No OneTemporary

File Metadata

Created
Wed, Apr 24, 11:50 AM
This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/3rdparty/README.md b/3rdparty/README.md
index be2ce3f3cc..ccdfe7be02 100644
--- a/3rdparty/README.md
+++ b/3rdparty/README.md
@@ -1,255 +1,241 @@
= CMake external projects to build krita's dependencies on Linux, Windows or OSX =
If you need to build Krita's dependencies for the following reasons:
-* you develop on Windows and aren't using Emerge
+* you develop on Windows and aren't using Craft
* you develop on OSX and aren't using Homebrew
* you want to build a generic, distro-agnostic version of Krita for Linux
* you develop on Linux, but some dependencies aren't available for your distribution
and you know what you're doing, you can use the following guide to build
the dependencies that Krita needs.
-If you develop on Linux and your distribution has the dependencies available,
+If you develop on Linux and your distribution has all dependencies available,
YOU DO NOT NEED THIS GUIDE AND YOU SHOULD STOP READING NOW
Otherwise you risk major confusion.
== Prerequisites ==
Note: on all operating systems the entire procedure is done in a terminal window.
1. git: https://git-scm.com/downloads. Make sure git is in your path
-2. cmake 3.3.2: https://cmake.org/download/. Make sure cmake is in your path.
+2. cmake 3.3.2 or later: https://cmake.org/download/. Make sure cmake is in your path.
3. Make sure you have a compiler:
* Linux: gcc, minimum version 4.8
* OSX: clang, you need to install xcode for this
* Windows: mingw-w64 5.4 (by mingw-builds)
- 32-bit (x86) target: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/5.4.0/threads-posix/dwarf/
- 64-bit (x64) target: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/5.4.0/threads-posix/seh/
Make sure mingw's bin folder is in your path. It might be a good
idea to create a batch file which sets the path and start cmd.
MSVC is *not* supported at the moment.
4. On Windows, you will also need Python 3.6: https://www.python.org. Make sure to have python.exe in your path. This version of python will be used for two things: to configure Qt and to build the python scripting module. Make sure the version you download is exactly python-3.6.1. Make sure Python is in your path.
== Setup your environment ==
== Prepare your directory layout ==
1. Make a toplevel build directory, say $HOME/dev or c:\dev. We'll refer to this directory as BUILDROOT. You can use a variable for this, on WINDOWS %BUILDROOT%, on OSX and Linux $BUILDROOT. You will have to replace BUILDROOT with $BUILDROOT or %BUILDROOT whenever you copy and paste a command, depending on your operating system.
2. Checkout krita in BUILDROOT
cd BUILDROOT
git clone git://anongit.kde.org/krita.git
3. Create the build directory
mkdir BUILDROOT/b
4. Create the downloads directory
mkdir BUILDROOT/d
5. Create the install directory
mkdir BUILDROOT/i
== Prepare the externals build ==
1. enter the BUILDROOT/b directory
-2. The cmake command needs to point to your BUILDROOT like /dev/d, not c:\dev\d.
-
- set PATH=BUILDROOT\i\bin\;BUILDROOT\i\lib;%PATH%
- cmake ..\krita\3rdparty -DEXTERNALS_DOWNLOAD_DIR=/dev/d -DINSTALL_ROOT=/dev/i -G "MinGW Makefiles"
-
-3. run cmake:
+2. run cmake:
* Linux:
export PATH=$BUILDROOT/i/bin
export PYTHONHOME=$BUILDROOT/i (only if you want to build your own python)
cmake ../krita/3rdparty \
-DINSTALL_ROOT=$BUILDROOT/i \
-DEXTERNALS_DOWNLOAD_DIR=$BUILDROOT/d \
-DCMAKE_INSTALL_PREFIX=BUILDROOT/i
* OSX:
export PATH=$BUILDROOT/i/bin
export PYTHONHOME=$BUILDROOT/i (only if you want to build your own python)
cmake ../krita/3rdparty/ \
-DCMAKE_INSTALL_PREFIX=$BUILDROOT/i \
-DEXTERNALS_DOWNLOAD_DIR=$BUILDROOT/d \
-DINSTALL_ROOT=$BUILDROOT/i
* Windows 32 bits:
TODO
* Windows 64 bits:
Note that the cmake command needs to point to your BUILDROOT like /dev/d, not c:\dev\d.
set PATH=%BUILDROOT%\i\bin\;%BUILDROOT%\i\lib;%PATH%
set PYTHONHOME=%BUILDROOT%/i (only if you want to build your own python)
set PATH=BUILDROOT\i\bin\;BUILDROOT\i\lib;%PATH%
cmake ..\krita\3rdparty -DEXTERNALS_DOWNLOAD_DIR=/dev/d -DINSTALL_ROOT=/dev/i -G "MinGW Makefiles"
-4. build the packages:
+3. build the packages:
With a judicious application of DEPENDS statements, it's possible to build it all in one go, but in my experience that fails always, so it's better to build the dependencies independently.
If you want to use the included version of Python (can be used on Windows to build Qt instead of installing Python separately):
cmake --build . --config RelWithDebInfo --target ext_python
On Windows:
cmake --build . --config RelWithDebInfo --target ext_patch
cmake --build . --config RelWithDebInfo --target ext_png2ico
cmake --build . --config RelWithDebInfo --target ext_gettext
On all operating systems:
cmake --build . --config RelWithDebInfo --target ext_qt
cmake --build . --config RelWithDebInfo --target ext_zlib
cmake --build . --config RelWithDebInfo --target ext_boost
Note about boost: check if the headers are installed into i/include/boost, but not into i/include/boost-1.61/boost
cmake --build . --config RelWithDebInfo --target ext_eigen3
cmake --build . --config RelWithDebInfo --target ext_exiv2
cmake --build . --config RelWithDebInfo --target ext_fftw3
On Windows:
set FFTW_LIB_DIR=%BUILDROOT%\i\lib
dlltool.exe -k --output-lib %FFTW_LIB_DIR%\libfftw3-3.a --input-def %FFTW_LIB_DIR%\libfftw3-3.def
dlltool.exe -k --output-lib %FFTW_LIB_DIR%\libfftw3f-3.a --input-def %FFTW_LIB_DIR%\libfftw3f-3.def
dlltool.exe -k --output-lib %FFTW_LIB_DIR%\libfftw3l-3.a --input-def %FFTW_LIB_DIR%\libfftw3l-3.def
On all operating systems
cmake --build . --config RelWithDebInfo --target ext_ilmbase
cmake --build . --config RelWithDebInfo --target ext_jpeg
cmake --build . --config RelWithDebInfo --target ext_lcms2
cmake --build . --config RelWithDebInfo --target ext_ocio
cmake --build . --config RelWithDebInfo --target ext_openexr
Note for OSX:
On OSX, you need to first build openexr; that will fail; then you need to set the rpath for the two utilities correctly, then try to build openexr again.
install_name_tool -add_rpath $BUILD_ROOT/i/lib $BUILD_ROOT/b/ext_openexr/ext_openexr-prefix/src/ext_openexr-build/IlmImf/./b44ExpLogTable
install_name_tool -add_rpath $BUILD_ROOT/i/lib $BUILD_ROOT/b/ext_openexr/ext_openexr-prefix/src/ext_openexr-build/IlmImf/./dwaLookups
On All operating systems:
cmake --build . --config RelWithDebInfo --target ext_png
cmake --build . --config RelWithDebInfo --target ext_tiff
cmake --build . --config RelWithDebInfo --target ext_gsl
cmake --build . --config RelWithDebInfo --target ext_vc
cmake --build . --config RelWithDebInfo --target ext_libraw
On Windows
cmake --build . --config RelWithDebInfo --target ext_freetype
cmake --build . --config RelWithDebInfo --target ext_poppler
On Linux
cmake --build . --config RelWithDebInfo --target ext_kcrash
Everywhere else:
cmake --build . --config RelWithDebInfo --target ext_kwindowsystem
On Windows, if you want to include DrMingw for dumping backtrace on crash:
cmake --build . --config RelWithDebInfo --target ext_drmingw
Note: poppler should be buildable on Linux as well with a home-built freetype
and fontconfig, but I don't know how to make fontconfig find freetype, and on
Linux, fontconfig is needed for poppler. Poppler is needed for PDF import.
Note 2: libcurl still isn't available.
Note 3: if you want to build a release, you need to get the binary gettext
archives from files.kde.org/krita/build/dependencies:
http://files.kde.org/krita/build/dependencies/gettext0.19.8.1-iconv1.14-shared-32.zip
http://files.kde.org/krita/build/dependencies/gettext0.19.8.1-iconv1.14-shared-64.zip
Take care, these zips contain a libstdc++-6.dll that you don't want in your path when building.
== Build Krita ==
1. Make a krita build directory:
mkdir BUILDROOT/build
2. Enter the BUILDROOT/build
3. Run
On Windows
Depending on what you want to use, run this command for MSBuild:
cmake ..\krita -G "MinGW Makefiles" -DBoost_DEBUG=OFF -DBOOST_INCLUDEDIR=c:\dev\i\include -DBOOST_DEBUG=ON -DBOOST_ROOT=c:\dev\i -DBOOST_LIBRARYDIR=c:\dev\i\lib -DCMAKE_INSTALL_PREFIX=c:\dev\i -DCMAKE_PREFIX_PATH=c:\dev\i -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DHAVE_MEMORY_LEAK_TRACKER=OFF -Wno-dev -DDEFINE_NO_DEPRECATED=1
Or this to use jom (faster compiling, uses all cores, ships with QtCreator/pre-built Qt binaries):
cmake ..\krita -G "MinGW Makefiles" -DBoost_DEBUG=OFF -DBOOST_INCLUDEDIR=c:\dev\i\include -DBOOST_DEBUG=ON -DBOOST_ROOT=c:\dev\i -DBOOST_LIBRARYDIR=c:\dev\i\lib -DCMAKE_INSTALL_PREFIX=c:\dev\i -DCMAKE_PREFIX_PATH=c:\dev\i -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DHAVE_MEMORY_LEAK_TRACKER=OFF -Wno-dev -DDEFINE_NO_DEPRECATED=1
On Linux
cmake ../krita -DCMAKE_INSTALL_PREFIX=BUILDROOT/i -DDEFINE_NO_DEPRECATED=1 -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfobg
On OSX
cmake ../krita -DCMAKE_INSTALL_PREFIX=$BUILDROOT/i -DDEFINE_NO_DEPRECATED=1 -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DBUNDLE_INSTALL_DIR=$BUILDROOT/i/bin -DCMAKE_BUILD_TYPE=RelWithDebInfo
4. Run
On Linux and OSX
make
make install
On Windows
Either use MSBuild to build (-- /m tells msbuild to use all your cores):
cmake --build . --config RelWithDebInfo --target INSTALL -- /m
Or use jom which should be in a path similar to C:\Qt\Qt5.6.0\Tools\QtCreator\bin\jom.exe.
So, from the same folder, instead of running cmake run:
"C:\Qt\Qt5.6.0\Tools\QtCreator\bin\jom.exe" install
6. Run krita:
On Linux
BUILDROOT/i/bin/krita
On Windows
BUILDROOT\i\bin\krita.exe
On OSX
BUILDROOT/i/bin/krita.app/Contents/MacOS/krita
== Packaging a Windows Build ==
If you want to create a stripped down version of Krita to distribute, after building everything just copy the makepkg.bat file from the "windows" folder inside krita root source folder to BUILDROOT and run it.
That will copy the necessary files into the specified folder and leave behind developer related files, so the resulting folder will be a smaller install folder.
-
-== Common Issues ==
-
-- On Windows, if you get a 'mspdb140.dll' missing alert window, it means you did not run the bat file. Make sure to include the quotes in the command:
- "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
-
-- On Windows, if you get an error about Qt5Core.dll missing/not found or nmake exit with an error that mention QT_PLUGIN_PATH, you have to copy a couple of dlls in the Qt build directory, look for the N.B. in the Qt instructions at the start of the Readme.
-
-- If you receive an error while compiling about "missing QtCore5.cmake", or something similar, check to make sure qmake is in your PATH. Restart your command line after any changes are made.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b77d01c676..a0f80c43fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,659 +1,663 @@
project(krita)
message(STATUS "Using CMake version: ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
set(MIN_QT_VERSION 5.6.0)
option(OVERRIDE_QT_VERSION "Use this to make it possible to build with Qt < 5.6.0. There will be bugs." OFF)
if (OVERRIDE_QT_VERSION)
set(MIN_QT_VERSION 5.4.0)
endif()
set(MIN_FRAMEWORKS_VERSION 5.7.0)
if (POLICY CMP0002)
cmake_policy(SET CMP0002 OLD)
endif()
if (POLICY CMP0017)
cmake_policy(SET CMP0017 NEW)
endif ()
if (POLICY CMP0022)
cmake_policy(SET CMP0022 OLD)
endif ()
if (POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif()
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if (POLICY CMP0046)
cmake_policy(SET CMP0046 OLD)
endif ()
if (POLICY CMP0059)
cmake_policy(SET CMP0059 OLD)
endif()
if (POLICY CMP0063)
cmake_policy(SET CMP0063 OLD)
endif()
if (POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif()
if (POLICY CMP0064)
cmake_policy(SET CMP0064 OLD)
endif()
if (APPLE)
set(APPLE_SUPPRESS_X11_WARNING TRUE)
set(KDE_SKIP_RPATH_SETTINGS TRUE)
set(CMAKE_MACOSX_RPATH 1)
set(BUILD_WITH_INSTALL_RPATH 1)
add_definitions(-mmacosx-version-min=10.9 -Wno-macro-redefined -Wno-deprecated-register)
endif()
+if (CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
+ add_definitions(-Werror=delete-incomplete)
+endif()
+
######################
#######################
## Constants defines ##
#######################
######################
# define common versions of Krita applications, used to generate kritaversion.h
# update these version for every release:
set(KRITA_VERSION_STRING "4.0.0-pre-alpha")
set(KRITA_STABLE_VERSION_MAJOR 4) # 3 for 3.x, 4 for 4.x, etc.
set(KRITA_STABLE_VERSION_MINOR 0) # 0 for 3.0, 1 for 3.1, etc.
set(KRITA_VERSION_RELEASE 0) # 88 for pre-alpha, 89 for Alpha, increase for next test releases, set 0 for first Stable, etc.
set(KRITA_ALPHA 1) # uncomment only for Alpha
#set(KRITA_BETA 1) # uncomment only for Beta
#set(KRITA_RC 1) # uncomment only for RC
set(KRITA_YEAR 2017) # update every year
if(NOT DEFINED KRITA_ALPHA AND NOT DEFINED KRITA_BETA AND NOT DEFINED KRITA_RC)
set(KRITA_STABLE 1) # do not edit
endif()
message(STATUS "Krita version: ${KRITA_VERSION_STRING}")
# Define the generic version of the Krita libraries here
# This makes it easy to advance it when the next Krita release comes.
# 14 was the last GENERIC_KRITA_LIB_VERSION_MAJOR of the previous Krita series
# (2.x) so we're starting with 15 in 3.x series, 16 in 4.x series
if(KRITA_STABLE_VERSION_MAJOR EQUAL 4)
math(EXPR GENERIC_KRITA_LIB_VERSION_MAJOR "${KRITA_STABLE_VERSION_MINOR} + 16")
else()
# let's make sure we won't forget to update the "16"
message(FATAL_ERROR "Reminder: please update offset == 16 used to compute GENERIC_KRITA_LIB_VERSION_MAJOR to something bigger")
endif()
set(GENERIC_KRITA_LIB_VERSION "${GENERIC_KRITA_LIB_VERSION_MAJOR}.0.0")
set(GENERIC_KRITA_LIB_SOVERSION "${GENERIC_KRITA_LIB_VERSION_MAJOR}")
LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
LIST (APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/kde_macro")
# fetch git revision for the current build
set(KRITA_GIT_SHA1_STRING "")
set(KRITA_GIT_BRANCH_STRING "")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
get_git_branch(GIT_BRANCH)
if(GIT_SHA1 AND GIT_BRANCH)
string(SUBSTRING ${GIT_SHA1} 0 7 GIT_SHA1)
set(KRITA_GIT_SHA1_STRING ${GIT_SHA1})
set(KRITA_GIT_BRANCH_STRING ${GIT_BRANCH})
endif()
if(NOT DEFINED RELEASE_BUILD)
# estimate mode by CMAKE_BUILD_TYPE content if not set on cmdline
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER)
set(RELEASE_BUILD_TYPES "release" "relwithdebinfo" "minsizerel")
list(FIND RELEASE_BUILD_TYPES "${CMAKE_BUILD_TYPE_TOLOWER}" INDEX)
if (INDEX EQUAL -1)
set(RELEASE_BUILD FALSE)
else()
set(RELEASE_BUILD TRUE)
endif()
endif()
message(STATUS "Release build: ${RELEASE_BUILD}")
# create test make targets
enable_testing()
# collect list of broken tests, empty here to start fresh with each cmake run
set(KRITA_BROKEN_TESTS "" CACHE INTERNAL "KRITA_BROKEN_TESTS")
############
#############
## Options ##
#############
############
include(FeatureSummary)
if (WIN32)
option(USE_DRMINGW "Support the Dr. Mingw crash handler (only on windows)" ON)
add_feature_info("Dr. Mingw" USE_DRMINGW "Enable the Dr. Mingw crash handler")
if (MINGW)
option(USE_MINGW_HARDENING_LINKER "Enable DEP (NX), ASLR and high-entropy ASLR linker flags (mingw-w64)" ON)
add_feature_info("Linker Security Flags" USE_MINGW_HARDENING_LINKER "Enable DEP (NX), ASLR and high-entropy ASLR linker flags")
if (USE_MINGW_HARDENING_LINKER)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat -Wl,--disable-auto-image-base")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat -Wl,--disable-auto-image-base")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat -Wl,--disable-auto-image-base")
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
# Enable high-entropy ASLR for 64-bit
# The image base has to be >4GB for HEASLR to be enabled.
# The values used here are kind of arbitrary.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x140000000")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x180000000")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x180000000")
endif ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
else (USE_MINGW_HARDENING_LINKER)
message(WARNING "Linker Security Flags not enabled!")
endif (USE_MINGW_HARDENING_LINKER)
endif (MINGW)
endif ()
option(HIDE_SAFE_ASSERTS "Don't show message box for \"safe\" asserts, just ignore them automatically and dump a message to the terminal." ON)
configure_file(config-hide-safe-asserts.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-hide-safe-asserts.h)
add_feature_info("Safe Asserts" HIDE_SAFE_ASSERTS "Don't show message box for \"safe\" asserts, just ignore them automatically and dump a message to the terminal.")
option(FOUNDATION_BUILD "A Foundation build is a binary release build that can package some extra things like color themes. Linux distributions that build and install Krita into a default system location should not define this option to true." OFF)
add_feature_info("Foundation Build" FOUNDATION_BUILD "A Foundation build is a binary release build that can package some extra things like color themes. Linux distributions that build and install Krita into a default system location should not define this option to true.")
option(KRITA_ENABLE_BROKEN_TESTS "Enable tests that are marked as broken" OFF)
add_feature_info("Enable Broken Tests" KRITA_ENABLE_BROKEN_TESTS "Runs broken test when \"make test\" is invoked (use -DKRITA_ENABLE_BROKEN_TESTS=ON to enable).")
include(MacroJPEG)
###########################################################
## Look for Python3. It is also searched by KF5, ##
## so we should request the correct version in advance ##
###########################################################
find_package(PythonInterp 3.0)
find_package(PythonLibrary 3.0)
########################
#########################
## Look for KDE and Qt ##
#########################
########################
-find_package(ECM 1.7.0 REQUIRED NOMODULE)
+find_package(ECM 5.19 REQUIRED NOMODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(ECMOptionalAddSubdirectory)
include(ECMAddAppIcon)
include(ECMSetupVersion)
include(ECMMarkNonGuiExecutable)
include(ECMGenerateHeaders)
include(GenerateExportHeader)
include(ECMMarkAsTest)
include(ECMInstallIcons)
include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
include(CheckFunctionExists)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
# do not reorder to be alphabetical: this is the order in which the frameworks
# depend on each other.
find_package(KF5 ${MIN_FRAMEWORKS_VERSION} REQUIRED COMPONENTS
Archive
Config
WidgetsAddons
Completion
CoreAddons
GuiAddons
I18n
ItemModels
ItemViews
WindowSystem
)
# KConfig deprecated authorizeKAction. In order to be warning free,
# compile with the updated function when the dependency is new enough.
# Remove this (and the uses of the define) when the minimum KF5
# version is >= 5.24.0.
if (${KF5Config_VERSION} VERSION_LESS "5.24.0" )
message("Old KConfig (< 5.24.0) found.")
add_definitions(-DKCONFIG_BEFORE_5_24)
endif()
find_package(Qt5 ${MIN_QT_VERSION}
REQUIRED COMPONENTS
Core
Gui
Widgets
Xml
Network
PrintSupport
Svg
Test
Concurrent
)
include (MacroAddFileDependencies)
include (MacroBoolTo01)
include (MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("Compiling Krita inside the source directory is not possible. Please refer to the build instruction https://community.kde.org/Krita#Build_Instructions")
# Note: OPTIONAL_COMPONENTS does not seem to be reliable
# (as of ECM 5.15.0, CMake 3.2)
find_package(Qt5Multimedia ${MIN_QT_VERSION})
set_package_properties(Qt5Multimedia PROPERTIES
DESCRIPTION "Qt multimedia integration"
URL "http://www.qt.io/"
TYPE OPTIONAL
PURPOSE "Optionally used to provide sound support for animations")
macro_bool_to_01(Qt5Multimedia_FOUND HAVE_QT_MULTIMEDIA)
configure_file(config-qtmultimedia.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-qtmultimedia.h )
if (NOT WIN32 AND NOT APPLE)
find_package(Qt5 ${MIN_QT_VERSION} REQUIRED X11Extras)
find_package(Qt5DBus ${MIN_QT_VERSION})
set(HAVE_DBUS ${Qt5DBus_FOUND})
set_package_properties(Qt5DBus PROPERTIES
DESCRIPTION "Qt DBUS integration"
URL "http://www.qt.io/"
TYPE OPTIONAL
PURPOSE "Optionally used to provide a dbus api on Linux")
find_package(KF5KIO ${MIN_FRAMEWORKS_VERSION})
macro_bool_to_01(KF5KIO_FOUND HAVE_KIO)
set_package_properties(KF5KIO PROPERTIES
DESCRIPTION "KDE's KIO Framework"
URL "http://api.kde.org/frameworks-api/frameworks5-apidocs/kio/html/index.html"
TYPE OPTIONAL
PURPOSE "Optionally used for recent document handling")
find_package(KF5Crash ${MIN_FRAMEWORKS_VERSION})
macro_bool_to_01(KF5Crash_FOUND HAVE_KCRASH)
set_package_properties(KF5Crash PROPERTIES
DESCRIPTION "KDE's Crash Handler"
URL "http://api.kde.org/frameworks-api/frameworks5-apidocs/kcrash/html/index.html"
TYPE OPTIONAL
PURPOSE "Optionally used to provide crash reporting on Linux")
find_package(X11 REQUIRED COMPONENTS Xinput)
set(HAVE_X11 TRUE)
add_definitions(-DHAVE_X11)
find_package(XCB COMPONENTS XCB ATOM)
set(HAVE_XCB ${XCB_FOUND})
else()
set(HAVE_DBUS FALSE)
set(HAVE_X11 FALSE)
set(HAVE_XCB FALSE)
endif()
add_definitions(
-DQT_USE_QSTRINGBUILDER
-DQT_STRICT_ITERATORS
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_USE_FAST_CONCATENATION
-DQT_NO_URL_CAST_FROM_STRING
-DQT_DISABLE_DEPRECATED_BEFORE=0
)
add_definitions(-DTRANSLATION_DOMAIN=\"krita\")
#
# The reason for this mode is that the Debug mode disable inlining
#
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_KRITADEVS "-O3 -g" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
endif()
if(UNIX)
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m")
endif()
if(WIN32)
if(MSVC)
# C4522: 'class' : multiple assignment operators specified
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4522")
endif()
endif()
# enable exceptions globally
kde_enable_exceptions()
# only with this definition will all the FOO_TEST_EXPORT macro do something
# TODO: check if this can be moved to only those places which make use of it,
# to reduce global compiler definitions that would trigger a recompile of
# everything on a change (like adding/removing tests to/from the build)
if(BUILD_TESTING)
add_definitions(-DCOMPILING_TESTS)
endif()
set(KRITA_DEFAULT_TEST_DATA_DIR ${CMAKE_SOURCE_DIR}/sdk/tests/data/)
macro(macro_add_unittest_definitions)
add_definitions(-DFILES_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/")
add_definitions(-DFILES_OUTPUT_DIR="${CMAKE_CURRENT_BINARY_DIR}")
add_definitions(-DFILES_DEFAULT_DATA_DIR="${KRITA_DEFAULT_TEST_DATA_DIR}")
add_definitions(-DSYSTEM_RESOURCES_DATA_DIR="${CMAKE_SOURCE_DIR}/krita/data/")
endmacro()
# overcome some platform incompatibilities
if(WIN32)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/winquirks)
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DNOMINMAX)
set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib)
endif()
# set custom krita plugin installdir
set(KRITA_PLUGIN_INSTALL_DIR ${LIB_INSTALL_DIR}/kritaplugins)
###########################
############################
## Required dependencies ##
############################
###########################
find_package(PNG REQUIRED)
if (APPLE)
# this is not added correctly on OSX -- see http://forum.kde.org/viewtopic.php?f=139&t=101867&p=221242#p221242
include_directories(SYSTEM ${PNG_INCLUDE_DIR})
endif()
add_definitions(-DBOOST_ALL_NO_LIB)
find_package(Boost REQUIRED COMPONENTS system) # for pigment and stage
include_directories(${Boost_INCLUDE_DIRS})
##
## Test for GNU Scientific Library
##
find_package(GSL)
set_package_properties(GSL PROPERTIES
URL "http://www.gnu.org/software/gsl"
TYPE RECOMMENDED
PURPOSE "Required by Krita's Transform tool.")
macro_bool_to_01(GSL_FOUND HAVE_GSL)
configure_file(config-gsl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gsl.h )
###########################
############################
## Optional dependencies ##
############################
###########################
##
## Check for OpenEXR
##
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "Compression library"
URL "http://www.zlib.net/"
TYPE OPTIONAL
PURPOSE "Optionally used by the G'Mic and the PSD plugins")
macro_bool_to_01(ZLIB_FOUND HAVE_ZLIB)
find_package(OpenEXR)
set_package_properties(OpenEXR PROPERTIES
DESCRIPTION "High dynamic-range (HDR) image file format"
URL "http://www.openexr.com"
TYPE OPTIONAL
PURPOSE "Required by the Krita OpenEXR filter")
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
set(LINK_OPENEXR_LIB)
if(OPENEXR_FOUND)
include_directories(SYSTEM ${OPENEXR_INCLUDE_DIR})
set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES})
add_definitions(${OPENEXR_DEFINITIONS})
endif()
find_package(TIFF)
set_package_properties(TIFF PROPERTIES
DESCRIPTION "TIFF Library and Utilities"
URL "http://www.remotesensing.org/libtiff"
TYPE OPTIONAL
PURPOSE "Required by the Krita TIFF filter")
find_package(JPEG)
set_package_properties(JPEG PROPERTIES
DESCRIPTION "Free library for JPEG image compression. Note: libjpeg8 is NOT supported."
URL "http://www.libjpeg-turbo.org"
TYPE OPTIONAL
PURPOSE "Required by the Krita JPEG filter")
set(LIBRAW_MIN_VERSION "0.16")
find_package(LibRaw ${LIBRAW_MIN_VERSION})
set_package_properties(LibRaw PROPERTIES
DESCRIPTION "Library to decode RAW images"
URL "http://www.libraw.org"
TYPE OPTIONAL
PURPOSE "Required to build the raw import plugin")
find_package(FFTW3)
set_package_properties(FFTW3 PROPERTIES
DESCRIPTION "A fast, free C FFT library"
URL "http://www.fftw.org/"
TYPE OPTIONAL
PURPOSE "Required by the Krita for fast convolution operators and some G'Mic features")
macro_bool_to_01(FFTW3_FOUND HAVE_FFTW3)
find_package(OCIO)
set_package_properties(OCIO PROPERTIES
DESCRIPTION "The OpenColorIO Library"
URL "http://www.opencolorio.org"
TYPE OPTIONAL
PURPOSE "Required by the Krita LUT docker")
macro_bool_to_01(OCIO_FOUND HAVE_OCIO)
##
## Look for OpenGL
##
# TODO: see if there is a better check for QtGui being built with opengl support (and thus the QOpenGL* classes)
if(Qt5Gui_OPENGL_IMPLEMENTATION)
message(STATUS "Found QtGui OpenGL support")
else()
message(FATAL_ERROR "Did NOT find QtGui OpenGL support. Check your Qt configuration. You cannot build Krita without Qt OpenGL support.")
endif()
##
## Test for eigen3
##
find_package(Eigen3 REQUIRED "3.0")
set_package_properties(Eigen3 PROPERTIES
DESCRIPTION "C++ template library for linear algebra"
URL "http://eigen.tuxfamily.org"
TYPE REQUIRED)
##
## Test for exiv2
##
set(EXIV2_MIN_VERSION "0.16")
find_package(Exiv2 REQUIRED)
set_package_properties(Exiv2 PROPERTIES
DESCRIPTION "Image metadata library and tools"
URL "http://www.exiv2.org"
PURPOSE "Required by Krita")
##
## Test for lcms
##
find_package(LCMS2 REQUIRED "2.4")
set_package_properties(LCMS2 PROPERTIES
DESCRIPTION "LittleCMS Color management engine"
URL "http://www.littlecms.com"
TYPE REQUIRED
PURPOSE "Will be used for color management and is necessary for Krita")
if(LCMS2_FOUND)
if(NOT ${LCMS2_VERSION} VERSION_LESS 2040 )
set(HAVE_LCMS24 TRUE)
endif()
set(HAVE_REQUIRED_LCMS_VERSION TRUE)
set(HAVE_LCMS2 TRUE)
endif()
##
## Test for Vc
##
set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} )
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
set(HAVE_VC FALSE)
if( NOT MSVC)
find_package(Vc 1.1.0)
set_package_properties(Vc PROPERTIES
DESCRIPTION "Portable, zero-overhead SIMD library for C++"
URL "https://github.com/VcDevel/Vc"
TYPE OPTIONAL
PURPOSE "Required by the Krita for vectorization")
macro_bool_to_01(Vc_FOUND HAVE_VC)
endif()
configure_file(config-vc.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-vc.h )
if(HAVE_VC)
message(STATUS "Vc found!")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/vc")
include (VcMacros)
if(Vc_COMPILER_IS_CLANG)
set(ADDITIONAL_VC_FLAGS "-Wabi -ffp-contract=fast -fPIC")
elseif (NOT MSVC)
set(ADDITIONAL_VC_FLAGS "-Wabi -fabi-version=0 -ffp-contract=fast -fPIC")
endif()
#Handle Vc master
if(Vc_COMPILER_IS_GCC OR Vc_COMPILER_IS_CLANG)
AddCompilerFlag("-std=c++11" _ok)
if(NOT _ok)
AddCompilerFlag("-std=c++0x" _ok)
endif()
endif()
macro(ko_compile_for_all_implementations_no_scalar _objs _src)
vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY SSE2 SSSE3 SSE4_1 AVX AVX2+FMA+BMI2)
endmacro()
macro(ko_compile_for_all_implementations _objs _src)
vc_compile_for_all_implementations(${_objs} ${_src} FLAGS ${ADDITIONAL_VC_FLAGS} ONLY Scalar SSE2 SSSE3 SSE4_1 AVX AVX2+FMA+BMI2)
endmacro()
endif()
set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH} )
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
if(WIN32)
set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS}
ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} )
endif()
##
## Test endianess
##
include (TestBigEndian)
test_big_endian(CMAKE_WORDS_BIGENDIAN)
##
## Test for qt-poppler
##
-find_package(Poppler)
+find_package(Poppler COMPONENTS Qt5)
set_package_properties(Poppler PROPERTIES
DESCRIPTION "A PDF rendering library"
URL "http://poppler.freedesktop.org"
TYPE OPTIONAL
PURPOSE "Required by the Krita PDF filter.")
##
## Test for pthreads (for G'Mic)
##
find_package(Threads)
set_package_properties(Threads PROPERTIES
DESCRIPTION "PThreads - A low-level threading library"
TYPE OPTIONAL
PURPOSE "Optionally used by the G'Mic plugin")
##
## Test for OpenMP (for G'Mic)
##
find_package(OpenMP)
set_package_properties(OpenMP PROPERTIES
DESCRIPTION "A low-level parallel execution library"
URL "http://openmp.org/wp/"
TYPE OPTIONAL
PURPOSE "Optionally used by the G'Mic plugin")
##
## Test for Curl (for G'Mic)
##
find_package(CURL)
set_package_properties(CURL PROPERTIES
DESCRIPTION "A tool to fetch remote data"
URL "http://curl.haxx.se/"
TYPE OPTIONAL
PURPOSE "Optionally used by the G'Mic plugin")
############################
#############################
## Add Krita helper macros ##
#############################
############################
include(MacroKritaAddBenchmark)
####################
#####################
## Define includes ##
#####################
####################
# for config.h and <toplevel/foo.h> includes (if any?)
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/interfaces
)
add_subdirectory(libs)
add_subdirectory(plugins)
add_subdirectory(benchmarks)
add_subdirectory(krita)
configure_file(KoConfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/KoConfig.h )
configure_file(config_convolution.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_convolution.h)
configure_file(config-ocio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-ocio.h )
check_function_exists(powf HAVE_POWF)
configure_file(config-powf.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powf.h)
message("\nBroken tests:")
foreach(tst ${KRITA_BROKEN_TESTS})
message(" * ${tst}")
endforeach()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/README.md b/README.md
index ea84a029de..9aa3143c9c 100644
--- a/README.md
+++ b/README.md
@@ -1,47 +1,47 @@
![Picture](https://krita.org/wp-content/uploads/2016/04/krita_logo_200-ef21fd67a8add4f0.png)
Krita is a free and open source digital painting application. It is for artists who want to create professional work from start to end. Krita is used by comic book artists, illustrators, concept artists, matte and texture painters and in the digital VFX industry.
If you are reading this on Github, be aware that this is just a mirror. Our real
code repository is provided by KDE: https://phabricator.kde.org/source/krita/
This repository contains the current, Qt5-based, development version of Krita 3. Krita 3.0 has been released and development on Krita 2.9 has stopped. Krita 2.9 was part of Calligra: https://phabricator.kde.org/source/krita/
-![Picture] (https://krita.org/wp-content/uploads/2016/04/krita-30-screenshot.jpg)
+![Picture](https://krita.org/wp-content/uploads/2016/04/krita-30-screenshot.jpg)
### User Manual
https://docs.krita.org/Category:User_Manual
### Development Notes and Build Instructions
If you're building on Windows or OSX you'll need to build some third-party dependencies first. You should look at the README in the 3rdparty folder for directions.
If you're building on Linux, please follow David Revoy's Cat Guide: http://www.davidrevoy.com/article193/guide-building-krita-on-linux-for-cats
Other developer guides, notes and wiki:
https://community.kde.org/Krita
Apidox:
https://api.kde.org/bundled-apps-api/krita-apidocs/
### Bugs and Wishes
https://bugs.kde.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=ASSIGNED&bug_status=REOPENED&list_id=1315444&product=krita&query_format=advanced
### Discussion Forum
http://forum.kde.org/viewforum.php?f=136
### IRC channel
Most of the developers hang out here. If you are interested in helping with the project this is a great place to start. Many of the developers based in Europe so they may be offline depending on when you join.
irc.freenode.net, #krita
### Project Website
http://www.krita.org
### License
Krita as a whole is licensed under the GNU Public License, Version 3. Individual files may have a different, but compatible license.
diff --git a/benchmarks/kis_projection_benchmark.cpp b/benchmarks/kis_projection_benchmark.cpp
index 3a1ff0b043..1bb98f2d0d 100644
--- a/benchmarks/kis_projection_benchmark.cpp
+++ b/benchmarks/kis_projection_benchmark.cpp
@@ -1,62 +1,67 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý lukast.dev@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QTest>
#include "kis_projection_benchmark.h"
#include "kis_benchmark_values.h"
#include <KoColor.h>
#include <kis_group_layer.h>
#include <kis_paint_device.h>
#include <KisDocument.h>
#include <kis_image.h>
#include <KisPart.h>
void KisProjectionBenchmark::initTestCase()
{
}
void KisProjectionBenchmark::cleanupTestCase()
{
}
void KisProjectionBenchmark::benchmarkProjection()
{
- QBENCHMARK{
- KisDocument *doc = KisPart::instance()->createDocument();
- doc->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test.kra");
- doc->image()->refreshGraph();
- doc->exportDocument(QUrl::fromLocalFile(QString(FILES_OUTPUT_DIR) + QDir::separator() + "save_test.kra"));
- delete doc;
+ KisDocument *doc = KisPart::instance()->createDocument();
+ doc->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test.kra");
+
+ qApp->processEvents();
+ QTest::qWait(100);
+
+ QBENCHMARK_ONCE {
+ doc->image()->refreshGraphAsync();
+ doc->image()->waitForDone();
}
+
+ delete doc;
}
void KisProjectionBenchmark::benchmarkLoading()
{
QBENCHMARK{
KisDocument *doc2 = KisPart::instance()->createDocument();
doc2->loadNativeFormat(QString(FILES_DATA_DIR) + QDir::separator() + "load_test.kra");
delete doc2;
}
}
QTEST_MAIN(KisProjectionBenchmark)
diff --git a/cmake/modules/FindPoppler.cmake b/cmake/modules/FindPoppler.cmake
deleted file mode 100644
index ba2fff22ad..0000000000
--- a/cmake/modules/FindPoppler.cmake
+++ /dev/null
@@ -1,106 +0,0 @@
-# - Try to find the poppler PDF library
-# Once done this will define
-#
-# POPPLER_FOUND - system has poppler
-# POPPLER_INCLUDE_DIR - the poppler include directory
-# POPPLER_LIBRARY - Link this to use poppler
-#
-
-# Copyright (c) 2006-2010, Pino Toscano, <pino@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY)
-
- # in cache already
- set(POPPLER_FOUND TRUE)
-
-else()
-
-set(_poppler_version_bad FALSE)
-
-if(NOT WIN32)
- # use pkg-config to get the directories and then use these values
- # in the FIND_PATH() and FIND_LIBRARY() calls
- include(FindPkgConfig)
- pkg_check_modules(_pc_poppler poppler-qt5)
- if(_pc_poppler_FOUND)
- if(NOT "${_pc_poppler_VERSION}" VERSION_GREATER 0.5.3)
- set(_poppler_version_bad TRUE)
- endif()
- endif()
-endif()
-
-if(NOT _poppler_version_bad)
- set(POPPLER_FOUND FALSE)
-
- find_library(POPPLER_LIBRARY poppler-qt5
- HINTS ${_pc_poppler_LIBRARY_DIRS}
- )
- find_library(POPPLER_CORE_LIBRARY poppler
- HINTS ${_pc_poppler_LIBRARY_DIRS}
- )
-
- find_path(POPPLER_INCLUDE_DIR poppler-qt5.h
- HINTS ${_pc_poppler_INCLUDE_DIRS}
- PATH_SUFFIXES poppler/qt5
- )
- find_path(POPPLER_INCLUDE_DIR_core qt5/poppler-qt5.h
- HINTS ${_pc_poppler_INCLUDE_DIRS}
- PATH_SUFFIXES poppler
- )
-
- if(POPPLER_LIBRARY AND POPPLER_INCLUDE_DIR AND POPPLER_INCLUDE_DIR_core)
- list(APPEND POPPLER_INCLUDE_DIR "${POPPLER_INCLUDE_DIR_core}")
- set(POPPLER_FOUND TRUE)
- endif()
-endif()
-
-if (POPPLER_FOUND)
- include(CheckCXXSourceCompiles)
-
- set(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIR} ${QT_INCLUDE_DIR})
- set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${POPPLER_CORE_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
-
-check_cxx_source_compiles("
-#include <poppler-qt5.h>
-int main()
-{
- Poppler::Document::RenderHint hint = Poppler::Document::ThinLineSolid;
- return 0;
-}
-" HAVE_POPPLER_0_24)
-
-check_cxx_source_compiles("
-#include <poppler-qt5.h>
-int main()
-{
- Poppler::Page *p = 0;
- p->annotations( QSet<Poppler::Annotation::SubType>() << Poppler::Annotation::ASound );
- return 0;
-}
-" HAVE_POPPLER_0_28)
-
- set(CMAKE_REQUIRED_INCLUDES)
- set(CMAKE_REQUIRED_LIBRARIES)
- if (HAVE_POPPLER_0_28)
- set(popplerVersionMessage "0.28")
- elseif (HAVE_POPPLER_0_24)
- set(popplerVersionMessage "0.24")
- endif ()
- if (NOT Poppler_FIND_QUIETLY)
- message(STATUS "Found Poppler-Qt5: ${POPPLER_LIBRARY}, (>= ${popplerVersionMessage})")
- endif ()
-else ()
- if (Poppler_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find Poppler-Qt5")
- endif ()
- message(STATUS "Could not find OPTIONAL package Poppler-Qt5")
-endif ()
-
-# ensure that they are cached
-set(POPPLER_INCLUDE_DIR ${POPPLER_INCLUDE_DIR} CACHE INTERNAL "The Poppler-Qt5 include path")
-set(POPPLER_LIBRARY ${POPPLER_LIBRARY} CACHE INTERNAL "The Poppler-Qt5 library")
-
-endif()
diff --git a/krita/data/templates/animation/.directory b/krita/data/templates/animation/.directory
index 351b8d2e3f..a462f96be0 100644
--- a/krita/data/templates/animation/.directory
+++ b/krita/data/templates/animation/.directory
@@ -1,17 +1,18 @@
[Desktop Entry]
Name=Animation Templates
Name[ca]=Plantilles d'animació
Name[ca@valencia]=Plantilles d'animació
Name[cs]=Šablony animací:
Name[de]=Animations-Vorlagen
Name[en_GB]=Animation Templates
Name[es]=Plantillas de animación
Name[it]=Modelli di animazioni
Name[nl]=Animatiesjablonen
Name[pl]=Szablony animacji
Name[pt]=Modelos de Animações
Name[pt_BR]=Modelos de animação
Name[sv]=Animeringsmallar
+Name[tr]=Canlandırma Şablonları
Name[uk]=Шаблони анімацій
Name[x-test]=xxAnimation Templatesxx
X-KDE-DefaultTab=true
diff --git a/krita/data/templates/animation/Anim-Jp-EN.desktop b/krita/data/templates/animation/Anim-Jp-EN.desktop
index 46f2baa38f..84fb9a835f 100644
--- a/krita/data/templates/animation/Anim-Jp-EN.desktop
+++ b/krita/data/templates/animation/Anim-Jp-EN.desktop
@@ -1,23 +1,24 @@
[Desktop Entry]
Type=Link
URL=.source/Anim-Jp-EN.kra
Icon=template_animation
Name=Animation-Japanese-En
Name[ca]=Animació-Japonès-EN
Name[ca@valencia]=Animació-Japonés-EN
Name[de]=Animation-Japanisch-En
Name[en_GB]=Animation-Japanese-En
Name[es]=Animación-Japonés-En
Name[et]=Animation-Japanese-En
Name[it]=Animazione-Giapponese-EN
Name[ja]=日本式アニメ(英語版)
Name[nl]=Animatie-Japans-En
Name[pl]=Animacja-Japońska-En
Name[pt]=Animação-Japonês-EN
Name[pt_BR]=Animation-Japanese-En
Name[ru]=Анимация-японская-англ
Name[sk]=Animation-Japanese-En
Name[sv]=Animering-japanska-en
+Name[tr]=Canlandırma-Japonca-İngilizce
Name[uk]=Японська анімація (англійською)
Name[x-test]=xxAnimation-Japanese-Enxx
Name[zh_CN]=日本动画 (英式)
diff --git a/krita/data/templates/animation/Anim-Jp-JP.desktop b/krita/data/templates/animation/Anim-Jp-JP.desktop
index 166deb207f..ecfc3e629d 100644
--- a/krita/data/templates/animation/Anim-Jp-JP.desktop
+++ b/krita/data/templates/animation/Anim-Jp-JP.desktop
@@ -1,23 +1,24 @@
[Desktop Entry]
Type=Link
URL=.source/Anim-Jp-JP.kra
Icon=template_animation
Name=Animation-Japanese-JP
Name[ca]=Animació-Japonès-JP
Name[ca@valencia]=Animació-Japonés-JP
Name[de]=Animation-Japanisch-JP
Name[en_GB]=Animation-Japanese-JP
Name[es]=Animación-Japonés-JP
Name[et]=Animation-Japanese-JP
Name[it]=Animazione-Giapponese-JP
Name[ja]=日本式アニメ(日本語版)
Name[nl]=Animatie-Japans-JP
Name[pl]=Animacja-Japońska-JP
Name[pt]=Animação-Japonês-JP
Name[pt_BR]=Animation-Japanese-JP
Name[ru]=Анимация-японская-японск
Name[sk]=Animation-Japanese-JP
Name[sv]=Animering-japanska-jp
+Name[tr]=Canlandırma-Japonca-JP
Name[uk]=Японська анімація (японською)
Name[x-test]=xxAnimation-Japanese-JPxx
Name[zh_CN]=日本动画 (日式)
diff --git a/krita/data/templates/comics/BD-EuroTemplate.desktop b/krita/data/templates/comics/BD-EuroTemplate.desktop
index 04f0f9c6ae..ce68d34a2c 100644
--- a/krita/data/templates/comics/BD-EuroTemplate.desktop
+++ b/krita/data/templates/comics/BD-EuroTemplate.desktop
@@ -1,73 +1,74 @@
[Desktop Entry]
Type=Link
URL=.source/BD-EuroTemplate.kra
Icon=template_comics_empty
Name=European BD template
Name[bs]=Evropski BD predložak
Name[ca]=Plantilla europea BD
Name[ca@valencia]=Plantilla europea BD
Name[da]=Europæisk BD-skabelon
Name[de]=Europäische „Bande Dessinée (BD)“-Vorlage
Name[el]=Ευρωπαϊκό BD πρότυπο
Name[en_GB]=European BD template
Name[es]=plantilla de cómic europeo
Name[et]=Euroopa BD mall
Name[eu]=Europako BD-txantiloia
Name[fi]=Eurooppalainen BD-pohja
Name[fr]=Modèle européen de bandes dessinées
Name[gl]=Formato europeo (2×4 viñetas)
Name[hu]=Európai BD sablon
Name[it]=Modello MD europeo
Name[ja]=バンドデシネテンプレート
Name[kk]=Еуропалық BD үлгісі
Name[lt]=Europos DB šablonas
Name[nb]=Europeisk BD-mal
Name[nds]=Europääsch BD-Vörlaag
Name[nl]=Europees BD-sjabloon
Name[pl]=Europejski szablon BD
Name[pt]=Modelo de BD Europeia
Name[pt_BR]=Modelo Europeu BD
Name[ru]=Шаблон в европейском стиле (BD)
Name[sk]=Európska BD šablóna
Name[sl]=Evropska predloga BD
Name[sv]=Europeisk BD-mall
Name[tr]=Avrupa BD Şablonu
Name[uk]=Європейський шаблон BD
Name[wa]=Modele di binde d' imådje a l' uropeyinne
Name[x-test]=xxEuropean BD templatexx
Name[zh_CN]=欧洲 BD 模板
Name[zh_TW]=歐式 BD 樣本
Comment=template for European BD-style comics
Comment[bs]=predložak za evropske BD stripove
Comment[ca]=plantilla per a còmics d'estil BD europeu
Comment[ca@valencia]=plantilla per a còmics d'estil BD europeu
Comment[da]=Skabelon til tegneserier i europæisk BD-stil
Comment[de]=Vorlage für Comics im europäischen „Bande Dessinée“-Stil
Comment[el]=πρότυπο για Ευρωπαϊκά BD-style κόμικς
Comment[en_GB]=template for European BD-style comics
Comment[es]=plantilla para cómics de estilo europeo
Comment[et]=Euroopa BD-stiilis koomiksi mall
Comment[eu]=Europako BD estiloko komikietarako txantiloia
Comment[fi]=Eurooppalaisen BD-tyylin sarjakuvan pohja
Comment[fr]=Modèle européen de bandes dessinées
Comment[gl]=Páxina de banda deseñada de formato europeo, con 2×4 viñetas regulares.
Comment[hu]=sablon az európai BD-stílusú képregényekhez
Comment[it]=modello per fumetti in stile BD europeo
Comment[ja]=バンドデシネ式コミック用テンプレート
Comment[kk]=Еуропалық BD-стильдегі комикс үлгісі
Comment[nb]=mal for europeiske tegneserier i BD-stil
Comment[nds]=BD-Vörlaag för europääsche Comics
Comment[nl]=sjabloon voor Europese strips in BD-stijl
Comment[pl]=szablon dla Europejskiego stylu komików BD
Comment[pt]=modelo de banda desenhada do estilo Europeu
Comment[pt_BR]=Modelo de quadrinhos no estilo Europeu BD
Comment[ru]=Шаблон комиксов в европейском стиле (BD)
Comment[sk]=šablóna pre európske BD komixy
Comment[sl]=predloga za stripe v evropskem slogu BD
Comment[sv]=seriemall med europeisk BD-stil
+Comment[tr]=Avrupa BD tarzı çizgi romanlar için şablon
Comment[uk]=шаблон для європейських коміксів у стилі BD
Comment[wa]=Modele po les bindes d' imådje al môde uropeyinne
Comment[x-test]=xxtemplate for European BD-style comicsxx
Comment[zh_CN]=欧洲 BD 式漫画模板
Comment[zh_TW]=歐式 BD-樣式漫畫的樣本
X-Krita-Version=28
diff --git a/krita/data/templates/comics/Comics-USTemplate.desktop b/krita/data/templates/comics/Comics-USTemplate.desktop
index 561e281151..f3de5e702d 100644
--- a/krita/data/templates/comics/Comics-USTemplate.desktop
+++ b/krita/data/templates/comics/Comics-USTemplate.desktop
@@ -1,76 +1,78 @@
[Desktop Entry]
Type=Link
URL=.source/Comics-USTemplate.kra
Icon=template_comics_empty
Name=US-style comics template
Name[bs]=Američki strip predložak
Name[ca]=plantilla de còmics d'estil americà
Name[ca@valencia]=plantilla de còmics d'estil americà
Name[cs]=Šablona komixu v americkém stylu
Name[da]=Tegneserieskabelon i amerikansk stil
Name[de]=US-Design-Comicvorlage
Name[el]=Πρότυπο κόμικς US-style
Name[en_GB]=US-style comics template
Name[es]=plantilla de cómic de estilo estadounidense
Name[et]=USA stiilis koomiksi mall
Name[eu]=AEBko estiloko komiki-txantiloia
Name[fi]=Yhdysvaltalaistyylinen sarjakuvapohja
Name[fr]=Modèle US de bande dessinée
Name[gl]=Formato estadounidense (2×3 viñetas)
Name[hu]=US-stílusú képregénysablon
Name[it]=Modello per fumetti in stile americano
Name[ja]=アメリカ式コミックテンプレート
Name[kk]=АҚШ-стильді комикс үлгісі
Name[ko]=미국식 만화 서식
Name[lt]=JAV stiliaus komiksų šablonas
Name[nb]=Tegneseriemal i USA-stil
Name[nds]=Amerikaansch Comicvörlaag
Name[nl]=sjabloon voor strips in US-stijl
Name[pl]=Szablon komiksów Amerykańskiego stylu
Name[pt]=Modelo de banda desenhada dos EUA
Name[pt_BR]=Modelo de quadrinhos no estilo americano
Name[ru]=Шаблон в американском стиле
Name[sk]=šablóna pre americké komixy
Name[sl]=Predloga za stripe v ameriškem slogu
Name[sv]=Seriemall med amerikansk stil
+Name[tr]=US tarzı çizgi roman şablonu
Name[uk]=Шаблон коміксів у американському стилі
Name[wa]=Modele comics a l' amerikinnes
Name[x-test]=xxUS-style comics templatexx
Name[zh_CN]=美式漫画模板
Name[zh_TW]=美式漫畫樣本
Comment=template for US-style comics
Comment[bs]=predložak za stripove američkog stila
Comment[ca]=plantilla per a còmics d'estil americà
Comment[ca@valencia]=plantilla per a còmics d'estil americà
Comment[cs]=šablona pro komiksy v americkém stylu
Comment[da]=skabelon til tegneserier i amerikansk stil
Comment[de]=Vorlage für Comics im US-Stil
Comment[el]=πρότυπο για US-style κόμικς
Comment[en_GB]=template for US-style comics
Comment[es]=plantilla para cómics de estilo estadounidense
Comment[et]=USA stiilis koomiksi mall
Comment[eu]=AEBko estiloko komikietarako txantiloia
Comment[fi]=yhdysvaltalaistyylisen sarjakuvan pohja
Comment[fr]=Modèle US de bandes dessinées
Comment[gl]=Páxina de banda deseñada de formato estadounidense, con 2×3 viñetas regulares.
Comment[hu]=sablon a US-stílusú képregényekhez
Comment[it]=modello per fumetti in stile americano
Comment[ja]=アメリカ式コミック用テンプレート
Comment[kk]=АҚШ-стильдегі комикс үлгісі
Comment[ko]=미국식 만화 서식
Comment[nb]=mal for tegneserier i US-stil
Comment[nds]=Vörlaag för amerikaansche Comics
Comment[nl]=sjabloon voor strips in US-stijl
Comment[pl]=szablon dla Amerykańskiego stylu komiksów
Comment[pt]=modelo de banda desenhada do estilo dos EUA
Comment[pt_BR]=Modelo de quadrinhos no estilo americano
Comment[ru]=Шаблон комиксов в американском стиле
Comment[sk]=šablóna pre americké komixy
Comment[sl]=predloga za stripe v ameriškem slogu
Comment[sv]=seriemall med amerikansk stil
+Comment[tr]=US tarzı çizgi romanlar için şablon
Comment[uk]=шаблон для коміксів у американському стилі
Comment[wa]=Modele di bindes d' imådje al môde des comics amerikins
Comment[x-test]=xxtemplate for US-style comicsxx
Comment[zh_CN]=美式漫画模板
Comment[zh_TW]=美式漫畫樣本
X-Krita-Version=28
diff --git a/krita/data/templates/comics/a4_waffle_grid.desktop b/krita/data/templates/comics/a4_waffle_grid.desktop
index 1ebaea23e9..8cc814294a 100644
--- a/krita/data/templates/comics/a4_waffle_grid.desktop
+++ b/krita/data/templates/comics/a4_waffle_grid.desktop
@@ -1,65 +1,67 @@
[Desktop Entry]
Type=Link
URL=.source/a4_waffle_grid.kra
Icon=template_comics_empty
Name=waffle-iron grid
Name[bs]=mreža sječenog željeza
Name[ca]=graella de ferro
Name[ca@valencia]=graella de ferro
Name[da]=vaffeljernsgitter
Name[de]=Waffeleisengitter
Name[el]=waffle-iron κάνναβος
Name[en_GB]=waffle-iron grid
Name[es]=rejilla de hierro para gofres
Name[et]=Vahvlimasina ruudustik
Name[eu]=gofreetarako burdinazko sareta
Name[fr]=Grille en métal-gaufré
Name[gl]=Grade de 3×5 viñetas
Name[it]=Griglia a wafer
Name[ja]=格子状コマ
Name[kk]=торлы көзді
Name[nb]=vaffeljern-rutenett
Name[nds]=Wafeliesengadder
Name[nl]=wafelijzer-raster
Name[pl]=siatka gofrownicy
Name[pt]=grelha de ferro para 'waffles'
Name[pt_BR]=Grade de ferro vazia
Name[ru]=Страница с ячейками
Name[sk]=vaflovo-železná mriežka
Name[sv]=våffelmönster
+Name[tr]=waffle-çelik ızgara
Name[uk]=сітка з комірками
Name[wa]=grile di fier a wåfes
Name[x-test]=xxwaffle-iron gridxx
Name[zh_CN]=华夫铁网格
Name[zh_TW]=鐵模式格線
Comment=300 dpi, A4 waffle-iron grid comic page with ink and color layers
Comment[bs]=300 dpi, A4 mreža sječenog željeza stranica stripa s slojevima za tintu i bojemreža sječenog željeza
Comment[ca]=300 ppp, pàgina de còmic amb graella de ferro amb capes de tinta i color
Comment[ca@valencia]=300 ppp, pàgina de còmic amb graella de ferro amb capes de tinta i color
Comment[da]=300 dpi, A4 tegneserieside i vaffeljernsgitter med blæk og farvelag
Comment[de]=Comicseite mit Waffeleisengitter-Muster, Tinten- und Farbebenen. Format A4, Auflösung 300 dpi.
Comment[el]=300 dpi, σελίδα κόμικ A4 με waffle-iron κάνναβο και στρώματα μελάνης και χρώματος
Comment[en_GB]=300 dpi, A4 waffle-iron grid comic page with ink and colour layers
Comment[es]=página de cómic con rejilla de hierro para gofres de tamaño A4, a 300 ppp, con tinta y capas de colores
Comment[et]=300 DPI A4 vahvlimasina ruudustikuga koomiksilehekülg tindi- ja värvikihiga
Comment[eu]=Gofreetarako burdinazko sareta duen 300 dpi-ko A4 komiki-orria, tinta- eta kolore-geruzaduna
Comment[fr]=Page de bande dessinée avec Grille en métal-gaufré de 300 dpi, A4 avec encre et calques colorés
Comment[gl]=Páxina de banda deseñada en A4 a 300 dpi con 3×5 viñetas regulares e capas de tinta e cor.
Comment[it]=Pagina di fumetti con griglia a wafer a 300 dpi, A4, con livelli per inchiostro e colore
Comment[ja]=300 dpi A4 サイズの、ペン入れレイヤーと彩色レイヤーを備えた格子状コマテンプレート
Comment[kk]=300 н/д A4 торлы көзді парақтағы комикс
Comment[nb]=300 dpi, A4 tegneserieside med vaffeljern-rutenett, med tusj- og fargelag
Comment[nds]=300 dpi, A4 Wafeliesengadder-Comicsiet mit Dint un Klöörlagen.
Comment[nl]=300 dpi, A4 wafelijzer-raster strippagina met inkt en kleurlagen
Comment[pl]=300 dpi, strona A4 siatki gofrownicy z warstwami tuszu i koloru
Comment[pt]=banda desenhada A4, em grelha de 'waffle' a 300 ppp, com camadas de cores e de pinturas
Comment[pt_BR]=Página de quadrinhos A4, em grade de ferro a 300 ppp, com camadas de cores e de pinturas
Comment[ru]=300 dpi, страница комикса в формате A4 с ячейками и слоями контуров и цветов
Comment[sk]=300 dpi, A4 vaflovo železná mriežka komiksovej strany s atramentom a farebnými vrstvami
Comment[sv]=300 punkter/tum, A4 våffelmönstrad seriesida med bläck- och färglager
+Comment[tr]=300 dpi, A4 waffle-çelik ızgara mürekkep ve renk katmanlı çizgi roman sayfası
Comment[uk]=300 т/д, сторінка коміксу у форматі A4 з комірками та шарами контурів та кольорів
Comment[wa]=Pådje A4 di binde d' imådjes avou on discôpaedje come ene grile di fier a wåfes avou des coûtches d' intche eyet d' coleurs.
Comment[x-test]=xx300 dpi, A4 waffle-iron grid comic page with ink and color layersxx
Comment[zh_CN]=300 DPI,A4 尺寸华夫铁网格漫画页,带有墨水和色彩图层
Comment[zh_TW]=300 dpi,A4 大小的烘餅鐵模狀的格線,有墨水與顏色圖層
X-Krita-Version=28
diff --git a/krita/krita.action b/krita/krita.action
index 5e041115ce..f75cd92257 100644
--- a/krita/krita.action
+++ b/krita/krita.action
@@ -1,2946 +1,2958 @@
<?xml version="1.0" encoding="UTF-8"?>
<ActionCollection version="2" name="Krita">
<Actions category="General">
<text>General</text>
<Action name="open_resources_directory">
<icon></icon>
<text>Open Resources Folder</text>
<whatsThis>Opens a file browser at the location Krita saves resources such as brushes to.</whatsThis>
<toolTip>Opens a file browser at the location Krita saves resources such as brushes to.</toolTip>
<iconText>Open Resources Folder</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="edit_blacklist_cleanup">
<icon></icon>
<text>Cleanup removed files...</text>
<whatsThis></whatsThis>
<toolTip>Cleanup removed files</toolTip>
<iconText>Cleanup removed files</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="windows_cascade">
<icon></icon>
<text>C&amp;ascade</text>
<whatsThis></whatsThis>
<toolTip>Cascade</toolTip>
<iconText>Cascade</iconText>
<activationFlags>10</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="windows_tile">
<icon></icon>
<text>&amp;Tile</text>
<whatsThis></whatsThis>
<toolTip>Tile</toolTip>
<iconText>Tile</iconText>
<activationFlags>10</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="create_bundle">
<icon></icon>
<text>Create Resource Bundle...</text>
<whatsThis></whatsThis>
<toolTip>Create Resource Bundle</toolTip>
<iconText>Create Resource Bundle</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="mainToolBar">
<icon></icon>
<text>Show File Toolbar</text>
<whatsThis></whatsThis>
<toolTip>Show File Toolbar</toolTip>
<iconText>Show File Toolbar</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_color_selector">
<icon></icon>
<text>Show color selector</text>
<whatsThis></whatsThis>
<toolTip>Show color selector</toolTip>
<iconText>Show color selector</iconText>
<shortcut>Shift+I</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_mypaint_shade_selector">
<icon></icon>
<text>Show MyPaint shade selector</text>
<whatsThis></whatsThis>
<toolTip>Show MyPaint shade selector</toolTip>
<iconText>Show MyPaint shade selector</iconText>
<shortcut>Shift+M</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_minimal_shade_selector">
<icon></icon>
<text>Show minimal shade selector</text>
<whatsThis></whatsThis>
<toolTip>Show minimal shade selector</toolTip>
<iconText>Show minimal shade selector</iconText>
<shortcut>Shift+N</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_color_history">
<icon></icon>
<text>Show color history</text>
<whatsThis></whatsThis>
<toolTip>Show color history</toolTip>
<iconText>Show color history</iconText>
<shortcut>H</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_common_colors">
<icon></icon>
<text>Show common colors</text>
<whatsThis></whatsThis>
<toolTip>Show common colors</toolTip>
<iconText>Show common colors</iconText>
<shortcut>U</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_tool_options">
<icon></icon>
<text>Show Tool Options</text>
<whatsThis></whatsThis>
<toolTip>Show Tool Options</toolTip>
<iconText>Show Tool Options</iconText>
<shortcut>\</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_brush_editor">
<icon></icon>
<text>Show Brush Editor</text>
<whatsThis></whatsThis>
<toolTip>Show Brush Editor</toolTip>
<iconText>Show Brush Editor</iconText>
<shortcut>F5</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_brush_presets">
<icon></icon>
<text>Show Brush Presets</text>
<whatsThis></whatsThis>
<toolTip>Show Brush Presets</toolTip>
<iconText>Show Brush Presets</iconText>
<shortcut>F6</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="tablet_debugger">
<icon></icon>
<text>Toggle Tablet Debugger</text>
<whatsThis></whatsThis>
<toolTip>Toggle Tablet Debugger</toolTip>
<iconText>Toggle Tablet Debugger</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+Shift+T</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="rename_composition">
<icon></icon>
<text>Rename Composition...</text>
<whatsThis></whatsThis>
<toolTip>Rename Composition</toolTip>
<iconText>Rename Composition</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="update_composition">
<icon></icon>
<text>Update Composition</text>
<whatsThis></whatsThis>
<toolTip>Update Composition</toolTip>
<iconText>Update Composition</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
<Actions category="Painting">
<text>Painting</text>
<Action name="make_brush_color_lighter">
<icon></icon>
<text>Make brush color lighter</text>
<whatsThis></whatsThis>
<toolTip>Make brush color lighter</toolTip>
<iconText>Make brush color lighter</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>L</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_darker">
<icon></icon>
<text>Make brush color darker</text>
<whatsThis></whatsThis>
<toolTip>Make brush color darker</toolTip>
<iconText>Make brush color darker</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>K</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_saturated">
<icon></icon>
<text>Make brush color more saturated</text>
<whatsThis></whatsThis>
<toolTip>Make brush color more saturated</toolTip>
<iconText>Make brush color more saturated</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_desaturated">
<icon></icon>
<text>Make brush color more desaturated</text>
<whatsThis></whatsThis>
<toolTip>Make brush color more desaturated</toolTip>
<iconText>Make brush color more desaturated</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="shift_brush_color_clockwise">
<icon></icon>
<text>Shift brush color hue clockwise</text>
<whatsThis></whatsThis>
<toolTip>Shift brush color hue clockwise</toolTip>
<iconText>Shift brush color hue clockwise</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="shift_brush_color_counter_clockwise">
<icon></icon>
<text>Shift brush color hue counter-clockwise</text>
<whatsThis></whatsThis>
<toolTip>Shift brush color hue counter-clockwise</toolTip>
<iconText>Shift brush color hue counter-clockwise</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_redder">
<icon></icon>
<text>Make brush color more red</text>
<whatsThis></whatsThis>
<toolTip>Make brush color more red</toolTip>
<iconText>Make brush color more red</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_greener">
<icon></icon>
<text>Make brush color more green</text>
<whatsThis></whatsThis>
<toolTip>Make brush color more green</toolTip>
<iconText>Make brush color more green</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_bluer">
<icon></icon>
<text>Make brush color more blue</text>
<whatsThis></whatsThis>
<toolTip>Make brush color more blue</toolTip>
<iconText>Make brush color more blue</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="make_brush_color_yellower">
<icon></icon>
<text>Make brush color more yellow</text>
<whatsThis></whatsThis>
<toolTip>Make brush color more yellow</toolTip>
<iconText>Make brush color more yellow</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="increase_opacity">
<icon></icon>
<text>Increase opacity</text>
<whatsThis></whatsThis>
<toolTip>Increase opacity</toolTip>
<iconText>Increase opacity</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>O</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="decrease_opacity">
<icon></icon>
<text>Decrease opacity</text>
<whatsThis></whatsThis>
<toolTip>Decrease opacity</toolTip>
<iconText>Decrease opacity</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>I</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="erase_action">
<icon>draw-eraser</icon>
<text>Set eraser mode</text>
<whatsThis></whatsThis>
<toolTip>Set eraser mode</toolTip>
<iconText>Set eraser mode</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>E</shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="reload_preset_action">
<icon>view-refresh</icon>
<text>Reload Original Preset</text>
<whatsThis></whatsThis>
<toolTip>Reload Original Preset</toolTip>
<iconText>Reload Original Preset</iconText>
<activationFlags>10000</activationFlags>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="preserve_alpha">
<icon>transparency-unlocked</icon>
<text>Preserve Alpha</text>
<whatsThis></whatsThis>
<toolTip>Preserve Alpha</toolTip>
<iconText>Preserve Alpha</iconText>
<activationFlags>10000</activationFlags>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="disable_pressure">
<icon>transform_icons_penPressure</icon>
<text>Use Pen Pressure</text>
<whatsThis></whatsThis>
<toolTip>Use Pen Pressure</toolTip>
<iconText>Use Pen Pressure</iconText>
<activationFlags>10000</activationFlags>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="hmirror_action">
<icon>symmetry-horizontal</icon>
<text>Horizontal Mirror Tool</text>
<whatsThis></whatsThis>
<toolTip>Horizontal Mirror Tool</toolTip>
<iconText>Horizontal Mirror Tool</iconText>
<activationFlags>10000</activationFlags>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="vmirror_action">
<icon>symmetry-vertical</icon>
<text>Vertical Mirror Tool</text>
<whatsThis></whatsThis>
<toolTip>Vertical Mirror Tool</toolTip>
<iconText>Vertical Mirror Tool</iconText>
<activationFlags>10000</activationFlags>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="invert">
<icon></icon>
<text>&amp;Invert Selection</text>
<whatsThis></whatsThis>
<toolTip>Invert current selection</toolTip>
<iconText>Invert Selection</iconText>
<activationFlags>10000000000</activationFlags>
<activationConditions>100</activationConditions>
<shortcut>Ctrl+Shift+I</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="fill_selection_foreground_color_opacity">
<icon></icon>
<text>Fill with Foreground Color (Opacity)</text>
<whatsThis></whatsThis>
<toolTip>Fill with Foreground Color (Opacity)</toolTip>
<iconText>Fill with Foreground Color (Opacity)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>Ctrl+Shift+Backspace</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="fill_selection_background_color_opacity">
<icon></icon>
<text>Fill with Background Color (Opacity)</text>
<whatsThis></whatsThis>
<toolTip>Fill with Background Color (Opacity)</toolTip>
<iconText>Fill with Background Color (Opacity)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>Ctrl+Backspace</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="fill_selection_pattern_opacity">
<icon></icon>
<text>Fill with Pattern (Opacity)</text>
<whatsThis></whatsThis>
<toolTip>Fill with Pattern (Opacity)</toolTip>
<iconText>Fill with Pattern (Opacity)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle-selection-overlay-mode">
<icon></icon>
<text>&amp;Toggle Selection Display Mode</text>
<whatsThis></whatsThis>
<toolTip>Toggle Selection Display Mode</toolTip>
<iconText>Toggle Selection Display Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="next_favorite_preset">
<icon></icon>
<text>Next Favourite Preset</text>
<whatsThis></whatsThis>
<toolTip>Next Favourite Preset</toolTip>
<iconText>Next Favourite Preset</iconText>
<shortcut>,</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="previous_favorite_preset">
<icon></icon>
<text>Previous Favourite Preset</text>
<whatsThis></whatsThis>
<toolTip>Previous Favourite Preset</toolTip>
<iconText>Previous Favourite Preset</iconText>
<shortcut>.</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="previous_preset">
<icon>preset-switcher</icon>
<text>Switch to Previous Preset</text>
<whatsThis></whatsThis>
<toolTip>Switch to Previous Preset</toolTip>
<iconText>Switch to Previous Preset</iconText>
<shortcut>/</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="BrushesAndStuff">
<icon></icon>
<text>Hide Brushes and Stuff Toolbar</text>
<whatsThis></whatsThis>
<toolTip>Hide Brushes and Stuff Toolbar</toolTip>
<iconText>Hide Brushes and Stuff Toolbar</iconText>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="reset_fg_bg">
<icon></icon>
<text>Reset Foreground and Background Color</text>
<whatsThis></whatsThis>
<toolTip>Reset Foreground and Background Color</toolTip>
<iconText>Reset Foreground and Background Color</iconText>
<shortcut>D</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_fg_bg">
<icon></icon>
<text>Swap Foreground and Background Color</text>
<whatsThis></whatsThis>
<toolTip>Swap Foreground and Background Color</toolTip>
<iconText>Swap Foreground and Background Color</iconText>
<shortcut>X</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="set_weighted_brush_smoothing">
<icon>smoothing-weighted</icon>
<text>Brush Smoothing: Weighted</text>
<whatsThis></whatsThis>
<toolTip>Brush Smoothing: Weighted</toolTip>
<iconText>Brush Smoothing: Weighted</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="set_no_brush_smoothing">
<icon>smoothing-no</icon>
<text>Brush Smoothing: Disabled</text>
<whatsThis></whatsThis>
<toolTip>Brush Smoothing: Disabled</toolTip>
<iconText>Brush Smoothing: Disabled</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="set_stabilizer_brush_smoothing">
<icon>smoothing-stabilizer</icon>
<text>Brush Smoothing: Stabilizer</text>
<whatsThis></whatsThis>
<toolTip>Brush Smoothing: Stabilizer</toolTip>
<iconText>Brush Smoothing: Stabilizer</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="decrease_brush_size">
<icon></icon>
<text>Decrease Brush Size</text>
<whatsThis></whatsThis>
<toolTip>Decrease Brush Size</toolTip>
<iconText>Decrease Brush Size</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>[</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="set_simple_brush_smoothing">
<icon>smoothing-basic</icon>
<text>Brush Smoothing: Basic</text>
<whatsThis></whatsThis>
<toolTip>Brush Smoothing: Basic</toolTip>
<iconText>Brush Smoothing: Basic</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="increase_brush_size">
<icon></icon>
<text>Increase Brush Size</text>
<whatsThis></whatsThis>
<toolTip>Increase Brush Size</toolTip>
<iconText>Increase Brush Size</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>]</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_assistant">
<icon></icon>
<text>Toggle Assistant</text>
<whatsThis></whatsThis>
<toolTip>Toggle Assistant</toolTip>
<iconText>ToggleAssistant</iconText>
<shortcut>Ctrl+Shift+L</shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="undo_polygon_selection">
<icon></icon>
<text>Undo Polygon Selection Points</text>
<whatsThis></whatsThis>
<toolTip>Undo Polygon Selection Points</toolTip>
<iconText>Undo Polygon Selection Points</iconText>
<shortcut>Shift+Z</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="fill_selection_foreground_color_opacity">
<icon></icon>
<text>Fill with Foreground Color (Opacity)</text>
<whatsThis></whatsThis>
<toolTip>Fill with Foreground Color (Opacity)</toolTip>
<iconText>Fill with Foreground Color (Opacity)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>Ctrl+Shift+Backspace</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="fill_selection_background_color_opacity">
<icon></icon>
<text>Fill with Background Color (Opacity)</text>
<whatsThis></whatsThis>
<toolTip>Fill with Background Color (Opacity)</toolTip>
<iconText>Fill with Background Color (Opacity)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>Ctrl+Backspace</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="fill_selection_pattern_opacity">
<icon></icon>
<text>Fill with Pattern (Opacity)</text>
<whatsThis></whatsThis>
<toolTip>Fill with Pattern (Opacity)</toolTip>
<iconText>Fill with Pattern (Opacity)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="convert_selection_to_shape">
<icon></icon>
<text>Convert &amp;to Shape</text>
<whatsThis></whatsThis>
<toolTip>Convert to Shape</toolTip>
<iconText>Convert to Shape</iconText>
<activationFlags>10000000000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="select_opaque">
<icon></icon>
<text>&amp;Select Opaque</text>
<whatsThis></whatsThis>
<toolTip>Select Opaque</toolTip>
<iconText>Select Opaque</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>100</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show-global-selection-mask">
<icon></icon>
<text>&amp;Show Global Selection Mask</text>
<whatsThis></whatsThis>
<toolTip>Shows global selection as a usual selection mask in &lt;interface>Layers&lt;/interface> docker</toolTip>
<iconText>Show Global Selection Mask</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>100</activationConditions>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
<Actions category="Filters">
<text>Filters</text>
<Action name="krita_filter_colortoalpha">
<icon>color-to-alpha</icon>
<text>&amp;Color to Alpha...</text>
<whatsThis></whatsThis>
<toolTip>Color to Alpha</toolTip>
<iconText>Color to Alpha</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_top edge detections">
<icon></icon>
<text>&amp;Top Edge Detection</text>
<whatsThis></whatsThis>
<toolTip>Top Edge Detection</toolTip>
<iconText>Top Edge Detection</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_indexcolors">
<icon></icon>
<text>&amp;Index Colors...</text>
<whatsThis></whatsThis>
<toolTip>Index Colors</toolTip>
<iconText>Index Colors</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_emboss horizontal only">
<icon></icon>
<text>Emboss Horizontal &amp;Only</text>
<whatsThis></whatsThis>
<toolTip>Emboss Horizontal Only</toolTip>
<iconText>Emboss Horizontal Only</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_dodge">
<icon></icon>
<text>D&amp;odge</text>
<whatsThis></whatsThis>
<toolTip>Dodge</toolTip>
<iconText>Dodge</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_sharpen">
<icon></icon>
<text>&amp;Sharpen</text>
<whatsThis></whatsThis>
<toolTip>Sharpen</toolTip>
<iconText>Sharpen</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_burn">
<icon></icon>
<text>B&amp;urn</text>
<whatsThis></whatsThis>
<toolTip>Burn</toolTip>
<iconText>Burn</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_mean removal">
<icon></icon>
<text>&amp;Mean Removal</text>
<whatsThis></whatsThis>
<toolTip>Mean Removal</toolTip>
<iconText>Mean Removal</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_gaussian blur">
<icon></icon>
<text>&amp;Gaussian Blur...</text>
<whatsThis></whatsThis>
<toolTip>Gaussian Blur</toolTip>
<iconText>Gaussian Blur</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_emboss all directions">
<icon></icon>
<text>Emboss &amp;in All Directions</text>
<whatsThis></whatsThis>
<toolTip>Emboss in All Directions</toolTip>
<iconText>Emboss in All Directions</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_smalltiles">
<icon></icon>
<text>&amp;Small Tiles...</text>
<whatsThis></whatsThis>
<toolTip>Small Tiles</toolTip>
<iconText>Small Tiles</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_levels">
<icon></icon>
<text>&amp;Levels...</text>
<whatsThis></whatsThis>
<toolTip>Levels</toolTip>
<iconText>Levels</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+L</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_sobel">
<icon></icon>
<text>&amp;Sobel...</text>
<whatsThis></whatsThis>
<toolTip>Sobel</toolTip>
<iconText>Sobel</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_wave">
<icon></icon>
<text>&amp;Wave...</text>
<whatsThis></whatsThis>
<toolTip>Wave</toolTip>
<iconText>Wave</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_motion blur">
<icon></icon>
<text>&amp;Motion Blur...</text>
<whatsThis></whatsThis>
<toolTip>Motion Blur</toolTip>
<iconText>Motion Blur</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_perchannel">
<icon></icon>
<text>&amp;Color Adjustment curves...</text>
<whatsThis></whatsThis>
<toolTip>Color Adjustment curves</toolTip>
<iconText>Color Adjustment curves</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+M</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_pixelize">
<icon></icon>
<text>Pi&amp;xelize...</text>
<whatsThis></whatsThis>
<toolTip>Pixelize</toolTip>
<iconText>Pixelize</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_emboss laplascian">
<icon></icon>
<text>Emboss (&amp;Laplacian)</text>
<whatsThis></whatsThis>
<toolTip>Emboss (Laplacian)</toolTip>
<iconText>Emboss (Laplacian)</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_left edge detections">
<icon></icon>
<text>&amp;Left Edge Detection</text>
<whatsThis></whatsThis>
<toolTip>Left Edge Detection</toolTip>
<iconText>Left Edge Detection</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_blur">
<icon></icon>
<text>&amp;Blur...</text>
<whatsThis></whatsThis>
<toolTip>Blur</toolTip>
<iconText>Blur</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_raindrops">
<icon></icon>
<text>&amp;Raindrops...</text>
<whatsThis></whatsThis>
<toolTip>Raindrops</toolTip>
<iconText>Raindrops</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_bottom edge detections">
<icon></icon>
<text>&amp;Bottom Edge Detection</text>
<whatsThis></whatsThis>
<toolTip>Bottom Edge Detection</toolTip>
<iconText>Bottom Edge Detection</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_noise">
<icon></icon>
<text>&amp;Random Noise...</text>
<whatsThis></whatsThis>
<toolTip>Random Noise</toolTip>
<iconText>Random Noise</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_brightnesscontrast">
<icon></icon>
<text>&amp;Brightness/Contrast curve...</text>
<whatsThis></whatsThis>
<toolTip>Brightness/Contrast curve</toolTip>
<iconText>Brightness/Contrast curve</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_colorbalance">
<icon></icon>
<text>Colo&amp;r Balance..</text>
<whatsThis></whatsThis>
<toolTip>Color Balance..</toolTip>
<iconText>Color Balance..</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+B</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_phongbumpmap">
<icon></icon>
<text>&amp;Phong Bumpmap...</text>
<whatsThis></whatsThis>
<toolTip>Phong Bumpmap</toolTip>
<iconText>Phong Bumpmap</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_desaturate">
<icon></icon>
<text>&amp;Desaturate</text>
<whatsThis></whatsThis>
<toolTip>Desaturate</toolTip>
<iconText>Desaturate</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+Shift+U</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_colortransfer">
<icon></icon>
<text>Color &amp;Transfer...</text>
<whatsThis></whatsThis>
<toolTip>Color Transfer</toolTip>
<iconText>Color Transfer</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_emboss vertical only">
<icon></icon>
<text>Emboss &amp;Vertical Only</text>
<whatsThis></whatsThis>
<toolTip>Emboss Vertical Only</toolTip>
<iconText>Emboss Vertical Only</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_lens blur">
<icon></icon>
<text>&amp;Lens Blur...</text>
<whatsThis></whatsThis>
<toolTip>Lens Blur</toolTip>
<iconText>Lens Blur</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_minimize">
<icon></icon>
<text>M&amp;inimize Channel</text>
<whatsThis></whatsThis>
<toolTip>Minimize Channel</toolTip>
<iconText>Minimize Channel</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_maximize">
<icon></icon>
<text>M&amp;aximize Channel</text>
<whatsThis></whatsThis>
<toolTip>Maximize Channel</toolTip>
<iconText>Maximize Channel</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_oilpaint">
<icon></icon>
<text>&amp;Oilpaint...</text>
<whatsThis></whatsThis>
<toolTip>Oilpaint</toolTip>
<iconText>Oilpaint</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_right edge detections">
<icon></icon>
<text>&amp;Right Edge Detection</text>
<whatsThis></whatsThis>
<toolTip>Right Edge Detection</toolTip>
<iconText>Right Edge Detection</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_autocontrast">
<icon></icon>
<text>&amp;Auto Contrast</text>
<whatsThis></whatsThis>
<toolTip>Auto Contrast</toolTip>
<iconText>Auto Contrast</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_roundcorners">
<icon></icon>
<text>&amp;Round Corners...</text>
<whatsThis></whatsThis>
<toolTip>Round Corners</toolTip>
<iconText>Round Corners</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_unsharp">
<icon></icon>
<text>&amp;Unsharp Mask...</text>
<whatsThis></whatsThis>
<toolTip>Unsharp Mask</toolTip>
<iconText>Unsharp Mask</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_emboss">
<icon></icon>
<text>&amp;Emboss with Variable Depth...</text>
<whatsThis></whatsThis>
<toolTip>Emboss with Variable Depth</toolTip>
<iconText>Emboss with Variable Depth</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_emboss horizontal and vertical">
<icon></icon>
<text>Emboss &amp;Horizontal &amp;&amp; Vertical</text>
<whatsThis></whatsThis>
<toolTip>Emboss Horizontal &amp; Vertical</toolTip>
<iconText>Emboss Horizontal &amp; Vertical</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_randompick">
<icon></icon>
<text>Random &amp;Pick...</text>
<whatsThis></whatsThis>
<toolTip>Random Pick</toolTip>
<iconText>Random Pick</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_gaussiannoisereducer">
<icon></icon>
<text>&amp;Gaussian Noise Reduction...</text>
<whatsThis></whatsThis>
<toolTip>Gaussian Noise Reduction</toolTip>
<iconText>Gaussian Noise Reduction</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_posterize">
<icon></icon>
<text>&amp;Posterize...</text>
<whatsThis></whatsThis>
<toolTip>Posterize</toolTip>
<iconText>Posterize</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_waveletnoisereducer">
<icon></icon>
<text>&amp;Wavelet Noise Reducer...</text>
<whatsThis></whatsThis>
<toolTip>Wavelet Noise Reducer</toolTip>
<iconText>Wavelet Noise Reducer</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="krita_filter_hsvadjustment">
<icon></icon>
<text>&amp;HSV Adjustment...</text>
<whatsThis></whatsThis>
<toolTip>HSV Adjustment</toolTip>
<iconText>HSV Adjustment</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+U</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
<Actions category="tool-shortcuts">
<text>Tool Shortcuts</text>
<Action name="KritaShape/KisToolDyna">
<icon></icon>
<text>Dynamic Brush Tool</text>
<whatsThis></whatsThis>
<toolTip>Dynamic Brush Tool</toolTip>
<iconText>Dynamic Brush Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolCrop">
<icon></icon>
<text>Crop Tool</text>
<whatsThis></whatsThis>
<toolTip>Crop the image to an area</toolTip>
<iconText>Crop the image to an area</iconText>
<shortcut>C</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolPolygon">
<icon></icon>
<text>Polygon Tool</text>
<whatsThis></whatsThis>
<toolTip>Polygon Tool. Shift-mouseclick ends the polygon.</toolTip>
<iconText>Polygon Tool. Shift-mouseclick ends the polygon.</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="ReferencesTool">
<icon></icon>
<text>References</text>
<whatsThis></whatsThis>
<toolTip>References</toolTip>
<iconText>References</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolRectangle">
<icon></icon>
<text>Rectangle Tool</text>
<whatsThis></whatsThis>
<toolTip>Rectangle Tool</toolTip>
<iconText>Rectangle Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolMultiBrush">
<icon></icon>
<text>Multibrush Tool</text>
<whatsThis></whatsThis>
<toolTip>Multibrush Tool</toolTip>
<iconText>Multibrush Tool</iconText>
<shortcut>Q</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="InteractionTool">
<icon></icon>
<text>Shape Manipulation Tool</text>
<whatsThis></whatsThis>
<toolTip>Shape Manipulation Tool</toolTip>
<iconText>Shape Manipulation Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaSelected/KisToolColorPicker">
<icon></icon>
<text>Color Picker</text>
<whatsThis></whatsThis>
<toolTip>Select a color from the image or current layer</toolTip>
<iconText>Select a color from the image or current layer</iconText>
<shortcut>P</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="TextTool">
<icon></icon>
<text>Text Editing Tool</text>
<whatsThis></whatsThis>
<toolTip>Text editing</toolTip>
<iconText>Text editing</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectOutline">
<icon></icon>
<text>Outline Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Outline Selection Tool</toolTip>
<iconText>Outline Selection Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="ArtisticTextTool">
<icon></icon>
<text>Artistic Text Tool</text>
<whatsThis></whatsThis>
<toolTip>Artistic text editing</toolTip>
<iconText>Artistic text editing</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectPath">
<icon></icon>
<text>Bezier Curve Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Select a </toolTip>
<iconText>Bezier Curve Selection Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectSimilar">
<icon></icon>
<text>Similar Color Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Select a </toolTip>
<iconText>Similar Color Selection Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaFill/KisToolFill">
<icon></icon>
<text>Fill Tool</text>
<whatsThis></whatsThis>
<toolTip>Fill a contiguous area of color with a color, or fill a selection.</toolTip>
<iconText>Fill a contiguous area of color with a color, or fill a selection.</iconText>
<shortcut>F</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolLine">
<icon></icon>
<text>Line Tool</text>
<whatsThis></whatsThis>
<toolTip>Line Tool</toolTip>
<iconText>Line Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolPencil">
<icon></icon>
<text>Freehand Path Tool</text>
<whatsThis></whatsThis>
<toolTip>Freehand Path Tool</toolTip>
<iconText>Freehand Path Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolPath">
<icon></icon>
<text>Bezier Curve Tool</text>
<whatsThis></whatsThis>
<toolTip>Bezier Curve Tool. Shift-mouseclick ends the curve.</toolTip>
<iconText>Bezier Curve Tool. Shift-mouseclick ends the curve.</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolEllipse">
<icon></icon>
<text>Ellipse Tool</text>
<whatsThis></whatsThis>
<toolTip>Ellipse Tool</toolTip>
<iconText>Ellipse Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolBrush">
<icon></icon>
<text>Freehand Brush Tool</text>
<whatsThis></whatsThis>
<toolTip>Freehand Brush Tool</toolTip>
<iconText>Freehand Brush Tool</iconText>
<shortcut>B</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="CreateShapesTool">
<icon></icon>
<text>Create object</text>
<whatsThis></whatsThis>
<toolTip>Create object</toolTip>
<iconText>Create object</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectElliptical">
<icon></icon>
<text>Elliptical Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Elliptical Selection Tool</toolTip>
<iconText>Elliptical Selection Tool</iconText>
<shortcut>J</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectContiguous">
<icon></icon>
<text>Contiguous Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Contiguous Selection Tool</toolTip>
<iconText>Contiguous Selection Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KarbonPatternTool">
<icon></icon>
<text>Pattern editing</text>
<whatsThis></whatsThis>
<toolTip>Pattern editing</toolTip>
<iconText>Pattern editing</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="ReviewTool">
<icon></icon>
<text>Review</text>
<whatsThis></whatsThis>
<toolTip>Review</toolTip>
<iconText>Review</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaFill/KisToolGradient">
<icon></icon>
<text>Draw a gradient.</text>
<whatsThis></whatsThis>
<toolTip>Draw a gradient.</toolTip>
<iconText>Draw a gradient.</iconText>
<shortcut>G</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectPolygonal">
<icon></icon>
<text>Polygonal Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Polygonal Selection Tool</toolTip>
<iconText>Polygonal Selection Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolMeasure">
<icon></icon>
<text>Measurement Tool</text>
<whatsThis></whatsThis>
<toolTip>Measure the distance between two points</toolTip>
<iconText>Measure the distance between two points</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolSelectRectangular">
<icon></icon>
<text>Rectangular Selection Tool</text>
<whatsThis></whatsThis>
<toolTip>Rectangular Selection Tool</toolTip>
<iconText>Rectangular Selection Tool</iconText>
<shortcut>Ctrl+R</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaTransform/KisToolMove">
<icon></icon>
<text>Move Tool</text>
<whatsThis></whatsThis>
<toolTip>Move a layer</toolTip>
<iconText>Move a layer</iconText>
<shortcut>T</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="VectorTool">
<icon></icon>
<text>Vector Image Tool</text>
<whatsThis></whatsThis>
<toolTip>Vector Image (EMF/WMF/SVM/SVG) tool</toolTip>
<iconText>Vector Image (EMF/WMF/SVM/SVG) tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KarbonCalligraphyTool">
<icon></icon>
<text>Calligraphy</text>
<whatsThis></whatsThis>
<toolTip>Calligraphy</toolTip>
<iconText>Calligraphy</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="PathTool">
<icon></icon>
<text>Path editing</text>
<whatsThis></whatsThis>
<toolTip>Path editing</toolTip>
<iconText>Path editing</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="ZoomTool">
<icon></icon>
<text>Zoom Tool</text>
<whatsThis></whatsThis>
<toolTip>Zoom Tool</toolTip>
<iconText>Zoom Tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolPolyline">
<icon></icon>
<text>Polyline Tool</text>
<whatsThis></whatsThis>
<toolTip>Polyline Tool. Shift-mouseclick ends the polyline.</toolTip>
<iconText>Polyline Tool. Shift-mouseclick ends the polyline.</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisToolTransform">
<icon></icon>
<text>Transform Tool</text>
<whatsThis></whatsThis>
<toolTip>Transform a layer or a selection</toolTip>
<iconText>Transform a layer or a selection</iconText>
<shortcut>Ctrl+T</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KisRulerAssistantTool">
<icon></icon>
<text>Ruler assistant editor tool</text>
<whatsThis></whatsThis>
<toolTip>Ruler assistant editor tool</toolTip>
<iconText>Ruler assistant editor tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KritaShape/KisToolText">
<icon></icon>
<text>Text tool</text>
<whatsThis></whatsThis>
<toolTip>Text tool</toolTip>
<iconText>Text tool</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="KarbonGradientTool">
<icon></icon>
<text>Gradient Editing Tool</text>
<whatsThis></whatsThis>
<toolTip>Gradient editing</toolTip>
<iconText>Gradient editing</iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
<Actions category="Blending Modes">
<text>Blending Modes</text>
<!-- commented out in the code right now
<Action name="Next Blending Mode">
<icon></icon>
<text>Next Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Next Blending Mode</toolTip>
<iconText>Next Blending Mode</iconText>
<shortcut>Alt+Shift++</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Previous Blending Mode">
<icon></icon>
<text>Previous Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Previous Blending Mode</toolTip>
<iconText>Previous Blending Mode</iconText>
<shortcut>Alt+Shift+-</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
-->
<Action name="Select Normal Blending Mode">
<icon></icon>
<text>Select Normal Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Normal Blending Mode</toolTip>
<iconText>Select Normal Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+N</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Dissolve Blending Mode">
<icon></icon>
<text>Select Dissolve Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Dissolve Blending Mode</toolTip>
<iconText>Select Dissolve Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+I</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Behind Blending Mode">
<icon></icon>
<text>Select Behind Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Behind Blending Mode</toolTip>
<iconText>Select Behind Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+Q</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Clear Blending Mode">
<icon></icon>
<text>Select Clear Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Clear Blending Mode</toolTip>
<iconText>Select Clear Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+R</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Darken Blending Mode">
<icon></icon>
<text>Select Darken Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Darken Blending Mode</toolTip>
<iconText>Select Darken Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+K</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Multiply Blending Mode">
<icon></icon>
<text>Select Multiply Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Multiply Blending Mode</toolTip>
<iconText>Select Multiply Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+M</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Color Burn Blending Mode">
<icon></icon>
<text>Select Color Burn Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Color Burn Blending Mode</toolTip>
<iconText>Select Color Burn Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+B</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Linear Burn Blending Mode">
<icon></icon>
<text>Select Linear Burn Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Linear Burn Blending Mode</toolTip>
<iconText>Select Linear Burn Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+A</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Lighten Blending Mode">
<icon></icon>
<text>Select Lighten Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Lighten Blending Mode</toolTip>
<iconText>Select Lighten Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+G</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Screen Blending Mode">
<icon></icon>
<text>Select Screen Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Screen Blending Mode</toolTip>
<iconText>Select Screen Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+S</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Color Dodge Blending Mode">
<icon></icon>
<text>Select Color Dodge Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Color Dodge Blending Mode</toolTip>
<iconText>Select Color Dodge Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+D</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Linear Dodge Blending Mode">
<icon></icon>
<text>Select Linear Dodge Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Linear Dodge Blending Mode</toolTip>
<iconText>Select Linear Dodge Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+W</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Overlay Blending Mode">
<icon></icon>
<text>Select Overlay Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Overlay Blending Mode</toolTip>
<iconText>Select Overlay Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+O</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
+ <Action name="Select Hard Overlay Blending Mode">
+ <icon></icon>
+ <text>Select Hard Overlay Blending Mode</text>
+ <whatsThis></whatsThis>
+ <toolTip>Select Hard Overlay Blending Mode</toolTip>
+ <iconText>Select Hard Overlay Blending Mode</iconText>
+ <activationFlags>0</activationFlags>
+ <activationConditions>0</activationConditions>
+ <shortcut>Alt+Shift+P</shortcut>
+ <isCheckable>false</isCheckable>
+ <statusTip></statusTip>
+ </Action>
<Action name="Select Soft Light Blending Mode">
<icon></icon>
<text>Select Soft Light Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Soft Light Blending Mode</toolTip>
<iconText>Select Soft Light Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+F</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Hard Light Blending Mode">
<icon></icon>
<text>Select Hard Light Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Hard Light Blending Mode</toolTip>
<iconText>Select Hard Light Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+H</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Vivid Light Blending Mode">
<icon></icon>
<text>Select Vivid Light Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Vivid Light Blending Mode</toolTip>
<iconText>Select Vivid Light Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+V</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Linear Light Blending Mode">
<icon></icon>
<text>Select Linear Light Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Linear Light Blending Mode</toolTip>
<iconText>Select Linear Light Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+J</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Pin Light Blending Mode">
<icon></icon>
<text>Select Pin Light Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Pin Light Blending Mode</toolTip>
<iconText>Select Pin Light Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+Z</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Hard Mix Blending Mode">
<icon></icon>
<text>Select Hard Mix Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Hard Mix Blending Mode</toolTip>
<iconText>Select Hard Mix Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+L</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Difference Blending Mode">
<icon></icon>
<text>Select Difference Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Difference Blending Mode</toolTip>
<iconText>Select Difference Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+E</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Exclusion Blending Mode">
<icon></icon>
<text>Select Exclusion Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Exclusion Blending Mode</toolTip>
<iconText>Select Exclusion Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+X</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Hue Blending Mode">
<icon></icon>
<text>Select Hue Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Hue Blending Mode</toolTip>
<iconText>Select Hue Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+U</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Saturation Blending Mode">
<icon></icon>
<text>Select Saturation Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Saturation Blending Mode</toolTip>
<iconText>Select Saturation Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+T</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Color Blending Mode">
<icon></icon>
<text>Select Color Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Color Blending Mode</toolTip>
<iconText>Select Color Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+C</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="Select Luminosity Blending Mode">
<icon></icon>
<text>Select Luminosity Blending Mode</text>
<whatsThis></whatsThis>
<toolTip>Select Luminosity Blending Mode</toolTip>
<iconText>Select Luminosity Blending Mode</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Alt+Shift+Y</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
<Actions category="Animation">
<text>Animation</text>
<Action name="previous_frame">
<icon></icon>
<text>Previous frame</text>
<whatsThis></whatsThis>
<toolTip>Move to previous frame</toolTip>
<iconText>Move to previous frame</iconText>
<activationFlags>1</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="next_frame">
<icon></icon>
<text>Next frame</text>
<whatsThis></whatsThis>
<toolTip>Move to next frame</toolTip>
<iconText>Move to next frame</iconText>
<activationFlags>1</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_playback">
<icon></icon>
<text>Play / pause animation</text>
<whatsThis></whatsThis>
<toolTip>Play / pause animation</toolTip>
<iconText>Play / pause animation</iconText>
<activationFlags>1</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_blank_frame">
<icon></icon>
<text>Add blank frame</text>
<whatsThis></whatsThis>
<toolTip>Add blank frame</toolTip>
<iconText>Add blank frame</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_duplicate_frame">
<icon></icon>
<text>Copy Frame</text>
<whatsThis></whatsThis>
<toolTip>Add duplicate frame</toolTip>
<iconText>Add duplicate frame</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_onion_skin">
<icon></icon>
<text>Toggle onion skin</text>
<whatsThis></whatsThis>
<toolTip>Toggle onion skin</toolTip>
<iconText>Toggle onion skin</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="previous_keyframe">
<icon></icon>
<text>Previous Keyframe</text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="next_keyframe">
<icon></icon>
<text>Next Keyframe</text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="first_frame">
<icon></icon>
<text>First Frame</text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="last_frame">
<icon></icon>
<text>Last Frame</text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="lazy_frame">
<icon></icon>
<text>Auto Frame Mode</text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="drop_frames">
<icon></icon>
<text></text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_blank_frame">
<icon></icon>
<text>Add blank frame</text>
<whatsThis></whatsThis>
<toolTip>Add blank frame</toolTip>
<iconText>Add blank frame</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="show_in_timeline">
<icon></icon>
<text>Show in Timeline</text>
<whatsThis></whatsThis>
<toolTip></toolTip>
<iconText></iconText>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
<Actions category="Layers">
<text>Layers</text>
<Action name="activateNextLayer">
<icon></icon>
<text>Activate next layer</text>
<whatsThis></whatsThis>
<toolTip>Activate next layer</toolTip>
<iconText>Activate next layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>PgUp</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="activatePreviousLayer">
<icon></icon>
<text>Activate previous layer</text>
<whatsThis></whatsThis>
<toolTip>Activate previous layer</toolTip>
<iconText>Activate previous layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>PgDown</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="switchToPreviouslyActiveNode">
<icon></icon>
<text>Activate previously selected layer</text>
<whatsThis></whatsThis>
<toolTip>Activate previously selected layer</toolTip>
<iconText>Activate previously selected layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>;</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_group_layer">
<icon>groupLayer</icon>
<text>&amp;Group Layer</text>
<whatsThis></whatsThis>
<toolTip>Group Layer</toolTip>
<iconText>Group Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_clone_layer">
<icon>cloneLayer</icon>
<text>&amp;Clone Layer</text>
<whatsThis></whatsThis>
<toolTip>Clone Layer</toolTip>
<iconText>Clone Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_shape_layer">
<icon>vectorLayer</icon>
<text>&amp;Vector Layer</text>
<whatsThis></whatsThis>
<toolTip>Vector Layer</toolTip>
<iconText>Vector Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_adjustment_layer">
<icon>filterLayer</icon>
<text>&amp;Filter Layer...</text>
<whatsThis></whatsThis>
<toolTip>Filter Layer</toolTip>
<iconText>Filter Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_fill_layer">
<icon>fillLayer</icon>
<text>&amp;Fill Layer...</text>
<whatsThis></whatsThis>
<toolTip>Fill Layer</toolTip>
<iconText>Fill Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_file_layer">
<icon>fileLayer</icon>
<text>&amp;File Layer...</text>
<whatsThis></whatsThis>
<toolTip>File Layer</toolTip>
<iconText>File Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_transparency_mask">
<icon>transparencyMask</icon>
<text>&amp;Transparency Mask</text>
<whatsThis></whatsThis>
<toolTip>Transparency Mask</toolTip>
<iconText>Transparency Mask</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_filter_mask">
<icon>filterMask</icon>
<text>&amp;Filter Mask...</text>
<whatsThis></whatsThis>
<toolTip>Filter Mask</toolTip>
<iconText>Filter Mask</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_colorize_mask">
<icon>filterMask</icon>
<text>&amp;Colorize Mask</text>
<whatsThis></whatsThis>
<toolTip>Colorize Mask</toolTip>
<iconText>Colorize Mask</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_transform_mask">
<icon>transformMask</icon>
<text>&amp;Transform Mask...</text>
<whatsThis></whatsThis>
<toolTip>Transform Mask</toolTip>
<iconText>Transform Mask</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_selection_mask">
<icon>selectionMask</icon>
<text>&amp;Local Selection</text>
<whatsThis></whatsThis>
<toolTip>Local Selection</toolTip>
<iconText>Local Selection</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="isolate_layer">
<icon>view-filter</icon>
<text>&amp;Isolate Layer</text>
<whatsThis></whatsThis>
<toolTip>Isolate Layer</toolTip>
<iconText>Isolate Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_paint_layer">
<icon>paintLayer</icon>
<text>&amp;Paint Layer</text>
<whatsThis></whatsThis>
<toolTip>Paint Layer</toolTip>
<iconText>Paint Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Insert</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="new_from_visible">
<icon></icon>
<text>&amp;New Layer From Visible</text>
<whatsThis></whatsThis>
<toolTip>New layer from visible</toolTip>
<iconText>New layer from visible</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="duplicatelayer">
<icon>duplicatelayer</icon>
<text>&amp;Duplicate Layer or Mask</text>
<whatsThis></whatsThis>
<toolTip>Duplicate Layer or Mask</toolTip>
<iconText>Duplicate Layer or Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+J</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="cut_selection_to_new_layer">
<icon></icon>
<text>&amp;Cut Selection to New Layer</text>
<whatsThis></whatsThis>
<toolTip>Cut Selection to New Layer</toolTip>
<iconText>Cut Selection to New Layer</iconText>
<activationFlags>100000000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>Ctrl+Shift+J</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="copy_selection_to_new_layer">
<icon></icon>
<text>Copy &amp;Selection to New Layer</text>
<whatsThis></whatsThis>
<toolTip>Copy Selection to New Layer</toolTip>
<iconText>Copy Selection to New Layer</iconText>
<activationFlags>100000000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+Alt+J</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="copy_layer_clipboard">
<icon></icon>
<text>Copy Layer</text>
<whatsThis></whatsThis>
<toolTip>Copy layer to clipboard</toolTip>
<iconText>Copy layer to clipboard</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="cut_layer_clipboard">
<icon></icon>
<text>Cut Layer</text>
<whatsThis></whatsThis>
<toolTip>Cut layer to clipboard</toolTip>
<iconText>Cut layer to clipboard</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="paste_layer_from_clipboard">
<icon></icon>
<text>Paste Layer</text>
<whatsThis></whatsThis>
<toolTip>Paste layer from clipboard</toolTip>
<iconText>Paste layer from clipboard</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="create_quick_group">
<icon></icon>
<text>Quick Group</text>
<whatsThis></whatsThis>
<toolTip>Create a group layer containing selected layers</toolTip>
<iconText>Quick Group</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+G</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="quick_ungroup">
<icon></icon>
<text>Quick Ungroup</text>
<whatsThis></whatsThis>
<toolTip>Remove grouping of the layers or remove one layer out of the group</toolTip>
<iconText>Quick Ungroup</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+Alt+G</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="create_quick_clipping_group">
<icon></icon>
<text>Quick Clipping Group</text>
<whatsThis></whatsThis>
<toolTip>Group selected layers and add a layer with clipped alpha channel</toolTip>
<iconText>Quick Clipping Group</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+Shift+G</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="select_all_layers">
<icon></icon>
<text>All Layers</text>
<whatsThis></whatsThis>
<toolTip>Select all layers</toolTip>
<iconText>Select all layers</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="select_visible_layers">
<icon></icon>
<text>Visible Layers</text>
<whatsThis></whatsThis>
<toolTip>Select all visible layers</toolTip>
<iconText>Select all visible layers</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="select_locked_layers">
<icon></icon>
<text>Locked Layers</text>
<whatsThis></whatsThis>
<toolTip>Select all locked layers</toolTip>
<iconText>Select all locked layers</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="select_invisible_layers">
<icon></icon>
<text>Invisible Layers</text>
<whatsThis></whatsThis>
<toolTip>Select all invisible layers</toolTip>
<iconText>Select all invisible layers</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="select_unlocked_layers">
<icon></icon>
<text>Unlocked Layers</text>
<whatsThis></whatsThis>
<toolTip>Select all unlocked layers</toolTip>
<iconText>Select all unlocked layers</iconText>
<activationFlags>10000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="save_node_as_image">
<icon>document-save</icon>
<text>&amp;Save Layer/Mask...</text>
<whatsThis></whatsThis>
<toolTip>Save Layer/Mask</toolTip>
<iconText>Save Layer/Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="save_groups_as_images">
<icon>document-save</icon>
<text>Save &amp;Group Layers...</text>
<whatsThis></whatsThis>
<toolTip>Save Group Layers</toolTip>
<iconText>Save Group Layers</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="convert_group_to_animated">
<icon></icon>
<text>Convert group to &amp;animated layer</text>
<whatsThis></whatsThis>
<toolTip>Convert child layers into animation frames</toolTip>
<iconText>Convert child layers into animation frames</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="import_layer_from_file">
<icon></icon>
<text>I&amp;mport Layer...</text>
<whatsThis></whatsThis>
<toolTip>Import Layer</toolTip>
<iconText>Import Layer</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="import_layer_as_paint_layer">
<icon>paintLayer</icon>
<text>&amp;as Paint Layer...</text>
<whatsThis></whatsThis>
<toolTip>as Paint Layer</toolTip>
<iconText>as Paint Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="import_layer_as_transparency_mask">
<icon>transparencyMask</icon>
<text>as &amp;Transparency Mask...</text>
<whatsThis></whatsThis>
<toolTip>as Transparency Mask</toolTip>
<iconText>as Transparency Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="import_layer_as_filter_mask">
<icon>filterMask</icon>
<text>as &amp;Filter Mask...</text>
<whatsThis></whatsThis>
<toolTip>as Filter Mask</toolTip>
<iconText>as Filter Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="import_layer_as_selection_mask">
<icon>selectionMask</icon>
<text>as &amp;Selection Mask...</text>
<whatsThis></whatsThis>
<toolTip>as Selection Mask</toolTip>
<iconText>as Selection Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="convert_to_paint_layer">
<icon>paintLayer</icon>
<text>to &amp;Paint Layer</text>
<whatsThis></whatsThis>
<toolTip>to Paint Layer</toolTip>
<iconText>to Paint Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="convert_to_transparency_mask">
<icon>transparencyMask</icon>
<text>to &amp;Transparency Mask</text>
<whatsThis></whatsThis>
<toolTip>to Transparency Mask</toolTip>
<iconText>to Transparency Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="convert_to_filter_mask">
<icon>filterMask</icon>
<text>to &amp;Filter Mask...</text>
<whatsThis></whatsThis>
<toolTip>to Filter Mask</toolTip>
<iconText>to Filter Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="convert_to_selection_mask">
<icon>selectionMask</icon>
<text>to &amp;Selection Mask</text>
<whatsThis></whatsThis>
<toolTip>to Selection Mask</toolTip>
<iconText>to Selection Mask</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="split_alpha_into_mask">
<icon>transparencyMask</icon>
<text>&amp;Alpha into Mask</text>
<whatsThis></whatsThis>
<toolTip>Alpha into Mask</toolTip>
<iconText>Alpha into Mask</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>10</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="split_alpha_write">
<icon>transparency-enabled</icon>
<text>&amp;Write as Alpha</text>
<whatsThis></whatsThis>
<toolTip>Write as Alpha</toolTip>
<iconText>Write as Alpha</iconText>
<activationFlags>1000000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="split_alpha_save_merged">
<icon>document-save</icon>
<text>&amp;Save Merged...</text>
<whatsThis></whatsThis>
<toolTip>Save Merged</toolTip>
<iconText>Save Merged</iconText>
<activationFlags>1000000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="layersplit">
<icon>split-layer</icon>
<text>Split Layer...</text>
<whatsThis></whatsThis>
<toolTip>Split Layer</toolTip>
<iconText>Split Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="waveletdecompose">
<icon></icon>
<text>Wavelet Decompose ...</text>
<whatsThis></whatsThis>
<toolTip>Wavelet Decompose</toolTip>
<iconText>Wavelet Decompose</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="mirrorNodeX">
<icon>symmetry-horizontal</icon>
<text>Mirror Layer Hori&amp;zontally</text>
<whatsThis></whatsThis>
<toolTip>Mirror Layer Horizontally</toolTip>
<iconText>Mirror Layer Horizontally</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="mirrorNodeY">
<icon>symmetry-vertical</icon>
<text>Mirror Layer &amp;Vertically</text>
<whatsThis></whatsThis>
<toolTip>Mirror Layer Vertically</toolTip>
<iconText>Mirror Layer Vertically</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="rotatelayer">
<icon></icon>
<text>&amp;Rotate Layer...</text>
<whatsThis></whatsThis>
<toolTip>Rotate Layer</toolTip>
<iconText>Rotate Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="rotateLayerCW90">
<icon>object-rotate-right</icon>
<text>Rotate &amp;Layer 90° to the Right</text>
<whatsThis></whatsThis>
<toolTip>Rotate Layer 90° to the Right</toolTip>
<iconText>Rotate Layer 90° to the Right</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="rotateLayerCCW90">
<icon>object-rotate-left</icon>
<text>Rotate Layer &amp;90° to the Left</text>
<whatsThis></whatsThis>
<toolTip>Rotate Layer 90° to the Left</toolTip>
<iconText>Rotate Layer 90° to the Left</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="rotateLayer180">
<icon></icon>
<text>Rotate Layer &amp;180°</text>
<whatsThis></whatsThis>
<toolTip>Rotate Layer 180°</toolTip>
<iconText>Rotate Layer 180°</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="layersize">
<icon></icon>
<text>Scale &amp;Layer to new Size...</text>
<whatsThis></whatsThis>
<toolTip>Scale Layer to new Size</toolTip>
<iconText>Scale Layer to new Size</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="shearlayer">
<icon></icon>
<text>&amp;Shear Layer...</text>
<whatsThis></whatsThis>
<toolTip>Shear Layer</toolTip>
<iconText>Shear Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="offsetlayer">
<icon></icon>
<text>&amp;Offset Layer...</text>
<whatsThis></whatsThis>
<toolTip>Offset Layer</toolTip>
<iconText>Offset Layer</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="clones_array">
<icon></icon>
<text>Clones &amp;Array...</text>
<whatsThis></whatsThis>
<toolTip>Clones Array</toolTip>
<iconText>Clones Array</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="EditLayerMetaData">
<icon></icon>
<text>&amp;Edit metadata...</text>
<whatsThis></whatsThis>
<toolTip>Edit metadata</toolTip>
<iconText>Edit metadata</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="histogram">
<icon></icon>
<text>&amp;Histogram...</text>
<whatsThis></whatsThis>
<toolTip>Histogram</toolTip>
<iconText>Histogram</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="layercolorspaceconversion">
<icon></icon>
<text>&amp;Convert Layer Color Space...</text>
<whatsThis></whatsThis>
<toolTip>Convert Layer Color Space</toolTip>
<iconText>Convert Layer Color Space</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="merge_layer">
<icon>merge-layer-below</icon>
<text>&amp;Merge with Layer Below</text>
<whatsThis></whatsThis>
<toolTip>Merge with Layer Below</toolTip>
<iconText>Merge with Layer Below</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+E</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="flatten_layer">
<icon></icon>
<text>&amp;Flatten Layer</text>
<whatsThis></whatsThis>
<toolTip>Flatten Layer</toolTip>
<iconText>Flatten Layer</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="rasterize_layer">
<icon></icon>
<text>Ras&amp;terize Layer</text>
<whatsThis></whatsThis>
<toolTip>Rasterize Layer</toolTip>
<iconText>Rasterize Layer</iconText>
<activationFlags>10000000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="flatten_image">
<icon></icon>
<text>Flatten ima&amp;ge</text>
<whatsThis></whatsThis>
<toolTip>Flatten image</toolTip>
<iconText>Flatten image</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>Ctrl+Shift+E</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="layer_style">
<icon></icon>
<text>La&amp;yer Style...</text>
<whatsThis></whatsThis>
<toolTip>Layer Style</toolTip>
<iconText>Layer Style</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="LayerGroupSwitcher/previous">
<icon></icon>
<text>Move into previous group</text>
<whatsThis></whatsThis>
<toolTip>Move into previous group</toolTip>
<iconText>Move into previous group</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="LayerGroupSwitcher/next">
<icon></icon>
<text>Move into next group</text>
<whatsThis></whatsThis>
<toolTip>Move into next group</toolTip>
<iconText>Move into next group</iconText>
<activationFlags>0</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="RenameCurrentLayer">
<icon></icon>
<text>Rename current layer</text>
<whatsThis></whatsThis>
<toolTip>Rename current layer</toolTip>
<iconText>Rename current layer</iconText>
<activationFlags>100000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut>F2</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="remove_layer">
<icon>deletelayer</icon>
<text>&amp;Remove Layer</text>
<whatsThis></whatsThis>
<toolTip>Remove Layer</toolTip>
<iconText>Remove Layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>Shift+Delete</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="move_layer_up">
<icon>arrowupblr</icon>
<text>Move Layer or Mask Up</text>
<whatsThis></whatsThis>
<toolTip>Move Layer or Mask Up</toolTip>
<iconText></iconText>
<shortcut>Ctrl+PgUp</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="move_layer_down">
<icon>arrowdown</icon>
<text>Move Layer or Mask Down</text>
<whatsThis></whatsThis>
<toolTip>Move Layer or Mask Down</toolTip>
<iconText></iconText>
<shortcut>Ctrl+PgDown</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="layer_properties">
<icon>properties</icon>
<text>&amp;Properties...</text>
<whatsThis></whatsThis>
<toolTip>Properties</toolTip>
<iconText>Properties</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>1</activationConditions>
<shortcut>F3</shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
</Actions>
</ActionCollection>
diff --git a/krita/org.kde.krita.appdata.xml b/krita/org.kde.krita.appdata.xml
index e634ae6ded..3eb2dc9814 100644
--- a/krita/org.kde.krita.appdata.xml
+++ b/krita/org.kde.krita.appdata.xml
@@ -1,165 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
<id>org.kde.krita.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<name>Krita</name>
<name xml:lang="ca">Krita</name>
<name xml:lang="ca-valencia">Krita</name>
<name xml:lang="cs">Krita</name>
<name xml:lang="de">Krita</name>
+ <name xml:lang="en-GB">Krita</name>
<name xml:lang="es">Krita</name>
<name xml:lang="it">Krita</name>
<name xml:lang="nl">Krita</name>
<name xml:lang="pl">Krita</name>
<name xml:lang="pt">Krita</name>
<name xml:lang="sv">Krita</name>
<name xml:lang="uk">Krita</name>
<name xml:lang="x-test">xxKritaxx</name>
<summary>Digital Painting, Creative Freedom</summary>
<summary xml:lang="ast">Pintura dixital, llibertá creativa</summary>
<summary xml:lang="bs">Digitalno crtanje, kreativna sloboda</summary>
<summary xml:lang="ca">Dibuix digital, Llibertat creativa</summary>
<summary xml:lang="ca-valencia">Dibuix digital, Llibertat creativa</summary>
<summary xml:lang="cs">Digitální malování, svoboda tvorby</summary>
<summary xml:lang="da">Digital tegning, kunstnerisk frihed</summary>
<summary xml:lang="de">Digitales Malen, kreative Freiheit</summary>
<summary xml:lang="en-GB">Digital Painting, Creative Freedom</summary>
<summary xml:lang="es">Pintura digital, libertad creativa</summary>
<summary xml:lang="et">Digitaalne joonistamine, loominguline vabadus</summary>
<summary xml:lang="fi">Digitaalimaalaus, luova vapaus</summary>
<summary xml:lang="fr">Peinture numérique, liberté créatrice</summary>
<summary xml:lang="gl">Debuxo dixital, liberdade creativa</summary>
<summary xml:lang="ia">Pictura digital, Libertate creative</summary>
<summary xml:lang="it">Pittura digitale, libertà creativa</summary>
<summary xml:lang="nl">Digital Painting, Creative Freedom</summary>
<summary xml:lang="pl">Cyfrowe malowanie, Wolność Twórcza</summary>
<summary xml:lang="pt">Pintura Digital, Liberdade Criativa</summary>
<summary xml:lang="pt-BR">Pintura Digital, Liberdade Criativa</summary>
<summary xml:lang="ru">Цифровое рисование. Творческая свобода</summary>
<summary xml:lang="sk">Digitálne maľovanie, kreatívna sloboda</summary>
<summary xml:lang="sv">Digital målning, kreativ frihet</summary>
<summary xml:lang="uk">Цифрове малювання, творча свобода</summary>
<summary xml:lang="x-test">xxDigital Painting, Creative Freedomxx</summary>
<summary xml:lang="zh-CN">数码绘图,自由创作</summary>
<description>
<p>Krita is the full-featured digital art studio.</p>
<p xml:lang="ast">Krita ye l'estudiu completu d'arte dixital.</p>
<p xml:lang="bs">Krita je potpuni digitalni umjetnički studio.</p>
<p xml:lang="ca">Krita és l'estudi d'art digital ple de funcionalitats.</p>
<p xml:lang="ca-valencia">Krita és l'estudi d'art digital ple de funcionalitats.</p>
<p xml:lang="de">Krita ist ein digitales Designstudio mit umfangreichen Funktionen.</p>
<p xml:lang="en-GB">Krita is the full-featured digital art studio.</p>
<p xml:lang="es">Krita es un estudio de arte digital completo</p>
<p xml:lang="et">Krita on rohkete võimalustega digitaalkunstistuudio.</p>
<p xml:lang="fi">Krita on täyspiirteinen digitaiteen ateljee.</p>
<p xml:lang="fr">Krita est le studio d'art numérique complet.</p>
<p xml:lang="gl">Krita é un estudio completo de arte dixital.</p>
<p xml:lang="ia">Krita es le studio de arte digital complete.</p>
<p xml:lang="it">Krita è uno studio d'arte digitale completo.</p>
<p xml:lang="ja">Krita は、フル機能を備えたデジタルなアートスタジオです。</p>
<p xml:lang="nl">Krita is de digitale kunststudio vol mogelijkheden.</p>
<p xml:lang="pl">Krita jest pełnowymiarowym, cyfrowym studiem artystycznym</p>
<p xml:lang="pt">O Krita é o estúdio de arte digital completo.</p>
<p xml:lang="pt-BR">O Krita é o estúdio de arte digital completo.</p>
<p xml:lang="ru">Krita полнофункциональный инструмент для создания цифровой графики.</p>
<p xml:lang="sk">Krita je plne vybavené digitálne umelecké štúdio.</p>
<p xml:lang="sv">Krita är den fullfjädrade digitala konststudion.</p>
<p xml:lang="uk">Krita — повноцінний комплекс для створення цифрових художніх творів.</p>
<p xml:lang="x-test">xxKrita is the full-featured digital art studio.xx</p>
<p xml:lang="zh-CN">Krita 是全功能的数码艺术工作室。</p>
<p>It is perfect for sketching and painting, and presents an end–to–end solution for creating digital painting files from scratch by masters.</p>
<p xml:lang="bs">On je savršen za skiciranje i slikanje i predstavlja finalno rješenje za kreiranje digitalnih slika od nule s majstorima</p>
<p xml:lang="ca">És perfecte per fer esbossos i pintar, i presenta una solució final per crear fitxers de dibuix digital des de zero per a mestres.</p>
<p xml:lang="ca-valencia">És perfecte per fer esbossos i pintar, i presenta una solució final per crear fitxers de dibuix digital des de zero per a mestres.</p>
<p xml:lang="en-GB">It is perfect for sketching and painting, and presents an end–to–end solution for creating digital painting files from scratch by masters.</p>
<p xml:lang="es">Es perfecto para diseñar y pintar, y ofrece una solución completa para crear desde cero archivos de pintura digital apta para profesionales.</p>
<p xml:lang="et">See on suurepärane töövahend visandite ja joonistuste valmistamiseks ning annab andekatele kunstnikele võimaluse luua digitaalpilt algusest lõpuni just oma käe järgi.</p>
<p xml:lang="fi">Se on täydellinen luonnosteluun ja maalaukseen ja tarjoaa kokonaisratkaisun digitaalisten kuvatiedostojen luomiseen alusta alkaen.</p>
<p xml:lang="fr">Il est parfait pour crayonner et peindre, et constitue une solution de bout en bout pour créer des fichier de peinture numérique depuis la feuille blanche jusqu'au épreuves finales.</p>
<p xml:lang="gl">Resulta perfecto para debuxar e pintar, e presenta unha solución completa que permite aos mestres crear ficheiros de debuxo dixital desde cero.</p>
<p xml:lang="ia">Illo es perfecte pro schizzar e pinger, e presenta un solution ab fin al fin pro crear files de pictura digital ab grattamentos per maestros.</p>
<p xml:lang="it">Perfetto per fare schizzi e dipingere, prevede una soluzione completa che consente agli artisti di creare file di dipinti digitali partendo da zero.</p>
<p xml:lang="nl">Het is perfect voor schetsen en schilderen en zet een end–to–end oplossing voor het maken van digitale bestanden voor schilderingen vanuit het niets door meesters.</p>
<p xml:lang="pl">Nadaje się perfekcyjnie do szkicowania i malowania i dostarcza zupełnego rozwiązania dla tworzenia plików malowideł cyfrowych od zalążka.</p>
<p xml:lang="pt">É perfeito para desenhos e pinturas, oferecendo uma solução final para criar ficheiros de pintura digital do zero por mestres.</p>
<p xml:lang="pt-BR">É perfeito para desenhos e pinturas, oferecendo uma solução final para criar arquivos de desenho digital feitos a partir do zero por mestres.</p>
<p xml:lang="ru">Она превосходно подходит для набросков и рисования, предоставляя мастерам самодостаточный инструмент для создания цифровой живописи с нуля.</p>
<p xml:lang="sk">Je ideálna na skicovanie a maľovanie a poskytuje end-to-end riešenie na vytváranie súborov digitálneho maľovania od základu od profesionálov.</p>
<p xml:lang="sv">Den är perfekt för att skissa och måla, samt erbjuder en helomfattande lösning för att skapa digitala målningsfiler från grunden av mästare.</p>
<p xml:lang="uk">Цей комплекс чудово пасує для створення ескізів та художніх зображень і є самодостатнім набором для створення файлів цифрових полотен «з нуля» для справжніх художників.</p>
<p xml:lang="x-test">xxIt is perfect for sketching and painting, and presents an end–to–end solution for creating digital painting files from scratch by masters.xx</p>
<p xml:lang="zh-CN">适合做草图和绘画,为艺术大师提供了从草稿到数码绘画的完整解决方案。</p>
<p>
Krita is a great choice for creating concept art, comics, textures for rendering and matte paintings. Krita supports many colorspaces like RGB and CMYK
at 8 and 16 bits integer channels, as well as 16 and 32 bits floating point channels.
</p>
<p xml:lang="bs">Krita je odličan izbor za kreiranje konceptualne umjetnosti, stripove, teksture za obradu i mat slike. Krita podržava mnoge prostore boja kao RGB i CMIK na 8 i 16 bitnim cjelobrojnim kanalimaa, kao i 16 i 32 bita floating point kanalima.</p>
<p xml:lang="ca">El Krita és una gran elecció per crear art conceptual, còmics, textures per renderitzar i pintures «matte». El Krita permet molts espais de color com el RGB i el CMYK a 8 i 16 bits de canals sencers, així com 16 i 32 bits de canals de coma flotant.</p>
<p xml:lang="ca-valencia">El Krita és una gran elecció per crear art conceptual, còmics, textures per renderitzar i pintures «matte». El Krita permet molts espais de color com el RGB i el CMYK a 8 i 16 bits de canals sencers, així com 16 i 32 bits de canals de coma flotant.</p>
<p xml:lang="en-GB">Krita is a great choice for creating concept art, comics, textures for rendering and matte paintings. Krita supports many colourspaces like RGB and CMYK at 8 and 16 bits integer channels, as well as 16 and 32 bits floating point channels.</p>
<p xml:lang="es">Krita es una gran elección para crear arte conceptual, cómics, texturas para renderizar y «matte paintings». Krita permite el uso de muchos espacios de color, como, por ejemplo, RGB y CMYK, tanto en canales de enteros de 8 y 16 bits, así como en canales de coma flotante de 16 y 32 bits.</p>
<p xml:lang="et">Krita on üks paremaid valikuid kontseptuaalkunsti, koomiksite, tekstuuride ja digitaalmaalide loomiseks. Krita toetab paljusid värviruume, näiteks RGB ja CMYK 8 ja 16 täisarvulise bitiga kanali kohta, samuti 16 ja 32 ujukomabitiga kanali kohta.</p>
<p xml:lang="fi">Krita on hyvä valinta konseptikuvituksen, sarjakuvien, pintakuvioiden ja maalausten luomiseen. Krita tukee useita väriavaruuksia kuten RGB:tä ja CMYK:ta 8 ja 16 bitin kokonaisluku- samoin kuin 16 ja 32 bitin liukulukukanavin.</p>
<p xml:lang="fr">Krita est un très bon choix pour créer des concepts arts, des bandes-dessinées, des textures de rendu et des peintures. Krita prend en charge plusieurs espaces de couleurs comme RVB et CMJN avec les canaux de 8 et 16 bits entiers ainsi que les canaux de 16 et 32 bits flottants.</p>
<p xml:lang="gl">Krita é unha gran opción para crear arte conceptual, texturas para renderización e pinturas mate. Krita permite usar moitos espazos de cores como RGB e CMYK con canles de 8 e 16 bits, así como canles de coma flotante de 16 e 32 bits.</p>
<p xml:lang="ia">Krita es un grande selection pro crear arte de concepto, comics, texturas pro rendering e picturas opac. Krita supporta multe spatios de colores como RGB e CMYK con canales de integer a 8 e 16 bits, como anque canales floating point a 16 e 32 bits.</p>
<p xml:lang="it">Krita rappresenta una scelta ottimale per la creazione di arte concettuale, fumetti e texture per il rendering e il matte painting. Krita supporta molti spazi colori come RGB e CMYK a 8 e 16 bit per canali interi e 16 e 32 bit per canali a virgola mobile.</p>
<p xml:lang="ja">コンセプトアート、コミック、3DCG 用テクスチャ、マットペイントを制作する方にとって、Krita は最適な選択です。Krita は、8/16 ビット整数/チャンネル、および 16/32 ビット浮動小数点/チャンネルの RGB や CMYK をはじめ、さまざまな色空間をサポートしています。</p>
<p xml:lang="nl">Krita is een goede keuze voor het maken van kunstconcepten, strips, textuur voor weergeven en matte schilderijen. Krita ondersteunt vele kleurruimten zoals RGB en CMYK in 8 en 16 bits kanalen met gehele getallen, evenals 16 en 32 bits kanalen met drijvende komma.</p>
<p xml:lang="pl">Krita jest świetnym wyborem przy tworzeniu koncepcyjnej sztuki, komiksów, tekstur do wyświetlania i kaszet. Krita obsługuje wiele przestrzeni barw takich jak RGB oraz CMYK dla kanałów 8 oraz 16 bitowych wyrażonych w l. całkowitych, a także 16 oraz 32 bitowych wyrażonych w l. zmiennoprzecinkowych.</p>
<p xml:lang="pt">O Krita é uma óptima escolha para criar arte conceptual, banda desenhada, texturas para desenho e pinturas. O Krita suporta diversos espaços de cores como o RGB e o CMYK com canais de cores inteiros a 8 e 16 bits, assim como canais de vírgula flutuante a 16 e a 32 bits.</p>
<p xml:lang="pt-BR">O Krita é uma ótima escolha para criação de arte conceitual, histórias em quadrinhos, texturas para desenhos e pinturas. O Krita tem suporte a diversos espaços de cores como RGB e CMYK com canais de cores inteiros de 8 e 16 bits, assim como canais de ponto flutuante de 16 e 32 bits.</p>
<p xml:lang="ru">Krita - отличный выбор для создания концепт-артов, комиксов, текстур для рендеринга и рисования. Она поддерживает множество цветовых пространств включая RGB и CMYK с 8 и 16 целыми битами на канал, а также 16 и 32 битами с плавающей запятой на канал.</p>
<p xml:lang="sk">Krita je výborná voľba pre vytváranie konceptového umenia, textúr na renderovanie a matné kresby. Krita podporuje mnoho farebných priestorov ako RGB a CMYK na 8 a 16 bitových celočíselných kanáloch ako aj 16 a 32 bitových reálnych kanáloch.</p>
<p xml:lang="sv">Krita är ett utmärkt val för att skapa concept art, serier, strukturer för återgivning och bakgrundsmålningar. Krita stöder många färgrymder som RGB och CMYK med 8- och 16-bitars heltal, samt 16- och 32-bitars flyttal.</p>
<p xml:lang="uk">Krita — чудовий інструмент для створення концептуального живопису, коміксів, текстур для моделей та декорацій. У Krita передбачено підтримку багатьох просторів кольорів, зокрема RGB та CMYK з 8-бітовими та 16-бітовими цілими значеннями, а також 16-бітовими та 32-бітовими значеннями з рухомою крапкою для каналів кольорів.</p>
<p xml:lang="x-test">xxKrita is a great choice for creating concept art, comics, textures for rendering and matte paintings. Krita supports many colorspaces like RGB and CMYK at 8 and 16 bits integer channels, as well as 16 and 32 bits floating point channels.xx</p>
<p xml:lang="zh-CN">Krita 是创建抽象艺术,漫画,渲染纹理和亚光绘画的理想选择。Krita 支持非常多的色彩空间,比如 8 位和 16 位整数通道以及 16 位和 32 位浮点通道的 RGB 和 CMYK。</p>
<p>Have fun painting with the advanced brush engines, amazing filters and many handy features that make Krita enormously productive.</p>
<p xml:lang="bs">Zabavite se kreirajući napredne pogone četki, filtere i mnoge praktične osobine koje čine Krita vrlo produktivnim.</p>
<p xml:lang="ca">Gaudiu pintant amb els motors de pinzells avançats, els filtres impressionants i moltes funcionalitats útils que fan el Krita molt productiu.</p>
<p xml:lang="ca-valencia">Gaudiu pintant amb els motors de pinzells avançats, els filtres impressionants i moltes funcionalitats útils que fan el Krita molt productiu.</p>
<p xml:lang="en-GB">Have fun painting with the advanced brush engines, amazing filters and many handy features that make Krita enormously productive.</p>
<p xml:lang="es">Diviértase pintando con los avanzados motores de pinceles, los espectaculares filtros y muchas funcionalidades prácticas que hacen que Krita sea enormemente productivo.</p>
<p xml:lang="et">Joonistamise muudavad tunduvalt lõbusamaks võimsad pintslimootorid, imetabased filtrid ja veel paljud käepärased võimalused, mis muudavad Krita kasutaja tohutult tootlikuks.</p>
<p xml:lang="fi">Pidä hauskaa maalatessasi edistyneillä sivellinmoottoreilla, hämmästyttävillä suotimilla ja monilla muilla kätevillä ominaisuuksilla, jotka tekevät Kritasta tavattoman tehokkaan.</p>
<p xml:lang="fr">Amusez-vous à peindre avec les outils de brosse avancés, les filtres incroyables et les nombreuses fonctionnalités pratiques qui rendent Krita extrêmement productif.</p>
<p xml:lang="gl">Goza debuxando con motores de pincel avanzados, filtros fantásticos e moitas outras funcionalidades útiles que fan de Krita un programa extremadamente produtivo.</p>
<p xml:lang="ia">Amusa te a pinger con le motores de pincel avantiate, filtros stupende e multe characteristicas amical que face Krita enormemente productive.</p>
<p xml:lang="it">Divertiti a dipingere con gli avanzati sistemi di pennelli, i sorprendenti filtri e molte altre utili caratteristiche che fanno di Krita un software enormemente produttivo.</p>
<p xml:lang="ja">Krita のソフトウェアとしての生産性を高めている先進的なブラシエンジンや素晴らしいフィルタのほか、便利な機能の数々をお楽しみください。</p>
<p xml:lang="nl">Veel plezier met schilderen met the geavanceerde penseel-engines, filters vol verbazing en vele handige mogelijkheden die maken dat Krita enorm productief is.</p>
<p xml:lang="pl">Baw się przy malowaniu przy użyciu zaawansowanych silników pędzli, zadziwiających filtrów i wielu innych przydatnych cech, które czynią z Krity bardzo produktywną.</p>
<p xml:lang="pt">Divirta-se a pintar com os motores de pincéis avançados, os filtros espantosos e muitas outras funcionalidades úteis que tornam o Krita altamente produtivo.</p>
<p xml:lang="pt-BR">Divirta-se pintando com os mecanismos de pincéis avançados, filtros maravilhosos e muitas outras funcionalidades úteis que tornam o Krita altamente produtivo.</p>
<p xml:lang="ru">Получайте удовольствие от использования особых кистевых движков, впечатляющих фильтров и множества других функций, делающих Krita сверхпродуктивной.</p>
<p xml:lang="sk">Užívajte si maľovanie s pokročilými kresliacimi enginmi, úžasnými filtrami a mnohými užitočnými funkciami, ktoré robia Kritu veľmi produktívnu.</p>
<p xml:lang="sv">Ha det så kul vid målning med de avancerade penselfunktionerna, fantastiska filtren och många praktiska funktioner som gör Krita så enormt produktiv.</p>
<p xml:lang="uk">Отримуйте задоволення від малювання за допомогою пензлів з найширшими можливостями, чудових фільтрів та багатьох зручних можливостей, які роблять Krita надзвичайно продуктивним засобом малювання.</p>
<p xml:lang="x-test">xxHave fun painting with the advanced brush engines, amazing filters and many handy features that make Krita enormously productive.xx</p>
<p xml:lang="zh-CN">尽情使用高级笔刷引擎,超赞的滤镜和很多手绘特性,发挥 Krita 绝佳的创造力。</p>
</description>
<url type="homepage">https://www.krita.org/</url>
<url type="faq">https://krita.org/about/faq/</url>
<url type="donation">https://krita.org/support-us/donations/</url>
<url type="help">https://docs.krita.org/Category:Tutorials</url>
<screenshots>
<screenshot type="default">
<image>http://files.kde.org/krita/marketing/appdata/2016-05-24_screenshot_002.png</image>
</screenshot>
<screenshot type="default">
<image>http://files.kde.org/krita/marketing/appdata/2016-05-24_screenshot_003.png</image>
</screenshot>
<screenshot type="default">
<image>http://files.kde.org/krita/marketing/appdata/2016-05-24_screenshot_004.png</image>
</screenshot>
<screenshot type="default">
<image>http://files.kde.org/krita/marketing/appdata/2016-05-24_screenshot_005.png</image>
</screenshot>
</screenshots>
<update_contact>foundation@krita.org</update_contact>
<project_group>KDE</project_group>
<provides>
<binary>krita</binary>
</provides>
</component>
diff --git a/krita/pics/misc-dark/misc-dark-icons.qrc b/krita/pics/misc-dark/misc-dark-icons.qrc
index 2bb29be62b..62db775c2a 100644
--- a/krita/pics/misc-dark/misc-dark-icons.qrc
+++ b/krita/pics/misc-dark/misc-dark-icons.qrc
@@ -1,55 +1,54 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>dark_draw-eraser.svg</file>
<file>dark_geometry.svg</file>
<file alias="dark_object-align-horizontal-center-calligra.svg">dark_ox16-action-object-align-horizontal-center-calligra.svg</file>
<file alias="dark_object-align-horizontal-left-calligra.svg">dark_ox16-action-object-align-horizontal-left-calligra.svg</file>
<file alias="dark_object-align-horizontal-right-calligra.svg">dark_ox16-action-object-align-horizontal-right-calligra.svg</file>
<file alias="dark_object-align-vertical-bottom-calligra.svg">dark_ox16-action-object-align-vertical-bottom-calligra.svg</file>
<file alias="dark_object-align-vertical-center-calligra.svg">dark_ox16-action-object-align-vertical-center-calligra.svg</file>
<file alias="dark_object-align-vertical-top-calligra.svg">dark_ox16-action-object-align-vertical-top-calligra.svg</file>
<file alias="dark_object-order-back-calligra.svg">dark_ox16-action-object-order-back-calligra.svg</file>
<file alias="dark_object-order-front-calligra.svg">dark_ox16-action-object-order-front-calligra.svg</file>
<file alias="dark_object-order-lower-calligra.svg">dark_ox16-action-object-order-lower-calligra.svg</file>
<file alias="dark_object-order-raise-calligra.svg">dark_ox16-action-object-order-raise-calligra.svg</file>
<file alias="dark_object-group-calligra.svg">dark_ox16-action-object-group-calligra.svg</file>
<file alias="dark_object-ungroup-calligra.svg">dark_ox16-action-object-ungroup-calligra.svg</file>
<file>dark_distribute-horizontal-center.svg</file>
<file>dark_distribute-horizontal-left.svg</file>
<file>dark_distribute-horizontal-right.svg</file>
<file>dark_distribute-horizontal.svg</file>
<file>dark_distribute-vertical-bottom.svg</file>
<file>dark_distribute-vertical-center.svg</file>
<file>dark_distribute-vertical-top.svg</file>
<file>dark_distribute-vertical.svg</file>
<file>dark_paintop_settings_01.svg</file>
<file>dark_paintop_settings_02.svg</file>
<file>dark_pivot-point.svg</file>
<file>dark_stroke-cap-butt.svg</file>
<file>dark_stroke-cap-round.svg</file>
<file>dark_stroke-cap-square.svg</file>
<file>dark_stroke-join-bevel.svg</file>
<file>dark_stroke-join-miter.svg</file>
<file>dark_stroke-join-round.svg</file>
<file>dark_symmetry-horizontal.svg</file>
<file>dark_symmetry-vertical.svg</file>
<file>dark_onionOff.svg</file>
<file>dark_onionOn.svg</file>
<file>dark_onion_skin_options.svg</file>
- <file>dark_onion_skin_options.svg</file>
<file>dark_path-break-point.svg</file>
<file>dark_path-break-segment.svg</file>
<file>dark_pathpoint-corner.svg</file>
<file>dark_pathpoint-curve.svg</file>
<file>dark_pathpoint-insert.svg</file>
<file>dark_pathpoint-join.svg</file>
<file>dark_pathpoint-line.svg</file>
<file>dark_pathpoint-merge.svg</file>
<file>dark_pathpoint-remove.svg</file>
<file>dark_pathpoint-smooth.svg</file>
<file>dark_pathpoint-symmetric.svg</file>
<file>dark_pathsegment-curve.svg</file>
<file>dark_pathsegment-line.svg</file>
</qresource>
</RCC>
diff --git a/libs/basicflakes/plugin/KoCreatePathToolFactory.h b/libs/basicflakes/plugin/KoCreatePathToolFactory.h
index 1db235e1c4..0de423789c 100644
--- a/libs/basicflakes/plugin/KoCreatePathToolFactory.h
+++ b/libs/basicflakes/plugin/KoCreatePathToolFactory.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCREATEPATHTOOLFACTORY_H
#define KOCREATEPATHTOOLFACTORY_H
#include "KoToolFactoryBase.h"
/// The factory for the KoCreatePathTool
class KoCreatePathToolFactory : public KoToolFactoryBase
{
public:
/// Constructor
KoCreatePathToolFactory();
/// Destructor
- ~KoCreatePathToolFactory();
+ ~KoCreatePathToolFactory() override;
- KoToolBase* createTool(KoCanvasBase *canvas);
+ KoToolBase* createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/libs/basicflakes/plugin/KoPencilToolFactory.h b/libs/basicflakes/plugin/KoPencilToolFactory.h
index 95d4e4aeb0..6f7416c0be 100644
--- a/libs/basicflakes/plugin/KoPencilToolFactory.h
+++ b/libs/basicflakes/plugin/KoPencilToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOPENCILTOOLFACTORY_H_
#define _KOPENCILTOOLFACTORY_H_
#include <KoToolFactoryBase.h>
class KoPencilToolFactory : public KoToolFactoryBase
{
public:
KoPencilToolFactory();
- ~KoPencilToolFactory();
+ ~KoPencilToolFactory() override;
- KoToolBase * createTool(KoCanvasBase *canvas);
+ KoToolBase * createTool(KoCanvasBase *canvas) override;
};
#endif // _KOPENCILTOOLFACTORY_H_
diff --git a/libs/basicflakes/plugin/Plugin.h b/libs/basicflakes/plugin/Plugin.h
index 67182caeef..c38223f7dc 100644
--- a/libs/basicflakes/plugin/Plugin.h
+++ b/libs/basicflakes/plugin/Plugin.h
@@ -1,33 +1,33 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PLUGIN_H
#define PLUGIN_H
#include <QObject>
#include <QVariantList>
class Plugin : public QObject
{
Q_OBJECT
public:
Plugin(QObject * parent, const QVariantList &);
- ~Plugin() {}
+ ~Plugin() override {}
};
#endif
diff --git a/libs/basicflakes/tools/KoCreatePathTool.h b/libs/basicflakes/tools/KoCreatePathTool.h
index 51094aee08..23cf888a20 100644
--- a/libs/basicflakes/tools/KoCreatePathTool.h
+++ b/libs/basicflakes/tools/KoCreatePathTool.h
@@ -1,109 +1,109 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008-2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCREATEPATHTOOL_H
#define KOCREATEPATHTOOL_H
#include "kritabasicflakes_export.h"
#include <KoFlakeTypes.h>
#include <KoToolBase.h>
#include <QList>
class KoPathShape;
class KoShapeStroke;
class KoCreatePathToolPrivate;
#define KoCreatePathTool_ID "CreatePathTool"
/**
* Tool for creating path shapes.
*/
class KRITABASICFLAKES_EXPORT KoCreatePathTool : public KoToolBase
{
Q_OBJECT
public:
/**
* Constructor for the tool that allows you to create new paths by hand.
* @param canvas the canvas this tool will be working for.
*/
explicit KoCreatePathTool(KoCanvasBase * canvas);
- virtual ~KoCreatePathTool();
+ ~KoCreatePathTool() override;
/// reimplemented
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/// reimplemented
- virtual void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mouseReleaseEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
/// For behavior as selection tool and with initial shift-key
virtual bool listeningToModifiers();
/**
* Returns true if path has been started
*/
bool pathStarted();
public Q_SLOTS:
/// reimplemented
- virtual void activate(ToolActivation activation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation activation, const QSet<KoShape*> &shapes) override;
/// reimplemented
- virtual void deactivate();
+ void deactivate() override;
/// reimplemented
- virtual void documentResourceChanged(int key, const QVariant & res);
+ void documentResourceChanged(int key, const QVariant & res) override;
protected:
/**
* Add path shape to document.
* This method can be overridden and change the behaviour of the tool. In that case the subclass takes ownership of pathShape.
* It gets only called if there are two or more points in the path.
*/
virtual void addPathShape(KoPathShape* pathShape);
protected:
/**
* This method is called to paint the path. Decorations are drawn by KoCreatePathTool afterwards.
*/
virtual void paintPath(KoPathShape& pathShape, QPainter &painter, const KoViewConverter &converter);
void endPath();
void endPathWithoutLastPoint();
void cancelPath();
void removeLastPoint();
/// reimplemented
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
private:
Q_DECLARE_PRIVATE(KoCreatePathTool)
Q_PRIVATE_SLOT(d_func(), void angleDeltaChanged(int))
Q_PRIVATE_SLOT(d_func(), void angleSnapChanged(int))
};
#endif
diff --git a/libs/basicflakes/tools/KoCreatePathTool_p.h b/libs/basicflakes/tools/KoCreatePathTool_p.h
index a902bd59e1..844d950ce9 100644
--- a/libs/basicflakes/tools/KoCreatePathTool_p.h
+++ b/libs/basicflakes/tools/KoCreatePathTool_p.h
@@ -1,427 +1,427 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008-2010 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCREATEPATHTOOL_P_H
#define KOCREATEPATHTOOL_P_H
#include "KoCreatePathTool.h"
#include "KoPathPoint.h"
#include "KoPathPointData.h"
#include "KoPathPointMergeCommand.h"
#include "KoParameterShape.h"
#include "KoShapeManager.h"
#include "KoSnapStrategy.h"
#include "KoToolBase_p.h"
#include <KoViewConverter.h>
#include "math.h"
class KoStrokeConfigWidget;
class KoConverter;
/// Small helper to keep track of a path point and its parent path shape
struct PathConnectionPoint {
PathConnectionPoint()
: path(0), point(0) {
}
// reset state to invalid
void reset() {
path = 0;
point = 0;
}
PathConnectionPoint& operator =(KoPathPoint * pathPoint) {
if (!pathPoint || ! pathPoint->parent()) {
reset();
} else {
path = pathPoint->parent();
point = pathPoint;
}
return *this;
}
bool operator != (const PathConnectionPoint &rhs) const {
return rhs.path != path || rhs.point != point;
}
bool operator == (const PathConnectionPoint &rhs) const {
return rhs.path == path && rhs.point == point;
}
bool isValid() const {
return path && point;
}
// checks if the path and point are still valid
void validate(KoCanvasBase *canvas) {
// no point in validating an already invalid state
if (!isValid()) {
return;
}
// we need canvas to validate
if (!canvas) {
reset();
return;
}
// check if path is still part of the docment
if (!canvas->shapeManager()->shapes().contains(path)) {
reset();
return;
}
// check if point is still part of the path
if (path->pathPointIndex(point) == KoPathPointIndex(-1, -1)) {
reset();
return;
}
}
KoPathShape * path;
KoPathPoint * point;
};
inline qreal squareDistance(const QPointF &p1, const QPointF &p2)
{
qreal dx = p1.x() - p2.x();
qreal dy = p1.y() - p2.y();
return dx * dx + dy * dy;
}
class AngleSnapStrategy : public KoSnapStrategy
{
public:
explicit AngleSnapStrategy(qreal angleStep, bool active)
: KoSnapStrategy(KoSnapGuide::CustomSnapping), m_angleStep(angleStep), m_active(active) {
}
void setStartPoint(const QPointF &startPoint) {
m_startPoint = startPoint;
}
void setAngleStep(qreal angleStep) {
m_angleStep = qAbs(angleStep);
}
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) {
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override {
Q_UNUSED(proxy);
if (!m_active)
return false;
QLineF line(m_startPoint, mousePosition);
qreal currentAngle = line.angle();
int prevStep = qAbs(currentAngle / m_angleStep);
int nextStep = prevStep + 1;
qreal prevAngle = prevStep * m_angleStep;
qreal nextAngle = nextStep * m_angleStep;
if (qAbs(currentAngle - prevAngle) <= qAbs(currentAngle - nextAngle)) {
line.setAngle(prevAngle);
} else {
line.setAngle(nextAngle);
}
qreal maxSquareSnapDistance = maxSnapDistance * maxSnapDistance;
qreal snapDistance = squareDistance(mousePosition, line.p2());
if (snapDistance > maxSquareSnapDistance)
return false;
setSnappedPosition(line.p2());
return true;
}
- virtual QPainterPath decoration(const KoViewConverter &converter) const {
+ QPainterPath decoration(const KoViewConverter &converter) const override {
Q_UNUSED(converter);
QPainterPath decoration;
decoration.moveTo(m_startPoint);
decoration.lineTo(snappedPosition());
return decoration;
}
void deactivate() {
m_active = false;
}
void activate() {
m_active = true;
}
private:
QPointF m_startPoint;
qreal m_angleStep;
bool m_active;
};
class KoCreatePathToolPrivate : public KoToolBasePrivate
{
KoCreatePathTool * const q;
public:
KoCreatePathToolPrivate(KoCreatePathTool * const qq, KoCanvasBase* canvas)
: KoToolBasePrivate(qq, canvas),
q(qq),
shape(0),
activePoint(0),
firstPoint(0),
handleRadius(3),
mouseOverFirstPoint(false),
pointIsDragged(false),
finishAfterThisPoint(false),
hoveredPoint(0),
listeningToModifiers(false),
angleSnapStrategy(0),
angleSnappingDelta(15),
angleSnapStatus(false)
{
}
KoPathShape *shape;
KoPathPoint *activePoint;
KoPathPoint *firstPoint;
int handleRadius;
bool mouseOverFirstPoint;
bool pointIsDragged;
bool finishAfterThisPoint;
PathConnectionPoint existingStartPoint; ///< an existing path point we started a new path at
PathConnectionPoint existingEndPoint; ///< an existing path point we finished a new path at
KoPathPoint *hoveredPoint; ///< an existing path end point the mouse is hovering on
bool listeningToModifiers; // Fine tune when to begin processing modifiers at the beginning of a stroke.
AngleSnapStrategy *angleSnapStrategy;
int angleSnappingDelta;
bool angleSnapStatus;
void repaintActivePoint() const {
const bool isFirstPoint = (activePoint == firstPoint);
if (!isFirstPoint && !pointIsDragged)
return;
QRectF rect = activePoint->boundingRect(false);
// make sure that we have the second control point inside our
// update rect, as KoPathPoint::boundingRect will not include
// the second control point of the last path point if the path
// is not closed
const QPointF &point = activePoint->point();
const QPointF &controlPoint = activePoint->controlPoint2();
rect = rect.united(QRectF(point, controlPoint).normalized());
// when painting the first point we want the
// first control point to be painted as well
if (isFirstPoint) {
const QPointF &controlPoint = activePoint->controlPoint1();
rect = rect.united(QRectF(point, controlPoint).normalized());
}
QPointF border = q->canvas()->viewConverter()
->viewToDocument(QPointF(handleRadius, handleRadius));
rect.adjust(-border.x(), -border.y(), border.x(), border.y());
q->canvas()->updateCanvas(rect);
}
/// returns the nearest existing path point
KoPathPoint* endPointAtPosition(const QPointF &position) const {
QRectF roi = q->handleGrabRect(position);
QList<KoShape *> shapes = q->canvas()->shapeManager()->shapesAt(roi);
KoPathPoint * nearestPoint = 0;
qreal minDistance = HUGE_VAL;
uint grabSensitivity = q->grabSensitivity();
qreal maxDistance = q->canvas()->viewConverter()->viewToDocumentX(grabSensitivity);
Q_FOREACH(KoShape * s, shapes) {
KoPathShape * path = dynamic_cast<KoPathShape*>(s);
if (!path)
continue;
KoParameterShape *paramShape = dynamic_cast<KoParameterShape*>(s);
if (paramShape && paramShape->isParametricShape())
continue;
KoPathPoint * p = 0;
uint subpathCount = path->subpathCount();
for (uint i = 0; i < subpathCount; ++i) {
if (path->isClosedSubpath(i))
continue;
p = path->pointByIndex(KoPathPointIndex(i, 0));
// check start of subpath
qreal d = squareDistance(position, path->shapeToDocument(p->point()));
if (d < minDistance && d < maxDistance) {
nearestPoint = p;
minDistance = d;
}
// check end of subpath
p = path->pointByIndex(KoPathPointIndex(i, path->subpathPointCount(i) - 1));
d = squareDistance(position, path->shapeToDocument(p->point()));
if (d < minDistance && d < maxDistance) {
nearestPoint = p;
minDistance = d;
}
}
}
return nearestPoint;
}
/// Connects given path with the ones we hit when starting/finishing
bool connectPaths(KoPathShape *pathShape, const PathConnectionPoint &pointAtStart, const PathConnectionPoint &pointAtEnd) const {
KoPathShape * startShape = 0;
KoPathShape * endShape = 0;
KoPathPoint * startPoint = 0;
KoPathPoint * endPoint = 0;
if (pointAtStart.isValid()) {
startShape = pointAtStart.path;
startPoint = pointAtStart.point;
}
if (pointAtEnd.isValid()) {
endShape = pointAtEnd.path;
endPoint = pointAtEnd.point;
}
// at least one point must be valid
if (!startPoint && !endPoint)
return false;
// do not allow connecting to the same point twice
if (startPoint == endPoint)
endPoint = 0;
// we have hit an existing path point on start/finish
// what we now do is:
// 1. combine the new created path with the ones we hit on start/finish
// 2. merge the endpoints of the corresponding subpaths
uint newPointCount = pathShape->subpathPointCount(0);
KoPathPointIndex newStartPointIndex(0, 0);
KoPathPointIndex newEndPointIndex(0, newPointCount - 1);
KoPathPoint * newStartPoint = pathShape->pointByIndex(newStartPointIndex);
KoPathPoint * newEndPoint = pathShape->pointByIndex(newEndPointIndex);
// combine with the path we hit on start
KoPathPointIndex startIndex(-1, -1);
if (startShape && startPoint) {
startIndex = startShape->pathPointIndex(startPoint);
pathShape->combine(startShape);
pathShape->moveSubpath(0, pathShape->subpathCount() - 1);
}
// combine with the path we hit on finish
KoPathPointIndex endIndex(-1, -1);
if (endShape && endPoint) {
endIndex = endShape->pathPointIndex(endPoint);
if (endShape != startShape) {
endIndex.first += pathShape->subpathCount();
pathShape->combine(endShape);
}
}
// do we connect twice to a single subpath ?
bool connectToSingleSubpath = (startShape == endShape && startIndex.first == endIndex.first);
if (startIndex.second == 0 && !connectToSingleSubpath) {
pathShape->reverseSubpath(startIndex.first);
startIndex.second = pathShape->subpathPointCount(startIndex.first) - 1;
}
if (endIndex.second > 0 && !connectToSingleSubpath) {
pathShape->reverseSubpath(endIndex.first);
endIndex.second = 0;
}
// after combining we have a path where with the subpaths in the following
// order:
// 1. the subpaths of the pathshape we started the new path at
// 2. the subpath we just created
// 3. the subpaths of the pathshape we finished the new path at
// get the path points we want to merge, as these are not going to
// change while merging
KoPathPoint * existingStartPoint = pathShape->pointByIndex(startIndex);
KoPathPoint * existingEndPoint = pathShape->pointByIndex(endIndex);
// merge first two points
if (existingStartPoint) {
KoPathPointData pd1(pathShape, pathShape->pathPointIndex(existingStartPoint));
KoPathPointData pd2(pathShape, pathShape->pathPointIndex(newStartPoint));
KoPathPointMergeCommand cmd1(pd1, pd2);
cmd1.redo();
}
// merge last two points
if (existingEndPoint) {
KoPathPointData pd3(pathShape, pathShape->pathPointIndex(newEndPoint));
KoPathPointData pd4(pathShape, pathShape->pathPointIndex(existingEndPoint));
KoPathPointMergeCommand cmd2(pd3, pd4);
cmd2.redo();
}
return true;
}
void addPathShape() {
if (!shape) return;
if (shape->pointCount() < 2) {
cleanUp();
return;
}
// this is done so that nothing happens when the mouseReleaseEvent for the this event is received
KoPathShape *pathShape = shape;
shape = 0;
q->addPathShape(pathShape);
cleanUp();
return;
}
void cleanUp() {
// reset snap guide
q->canvas()->updateCanvas(q->canvas()->snapGuide()->boundingRect());
q->canvas()->snapGuide()->reset();
angleSnapStrategy = 0;
delete shape;
shape = 0;
existingStartPoint = 0;
existingEndPoint = 0;
hoveredPoint = 0;
listeningToModifiers = false;
}
void angleDeltaChanged(int value) {
angleSnappingDelta = value;
if (angleSnapStrategy)
angleSnapStrategy->setAngleStep(angleSnappingDelta);
}
void angleSnapChanged(int angleSnap) {
angleSnapStatus = ! angleSnapStatus;
if (angleSnapStrategy) {
if (angleSnap == Qt::Checked)
angleSnapStrategy->activate();
else
angleSnapStrategy->deactivate();
}
}
};
#endif // KOCREATEPATHTOOL_P_H
diff --git a/libs/basicflakes/tools/KoPencilTool.h b/libs/basicflakes/tools/KoPencilTool.h
index 60201a123f..d8951a6a83 100644
--- a/libs/basicflakes/tools/KoPencilTool.h
+++ b/libs/basicflakes/tools/KoPencilTool.h
@@ -1,103 +1,103 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOPENCILTOOL_H_
#define _KOPENCILTOOL_H_
#include "KoFlakeTypes.h"
#include "KoToolBase.h"
class KoPathShape;
class KoShapeStroke;
class KoPathPoint;
class KoStrokeConfigWidget;
#include "kritabasicflakes_export.h"
class KRITABASICFLAKES_EXPORT KoPencilTool : public KoToolBase
{
Q_OBJECT
public:
explicit KoPencilTool(KoCanvasBase *canvas);
- ~KoPencilTool();
+ ~KoPencilTool() override;
- void paint(QPainter &painter, const KoViewConverter &converter);
- void repaintDecorations();
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
+ void repaintDecorations() override;
- void mousePressEvent(KoPointerEvent *event) ;
- void mouseMoveEvent(KoPointerEvent *event);
- void mouseReleaseEvent(KoPointerEvent *event);
- void keyPressEvent(QKeyEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override ;
+ void mouseMoveEvent(KoPointerEvent *event) override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
- virtual void activate(ToolActivation activation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void activate(ToolActivation activation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
protected:
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
/**
* Add path shape to document.
* This method can be overridden and change the behaviour of the tool. In that case the subclass takes ownership of pathShape.
* It gets only called, if there are two or more points in the path.
*/
virtual void addPathShape(KoPathShape* path, bool closePath);
KoShapeStrokeSP createStroke();
void setFittingError(qreal fittingError);
qreal getFittingError();
private Q_SLOTS:
void selectMode(int mode);
void setOptimize(int state);
void setDelta(double delta);
protected Q_SLOTS:
virtual void slotUpdatePencilCursor();
private:
qreal lineAngle(const QPointF &p1, const QPointF &p2);
void addPoint(const QPointF & point);
void finish(bool closePath);
/// returns the nearest existing path point
KoPathPoint* endPointAtPosition(const QPointF &position);
/// Connects given path with the ones we hit when starting/finishing
bool connectPaths(KoPathShape *pathShape, KoPathPoint *pointAtStart, KoPathPoint *pointAtEnd);
enum PencilMode { ModeRaw, ModeCurve, ModeStraight };
PencilMode m_mode;
bool m_optimizeRaw;
bool m_optimizeCurve;
qreal m_combineAngle;
qreal m_fittingError;
bool m_close;
QList<QPointF> m_points; // the raw points
KoPathShape * m_shape;
KoPathPoint *m_existingStartPoint; ///< an existing path point we started a new path at
KoPathPoint *m_existingEndPoint; ///< an existing path point we finished a new path at
KoPathPoint *m_hoveredPoint; ///< an existing path end point the mouse is hovering on
KoStrokeConfigWidget *m_strokeWidget;
};
#endif // _KOPENCILTOOL_H_
diff --git a/libs/brush/kis_abr_brush.h b/libs/brush/kis_abr_brush.h
index 0eb9ca926e..e6420f2a67 100644
--- a/libs/brush/kis_abr_brush.h
+++ b/libs/brush/kis_abr_brush.h
@@ -1,78 +1,78 @@
/*
* Copyright (c) 2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2007 Eric Lamarque <eric.lamarque@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ABR_BRUSH_
#define KIS_ABR_BRUSH_
#include <QImage>
#include <QVector>
#include <kis_scaling_size_brush.h>
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
#include "kritabrush_export.h"
class KisQImagemask;
class KisAbrBrushCollection;
typedef KisSharedPtr<KisQImagemask> KisQImagemaskSP;
class QString;
class QIODevice;
class BRUSH_EXPORT KisAbrBrush : public KisScalingSizeBrush
{
public:
/// Construct brush to load filename later as brush
KisAbrBrush(const QString& filename, KisAbrBrushCollection *parent);
KisAbrBrush(const KisAbrBrush& rhs);
KisAbrBrush(const KisAbrBrush& rhs, KisAbrBrushCollection *parent);
- KisBrush* clone() const;
+ KisBrush* clone() const override;
- virtual bool load();
+ bool load() override;
- virtual bool loadFromDevice(QIODevice *dev);
+ bool loadFromDevice(QIODevice *dev) override;
- virtual bool save();
+ bool save() override;
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool saveToDevice(QIODevice* dev) const override;
/**
* @return default file extension for saving the brush
*/
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
- virtual QImage brushTipImage() const;
+ QImage brushTipImage() const override;
friend class KisAbrBrushCollection;
- virtual void setBrushTipImage(const QImage& image);
+ void setBrushTipImage(const QImage& image) override;
- void toXML(QDomDocument& d, QDomElement& e) const;
+ void toXML(QDomDocument& d, QDomElement& e) const override;
private:
KisAbrBrushCollection *m_parent;
};
#endif // KIS_ABR_BRUSH_
diff --git a/libs/brush/kis_abr_brush_collection.h b/libs/brush/kis_abr_brush_collection.h
index bb857a4fa4..4b18d19ba4 100644
--- a/libs/brush/kis_abr_brush_collection.h
+++ b/libs/brush/kis_abr_brush_collection.h
@@ -1,93 +1,93 @@
/*
* Copyright (c) 2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2007 Eric Lamarque <eric.lamarque@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ABR_BRUSH_COLLECTION_H
#define KIS_ABR_BRUSH_COLLECTION_H
#include <QImage>
#include <QVector>
#include <QDataStream>
#include <QString>
#include <kis_debug.h>
#include <kis_scaling_size_brush.h>
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
class QString;
class QIODevice;
class KisAbrBrush;
struct AbrInfo;
/**
* load a collection of brushes from an abr file
*/
class BRUSH_EXPORT KisAbrBrushCollection : public KisScalingSizeBrush
{
protected:
public:
/// Construct brush to load filename later as brush
KisAbrBrushCollection(const QString& filename);
- KisBrush* clone() const;
+ KisBrush* clone() const override;
- virtual ~KisAbrBrushCollection() {}
+ ~KisAbrBrushCollection() override {}
- virtual bool load();
+ bool load() override;
- virtual bool loadFromDevice(QIODevice *dev);
+ bool loadFromDevice(QIODevice *dev) override;
- virtual bool save();
+ bool save() override;
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool saveToDevice(QIODevice* dev) const override;
/**
* @return a preview of the brush
*/
virtual QImage image() const;
/**
* @return default file extension for saving the brush
*/
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
QList<KisAbrBrush*> brushes() {
return m_abrBrushes.values();
}
protected:
KisAbrBrushCollection(const KisAbrBrushCollection& rhs);
- void toXML(QDomDocument& d, QDomElement& e) const;
+ void toXML(QDomDocument& d, QDomElement& e) const override;
private:
qint32 abr_brush_load(QDataStream & abr, AbrInfo *abr_hdr, const QString filename, qint32 image_ID, qint32 id);
qint32 abr_brush_load_v12(QDataStream & abr, AbrInfo *abr_hdr, const QString filename, qint32 image_ID, qint32 id);
quint32 abr_brush_load_v6(QDataStream & abr, AbrInfo *abr_hdr, const QString filename, qint32 image_ID, qint32 id);
QMap<QString, KisAbrBrush*> m_abrBrushes;
};
#endif
diff --git a/libs/brush/kis_auto_brush.h b/libs/brush/kis_auto_brush.h
index 5abb0ecb73..0966f6eaa8 100644
--- a/libs/brush/kis_auto_brush.h
+++ b/libs/brush/kis_auto_brush.h
@@ -1,103 +1,103 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_AUTOBRUSH_RESOURCE_H_
#define _KIS_AUTOBRUSH_RESOURCE_H_
#include "kritabrush_export.h"
#include "kis_brush.h"
#include <QScopedPointer>
class KisMaskGenerator;
/**
* XXX: docs!
*/
class BRUSH_EXPORT KisAutoBrush : public KisBrush
{
public:
KisAutoBrush(KisMaskGenerator* as, qreal angle, qreal randomness, qreal density = 1.0);
KisAutoBrush(const KisAutoBrush& rhs);
KisBrush* clone() const override;
- virtual ~KisAutoBrush();
+ ~KisAutoBrush() override;
public:
qreal userEffectiveSize() const override;
void setUserEffectiveSize(qreal value) override;
qint32 maskWidth(KisDabShape const& shape, qreal subPixelX, qreal subPixelY,
const KisPaintInformation& info) const override;
qint32 maskHeight(KisDabShape const& shape, qreal subPixelX, qreal subPixelY,
const KisPaintInformation& info) const override;
QSizeF characteristicSize(KisDabShape const&) const override;
- virtual KisFixedPaintDeviceSP paintDevice(const KoColorSpace*,
+ KisFixedPaintDeviceSP paintDevice(const KoColorSpace*,
KisDabShape const&,
const KisPaintInformation&,
double = 0, double = 0) const override {
return 0; // The autobrush does NOT support images!
}
- virtual void generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst,
+ void generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst,
KisBrush::ColoringInformation* src,
KisDabShape const&,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0,
qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const override;
- virtual QPainterPath outline() const override;
+ QPainterPath outline() const override;
public:
bool load() override {
return false;
}
- virtual bool loadFromDevice(QIODevice *) override {
+ bool loadFromDevice(QIODevice *) override {
return false;
}
bool save() override {
return false;
}
bool saveToDevice(QIODevice*) const override {
return false;
}
void toXML(QDomDocument& , QDomElement&) const override;
const KisMaskGenerator* maskGenerator() const;
qreal randomness() const;
qreal density() const;
void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
QImage createBrushPreview();
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif // _KIS_AUTOBRUSH_RESOURCE_H_
diff --git a/libs/brush/kis_auto_brush_factory.h b/libs/brush/kis_auto_brush_factory.h
index c0524a67aa..719bd29b2a 100644
--- a/libs/brush/kis_auto_brush_factory.h
+++ b/libs/brush/kis_auto_brush_factory.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_AUTO_BRUSH_FACTORY
#define KIS_AUTO_BRUSH_FACTORY
#include <QString>
#include <QDomElement>
#include <QHash>
#include <KoID.h>
#include "kis_brush.h"
#include "kis_brush_factory.h"
#include "kis_fixed_paint_device.h"
/**
* A brush factory can create a new brush instance based
* on a properties object that contains a serialized representation
* of the object.
*/
class BRUSH_EXPORT KisAutoBrushFactory : public KisBrushFactory
{
public:
KisAutoBrushFactory() {}
- virtual ~KisAutoBrushFactory() {}
+ ~KisAutoBrushFactory() override {}
- virtual QString id() const {
+ QString id() const override {
return "auto_brush";
}
/**
* Create a a new brush from the given data or return an existing KisBrush
* object. If this call leads to the creation of a resource, it should be
* added to the resource provider, too.
*/
- KisBrushSP getOrCreateBrush(const QDomElement& brushDefinition, bool forceCopy);
+ KisBrushSP getOrCreateBrush(const QDomElement& brushDefinition, bool forceCopy) override;
};
#endif
diff --git a/libs/brush/kis_brush.h b/libs/brush/kis_brush.h
index 07a6b70b1b..203d2824f0 100644
--- a/libs/brush/kis_brush.h
+++ b/libs/brush/kis_brush.h
@@ -1,379 +1,379 @@
/*
* Copyright (c) 1999 Matthias Elter <me@kde.org>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_
#define KIS_BRUSH_
#include <QImage>
#include <resources/KoResource.h>
#include <kis_types.h>
#include <kis_shared.h>
#include <kis_dab_shape.h>
#include <kritabrush_export.h>
class KisQImagemask;
typedef KisSharedPtr<KisQImagemask> KisQImagemaskSP;
class QString;
class KoColor;
class KoColorSpace;
class KisPaintInformation;
class KisBoundary;
class KisPaintopLodLimitations;
enum enumBrushType {
INVALID,
MASK,
IMAGE,
PIPE_MASK,
PIPE_IMAGE
};
static const qreal DEFAULT_SOFTNESS_FACTOR = 1.0;
class KisBrush;
typedef KisSharedPtr<KisBrush> KisBrushSP;
/**
* KisBrush is the base class for brush resources. A brush resource
* defines one or more images that are used to potato-stamp along
* the drawn path. The brush type defines how this brush is used --
* the important difference is between masks (which take the current
* painting color) and images (which do not). It is up to the paintop
* to make use of this feature.
*
* Brushes must be serializable to an xml representation and provide
* a factory class that can recreate or retrieve the brush based on
* this representation.
*
* XXX: This api is still a big mess -- it needs a good refactoring.
* And the whole KoResource architecture is way over-designed.
*/
class BRUSH_EXPORT KisBrush : public KoResource, public KisShared
{
public:
class ColoringInformation
{
public:
virtual ~ColoringInformation();
virtual const quint8* color() const = 0;
virtual void nextColumn() = 0;
virtual void nextRow() = 0;
};
protected:
class PlainColoringInformation : public ColoringInformation
{
public:
PlainColoringInformation(const quint8* color);
- virtual ~PlainColoringInformation();
- virtual const quint8* color() const ;
- virtual void nextColumn();
- virtual void nextRow();
+ ~PlainColoringInformation() override;
+ const quint8* color() const override ;
+ void nextColumn() override;
+ void nextRow() override;
private:
const quint8* m_color;
};
class PaintDeviceColoringInformation : public ColoringInformation
{
public:
PaintDeviceColoringInformation(const KisPaintDeviceSP source, int width);
- virtual ~PaintDeviceColoringInformation();
- virtual const quint8* color() const ;
- virtual void nextColumn();
- virtual void nextRow();
+ ~PaintDeviceColoringInformation() override;
+ const quint8* color() const override ;
+ void nextColumn() override;
+ void nextRow() override;
private:
const KisPaintDeviceSP m_source;
KisHLineConstIteratorSP m_iterator;
};
public:
KisBrush();
KisBrush(const QString& filename);
- virtual ~KisBrush();
+ ~KisBrush() override;
virtual qreal userEffectiveSize() const = 0;
virtual void setUserEffectiveSize(qreal value) = 0;
- virtual bool load() {
+ bool load() override {
return false;
}
- virtual bool loadFromDevice(QIODevice *) {
+ bool loadFromDevice(QIODevice *) override {
return false;
}
- virtual bool save() {
+ bool save() override {
return false;
}
- virtual bool saveToDevice(QIODevice* ) const {
+ bool saveToDevice(QIODevice* ) const override {
return false;
}
/**
* @brief brushImage the image the brush tip can paint with. Not all brush types have a single
* image.
* @return a valid QImage.
*/
virtual QImage brushTipImage() const;
/**
* Change the spacing of the brush.
* @param spacing a spacing of 1.0 means that strokes will be separated from one time the size
* of the brush.
*/
virtual void setSpacing(double spacing);
/**
* @return the spacing between two strokes for this brush
*/
double spacing() const;
void setAutoSpacing(bool active, qreal coeff);
bool autoSpacingActive() const;
qreal autoSpacingCoeff() const;
/**
* @return the width (for scale == 1.0)
*/
qint32 width() const;
/**
* @return the height (for scale == 1.0)
*/
qint32 height() const;
/**
* @return the width of the mask for the given scale and angle
*/
virtual qint32 maskWidth(KisDabShape const&, qreal subPixelX, qreal subPixelY, const KisPaintInformation& info) const;
/**
* @return the height of the mask for the given scale and angle
*/
virtual qint32 maskHeight(KisDabShape const&, qreal subPixelX, qreal subPixelY, const KisPaintInformation& info) const;
/**
* @return the logical size of the brush, that is the size measured
* in floating point value.
*
* This value should not be used for calculating future dab sizes
* because it doesn't take any rounding into account. The only use
* of this metric is calculation of brush-size derivatives like
* hotspots and spacing.
*/
virtual QSizeF characteristicSize(KisDabShape const&) const;
/**
* @return the angle of the mask adding the given angle
*/
double maskAngle(double angle = 0) const;
/**
* @return the index of the brush
* if the brush consists of multiple images
*/
virtual quint32 brushIndex(const KisPaintInformation& info) const;
/**
* The brush type defines how the brush is used.
*/
virtual enumBrushType brushType() const;
QPointF hotSpot(KisDabShape const&, const KisPaintInformation& info) const;
/**
* Returns true if this brush can return something useful for the info. This is used
* by Pipe Brushes that can't paint sometimes
**/
virtual bool canPaintFor(const KisPaintInformation& /*info*/);
/**
* Is called by the paint op when a paintop starts a stroke. The
* point is that we store brushes a server while the paint ops are
* are recreated all the time. Is means that upon a stroke start
* the brushes may need to clear its state.
*/
virtual void notifyStrokeStarted();
/**
* Is called by the cache, when cache hit has happened.
* Having got this notification the brush can update the counters
* of dabs, generate some new random values if needed.
*
* Currently, this is used by pipe'd brushes to implement
* incremental and random parasites
*/
virtual void notifyCachedDabPainted(const KisPaintInformation& info);
/**
* Return a fixed paint device that contains a correctly scaled image dab.
*/
virtual KisFixedPaintDeviceSP paintDevice(const KoColorSpace * colorSpace,
KisDabShape const&,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0) const;
/**
* Apply the brush mask to the pixels in dst. Dst should be big enough!
*/
void mask(KisFixedPaintDeviceSP dst,
KisDabShape const& shape,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0, qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const;
/**
* clear dst fill it with a mask colored with KoColor
*/
void mask(KisFixedPaintDeviceSP dst,
const KoColor& color,
KisDabShape const& shape,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0, qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const;
/**
* clear dst and fill it with a mask colored with the corresponding colors of src
*/
void mask(KisFixedPaintDeviceSP dst,
const KisPaintDeviceSP src,
KisDabShape const& shape,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0, qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const;
virtual bool hasColor() const;
/**
* Create a mask and either mask dst (that is, change all alpha values of the
* existing pixels to those of the mask) or, if coloringInfo is present, clear
* dst and fill dst with pixels according to coloringInfo, masked according to the
* generated mask.
*
* @param dst the destination that will be draw on the image, and this function
* will edit its alpha channel
* @param coloringInfo coloring information that will be copied on the dab, it can be null
* @param scale a scale applied on the alpha mask
* @param angle a rotation applied on the alpha mask
* @param info the painting information (this is only and should only be used by
* KisImagePipeBrush and only to be backward compatible with the Gimp,
* KisImagePipeBrush is ignoring scale and angle information)
* @param subPixelX sub position of the brush (contained between 0.0 and 1.0)
* @param subPixelY sub position of the brush (contained between 0.0 and 1.0)
*
* @return a mask computed from the grey-level values of the
* pixels in the brush.
*/
virtual void generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst,
ColoringInformation* coloringInfo,
KisDabShape const&,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0, qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const;
/**
* Serialize this brush to XML.
*/
virtual void toXML(QDomDocument& , QDomElement&) const;
static KisBrushSP fromXML(const QDomElement& element, bool forceCopy = false);
virtual const KisBoundary* boundary() const;
virtual QPainterPath outline() const;
virtual void setScale(qreal _scale);
qreal scale() const;
virtual void setAngle(qreal _angle);
qreal angle() const;
void prepareBrushPyramid() const;
void clearBrushPyramid();
virtual void lodLimitations(KisPaintopLodLimitations *l) const;
virtual KisBrush* clone() const = 0;
//protected:
KisBrush(const KisBrush& rhs);
void setWidth(qint32 width);
void setHeight(qint32 height);
void setHotSpot(QPointF);
/**
* The image is used to represent the brush in the gui, and may also, depending on the brush type
* be used to define the actual brush instance.
*/
virtual void setBrushTipImage(const QImage& image);
/**
* XXX
*/
virtual void setBrushType(enumBrushType type);
virtual void setHasColor(bool hasColor);
/**
* Returns true if the brush has a bunch of pixels almost
* fully transparent in the very center. If the brush is pierced,
* then dulling mode may not work correctly due to empty samples.
*
* WARNING: this method is relatively expensive since it iterates
* up to 100 pixels of the brush.
*/
bool isPiercedApprox() const;
protected:
void resetBoundary();
void predefinedBrushToXML(const QString &type, QDomElement& e) const;
private:
// Initialize our boundary
void generateBoundary() const;
struct Private;
Private* const d;
};
#endif // KIS_BRUSH_
diff --git a/libs/brush/kis_brush_registry.h b/libs/brush/kis_brush_registry.h
index 429400ad03..82066fcb8c 100644
--- a/libs/brush/kis_brush_registry.h
+++ b/libs/brush/kis_brush_registry.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_REGISTRY_H_
#define KIS_BRUSH_REGISTRY_H_
#include <QObject>
#include "kis_types.h"
#include "KoGenericRegistry.h"
#include <kritabrush_export.h>
#include "kis_brush.h"
#include "kis_brush_factory.h"
class QDomElement;
class BRUSH_EXPORT KisBrushRegistry : public QObject, public KoGenericRegistry<KisBrushFactory*>
{
Q_OBJECT
public:
KisBrushRegistry();
- virtual ~KisBrushRegistry();
+ ~KisBrushRegistry() override;
static KisBrushRegistry* instance();
KisBrushSP getOrCreateBrush(const QDomElement& element, bool forceCopy = false);
private:
KisBrushRegistry(const KisBrushRegistry&);
KisBrushRegistry operator=(const KisBrushRegistry&);
};
#endif // KIS_GENERATOR_REGISTRY_H_
diff --git a/libs/brush/kis_brush_server.h b/libs/brush/kis_brush_server.h
index 25663bf384..fe24d4d71f 100644
--- a/libs/brush/kis_brush_server.h
+++ b/libs/brush/kis_brush_server.h
@@ -1,66 +1,66 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_SERVER_H
#define KIS_BRUSH_SERVER_H
#include <QString>
#include <QStringList>
#include <QList>
#include <KoResourceServer.h>
#include <KoResourceServerAdapter.h>
#include "kritabrush_export.h"
#include "kis_brush.h"
class KoResourceLoaderThread;
typedef KoResourceServer<KisBrush, SharedPointerStoragePolicy<KisBrushSP> > KisBrushResourceServer;
typedef KoResourceServerAdapter<KisBrush, SharedPointerStoragePolicy<KisBrushSP> > KisBrushResourceServerAdapter;
/**
*
*/
class BRUSH_EXPORT KisBrushServer : public QObject
{
Q_OBJECT
public:
KisBrushServer();
- virtual ~KisBrushServer();
+ ~KisBrushServer() override;
KisBrushResourceServer* brushServer(bool block = true);
static KisBrushServer* instance();
public Q_SLOTS:
void slotRemoveBlacklistedResources();
private:
KisBrushServer(const KisBrushServer&);
KisBrushServer operator=(const KisBrushServer&);
KisBrushResourceServer* m_brushServer;
private:
KoResourceLoaderThread *m_brushThread;
};
#endif
diff --git a/libs/brush/kis_gbr_brush.h b/libs/brush/kis_gbr_brush.h
index 56a20ca8b5..6d578e9e96 100644
--- a/libs/brush/kis_gbr_brush.h
+++ b/libs/brush/kis_gbr_brush.h
@@ -1,122 +1,122 @@
/*
* Copyright (c) 1999 Matthias Elter <me@kde.org>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GBR_BRUSH_
#define KIS_GBR_BRUSH_
#include <QImage>
#include <QVector>
#include "kis_scaling_size_brush.h"
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
#include "kritabrush_export.h"
class KisQImagemask;
typedef KisSharedPtr<KisQImagemask> KisQImagemaskSP;
class QString;
class QIODevice;
class BRUSH_EXPORT KisGbrBrush : public KisScalingSizeBrush
{
protected:
public:
/// Construct brush to load filename later as brush
KisGbrBrush(const QString& filename);
/// Load brush from the specified data, at position dataPos, and set the filename
KisGbrBrush(const QString& filename,
const QByteArray & data,
qint32 & dataPos);
/// Load brush from the specified paint device, in the specified region
KisGbrBrush(KisPaintDeviceSP image, int x, int y, int w, int h);
/// Load brush as a copy from the specified QImage (handy when you need to copy a brush!)
KisGbrBrush(const QImage& image, const QString& name = QString());
- virtual ~KisGbrBrush();
+ ~KisGbrBrush() override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
/**
* @return a preview of the brush
*/
- virtual QImage brushTipImage() const;
+ QImage brushTipImage() const override;
/**
* If the brush image data are colorful (e.g. you created the brush from the canvas with custom brush)
* and you want to paint with it as with masks, set to true.
*/
virtual void setUseColorAsMask(bool useColorAsMask);
virtual bool useColorAsMask() const;
/**
* Convert the mask to inverted gray scale, so it is alpha mask.
* It can be used as MASK brush type. This operates on the date of the brush,
* so it destruct the original brush data
*/
virtual void makeMaskImage();
- virtual enumBrushType brushType() const;
+ enumBrushType brushType() const override;
/**
* Makes a copy of this brush.
*/
- virtual KisBrush* clone() const;
+ KisBrush* clone() const override;
/**
* @return default file extension for saving the brush
*/
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
protected:
/**
* save the content of this brush to an IO device
*/
friend class KisImageBrushesPipe;
KisGbrBrush(const KisGbrBrush& rhs);
- void setBrushType(enumBrushType type);
- virtual void setBrushTipImage(const QImage& image);
+ void setBrushType(enumBrushType type) override;
+ void setBrushTipImage(const QImage& image) override;
- void toXML(QDomDocument& d, QDomElement& e) const;
+ void toXML(QDomDocument& d, QDomElement& e) const override;
private:
bool init();
bool initFromPaintDev(KisPaintDeviceSP image, int x, int y, int w, int h);
struct Private;
Private* const d;
};
#endif // KIS_GBR_BRUSH_
diff --git a/libs/brush/kis_imagepipe_brush.h b/libs/brush/kis_imagepipe_brush.h
index 5678cfd5e1..9679fdf4f6 100644
--- a/libs/brush/kis_imagepipe_brush.h
+++ b/libs/brush/kis_imagepipe_brush.h
@@ -1,142 +1,142 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGEPIPE_BRUSH_
#define KIS_IMAGEPIPE_BRUSH_
#include <QList>
#include <QMap>
#include <QString>
#include <resources/KoResource.h>
#include "kis_gbr_brush.h"
#include "kis_global.h"
class KisPipeBrushParasite;
/**
* Velocity won't be supported, atm Tilt isn't either,
* but have chances of implementation
*/
namespace KisParasite
{
enum SelectionMode {
Constant,
Incremental,
Angular,
Velocity,
Random,
Pressure,
TiltX,
TiltY
};
}
class BRUSH_EXPORT KisImagePipeBrush : public KisGbrBrush
{
public:
KisImagePipeBrush(const QString& filename);
/**
* Specialized constructor that makes a new pipe brush from a sequence of samesize
* devices. The fact that it's a vector of a vector, is to support multidimensional
* brushes (not yet supported!) */
KisImagePipeBrush(const QString& name, int w, int h,
QVector< QVector<KisPaintDevice*> > devices,
QVector<KisParasite::SelectionMode> modes);
- virtual ~KisImagePipeBrush();
+ ~KisImagePipeBrush() override;
bool load() override;
bool loadFromDevice(QIODevice *dev) override;
bool save() override;
bool saveToDevice(QIODevice* dev) const override;
/**
* @return the next image in the pipe.
*/
KisFixedPaintDeviceSP paintDevice(const KoColorSpace * colorSpace,
KisDabShape const&,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0) const override;
void setUseColorAsMask(bool useColorAsMask) override;
bool hasColor() const override;
enumBrushType brushType() const override;
const KisBoundary* boundary() const override;
bool canPaintFor(const KisPaintInformation& info) override;
void makeMaskImage() override;
KisBrush* clone() const override;
QString defaultFileExtension() const override;
void setAngle(qreal _angle) override;
void setScale(qreal _scale) override;
void setSpacing(double _spacing) override;
quint32 brushIndex(const KisPaintInformation& info) const override;
qint32 maskWidth(KisDabShape const&, double subPixelX, double subPixelY, const KisPaintInformation& info) const override;
qint32 maskHeight(KisDabShape const&, double subPixelX, double subPixelY, const KisPaintInformation& info) const override;
void notifyStrokeStarted() override;
void notifyCachedDabPainted(const KisPaintInformation& info) override;
void generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst, KisBrush::ColoringInformation* coloringInformation,
KisDabShape const&,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0, qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const override;
QVector<KisGbrBrush*> brushes() const;
const KisPipeBrushParasite &parasite() const;
void setParasite(const KisPipeBrushParasite& parasite);
void setDevices(QVector< QVector<KisPaintDevice*> > devices, int w, int h);
protected:
void setBrushType(enumBrushType type) override;
void setHasColor(bool hasColor) override;
/// Will call KisBrush's saveToDevice as well
KisImagePipeBrush(const KisImagePipeBrush& rhs);
private:
friend class KisImagePipeBrushTest;
KisGbrBrush* testingGetCurrentBrush(const KisPaintInformation& info) const;
void testingSelectNextBrush(const KisPaintInformation& info) const;
bool initFromData(const QByteArray &data);
private:
struct Private;
Private * const m_d;
};
#endif // KIS_IMAGEPIPE_BRUSH_
diff --git a/libs/brush/kis_png_brush.h b/libs/brush/kis_png_brush.h
index 4c524c5c5b..be62f002e6 100644
--- a/libs/brush/kis_png_brush.h
+++ b/libs/brush/kis_png_brush.h
@@ -1,40 +1,40 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PNG_BRUSH_
#define KIS_PNG_BRUSH_
#include "kis_scaling_size_brush.h"
class BRUSH_EXPORT KisPngBrush : public KisScalingSizeBrush
{
public:
/// Construct brush to load filename later as brush
KisPngBrush(const QString& filename);
- KisBrush* clone() const;
+ KisBrush* clone() const override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice *dev) const;
- virtual QString defaultFileExtension() const;
- void toXML(QDomDocument& d, QDomElement& e) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice *dev) const override;
+ QString defaultFileExtension() const override;
+ void toXML(QDomDocument& d, QDomElement& e) const override;
};
#endif
diff --git a/libs/brush/kis_predefined_brush_factory.h b/libs/brush/kis_predefined_brush_factory.h
index 46bd7c32cf..af5fc50d6d 100644
--- a/libs/brush/kis_predefined_brush_factory.h
+++ b/libs/brush/kis_predefined_brush_factory.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PREDEFINED_BRUSH_FACTORY_H
#define __KIS_PREDEFINED_BRUSH_FACTORY_H
#include <QString>
#include <QDomElement>
#include "kis_brush_factory.h"
#include "kis_brush.h"
class KisPredefinedBrushFactory : public KisBrushFactory
{
public:
KisPredefinedBrushFactory(const QString &brushType);
- QString id() const;
- KisBrushSP getOrCreateBrush(const QDomElement& brushDefinition, bool forceCopy);
+ QString id() const override;
+ KisBrushSP getOrCreateBrush(const QDomElement& brushDefinition, bool forceCopy) override;
private:
const QString m_id;
};
#endif /* __KIS_PREDEFINED_BRUSH_FACTORY_H */
diff --git a/libs/brush/kis_scaling_size_brush.h b/libs/brush/kis_scaling_size_brush.h
index e5718a4a81..deea7f92fc 100644
--- a/libs/brush/kis_scaling_size_brush.h
+++ b/libs/brush/kis_scaling_size_brush.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSCALINGSIZEBRUSH_H
#define KISSCALINGSIZEBRUSH_H
#include "kritabrush_export.h"
#include "kis_brush.h"
class BRUSH_EXPORT KisScalingSizeBrush : public KisBrush
{
public:
KisScalingSizeBrush();
KisScalingSizeBrush(const QString& filename);
- qreal userEffectiveSize() const;
- void setUserEffectiveSize(qreal value);
+ qreal userEffectiveSize() const override;
+ void setUserEffectiveSize(qreal value) override;
};
#endif // KISSCALINGSIZEBRUSH_H
diff --git a/libs/brush/kis_svg_brush.h b/libs/brush/kis_svg_brush.h
index 4374e31a08..16f0d47d14 100644
--- a/libs/brush/kis_svg_brush.h
+++ b/libs/brush/kis_svg_brush.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SVG_BRUSH_
#define KIS_SVG_BRUSH_
#include "kis_scaling_size_brush.h"
class BRUSH_EXPORT KisSvgBrush : public KisScalingSizeBrush
{
public:
/// Construct brush to load filename later as brush
KisSvgBrush(const QString& filename);
KisSvgBrush(const KisSvgBrush& rhs);
- KisBrush* clone() const;
+ KisBrush* clone() const override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice *dev) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice *dev) const override;
- virtual QString defaultFileExtension() const;
- void toXML(QDomDocument& d, QDomElement& e) const;
+ QString defaultFileExtension() const override;
+ void toXML(QDomDocument& d, QDomElement& e) const override;
private:
QByteArray m_svg;
};
#endif
diff --git a/libs/brush/kis_text_brush.h b/libs/brush/kis_text_brush.h
index e57a9bcf49..4c13b17b89 100644
--- a/libs/brush/kis_text_brush.h
+++ b/libs/brush/kis_text_brush.h
@@ -1,95 +1,95 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TEXT_BRUSH_H_
#define _KIS_TEXT_BRUSH_H_
#include <QFont>
#include "kis_scaling_size_brush.h"
#include "kritabrush_export.h"
class KisTextBrushesPipe;
class BRUSH_EXPORT KisTextBrush : public KisScalingSizeBrush
{
public:
KisTextBrush();
KisTextBrush(const KisTextBrush &rhs);
- virtual ~KisTextBrush();
+ ~KisTextBrush() override;
void notifyStrokeStarted() override;
void notifyCachedDabPainted(const KisPaintInformation& info) override;
void generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst, KisBrush::ColoringInformation* coloringInformation,
KisDabShape const&,
const KisPaintInformation& info,
double subPixelX = 0, double subPixelY = 0, qreal softnessFactor = DEFAULT_SOFTNESS_FACTOR) const override;
KisFixedPaintDeviceSP paintDevice(const KoColorSpace * colorSpace,
KisDabShape const&, const KisPaintInformation& info, double subPixelX, double subPixelY) const override;
bool load() override {
return false;
}
- virtual bool loadFromDevice(QIODevice *) override {
+ bool loadFromDevice(QIODevice *) override {
return false;
}
bool save() override {
return false;
}
bool saveToDevice(QIODevice* ) const override {
return false;
}
void setText(const QString& txt);
QString text(void) const;
QFont font();
void setFont(const QFont& font);
void setPipeMode(bool pipe);
bool pipeMode() const;
void updateBrush();
void toXML(QDomDocument& , QDomElement&) const override;
quint32 brushIndex(const KisPaintInformation& info) const override;
qint32 maskWidth(KisDabShape const&, double subPixelX, double subPixelY, const KisPaintInformation& info) const override;
qint32 maskHeight(KisDabShape const&, double subPixelX, double subPixelY, const KisPaintInformation& info) const override;
void setAngle(qreal _angle) override;
void setScale(qreal _scale) override;
void setSpacing(double _spacing) override;
KisBrush* clone() const override;
private:
QFont m_font;
QString m_text;
private:
KisTextBrushesPipe *m_brushesPipe;
};
#endif
diff --git a/libs/brush/kis_text_brush_factory.h b/libs/brush/kis_text_brush_factory.h
index 6e70c8a50b..e854bcc053 100644
--- a/libs/brush/kis_text_brush_factory.h
+++ b/libs/brush/kis_text_brush_factory.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TEXT_BRUSH_FACTORY
#define KIS_TEXT_BRUSH_FACTORY
#include <QString>
#include <QDomElement>
#include "kis_brush_factory.h"
#include "kis_brush.h"
/**
* A brush factory can create a new brush instance based
* on a properties object that contains a serialized representation
* of the object.
*/
class BRUSH_EXPORT KisTextBrushFactory : public KisBrushFactory
{
public:
KisTextBrushFactory() {}
- virtual ~KisTextBrushFactory() {}
+ ~KisTextBrushFactory() override {}
- virtual QString id() const {
+ QString id() const override {
return "kis_text_brush";
}
/**
* Create a a new brush from the given data or return an existing KisBrush
* object. If this call leads to the creation of a resource, it should be
* added to the resource provider, too.
*/
- KisBrushSP getOrCreateBrush(const QDomElement& brushDefinition, bool forceCopy);
+ KisBrushSP getOrCreateBrush(const QDomElement& brushDefinition, bool forceCopy) override;
};
#endif
diff --git a/libs/color/colord/KisColord.h b/libs/color/colord/KisColord.h
index 16fe786767..21ad0a5d5c 100644
--- a/libs/color/colord/KisColord.h
+++ b/libs/color/colord/KisColord.h
@@ -1,80 +1,80 @@
/*
* Copyright (C) 2012 by Daniel Nicoletti <dantti12@gmail.com>
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORD_H
#define KIS_COLORD_H
#include "dbus-types.h"
#include <QDBusObjectPath>
#include <QDBusServiceWatcher>
#include <QDBusPendingCallWatcher>
#include <QMap>
#include <QString>
#include <QMetaType>
#define CD_PROFILE_METADATA_DATA_SOURCE_EDID "edid"
#define CD_PROFILE_METADATA_DATA_SOURCE_CALIB "calib"
#define CD_PROFILE_METADATA_DATA_SOURCE_STANDARD "standard"
#define CD_PROFILE_METADATA_DATA_SOURCE_TEST "test"
class CdInterface;
struct Device;
#include "kritacolord_export.h"
class KRITACOLORD_EXPORT KisColord : public QObject
{
Q_OBJECT
public:
KisColord(QObject *parent = 0);
- ~KisColord();
+ ~KisColord() override;
QStringList devices(const QString &type) const;
const QString deviceName(const QString &id) const;
QByteArray deviceProfile(const QString &id, int profile);
Q_SIGNALS:
void changed();
void changed(const QString& device);
private Q_SLOTS:
void serviceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner);
void gotDevices(QDBusPendingCallWatcher *call);
void deviceChanged(const QDBusObjectPath &objectPath);
void deviceAdded(const QDBusObjectPath &objectPath, bool emitChanged = true);
void deviceRemoved(const QDBusObjectPath &objectPath);
private:
void addProfilesToDevice(Device *dev, QList<QDBusObjectPath> profiles) const;
QMap<QDBusObjectPath, Device*> m_devices;
CdInterface *m_cdInterface;
};
#endif // COLORD_KCM_H
diff --git a/libs/color/kis_color_manager.h b/libs/color/kis_color_manager.h
index 6c438710b5..34028a4ee6 100644
--- a/libs/color/kis_color_manager.h
+++ b/libs/color/kis_color_manager.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_MANAGER_H
#define KIS_COLOR_MANAGER_H
#include <QObject>
#include <QString>
#include <QStringList>
#include <QByteArray>
#include "kritacolor_export.h"
/**
* @brief The KisColorManager class can be used as a cross-platform way to get the
* display profile associated with a device.
*
* TODO: support other devices than monitors
*/
class KRITACOLOR_EXPORT KisColorManager : public QObject
{
Q_OBJECT
public:
explicit KisColorManager();
- virtual ~KisColorManager();
+ ~KisColorManager() override;
enum DeviceType {
screen,
printer,
camera,
scanner
};
/// Return the user-visible name for the given device
QString deviceName(const QString &id);
/// Return a list of device id's for the specified type
QStringList devices(DeviceType type = screen) const;
/// Return the icc profile for the given device and index (if a device has more than one profile)
QByteArray displayProfile(const QString &device, int profile = 0) const;
static KisColorManager *instance();
Q_SIGNALS:
void changed(const QString device);
public Q_SLOTS:
private:
KisColorManager(const KisColorManager&);
KisColorManager operator=(const KisColorManager&);
class Private;
const Private *const d;
};
#endif // KIS_COLOR_MANAGER_H
diff --git a/libs/command/kis_command_utils.h b/libs/command/kis_command_utils.h
index f61204e770..f4f41bdc37 100644
--- a/libs/command/kis_command_utils.h
+++ b/libs/command/kis_command_utils.h
@@ -1,138 +1,138 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COMMAND_UTILS_H
#define __KIS_COMMAND_UTILS_H
#include "kundo2command.h"
#include "kis_undo_stores.h"
#include "kritacommand_export.h"
#include <functional>
namespace KisCommandUtils
{
/**
* @brief The AggregateCommand struct is a command with delayed
* initialization. On first redo() populateChildCommands() is called
* and the descendants add the desired commands to the internal list.
* After that, the added commands are executed on every undo()/redo().
*
* This structure is used when the commands should be populated from
* the context of the stroke, not from the GUI thread.
*/
struct KRITACOMMAND_EXPORT AggregateCommand : public KUndo2Command {
AggregateCommand(KUndo2Command *parent = 0);
AggregateCommand(const KUndo2MagicString &text,
KUndo2Command *parent = 0);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
protected:
virtual void populateChildCommands() = 0;
void addCommand(KUndo2Command *cmd);
private:
bool m_firstRedo;
KisSurrogateUndoStore m_store;
};
/**
* @brief The LambdaCommand struct is a shorthand for creation of
* AggregateCommand commands using C++ lambda feature. Just pass
* a lambda object into a command and it will be called from within
* the context of the strokes thread to populate the command content.
*/
struct KRITACOMMAND_EXPORT LambdaCommand : public AggregateCommand {
LambdaCommand(std::function<KUndo2Command*()> createCommandFunc);
LambdaCommand(const KUndo2MagicString &text,
std::function<KUndo2Command*()> createCommandFunc);
LambdaCommand(const KUndo2MagicString &text,
KUndo2Command *parent,
std::function<KUndo2Command*()> createCommandFunc);
LambdaCommand(KUndo2Command *parent,
std::function<KUndo2Command*()> createCommandFunc);
protected:
void populateChildCommands() override;
private:
std::function<KUndo2Command*()> m_createCommandFunc;
};
struct KRITACOMMAND_EXPORT SkipFirstRedoWrapper : public KUndo2Command {
SkipFirstRedoWrapper(KUndo2Command *child = 0, KUndo2Command *parent = 0);
void redo() override;
void undo() override;
private:
bool m_firstRedo;
QScopedPointer<KUndo2Command> m_child;
};
struct KRITACOMMAND_EXPORT SkipFirstRedoBase : public KUndo2Command {
SkipFirstRedoBase(bool skipFirstRedo, KUndo2Command *parent = 0);
SkipFirstRedoBase(bool skipFirstRedo, const KUndo2MagicString &text, KUndo2Command *parent = 0);
void redo() final;
void undo() final;
void setSkipOneRedo(bool value);
protected:
virtual void redoImpl() = 0;
virtual void undoImpl() = 0;
private:
bool m_firstRedo;
};
struct KRITACOMMAND_EXPORT FlipFlopCommand : public KUndo2Command {
FlipFlopCommand(bool finalize, KUndo2Command *parent = 0);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
protected:
virtual void init();
virtual void end();
bool isFinalizing() const { return m_finalize; }
bool isFirstRedo() const { return m_firstRedo; }
private:
bool m_finalize;
bool m_firstRedo;
};
struct KRITACOMMAND_EXPORT CompositeCommand : public KUndo2Command {
CompositeCommand(KUndo2Command *parent = 0);
- ~CompositeCommand();
+ ~CompositeCommand() override;
void addCommand(KUndo2Command *cmd);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
QVector<KUndo2Command*> m_commands;
};
}
#endif /* __KIS_COMMAND_UTILS_H */
diff --git a/libs/command/kis_undo_stores.h b/libs/command/kis_undo_stores.h
index 806a5c40ab..54d95492bf 100644
--- a/libs/command/kis_undo_stores.h
+++ b/libs/command/kis_undo_stores.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UNDO_STORES_H
#define __KIS_UNDO_STORES_H
#include "kis_undo_store.h"
class KUndo2Stack;
class KUndo2MagicString;
/**
* KisSurrogateUndoAdapter -- saves commands directly to the
* internal stack. Used for wrapping around legacy code into
* a single command.
*/
class KRITACOMMAND_EXPORT KisSurrogateUndoStore : public KisUndoStore
{
public:
KisSurrogateUndoStore();
- ~KisSurrogateUndoStore();
+ ~KisSurrogateUndoStore() override;
- const KUndo2Command* presentCommand();
- void undoLastCommand();
- void addCommand(KUndo2Command *cmd);
- void beginMacro(const KUndo2MagicString& macroName);
- void endMacro();
+ const KUndo2Command* presentCommand() override;
+ void undoLastCommand() override;
+ void addCommand(KUndo2Command *cmd) override;
+ void beginMacro(const KUndo2MagicString& macroName) override;
+ void endMacro() override;
void undo();
void redo();
void undoAll();
void redoAll();
- void purgeRedoState();
+ void purgeRedoState() override;
void clear();
private:
KUndo2Stack *m_undoStack;
};
/**
* @brief The KisDumbUndoStore class doesn't actually save commands,
* so you cannot undo or redo!
*/
class KRITACOMMAND_EXPORT KisDumbUndoStore : public KisUndoStore
{
public:
- const KUndo2Command* presentCommand();
- void undoLastCommand();
- void addCommand(KUndo2Command *cmd);
- void beginMacro(const KUndo2MagicString& macroName);
- void endMacro();
- void purgeRedoState();
+ const KUndo2Command* presentCommand() override;
+ void undoLastCommand() override;
+ void addCommand(KUndo2Command *cmd) override;
+ void beginMacro(const KUndo2MagicString& macroName) override;
+ void endMacro() override;
+ void purgeRedoState() override;
};
#endif /* __KIS_UNDO_STORES_H */
diff --git a/libs/command/kundo2group.h b/libs/command/kundo2group.h
index dab85c9a70..87b3835449 100644
--- a/libs/command/kundo2group.h
+++ b/libs/command/kundo2group.h
@@ -1,104 +1,104 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef KUNDO2GROUP_H
#define KUNDO2GROUP_H
#include <QObject>
#include <QString>
#include "kritacommand_export.h"
class KUndo2GroupPrivate;
class KUndo2QStack;
class QAction;
#ifndef QT_NO_UNDOGROUP
class KRITACOMMAND_EXPORT KUndo2Group : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(KUndo2Group)
public:
explicit KUndo2Group(QObject *parent = 0);
- ~KUndo2Group();
+ ~KUndo2Group() override;
void addStack(KUndo2QStack *stack);
void removeStack(KUndo2QStack *stack);
QList<KUndo2QStack*> stacks() const;
KUndo2QStack *activeStack() const;
#ifndef QT_NO_ACTION
QAction *createUndoAction(QObject *parent) const;
QAction *createRedoAction(QObject *parent) const;
#endif // QT_NO_ACTION
bool canUndo() const;
bool canRedo() const;
QString undoText() const;
QString redoText() const;
bool isClean() const;
public Q_SLOTS:
void undo();
void redo();
void setActiveStack(KUndo2QStack *stack);
Q_SIGNALS:
void activeStackChanged(KUndo2QStack *stack);
void indexChanged(int idx);
void cleanChanged(bool clean);
void canUndoChanged(bool canUndo);
void canRedoChanged(bool canRedo);
void undoTextChanged(const QString &undoActionText);
void redoTextChanged(const QString &redoActionText);
private:
// from QUndoGroupPrivate
KUndo2QStack *m_active;
QList<KUndo2QStack*> m_stack_list;
Q_DISABLE_COPY(KUndo2Group)
};
#endif // QT_NO_UNDOGROUP
#endif // KUNDO2GROUP_H
diff --git a/libs/command/kundo2model.h b/libs/command/kundo2model.h
index 13237e6195..305a28f03b 100644
--- a/libs/command/kundo2model.h
+++ b/libs/command/kundo2model.h
@@ -1,105 +1,105 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef K_UNDO_2_MODEL
#define K_UNDO_2_MODEL
#include <QAbstractItemModel>
#include "kundo2stack.h"
#include <QItemSelectionModel>
#include <QIcon>
class KUndo2Model : public QAbstractItemModel
{
Q_OBJECT
public:
explicit KUndo2Model(QObject *parent = 0);
KUndo2QStack *stack() const;
- virtual QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column,
+ const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QModelIndex selectedIndex() const;
QItemSelectionModel *selectionModel() const;
QString emptyLabel() const;
void setEmptyLabel(const QString &label);
void setCleanIcon(const QIcon &icon);
QIcon cleanIcon() const;
public Q_SLOTS:
void setStack(KUndo2QStack *stack);
private Q_SLOTS:
void stackChanged();
void stackDestroyed(QObject *obj);
void setStackCurrentIndex(const QModelIndex &index);
private:
KUndo2QStack *m_stack;
QItemSelectionModel *m_sel_model;
QString m_emty_label;
QIcon m_clean_icon;
};
#endif
diff --git a/libs/command/kundo2stack.h b/libs/command/kundo2stack.h
index 4aef82244c..aef1b0d89b 100644
--- a/libs/command/kundo2stack.h
+++ b/libs/command/kundo2stack.h
@@ -1,271 +1,271 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef KUNDO2STACK_H
#define KUNDO2STACK_H
#include <QObject>
#include <QString>
#include <QList>
#include <QAction>
#include <QTime>
#include <QVector>
#include "kritacommand_export.h"
class QAction;
class KUndo2CommandPrivate;
class KUndo2Group;
class KActionCollection;
#ifndef QT_NO_UNDOCOMMAND
#include "kundo2magicstring.h"
#include "kundo2commandextradata.h"
/**
* WARNING: In general, don't derive undo commands from QObject. And
* if you really need it, don't use QObject lifetime tracking
* for the commands: KUndo2Command has its own, *nonvirtual*
* hierarchy, and don't make it a parent or a child of any
* QObject. Otherwise two different parents will try to track
* the lifetime of your command and, most probably, you'll
* get a crash.
*
* As a general rule: an undo command should be derived
* from QObject only for the sake of signal/slots capabilities.
* Nothing else.
*/
class KRITACOMMAND_EXPORT KUndo2Command
{
KUndo2CommandPrivate *d;
int timedID;
public:
explicit KUndo2Command(KUndo2Command *parent = 0);
explicit KUndo2Command(const KUndo2MagicString &text, KUndo2Command *parent = 0);
virtual ~KUndo2Command();
virtual void undo();
virtual void redo();
QString actionText() const;
KUndo2MagicString text() const;
void setText(const KUndo2MagicString &text);
virtual int id() const;
virtual int timedId();
virtual void setTimedID(int timedID);
virtual bool mergeWith(const KUndo2Command *other);
virtual bool timedMergeWith(KUndo2Command *other);
int childCount() const;
const KUndo2Command *child(int index) const;
bool hasParent();
virtual void setTime();
virtual QTime time();
virtual void setEndTime();
virtual QTime endTime();
virtual QVector<KUndo2Command*> mergeCommandsVector();
virtual bool isMerged();
virtual void undoMergedCommands();
virtual void redoMergedCommands();
/**
* \return user-defined object associated with the command
*
* \see setExtraData()
*/
KUndo2CommandExtraData* extraData() const;
/**
* The user can assign an arbitrary object associated with the
* command. The \p data object is owned by the command. If you assign
* the object twice, the first one will be destroyed.
*/
void setExtraData(KUndo2CommandExtraData *data);
private:
Q_DISABLE_COPY(KUndo2Command)
friend class KUndo2QStack;
bool m_hasParent;
int m_timedID;
QTime m_timeOfCreation;
QTime m_endOfCommand;
QVector<KUndo2Command*> m_mergeCommandsVector;
};
#endif // QT_NO_UNDOCOMMAND
#ifndef QT_NO_UNDOSTACK
class KRITACOMMAND_EXPORT KUndo2QStack : public QObject
{
Q_OBJECT
// Q_DECLARE_PRIVATE(KUndo2QStack)
Q_PROPERTY(bool active READ isActive WRITE setActive)
Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit)
public:
explicit KUndo2QStack(QObject *parent = 0);
- virtual ~KUndo2QStack();
+ ~KUndo2QStack() override;
void clear();
void push(KUndo2Command *cmd);
bool canUndo() const;
bool canRedo() const;
QString undoText() const;
QString redoText() const;
int count() const;
int index() const;
QString actionText(int idx) const;
QString text(int idx) const;
#ifndef QT_NO_ACTION
QAction *createUndoAction(QObject *parent) const;
QAction *createRedoAction(QObject *parent) const;
#endif // QT_NO_ACTION
bool isActive() const;
bool isClean() const;
int cleanIndex() const;
void beginMacro(const KUndo2MagicString &text);
void endMacro();
void setUndoLimit(int limit);
int undoLimit() const;
const KUndo2Command *command(int index) const;
void setUseCumulativeUndoRedo(bool value);
bool useCumulativeUndoRedo();
void setTimeT1(double value);
double timeT1();
void setTimeT2(double value);
double timeT2();
int strokesN();
void setStrokesN(int value);
public Q_SLOTS:
void setClean();
virtual void setIndex(int idx);
virtual void undo();
virtual void redo();
void setActive(bool active = true);
void purgeRedoState();
Q_SIGNALS:
void indexChanged(int idx);
void cleanChanged(bool clean);
void canUndoChanged(bool canUndo);
void canRedoChanged(bool canRedo);
void undoTextChanged(const QString &undoActionText);
void redoTextChanged(const QString &redoActionText);
protected:
virtual void notifySetIndexChangedOneCommand();
private:
// from QUndoStackPrivate
QList<KUndo2Command*> m_command_list;
QList<KUndo2Command*> m_macro_stack;
int m_index;
int m_clean_index;
KUndo2Group *m_group;
int m_undo_limit;
bool m_useCumulativeUndoRedo;
double m_timeT1;
double m_timeT2;
int m_strokesN;
int m_lastMergedSetCount;
int m_lastMergedIndex;
// also from QUndoStackPrivate
void setIndex(int idx, bool clean);
bool checkUndoLimit();
Q_DISABLE_COPY(KUndo2QStack)
friend class KUndo2Group;
};
class KRITACOMMAND_EXPORT KUndo2Stack : public KUndo2QStack
{
public:
explicit KUndo2Stack(QObject *parent = 0);
// functions from KUndoStack
QAction* createRedoAction(KActionCollection* actionCollection, const QString& actionName = QString());
QAction* createUndoAction(KActionCollection* actionCollection, const QString& actionName = QString());
};
#endif // QT_NO_UNDOSTACK
#endif // KUNDO2STACK_H
diff --git a/libs/command/kundo2view.h b/libs/command/kundo2view.h
index 1162b4a81e..b1c951871f 100644
--- a/libs/command/kundo2view.h
+++ b/libs/command/kundo2view.h
@@ -1,111 +1,111 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef KUNDO2VIEW_H
#define KUNDO2VIEW_H
#include <QListView>
#include <QString>
#include "kritacommand_export.h"
#ifndef QT_NO_UNDOVIEW
class KUndo2ViewPrivate;
class KUndo2QStack;
class KUndo2Group;
class QIcon;
class KRITACOMMAND_EXPORT KUndo2View : public QListView
{
Q_OBJECT
Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel)
Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon)
public:
explicit KUndo2View(QWidget *parent = 0);
explicit KUndo2View(KUndo2QStack *stack, QWidget *parent = 0);
#ifndef QT_NO_UNDOGROUP
explicit KUndo2View(KUndo2Group *group, QWidget *parent = 0);
#endif
- ~KUndo2View();
+ ~KUndo2View() override;
KUndo2QStack *stack() const;
#ifndef QT_NO_UNDOGROUP
KUndo2Group *group() const;
#endif
void setEmptyLabel(const QString &label);
QString emptyLabel() const;
void setCleanIcon(const QIcon &icon);
QIcon cleanIcon() const;
public Q_SLOTS:
void setStack(KUndo2QStack *stack);
#ifndef QT_NO_UNDOGROUP
void setGroup(KUndo2Group *group);
#endif
private:
KUndo2ViewPrivate* const d;
Q_DISABLE_COPY(KUndo2View)
};
#endif // QT_NO_UNDOVIEW
#endif // KUNDO2VIEW_H
diff --git a/libs/flake/KoCanvasBase.h b/libs/flake/KoCanvasBase.h
index 3205dab0ea..f421556f3c 100644
--- a/libs/flake/KoCanvasBase.h
+++ b/libs/flake/KoCanvasBase.h
@@ -1,254 +1,254 @@
/* This file is part of the KDE project
Copyright (C) 2006, 2010 Boudewijn Rempt <boud@valdyas.org>
Copyright (C) 2006, 2010 Thomas Zander <zander@kde.org>
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOCANVASBASE_H
#define KOCANVASBASE_H
#include <QPoint>
#include "kritaflake_export.h"
class KUndo2Command;
class KoUnit;
class KoCanvasResourceManager;
class KoShapeManager;
class KoToolProxy;
class KoViewConverter;
class KoShapeController;
class KoShapeBasedDocumentBase;
class KoCanvasController;
class KoShape;
class KoSnapGuide;
class KoSelectedShapesProxy;
class QWidget;
class QCursor;
class QPointF;
class QRectF;
class QSizeF;
#include <QObject>
/**
* KoCanvasBase is the interface actual application canvas classes
* should implement. Flake tools know about the canvas, so they can
* do things like scroll, redraw, set a cursor etc.
*/
class KRITAFLAKE_EXPORT KoCanvasBase : public QObject
{
Q_OBJECT
public:
/**
* The constructor.
* @param shapeBasedDocument the implementation of the shapeController that the
* application provides to allow shapes to be added in multiple views.
*/
explicit KoCanvasBase(KoShapeBasedDocumentBase *shapeBasedDocument, KoCanvasResourceManager *sharedResourceManager = 0);
- virtual ~KoCanvasBase();
+ ~KoCanvasBase() override;
public:
/**
* @return true if opengl can be used directly on the canvas
*/
virtual bool canvasIsOpenGL() const { return false; }
/**
* retrieve the grid size setting.
* The grid spacing will be provided in pt.
* @param horizontal a pointer to a qreal that will be filled with the horizontal grid-spacing
* @param vertical a pointer to a qreal that will be filled with the vertical grid-spacing
*/
virtual void gridSize(QPointF *offset, QSizeF *spacing) const = 0;
/**
* return if snap to grid is enabled.
* @return if snap to grid is enabled.
*/
virtual bool snapToGrid() const = 0;
/**
* set the specified cursor on this canvas
*
* @param cursor the new cursor
* @return the old cursor
*/
virtual void setCursor(const QCursor &cursor) = 0;
/**
* Adds a command to the history. Call this for each @p command you create.
* This will also execute the command.
* This means, most of the application's code will look like
* MyCommand * cmd = new MyCommand( parameters );
* canvas.addCommand( cmd );
*
* Note that the command history takes ownership of the command, it will delete
* it when the undo limit is reached, or when deleting the command history itself.
* @param command the command to add
*/
virtual void addCommand(KUndo2Command *command) = 0;
/**
* Return the current shapeManager. WARNING: the shape manager can switch
* in time, e.g. when a layer is changed. Please don't keep any persistent
* connections to it. Instead please use selectedShapesProxy(),
* which is guaranteed to be the same throughout the life of the canvas.
*
* @return the current shapeManager
*/
virtual KoShapeManager *shapeManager() const = 0;
/**
* @brief selectedShapesProxy() is a special interface for keeping a persistent connections
* to selectionChanged() and selectionContentChanged() signals. While shapeManager() can change
* throughout the life time of the cavas, selectedShapesProxy() is guaranteed to stay the same.
* @return persistent KoSelectedShapesProxy object
*/
virtual KoSelectedShapesProxy *selectedShapesProxy() const = 0;
/**
* Tell the canvas to repaint the specified rectangle. The coordinates
* are document coordinates, not view coordinates.
*/
virtual void updateCanvas(const QRectF &rc) = 0;
/**
* Return the proxy to the active tool (determining which tool
* is really, really active is hard when tablets are involved,
* so leave that to others.
*/
virtual KoToolProxy *toolProxy() const = 0;
/**
* Return the viewConverter for this view.
* @return the viewConverter for this view.
*/
virtual KoViewConverter *viewConverter() const = 0;
/**
* Convert a coordinate in pixels to pt.
* @param viewPoint the point in the coordinate system of the widget, or window.
*/
virtual QPointF viewToDocument(const QPointF &viewPoint) const;
/**
* Return the widget that will be added to the scrollArea.
*/
virtual QWidget *canvasWidget() = 0;
/**
* Return the widget that will be added to the scrollArea.
*/
virtual const QWidget *canvasWidget() const = 0;
/**
* Return the unit of the current document for initialization of the widgets created
* by the flake framework.
* @see KoDocument::unit()
*/
virtual KoUnit unit() const = 0;
/**
* Called when the user tries to move the argument shape to allow the application to limit the
* users movement to stay within the document bounds.
* An implementation can alter the parameter move to make sure that if the distance moved
* is applied to the shape it will not become unreachable for the user.
* The default implementation does not restrict movement.
* @param shape the shape that will be moved soon.
* @param move the distance the caller intends to move the shape.
*/
virtual void clipToDocument(const KoShape *shape, QPointF &move) const;
/**
* Return the position of the document origin inside the canvas widget, in pixels.
* By default the origin of the canvas widget and the position of the
* document origin are coincident, thus an empty point is returned.
*/
virtual QPoint documentOrigin() const {
return QPoint(0, 0);
}
/**
* This method should somehow call QWidget::updateMicroFocus() on the canvas widget.
*/
virtual void updateInputMethodInfo() = 0;
/**
* disconnect the given QObject completely and utterly from any and all
* connections it has to any QObject owned by the canvas. Do this in
* the setCanvas of every KoCanvasObserver.
*/
virtual void disconnectCanvasObserver(QObject *object);
/**
* Return a pointer to the resource manager associated with this
* canvas. The resource manager contains per-canvas settings such
* as current foreground and background color.
* If instead of per-canvas resources you need per-document resources
* you can by going via the shapeController instead;
* @code
* canvasBase->shapeController()->resourceManager();
* @endcode
* @see KoShapeController::resourceManager()
*/
KoCanvasResourceManager *resourceManager() const;
/**
* Return the shape controller for this canvas.
* A shape controller is used to create or delete shapes and show the relevant dialogs to the user.
*/
KoShapeController *shapeController() const;
/**
* Return the canvas controller for this canvas.
*/
KoCanvasController *canvasController() const;
/**
* @brief Scrolls the content of the canvas so that the given rect is visible.
*
* The rect is to be specified in document coordinates.
*
* @param rect the rectangle to make visible
*/
virtual void ensureVisible(const QRectF &rect);
/**
* Returns the snap guide of the canvas
*/
KoSnapGuide *snapGuide() const;
/// called by KoCanvasController to set the controller that handles this canvas.
void setCanvasController(KoCanvasController *controller);
private:
// we need a KoShapeBasedDocumentBase so that it can work
KoCanvasBase();
class Private;
Private * const d;
};
#endif // KOCANVASBASE_H
diff --git a/libs/flake/KoCanvasController.h b/libs/flake/KoCanvasController.h
index 297650c300..3e4df73ffe 100644
--- a/libs/flake/KoCanvasController.h
+++ b/libs/flake/KoCanvasController.h
@@ -1,478 +1,478 @@
/* This file is part of the KDE project
* Copyright (C) 2006, 2008 Thomas Zander <zander@kde.org>
* Copyright (C) 2007-2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2007-2008 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2009 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCANVASCONTROLLER_H
#define KOCANVASCONTROLLER_H
#include "kritaflake_export.h"
#include <QObject>
#include <QSize>
#include <QPoint>
#include <QPointF>
class KActionCollection;
class QRect;
class QRectF;
class KoShape;
class KoCanvasBase;
class KoCanvasControllerProxyObject;
/**
* KoCanvasController is the base class for wrappers around your canvas
* that provides scrolling and zooming for your canvas.
*
* Flake does not provide a canvas, the application will have to
* implement a canvas themselves. You canvas can be QWidget-based
* or something we haven't invented yet -- as long the class that holds the canvas
* imlements KoCanvasController, tools, scrolling and zooming will work.
*
* A KoCanvasController implementation acts as a decorator around the canvas widget
* and provides a way to scroll the canvas, allows the canvas to be centered
* in the viewArea and manages tool activation.
*
* <p>The using application can instantiate this class and add its
* canvas using the setCanvas() call. Which is designed so it can be
* called multiple times if you need to exchange one canvas
* widget for another, for instance, switching between a plain QWidget or a QOpenGLWidget.
*
* <p>There is _one_ KoCanvasController per canvas in your
* application.
*
* <p>The canvas widget is at most as big as the viewport of the scroll
* area, and when the view on the document is near its edges, smaller.
* In your canvas widget code, you can find the right place in your
* document in view coordinates (pixels) by adding the documentOffset
*/
class KRITAFLAKE_EXPORT KoCanvasController
{
public:
/// An enum to alter the positioning and size of the canvas inside the canvas controller
enum CanvasMode {
AlignTop, ///< canvas is top aligned if smaller than the viewport
Centered, ///< canvas is centered if smaller than the viewport
Infinite, ///< canvas is never smaller than the viewport
Spreadsheet ///< same as Infinite, but supports right-to-left layouts
};
// proxy QObject: use this to connect to slots and signals.
KoCanvasControllerProxyObject *proxyObject;
/**
* Constructor.
* @param actionCollection the action collection for this canvas
*/
explicit KoCanvasController(KActionCollection* actionCollection);
virtual ~KoCanvasController();
public:
/**
* Returns the current margin that is used to pad the canvas with.
* This value is read from the KConfig property "canvasmargin"
*/
virtual int margin() const;
/**
* Set the new margin to pad the canvas with.
*/
virtual void setMargin(int margin);
/**
* Sets the how the canvas behaves if the zoomed document becomes smaller than the viewport.
* @param mode the new canvas mode, CanvasMode::Centered is the default value
*/
virtual void setCanvasMode(KoCanvasController::CanvasMode mode);
/// Returns the current canvas mode
virtual KoCanvasController::CanvasMode canvasMode() const;
/**
* compatibility with QAbstractScrollArea
*/
virtual void scrollContentsBy(int dx, int dy) = 0;
/**
* @return the size of the viewport
*/
virtual QSize viewportSize() const = 0;
/**
* Set the shadow option -- by default the canvas controller draws
* a black shadow around the canvas widget, which you may or may
* not want.
*
* @param drawShadow if true, the shadow is drawn, if false, not
*/
virtual void setDrawShadow(bool drawShadow) = 0;
/**
* Set the new canvas to be shown as a child
* Calling this will emit canvasRemoved() if there was a canvas before, and will emit
* canvasSet() with the new canvas.
* @param canvas the new canvas. The KoCanvasBase::canvas() will be called to retrieve the
* actual widget which will then be added as child of this one.
*/
virtual void setCanvas(KoCanvasBase *canvas) = 0;
/**
* Return the currently set canvas. The default implementation will return Null
* @return the currently set canvas
*/
virtual KoCanvasBase *canvas() const;
/**
* return the amount of pixels vertically visible of the child canvas.
* @return the amount of pixels vertically visible of the child canvas.
*/
virtual int visibleHeight() const = 0;
/**
* return the amount of pixels horizontally visible of the child canvas.
* @return the amount of pixels horizontally visible of the child canvas.
*/
virtual int visibleWidth() const = 0;
/**
* return the amount of pixels that are not visible on the left side of the canvas.
* The leftmost pixel that is shown is returned.
*/
virtual int canvasOffsetX() const = 0;
/**
* return the amount of pixels that are not visible on the top side of the canvas.
* The topmost pixel that is shown is returned.
*/
virtual int canvasOffsetY() const = 0;
/**
* @brief Scrolls the content of the canvas so that the given rect is visible.
*
* The rect is to be specified in view coordinates (pixels). The scrollbar positions
* are changed so that the centerpoint of the rectangle is centered if possible.
*
* @param rect the rectangle to make visible
* @param smooth if true the viewport translation will make be just enough to ensure visibility, no more.
* @see KoViewConverter::documentToView()
*/
virtual void ensureVisible(const QRectF &rect, bool smooth = false) = 0;
/**
* @brief Scrolls the content of the canvas so that the given shape is visible.
*
* This is just a wrapper function of the above function.
*
* @param shape the shape to make visible
*/
virtual void ensureVisible(KoShape *shape) = 0;
/**
* @brief zooms in around the center.
*
* The center must be specified in view coordinates (pixels). The scrollbar positions
* are changed so that the center becomes center if possible.
*
* @param center the position to zoom in on
*/
virtual void zoomIn(const QPoint &center) = 0;
/**
* @brief zooms out around the center.
*
* The center must be specified in view coordinates (pixels). The scrollbar positions
* are changed so that the center becomes center if possible.
*
* @param center the position to zoom out around
*/
virtual void zoomOut(const QPoint &center) = 0;
/**
* @brief zooms around the center.
*
* The center must be specified in view coordinates (pixels). The scrollbar positions
* are changed so that the center becomes center if possible.
*
* @param center the position to zoom around
* @param zoom the zoom to apply
*/
virtual void zoomBy(const QPoint &center, qreal zoom) = 0;
/**
* @brief zoom so that rect is exactly visible (as close as possible)
*
* The rect must be specified in view coordinates (pixels). The scrollbar positions
* are changed so that the center of the rect becomes center if possible.
*
* @param rect the rect in view coordinates (pixels) that should fit the view afterwards
*/
virtual void zoomTo(const QRect &rect) = 0;
/**
* @brief repositions the scrollbars so previous center is once again center
*
* The previous center is cached from when the user uses the scrollbars or zoomTo
* are called. zoomTo is mostly used when a zoom tool of sorts have marked an area
* to zoom in on
*
* The success of this method is limited by the size of thing. But we try our best.
*/
virtual void recenterPreferred() = 0;
/**
* Sets the preferred center point in view coordinates (pixels).
* @param viewPoint the new preferred center
*/
virtual void setPreferredCenter(const QPointF &viewPoint) = 0;
/// Returns the currently set preferred center point in view coordinates (pixels)
virtual QPointF preferredCenter() const = 0;
/**
* Move the canvas over the x and y distance of the parameter distance
* @param distance the distance in view coordinates (pixels). A positive distance means moving the canvas up/left.
*/
virtual void pan(const QPoint &distance) = 0;
/**
* Get the position of the scrollbar
*/
virtual QPoint scrollBarValue() const = 0;
/**
* Set the position of the scrollbar
* @param value the new values of the scroll bars
*/
virtual void setScrollBarValue(const QPoint &value) = 0;
/**
* Called when the size of your document in view coordinates (pixels) changes, for instance when zooming.
*
* @param newSize the new size, in view coordinates (pixels), of the document.
* @param recalculateCenter if true the offset in the document we center on after calling
* recenterPreferred() will be recalculated for the new document size so the visual offset stays the same.
*/
virtual void updateDocumentSize(const QSize &sz, bool recalculateCenter) = 0;
/**
* Set mouse wheel to zoom behaviour
* @param zoom if true wheel will zoom instead of scroll, control modifier will scroll
*/
virtual void setZoomWithWheel(bool zoom) = 0;
/**
* Set scroll area to be bigger than actual document.
* It allows the user to move the corner of the document
* to e.g. the center of the screen
*
* @param factor the coefficient, defining how much we can scroll out,
* measured in parts of the widget size. Null value means vast
* scrolling is disabled.
*/
virtual void setVastScrolling(qreal factor) = 0;
/**
* Returns the action collection for the canvas
* @returns action collection for this canvas, can be 0
*/
virtual KActionCollection* actionCollection() const;
QPoint documentOffset() const;
/**
* @return the current position of the cursor fetched from QCursor::pos() and
* converted into document coordinates
*/
virtual QPointF currentCursorPosition() const = 0;
protected:
void setDocumentSize(const QSize &sz);
QSize documentSize() const;
void setPreferredCenterFractionX(qreal);
qreal preferredCenterFractionX() const;
void setPreferredCenterFractionY(qreal);
qreal preferredCenterFractionY() const;
void setDocumentOffset( QPoint &offset);
private:
class Private;
Private * const d;
};
/**
* Workaround class for the problem that Qt does not allow two QObject base classes.
* KoCanvasController can be implemented by for instance QWidgets, so it cannot be
* a QObject directly. The interface of this class should be considered public interface
* for KoCanvasController.
*/
class KRITAFLAKE_EXPORT KoCanvasControllerProxyObject : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(KoCanvasControllerProxyObject)
public:
explicit KoCanvasControllerProxyObject(KoCanvasController *canvasController, QObject *parent = 0);
public:
// Convenience methods to invoke the signals from subclasses
void emitCanvasRemoved(KoCanvasController *canvasController) { emit canvasRemoved(canvasController); }
void emitCanvasSet(KoCanvasController *canvasController) { emit canvasSet(canvasController); }
void emitCanvasOffsetXChanged(int offset) { emit canvasOffsetXChanged(offset); }
void emitCanvasOffsetYChanged(int offset) { emit canvasOffsetYChanged(offset); }
void emitCanvasMousePositionChanged(const QPoint &position) { emit canvasMousePositionChanged(position); }
void emitDocumentMousePositionChanged(const QPointF &position) { emit documentMousePositionChanged(position); }
void emitSizeChanged(const QSize &size) { emit sizeChanged(size); }
void emitMoveDocumentOffset(const QPoint &point) { emit moveDocumentOffset(point); }
void emitZoomRelative(const qreal factor, const QPointF &stillPoint) { emit zoomRelative(factor, stillPoint); }
// Convenience method to retrieve the canvas controller for who needs to use QPointer
KoCanvasController *canvasController() const { return m_canvasController; }
Q_SIGNALS:
/**
* Emitted when a previously added canvas is about to be removed.
* @param canvasController this object
*/
void canvasRemoved(KoCanvasController *canvasController);
/**
* Emitted when a canvas is set on this widget
* @param canvasController this object
*/
void canvasSet(KoCanvasController *canvasController);
/**
* Emitted when canvasOffsetX() changes
* @param offset the new canvas offset
*/
void canvasOffsetXChanged(int offset);
/**
* Emitted when canvasOffsetY() changes
* @param offset the new canvas offset
*/
void canvasOffsetYChanged(int offset);
/**
* Emitted when the cursor is moved over the canvas widget.
* @param position the position in view coordinates (pixels).
*/
void canvasMousePositionChanged(const QPoint &position);
/**
* Emitted when the cursor is moved over the canvas widget.
* @param position the position in document coordinates.
*
* Use \ref canvasMousePositionChanged to get the position
* in view coordinates.
*/
void documentMousePositionChanged(const QPointF &position);
/**
* Emitted when the entire controller size changes
* @param size the size in widget pixels.
*/
void sizeChanged(const QSize &size);
/**
* Emitted whenever the document is scrolled.
*
* @param point the new top-left point from which the document should
* be drawn.
*/
void moveDocumentOffset(const QPoint &point);
/**
* Emitted when zoomRelativeToPoint have calculated a factor by which
* the zoom should change and the point which should stand still
* on screen.
* Someone needs to connect to this and take action
*
* @param factor by how much the zoom needs to change.
* @param stillPoint the point which will not change its position
* in widget during the zooming. It is measured in
* view coordinate system *before* zoom.
*/
void zoomRelative(const qreal factor, const QPointF &stillPoint);
public Q_SLOTS:
/**
* Call this slot whenever the size of your document in view coordinates (pixels)
* changes, for instance when zooming.
* @param newSize the new size, in view coordinates (pixels), of the document.
* @param recalculateCenter if true the offset in the document we center on after calling
* recenterPreferred() will be recalculated for the new document size so the visual offset stays the same.
*/
void updateDocumentSize(const QSize &newSize, bool recalculateCenter = true);
private:
KoCanvasController *m_canvasController;
};
class KRITAFLAKE_EXPORT KoDummyCanvasController : public KoCanvasController {
public:
explicit KoDummyCanvasController(KActionCollection* actionCollection)
: KoCanvasController(actionCollection)
{}
- virtual ~KoDummyCanvasController()
+ ~KoDummyCanvasController() override
{}
- virtual void scrollContentsBy(int /*dx*/, int /*dy*/) {}
- virtual QSize viewportSize() const { return QSize(); }
- virtual void setDrawShadow(bool /*drawShadow*/) {}
- virtual void setCanvas(KoCanvasBase *canvas) {Q_UNUSED(canvas)}
- virtual KoCanvasBase *canvas() const {return 0;}
- virtual int visibleHeight() const {return 0;}
- virtual int visibleWidth() const {return 0;}
- virtual int canvasOffsetX() const {return 0;}
- virtual int canvasOffsetY() const {return 0;}
- virtual void ensureVisible(const QRectF &/*rect*/, bool /*smooth */ = false) {}
- virtual void ensureVisible(KoShape *shape) {Q_UNUSED(shape)}
- virtual void zoomIn(const QPoint &/*center*/) {}
- virtual void zoomOut(const QPoint &/*center*/) {}
- virtual void zoomBy(const QPoint &/*center*/, qreal /*zoom*/) {}
- virtual void zoomTo(const QRect &/*rect*/) {}
- virtual void recenterPreferred() {}
- virtual void setPreferredCenter(const QPointF &/*viewPoint*/) {}
- virtual QPointF preferredCenter() const {return QPointF();}
- virtual void pan(const QPoint &/*distance*/) {}
- virtual QPoint scrollBarValue() const {return QPoint();}
- virtual void setScrollBarValue(const QPoint &/*value*/) {}
- virtual void updateDocumentSize(const QSize &/*sz*/, bool /*recalculateCenter*/) {}
- virtual void setZoomWithWheel(bool /*zoom*/) {}
- virtual void setVastScrolling(qreal /*factor*/) {}
+ void scrollContentsBy(int /*dx*/, int /*dy*/) override {}
+ QSize viewportSize() const override { return QSize(); }
+ void setDrawShadow(bool /*drawShadow*/) override {}
+ void setCanvas(KoCanvasBase *canvas) override {Q_UNUSED(canvas)}
+ KoCanvasBase *canvas() const override {return 0;}
+ int visibleHeight() const override {return 0;}
+ int visibleWidth() const override {return 0;}
+ int canvasOffsetX() const override {return 0;}
+ int canvasOffsetY() const override {return 0;}
+ void ensureVisible(const QRectF &/*rect*/, bool /*smooth */ = false) override {}
+ void ensureVisible(KoShape *shape) override {Q_UNUSED(shape)}
+ void zoomIn(const QPoint &/*center*/) override {}
+ void zoomOut(const QPoint &/*center*/) override {}
+ void zoomBy(const QPoint &/*center*/, qreal /*zoom*/) override {}
+ void zoomTo(const QRect &/*rect*/) override {}
+ void recenterPreferred() override {}
+ void setPreferredCenter(const QPointF &/*viewPoint*/) override {}
+ QPointF preferredCenter() const override {return QPointF();}
+ void pan(const QPoint &/*distance*/) override {}
+ QPoint scrollBarValue() const override {return QPoint();}
+ void setScrollBarValue(const QPoint &/*value*/) override {}
+ void updateDocumentSize(const QSize &/*sz*/, bool /*recalculateCenter*/) override {}
+ void setZoomWithWheel(bool /*zoom*/) override {}
+ void setVastScrolling(qreal /*factor*/) override {}
QPointF currentCursorPosition() const override { return QPointF(); }
};
#endif
diff --git a/libs/flake/KoCanvasControllerWidget.h b/libs/flake/KoCanvasControllerWidget.h
index 68d9d80f2f..e46f42ba7c 100644
--- a/libs/flake/KoCanvasControllerWidget.h
+++ b/libs/flake/KoCanvasControllerWidget.h
@@ -1,184 +1,184 @@
/* This file is part of the KDE project
* Copyright (C) 2006, 2008 Thomas Zander <zander@kde.org>
* Copyright (C) 2007-2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2007-2008 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2009 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCANVASCONTROLLERWIDGET_H
#define KOCANVASCONTROLLERWIDGET_H
#include "kritaflake_export.h"
#include <QAbstractScrollArea>
#include <QPointer>
#include "KoCanvasController.h"
class KoShape;
class KoCanvasBase;
/**
* KoCanvasController implementation for QWidget based canvases
*/
class KRITAFLAKE_EXPORT KoCanvasControllerWidget : public QAbstractScrollArea, public KoCanvasController
{
Q_OBJECT
public:
/**
* Constructor.
* @param parent the parent this widget will belong to
*/
explicit KoCanvasControllerWidget(KActionCollection * actionCollection, QWidget *parent = 0);
- virtual ~KoCanvasControllerWidget();
+ ~KoCanvasControllerWidget() override;
/**
* Reimplemented from QAbstractScrollArea.
*/
- void scrollContentsBy(int dx, int dy);
+ void scrollContentsBy(int dx, int dy) override;
- virtual QSize viewportSize() const;
+ QSize viewportSize() const override;
/// Reimplemented from KoCanvasController
/**
* Activate this canvascontroller
*/
virtual void activate();
- virtual void setDrawShadow(bool drawShadow);
+ void setDrawShadow(bool drawShadow) override;
- virtual void setCanvas(KoCanvasBase *canvas);
+ void setCanvas(KoCanvasBase *canvas) override;
- virtual KoCanvasBase *canvas() const;
+ KoCanvasBase *canvas() const override;
/**
* Change the actual canvas widget used by the current canvas. This allows the canvas widget
* to be changed while keeping the current KoCanvasBase canvas and its associated resources as
* they are. This might be used, for example, to switch from a QWidget to a QOpenGLWidget canvas.
* @param widget the new canvas widget.
*/
virtual void changeCanvasWidget(QWidget *widget);
- virtual int visibleHeight() const;
- virtual int visibleWidth() const;
- virtual int canvasOffsetX() const;
- virtual int canvasOffsetY() const;
+ int visibleHeight() const override;
+ int visibleWidth() const override;
+ int canvasOffsetX() const override;
+ int canvasOffsetY() const override;
- virtual void ensureVisible(const QRectF &rect, bool smooth = false);
+ void ensureVisible(const QRectF &rect, bool smooth = false) override;
- virtual void ensureVisible(KoShape *shape);
+ void ensureVisible(KoShape *shape) override;
/**
* will cause the toolOptionWidgetsChanged to be emitted and all
* listeners to be updated to the new widget.
*
* FIXME: This doesn't belong her and it does an
* inherits("KoView") so it too much tied to komain
*
* @param widgets the map of widgets
*/
void setToolOptionWidgets(const QList<QPointer<QWidget> > &widgets);
- virtual void zoomIn(const QPoint &center);
+ void zoomIn(const QPoint &center) override;
- virtual void zoomOut(const QPoint &center);
+ void zoomOut(const QPoint &center) override;
- virtual void zoomBy(const QPoint &center, qreal zoom);
+ void zoomBy(const QPoint &center, qreal zoom) override;
- virtual void zoomTo(const QRect &rect);
+ void zoomTo(const QRect &rect) override;
/**
* Zoom document keeping point \p widgetPoint unchanged
* \param widgetPoint sticky point in widget pixels
*/
virtual void zoomRelativeToPoint(const QPoint &widgetPoint, qreal zoomCoeff);
- virtual void recenterPreferred();
+ void recenterPreferred() override;
- virtual void setPreferredCenter(const QPointF &viewPoint);
+ void setPreferredCenter(const QPointF &viewPoint) override;
/// Returns the currently set preferred center point in view coordinates (pixels)
- virtual QPointF preferredCenter() const;
+ QPointF preferredCenter() const override;
- virtual void pan(const QPoint &distance);
+ void pan(const QPoint &distance) override;
- virtual void setMargin(int margin);
+ void setMargin(int margin) override;
- virtual QPoint scrollBarValue() const;
+ QPoint scrollBarValue() const override;
/**
* Used by KisCanvasController to correct the scrollbars position
* after the rotation.
*/
- virtual void setScrollBarValue(const QPoint &value);
+ void setScrollBarValue(const QPoint &value) override;
- virtual void updateDocumentSize(const QSize &sz, bool recalculateCenter = true);
+ void updateDocumentSize(const QSize &sz, bool recalculateCenter = true) override;
/**
* Set mouse wheel to zoom behaviour
* @param zoom if true wheel will zoom instead of scroll, control modifier will scroll
*/
- void setZoomWithWheel(bool zoom);
+ void setZoomWithWheel(bool zoom) override;
- virtual void setVastScrolling(qreal factor);
+ void setVastScrolling(qreal factor) override;
QPointF currentCursorPosition() const override;
/**
* \internal
*/
class Private;
KoCanvasControllerWidget::Private *priv();
private Q_SLOTS:
/// Called by the horizontal scrollbar when its value changes
void updateCanvasOffsetX();
/// Called by the vertical scrollbar when its value changes
void updateCanvasOffsetY();
protected:
friend class KisZoomAndPanTest;
/// reimplemented from QWidget
- virtual void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
/// reimplemented from QWidget
- virtual void resizeEvent(QResizeEvent *resizeEvent);
+ void resizeEvent(QResizeEvent *resizeEvent) override;
/// reimplemented from QWidget
- virtual void dragEnterEvent(QDragEnterEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event) override;
/// reimplemented from QWidget
- virtual void dropEvent(QDropEvent *event);
+ void dropEvent(QDropEvent *event) override;
/// reimplemented from QWidget
- virtual void dragMoveEvent(QDragMoveEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event) override;
/// reimplemented from QWidget
- virtual void dragLeaveEvent(QDragLeaveEvent *event);
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
/// reimplemented from QWidget
- virtual void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) override;
/// reimplemented from QWidget
- virtual bool focusNextPrevChild(bool next);
+ bool focusNextPrevChild(bool next) override;
private:
Q_PRIVATE_SLOT(d, void activate())
Private * const d;
};
#endif
diff --git a/libs/flake/KoCanvasControllerWidgetViewport_p.h b/libs/flake/KoCanvasControllerWidgetViewport_p.h
index 6ffe0a89f5..c430e39e59 100644
--- a/libs/flake/KoCanvasControllerWidgetViewport_p.h
+++ b/libs/flake/KoCanvasControllerWidgetViewport_p.h
@@ -1,91 +1,91 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007-2010 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCANVASCONTROLLERWIDGETVIEWPORT_P_H
#define KOCANVASCONTROLLERWIDGETVIEWPORT_P_H
#include <QWidget>
#include <QSize>
#include <QPoint>
class KoCanvasControllerWidget;
class KoShape;
class Viewport : public QWidget
{
Q_OBJECT
public:
explicit Viewport(KoCanvasControllerWidget *parent);
- ~Viewport() {}
+ ~Viewport() override {}
void setCanvas(QWidget *canvas);
QWidget *canvas() const {
return m_canvas;
}
void setDocumentSize(const QSize &size);
/**
* When true, a shadow is drawn around the canvas widet.
*/
void setDrawShadow(bool drawShadow);
public Q_SLOTS:
void documentOffsetMoved(const QPoint &);
Q_SIGNALS:
void sizeChanged();
public:
void handleDragEnterEvent(QDragEnterEvent *event);
void handleDropEvent(QDropEvent *event);
void handleDragMoveEvent(QDragMoveEvent *event);
void handleDragLeaveEvent(QDragLeaveEvent *event);
void handlePaintEvent(QPainter &gc, QPaintEvent *event);
void setMargin(int margin) { m_margin = margin; resetLayout(); }
private:
QPointF correctPosition(const QPoint &point) const;
void repaint(KoShape *shape);
/**
Decides whether the containing canvas widget should be as
big as the viewport (i.e., no margins are visible) or whether
there are margins to be left blank, and then places the canvas
widget accordingly.
*/
void resetLayout();
private:
KoCanvasControllerWidget *m_parent;
KoShape *m_draggedShape;
bool m_drawShadow;
QWidget *m_canvas;
QSize m_documentSize; // Size in pixels of the document
QPoint m_documentOffset; // Place where the canvas widget should
int m_margin; // The viewport margin around the document
};
#endif
diff --git a/libs/flake/KoCanvasResourceManager.h b/libs/flake/KoCanvasResourceManager.h
index c66a250d8d..e5f1a1a9ab 100644
--- a/libs/flake/KoCanvasResourceManager.h
+++ b/libs/flake/KoCanvasResourceManager.h
@@ -1,281 +1,281 @@
/*
Copyright (c) 2006, 2011 Boudewijn Rempt (boud@valdyas.org)
Copyright (C) 2007, 2009, 2010 Thomas Zander <zander@kde.org>
Copyright (c) 2008 Carlos Licea <carlos.licea@kdemail.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KO_CANVASRESOURCEMANAGER_H
#define KO_CANVASRESOURCEMANAGER_H
#include <QObject>
#include "kritaflake_export.h"
#include "KoDerivedResourceConverter.h"
#include "KoResourceUpdateMediator.h"
class KoShape;
class KoShapeStroke;
class KoColor;
class KoUnit;
class QVariant;
class QSizeF;
/**
* The KoCanvasResourceManager contains a set of per-canvas
* properties, like current foreground color, current background
* color and more. All tools belonging to the current canvas are
* notified when a Resource changes (is set).
*
* The manager can contain all sorts of variable types and there are accessors
* for the most common ones. All variables are always stored inside a QVariant
* instance internally and you can always just use the resource() method to get
* that directly.
* The way to store arbitairy data objects that are stored as pointers you can use
* the following code snippets;
* @code
* QVariant variant;
* variant.setValue<void*>(textShapeData->document());
* resourceManager->setResource(KoText::CurrentTextDocument, variant);
* // and get it out again.
* QVariant var = resourceManager->resource(KoText::CurrentTextDocument);
* document = static_cast<QTextDocument*>(var.value<void*>());
* @endcode
*/
class KRITAFLAKE_EXPORT KoCanvasResourceManager : public QObject
{
Q_OBJECT
public:
/**
* This enum holds identifiers to the resources that can be stored in here.
*/
enum CanvasResource {
ForegroundColor, ///< The active forground color selected for this canvas.
BackgroundColor, ///< The active background color selected for this canvas.
PageSize, ///< The size of the (current) page in postscript points.
Unit, ///< The unit of this canvas
CurrentPage, ///< The current page number
ActiveStyleType, ///< the actual active style type see KoFlake::StyleType for valid values
ActiveRange, ///< The area where the rulers should show white
ShowTextShapeOutlines, ///< Paint of text shape outlines ?
ShowFormattingCharacters, ///< Paint of formatting characters ?
ShowTableBorders, ///< Paint of table borders (when not really there) ?
ShowSectionBounds, ///< Paint of sections bounds ?
ShowInlineObjectVisualization, ///< paint a different background for inline objects
ApplicationSpeciality, ///< Special features and limitations of the application
KarbonStart = 1000, ///< Base number for Karbon specific values.
KexiStart = 2000, ///< Base number for Kexi specific values.
FlowStart = 3000, ///< Base number for Flow specific values.
PlanStart = 4000, ///< Base number for Plan specific values.
StageStart = 5000, ///< Base number for Stage specific values.
KritaStart = 6000, ///< Base number for Krita specific values.
SheetsStart = 7000, ///< Base number for Sheets specific values.
WordsStart = 8000, ///< Base number for Words specific values.
KoPageAppStart = 9000 ///< Base number for KoPageApp specific values.
};
enum ApplicationSpecial {
NoSpecial = 0,
NoAdvancedText = 1
};
/**
* Constructor.
* @param parent the parent QObject, used for memory management.
*/
explicit KoCanvasResourceManager(QObject *parent = 0);
- virtual ~KoCanvasResourceManager();
+ ~KoCanvasResourceManager() override;
public Q_SLOTS:
/**
* Set a resource of any type.
* @param key the integer key
* @param value the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
*/
void setResource(int key, const QVariant &value);
/**
* Set a resource of type KoColor.
* @param key the integer key
* @param color the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
*/
void setResource(int key, const KoColor &color);
/**
* Set a resource of type KoShape*.
* @param key the integer key
* @param id the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
*/
void setResource(int key, KoShape *shape);
/**
* Set a resource of type KoUnit
* @param key the integer key
* @param id the new value for the key.
* @see KoCanvasResourceManager::CanvasResource
*/
void setResource(int key, const KoUnit &unit);
public:
/**
* Returns a qvariant containing the specified resource or a standard one if the
* specified resource does not exist.
* @param key the key
* @see KoCanvasResourceManager::CanvasResource
*/
QVariant resource(int key) const;
/**
* Set the foregroundColor resource.
* @param color the new foreground color
*/
void setForegroundColor(const KoColor &color);
/**
* Return the foregroundColor
*/
KoColor foregroundColor() const;
/**
* Set the backgroundColor resource.
* @param color the new background color
*/
void setBackgroundColor(const KoColor &color);
/**
* Return the backgroundColor
*/
KoColor backgroundColor() const;
/**
* Return the resource determined by param key as a boolean.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
bool boolResource(int key) const;
/**
* Return the resource determined by param key as an integer.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
int intResource(int key) const;
/**
* Return the resource determined by param key as a KoColor.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
KoColor koColorResource(int key) const;
/**
* Return the resource determined by param key as a pointer to a KoShape.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
KoShape *koShapeResource(int key) const;
/**
* Return the resource determined by param key as a QString .
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
QString stringResource(int key) const;
/**
* Return the resource determined by param key as a QSizeF.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
QSizeF sizeResource(int key) const;
/**
* Return the resource determined by param key as a KoUnit.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
KoUnit unitResource(int key) const;
/**
* Returns true if there is a resource set with the requested key.
* @param key the indentifying key for the resource
* @see KoCanvasResourceManager::CanvasResource
*/
bool hasResource(int key) const;
/**
* Remove the resource with @p key from the provider.
* @param key the key that will be used to remove the resource
* There will be a signal emitted with a variable that will return true on QVariable::isNull();
* @see KoCanvasResourceManager::CanvasResource
*/
void clearResource(int key);
/**
* @see KoReosurceManager::addDerivedResourceConverter()
*/
void addDerivedResourceConverter(KoDerivedResourceConverterSP converter);
/**
* @see KoReosurceManager::hasDerivedResourceConverter()
*/
bool hasDerivedResourceConverter(int key);
/**
* @see KoReosurceManager::removeDerivedResourceConverter()
*/
void removeDerivedResourceConverter(int key);
/**
* @see KoReosurceManager::addResourceUpdateMediator
*/
void addResourceUpdateMediator(KoResourceUpdateMediatorSP mediator);
/**
* @see KoReosurceManager::hasResourceUpdateMediator
*/
bool hasResourceUpdateMediator(int key);
/**
* @see KoReosurceManager::removeResourceUpdateMediator
*/
void removeResourceUpdateMediator(int key);
Q_SIGNALS:
/**
* This signal is emitted every time a resource is set that is either
* new or different from the previous set value.
* @param key the indentifying key for the resource
* @param value the variants new value.
* @see KoCanvasResourceManager::CanvasResource
*/
void canvasResourceChanged(int key, const QVariant &value);
private:
KoCanvasResourceManager(const KoCanvasResourceManager&);
KoCanvasResourceManager& operator=(const KoCanvasResourceManager&);
class Private;
Private *const d;
};
#endif
diff --git a/libs/flake/KoColorBackground.h b/libs/flake/KoColorBackground.h
index b406c567b7..2092609fa9 100644
--- a/libs/flake/KoColorBackground.h
+++ b/libs/flake/KoColorBackground.h
@@ -1,65 +1,65 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORBACKGROUND_H
#define KOCOLORBACKGROUND_H
#include "KoShapeBackground.h"
#include "kritaflake_export.h"
#include <Qt>
class KoColorBackgroundPrivate;
class QColor;
/// A simple solid color shape background
class KRITAFLAKE_EXPORT KoColorBackground : public KoShapeBackground
{
public:
KoColorBackground();
/// Creates background from given color and style
explicit KoColorBackground(const QColor &color, Qt::BrushStyle style = Qt::SolidPattern);
- virtual ~KoColorBackground();
+ ~KoColorBackground() override;
bool compareTo(const KoShapeBackground *other) const override;
/// Returns the background color
QColor color() const;
/// Sets the background color
void setColor(const QColor &color);
/// Returns the background style
Qt::BrushStyle style() const;
// reimplemented from KoShapeBackground
- virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const;
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const override;
// reimplemented from KoShapeBackground
- virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context);
+ void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
// reimplemented from KoShapeBackground
- virtual bool loadStyle(KoOdfLoadingContext & context, const QSizeF &shapeSize);
+ bool loadStyle(KoOdfLoadingContext & context, const QSizeF &shapeSize) override;
protected:
KoColorBackground(KoShapeBackgroundPrivate &dd);
private:
Q_DECLARE_PRIVATE(KoColorBackground)
Q_DISABLE_COPY(KoColorBackground)
};
#endif // KOCOLORBACKGROUND_H
diff --git a/libs/flake/KoConnectionShape.h b/libs/flake/KoConnectionShape.h
index f1c1b4f1d0..f3f1fa75d5 100644
--- a/libs/flake/KoConnectionShape.h
+++ b/libs/flake/KoConnectionShape.h
@@ -1,145 +1,145 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Boudewijn Rempt <boud@kde.org>
* Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2009 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_CONNECTION_SHAPE_H
#define KO_CONNECTION_SHAPE_H
#include "KoParameterShape.h"
#include "kritaflake_export.h"
#define KOCONNECTIONSHAPEID "KoConnectionShape"
class KoConnectionShapePrivate;
/// API docs go here
class KRITAFLAKE_EXPORT KoConnectionShape : public KoParameterShape
{
public:
enum Type {
Standard, ///< escapes connected shapes with straight lines, connects with perpendicular lines
Lines, ///< escapes connected shapes with straight lines, connects with straight line
Straight, ///< one straight line between connected shapes
Curve ///< a single curved line between connected shapes
};
// IDs of the connecting handles
enum HandleId {
StartHandle,
EndHandle,
ControlHandle_1,
ControlHandle_2,
ControlHandle_3
};
KoConnectionShape();
- virtual ~KoConnectionShape();
+ ~KoConnectionShape() override;
KoShape* cloneShape() const override;
// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
// reimplemented
- virtual QString pathShapeId() const;
+ QString pathShapeId() const override;
/**
* Sets the first shape this connector is connected to
*
* Passing a null pointer as the first parameter will sever the connection.
*
* @param shape the shape to connect to or null to reset the connection
* @param connectionPointId the id of the connection point to connect to
* @return true if connection could be established, otherwise false
*/
bool connectFirst(KoShape *shape, int connectionPointId);
/**
* Sets the second shape the connector is connected to
*
* Passing a null pointer as the first parameter will sever the connection.
*
* @param shape the shape to connect to or null to reset the connection
* @param connectionPointId the id of the connection point to connect to
* @return true if connection could be established, otherwise false
*/
bool connectSecond(KoShape *shape, int connectionPointId);
/**
* Return the first shape this connection is attached to, or null if none.
*/
KoShape *firstShape() const;
/**
* Return the connection point id of the first shape we are connected to.
* In case we are not connected to a first shape the return value is undefined.
* @see firstShape(), KoShape::connectionPoints()
*/
int firstConnectionId() const;
/**
* Return the second shape this connection is attached to, or null if none.
*/
KoShape *secondShape() const;
/**
* Return the connection point id of the second shape we are connected to.
* In case we are not connected to a second shape the return value is undefined.
* @see firstShape(), KoShape::connectionPoints()
*/
int secondConnectionId() const;
/**
* Finishes the loading of a connection.
*/
void finishLoadingConnection();
/// Returns connection type
Type type() const;
/// Sets the connection type
void setType(Type connectionType);
/// Updates connections to shapes
void updateConnections();
protected:
KoConnectionShape(const KoConnectionShape &rhs);
/// reimplemented
- void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
/// reimplemented
- void updatePath(const QSizeF &size);
+ void updatePath(const QSizeF &size) override;
/// reimplemented
- virtual void shapeChanged(ChangeType type, KoShape *shape);
+ void shapeChanged(ChangeType type, KoShape *shape) override;
private:
Q_DECLARE_PRIVATE(KoConnectionShape)
};
#endif
diff --git a/libs/flake/KoConnectionShapeConfigWidget.h b/libs/flake/KoConnectionShapeConfigWidget.h
index 0c390dd960..109d025e72 100644
--- a/libs/flake/KoConnectionShapeConfigWidget.h
+++ b/libs/flake/KoConnectionShapeConfigWidget.h
@@ -1,56 +1,56 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCONNECTIONSHAPECONFIGWIDGET_H
#define KOCONNECTIONSHAPECONFIGWIDGET_H
#include "ui_KoConnectionShapeConfigWidget.h"
#include <KoShapeConfigWidgetBase.h>
class KoConnectionShape;
class KoConnectionShapeConfigWidget : public KoShapeConfigWidgetBase
{
Q_OBJECT
public:
KoConnectionShapeConfigWidget();
/// reimplemented
- virtual void open(KoShape *shape);
+ void open(KoShape *shape) override;
/// reimplemented
- virtual void save();
+ void save() override;
/// reimplemented
- virtual bool showOnShapeCreate() {
+ bool showOnShapeCreate() override {
return false;
}
/// reimplemented
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
Q_SIGNALS:
void connectionTypeChanged(int type);
public Q_SLOTS:
void setConnectionType(int type);
private:
Ui::KoConnectionShapeConfigWidget widget;
KoConnectionShape *m_connection;
};
#endif // KOCONNECTIONSHAPECONFIGWIDGET_H
diff --git a/libs/flake/KoConnectionShapeFactory.h b/libs/flake/KoConnectionShapeFactory.h
index 1d4cd8eece..dde8a6bb0e 100644
--- a/libs/flake/KoConnectionShapeFactory.h
+++ b/libs/flake/KoConnectionShapeFactory.h
@@ -1,40 +1,40 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Boudewijn Rempt <boud@kde.org>
* Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CONNECTIONSHAPEFACTORY_H
#define CONNECTIONSHAPEFACTORY_H
#include <KoShapeFactoryBase.h>
class KoShape;
class KoConnectionShapeFactory : public KoShapeFactoryBase
{
public:
KoConnectionShapeFactory();
- ~KoConnectionShapeFactory() {}
+ ~KoConnectionShapeFactory() override {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
- virtual QList<KoShapeConfigWidgetBase*> createShapeOptionPanels();
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
+ QList<KoShapeConfigWidgetBase*> createShapeOptionPanels() override;
};
#endif
diff --git a/libs/flake/KoConnectionShapeLoadingUpdater.h b/libs/flake/KoConnectionShapeLoadingUpdater.h
index 23ce9559a8..01cb1ab819 100644
--- a/libs/flake/KoConnectionShapeLoadingUpdater.h
+++ b/libs/flake/KoConnectionShapeLoadingUpdater.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
Copyright (C) 2009 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCONNECTIONSHAPELOADINGUPDATER_H
#define KOCONNECTIONSHAPELOADINGUPDATER_H
#include <KoLoadingShapeUpdater.h>
class KoConnectionShape;
class KoShape;
class KoConnectionShapeLoadingUpdater : public KoLoadingShapeUpdater
{
public:
enum ConnectionPosition
{
First,
Second
};
KoConnectionShapeLoadingUpdater(KoConnectionShape *connectionShape, ConnectionPosition position);
- virtual ~KoConnectionShapeLoadingUpdater();
+ ~KoConnectionShapeLoadingUpdater() override;
- virtual void update(KoShape *shape);
+ void update(KoShape *shape) override;
private:
KoConnectionShape *m_connectionShape;
ConnectionPosition m_position;
};
#endif /* KOCONNECTIONSHAPELOADINGUPDATER_H */
diff --git a/libs/flake/KoDeferredShapeFactoryBase.h b/libs/flake/KoDeferredShapeFactoryBase.h
index d4aff4fba4..acb0bffb10 100644
--- a/libs/flake/KoDeferredShapeFactoryBase.h
+++ b/libs/flake/KoDeferredShapeFactoryBase.h
@@ -1,78 +1,78 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Boudewijn Rempt (boud@valdyas.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KODEFERREDSHAPEFACTORYBASE_H
#define KODEFERREDSHAPEFACTORYBASE_H
#include "kritaflake_export.h"
#include <QObject>
class KoShape;
class KoDocumentResourceManager;
class KoProperties;
class QString;
/**
* A factory for KoShape objects. This factory differs from the public KoShapeFactorBase
* class that this class really creates the shape; it's the plugin entry point for the
* actually shape plugins.
*/
class KRITAFLAKE_EXPORT KoDeferredShapeFactoryBase : public QObject
{
Q_OBJECT
public:
explicit KoDeferredShapeFactoryBase(QObject *parent);
- virtual ~KoDeferredShapeFactoryBase();
+ ~KoDeferredShapeFactoryBase() override;
virtual QString deferredPluginName() = 0;
/**
* This method should be implemented by factories to create a shape that the user
* gets when doing a base insert. For example from a script. The created shape
* should have its values set to good defaults that the user can then adjust further if
* needed. Including the KoShape:setShapeId(), with the Id from this factory
* The default shape position is not relevant, it will be moved by the caller.
* @param documentResources the resources manager that has all the document wide
* resources which can be used to create the object.
* @return a new shape
* @see createShape() newDocumentResourceManager()
*/
virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const = 0;
/**
* This method should be implemented by factories to create a shape based on a set of
* properties that are specifically made for this shape-type.
* This method should also set this factories shapeId on the shape using KoShape::setShapeId()
* The default implementation just ignores 'params' and calls createDefaultShape()
* @return a new shape
* @param params the properties object is the same as added in the addTemplate() call
* @param documentResources the resources manager that has all the document wide
* resources which can be used to create the object.
* @see createDefaultShape() newDocumentResourceManager()
* @see KoShapeTemplate::properties
*/
virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
};
#endif
diff --git a/libs/flake/KoDockRegistry.h b/libs/flake/KoDockRegistry.h
index 52751dbc66..0ea8e234bc 100644
--- a/libs/flake/KoDockRegistry.h
+++ b/libs/flake/KoDockRegistry.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KODOCKREGISTRY_
#define KODOCKREGISTRY_
#include <QFont>
#include "KoGenericRegistry.h"
#include <KoDockFactoryBase.h>
#include "kritaflake_export.h"
/**
* This singleton class keeps a register of all available dockers,
* or rather, of the factories that can create the QDockWidget instances
* for the mainwindows.
* Note that adding your KoDockFactoryBase to this registry will mean it will automatically be
* added to an application, no extra code is required for that.
*
* @see KoCanvasObserverBase
*/
class KRITAFLAKE_EXPORT KoDockRegistry : public KoGenericRegistry<KoDockFactoryBase*>
{
public:
KoDockRegistry();
- ~KoDockRegistry();
+ ~KoDockRegistry() override;
/**
* Return an instance of the KoDockRegistry
* Create a new instance on first call and return the singleton.
*/
static KoDockRegistry *instance();
/**
* @brief dockFontSize calculates a smallish font size for dock widgets to use
* @return the point size in floating point.
*/
static QFont dockFont();
private:
KoDockRegistry(const KoDockRegistry&);
KoDockRegistry operator=(const KoDockRegistry&);
void init();
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/KoDocumentResourceManager.h b/libs/flake/KoDocumentResourceManager.h
index b24c06f23e..2f57407b45 100644
--- a/libs/flake/KoDocumentResourceManager.h
+++ b/libs/flake/KoDocumentResourceManager.h
@@ -1,253 +1,253 @@
/*
Copyright (c) 2006 Boudewijn Rempt (boud@valdyas.org)
Copyright (C) 2007, 2009, 2010 Thomas Zander <zander@kde.org>
Copyright (c) 2008 Carlos Licea <carlos.licea@kdemail.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KO_DOCUMENTRESOURCEMANAGER_H
#define KO_DOCUMENTRESOURCEMANAGER_H
#include <QObject>
#include "kritaflake_export.h"
class KoShape;
class KUndo2Stack;
class KoImageCollection;
class KoDocumentBase;
class KoShapeController;
class KoColor;
class KoUnit;
class QVariant;
class QSizeF;
/**
* The KoResourceManager contains a set of per-canvas <i>or</i> per-document
* properties, like current foreground color, current background
* color and more. All tools belonging to the current canvas are
* notified when a Resource changes (is set).
*
* The properties come from the KoDocumentResourceManager::DocumentResource
* See KoShapeController::resourceManager
*
* The manager can contain all sorts of variable types and there are accessors
* for the most common ones. All variables are always stored inside a QVariant
* instance internally and you can always just use the resource() method to get
* that directly.
* The way to store arbitairy data objects that are stored as pointers you can use
* the following code snippets;
* @code
* QVariant variant;
* variant.setValue<void*>(textShapeData->document());
* resourceManager->setResource(KoText::CurrentTextDocument, variant);
* // and get it out again.
* QVariant var = resourceManager->resource(KoText::CurrentTextDocument);
* document = static_cast<QTextDocument*>(var.value<void*>());
* @endcode
*/
class KRITAFLAKE_EXPORT KoDocumentResourceManager : public QObject
{
Q_OBJECT
public:
/**
* This enum holds identifiers to the resources that can be stored in here.
*/
enum DocumentResource {
UndoStack, ///< The document-wide undo stack (KUndo2Stack)
ImageCollection, ///< The KoImageCollection for the document
OdfDocument, ///< The document this canvas shows (KoDocumentBase)
HandleRadius, ///< The handle radius used for drawing handles of any kind
GrabSensitivity, ///< The grab sensitivity used for grabbing handles of any kind
MarkerCollection, ///< The collection holding all markers
ShapeController, ///< The KoShapeController for the document
KarbonStart = 1000, ///< Base number for Karbon specific values.
KexiStart = 2000, ///< Base number for Kexi specific values.
FlowStart = 3000, ///< Base number for Flow specific values.
PlanStart = 4000, ///< Base number for Plan specific values.
StageStart = 5000, ///< Base number for Stage specific values.
KritaStart = 6000, ///< Base number for Krita specific values.
SheetsStart = 7000, ///< Base number for Sheets specific values.
WordsStart = 8000, ///< Base number for Words specific values.
KoPageAppStart = 9000, ///< Base number for KoPageApp specific values.
KoTextStart = 10000 ///< Base number for KoText specific values.
};
/**
* Constructor.
* @param parent the parent QObject, used for memory management.
*/
explicit KoDocumentResourceManager(QObject *parent = 0);
- ~KoDocumentResourceManager();
+ ~KoDocumentResourceManager() override;
/**
* Set a resource of any type.
* @param key the integer key
* @param value the new value for the key.
* @see KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, const QVariant &value);
/**
* Set a resource of type KoColor.
* @param key the integer key
* @param color the new value for the key.
* @see KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, const KoColor &color);
/**
* Set a resource of type KoShape*.
* @param key the integer key
* @param id the new value for the key.
* @see KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, KoShape *shape);
/**
* Set a resource of type KoUnit
* @param key the integer key
* @param id the new value for the key.
* @see KoDocumentResourceManager::DocumentResource
*/
void setResource(int key, const KoUnit &unit);
/**
* Returns a qvariant containing the specified resource or a standard one if the
* specified resource does not exist.
* @param key the key
* @see KoDocumentResourceManager::DocumentResource
*/
QVariant resource(int key) const;
/**
* Return the resource determined by param key as a boolean.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
bool boolResource(int key) const;
/**
* Return the resource determined by param key as an integer.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
int intResource(int key) const;
/**
* Return the resource determined by param key as a KoColor.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
KoColor koColorResource(int key) const;
/**
* Return the resource determined by param key as a pointer to a KoShape.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
KoShape *koShapeResource(int key) const;
/**
* Return the resource determined by param key as a QString .
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
QString stringResource(int key) const;
/**
* Return the resource determined by param key as a QSizeF.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
QSizeF sizeResource(int key) const;
/**
* Return the resource determined by param key as a KoUnit.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
KoUnit unitResource(int key) const;
/**
* Returns true if there is a resource set with the requested key.
* @param key the indentifying key for the resource
* @see KoDocumentResourceManager::DocumentResource
*/
bool hasResource(int key) const;
/**
* Remove the resource with @p key from the provider.
* @param key the key that will be used to remove the resource
* There will be a signal emitted with a variable that will return true on QVariable::isNull();
* @see KoDocumentResourceManager::DocumentResource
*/
void clearResource(int key);
/**
* Tools that provide a handle for controlling the content that the tool can edit can
* use this property to alter the radius that a circular handle should have on screen.
* @param handleSize the radius in pixels.
*/
void setHandleRadius(int handleSize);
/// Returns the actual handle radius
int handleRadius() const;
/**
* Tools that are used to grab handles or similar with the mouse
* should use this value to determine if the mouse is near enough
* @param grabSensitivity the grab sensitivity in pixels
*/
void setGrabSensitivity(int grabSensitivity);
/// Returns the actual grab sensitivity
int grabSensitivity() const;
KUndo2Stack *undoStack() const;
void setUndoStack(KUndo2Stack *undoStack);
KoImageCollection *imageCollection() const;
void setImageCollection(KoImageCollection *ic);
KoDocumentBase *odfDocument() const;
void setOdfDocument(KoDocumentBase *currentDocument);
KoShapeController *shapeController() const;
void setShapeController(KoShapeController *shapeController);
Q_SIGNALS:
/**
* This signal is emitted every time a resource is set that is either
* new or different from the previous set value.
* @param key the indentifying key for the resource
* @param value the variants new value.
* @see KoDocumentResourceManager::DocumentResource
*/
void resourceChanged(int key, const QVariant &value);
private:
KoDocumentResourceManager(const KoDocumentResourceManager&);
KoDocumentResourceManager& operator=(const KoDocumentResourceManager&);
class Private;
Private *const d;
};
#endif
diff --git a/libs/flake/KoFilterEffectConfigWidgetBase.h b/libs/flake/KoFilterEffectConfigWidgetBase.h
index 06e9dbe413..fdf54ab134 100644
--- a/libs/flake/KoFilterEffectConfigWidgetBase.h
+++ b/libs/flake/KoFilterEffectConfigWidgetBase.h
@@ -1,44 +1,44 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOFILTEREFFECTCONFIGWIDGETBASE_H
#define KOFILTEREFFECTCONFIGWIDGETBASE_H
#include "kritaflake_export.h"
#include <QWidget>
class KoFilterEffect;
/// Base class for filter effects config widgets
class KRITAFLAKE_EXPORT KoFilterEffectConfigWidgetBase : public QWidget
{
Q_OBJECT
public:
explicit KoFilterEffectConfigWidgetBase(QWidget *parent = 0);
- virtual ~KoFilterEffectConfigWidgetBase() {};
+ ~KoFilterEffectConfigWidgetBase() override {};
/// Sets the filter effect to be edited by the config widget
virtual bool editFilterEffect(KoFilterEffect *filterEffect) = 0;
Q_SIGNALS:
/// Is emitted when the filter effect has changed
void filterChanged();
};
#endif // KOFILTEREFFECTCONFIGWIDGETBASE_H
diff --git a/libs/flake/KoFilterEffectRegistry.h b/libs/flake/KoFilterEffectRegistry.h
index c79213c745..cd1cbb3643 100644
--- a/libs/flake/KoFilterEffectRegistry.h
+++ b/libs/flake/KoFilterEffectRegistry.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOFILTEREFFECTREGISTRY_H
#define KOFILTEREFFECTREGISTRY_H
#include <KoGenericRegistry.h>
#include <KoFilterEffectFactoryBase.h>
#include "kritaflake_export.h"
class KoXmlElement;
class KoFilterEffectLoadingContext;
class KoFilterEffect;
class KRITAFLAKE_EXPORT KoFilterEffectRegistry : public KoGenericRegistry<KoFilterEffectFactoryBase*>
{
public:
KoFilterEffectRegistry();
- virtual ~KoFilterEffectRegistry();
+ ~KoFilterEffectRegistry() override;
/**
* Return the only instance of KoFilterEffectRegistry.
* Creates an instance on the first call.
*/
static KoFilterEffectRegistry *instance();
/**
* Creates filter effect from given xml element.
* @param element the xml element to load form
* @return the created filter effect if successful, otherwise returns 0
*/
KoFilterEffect *createFilterEffectFromXml(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
private:
KoFilterEffectRegistry(const KoFilterEffectRegistry&);
KoFilterEffectRegistry operator=(const KoFilterEffectRegistry&);
void init();
class Private;
Private * const d;
};
#endif // KOFILTEREFFECTREGISTRY_H
diff --git a/libs/flake/KoGradientBackground.h b/libs/flake/KoGradientBackground.h
index be0b3d3559..2add15f226 100644
--- a/libs/flake/KoGradientBackground.h
+++ b/libs/flake/KoGradientBackground.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOGRADIENTBACKGROUND_H
#define KOGRADIENTBACKGROUND_H
#include "KoShapeBackground.h"
#include "kritaflake_export.h"
#include <QTransform>
class QGradient;
class KoGradientBackgroundPrivate;
/// A gradient shape background
class KRITAFLAKE_EXPORT KoGradientBackground : public KoShapeBackground
{
public:
/**
* Creates new gradient background from given gradient.
* The background takes ownership of the given gradient.
*/
explicit KoGradientBackground(QGradient *gradient, const QTransform &matrix = QTransform());
/**
* Create new gradient background from the given gradient.
* A clone of the given gradient is used.
*/
explicit KoGradientBackground(const QGradient &gradient, const QTransform &matrix = QTransform());
/// Destroys the background
- virtual ~KoGradientBackground();
+ ~KoGradientBackground() override;
bool compareTo(const KoShapeBackground *other) const override;
/// Sets the transform matrix
void setTransform(const QTransform &matrix);
/// Returns the transform matrix
QTransform transform() const;
/**
* Sets a new gradient.
* A clone of the given gradient is used.
*/
void setGradient(const QGradient &gradient);
/// Returns the gradient
const QGradient *gradient() const;
/// reimplemented from KoShapeBackground
- virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const;
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const override;
/// reimplemented from KoShapeBackground
- virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context);
+ void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
/// reimplemented from KoShapeBackground
- virtual bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize);
+ bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) override;
private:
Q_DECLARE_PRIVATE(KoGradientBackground)
Q_DISABLE_COPY(KoGradientBackground)
};
#endif // KOGRADIENTBACKGROUND_H
diff --git a/libs/flake/KoHatchBackground.h b/libs/flake/KoHatchBackground.h
index 14eb186fdd..872616a488 100644
--- a/libs/flake/KoHatchBackground.h
+++ b/libs/flake/KoHatchBackground.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
*
* Copyright (C) 2012 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOHATCHBACKGROUND_H
#define KOHATCHBACKGROUND_H
#include "KoColorBackground.h"
class KoHatchBackgroundPrivate;
/**
* A hatch shape background
*/
class KoHatchBackground : public KoColorBackground
{
public:
enum HatchStyle {
Single,
Double,
Triple
};
KoHatchBackground();
// reimplemented
- virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const;
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const override;
// reimplemented
- virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context);
+ void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
// reimplemented
- virtual bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize);
+ bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) override;
private:
QString saveHatchStyle(KoShapeSavingContext &context) const;
Q_DECLARE_PRIVATE(KoHatchBackground)
Q_DISABLE_COPY(KoHatchBackground)
};
#endif /* KOHATCHBACKGROUND_H */
diff --git a/libs/flake/KoImageCollection.h b/libs/flake/KoImageCollection.h
index ec262cf4ac..d7666b7de3 100644
--- a/libs/flake/KoImageCollection.h
+++ b/libs/flake/KoImageCollection.h
@@ -1,114 +1,114 @@
/* This file is part of the KDE project
* Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOIMAGECOLLECTION_H
#define KOIMAGECOLLECTION_H
#include "kritaflake_export.h"
#include <QObject>
#include <KoDataCenterBase.h>
class QImage;
class QUrl;
class KoStore;
class KoImageData;
/**
* A collection of KoImageData objects to allow loading and saving them all together to the KoStore.
* It also makes sure that if the same image is added to the collection that they share the internal data structure.
*/
class KRITAFLAKE_EXPORT KoImageCollection : public QObject, public KoDataCenterBase
{
Q_OBJECT
public:
/// constructor
explicit KoImageCollection(QObject *parent = 0);
- virtual ~KoImageCollection();
+ ~KoImageCollection() override;
/// reimplemented
- bool completeLoading(KoStore *store);
+ bool completeLoading(KoStore *store) override;
/**
* Save all images to the store which are in the context
* @return returns true if save was successful (no images failed).
*/
- bool completeSaving(KoStore *store, KoXmlWriter *manifestWriter, KoShapeSavingContext *context);
+ bool completeSaving(KoStore *store, KoXmlWriter *manifestWriter, KoShapeSavingContext *context) override;
/**
* Create a data object for the image data.
* The collection will create an image data in a way that if there is an
* existing data object with the same image the returned KoImageData will
* share its data.
* @param image a valid image which will be represented by the imageData.
* @see KoImageData::isValid()
*/
KoImageData *createImageData(const QImage &image);
/**
* Create a data object for the image data.
* The collection will create an image data in a way that if there is an
* existing data object with the same image the returned KoImageData will
* share its data.
* @param href the name of the image inside the store.
* @param store the KoStore object.
* @see KoImageData::isValid()
*/
KoImageData *createImageData(const QString &href, KoStore *store);
/**
* Create a data object for the image data.
* The collection will create an image data in a way that if there is an
* existing data object with the same image the returned KoImageData will
* share its data.
* @param imageData the bytes that represent the image in a format like png.
* @see KoImageData::isValid()
*/
KoImageData *createImageData(const QByteArray &imageData);
void removeOnKey(qint64 imageDataKey);
bool fillFromKey(KoImageData &idata, qint64 imageDataKey);
/**
* Get the number of images inside the collection
*/
int size() const;
/**
* Get the number of images inside the collection
*/
int count() const;
/**
* Update the imagecollection: the imagedata object with the old
* key will now be associated with the new key.
*
* @param the key by which the object is known in the collection
* @param they new key by which the object should be known
*/
void update(qint64 oldKey, qint64 newKey);
private:
KoImageData *cacheImage(KoImageData *data);
class Private;
Private * const d;
};
#endif // KOIMAGECOLLECTION_H
diff --git a/libs/flake/KoImageData.h b/libs/flake/KoImageData.h
index 38190efa53..9369e7067a 100644
--- a/libs/flake/KoImageData.h
+++ b/libs/flake/KoImageData.h
@@ -1,141 +1,141 @@
/* This file is part of the KDE project
* Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOIMAGEDATA_H
#define KOIMAGEDATA_H
#include "kritaflake_export.h"
#include <QSize>
#include <QMetaType>
#include <KoShapeUserData.h>
class QIODevice;
class QPixmap;
class QImage;
class QSizeF;
class QUrl;
class KoImageCollection;
class KoImageDataPrivate;
class KoStore;
/**
* This class is meant to represent the image data so it can be shared between image shapes.
*
* This class inherits from KoShapeUserData which means you can set it on any KoShape using
* KoShape::setUserData() and get it using KoShape::userData(). The pictureshape plugin
* uses this class to show its image data.
*
* Plugins should not make a copy of the pixmap data, but use the pixmap() method, which
* handles caching.
*/
class KRITAFLAKE_EXPORT KoImageData : public KoShapeUserData
{
Q_OBJECT
public:
/// Various error codes representing what has gone wrong
enum ErrorCode {
Success,
OpenFailed,
StorageFailed, ///< This is set if the image data has to be stored on disk in a temporary file, but we failed to do so
LoadFailed
};
/// default constructor, creates an invalid imageData object
KoImageData();
- virtual ~KoImageData();
+ ~KoImageData() override;
KoImageData(const KoImageData &imageData);
KoImageData &operator=(const KoImageData &other);
inline bool operator!=(const KoImageData &other) const { return !operator==(other); }
bool operator==(const KoImageData &other) const;
KoShapeUserData* clone() const override;
void setImage(const QString &location, KoStore *store, KoImageCollection *collection = 0);
/**
* Renders a pixmap the first time you request it is called and returns it.
* @returns the cached pixmap
* @see isValid(), hasCachedPixmap()
*/
QPixmap pixmap(const QSize &targetSize = QSize());
/**
* Return the internal store of the image.
* @see isValid(), hasCachedImage()
*/
QImage image() const;
/**
* The size of the image in points
*/
QSizeF imageSize();
/**
* Save the image data to the param device.
* The full file is saved.
* @param device the device that is used to get the data from.
* @return returns true if load was successful.
*/
bool saveData(QIODevice &device);
/**
* Get a unique key of the image data
*/
qint64 key() const;
/// @return the original image file's extension, e.g. "png" or "gif"
QString suffix() const;
ErrorCode errorCode() const;
/// returns if this is a valid imageData with actual image data present on it.
bool isValid() const;
/// \internal
KoImageDataPrivate *priv() { return d; }
private:
friend class KoImageCollection;
friend class TestImageCollection;
KoImageData(KoImageDataPrivate *priv);
/// returns true only if pixmap() would return immediately with a cached pixmap
bool hasCachedPixmap() const;
/// returns true only if image() would return immediately with a cached image
bool hasCachedImage() const;
void setImage(const QImage &image, KoImageCollection *collection = 0);
void setImage(const QByteArray &imageData, KoImageCollection *collection = 0);
private:
KoImageDataPrivate *d;
Q_PRIVATE_SLOT(d, void cleanupImageCache())
};
Q_DECLARE_METATYPE(KoImageData*)
#endif
diff --git a/libs/flake/KoInputDeviceHandler.h b/libs/flake/KoInputDeviceHandler.h
index 9d4d40d345..8df7e53fa0 100644
--- a/libs/flake/KoInputDeviceHandler.h
+++ b/libs/flake/KoInputDeviceHandler.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (c) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINPUTDEVICEHANDLER_H
#define KOINPUTDEVICEHANDLER_H
#include "kritaflake_export.h"
#include <QObject>
/**
* Base class for all custom input devices.
*/
class KRITAFLAKE_EXPORT KoInputDeviceHandler : public QObject
{
Q_OBJECT
public:
KoInputDeviceHandler(QObject *parent, const QString &id);
- virtual ~KoInputDeviceHandler();
+ ~KoInputDeviceHandler() override;
/**
* Return the id for the device.
* @return the id for the device
*/
QString id() const;
/**
* Starts the device.
* @return true if the device was started, false otherwise
*/
virtual bool start() = 0;
/**
* Stops the device.
* @return true if the device was stopped, false otherwise
*/
virtual bool stop() = 0;
private:
class Private;
Private * const d;
};
#endif // KOINPUTDEVICEHANDLER_H
diff --git a/libs/flake/KoInputDeviceHandlerEvent.h b/libs/flake/KoInputDeviceHandlerEvent.h
index 679c71beed..b8adff468b 100644
--- a/libs/flake/KoInputDeviceHandlerEvent.h
+++ b/libs/flake/KoInputDeviceHandlerEvent.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE project
* Copyright (c) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINPUTDEVICEHANDLEREVENT_H
#define KOINPUTDEVICEHANDLEREVENT_H
#include "kritaflake_export.h"
#include <QInputEvent>
class KoPointerEvent;
/**
* Base class for events from custom input devices.
*/
class KRITAFLAKE_EXPORT KoInputDeviceHandlerEvent : public QInputEvent
{
public:
enum Type {
ButtonPressed = QEvent::User + 2008, ///< a button was pressed
ButtonReleased, ///< a button was released
PositionChanged ///< the position has changed
};
/// Constructs a new device event of the given type
explicit KoInputDeviceHandlerEvent(Type type);
- virtual ~KoInputDeviceHandlerEvent();
+ ~KoInputDeviceHandlerEvent() override;
/// Creates and returns a KoPointerEvent for tools to consume
virtual KoPointerEvent * pointerEvent() = 0;
/// The device button which caused the event, Qt::NoButton if it is a move event
Qt::MouseButton button() const;
/// The device button state when the event was generated
Qt::MouseButtons buttons() const;
/// Sets the device button causing the event
void setButton(Qt::MouseButton);
/// Sets the device button state
void setButtons(Qt::MouseButtons);
protected:
KoPointerEvent *m_event;
private:
class Private;
Private * const d;
};
#endif // KOINPUTDEVICEHANDLEREVENT_H
diff --git a/libs/flake/KoInputDeviceHandlerRegistry.h b/libs/flake/KoInputDeviceHandlerRegistry.h
index 7900fa5dbd..79c2024107 100644
--- a/libs/flake/KoInputDeviceHandlerRegistry.h
+++ b/libs/flake/KoInputDeviceHandlerRegistry.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (c) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINPUTDEVICEHANDLERREGISTRY_H
#define KOINPUTDEVICEHANDLERREGISTRY_H
#include "KoGenericRegistry.h"
#include <KoInputDeviceHandler.h>
#include "kritaflake_export.h"
/**
* This singleton class keeps a register of all custom input devices
* for instance the 3D Space Navigator which generate input events.
* These will get routed the active tools which can then do whatever
* they like with it.
*/
class KRITAFLAKE_EXPORT KoInputDeviceHandlerRegistry : public KoGenericRegistry<KoInputDeviceHandler*>
{
public:
KoInputDeviceHandlerRegistry();
- ~KoInputDeviceHandlerRegistry();
+ ~KoInputDeviceHandlerRegistry() override;
/**
* Return an instance of the KoInputDeviceHandlerRegistry
* Create a new instance on first call and return the singleton.
*/
static KoInputDeviceHandlerRegistry *instance();
private:
KoInputDeviceHandlerRegistry(const KoInputDeviceHandlerRegistry&);
KoInputDeviceHandlerRegistry operator=(const KoInputDeviceHandlerRegistry&);
void init();
class Private;
Private *d;
};
#endif // KOINPUTDEVICEHANDLERREGISTRY_H
diff --git a/libs/flake/KoMarkerCollection.h b/libs/flake/KoMarkerCollection.h
index 56a280da9f..bd74001047 100644
--- a/libs/flake/KoMarkerCollection.h
+++ b/libs/flake/KoMarkerCollection.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOMARKERCOLLECTION_H
#define KOMARKERCOLLECTION_H
#include "kritaflake_export.h"
#include <QObject>
#include <QList>
#include <QHash>
#include <QMetaType>
class KoMarker;
class KoXmlElement;
class KoShapeLoadingContext;
class KRITAFLAKE_EXPORT KoMarkerCollection : public QObject
{
Q_OBJECT
public:
explicit KoMarkerCollection(QObject *parent = 0);
- virtual ~KoMarkerCollection();
+ ~KoMarkerCollection() override;
QList<KoMarker*> markers() const;
/**
* Add marker to collection
*
* The collection checks if a marker with the same content exists and if so deletes the
* passed marker and returns a pointer to an existing marker. If no such marker exists it
* adds the marker and return the same pointer as passed.
* Calling that function passes ownership of the marker to this class.
*
* @param marker Marker to add
* @return pointer to marker that should be used. This might be different to the marker passed
*/
KoMarker * addMarker(KoMarker *marker);
void loadMarkersFromFile(const QString &svgFile);
private:
/// load the markers that are available per default.
void loadDefaultMarkers();
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoMarkerCollection *)
#endif /* KOMARKERCOLLECTION_H */
diff --git a/libs/flake/KoOdfGradientBackground.h b/libs/flake/KoOdfGradientBackground.h
index 2170ef2aac..5b097f69db 100644
--- a/libs/flake/KoOdfGradientBackground.h
+++ b/libs/flake/KoOdfGradientBackground.h
@@ -1,66 +1,66 @@
/* This file is part of the KDE project
*
* Copyright (C) 2011 Lukáš Tvrdý <lukas.tvrdy@ixonos.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOODFGRADIENTBACKGROUND_H
#define KOODFGRADIENTBACKGROUND_H
#include "KoShapeBackground.h"
#include "kritaflake_export.h"
class QImage;
class KoOdfGradientBackgroundPrivate;
class KoXmlElement;
class KoGenStyles;
class KoGenStyle;
/// Gradients from odf that are not native to Qt
class KoOdfGradientBackground : public KoShapeBackground {
public:
// constructor
KoOdfGradientBackground();
// destructor
- virtual ~KoOdfGradientBackground();
+ ~KoOdfGradientBackground() override;
bool compareTo(const KoShapeBackground *other) const override;
/// reimplemented from KoShapeBackground
- virtual void fillStyle(KoGenStyle& style, KoShapeSavingContext& context);
+ void fillStyle(KoGenStyle& style, KoShapeSavingContext& context) override;
/// reimplemented from KoShapeBackground
- virtual bool loadStyle(KoOdfLoadingContext& context, const QSizeF& shapeSize);
+ bool loadStyle(KoOdfLoadingContext& context, const QSizeF& shapeSize) override;
/// reimplemented from KoShapeBackground
- virtual void paint(QPainter& painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath& fillPath) const;
+ void paint(QPainter& painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath& fillPath) const override;
private:
bool loadOdf(const KoXmlElement &element);
void saveOdf(KoGenStyle& styleFill, KoGenStyles& mainStyles) const;
void renderSquareGradient(QImage &buffer) const;
void renderRectangleGradient(QImage &buffer) const;
private:
void debug() const;
private:
Q_DECLARE_PRIVATE(KoOdfGradientBackground)
Q_DISABLE_COPY(KoOdfGradientBackground)
};
#endif
diff --git a/libs/flake/KoParameterShape.h b/libs/flake/KoParameterShape.h
index 05ce7ce9a1..ec308f1b81 100644
--- a/libs/flake/KoParameterShape.h
+++ b/libs/flake/KoParameterShape.h
@@ -1,165 +1,165 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPARAMETERSHAPE_H
#define KOPARAMETERSHAPE_H
#include "KoPathShape.h"
#include "kritaflake_export.h"
class KoParameterShapePrivate;
class KisHandlePainterHelper;
/**
* KoParameterShape is the base class for all parametric shapes
* in flake.
* Parametric shapes are those whose appearance can be completely
* defined by a few numerical parameters. Rectangle, ellipse and star
* are examples of parametric shapes.
* In flake, these shape parameters can be manipulated visually by means
* of control points. These control points can be moved with the mouse
* on the canvas which changes the shapes parameter values and hence the
* shapes appearance in realtime.
* KoParameterShape is derived from the KoPathShape class that means
* by changing the shape parameters, the underlying path is manipulated.
* A parametric shape can be converted into a path shape by simply calling
* the setModified method. This makes the path tool know that it can handle
* the shape like a path shape, so that modifying the single path points
* is possible.
*/
class KRITAFLAKE_EXPORT KoParameterShape : public KoPathShape
{
public:
KoParameterShape();
- virtual ~KoParameterShape();
+ ~KoParameterShape() override;
/**
* @brief Move handle to point
*
* This method calls moveHandleAction. Overload moveHandleAction to get the behaviour you want.
* After that updatePath and a repaint is called.
*
* @param handleId the id of the handle to move
* @param point the point to move the handle to in document coordinates
* @param modifiers the keyboard modifiers used during moving the handle
*/
void moveHandle(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
/**
* @brief Get the id of the handle within the given rect
*
* @param rect the rect in shape coordinates
* @return id of the found handle or -1 if none was found
*/
int handleIdAt(const QRectF &rect) const;
/**
* @brief Get the handle position
*
* @param handleId the id of the handle for which to get the position in shape coordinates
*/
QPointF handlePosition(int handleId) const;
/**
* @brief Paint the handles
*
* @param painter the painter to paint the handles on
* @param converter the view converter for applying the actual zoom
* @param handleRadius the radius of the handles used for painting
*/
void paintHandles(KisHandlePainterHelper &handlesHelper);
/**
* @brief Paint the given handles
*
* @param painter the painter to paint the handles on
* @param converter the view converter for applying the actual zoom
* @param handleId of the handle which should be repainted
* @param handleRadius the radius of the handle used for painting
*/
void paintHandle(KisHandlePainterHelper &handlesHelper, int handleId);
/// reimplemented from KoShape
- virtual void setSize(const QSizeF &size);
+ void setSize(const QSizeF &size) override;
/**
* @brief Check if object is a parametric shape
*
* It is no longer a parametric shape when the path was manipulated
*
* @return true if it is a parametic shape, false otherwise
*/
bool isParametricShape() const;
/**
* @brief Set if the shape can be modified using parameters
*
* After the state is set to false it is no longer possible to work
* with parameters on this shape.
*
* @param parametric the new state
* @see isParametricShape
*/
void setParametricShape(bool parametric);
- virtual QPointF normalize();
+ QPointF normalize() override;
/// return the number of handles set on the shape
int handleCount() const;
protected:
/**
* Get the handle positions for manipulating the parameters.
* @see setHandles, handleCount()
*/
QList<QPointF> handles() const;
/**
* Set the new handle positions which are used by the user to manipulate the parameters.
* @see handles(), handleCount()
*/
void setHandles(const QList<QPointF> &handles);
/// constructor
KoParameterShape(KoParameterShapePrivate *);
/**
* @brief Updates the internal state of a KoParameterShape.
*
* This method is called from moveHandle.
*
* @param handleId of the handle
* @param point to move the handle to in shape coordinates
* @param modifiers used during move to point
*/
virtual void moveHandleAction(int handleId, const QPointF & point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) = 0;
/**
* @brief Update the path of the parameter shape
*
* @param size of the shape
*/
virtual void updatePath(const QSizeF &size) = 0;
protected:
Q_DECLARE_PRIVATE(KoParameterShape)
};
#endif /* KOPARAMETERSHAPE_H */
diff --git a/libs/flake/KoPathShape.h b/libs/flake/KoPathShape.h
index 089f535b74..40b500a801 100644
--- a/libs/flake/KoPathShape.h
+++ b/libs/flake/KoPathShape.h
@@ -1,510 +1,510 @@
/* This file is part of the KDE project
Copyright (C) 2006, 2011 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007,2009 Thomas Zander <zander@kde.org>
Copyright (C) 2006-2008 Jan Hambrecht <jaham@gmx.net>
Copyright (C) 2011 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHSHAPE_H
#define KOPATHSHAPE_H
#include "kritaflake_export.h"
#include <QMetaType>
#include <QTransform>
#include "KoTosContainer.h"
#define KoPathShapeId "KoPathShape"
class KoPathSegment;
class KoPathPoint;
class KoPathShapePrivate;
class KoMarker;
class KisHandlePainterHelper;
typedef QPair<int, int> KoPathPointIndex;
/// a KoSubpath contains a path from a moveTo until a close or a new moveTo
typedef QList<KoPathPoint *> KoSubpath;
typedef QList<KoSubpath *> KoSubpathList;
/// The position of a path point within a path shape
/**
* @brief This is the base for all graphical objects.
*
* All graphical objects are based on this object e.g. lines, rectangulars, pies
* and so on.
*
* The KoPathShape uses KoPathPoint's to describe the path of the shape.
*
* Here a short example:
* 3 points connected by a curveTo's described by the following svg:
* M 100,200 C 100,100 250,100 250,200 C 250,200 400,300 400,200.
*
* This will be stored in 3 KoPathPoint's as
* The first point contains in
* point 100,200
* controlPoint2 100,100
* The second point contains in
* point 250,200
* controlPoint1 250,100
* controlPoint2 250,300
* The third point contains in
* point 400,300
* controlPoint1 400,200
*
* Not the segments are stored but the points. Out of the points the segments are
* generated. See the outline method. The reason for storing it like that is that
* it is the points that are modified by the user and not the segments.
*/
class KRITAFLAKE_EXPORT KoPathShape : public KoTosContainer
{
public:
/**
* @brief constructor
*/
KoPathShape();
/**
* @brief
*/
- virtual ~KoPathShape();
+ ~KoPathShape() override;
- KoShape *cloneShape() const;
+ KoShape *cloneShape() const override;
/// reimplemented
- virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
virtual void paintPoints(KisHandlePainterHelper &handlesHelper);
/// reimplemented
QRectF outlineRect() const override;
/// reimplemented
QPainterPath outline() const override;
/// reimplemented
QRectF boundingRect() const override;
/// reimplemented
QSizeF size() const override;
QPainterPath pathStroke(const QPen &pen) const;
/**
* Resize the shape
*
* This makes sure that the pathshape will not be resized to 0 if the new size
* is null as that makes it impossible to undo the change.
*
* All functions that overwrite this function should also use the resizeMatrix
* function to get and use the same data in resizing.
*
* @see resizeMatrix()
*/
- virtual void setSize(const QSizeF &size);
+ void setSize(const QSizeF &size) override;
/// reimplemented
- virtual bool hitTest(const QPointF &position) const;
+ bool hitTest(const QPointF &position) const override;
// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
// basically the same as loadOdf but adapted to the contour cases
// tag needs to be either contour-polygon or contour-path from another shape
bool loadContourOdf(const KoXmlElement & element, KoShapeLoadingContext &context, const QSizeF &scaleFactor);
/** basically the equivalent saveOdf but adapted to the contour cases
* @param originalSize the original size of the unscaled image.
*/
void saveContourOdf(KoShapeSavingContext &context, const QSizeF &originalSize) const;
/// Removes all subpaths and their points from the path
void clear();
/**
* @brief Starts a new Subpath
*
* Moves the pen to p and starts a new subpath.
*
* @return the newly created point
*/
KoPathPoint *moveTo(const QPointF &p);
/**
* @brief Adds a new line segment
*
* Adds a straight line between the last point and the given point p.
*
* @return the newly created point
*/
KoPathPoint *lineTo(const QPointF &p);
/**
* @brief Adds a new cubic Bezier curve segment.
*
* Adds a cubic Bezier curve between the last point and the given point p,
* using the control points specified by c1 and c2.
*
* @param c1 control point1
* @param c2 control point2
* @param p the endpoint of this curve segment
*
* @return The newly created point
*/
KoPathPoint *curveTo(const QPointF &c1, const QPointF &c2, const QPointF &p);
/**
* @brief Adds a new quadratic Bezier curve segment.
*
* Adds a quadratic Bezier curve between the last point and the given point p,
* using the control point specified by c.
*
* @param c control point
* @param p the endpoint of this curve segment
*
* @return The newly created point
*/
KoPathPoint *curveTo(const QPointF &c, const QPointF &p);
/**
* @brief Add an arc.
*
* Adds an arc starting at the current point. The arc will be converted to bezier curves.
*
* @param rx x radius of the ellipse
* @param ry y radius of the ellipse
* @param startAngle the angle where the arc will be started
* @param sweepAngle the length of the angle
* TODO add param to have angle of the ellipse
*
* @return The newly created point
*/
KoPathPoint *arcTo(qreal rx, qreal ry, qreal startAngle, qreal sweepAngle);
/**
* @brief Closes the current subpath
*/
void close();
/**
* @brief Closes the current subpath
*
* It tries to merge the last and first point of the subpath
* to one point and then closes the subpath. If merging is not
* possible as the two point are to far from each other a close
* will be done.
* TODO define a maximum distance between the two points until this is working
*/
void closeMerge();
/**
* @brief Normalizes the path data.
*
* The path points are transformed so that the top-left corner
* of the bounding rect is at (0,0).
* This should be called after adding points to the path or changing
* positions of path points.
* @return the offset by which the points are moved in shape coordinates.
*/
virtual QPointF normalize();
/**
* @brief Returns the path points within the given rectangle.
* @param rect the rectangle the requested points are in
* @return list of points within the rectangle
*/
QList<KoPathPoint*> pointsAt(const QRectF &rect) const;
/**
* @brief Returns the list of path segments within the given rectangle.
* @param rect the rectangle the requested segments are in
* @return list of segments within the rectangle
*/
QList<KoPathSegment> segmentsAt(const QRectF &rect) const;
/**
* @brief Returns the path point index of a given path point
*
* @param point the point for which you want to get the index
* @return path point index of the point if it exists
* otherwise KoPathPointIndex( -1, -1 )
*/
KoPathPointIndex pathPointIndex(const KoPathPoint *point) const;
/**
* @brief Returns the path point specified by a path point index
*
* @param pointIndex index of the point to get
*
* @return KoPathPoint on success, 0 otherwise e.g. out of bounds
*/
KoPathPoint *pointByIndex(const KoPathPointIndex &pointIndex) const;
/**
* @brief Returns the segment specified by a path point index
*
* A semgent is defined by the point index of the first point in the segment.
* A segment contains the defined point and its following point. If the subpath is
* closed and the and the pointIndex point to the last point in the subpath, the
* following point is the first point in the subpath.
*
* @param pointIndex index of the first point of the segment
*
* @return Segment containing both points of the segment or KoPathSegment( 0, 0 ) on error e.g. out of bounds
*/
KoPathSegment segmentByIndex(const KoPathPointIndex &pointIndex) const;
/**
* @brief Returns the number of points in the path
*
* @return The number of points in the path
*/
int pointCount() const;
/**
* @brief Returns the number of subpaths in the path
*
* @return The number of subpaths in the path
*/
int subpathCount() const;
/**
* @brief Returns the number of points in a subpath
*
* @return The number of points in the subpath or -1 if subpath out of bounds
*/
int subpathPointCount(int subpathIndex) const;
/**
* @brief Checks if a subpath is closed
*
* @param subpathIndex index of the subpath to check
*
* @return true when the subpath is closed, false otherwise
*/
bool isClosedSubpath(int subpathIndex) const;
/**
* @brief Inserts a new point into the given subpath at the specified position
*
* This method keeps the subpath closed if it is closed, and open when it was
* open. So it can change the properties of the point inserted.
* You might need to update the point before/after to get the desired result
* e.g. when you insert the point into a curve.
*
* @param point to insert
* @param pointIndex index at which the point should be inserted
*
* @return true on success,
* false when pointIndex is out of bounds
*/
bool insertPoint(KoPathPoint *point, const KoPathPointIndex &pointIndex);
/**
* @brief Removes a point from the path.
*
* Note that the ownership of the point will pass to the caller.
*
* @param pointIndex index of the point which should be removed
*
* @return The removed point on success,
* otherwise 0
*/
KoPathPoint *removePoint(const KoPathPointIndex &pointIndex);
/**
* @brief Breaks the path after the point index
*
* The new subpath will be behind the one that was broken. The segment between
* the given point and the one behind will be removed. If you want to split at
* one point insert first a copy of the point behind it.
* This does not work when the subpath is closed. Use openSubpath for this.
* It does not break at the last position of a subpath or if there is only one
* point in the subpath.
*
* @param pointIndex index of the point after which the path should be broken
*
* @return true if the subpath was broken, otherwise false
*/
bool breakAfter(const KoPathPointIndex &pointIndex);
/**
* @brief Joins the given subpath with the following one
*
* Joins the given subpath with the following one by inserting a segment between
* the two subpaths.
* This does nothing if the specified subpath is the last subpath
* or one of both subpaths is closed.
*
* @param subpathIndex index of the subpath being joined with the following subpath
*
* @return true if the subpath was joined, otherwise false
*/
bool join(int subpathIndex);
/**
* @brief Moves the position of a subpath within a path
*
* @param oldSubpathIndex old index of the subpath
* @param newSubpathIndex new index of the subpath
*
* @return true if the subpath was moved, otherwise false e.g. if an index is out of bounds
*/
bool moveSubpath(int oldSubpathIndex, int newSubpathIndex);
/**
* @brief Opens a closed subpath
*
* The subpath is opened by removing the segment before the given point, making
* the given point the new start point of the subpath.
*
* @param pointIndex the index of the point at which to open the closed subpath
* @return the new position of the old first point in the subpath
* otherwise KoPathPointIndex( -1, -1 )
*/
KoPathPointIndex openSubpath(const KoPathPointIndex &pointIndex);
/**
* @brief Close a open subpath
*
* The subpath is closed be inserting a segment between the start and end point, making
* the given point the new start point of the subpath.
*
* @return the new position of the old first point in the subpath
* otherwise KoPathPointIndex( -1, -1 )
*/
KoPathPointIndex closeSubpath(const KoPathPointIndex &pointIndex);
/**
* @brief Reverse subpath
*
* The last point becomes the first point and the first one becomes the last one.
*
* @param subpathIndex the index of the subpath to reverse
*/
bool reverseSubpath(int subpathIndex);
/**
* @brief Removes subpath from the path
* @param subpathIndex the index of the subpath to remove
* @return the removed subpath on succes, 0 otherwise.
*/
KoSubpath *removeSubpath(int subpathIndex);
/**
* @brief Adds a subpath at the given index to the path
* @param subpath the subpath to add
* @param subpathIndex the index at which the new subpath should be inserted
* @return true on success, false otherwise e.g. subpathIndex out of bounds
*/
bool addSubpath(KoSubpath *subpath, int subpathIndex);
/**
* @brief Combines two path shapes by appending the data of the specified path.
* @param path the path to combine with
* @return index of the first segment inserted or -1 on failure
*/
int combine(KoPathShape *path);
/**
* @brief Creates separate path shapes, one for each existing subpath.
* @param separatedPaths the list which contains the separated path shapes
* @return true if separating the path was successful, false otherwise
*/
bool separate(QList<KoPathShape*> &separatedPaths);
/**
* Returns the specific path shape id.
*
* Path shape derived shapes have a different shape id which link them
* to their respective shape factories. In most cases they do not have
* a special tool for editing them.
* This function returns the specific shape id for finding the shape
* factory from KoShapeRegistry. The default KoPathShapeId is returned
* from KoShape::shapeId() so that the generic path editing tool gets
* activated when the shape is selected.
*
* @return the specific shape id
*/
virtual QString pathShapeId() const;
/// Returns a odf/svg string represenatation of the path data with the given matrix applied.
QString toString(const QTransform &matrix = QTransform()) const;
/// Returns the fill rule for the path object
Qt::FillRule fillRule() const;
/// Sets the fill rule to be used for painting the background
void setFillRule(Qt::FillRule fillRule);
/// Creates path shape from given QPainterPath
static KoPathShape *createShapeFromPainterPath(const QPainterPath &path);
/// Returns the viewbox from the given xml element.
static QRect loadOdfViewbox(const KoXmlElement &element);
void setMarker(KoMarker *marker, KoFlake::MarkerPosition pos);
KoMarker* marker(KoFlake::MarkerPosition pos) const;
bool hasMarkers() const;
bool autoFillMarkers() const;
void setAutoFillMarkers(bool value);
private:
/// constructor: to be used in cloneShape(), not in descendants!
/// \internal
KoPathShape(const KoPathShape &rhs);
protected:
/// constructor:to be used in descendant shapes
/// \internal
KoPathShape(KoPathShapePrivate *);
/// reimplemented
- virtual QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
+ QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const override;
/// reimplemented
- virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context);
+ void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/**
* @brief Add an arc.
*
* Adds an arc starting at the current point. The arc will be converted to bezier curves.
* @param rx x radius of the ellipse
* @param ry y radius of the ellipse
* @param startAngle the angle where the arc will be started
* @param sweepAngle the length of the angle
* TODO add param to have angle of the ellipse
* @param offset to the first point in the arc
* @param curvePoints a array which take the cuve points, pass a 'QPointF curvePoins[12]';
*
* @return number of points created by the curve
*/
int arcToCurve(qreal rx, qreal ry, qreal startAngle, qreal sweepAngle, const QPointF &offset, QPointF *curvePoints) const;
/**
* Get the resize matrix
*
* This makes sure that also if the newSize isNull that there will be a
* very small size of 0.000001 pixels
*/
QTransform resizeMatrix( const QSizeF &newSize ) const;
private:
Q_DECLARE_PRIVATE(KoPathShape)
};
Q_DECLARE_METATYPE(KoPathShape*)
#endif /* KOPATHSHAPE_H */
diff --git a/libs/flake/KoPathShapeFactory.h b/libs/flake/KoPathShapeFactory.h
index 5baa04b1a7..770a6ebcb6 100644
--- a/libs/flake/KoPathShapeFactory.h
+++ b/libs/flake/KoPathShapeFactory.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
Copyright (C) 2006 Rob Buis <buis@kde.org>
Copyright (C) 2006 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHSHAPEFACTORY_H
#define KOPATHSHAPEFACTORY_H
#include "KoShapeFactoryBase.h"
#include "KoXmlReader.h"
class KoShape;
/// Factory for path shapes.
class KRITAFLAKE_EXPORT KoPathShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
KoPathShapeFactory(const QStringList&);
- ~KoPathShapeFactory() {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- bool supports(const KoXmlElement &element, KoShapeLoadingContext &context) const;
+ ~KoPathShapeFactory() override {}
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &element, KoShapeLoadingContext &context) const override;
/// reimplemented
- virtual void newDocumentResourceManager(KoDocumentResourceManager *manager) const;
+ void newDocumentResourceManager(KoDocumentResourceManager *manager) const override;
};
#endif
diff --git a/libs/flake/KoPatternBackground.h b/libs/flake/KoPatternBackground.h
index 9a7bf6f765..b442843bd4 100644
--- a/libs/flake/KoPatternBackground.h
+++ b/libs/flake/KoPatternBackground.h
@@ -1,128 +1,128 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATTERNBACKGROUND_H
#define KOPATTERNBACKGROUND_H
#include "KoShapeBackground.h"
#include "kritaflake_export.h"
class KoImageCollection;
class KoOdfLoadingContext;
class KoPatternBackgroundPrivate;
class KoImageData;
class QTransform;
class QImage;
class QPointF;
class QRectF;
/// A pattern shape background
class KRITAFLAKE_EXPORT KoPatternBackground : public KoShapeBackground
{
public:
/// Pattern rendering style
enum PatternRepeat {
Original,
Tiled,
Stretched
};
/// Pattern reference point
enum ReferencePoint {
TopLeft,
Top,
TopRight,
Left,
Center,
Right,
BottomLeft,
Bottom,
BottomRight
};
/// Constructs a new pattern background utilizing the given image collection
explicit KoPatternBackground(KoImageCollection *collection);
- virtual ~KoPatternBackground();
+ ~KoPatternBackground() override;
bool compareTo(const KoShapeBackground *other) const override;
/// Sets the transform matrix
void setTransform(const QTransform &matrix);
/// Returns the transform matrix
QTransform transform() const;
/// Sets a new pattern
void setPattern(const QImage &pattern);
/// Sets a new pattern. imageData memory is deleted inside this class
void setPattern(KoImageData *imageData);
/// Returns the pattern
QImage pattern() const;
/// Sets the pattern repeatgfl
void setRepeat(PatternRepeat repeat);
/// Returns the pattern repeat
PatternRepeat repeat() const;
/// Returns the pattern reference point identifier
ReferencePoint referencePoint() const;
/// Sets the pattern reference point
void setReferencePoint(ReferencePoint referencePoint);
/// Returns reference point offset in percent of the pattern display size
QPointF referencePointOffset() const;
/// Sets the reference point offset in percent of the pattern display size
void setReferencePointOffset(const QPointF &offset);
/// Returns tile repeat offset in percent of the pattern display size
QPointF tileRepeatOffset() const;
/// Sets the tile repeat offset in percent of the pattern display size
void setTileRepeatOffset(const QPointF &offset);
/// Returns the pattern display size
QSizeF patternDisplaySize() const;
/// Sets pattern display size
void setPatternDisplaySize(const QSizeF &size);
/// Returns the original image size
QSizeF patternOriginalSize() const;
/// reimplemented from KoShapeBackground
- virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const;
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const override;
/// reimplemented from KoShapeBackground
- virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context);
+ void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
/// reimplemented from KoShapeBackground
- virtual bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize);
+ bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) override;
/// Returns the bounding rect of the pattern image based on the given fill size
QRectF patternRectFromFillSize(const QSizeF &size);
private:
Q_DECLARE_PRIVATE(KoPatternBackground)
Q_DISABLE_COPY(KoPatternBackground)
};
#endif // KOPATTERNBACKGROUND_H
diff --git a/libs/flake/KoPostscriptPaintDevice.h b/libs/flake/KoPostscriptPaintDevice.h
index fc749c154f..1980dbf055 100644
--- a/libs/flake/KoPostscriptPaintDevice.h
+++ b/libs/flake/KoPostscriptPaintDevice.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPOSTSCRIPTPAINTDEVICE_H
#define KOPOSTSCRIPTPAINTDEVICE_H
#include <QPaintDevice>
#include "kritaflake_export.h"
/**
* Helper class to disable any screen conversion as that is done in flake.
*
* Flake has the property that all content is always defined in pts. And only when it
* is displayed is it converted to the proper zoom and resolution.
*
* This is in contradiction to the normal behavior of Qt fonts which automatically
* applies DPI on creation. So this is where this special paint device comes in.
*
* Usage;
*
* For all QFont() and QFontMetrics constructors add an instance of this PaintDevice
* to the constructor if those fonts are to be used for painting in a KoShape inheriting
* class.
*
* Note: never try to actually paint on this paint device, since that will noisily crash.
*/
class KRITAFLAKE_EXPORT KoPostscriptPaintDevice : public QPaintDevice
{
public:
/// constructor
KoPostscriptPaintDevice();
/// reimplemented from QPaintDevice
- QPaintEngine *paintEngine() const;
+ QPaintEngine *paintEngine() const override;
/// reimplemented from QPaintDevice
- int metric(QPaintDevice::PaintDeviceMetric metric) const;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
};
#endif
diff --git a/libs/flake/KoRTree.h b/libs/flake/KoRTree.h
index 8524e26a47..c7e2e741b6 100644
--- a/libs/flake/KoRTree.h
+++ b/libs/flake/KoRTree.h
@@ -1,1165 +1,1165 @@
/* This file is part of the KDE project
Copyright (c) 2006 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
Based on code from Wolfgang Baer - WBaer@gmx.de
*/
#ifndef KORTREE_H
#define KORTREE_H
#include <QPair>
#include <QMap>
#include <QList>
#include <QVector>
#include <QPointF>
#include <QRectF>
#include <QVarLengthArray>
#include <QDebug>
#include "kis_assert.h"
// #define CALLIGRA_RTREE_DEBUG
#ifdef CALLIGRA_RTREE_DEBUG
#include <QPainter>
#endif
/**
* @brief The KoRTree class is a template class that provides a R-tree.
*
* This class implements a R-tree as described in
* "R-TREES. A DYNAMIC INDEX STRUCTURE FOR SPATIAL SEARCHING" by Antomn Guttman
*
* It only supports 2 dimensional bounding boxes which are repesented by a QRectF.
* For node splitting the Quadratic-Cost Algorithm is used as descibed by Guttman.
*/
template <typename T>
class KoRTree
{
public:
/**
* @brief Constructor
*
* @param capacity the capacity a node can take
* @param minimum the minimum filling of a node max 0.5 * capacity
*/
KoRTree(int capacity, int minimum);
/**
* @brief Destructor
*/
virtual ~KoRTree();
/**
* @brief Insert data item into the tree
*
* This will insert a data item into the tree. If necessary the tree will
* adjust itself.
*
* @param data
* @param bb
*/
virtual void insert(const QRectF& bb, const T& data);
/**
* @brief Show if a shape is a part of the tree
* @param data
*/
bool contains(const T &data);
/**
* @brief Remove a data item from the tree
*
* This removed a data item from the tree. If necessary the tree will
* adjust itself.
*
* @param data
*/
void remove(const T& data);
/**
* @brief Find all data items which intersects rect
* The items are sorted by insertion time in ascending order.
*
* @param rect where the objects have to be in
*
* @return objects intersecting the rect
*/
virtual QList<T> intersects(const QRectF& rect) const;
/**
* @brief Find all data item which contain the point
* The items are sorted by insertion time in ascending order.
*
* @param point which should be contained in the objects
*
* @return objects which contain the point
*/
QList<T> contains(const QPointF &point) const;
/**
* @brief Find all data item which contain the point
* The items are sorted by insertion time in ascending order.
*
* @param point which should be contained in the objects
*
* @return objects which contain the point
*/
QList<T> contained(const QRectF &point) const;
/**
* @brief Find all data rectangles
* The order is NOT guaranteed to be the same as that used by values().
*
* @return a list containing all the data rectangles used in the tree
*/
QList<QRectF> keys() const;
/**
* @brief Find all data items
* The order is NOT guaranteed to be the same as that used by keys().
*
* @return a list containing all the data used in the tree
*/
QList<T> values() const;
virtual void clear() {
delete m_root;
m_root = createLeafNode(m_capacity + 1, 0, 0);
m_leafMap.clear();
}
#ifdef CALLIGRA_RTREE_DEBUG
/**
* @brief Paint the tree
*
* @param p painter which should be used for painting
*/
void paint(QPainter & p) const;
/**
* @brief Print the tree using qdebug
*/
void debug() const;
#endif
protected:
class NonLeafNode;
class LeafNode;
class Node
{
public:
#ifdef CALLIGRA_RTREE_DEBUG
static int nodeIdCnt;
#endif
Node(int capacity, int level, Node * parent);
virtual ~Node() {}
virtual void remove(int index);
// move node between nodes of the same type from node
virtual void move(Node * node, int index) = 0;
virtual LeafNode * chooseLeaf(const QRectF& bb) = 0;
virtual NonLeafNode * chooseNode(const QRectF& bb, int level) = 0;
virtual void intersects(const QRectF& rect, QMap<int, T> & result) const = 0;
virtual void contains(const QPointF & point, QMap<int, T> & result) const = 0;
virtual void contained(const QRectF & point, QMap<int, T> & result) const = 0;
virtual void keys(QList<QRectF> & result) const = 0;
virtual void values(QMap<int, T> & result) const = 0;
virtual Node * parent() const {
return m_parent;
}
virtual void setParent(Node * parent) {
m_parent = parent;
}
virtual int childCount() const {
return m_counter;
}
virtual const QRectF& boundingBox() const {
return m_boundingBox;
}
virtual void updateBoundingBox();
virtual const QRectF& childBoundingBox(int index) const {
return m_childBoundingBox[index];
}
virtual void setChildBoundingBox(int index, const QRectF& rect) {
m_childBoundingBox[index] = rect;
}
virtual void clear();
virtual bool isRoot() const {
return m_parent == 0;
}
virtual bool isLeaf() const {
return false;
}
virtual int place() const {
return m_place;
}
virtual void setPlace(int place) {
m_place = place;
}
virtual int level() const {
return m_level;
}
virtual void setLevel(int level) {
m_level = level;
}
#ifdef CALLIGRA_RTREE_DEBUG
virtual int nodeId() const {
return m_nodeId;
}
virtual void paint(QPainter & p, int level) const = 0;
virtual void debug(QString line) const = 0;
protected:
#define levelColorSize 5
static QColor levelColor[levelColorSize];
virtual void paintRect(QPainter & p, int level) const;
#endif
protected:
Node * m_parent;
QRectF m_boundingBox;
QVector<QRectF> m_childBoundingBox;
int m_counter;
// the position in the parent
int m_place;
#ifdef CALLIGRA_RTREE_DEBUG
int m_nodeId;
#endif
int m_level;
};
class NonLeafNode : virtual public Node
{
public:
NonLeafNode(int capacity, int level, Node * parent);
- virtual ~NonLeafNode();
+ ~NonLeafNode() override;
virtual void insert(const QRectF& bb, Node * data);
- virtual void remove(int index);
- virtual void move(Node * node, int index);
+ void remove(int index) override;
+ void move(Node * node, int index) override;
- virtual LeafNode * chooseLeaf(const QRectF& bb);
- virtual NonLeafNode * chooseNode(const QRectF& bb, int level);
+ LeafNode * chooseLeaf(const QRectF& bb) override;
+ NonLeafNode * chooseNode(const QRectF& bb, int level) override;
- virtual void intersects(const QRectF& rect, QMap<int, T> & result) const;
- virtual void contains(const QPointF & point, QMap<int, T> & result) const;
- virtual void contained(const QRectF & point, QMap<int, T> & result) const;
+ void intersects(const QRectF& rect, QMap<int, T> & result) const override;
+ void contains(const QPointF & point, QMap<int, T> & result) const override;
+ void contained(const QRectF & point, QMap<int, T> & result) const override;
- virtual void keys(QList<QRectF> & result) const;
- virtual void values(QMap<int, T> & result) const;
+ void keys(QList<QRectF> & result) const override;
+ void values(QMap<int, T> & result) const override;
virtual Node * getNode(int index) const;
#ifdef CALLIGRA_RTREE_DEBUG
virtual void paint(QPainter & p, int level) const;
virtual void debug(QString line) const;
#endif
protected:
virtual Node * getLeastEnlargement(const QRectF& bb) const;
QVector<Node *> m_childs;
};
class LeafNode : virtual public Node
{
public:
static int dataIdCounter;
LeafNode(int capacity, int level, Node * parent);
- virtual ~LeafNode();
+ ~LeafNode() override;
virtual void insert(const QRectF& bb, const T& data, int id);
- virtual void remove(int index);
+ void remove(int index) override;
virtual void remove(const T& data);
- virtual void move(Node * node, int index);
+ void move(Node * node, int index) override;
- virtual LeafNode * chooseLeaf(const QRectF& bb);
- virtual NonLeafNode * chooseNode(const QRectF& bb, int level);
+ LeafNode * chooseLeaf(const QRectF& bb) override;
+ NonLeafNode * chooseNode(const QRectF& bb, int level) override;
- virtual void intersects(const QRectF& rect, QMap<int, T> & result) const;
- virtual void contains(const QPointF & point, QMap<int, T> & result) const;
- virtual void contained(const QRectF & point, QMap<int, T> & result) const;
+ void intersects(const QRectF& rect, QMap<int, T> & result) const override;
+ void contains(const QPointF & point, QMap<int, T> & result) const override;
+ void contained(const QRectF & point, QMap<int, T> & result) const override;
- virtual void keys(QList<QRectF> & result) const;
- virtual void values(QMap<int, T> & result) const;
+ void keys(QList<QRectF> & result) const override;
+ void values(QMap<int, T> & result) const override;
virtual const T& getData(int index) const;
virtual int getDataId(int index) const;
- virtual bool isLeaf() const {
+ bool isLeaf() const override {
return true;
}
#ifdef CALLIGRA_RTREE_DEBUG
virtual void debug(QString line) const;
virtual void paint(QPainter & p, int level) const;
#endif
protected:
QVector<T> m_data;
QVector<int> m_dataIds;
};
// factory methods
virtual LeafNode* createLeafNode(int capacity, int level, Node * parent) {
return new LeafNode(capacity, level, parent);
}
virtual NonLeafNode* createNonLeafNode(int capacity, int level, Node * parent) {
return new NonLeafNode(capacity, level, parent);
}
// methods for insert
QPair<Node *, Node *> splitNode(Node * node);
QPair<int, int> pickSeeds(Node * node);
QPair<int, int> pickNext(Node * node, QVector<bool> & marker, Node * group1, Node * group2);
virtual void adjustTree(Node * node1, Node * node2);
void insertHelper(const QRectF& bb, const T& data, int id);
// methods for delete
void insert(Node * node);
virtual void condenseTree(Node * node, QVector<Node *> & reinsert);
int m_capacity;
int m_minimum;
Node * m_root;
QMap<T, LeafNode *> m_leafMap;
};
template <typename T>
KoRTree<T>::KoRTree(int capacity, int minimum)
: m_capacity(capacity)
, m_minimum(minimum)
, m_root(createLeafNode(m_capacity + 1, 0, 0))
{
if (minimum > capacity / 2)
qFatal("KoRTree::KoRTree minimum can be maximal capacity/2");
//qDebug() << "root node " << m_root->nodeId();
}
template <typename T>
KoRTree<T>::~KoRTree()
{
delete m_root;
}
template <typename T>
void KoRTree<T>::insert(const QRectF& bb, const T& data)
{
// check if the shape is not already registered
KIS_SAFE_ASSERT_RECOVER_NOOP(!m_leafMap[data]);
insertHelper(bb, data, LeafNode::dataIdCounter++);
}
template <typename T>
void KoRTree<T>::insertHelper(const QRectF& bb, const T& data, int id)
{
QRectF nbb(bb.normalized());
// This has to be done as it is not possible to use QRectF::united() with a isNull()
if (nbb.isNull()) {
nbb.setWidth(0.0001);
nbb.setHeight(0.0001);
qWarning() << "KoRTree::insert boundingBox isNull setting size to" << nbb.size();
}
else {
// This has to be done as QRectF::intersects() return false if the rect does not have any area overlapping.
// If there is no width or height there is no area and therefore no overlapping.
if ( nbb.width() == 0 ) {
nbb.setWidth(0.0001);
}
if ( nbb.height() == 0 ) {
nbb.setHeight(0.0001);
}
}
LeafNode * leaf = m_root->chooseLeaf(nbb);
//qDebug() << " leaf" << leaf->nodeId() << nbb;
if (leaf->childCount() < m_capacity) {
leaf->insert(nbb, data, id);
m_leafMap[data] = leaf;
adjustTree(leaf, 0);
} else {
leaf->insert(nbb, data, id);
m_leafMap[data] = leaf;
QPair<Node *, Node *> newNodes = splitNode(leaf);
LeafNode * l = dynamic_cast<LeafNode *>(newNodes.first);
if (l)
for (int i = 0; i < l->childCount(); ++i)
m_leafMap[l->getData(i)] = l;
l = dynamic_cast<LeafNode *>(newNodes.second);
if (l)
for (int i = 0; i < l->childCount(); ++i)
m_leafMap[l->getData(i)] = l;
adjustTree(newNodes.first, newNodes.second);
}
}
template <typename T>
void KoRTree<T>::insert(Node * node)
{
if (node->level() == m_root->level()) {
adjustTree(m_root, node);
} else {
QRectF bb(node->boundingBox());
NonLeafNode * newParent = m_root->chooseNode(bb, node->level() + 1);
newParent->insert(bb, node);
QPair<Node *, Node *> newNodes(node, 0);
if (newParent->childCount() > m_capacity) {
newNodes = splitNode(newParent);
}
adjustTree(newNodes.first, newNodes.second);
}
}
template <typename T>
bool KoRTree<T>::contains(const T &data)
{
return m_leafMap[data];
}
template <typename T>
void KoRTree<T>::remove(const T&data)
{
//qDebug() << "KoRTree remove";
LeafNode * leaf = m_leafMap[data];
// Trying to remove unexistent leaf. Most probably, this leaf hasn't been added
// to the shape manager correctly
KIS_SAFE_ASSERT_RECOVER_RETURN(leaf);
m_leafMap.remove(data);
leaf->remove(data);
/**
* WARNING: after calling condenseTree() the temporary enters an inconsistent state!
* m_leafMap still points to the nodes now stored in 'reinsert' list, although
* they are not a part of the hierarchy. This state does not cause any use
* visible changes, but should be considered while implementing sanity checks.
*/
QVector<Node *> reinsert;
condenseTree(leaf, reinsert);
for (int i = 0; i < reinsert.size(); ++i) {
if (reinsert[i]->isLeaf()) {
LeafNode * leaf = dynamic_cast<LeafNode *>(reinsert[i]);
for (int j = 0; j < leaf->childCount(); ++j) {
insertHelper(leaf->childBoundingBox(j), leaf->getData(j), leaf->getDataId(j));
}
// clear is needed as the data items are not removed when insert into a new node
leaf->clear();
delete leaf;
} else {
NonLeafNode * node = dynamic_cast<NonLeafNode *>(reinsert[i]);
for (int j = 0; j < node->childCount(); ++j) {
insert(node->getNode(j));
}
// clear is needed as the data items are not removed when insert into a new node
node->clear();
delete node;
}
}
}
template <typename T>
QList<T> KoRTree<T>::intersects(const QRectF& rect) const
{
QMap<int, T> found;
m_root->intersects(rect, found);
return found.values();
}
template <typename T>
QList<T> KoRTree<T>::contains(const QPointF &point) const
{
QMap<int, T> found;
m_root->contains(point, found);
return found.values();
}
template <typename T>
QList<T> KoRTree<T>::contained(const QRectF& rect) const
{
QMap<int, T> found;
m_root->contained(rect, found);
return found.values();
}
template <typename T>
QList<QRectF> KoRTree<T>::keys() const
{
QList<QRectF> found;
m_root->keys(found);
return found;
}
template <typename T>
QList<T> KoRTree<T>::values() const
{
QMap<int, T> found;
m_root->values(found);
return found.values();
}
#ifdef CALLIGRA_RTREE_DEBUG
template <typename T>
void KoRTree<T>::paint(QPainter & p) const
{
if (m_root) {
m_root->paint(p, 0);
}
}
template <typename T>
void KoRTree<T>::debug() const
{
QString prefix("");
m_root->debug(prefix);
}
#endif
template <typename T>
QPair< typename KoRTree<T>::Node*, typename KoRTree<T>::Node* > KoRTree<T>::splitNode(typename KoRTree<T>::Node* node)
{
//qDebug() << "KoRTree::splitNode" << node;
Node * n1;
Node * n2;
if (node->isLeaf()) {
n1 = createLeafNode(m_capacity + 1, node->level(), node->parent());
n2 = createLeafNode(m_capacity + 1, node->level(), node->parent());
} else {
n1 = createNonLeafNode(m_capacity + 1, node->level(), node->parent());
n2 = createNonLeafNode(m_capacity + 1, node->level(), node->parent());
}
//qDebug() << " n1" << n1 << n1->nodeId();
//qDebug() << " n2" << n2 << n2->nodeId();
QVector<bool> marker(m_capacity + 1);
QPair<int, int> seeds(pickSeeds(node));
n1->move(node, seeds.first);
n2->move(node, seeds.second);
marker[seeds.first] = true;
marker[seeds.second] = true;
// There is one more in a node to split than the capacity and as we
// already put the seeds in the new nodes subtract them.
int remaining = m_capacity + 1 - 2;
while (remaining > 0) {
if (m_minimum - n1->childCount() == remaining) {
for (int i = 0; i < m_capacity + 1; ++i) {
if (!marker[i]) {
n1->move(node, i);
--remaining;
}
}
} else if (m_minimum - n2->childCount() == remaining) {
for (int i = 0; i < m_capacity + 1; ++i) {
if (!marker[i]) {
n2->move(node, i);
--remaining;
}
}
} else {
QPair<int, int> next(pickNext(node, marker, n1, n2));
if (next.first == 0) {
n1->move(node, next.second);
} else {
n2->move(node, next.second);
}
--remaining;
}
}
Q_ASSERT(n1->childCount() + n2->childCount() == node->childCount());
// move the data back to the old node
// this has to be done as the current node is already in the tree.
node->clear();
for (int i = 0; i < n1->childCount(); ++i) {
node->move(n1, i);
}
//qDebug() << " delete n1" << n1 << n1->nodeId();
// clear is needed as the data items are not removed
n1->clear();
delete n1;
return qMakePair(node, n2);
}
template <typename T>
QPair<int, int> KoRTree<T>::pickSeeds(Node *node)
{
int s1 = 0;
int s2 = 1;
qreal max = 0;
for (int i = 0; i < m_capacity + 1; ++i) {
for (int j = i+1; j < m_capacity + 1; ++j) {
if (i != j) {
QRectF bb1(node->childBoundingBox(i));
QRectF bb2(node->childBoundingBox(j));
QRectF comp(node->childBoundingBox(i).united(node->childBoundingBox(j)));
qreal area = comp.width() * comp.height() - bb1.width() * bb1.height() - bb2.width() * bb2.height();
//qDebug() << " ps" << i << j << area;
if (area > max) {
max = area;
s1 = i;
s2 = j;
}
}
}
}
return qMakePair(s1, s2);
}
template <typename T>
QPair<int, int> KoRTree<T>::pickNext(Node * node, QVector<bool> & marker, Node * group1, Node * group2)
{
//qDebug() << "KoRTree::pickNext" << marker;
qreal max = -1.0;
int select = 0;
int group = 0;
for (int i = 0; i < m_capacity + 1; ++i) {
if (marker[i] == false) {
QRectF bb1 = group1->boundingBox().united(node->childBoundingBox(i));
QRectF bb2 = group2->boundingBox().united(node->childBoundingBox(i));
qreal d1 = bb1.width() * bb1.height() - group1->boundingBox().width() * group1->boundingBox().height();
qreal d2 = bb2.width() * bb2.height() - group2->boundingBox().width() * group2->boundingBox().height();
qreal diff = qAbs(d1 - d2);
//qDebug() << " diff" << diff << i << d1 << d2;
if (diff > max) {
max = diff;
select = i;
//qDebug() << " i =" << i;
if (qAbs(d1) > qAbs(d2)) {
group = 1;
} else {
group = 0;
}
//qDebug() << " group =" << group;
}
}
}
marker[select] = true;
return qMakePair(group, select);
}
template <typename T>
void KoRTree<T>::adjustTree(Node *node1, Node *node2)
{
//qDebug() << "KoRTree::adjustTree";
if (node1->isRoot()) {
//qDebug() << " root";
if (node2) {
NonLeafNode * newRoot = createNonLeafNode(m_capacity + 1, node1->level() + 1, 0);
newRoot->insert(node1->boundingBox(), node1);
newRoot->insert(node2->boundingBox(), node2);
m_root = newRoot;
//qDebug() << "new root" << m_root->nodeId();
}
} else {
NonLeafNode * parent = dynamic_cast<NonLeafNode *>(node1->parent());
if (!parent) {
qFatal("KoRTree::adjustTree: no parent node found!");
return;
}
//QRectF pbbold( parent->boundingBox() );
parent->setChildBoundingBox(node1->place(), node1->boundingBox());
parent->updateBoundingBox();
//qDebug() << " bb1 =" << node1->boundingBox() << node1->place() << pbbold << "->" << parent->boundingBox() << parent->nodeId();
if (!node2) {
//qDebug() << " update";
adjustTree(parent, 0);
} else {
if (parent->childCount() < m_capacity) {
//qDebug() << " no split needed";
parent->insert(node2->boundingBox(), node2);
adjustTree(parent, 0);
} else {
//qDebug() << " split again";
parent->insert(node2->boundingBox(), node2);
QPair<Node *, Node *> newNodes = splitNode(parent);
adjustTree(newNodes.first, newNodes.second);
}
}
}
}
template <typename T>
void KoRTree<T>::condenseTree(Node *node, QVector<Node*> & reinsert)
{
//qDebug() << "KoRTree::condenseTree begin reinsert.size()" << reinsert.size();
if (!node->isRoot()) {
Node * parent = node->parent();
//qDebug() << " !node->isRoot us" << node->childCount();
if (node->childCount() < m_minimum) {
//qDebug() << " remove node";
parent->remove(node->place());
reinsert.push_back(node);
/**
* WARNING: here we leave the tree in an inconsistent state! 'reinsert'
* nodes may still be kept in m_leafMap structure, but we will
* *not* remove them for the efficiency reasons. They are guarenteed
* to be readded in remove().
*/
} else {
//qDebug() << " update BB parent is root" << parent->isRoot();
parent->setChildBoundingBox(node->place(), node->boundingBox());
parent->updateBoundingBox();
}
condenseTree(parent, reinsert);
} else {
//qDebug() << " node->isRoot us" << node->childCount();
if (node->childCount() == 1 && !node->isLeaf()) {
//qDebug() << " usedSpace = 1";
NonLeafNode * n = dynamic_cast<NonLeafNode *>(node);
if (n) {
Node * kid = n->getNode(0);
// clear is needed as the data items are not removed
m_root->clear();
delete m_root;
m_root = kid;
m_root->setParent(0);
//qDebug() << " new root" << m_root;
} else {
qFatal("KoRTree::condenseTree cast to NonLeafNode failed");
}
}
}
//qDebug() << "KoRTree::condenseTree end reinsert.size()" << reinsert.size();
}
#ifdef CALLIGRA_RTREE_DEBUG
template <typename T>
QColor KoRTree<T>::Node::levelColor[] = {
QColor(Qt::green),
QColor(Qt::red),
QColor(Qt::cyan),
QColor(Qt::magenta),
QColor(Qt::yellow),
};
template <class T>
int KoRTree<T>::Node::nodeIdCnt = 0;
#endif
template <typename T>
KoRTree<T>::Node::Node(int capacity, int level, Node * parent)
: m_parent(parent)
, m_childBoundingBox(capacity)
, m_counter(0)
#ifdef CALLIGRA_RTREE_DEBUG
, m_nodeId(nodeIdCnt++)
#endif
, m_level(level)
{
}
template <typename T>
void KoRTree<T>::Node::remove(int index)
{
for (int i = index + 1; i < m_counter; ++i) {
m_childBoundingBox[i-1] = m_childBoundingBox[i];
}
--m_counter;
updateBoundingBox();
}
template <typename T>
void KoRTree<T>::Node::updateBoundingBox()
{
m_boundingBox = QRectF();
for (int i = 0; i < m_counter; ++i) {
m_boundingBox = m_boundingBox.united(m_childBoundingBox[i]);
}
}
template <typename T>
void KoRTree<T>::Node::clear()
{
m_counter = 0;
m_boundingBox = QRectF();
}
#ifdef CALLIGRA_RTREE_DEBUG
template <typename T>
void KoRTree<T>::Node::paintRect(QPainter & p, int level) const
{
QColor c(Qt::black);
if (level < levelColorSize) {
c = levelColor[level];
}
QPen pen(c, 0);
p.setPen(pen);
QRectF bbdraw(this->m_boundingBox);
bbdraw.adjust(level * 2, level * 2, -level * 2, -level * 2);
p.drawRect(bbdraw);
}
#endif
template <typename T>
KoRTree<T>::NonLeafNode::NonLeafNode(int capacity, int level, Node * parent)
: Node(capacity, level, parent)
, m_childs(capacity)
{
//qDebug() << "NonLeafNode::NonLeafNode()" << this;
}
template <typename T>
KoRTree<T>::NonLeafNode::~NonLeafNode()
{
//qDebug() << "NonLeafNode::~NonLeafNode()" << this;
for (int i = 0; i < this->m_counter; ++i) {
delete m_childs[i];
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::insert(const QRectF& bb, Node * data)
{
m_childs[this->m_counter] = data;
data->setPlace(this->m_counter);
data->setParent(this);
this->m_childBoundingBox[this->m_counter] = bb;
this->m_boundingBox = this->m_boundingBox.united(bb);
//qDebug() << "NonLeafNode::insert" << this->nodeId() << data->nodeId();
++this->m_counter;
}
template <typename T>
void KoRTree<T>::NonLeafNode::remove(int index)
{
for (int i = index + 1; i < this->m_counter; ++i) {
m_childs[i-1] = m_childs[i];
m_childs[i-1]->setPlace(i - 1);
}
Node::remove(index);
}
template <typename T>
void KoRTree<T>::NonLeafNode::move(Node * node, int index)
{
//qDebug() << "NonLeafNode::move" << this << node << index << node->nodeId() << "->" << this->nodeId();
NonLeafNode * n = dynamic_cast<NonLeafNode *>(node);
if (n) {
QRectF bb = n->childBoundingBox(index);
insert(bb, n->getNode(index));
}
}
template <typename T>
typename KoRTree<T>::LeafNode * KoRTree<T>::NonLeafNode::chooseLeaf(const QRectF& bb)
{
return getLeastEnlargement(bb)->chooseLeaf(bb);
}
template <typename T>
typename KoRTree<T>::NonLeafNode * KoRTree<T>::NonLeafNode::chooseNode(const QRectF& bb, int level)
{
if (this->m_level > level) {
return getLeastEnlargement(bb)->chooseNode(bb, level);
} else {
return this;
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::intersects(const QRectF& rect, QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
if (this->m_childBoundingBox[i].intersects(rect)) {
m_childs[i]->intersects(rect, result);
}
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::contains(const QPointF & point, QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
if (this->m_childBoundingBox[i].contains(point)) {
m_childs[i]->contains(point, result);
}
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::contained(const QRectF& rect, QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
if (this->m_childBoundingBox[i].intersects(rect)) {
m_childs[i]->contained(rect, result);
}
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::keys(QList<QRectF> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
m_childs[i]->keys(result);
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::values(QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
m_childs[i]->values(result);
}
}
template <typename T>
typename KoRTree<T>::Node * KoRTree<T>::NonLeafNode::getNode(int index) const
{
return m_childs[index];
}
template <typename T>
typename KoRTree<T>::Node * KoRTree<T>::NonLeafNode::getLeastEnlargement(const QRectF& bb) const
{
//qDebug() << "NonLeafNode::getLeastEnlargement";
QVarLengthArray<qreal> area(this->m_counter);
for (int i = 0; i < this->m_counter; ++i) {
QSizeF big(this->m_childBoundingBox[i].united(bb).size());
area[i] = big.width() * big.height() - this->m_childBoundingBox[i].width() * this->m_childBoundingBox[i].height();
}
int minIndex = 0;
qreal minArea = area[minIndex];
//qDebug() << " min" << minIndex << minArea;
for (int i = 1; i < this->m_counter; ++i) {
if (area[i] < minArea) {
minIndex = i;
minArea = area[i];
//qDebug() << " min" << minIndex << minArea;
}
}
return m_childs[minIndex];
}
#ifdef CALLIGRA_RTREE_DEBUG
template <typename T>
void KoRTree<T>::NonLeafNode::debug(QString line) const
{
for (int i = 0; i < this->m_counter; ++i) {
qDebug("%s %d %d", qPrintable(line), this->nodeId(), i);
m_childs[i]->debug(line + " ");
}
}
template <typename T>
void KoRTree<T>::NonLeafNode::paint(QPainter & p, int level) const
{
this->paintRect(p, level);
for (int i = 0; i < this->m_counter; ++i) {
m_childs[i]->paint(p, level + 1);
}
}
#endif
template <class T>
int KoRTree<T>::LeafNode::dataIdCounter = 0;
template <typename T>
KoRTree<T>::LeafNode::LeafNode(int capacity, int level, Node * parent)
: Node(capacity, level, parent)
, m_data(capacity)
, m_dataIds(capacity)
{
//qDebug() << "LeafNode::LeafNode" << this;
}
template <typename T>
KoRTree<T>::LeafNode::~LeafNode()
{
//qDebug() << "LeafNode::~LeafNode" << this;
}
template <typename T>
void KoRTree<T>::LeafNode::insert(const QRectF& bb, const T& data, int id)
{
m_data[this->m_counter] = data;
m_dataIds[this->m_counter] = id;
this->m_childBoundingBox[this->m_counter] = bb;
this->m_boundingBox = this->m_boundingBox.united(bb);
++this->m_counter;
}
template <typename T>
void KoRTree<T>::LeafNode::remove(int index)
{
for (int i = index + 1; i < this->m_counter; ++i) {
m_data[i-1] = m_data[i];
m_dataIds[i-1] = m_dataIds[i];
}
Node::remove(index);
}
template <typename T>
void KoRTree<T>::LeafNode::remove(const T& data)
{
int old_counter = this->m_counter;
for (int i = 0; i < this->m_counter; ++i) {
if (m_data[i] == data) {
//qDebug() << "LeafNode::remove id" << i;
remove(i);
break;
}
}
if (old_counter == this->m_counter) {
qWarning() << "LeafNode::remove( const T&data) data not found";
}
}
template <typename T>
void KoRTree<T>::LeafNode::move(Node * node, int index)
{
LeafNode * n = dynamic_cast<LeafNode*>(node);
if (n) {
//qDebug() << "LeafNode::move" << this << node << index
// << node->nodeId() << "->" << this->nodeId() << n->childBoundingBox( index );
QRectF bb = n->childBoundingBox(index);
insert(bb, n->getData(index), n->getDataId(index));
}
}
template <typename T>
typename KoRTree<T>::LeafNode * KoRTree<T>::LeafNode::chooseLeaf(const QRectF& bb)
{
Q_UNUSED(bb);
return this;
}
template <typename T>
typename KoRTree<T>::NonLeafNode * KoRTree<T>::LeafNode::chooseNode(const QRectF& bb, int level)
{
Q_UNUSED(bb);
Q_UNUSED(level);
qFatal("LeafNode::chooseNode called. This should not happen!");
return 0;
}
template <typename T>
void KoRTree<T>::LeafNode::intersects(const QRectF& rect, QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
if (this->m_childBoundingBox[i].intersects(rect)) {
result.insert(m_dataIds[i], m_data[i]);
}
}
}
template <typename T>
void KoRTree<T>::LeafNode::contains(const QPointF & point, QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
if (this->m_childBoundingBox[i].contains(point)) {
result.insert(m_dataIds[i], m_data[i]);
}
}
}
template <typename T>
void KoRTree<T>::LeafNode::contained(const QRectF& rect, QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
if (rect.contains(this->m_childBoundingBox[i])) {
result.insert(m_dataIds[i], m_data[i]);
}
}
}
template <typename T>
void KoRTree<T>::LeafNode::keys(QList<QRectF> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
result.push_back(this->m_childBoundingBox[i]);
}
}
template <typename T>
void KoRTree<T>::LeafNode::values(QMap<int, T> & result) const
{
for (int i = 0; i < this->m_counter; ++i) {
result.insert(m_dataIds[i], m_data[i]);
}
}
template <typename T>
const T& KoRTree<T>::LeafNode::getData(int index) const
{
return m_data[ index ];
}
template <typename T>
int KoRTree<T>::LeafNode::getDataId(int index) const
{
return m_dataIds[ index ];
}
#ifdef CALLIGRA_RTREE_DEBUG
template <typename T>
void KoRTree<T>::LeafNode::debug(QString line) const
{
for (int i = 0; i < this->m_counter; ++i) {
qDebug("%s %d %d %p", qPrintable(line), this->nodeId(), i, &(m_data[i]));
qDebug() << this->m_childBoundingBox[i].toRect();
}
}
template <typename T>
void KoRTree<T>::LeafNode::paint(QPainter & p, int level) const
{
if (this->m_counter) {
this->paintRect(p, level);
}
}
#endif
#endif /* KORTREE_H */
diff --git a/libs/flake/KoResourceUpdateMediator.h b/libs/flake/KoResourceUpdateMediator.h
index 602df7443d..25638a829b 100644
--- a/libs/flake/KoResourceUpdateMediator.h
+++ b/libs/flake/KoResourceUpdateMediator.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KO_RESOURCE_UPDATE_MEDIATOR_H
#define __KO_RESOURCE_UPDATE_MEDIATOR_H
#include <QScopedPointer>
#include <QSharedPointer>
#include "kritaflake_export.h"
/**
* A special mediator class that connects the resource and the
* resource manager. The resource manager connects to a
* sigResourceChanged() changed and when a resource changes, the
* manager calls connectResource() for this resource. After that, the
* mediator should notify the manager about every change that happens
* to the resource by emitting the corresponding signal.
*
* There is only one mediator for one type (key) of the resource.
*/
class KRITAFLAKE_EXPORT KoResourceUpdateMediator : public QObject
{
Q_OBJECT
public:
KoResourceUpdateMediator(int key);
- virtual ~KoResourceUpdateMediator();
+ ~KoResourceUpdateMediator() override;
int key() const;
virtual void connectResource(QVariant sourceResource) = 0;
Q_SIGNALS:
void sigResourceChanged(int key);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
typedef QSharedPointer<KoResourceUpdateMediator> KoResourceUpdateMediatorSP;
#endif /* __KO_RESOURCE_UPDATE_MEDIATOR_H */
diff --git a/libs/flake/KoSelectedShapesProxySimple.h b/libs/flake/KoSelectedShapesProxySimple.h
index ead3971a92..607ed4bf32 100644
--- a/libs/flake/KoSelectedShapesProxySimple.h
+++ b/libs/flake/KoSelectedShapesProxySimple.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOSELECTEDSHAPESPROXYSIMPLE_H
#define KOSELECTEDSHAPESPROXYSIMPLE_H
#include <QPointer>
#include <KoSelectedShapesProxy.h>
class KoShapeManager;
class KRITAFLAKE_EXPORT KoSelectedShapesProxySimple : public KoSelectedShapesProxy
{
Q_OBJECT
public:
KoSelectedShapesProxySimple(KoShapeManager *shapeManager);
- KoSelection *selection();
+ KoSelection *selection() override;
private:
QPointer<KoShapeManager> m_shapeManager;
};
#endif // KOSELECTEDSHAPESPROXYSIMPLE_H
diff --git a/libs/flake/KoSelection.h b/libs/flake/KoSelection.h
index e5919cebed..ed8e096af0 100644
--- a/libs/flake/KoSelection.h
+++ b/libs/flake/KoSelection.h
@@ -1,165 +1,165 @@
/* This file is part of the KDE project
Copyright (C) 2006 Boudewijn Rempt <boud@valdyas.org>
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007,2009 Thomas Zander <zander@kde.org>
Copyright (C) 2006,2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSELECTION_H
#define KOSELECTION_H
#include <QObject>
#include "KoShape.h"
#include "KoFlake.h"
#include "kritaflake_export.h"
class KoViewConverter;
class KoShapeLayer;
class KoSelectionPrivate;
/**
* A selection is a shape that contains a number of references
* to shapes. That means that a selection can be manipulated in
* the same way as a single shape.
*
* Note that a single shape can be selected in one view, and not in
* another, and that in a single view, more than one selection can be
* present. So selections should not be seen as singletons, or as
* something completely transient.
*
* A selection, however, should not be selectable. We need to think
* a little about the interaction here.
*/
class KRITAFLAKE_EXPORT KoSelection : public QObject, public KoShape, public KoShape::ShapeChangeListener
{
Q_OBJECT
public:
KoSelection();
- virtual ~KoSelection();
+ ~KoSelection() override;
void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
void setSize(const QSizeF &size) override;
QSizeF size() const override;
QRectF outlineRect() const override;
QRectF boundingRect() const override;
/**
* Adds a shape to the selection.
*
* If the shape is a KoShapeGroup all of its child shapes are automatically added
* to the selection.
* If the shape has no parent or is not a KoShapeGroup, only the given shape is
* added to the selection.
* If the given shape is a child of a KoShapeGroup and recursive selection is enabled
* the all parents and their child shapes up to the toplevel KoShapeGroup are added to
* the selection.
*
* @param shape the shape to add to the selection
* @param recursive enables recursively selecting shapes of parent groups
*/
void select(KoShape *shape);
/**
* Removes a selected shape.
*
* If the shape is a KoShapeGroup all of its child shapes are automatically removed
* from the selection.
* If the shape has no parent or is not a KoShapeGroup, only the given shape is
* removed from the selection.
* If the given shape is a child of a KoShapeGroup and recursive selection is enabled
* the all parents and their child shape up to the toplevel KoShapeGroup are removed
* from the selection.
*
* @param shape the shape to remove from the selection
* @param recursive enables recursively deselecting shapes of parent groups
*/
void deselect(KoShape *shape);
/// clear the selections list
void deselectAll();
/**
* Return the list of selected shapes
* @return the list of selected shapes
* @param strip if StrippedSelection, the returned list will not include any children
* of a container shape if the container-parent is itself also in the set.
*/
const QList<KoShape*> selectedShapes() const;
/**
* Same as selectedShapes() but only for editable shapes. Used by
* the algorithms that modify the image
*/
const QList<KoShape*> selectedEditableShapes() const;
/**
* Same as selectedEditableShapes() but also includes shapes delegates.
* Used for
*/
const QList<KoShape*> selectedEditableShapesAndDelegates() const;
/**
* Return the first selected shape, or 0 if there is nothing selected.
* @param strip if StrippedSelection, the returned list will not include any children
* of a grouped shape if the group-parent is itself also in the set.
*/
KoShape *firstSelectedShape() const;
/// return true if the shape is selected
bool isSelected(const KoShape *shape) const;
/// return the selection count, i.e. the number of all selected shapes
int count() const;
- virtual bool hitTest(const QPointF &position) const;
+ bool hitTest(const QPointF &position) const override;
/**
* Sets the currently active layer.
* @param layer the new active layer
*/
void setActiveLayer(KoShapeLayer *layer);
/**
* Returns a currently active layer.
*
* @return the currently active layer, or zero if there is none
*/
KoShapeLayer *activeLayer() const;
- void notifyShapeChanged(ChangeType type, KoShape *shape);
+ void notifyShapeChanged(ChangeType type, KoShape *shape) override;
Q_SIGNALS:
/// emitted when the selection is changed
void selectionChanged();
/// emitted when the current layer is changed
void currentLayerChanged(const KoShapeLayer *layer);
private:
- virtual void saveOdf(KoShapeSavingContext &) const;
- virtual bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &);
+ void saveOdf(KoShapeSavingContext &) const override;
+ bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) override;
Q_DECLARE_PRIVATE_D(KoShape::d_ptr, KoSelection)
};
#endif
diff --git a/libs/flake/KoShapeConfigWidgetBase.h b/libs/flake/KoShapeConfigWidgetBase.h
index 755c007e48..06e193566a 100644
--- a/libs/flake/KoShapeConfigWidgetBase.h
+++ b/libs/flake/KoShapeConfigWidgetBase.h
@@ -1,99 +1,99 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONFIGWIDGETBASE_H
#define KOSHAPECONFIGWIDGETBASE_H
#include <QWidget>
#include "kritaflake_export.h"
class KoShape;
class KUndo2Command;
class KoUnit;
class KoCanvasResourceManager;
/**
* Base widget for shape-configuration panels.
* This is an interface type class used by classes that intend to provide
* a GUI for configuring newly created shapes as created by a KoShapeFactoryBase.
*
* Every time after a shape is created the KoShapeFactoryBase for that shape-type
* will be queried for all the config widgets; both factory specific as well as
* those set by the hosting application.
* A dialog will be shown with all those panels, each extending this class.
* The framework will then call open() to populate the widget with data from
* the param shape. After the user ok-ed the dialog the save() will be called
* to allow the widget to apply all settings from the widget to the shape.
*/
class KRITAFLAKE_EXPORT KoShapeConfigWidgetBase : public QWidget
{
Q_OBJECT
public:
/**
* Default constructor
*/
KoShapeConfigWidgetBase();
- virtual ~KoShapeConfigWidgetBase();
+ ~KoShapeConfigWidgetBase() override;
/**
* Open the argument shape by interpreting the data and setting that data on this
* widget.
* @param shape the shape that is to be queried for the data this widget can edit.
*/
virtual void open(KoShape *shape) = 0;
/**
* Save the data of this widget to the shape passed to open earlier to
* apply any user changed options.
* Called by the tool that created the shape.
*/
virtual void save() = 0;
/**
* Overwrite this method to set the application unit type and update all unit-widgets
* in this panel.
* Called by the tool that created the shape using KoCavasBase::unit()
* @param unit the new unit to show data in.
*/
virtual void setUnit(const KoUnit &unit);
/// called to set the canvas resource manager of the canvas the user used to insert the new shape.
void setResourceManager(KoCanvasResourceManager *rm);
/// Return true if the shape config panel should be shown after the shape is created
virtual bool showOnShapeCreate();
/// Return true if the shape config panel should be shown when the shape is selected
virtual bool showOnShapeSelect();
/// Creates a command which applies all changes to the opened shape
virtual KUndo2Command * createCommand();
Q_SIGNALS:
/// is emitted after one of the config options has changed
void propertyChanged();
/// is emitted when the dialog should be accepted ie a file double clicked in a filebrowser
void accept();
protected:
KoCanvasResourceManager *m_resourceManager; ///< the resource provider with data for this canvas
};
#endif
diff --git a/libs/flake/KoShapeContainer.h b/libs/flake/KoShapeContainer.h
index f434b91da3..5c43458db0 100644
--- a/libs/flake/KoShapeContainer.h
+++ b/libs/flake/KoShapeContainer.h
@@ -1,259 +1,259 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONTAINER_H
#define KOSHAPECONTAINER_H
#include "KoShape.h"
#include <QList>
#include "kritaflake_export.h"
class QPainter;
class KoShapeContainerModel;
class KoShapeContainerPrivate;
class KoViewConverter;
/**
* This is the base class that all Flake group-shapes are based on.
* Extending from this class allows you to have child-shapes.
* Like the KoShape class, this shape is a visible class with
* a position and a size. It can paint itself as well if you implement
* the paintComponent() method.
*
* <p>The most important feature of this class is that you can make
* other KoShape classes to be children of this container.
*
* <p>The effect of grouping those shapes is that their position
* is relative to the position of the container. Move the container and
* all children move with it.
*
* <p>Each child can optionally be said to be 'clipped' by the container.
* This feature will give the effect that if the child has a size and
* position outside the container, parts outside the container will not be shown.
* This is especially useful
* for showing cutouts of content, like images, without changing the actual content.
*
* <p>For so called clipped children any modification made to the container is
* propagated to the child. This includes rotation as well as scaling
* and shearing.
*
* <p>Maintaining the list of children can be done using the supplied methods
* addChild() and removeChild(). However, they only forward their requests to the
* data model KoShapeContainerModel and if you provide a custom implementation
* of that model any means can be used to maintain a list of children, as long as
* you will take care to register them with the appropriate shape manager.
*
* <p>An example usage where a custom model might be useful is when you have a
* container for text areas which are split into columns. If you resize the container
* and the width of the individual columns gets too small, the model can choose to
* remove a child or add one when the width allows another column.
*/
class KRITAFLAKE_EXPORT KoShapeContainer : public KoShape
{
public:
/**
* Constructor with custom model to be used for maintaining the list of children.
* For all the normal cases you don't need a custom model. Only when you want to respond
* to moves of the container to do something special, or disable one of the features the
* container normally has (like clipping). Use the default constructor in those cases.
* @param model the custom model to be used for maintaining the list of children.
*/
explicit KoShapeContainer(KoShapeContainerModel *model = 0);
/**
* Destructor for the shape container.
* All children will be orphaned by calling a KoShape::setParent(0)
*/
- virtual ~KoShapeContainer();
+ ~KoShapeContainer() override;
/**
* Add a child to this container.
*
* This container will NOT take over ownership of the shape. The caller or those creating
* the shape is responsible to delete it if not needed any longer.
*
* @param shape the child to be managed in the container.
*/
void addShape(KoShape *shape);
/**
* Remove a child to be completely separated from the container.
*
* The shape will only be removed from this container but not be deleted.
*
* @param shape the child to be removed.
*/
void removeShape(KoShape *shape);
/**
* Return the current number of children registered.
* @return the current number of children registered.
*/
int shapeCount() const;
/**
* Set the argument child to have its 'clipping' property set.
*
* A shape that is clipped by the container will have its visible portion
* limited to the area where it intersects with the container.
* If a shape is positioned or sized such that it would be painted outside
* of the KoShape::outline() of its parent container, setting this property
* to true will clip the shape painting to the container outline.
*
* @param child the child for which the property will be changed.
* @param clipping the property
*/
void setClipped(const KoShape *child, bool clipping);
/**
* Returns if the argument child has its 'clipping' property set.
*
* A shape that is clipped by the container will have its visible portion
* limited to the area where it intersects with the container.
* If a shape is positioned or sized such that it would be painted outside
* of the KoShape::outline() of its parent container, setting this property
* to true will clip the shape painting to the container outline.
*
* @return if the argument child has its 'clipping' property set.
* @param child the child for which the property will be returned.
*/
bool isClipped(const KoShape *child) const;
/**
* Return whether the child has the effective state of being locked for user modifications.
* This method is deferred to the model, which should call the KoShape::isGeometryProtected() on the child.
* @param child the shape that the user wants to move.
*/
bool isChildLocked(const KoShape *child) const;
/**
* Set the shape to inherit the container transform.
*
* A shape that inherits the transform of the parent container will have its
* share / rotation / skew etc be calculated as being the product of both its
* own local transformation and also that of its parent container.
* If you set this to true and rotate the container, the shape will get that
* rotation as well automatically.
*
* @param shape the shape for which the property will be changed.
* @param inherit the new value
*/
void setInheritsTransform(const KoShape *shape, bool inherit);
/**
* Returns if the shape inherits the container transform.
*
* A shape that inherits the transform of the parent container will have its
* share / rotation / skew etc be calculated as being the product of both its
* own local transformation and also that of its parent container.
* If you set this to true and rotate the container, the shape will get that
* rotation as well automatically.
*
* @return if the argument shape has its 'inherits transform' property set.
* @param shape the shape for which the property will be returned.
*/
bool inheritsTransform(const KoShape *shape) const;
/// reimplemented
- virtual void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
/**
* @brief Paint the component
* Implement this method to allow the shape to paint itself, just like the KoShape::paint()
* method does.
*
* @param painter used for painting the shape
* @param converter to convert between internal and view coordinates.
* @see applyConversion()
*/
virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) = 0;
using KoShape::update;
/// reimplemented
- virtual void update() const;
+ void update() const override;
/**
* Return the list of all child shapes.
* @return the list of all child shapes
*/
QList<KoShape*> shapes() const;
/**
* return the model for this container
*/
KoShapeContainerModel *model() const;
/**
* A special interface for KoShape to use during setParent call. Don't use
* these method directly for managing shapes hierarchy! Use shape->setParent()
* instead.
*/
struct ShapeInterface {
ShapeInterface(KoShapeContainer *_q);
/**
* Add a child to this container.
*
* This container will NOT take over ownership of the shape. The caller or those creating
* the shape is responsible to delete it if not needed any longer.
*
* @param shape the child to be managed in the container.
*/
void addShape(KoShape *shape);
/**
* Remove a child to be completely separated from the container.
*
* The shape will only be removed from this container but not be deleted.
*
* @param shape the child to be removed.
*/
void removeShape(KoShape *shape);
protected:
KoShapeContainer *q;
};
ShapeInterface* shapeInterface();
protected:
/**
* This hook is for inheriting classes that need to do something on adding/removing
* of children.
* This method will be called just after the child has been added/removed.
* The default implementation is empty.
*/
virtual void shapeCountChanged() { }
- virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
+ void shapeChanged(ChangeType type, KoShape *shape = 0) override;
/// constructor
KoShapeContainer(KoShapeContainerPrivate *);
private:
Q_DECLARE_PRIVATE(KoShapeContainer)
};
#endif
diff --git a/libs/flake/KoShapeContainer_p.h b/libs/flake/KoShapeContainer_p.h
index 2a1b21164e..b656793649 100644
--- a/libs/flake/KoShapeContainer_p.h
+++ b/libs/flake/KoShapeContainer_p.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONTAINERPRIVATE_H
#define KOSHAPECONTAINERPRIVATE_H
#include "KoShape_p.h"
#include "KoShapeContainer.h"
#include "kritaflake_export.h"
class KoShapeContainerModel;
/**
* \internal used private d-pointer class for the \a KoShapeContainer class.
*/
class KRITAFLAKE_EXPORT KoShapeContainerPrivate : public KoShapePrivate
{
public:
explicit KoShapeContainerPrivate(KoShapeContainer *q);
- virtual ~KoShapeContainerPrivate();
+ ~KoShapeContainerPrivate() override;
KoShapeContainerPrivate(const KoShapeContainerPrivate &rhs, KoShapeContainer *q);
KoShapeContainer::ShapeInterface shapeInterface;
KoShapeContainerModel *model;
};
#endif
diff --git a/libs/flake/KoShapeController.h b/libs/flake/KoShapeController.h
index fbb5356ad0..26171e50af 100644
--- a/libs/flake/KoShapeController.h
+++ b/libs/flake/KoShapeController.h
@@ -1,169 +1,169 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007, 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONTROLLER_H
#define KOSHAPECONTROLLER_H
#include "kritaflake_export.h"
#include <QObject>
#include <QList>
#include <QMetaType>
class KoCanvasBase;
class KoShape;
class KoShapeBasedDocumentBase;
class KUndo2Command;
class KoDocumentResourceManager;
/**
* Class used by tools to maintain the list of shapes.
* All applications have some sort of list of all shapes that belong to the document.
* The applications implement the KoShapeBasedDocumentBase interface (all pure virtuals)
* to add and remove shapes from the document. To ensure that an application can expect
* a certain protocol to be adhered to when adding/removing shapes, all tools use the API
* from this class for maintaining the list of shapes in the document. So no tool gets
* to access the application directly.
*/
class KRITAFLAKE_EXPORT KoShapeController : public QObject
{
Q_OBJECT
public:
/**
* Create a new Controller; typically not called by applications, only
* by the KonCanvasBase constructor.
* @param canvas the canvas this controller works for. The canvas can be 0
* @param shapeBasedDocument the application provided shapeBasedDocument that we can call.
*/
KoShapeController(KoCanvasBase *canvas, KoShapeBasedDocumentBase *shapeBasedDocument);
/// destructor
- ~KoShapeController();
+ ~KoShapeController() override;
/**
* @brief reset sets the canvas and shapebased document to 0.
*/
void reset();
/**
* @brief Add a shape to the document.
* If the shape has no parent, the active layer will become its parent.
*
* @param shape to add to the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shape into the document or 0 if the
* insertion was cancelled. The command is not yet executed.
*/
KUndo2Command* addShape(KoShape *shape, KUndo2Command *parent = 0);
/**
* @brief Add a shape to the document, skipping any dialogs or other user interaction.
*
* @param shape to add to the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shape into the document. The command is not yet executed.
*/
KUndo2Command* addShapeDirect(KoShape *shape, KUndo2Command *parent = 0);
/**
* @brief Add shapes to the document, skipping any dialogs or other user interaction.
*
* @param shapes to add to the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will insert the shapes into the document. The command is not yet executed.
*/
KUndo2Command* addShapesDirect(const QList<KoShape*> shape, KUndo2Command *parent = 0);
/**
* @brief Remove a shape from the document.
*
* @param shape to remove from the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will remove the shape from the document.
* The command is not yet executed.
*/
KUndo2Command* removeShape(KoShape *shape, KUndo2Command *parent = 0);
/**
* Remove a shape from the document.
*
* @param shapes the set of shapes to remove from the document
* @param parent the parent command if the resulting command is a compound undo command.
*
* @return command which will remove the shape from the document.
* The command is not yet executed.
*/
KUndo2Command* removeShapes(const QList<KoShape*> &shapes, KUndo2Command *parent = 0);
/**
* @brief Set the KoShapeBasedDocumentBase used to add/remove shapes.
*
* NOTE: only Sheets uses this method. Do not use it in your application. Sheets
* has to also call:
* <code>KoToolManager::instance()->updateShapeControllerBase(shapeBasedDocument, canvas->canvasController());</code>
*
* @param shapeBasedDocument the new shapeBasedDocument.
*/
void setShapeControllerBase(KoShapeBasedDocumentBase *shapeBasedDocument);
/**
* The size of the document measured in rasterized pixels. This information is needed for loading
* SVG documents that use 'px' as the default unit.
*/
QRectF documentRectInPixels() const;
/**
* Resolution of the rasterized representaiton of the document. Used to load SVG documents correctly.
*/
qreal pixelsPerInch() const;
/**
* Document rect measured in 'pt'
*/
QRectF documentRect() const;
/**
* Return a pointer to the resource manager associated with the
* shape-set (typically a document). The resource manager contains
* document wide resources * such as variable managers, the image
* collection and others.
*/
KoDocumentResourceManager *resourceManager() const;
/**
* @brief Returns the KoShapeBasedDocumentBase used to add/remove shapes.
*
* @return the KoShapeBasedDocumentBase
*/
KoShapeBasedDocumentBase *documentBase() const;
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoShapeController *)
#endif
diff --git a/libs/flake/KoShapeFactoryBase.h b/libs/flake/KoShapeFactoryBase.h
index 9781746c19..317006475f 100644
--- a/libs/flake/KoShapeFactoryBase.h
+++ b/libs/flake/KoShapeFactoryBase.h
@@ -1,304 +1,304 @@
/* This file is part of the KDE project
* Copyright (c) 2006 Boudewijn Rempt (boud@valdyas.org)
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEFACTORYBASE_H
#define KOSHAPEFACTORYBASE_H
#include <QObject>
#include <QString>
#include <QList>
#include "kritaflake_export.h"
#include <KoXmlReader.h>
class KoShape;
class KoProperties;
class KoShapeConfigWidgetBase;
class KoShapeLoadingContext;
class KoDocumentResourceManager;
class QStringList;
#define SHAPETEMPLATE_MIMETYPE "application/x-flake-shapetemplate"
#define SHAPEID_MIMETYPE "application/x-flake-shapeId"
/**
* Contains a KoProperties object that describes the settings of a
* particular variant of a shape object, together with a name, a description
* and an icon for use in the user interface.
*/
struct KRITAFLAKE_EXPORT KoShapeTemplate {
KoShapeTemplate() {
properties = 0;
}
QString id; ///< The id of the shape
QString templateId; ///< The id of this particular template - only has to be unique with the shape
QString name; ///< The name to be shown for this template
QString family; ///< The family of the shape (possible values are: "funny","arrow")
QString toolTip; ///< The tooltip text for the template
QString iconName; ///< Icon name
/**
* The properties which, when passed to the KoShapeFactoryBase::createShape() method
* result in the shape this template represents.
*/
const KoProperties *properties;
};
/**
* A factory for KoShape objects.
* The baseclass for all shape plugins. Each plugin that ships a KoShape should also
* ship a factory. That factory will extend this class and set variable data like
* a toolTip and icon in the constructor of that extending class.
*
* An example usage would be:
@code
class MyShapeFactory : public KoShapeFactoryBase {
public:
MyShapeFactory()
: KoShapeFactoryBase("MyShape", i18n("My Shape")) {
setToolTip(i18n("A nice shape"));
}
~MyShapeFactory() {}
// more methods here
};
@endcode
* After you created the factory you should create a plugin that can announce the factory to the
* KoShapeRegistry. See the KoPluginLoader as well.
*/
class KRITAFLAKE_EXPORT KoShapeFactoryBase : public QObject
{
Q_OBJECT
public:
/**
* Create the new factory
* @param id a string that will be used internally for referencing the shape, for
* example for use by the KoToolBase::activateTemporary.
* @param name the user visible name of the shape this factory creates.
*/
KoShapeFactoryBase(const QString &id, const QString &name, const QString &deferredPluginName = QString());
- virtual ~KoShapeFactoryBase();
+ ~KoShapeFactoryBase() override;
/**
* Create a list of option panels to show on creating a new shape.
* The shape type this factory creates may have general or specific setting panels
* that will be shown after inserting a new shape.
* The first item in the list will be shown as the first tab in the list of panels,
* behind all app specific panels.
* This is a separate list as set by setOptionPanels() and fetched by panelFactories()
*/
virtual QList<KoShapeConfigWidgetBase*> createShapeOptionPanels() {
return QList<KoShapeConfigWidgetBase*>();
}
/**
* return the id for the shape this factory creates.
* @return the id for the shape this factory creates.
*/
QString id() const;
/**
* Return all the templates this factory knows about.
* Each template shows a different way to create a shape this factory is specialized in.
*/
QList<KoShapeTemplate> templates() const;
/**
* return a translated tooltip Text for a selector of shapes
* @return a translated tooltip Text
*/
QString toolTip() const;
/**
* return the basename of the icon for a selector of shapes
* @return the basename of the icon for a selector of shapes
*/
QString iconName() const;
/**
* return the user visible (and translated) name to be seen by the user.
* @return the user visible (and translated) name to be seen by the user.
*/
QString name() const;
/**
* return the non-visible name of the family the default shape belongs to.
* @return the family name.
*/
QString family() const;
/// lower prio means the shape is more generic and will be checked later
int loadingPriority() const;
/**
* The list of namespaces to the supported elements the factory supports.
*/
QList<QPair<QString, QStringList> > odfElements() const;
/// returns true if this shapeFactory is able to load the ODF type
/// started at argument element. ('draw:line' / 'draw:frame' / etc)
virtual bool supports(const KoXmlElement &element, KoShapeLoadingContext &context) const = 0;
/**
* The hidden boolean requests if the shape should be hidden in the
* shape selector or shown with all its templates.
* The default is false
* @see setHidden()
*/
bool hidden() const;
/**
* This method is called whenever there is a new document resource
* manager that is created. The factory may reimplement this in
* order to get existing resources or put factory specific resources in.
* In case the factory creates new resources it is adviced to parent
* them to the manager (which is a QObject) for memory management
* purposes.
*
* FIXME: this method is only used by Tables. We should refactor so
* it is no longer necessary.
*
* NOTE: this actually is also used somehow to create the imagecollection
* for the picture shape?
*
* NOTE: we store the documentmanagers in a list, and remove them
* from the list on delete.
*
* @param manager the new manager
*/
virtual void newDocumentResourceManager(KoDocumentResourceManager *manager) const;
/**
* This method should be implemented by factories to create a shape that the user
* gets when doing a base insert. For example from a script. The created shape
* should have its values set to good defaults that the user can then adjust further if
* needed. Including the KoShape:setShapeId(), with the Id from this factory
* The default shape position is not relevant, it will be moved by the caller.
* @param documentResources the resources manager that has all the document wide
* resources which can be used to create the object.
* @return a new shape
* @see createShape() newDocumentResourceManager()
*/
virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
/**
* This method should be implemented by factories to create a shape based on a set of
* properties that are specifically made for this shape-type.
* This method should also set this factories shapeId on the shape using KoShape::setShapeId()
* The default implementation just ignores 'params' and calls createDefaultShape()
* @return a new shape
* @param params the parameters to use when creating the shape
* @param documentResources the resources manager that has all the document wide
* resources which can be used to create the object.
* @see createDefaultShape() newDocumentResourceManager() addTemplate()
* @see KoShapeTemplate::properties
*/
virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
/**
* This method provides the default implementation for creating a shape
* from a specified xml element of an odf document.
* Most derived factories do not need to reimplement this method, however if a factory
* has some special requirements or does something special it is still possible.
* One example is creating different shapes depending on the content of the passed
* xml element.
*/
virtual KoShape *createShapeFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
protected:
/**
* Add a template with the properties of a specific type of shape this factory can generate
* using the createShape() method. The factory will take ownership of the properties object
* to which the member @p properties of @p params points to and destroy it only in its own destructor.
* @param params the new template this factory knows to produce
*/
void addTemplate(const KoShapeTemplate &params);
/**
* Set the tooltip to be used for a selector of shapes
* @param tooltip the tooltip
*/
void setToolTip(const QString &tooltip);
/**
* Set an icon to be used in a selector of shapes
* @param iconName the basename (without extension) of the icon
*/
void setIconName(const char *iconName);
/**
* Set the family name of the default shape
* @param family the family name of the default shape this factory creates.
* for example "funny", "arrows", "geometrics". Use "" for default
*/
void setFamily(const QString &family);
/**
* Set the loading priority for this icon; higher priority means
* the shape is more specific which means it will be earlier in
* the queue to try loading a particular odf element.
*/
void setLoadingPriority(int priority);
/**
* Set the namespace and element tags used for quick checking whether this shapefactory
* is able to create a shape from xml identified by this element
* name.
*
* @param nameSpace the ODF name space (like
* urn:oasis:names:tc:opendocument:xmlns:text:1.0,
* take it from KoXmlNS.h)
* @param elementNames the name of the element itself, like "path"
*
*/
void setXmlElementNames(const QString &nameSpace, const QStringList &elementNames);
/**
* Set the namespaces and according element tags used for quick checking whether this shapefactory
* is able to create a shape from xml identified by this element
* name.
*
* @param elementNamesList containing a list of namespace (like
* urn:oasis:names:tc:opendocument:xmlns:text:1.0,
* take it from KoXmlNS.h) to a list of elementName of the element itself, like "path"
*/
void setXmlElements(const QList<QPair<QString, QStringList> > &elementNamesList);
/**
* The hidden boolean requests if the shape should be hidden in the
* shape selector or shown with all its templates.
* The default is false
* @see hidden()
*/
void setHidden(bool hidden);
private:
void getDeferredPlugin();
private Q_SLOTS:
/// called whenever a document KoDocumentResourceManager is deleted
void pruneDocumentResourceManager(QObject *);
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/KoShapeGroup.h b/libs/flake/KoShapeGroup.h
index acd5814669..ffb859c6b1 100644
--- a/libs/flake/KoShapeGroup.h
+++ b/libs/flake/KoShapeGroup.h
@@ -1,93 +1,93 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEGROUP_H
#define KOSHAPEGROUP_H
#include "KoShapeContainer.h"
#include <QList>
#include "kritaflake_export.h"
class KoShapeSavingContext;
class KoShapeLoadingContext;
class KoShapeGroupPrivate;
/**
* Provide grouping for shapes.
* The group shape allows you to add children which will then be grouped in selections
* and actions.
* <p>If you have a set of shapes that together make up a bigger shape it is often
* useful to group them together so the user will perceive the different shapes as
* actually being one. This means that if the user clicks on one shape, all shapes
* in the group will be selected at once, making the tools that works on
* selections alter all of them at the same time.
*
* <p>Note that while this object is also a shape, it is not actually visible and the user
* can't interact with it.
*
* <p>WARNING: this class is NOT threadsafe, it caches the size in an unsafe way
*/
class KRITAFLAKE_EXPORT KoShapeGroup : public KoShapeContainer
{
public:
/// Constructor
KoShapeGroup();
/// destructor
- virtual ~KoShapeGroup();
+ ~KoShapeGroup() override;
KoShape* cloneShape() const override;
/// This implementation is empty since a group is itself not visible.
- virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
/// always returns false since the group itself can't be selected or hit
- virtual bool hitTest(const QPointF &position) const;
+ bool hitTest(const QPointF &position) const override;
QSizeF size() const override;
void setSize(const QSizeF &size) override;
QRectF outlineRect() const override;
/// a group's boundingRect
QRectF boundingRect() const override;
/// reimplemented from KoShape
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
private:
friend class ShapeGroupContainerModel;
/**
* @brief Invalidate the size cache of the group
*
* The group shape caches the size of itself as it can be quite expensive to recalculate
* the size if there are a lot of subshapes. This function is called when the cache needs
* to be invalidated.
*/
void invalidateSizeCache();
private:
KoShapeGroup(const KoShapeGroup &rhs);
private:
- virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
+ void shapeChanged(ChangeType type, KoShape *shape = 0) override;
Q_DECLARE_PRIVATE(KoShapeGroup)
};
#endif
diff --git a/libs/flake/KoShapeLayer.h b/libs/flake/KoShapeLayer.h
index 9625122c67..4f1fa6a800 100644
--- a/libs/flake/KoShapeLayer.h
+++ b/libs/flake/KoShapeLayer.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __KOSHAPELAYER_H__
#define __KOSHAPELAYER_H__
#include "KoShapeContainer.h"
#include "kritaflake_export.h"
class KoShapeLayerPrivate;
/**
* Provides arranging shapes into layers.
* This makes it possible to have a higher key of a number of objects
* in a document.
* A layer is always invisible and unselectable.
*/
class KRITAFLAKE_EXPORT KoShapeLayer : public KoShapeContainer
{
public:
/// The default constructor
KoShapeLayer();
/**
* Constructor with custom model
* @param model the custom modem
*/
explicit KoShapeLayer(KoShapeContainerModel *model);
/**
* Empty implementation, as the layer itself is not visible
*/
- virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
- virtual bool hitTest(const QPointF &position) const;
- virtual QRectF boundingRect() const;
- virtual void saveOdf(KoShapeSavingContext & context) const;
- virtual bool loadOdf(const KoXmlElement & element, KoShapeLoadingContext &context);
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
+ bool hitTest(const QPointF &position) const override;
+ QRectF boundingRect() const override;
+ void saveOdf(KoShapeSavingContext & context) const override;
+ bool loadOdf(const KoXmlElement & element, KoShapeLoadingContext &context) override;
private:
Q_DECLARE_PRIVATE(KoShapeLayer)
};
#endif // __KOSHAPELAYER_H__
diff --git a/libs/flake/KoShapeManager.h b/libs/flake/KoShapeManager.h
index 20bdc199e0..41042c4cab 100644
--- a/libs/flake/KoShapeManager.h
+++ b/libs/flake/KoShapeManager.h
@@ -1,215 +1,215 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEMANAGER_H
#define KOSHAPEMANAGER_H
#include <QList>
#include <QObject>
#include <QSet>
#include "KoFlake.h"
#include "kritaflake_export.h"
class KoShape;
class KoSelection;
class KoViewConverter;
class KoCanvasBase;
class KoPointerEvent;
class KoShapePaintingContext;
class QPainter;
class QPointF;
class QRectF;
/**
* The shape manager hold a list of all shape which are in scope.
* There is one shape manager per canvas. This makes the shape manager
* different from QGraphicsScene, which contains the datamodel for all
* graphics items: KoShapeManager only contains the subset of shapes
* that are shown in its canvas.
*
* The selection in the different views can be different.
*/
class KRITAFLAKE_EXPORT KoShapeManager : public QObject
{
Q_OBJECT
public:
/// enum for add()
enum Repaint {
PaintShapeOnAdd, ///< Causes each shapes 'update()' to be called after being added to the shapeManager
AddWithoutRepaint ///< Avoids each shapes 'update()' to be called for faster addition when its possible.
};
/**
* Constructor.
*/
explicit KoShapeManager(KoCanvasBase *canvas);
/**
* Constructor that takes a list of shapes, convenience version.
* @param shapes the shapes to start out with, see also setShapes()
* @param canvas the canvas this shape manager is working on.
*/
KoShapeManager(KoCanvasBase *canvas, const QList<KoShape *> &shapes);
- virtual ~KoShapeManager();
+ ~KoShapeManager() override;
/**
* Remove all previously owned shapes and make the argument list the new shapes
* to be managed by this manager.
* @param shapes the new shapes to manage.
* @param repaint if true it will trigger a repaint of the shapes
*/
void setShapes(const QList<KoShape *> &shapes, Repaint repaint = PaintShapeOnAdd);
/// returns the list of maintained shapes
QList<KoShape*> shapes() const;
/**
* Get a list of all shapes that don't have a parent.
*/
QList<KoShape*> topLevelShapes() const;
public Q_SLOTS:
/**
* Add a KoShape to be displayed and managed by this manager.
* This will trigger a repaint of the shape.
* @param shape the shape to add
* @param repaint if true it will trigger a repaint of the shape
*/
void addShape(KoShape *shape, KoShapeManager::Repaint repaint = PaintShapeOnAdd);
/**
* Remove a KoShape from this manager
* @param shape the shape to remove
*/
void remove(KoShape *shape);
public:
/// return the selection shapes for this shapeManager
KoSelection *selection() const;
/**
* Paint all shapes and their selection handles etc.
* @param painter the painter to paint to.
* @param forPrint if true, make sure only actual content is drawn and no decorations.
* @param converter to convert between document and view coordinates.
*/
void paint(QPainter &painter, const KoViewConverter &converter, bool forPrint);
/**
* Returns the shape located at a specific point in the document.
* If more than one shape is located at the specific point, the given selection type
* controls which of them is returned.
* @param position the position in the document coordinate system.
* @param selection controls which shape is returned when more than one shape is at the specific point
* @param omitHiddenShapes if true, only visible shapes are considered
*/
KoShape *shapeAt(const QPointF &position, KoFlake::ShapeSelection selection = KoFlake::ShapeOnTop, bool omitHiddenShapes = true);
/**
* Returns the shapes which intersects the specific rect in the document.
* @param rect the rectangle in the document coordinate system.
* @param omitHiddenShapes if true, only visible shapes are considered
*/
QList<KoShape *> shapesAt(const QRectF &rect, bool omitHiddenShapes = true, bool containedMode = false);
/**
* Request a repaint to be queued.
* The repaint will be restricted to the parameters rectangle, which is expected to be
* in points (the document coordinates system of KoShape) and it is expected to be
* normalized and based in the global coordinates, not any local coordinates.
* <p>This method will return immediately and only request a repaint. Successive calls
* will be merged into an appropriate repaint action.
* @param rect the rectangle (in pt) to queue for repaint.
* @param shape the shape that is going to be redrawn; only needed when selectionHandles=true
* @param selectionHandles if true; find out if the shape is selected and repaint its
* selection handles at the same time.
*/
void update(QRectF &rect, const KoShape *shape = 0, bool selectionHandles = false);
/**
* Update the tree for finding the shapes.
* This will remove the shape from the tree and will reinsert it again.
* The update to the tree will be posponed until it is needed so that successive calls
* will be merged into one.
* @param shape the shape to updated its position in the tree.
*/
void notifyShapeChanged(KoShape *shape);
/**
* Paint a shape
*
* @param shape the shape to paint
* @param painter the painter to paint to.
* @param converter to convert between document and view coordinates.
*/
static void paintShape(KoShape *shape, QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
/**
* @brief renderSingleShape renders a shape on \p painter. This method includes all the
* needed steps for painting a single shape: setting transformations, clipping and masking.
*/
static void renderSingleShape(KoShape *shape, QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
/**
* A special interface for KoShape to use during shape destruction. Don't use this
* interface directly unless you are KoShape.
*/
struct ShapeInterface {
ShapeInterface(KoShapeManager *_q);
/**
* Called by a shape when it is destructed. Please note that you cannot access
* any shape's method type or information during this call because the shape might be
* semi-destroyed.
*/
void notifyShapeDestructed(KoShape *shape);
protected:
KoShapeManager *q;
};
ShapeInterface* shapeInterface();
Q_SIGNALS:
/// emitted when the selection is changed
void selectionChanged();
/// emitted when an object in the selection is changed (moved/rotated etc)
void selectionContentChanged();
/// emitted when any object changed (moved/rotated etc)
void contentChanged();
/// emitted when any shape changed.
void shapeChanged(KoShape *);
private:
KoCanvasBase *canvas();
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void updateTree())
};
#endif
diff --git a/libs/flake/KoShapeOdfSaveHelper.h b/libs/flake/KoShapeOdfSaveHelper.h
index 459682b89c..f26f9afdcc 100644
--- a/libs/flake/KoShapeOdfSaveHelper.h
+++ b/libs/flake/KoShapeOdfSaveHelper.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEODFSAVEHELPER_H
#define KOSHAPEODFSAVEHELPER_H
#include "KoDragOdfSaveHelper.h"
#include "kritaflake_export.h"
#include <QList>
class KoShape;
class KoShapeOdfSaveHelperPrivate;
/**
* Save helper for saving shapes to odf.
*
* The shapes are saved in an office:text document.
*/
class KRITAFLAKE_EXPORT KoShapeOdfSaveHelper : public KoDragOdfSaveHelper
{
public:
/**
* Constructor
*
* @param shapes The list of shapes to save. If the shapes contain
* children these are also saved.
*/
explicit KoShapeOdfSaveHelper(const QList<KoShape *> &shapes);
/// reimplemented
- virtual bool writeBody();
+ bool writeBody() override;
private:
Q_DECLARE_PRIVATE(KoShapeOdfSaveHelper)
};
#endif /* KOSHAPEODFSAVEHELPER_H */
diff --git a/libs/flake/KoShapeRegistry.h b/libs/flake/KoShapeRegistry.h
index 8f20c80b4f..5465a6d5fe 100644
--- a/libs/flake/KoShapeRegistry.h
+++ b/libs/flake/KoShapeRegistry.h
@@ -1,86 +1,86 @@
/* This file is part of the KDE project
* Copyright (c) 2006 Boudewijn Rempt (boud@valdyas.org)
* Copyright (C) 2006, 2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEREGISTRY_H
#define KOSHAPEREGISTRY_H
#include <KoGenericRegistry.h>
#include <KoShapeFactoryBase.h>
#include <KoXmlReaderForward.h>
#include "kritaflake_export.h"
class KoShape;
class KoShapeLoadingContext;
/**
* This singleton class keeps a register of all available flake shapes,
* or rather, of the factories that applications can use to create flake
* shape objects.
*/
class KRITAFLAKE_EXPORT KoShapeRegistry : public KoGenericRegistry<KoShapeFactoryBase*>
{
public:
KoShapeRegistry();
- virtual ~KoShapeRegistry();
+ ~KoShapeRegistry() override;
/**
* Return an instance of the KoShapeRegistry
* Creates an instance if that has never happened before and returns the singleton instance.
*/
static KoShapeRegistry *instance();
/**
* Add shape factory for a shape that is not a plugin
* This can be used also if you want to have a shape only in one application
*
* @param factory The factory of the shape
*/
void addFactory(KoShapeFactoryBase *factory);
/**
* Use the element to find out which flake plugin can load it, and
* returns the loaded shape. The element expected is one of
* 'draw:line', 'draw:frame' / etc.
*
* @returns the shape or 0 if no shape could be created. The shape may have as its parent
* set a layer which was previously created and stored in the context.
* @see KoShapeLoadingContext::layer()
*/
KoShape *createShapeFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context) const;
/**
* Returns a list of shape factories supporting the specified xml element.
* @param nameSpace the namespace of the xml element, see KoXmlNS for valid namespaces
* @param elementName the tag name of the element
* @return the list of shape factories supporting the specified xml element
*/
QList<KoShapeFactoryBase*> factoriesForElement(const QString &nameSpace, const QString &elementName);
private:
KoShapeRegistry(const KoShapeRegistry&);
KoShapeRegistry operator=(const KoShapeRegistry&);
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/KoShapeStroke.h b/libs/flake/KoShapeStroke.h
index 56f2945f22..cce7baf9ab 100644
--- a/libs/flake/KoShapeStroke.h
+++ b/libs/flake/KoShapeStroke.h
@@ -1,120 +1,120 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2007,2009 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPESTROKE_H
#define KOSHAPESTROKE_H
#include "KoFlakeTypes.h"
#include "KoShapeStrokeModel.h"
#include "kritaflake_export.h"
#include <QMetaType>
#include <QColor>
class KoShape;
class QPainter;
class QBrush;
class KoViewConverter;
struct KoInsets;
/**
* A border for shapes that draws a single line around the object.
*/
class KRITAFLAKE_EXPORT KoShapeStroke : public KoShapeStrokeModel
{
public:
/// Constructor for a thin line in black
KoShapeStroke();
/// Copy constructor
KoShapeStroke(const KoShapeStroke &other);
/**
* Constructor for a Stroke
* @param lineWidth the width, in pt
* @param color the color we draw the outline in.
*/
explicit KoShapeStroke(qreal lineWidth, const QColor &color = Qt::black);
- virtual ~KoShapeStroke();
+ ~KoShapeStroke() override;
/// Assignment operator
KoShapeStroke& operator = (const KoShapeStroke &rhs);
/// Sets the lines cap style
void setCapStyle(Qt::PenCapStyle style);
/// Returns the lines cap style
Qt::PenCapStyle capStyle() const;
/// Sets the lines join style
void setJoinStyle(Qt::PenJoinStyle style);
/// Returns the lines join style
Qt::PenJoinStyle joinStyle() const;
/// Sets the line width
void setLineWidth(qreal lineWidth);
/// Returns the line width
qreal lineWidth() const;
/// Sets the miter limit
void setMiterLimit(qreal miterLimit);
/// Returns the miter limit
qreal miterLimit() const;
/// Sets the line style
void setLineStyle(Qt::PenStyle style, const QVector<qreal> &dashes);
/// Returns the line style
Qt::PenStyle lineStyle() const;
/// Returns the line dashes
QVector<qreal> lineDashes() const;
/// Sets the dash offset
void setDashOffset(qreal dashOffset);
/// Returns the dash offset
qreal dashOffset() const;
/// Returns the color
QColor color() const;
/// Sets the color
void setColor(const QColor &color);
/// Sets the strokes brush used to fill strokes of this border
void setLineBrush(const QBrush & brush);
/// Returns the strokes brush
QBrush lineBrush() const;
// pure virtuals from KoShapeStrokeModel implemented here.
- virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
- virtual void strokeInsets(const KoShape *shape, KoInsets &insets) const;
- virtual qreal strokeMaxMarkersInset(const KoShape *shape) const;
- virtual bool hasTransparency() const;
- virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter);
-
- virtual bool compareFillTo(const KoShapeStrokeModel *other);
- virtual bool compareStyleTo(const KoShapeStrokeModel *other);
- virtual bool isVisible() const;
+ void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const override;
+ void strokeInsets(const KoShape *shape, KoInsets &insets) const override;
+ qreal strokeMaxMarkersInset(const KoShape *shape) const override;
+ bool hasTransparency() const override;
+ void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter) override;
+
+ bool compareFillTo(const KoShapeStrokeModel *other) override;
+ bool compareStyleTo(const KoShapeStrokeModel *other) override;
+ bool isVisible() const override;
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE( KoShapeStroke )
#endif // KOSHAPESTROKE_H
diff --git a/libs/flake/KoShapeUserData.h b/libs/flake/KoShapeUserData.h
index edde53f9ea..b4a5b95198 100644
--- a/libs/flake/KoShapeUserData.h
+++ b/libs/flake/KoShapeUserData.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEUSERDATA_H
#define KOSHAPEUSERDATA_H
#include <QObject>
#include "kritaflake_export.h"
/**
* The KoShapeUserData class is used to associate custom data with a shape.
*
* KoShapeUserData provides an abstract interface for container classes
* that are used to associate application-specific user data with shapes in KoShape
* Generally, subclasses of this class provide functions to allow data to
* be stored and retrieved, and instances are attached to KoShape using
* KoShape::setUserData(). This makes it possible to store additional data per
* shape in a way that allows applications to not know the implementation of a
* specific KoShape extending class.
*
* Each subclass should provide a reimplementation of the destructor to ensure that
* any private data is automatically cleaned up when user data objects are deleted.
*
* Please note that this object is a QObject to allow a
* <code>qobject_cast<MyData*> (shape->userData())</code> to work which is useful in an environment
* where classes from plugins may not be castable using a static_cast or a dynamic_cast
*/
class KRITAFLAKE_EXPORT KoShapeUserData : public QObject
{
Q_OBJECT
public:
/// Constructor
explicit KoShapeUserData(QObject *parent = 0);
- virtual ~KoShapeUserData();
+ ~KoShapeUserData() override;
virtual KoShapeUserData* clone() const = 0;
protected:
KoShapeUserData(const KoShapeUserData &rhs);
};
#endif
diff --git a/libs/flake/KoSnapStrategy.h b/libs/flake/KoSnapStrategy.h
index 02d60bb429..3102755294 100644
--- a/libs/flake/KoSnapStrategy.h
+++ b/libs/flake/KoSnapStrategy.h
@@ -1,144 +1,144 @@
/* This file is part of the KDE project
* Copyright (C) 2008-2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSNAPSTRATEGY_H
#define KOSNAPSTRATEGY_H
#include "KoSnapGuide.h"
#include <QLineF>
class TestSnapStrategy;
class KoPathPoint;
class KoSnapProxy;
class KoViewConverter;
class QTransform;
class QPainterPath;
class KRITAFLAKE_EXPORT KoSnapStrategy
{
public:
KoSnapStrategy(KoSnapGuide::Strategy type);
virtual ~KoSnapStrategy() {};
virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) = 0;
/// returns the strategies type
KoSnapGuide::Strategy type() const;
static qreal squareDistance(const QPointF &p1, const QPointF &p2);
static qreal scalarProduct(const QPointF &p1, const QPointF &p2);
/// returns the snapped position form the last call to snapToPoints
QPointF snappedPosition() const;
/// returns the current snap strategy decoration
virtual QPainterPath decoration(const KoViewConverter &converter) const = 0;
protected:
/// sets the current snapped position
void setSnappedPosition(const QPointF &position);
private:
KoSnapGuide::Strategy m_snapType;
QPointF m_snappedPosition;
};
/// snaps to x- or y-coordinates of path points
class KRITAFLAKE_EXPORT OrthogonalSnapStrategy : public KoSnapStrategy
{
public:
OrthogonalSnapStrategy();
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- virtual QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
private:
QLineF m_hLine;
QLineF m_vLine;
};
/// snaps to path points
class KRITAFLAKE_EXPORT NodeSnapStrategy : public KoSnapStrategy
{
public:
NodeSnapStrategy();
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- virtual QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
};
/// snaps extension lines of path shapes
class KRITAFLAKE_EXPORT ExtensionSnapStrategy : public KoSnapStrategy
{
friend class TestSnapStrategy;
public:
ExtensionSnapStrategy();
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- virtual QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
private:
qreal project(const QPointF &lineStart , const QPointF &lineEnd, const QPointF &point);
QPointF extensionDirection(KoPathPoint * point, const QTransform &matrix);
bool snapToExtension(QPointF &position, KoPathPoint * point, const QTransform &matrix);
QList<QLineF> m_lines;
};
/// snaps to intersections of shapes
class KRITAFLAKE_EXPORT IntersectionSnapStrategy : public KoSnapStrategy
{
public:
IntersectionSnapStrategy();
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- virtual QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
};
/// snaps to the canvas grid
class KRITAFLAKE_EXPORT GridSnapStrategy : public KoSnapStrategy
{
public:
GridSnapStrategy();
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- virtual QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
};
/// snaps to shape bounding boxes
class KRITAFLAKE_EXPORT BoundingBoxSnapStrategy : public KoSnapStrategy
{
friend class TestSnapStrategy;
public:
BoundingBoxSnapStrategy();
- virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- virtual QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
private:
qreal squareDistanceToLine(const QPointF &lineA, const QPointF &lineB, const QPointF &point, QPointF &pointOnLine);
QPointF m_boxPoints[5];
};
// KoGuidesData has been moved into Krita. Please port this class!
//
/// snaps to line guides
// class KRITAFLAKE_EXPORT LineGuideSnapStrategy : public KoSnapStrategy
// {
// public:
// LineGuideSnapStrategy();
// virtual bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
// virtual QPainterPath decoration(const KoViewConverter &converter) const;
// private:
// int m_orientation;
// };
#endif // KOSNAPSTRATEGY_H
diff --git a/libs/flake/KoTextShapeDataBase.h b/libs/flake/KoTextShapeDataBase.h
index e217ff7875..14236e49fc 100644
--- a/libs/flake/KoTextShapeDataBase.h
+++ b/libs/flake/KoTextShapeDataBase.h
@@ -1,145 +1,145 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAPEDATABASE_H
#define KOTEXTSHAPEDATABASE_H
#include "kritaflake_export.h"
#include "KoShapeUserData.h"
class KoTextShapeDataBasePrivate;
class KoXmlElement;
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoGenStyle;
struct KoInsets;
class QTextDocument;
/**
* \internal
*/
class KRITAFLAKE_EXPORT KoTextShapeDataBase : public KoShapeUserData
{
Q_OBJECT
public:
/// constructor
KoTextShapeDataBase();
- virtual ~KoTextShapeDataBase();
+ ~KoTextShapeDataBase() override;
/// return the document
QTextDocument *document() const;
/**
* Set the margins that will make the shapes text area smaller.
* The shape that owns this textShapeData object will layout text in an area
* confined by the shape size made smaller by the margins set here.
* @param margins the margins that shrink the text area.
*/
void setShapeMargins(const KoInsets &margins);
/**
* returns the currently set margins for the shape.
*/
KoInsets shapeMargins() const;
/**
* Load the text from ODF.
*/
virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) = 0;
/**
* Save the text to ODF.
*/
virtual void saveOdf(KoShapeSavingContext &context, int from = 0, int to = -1) const = 0;
/**
* Load the style of the element
*
* This method is used to load the style in case the TextShape is used as TOS. In this case
* the paragraph style of the shape e.g. a custom-shape needs to be applied before we load the
* text so all looks as it should look.
*/
virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context) = 0;
/**
* Save the style of the element
*
* This method save the style in case the TextShape is used as TOS. In this case the paragraph
* style of the shape e.g. a custom-shape needs to be saved with the style of the shape.
*/
virtual void saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const = 0;
/** Sets the vertical alignment of all the text inside the shape. */
void setVerticalAlignment(Qt::Alignment alignment);
/** Returns the vertical alignment of all the text in the shape */
Qt::Alignment verticalAlignment() const;
/**
* Enum to describe the text document's automatic resizing behaviour.
*/
enum ResizeMethod {
/// Resize the shape to fit the content. This makes sure that the text shape takes op
/// only as much space as absolutely necessary to fit the entire text into its boundaries.
AutoResize,
/// Specifies whether or not to automatically increase the width of the drawing object
/// if text is added to fit the entire width of the text into its boundaries.
/// Compared to AutoResize above this only applied to the width whereas the height is
/// not resized. Also this only grows but does not shrink again if text is removed again.
AutoGrowWidth,
/// Specifies whether or not to automatically increase the height of the drawing object
/// if text is added to fit the entire height of the text into its boundaries.
AutoGrowHeight,
/// This combines the AutoGrowWidth and AutoGrowHeight and automatically increase width
/// and height to fit the entire text into its boundaries.
AutoGrowWidthAndHeight,
/// Shrink the content displayed within the shape to match into the shape's boundaries. This
/// will scale the content down as needed to display the whole document.
ShrinkToFitResize,
/// Deactivates auto-resizing. This is the default resizing method.
NoResize
};
/**
* Specifies how the document should be resized upon a change in the document.
*
* If auto-resizing is turned on, text will not be wrapped unless enforced by e.g. a newline.
*
* By default, NoResize is set.
*/
void setResizeMethod(ResizeMethod method);
/**
* Returns the auto-resizing mode. By default, this is NoResize.
*
* @see setResizeMethod
*/
ResizeMethod resizeMethod() const;
protected:
/// constructor
KoTextShapeDataBase(KoTextShapeDataBasePrivate *);
KoTextShapeDataBasePrivate *d_ptr;
private:
Q_DECLARE_PRIVATE(KoTextShapeDataBase)
};
#endif
diff --git a/libs/flake/KoToolBase.h b/libs/flake/KoToolBase.h
index b19b815840..8d300c9105 100644
--- a/libs/flake/KoToolBase.h
+++ b/libs/flake/KoToolBase.h
@@ -1,539 +1,539 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTOOLBASE_H
#define KOTOOLBASE_H
#include <QObject>
#include <QPointer>
#include <QSet>
#include <QList>
#include <QHash>
#include "kritaflake_export.h"
class KoShape;
class KoCanvasBase;
class KoPointerEvent;
class KoViewConverter;
class KoToolSelection;
class KoToolBasePrivate;
class KoShapeBasedDocumentBase;
class QAction;
class QKeyEvent;
class QWidget;
class QCursor;
class QPainter;
class QString;
class QStringList;
class QRectF;
class QPointF;
class QInputMethodEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;
class QTouchEvent;
class QMenu;
/**
* Abstract base class for all tools. Tools can create or manipulate
* flake shapes, canvas state or any other thing that a user may wish
* to do to his document or his view on a document with a pointing
* device.
*
* There exists an instance of every tool for every pointer device.
* These instances are managed by the toolmanager..
*/
class KRITAFLAKE_EXPORT KoToolBase : public QObject
{
Q_OBJECT
public:
/// Option for activate()
enum ToolActivation {
TemporaryActivation, ///< The tool is activated temporarily and works 'in-place' of another one.
DefaultActivation ///< The tool is activated normally and emitting 'done' goes to the defaultTool
};
/**
* Constructor, normally only called by the factory (see KoToolFactoryBase)
* @param canvas the canvas interface this tool will work for.
*/
explicit KoToolBase(KoCanvasBase *canvas);
- virtual ~KoToolBase();
+ ~KoToolBase() override;
/**
* connect the tool to the new shapecontroller. Old connections are removed.
*
* @param shapeController the new shape controller
*/
void updateShapeController(KoShapeBasedDocumentBase *shapeController);
/**
* request a repaint of the decorations to be made. This triggers
* an update call on the canvas, but does not paint directly.
*/
virtual void repaintDecorations();
/**
* Return if dragging (moving with the mouse down) to the edge of a canvas should scroll the
* canvas (default is true).
* @return if this tool wants mouse events to cause scrolling of canvas.
*/
virtual bool wantsAutoScroll() const;
/**
* Called by the canvas to paint any decorations that the tool deems needed.
* The painter has the top left of the canvas as its origin.
* @param painter used for painting the shape
* @param converter to convert between internal and view coordinates.
*/
virtual void paint(QPainter &painter, const KoViewConverter &converter) = 0;
/**
* Return the option widgets for this tool. Create them if they
* do not exist yet. If the tool does not have an option widget,
* this method return an empty list. (After discussion with Thomas, who prefers
* the toolmanager to handle that case.)
*
* @see m_optionWidgets
*/
QList<QPointer<QWidget> > optionWidgets();
/**
* Retrieves the entire collection of actions for the tool.
*/
QHash<QString, QAction *> actions() const;
/**
* Retrieve an action by name.
*/
QAction *action(const QString &name) const;
/**
* Called when (one of) the mouse or stylus buttons is pressed.
* Implementors should call event->ignore() if they do not actually use the event.
* @param event state and reason of this mouse or stylus press
*/
virtual void mousePressEvent(KoPointerEvent *event) = 0;
/**
* Called when (one of) the mouse or stylus buttons is double clicked.
* Implementors should call event->ignore() if they do not actually use the event.
* Default implementation ignores this event.
* @param event state and reason of this mouse or stylus press
*/
virtual void mouseDoubleClickEvent(KoPointerEvent *event);
/**
* Called when (one of) the mouse or stylus buttons is triple clicked.
* Implementors should call event->ignore() if they do not actually use the event.
* Default implementation ignores this event.
* @param event state and reason of this mouse or stylus press
*/
virtual void mouseTripleClickEvent(KoPointerEvent *event);
/**
* Called when the mouse or stylus moved over the canvas.
* Implementors should call event->ignore() if they do not actually use the event.
* @param event state and reason of this mouse or stylus move
*/
virtual void mouseMoveEvent(KoPointerEvent *event) = 0;
/**
* Called when (one of) the mouse or stylus buttons is released.
* Implementors should call event->ignore() if they do not actually use the event.
* @param event state and reason of this mouse or stylus release
*/
virtual void mouseReleaseEvent(KoPointerEvent *event) = 0;
/**
* Called when a key is pressed.
* Implementors should call event->ignore() if they do not actually use the event.
* Default implementation ignores this event.
* @param event state and reason of this key press
*/
virtual void keyPressEvent(QKeyEvent *event);
/**
* Called when a key is released
* Implementors should call event->ignore() if they do not actually use the event.
* Default implementation ignores this event.
* @param event state and reason of this key release
*/
virtual void keyReleaseEvent(QKeyEvent *event);
/**
* Called when the scrollwheel is used
* Implementors should call event->ignore() if they do not actually use the event
* @param event state of this wheel event
*/
virtual void wheelEvent(KoPointerEvent *event);
virtual void touchEvent(QTouchEvent *event);
/**
* @brief explicitUserStrokeEndRequest is called by the input manager
* when the user presses Enter key or any equivalent. This callback
* comes before requestStrokeEnd(), which comes from a different source.
*/
virtual void explicitUserStrokeEndRequest();
/**
* This method is used to query a set of properties of the tool to be
* able to support complex input method operations as support for surrounding
* text and reconversions.
* Default implementation returns simple defaults, for tools that want to provide
* a more responsive text entry experience for CJK languages it would be good to reimplemnt.
* @param query specifies which property is queried.
* @param converter the view converter for the current canvas.
*/
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const;
/**
* Text entry of complex text, like CJK, can be made more interactive if a tool
* implements this and the InputMethodQuery() methods.
* Reimplementing this only provides the user with a more responsive text experience, since the
* default implementation forwards the typed text as key pressed events.
* @param event the input method event.
*/
virtual void inputMethodEvent(QInputMethodEvent *event);
/**
* @return true if synthetic mouse events on the canvas should be eaten.
*
* For example, the guides tool should allow click and drag with touch,
* while the same touch events should be rejected by the freehand tool.
*
* These events are sent by the OS in Windows
*/
bool maskSyntheticEvents() const;
/**
* @return true if the tool will accept raw QTouchEvents.
*/
virtual bool wantsTouch() const;
/**
* Set the identifier code from the KoToolFactoryBase that created this tool.
* @param id the identifier code
* @see KoToolFactoryBase::id()
*/
void setToolId(const QString &id);
/**
* get the identifier code from the KoToolFactoryBase that created this tool.
* @return the toolId.
* @see KoToolFactoryBase::id()
*/
Q_INVOKABLE QString toolId() const;
/// return the last emitted cursor
QCursor cursor() const;
/**
* Returns the internal selection object of this tool.
* Each tool can have a selection which is private to that tool and the specified shape that it comes with.
* The default returns 0.
*/
virtual KoToolSelection *selection();
/**
* @returns true if the tool has selected data.
*/
virtual bool hasSelection();
/**
* copies the tools selection to the clipboard.
* The default implementation is empty to aid tools that don't have any selection.
* @see selection()
*/
virtual void copy() const;
/**
* Delete the tools selection.
* The default implementation is empty to aid tools that don't have any selection.
* @see selection()
*/
virtual void deleteSelection();
/**
* Cut the tools selection and copy it to the clipboard.
* The default implementation calls copy() and then deleteSelection()
* @see copy()
* @see deleteSelection()
*/
virtual void cut();
/**
* Paste the clipboard selection.
* A tool typically has one or more shapes selected and pasting should do something meaningful
* for this specific shape and tool combination. Inserting text in a text tool, for example.
* @return will return true if pasting succeeded. False if nothing happened.
*/
virtual bool paste();
/**
* Handle the dragMoveEvent
* A tool typically has one or more shapes selected and dropping into should do
* something meaningful for this specific shape and tool combination. For example
* dropping text in a text tool.
* The tool should Accept the event if it is meaningful; Default implementation does not.
*/
virtual void dragMoveEvent(QDragMoveEvent *event, const QPointF &point);
/**
* Handle the dragLeaveEvent
* Basically just a noticification that the drag is no long relevant
* The tool should Accept the event if it is meaningful; Default implementation does not.
*/
virtual void dragLeaveEvent(QDragLeaveEvent *event);
/**
* Handle the dropEvent
* A tool typically has one or more shapes selected and dropping into should do
* something meaningful for this specific shape and tool combination. For example
* dropping text in a text tool.
* The tool should Accept the event if it is meaningful; Default implementation does not.
*/
virtual void dropEvent(QDropEvent *event, const QPointF &point);
/**
* @return a menu with context-aware actions for the currect selection. If
* the returned value is null, no context menu is shown.
*/
virtual QMenu* popupActionsMenu();
/// Returns the canvas the tool is working on
KoCanvasBase *canvas() const;
/**
* This method can be reimplemented in a subclass.
* @return returns true, if the tool is in text mode. that means, that there is
* any kind of textual input and all single key shortcuts should be eaten.
*/
bool isInTextMode() const;
/**
* Called when the user requested undo while the stroke is
* active. If you tool supports undo of the part of its actions,
* override this method and do the needed work there.
*
* NOTE: Default implementation forwards this request to
* requestStrokeCancellation() method, so that the stroke
* would be cancelled.
*/
virtual void requestUndoDuringStroke();
/**
* Called when the user requested the cancellation of the current
* stroke. If you tool supports cancelling, override this method
* and do the needed work there
*/
virtual void requestStrokeCancellation();
/**
* Called when the image decided that the stroke should better be
* ended. If you tool supports long strokes, override this method
* and do the needed work there
*/
virtual void requestStrokeEnd();
public Q_SLOTS:
/**
* This method is called when this tool instance is activated.
* For any main window there is only one tool active at a time, which then gets all
* user input. Switching between tools will call deactivate on one and activate on the
* new tool allowing the tool to flush items (like a selection)
* when it is not in use.
*
* <p>There is one case where two tools are activated at the same. This is the case
* where one tool delegates work to another temporarily. For example, while shift is
* being held down. The second tool will get activated with temporary=true and
* it should emit done() when the state that activated it is ended.
* <p>One of the important tasks of activate is to call useCursor()
*
* @param shapes the set of shapes that are selected or suggested for editing by a
* selected shape for the tool to work on. Not all shapes will be meant for this
* tool.
* @param toolActivation if TemporaryActivation, this tool is only temporarily actived
* and should emit done when it is done.
* @see deactivate()
*/
virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
/**
* This method is called whenever this tool is no longer the
* active tool
* @see activate()
*/
virtual void deactivate();
/**
* This method is called whenever a property in the resource
* provider associated with the canvas this tool belongs to
* changes. An example is currently selected foreground color.
*/
virtual void canvasResourceChanged(int key, const QVariant &res);
/**
* This method is called whenever a property in the resource
* provider associated with the document this tool belongs to
* changes. An example is the handle radius
*/
virtual void documentResourceChanged(int key, const QVariant &res);
/**
* This method just relays the given text via the tools statusTextChanged signal.
* @param statusText the new status text
*/
void setStatusText(const QString &statusText);
Q_SIGNALS:
/**
* Emitted when this tool wants itself to be replaced by another tool.
*
* @param id the identification of the desired tool
* @see toolId(), KoToolFactoryBase::id()
*/
void activateTool(const QString &id);
/**
* Emitted when this tool wants itself to temporarily be replaced by another tool.
* For instance, a paint tool could desire to be
* temporarily replaced by a pan tool which could be temporarily
* replaced by a colorpicker.
* @param id the identification of the desired tool
*/
void activateTemporary(const QString &id);
/**
* Emitted when the tool has been temporarily activated and wants
* to notify the world that it's done.
*/
void done();
/**
* Emitted by useCursor() when the cursor to display on the canvas is changed.
* The KoToolManager should connect to this signal to handle cursors further.
*/
void cursorChanged(const QCursor &cursor);
/**
* A tool can have a selection that is copy-able, this signal is emitted when that status changes.
* @param hasSelection is true when the tool holds selected data.
*/
void selectionChanged(bool hasSelection);
/**
* Emitted when the tool wants to display a different status text
* @param statusText the new status text
*/
void statusTextChanged(const QString &statusText);
protected:
/**
* Classes inheriting from this one can call this method to signify which cursor
* the tool wants to display at this time. Logical place to call it is after an
* incoming event has been handled.
* @param cursor the new cursor.
*/
void useCursor(const QCursor &cursor);
/**
* Reimplement this if your tool actually has an option widget.
* Sets the option widget to 0 by default.
*/
virtual QWidget *createOptionWidget();
virtual QList<QPointer<QWidget> > createOptionWidgets();
/**
* Add an action under the given name to the collection.
*
* Inserting an action under a name that is already used for another action will replace
* the other action in the collection.
*
* @param name The name by which the action be retrieved again from the collection.
* @param action The action to add.
* @param readWrite set this to ReadOnlyAction to keep the action available on
* read-only documents
*/
void addAction(const QString &name, QAction *action);
/// Convenience function to get the current handle radius
uint handleRadius() const;
/// Convencience function to get the current grab sensitivity
uint grabSensitivity() const;
/**
* Returns a handle grab rect at the given position.
*
* The position is expected to be in document coordinates. The grab sensitivity
* canvas resource is used for the dimension of the rectangle.
*
* @return the handle rectangle in document coordinates
*/
QRectF handleGrabRect(const QPointF &position) const;
/**
* Returns a handle paint rect at the given position.
*
* The position is expected to be in document coordinates. The handle radius
* canvas resource is used for the dimension of the rectangle.
*
* @return the handle rectangle in document coordinates
*/
QRectF handlePaintRect(const QPointF &position) const;
/**
* You should set the text mode to true in subclasses, if this tool is in text input mode, eg if the users
* are able to type. If you don't set it, then single key shortcuts will get the key event and not this tool.
*/
void setTextMode(bool value);
/**
* Allows subclasses to specify whether synthetic mouse events should be accepted.
*/
void setMaskSyntheticEvents(bool value);
/**
* Returns true if activate() has been called (more times than deactivate :) )
*/
bool isActivated() const;
protected:
KoToolBase(KoToolBasePrivate &dd);
KoToolBasePrivate *d_ptr;
private:
KoToolBase();
KoToolBase(const KoToolBase&);
KoToolBase& operator=(const KoToolBase&);
Q_DECLARE_PRIVATE(KoToolBase)
};
#endif /* KOTOOL_H */
diff --git a/libs/flake/KoToolManager.h b/libs/flake/KoToolManager.h
index 261982df80..689fa37dc2 100644
--- a/libs/flake/KoToolManager.h
+++ b/libs/flake/KoToolManager.h
@@ -1,351 +1,351 @@
/* This file is part of the KDE project
* Copyright (c) 2005-2006 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2006, 2008 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_TOOL_MANAGER
#define KO_TOOL_MANAGER
#include "KoInputDevice.h"
#include "kritaflake_export.h"
#include <QObject>
#include <QList>
class KoCanvasController;
class KoShapeBasedDocumentBase;
class KoToolFactoryBase;
class KoCanvasBase;
class KoToolBase;
class KoCreateShapesTool;
class KActionCollection;
class KoShape;
class KoInputDeviceHandlerEvent;
class KoShapeLayer;
class ToolHelper;
class QKeySequence;
class QCursor;
/**
* This class serves as a QAction-like control object for activation of a tool.
*
* It allows to implement a custom UI to control the activation of tools.
* See KoToolBox & KoModeBox in the kowidgets library.
*
* KoToolAction objects are indirectly owned by the KoToolManager singleton
* and live until the end of its lifetime.
*/
class KRITAFLAKE_EXPORT KoToolAction : public QObject
{
Q_OBJECT
public:
// toolHelper takes over ownership, and those live till the end of KoToolManager.
explicit KoToolAction(ToolHelper *toolHelper);
- ~KoToolAction();
+ ~KoToolAction() override;
public:
QString id() const; ///< The id of the tool
QString iconText() const; ///< The icontext of the tool
QString toolTip() const; ///< The tooltip of the tool
QString iconName() const; ///< The icon name of the tool
QKeySequence shortcut() const; ///< The shortcut to activate the tool
QString section() const; ///< The section the tool wants to be in.
int priority() const; ///< Lower number (higher priority) means coming first in the section.
int buttonGroupId() const; ///< A unique ID for this tool as passed by changedTool(), >= 0
QString visibilityCode() const; ///< This tool should become visible when we emit this string in toolCodesSelected()
public Q_SLOTS:
void trigger(); ///< Request the activation of the tool
Q_SIGNALS:
void changed(); ///< Emitted when a property changes (shortcut ATM)
private:
friend class ToolHelper;
class Private;
Private *const d;
};
/**
* This class manages the activation and deactivation of tools for
* each input device.
*
* Managing the active tool and switching tool based on various variables.
*
* The state of the toolbox will be the same for all views in the process so practically
* you can say we have one toolbox per application instance (process). Implementation
* does not allow one widget to be in more then one view, so we just make sure the toolbox
* is hidden in not-in-focus views.
*
* The ToolManager is a singleton and will manage all views in all applications that
* are loaded in this process. This means you will have to register and unregister your view.
* When creating your new view you should use a KoCanvasController() and register that
* with the ToolManager like this:
@code
MyGuiWidget::MyGuiWidget() {
m_canvasController = new KoCanvasController(this);
m_canvasController->setCanvas(m_canvas);
KoToolManager::instance()->addControllers(m_canvasController));
}
MyGuiWidget::~MyGuiWidget() {
KoToolManager::instance()->removeCanvasController(m_canvasController);
}
@endcode
*
* For a new view that extends KoView all you need to do is implement KoView::createToolBox()
*
* KoToolManager also keeps track of the current tool based on a
complex set of conditions and heuristics:
- there is one active tool per KoCanvasController (and there is one KoCanvasController
per view, because this is a class with scrollbars and a zoomlevel and so on)
- for every pointing device (determined by the unique id of tablet,
or 0 for mice -- you may have more than one mouse attached, but
Qt cannot distinquish between them, there is an associated tool.
- depending on things like tablet leave/enter proximity, incoming
mouse or tablet events and a little timer (that gets stopped when
we know what is what), the active pointing device is determined,
and the active tool is set accordingly.
Nota bene: if you use KoToolManager and register your canvases with
it you no longer have to manually implement methods to route mouse,
tablet, key or wheel events to the active tool. In fact, it's no
longer interesting to you which tool is active; you can safely
route the paint event through KoToolProxy::paint().
(The reason the input events are handled completely by the
toolmanager and the paint events not is that, generally speaking,
it's okay if the tools get the input events first, but you want to
paint your shapes or other canvas stuff first and only then paint
the tool stuff.)
*/
class KRITAFLAKE_EXPORT KoToolManager : public QObject
{
Q_OBJECT
public:
KoToolManager();
/// Return the toolmanager singleton
static KoToolManager* instance();
- ~KoToolManager();
+ ~KoToolManager() override;
/**
* Register actions for switching to tools at the actionCollection parameter.
* The actions will have the text / shortcut as stated by the toolFactory.
* If the application calls this in their KoView extending class they will have all the benefits
* from allowing this in the menus and to allow the use to configure the shortcuts used.
* @param ac the actionCollection that will be the parent of the actions.
* @param controller tools registered with this controller will have all their actions added as well.
*/
void registerToolActions(KActionCollection *ac, KoCanvasController *controller);
/**
* Register a new canvas controller
* @param controller the view controller that this toolmanager will manage the tools for
*/
void addController(KoCanvasController *controller);
/**
* Remove a set of controllers
* When the controller is no longer used it should be removed so all tools can be
* deleted and stop eating memory.
* @param controller the controller that is removed
*/
void removeCanvasController(KoCanvasController *controller);
/**
* Attempt to remove a controller.
* This is automatically called when a controller's proxy object is deleted, and
* it ensures that the controller is, in fact, removed, even if the creator forgot
* to do so.
* @param controller the proxy object of the controller to be removed
*/
Q_SLOT void attemptCanvasControllerRemoval(QObject *controller);
/// @return the active canvas controller
KoCanvasController *activeCanvasController() const;
/**
* Connect all the tools for the given canvas to the new shape controller.
*
* @param shapecontroller the new shape controller
* @param canvasController the canvas
*/
void updateShapeControllerBase(KoShapeBasedDocumentBase *shapeController, KoCanvasController *canvasController);
/**
* Return the tool that is able to create shapes for this param canvas.
* This is typically used by the KoShapeSelector to set which shape to create next.
* @param canvas the canvas that is a child of a previously registered controller
* who's tool you want.
* @see addController()
*/
KoCreateShapesTool *shapeCreatorTool(KoCanvasBase *canvas) const;
/**
* Returns the tool for the given tool id.
* @param canvas the canvas that is a child of a previously registered controller
* who's tool you want.
* @see addController()
*/
KoToolBase *toolById(KoCanvasBase *canvas, const QString &id) const;
/// @return the currently active pointing device
KoInputDevice currentInputDevice() const;
/**
* For the list of shapes find out which tool is the highest priorty tool that can handle it.
* @returns the toolId for the shapes.
* @param shapes a list of shapes, a selection for example, that is used to look for the tool.
*/
QString preferredToolForSelection(const QList<KoShape*> &shapes);
/**
* Returns the list of toolActions for the current tools.
* @returns lists of toolActions for the current tools.
*/
QList<KoToolAction*> toolActionList() const;
/// Update the internal shortcuts of each tool. (Activation shortcuts are exposed already.)
void updateToolShortcuts();
/// Request tool activation for the given canvas controller
void requestToolActivation(KoCanvasController *controller);
/// Returns the toolId of the currently active tool
QString activeToolId() const;
void initializeCurrentToolForCanvas();
class Private;
/**
* \internal return the private object for the toolmanager.
*/
KoToolManager::Private *priv();
public Q_SLOTS:
/**
* Request switching tool
* @param id the id of the tool
*/
void switchToolRequested(const QString &id);
/**
* Request change input device
* @param id the id of the input device
*/
void switchInputDeviceRequested(const KoInputDevice &id);
/**
* a new tool has become known to mankind
*/
void addDeferredToolFactory(KoToolFactoryBase *toolFactory);
/**
* Request for temporary switching the tools.
* This switch can be later reverted with switchBackRequested().
* @param id the id of the tool
*
* @see switchBackRequested()
*/
void switchToolTemporaryRequested(const QString &id);
/**
* Switches back to the original tool after the temporary switch
* has been done. It the user changed the tool manually on the way,
* then it switches to the interaction tool
*/
void switchBackRequested();
Q_SIGNALS:
/**
* Emitted when a new tool is going to override the current tool
* @param canvas the currently active canvas.
*/
void aboutToChangeTool(KoCanvasController *canvas);
/**
* Emitted when a new tool was selected or became active.
* @param canvas the currently active canvas.
* @param uniqueToolId a random but unique code for the new tool.
*/
void changedTool(KoCanvasController *canvas, int uniqueToolId);
/**
* Emitted after the selection changed to state which unique shape-types are now
* in the selection.
* @param canvas the currently active canvas.
* @param types a list of string that are the shape types of the selected objects.
*/
void toolCodesSelected(const QList<QString> &types);
/**
* Emitted after the current layer changed either its properties or to a new layer.
* @param canvas the currently active canvas.
* @param layer the layer that is selected.
*/
void currentLayerChanged(const KoCanvasController *canvas, const KoShapeLayer *layer);
/**
* Every time a new input device gets used by a tool, this event is emitted.
* @param device the new input device that the user picked up.
*/
void inputDeviceChanged(const KoInputDevice &device);
/**
* Emitted whenever the active canvas changed.
* @param canvas the new activated canvas (might be 0)
*/
void changedCanvas(const KoCanvasBase *canvas);
/**
* Emitted whenever the active tool changes the status text.
* @param statusText the new status text
*/
void changedStatusText(const QString &statusText);
/**
* emitted whenever a new tool is dynamically added for the given canvas
*/
void addedTool(KoToolAction *toolAction, KoCanvasController *canvas);
/**
* Emit the new tool option widgets to be used with this canvas.
*/
void toolOptionWidgetsChanged(KoCanvasController *controller, const QList<QPointer<QWidget> > &widgets);
private:
KoToolManager(const KoToolManager&);
KoToolManager operator=(const KoToolManager&);
Q_PRIVATE_SLOT(d, void toolActivated(ToolHelper *tool))
Q_PRIVATE_SLOT(d, void detachCanvas(KoCanvasController *controller))
Q_PRIVATE_SLOT(d, void attachCanvas(KoCanvasController *controller))
Q_PRIVATE_SLOT(d, void movedFocus(QWidget *from, QWidget *to))
Q_PRIVATE_SLOT(d, void updateCursor(const QCursor &cursor))
Q_PRIVATE_SLOT(d, void selectionChanged(const QList<KoShape*> &shapes))
Q_PRIVATE_SLOT(d, void currentLayerChanged(const KoShapeLayer *layer))
QPair<QString, KoToolBase*> createTools(KoCanvasController *controller, ToolHelper *tool);
Private *const d;
};
#endif
diff --git a/libs/flake/KoToolManager_p.h b/libs/flake/KoToolManager_p.h
index 0d8c52c86d..dc167885b2 100644
--- a/libs/flake/KoToolManager_p.h
+++ b/libs/flake/KoToolManager_p.h
@@ -1,190 +1,190 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_TOOL_MANAGER_P
#define KO_TOOL_MANAGER_P
#include <QList>
#include <QObject>
#include <QString>
#include <QHash>
#include <QKeySequence>
#include <QAction>
#include "KoInputDevice.h"
#include "KoToolManager.h"
class KoToolFactoryBase;
class KoShapeManager;
class KoCanvasBase;
class KoToolBase;
class KoShape;
class KoToolManager;
class KoCanvasController;
class KoShapeLayer;
class ToolHelper;
class CanvasData;
class KoToolProxy;
class Q_DECL_HIDDEN KoToolManager::Private
{
public:
Private(KoToolManager *qq);
~Private();
void setup();
void connectActiveTool();
void disconnectActiveTool();
void switchTool(KoToolBase *tool, bool temporary);
void switchTool(const QString &id, bool temporary);
void postSwitchTool(bool temporary);
void switchCanvasData(CanvasData *cd);
bool eventFilter(QObject *object, QEvent *event);
void toolActivated(ToolHelper *tool);
void detachCanvas(KoCanvasController *controller);
void attachCanvas(KoCanvasController *controller);
void movedFocus(QWidget *from, QWidget *to);
void updateCursor(const QCursor &cursor);
void switchBackRequested();
void selectionChanged(const QList<KoShape*> &shapes);
void currentLayerChanged(const KoShapeLayer *layer);
void updateToolForProxy();
void switchToolTemporaryRequested(const QString &id);
CanvasData *createCanvasData(KoCanvasController *controller, const KoInputDevice &device);
/**
* Request a switch from to the param input device.
* This will cause the tool for that device to be selected.
*/
void switchInputDevice(const KoInputDevice &device);
/**
* Whenever a new tool proxy class is instantiated, it will use this method to register itself
* so the toolManager can update it to the latest active tool.
* @param proxy the proxy to register.
* @param canvas which canvas the proxy is associated with; whenever a new tool is selected for that canvas,
* the proxy gets an update.
*/
void registerToolProxy(KoToolProxy *proxy, KoCanvasBase *canvas);
KoToolManager *q;
QList<ToolHelper*> tools; // list of all available tools via their factories.
QHash<KoToolBase*, int> uniqueToolIds; // for the changedTool signal
QHash<KoCanvasController*, QList<CanvasData*> > canvasses;
QHash<KoCanvasBase*, KoToolProxy*> proxies;
CanvasData *canvasData; // data about the active canvas.
KoInputDevice inputDevice;
bool layerExplicitlyDisabled;
};
class ShortcutToolAction;
/// \internal
class ToolHelper : public QObject
{
Q_OBJECT
public:
explicit ToolHelper(KoToolFactoryBase *tool);
KoToolAction *toolAction();
/// wrapper around KoToolFactoryBase::id();
QString id() const;
/// wrapper around KoToolFactoryBase::iconName();
QString iconName() const;
/// descriptive text, as ;
QString text() const;
/// descriptive icon text, e.g. use on a button next to an icon or without one;
QString iconText() const;
/// tooltip of the tool, e.g. for tooltip of a button;
QString toolTip() const;
/// wrapper around KoToolFactoryBase::toolType();
QString section() const;
/// wrapper around KoToolFactoryBase::activationShapeId();
QString activationShapeId() const;
/// wrapper around KoToolFactoryBase::priority();
int priority() const;
KoToolBase *createTool(KoCanvasBase *canvas) const;
ShortcutToolAction *createShortcutToolAction(QObject *parent);
/// unique id, >= 0
int uniqueId() const {
return m_uniqueId;
}
/// QAction->shortcut() if it exists, otherwise KoToolFactoryBase::shortcut()
QKeySequence shortcut() const;
public Q_SLOTS:
void activate();
Q_SIGNALS:
/// Emitted when the tool should be activated, e.g. by pressing the tool's assigned button in the toolbox
void toolActivated(ToolHelper *tool);
private Q_SLOTS:
void shortcutToolActionUpdated();
private:
KoToolFactoryBase * const m_toolFactory;
const int m_uniqueId;
QKeySequence m_customShortcut;
bool m_hasCustomShortcut;
KoToolAction *m_toolAction;
};
/// \internal
/// Helper class to transform a simple signal selection changed into a signal with a parameter
class Connector : public QObject
{
Q_OBJECT
public:
explicit Connector(KoShapeManager *parent);
public Q_SLOTS:
void selectionChanged();
Q_SIGNALS:
void selectionChanged(const QList<KoShape*> &shape);
private:
KoShapeManager *m_shapeManager;
};
/// \internal
/// Helper class to provide a action for tool shortcuts
class ShortcutToolAction : public QAction
{
Q_OBJECT
public:
ShortcutToolAction(const QString &id, const QString &name, QObject *parent);
- virtual ~ShortcutToolAction();
+ ~ShortcutToolAction() override;
private Q_SLOTS:
void actionTriggered();
private:
QString m_toolID;
};
#endif
diff --git a/libs/flake/KoToolProxy.h b/libs/flake/KoToolProxy.h
index 5a2ae003c2..2c281ce0c2 100644
--- a/libs/flake/KoToolProxy.h
+++ b/libs/flake/KoToolProxy.h
@@ -1,201 +1,201 @@
/* This file is part of the KDE project
*
* Copyright (c) 2006, 2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_TOOL_PROXY_H_
#define _KO_TOOL_PROXY_H_
#include "kritaflake_export.h"
#include <QObject>
#include <QHash>
class QAction;
class QAction;
class QMouseEvent;
class QKeyEvent;
class QWheelEvent;
class QTabletEvent;
class KoCanvasBase;
class KoViewConverter;
class KoToolBase;
class KoToolProxyPrivate;
class QInputMethodEvent;
class KoPointerEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;
class QTouchEvent;
class QPainter;
class QPointF;
class QMenu;
/**
* Tool proxy object which allows an application to address the current tool.
*
* Applications typically have a canvas and a canvas requires a tool for
* the user to do anything. Since the flake system is responsible for handling
* tools and also to change the active tool when needed we provide one class
* that can be used by an application canvas to route all the native events too
* which will transparantly be routed to the active tool. Without the application
* having to bother about which tool is active.
*/
class KRITAFLAKE_EXPORT KoToolProxy : public QObject
{
Q_OBJECT
public:
/**
* Constructor
* @param canvas Each canvas has 1 toolProxy. Pass the parent here.
* @param parent a parent QObject for memory management purposes.
*/
explicit KoToolProxy(KoCanvasBase *canvas, QObject *parent = 0);
- virtual ~KoToolProxy();
+ ~KoToolProxy() override;
/// Forwarded to the current KoToolBase
void paint(QPainter &painter, const KoViewConverter &converter);
/// Forwarded to the current KoToolBase
void repaintDecorations();
/**
* Forward the given touch event to the current KoToolBase.
* The viewconverter and document offset are necessary to convert all
* the QTouchPoints to KoTouchPoints that work in document coordinates.
*/
void touchEvent(QTouchEvent *event);
/// Forwarded to the current KoToolBase
void tabletEvent(QTabletEvent *event, const QPointF &point);
/// Forwarded to the current KoToolBase
void mousePressEvent(QMouseEvent *event, const QPointF &point);
void mousePressEvent(KoPointerEvent *event);
/// Forwarded to the current KoToolBase
void mouseDoubleClickEvent(QMouseEvent *event, const QPointF &point);
void mouseDoubleClickEvent(KoPointerEvent *event);
/// Forwarded to the current KoToolBase
void mouseMoveEvent(QMouseEvent *event, const QPointF &point);
void mouseMoveEvent(KoPointerEvent *event);
/// Forwarded to the current KoToolBase
void mouseReleaseEvent(QMouseEvent *event, const QPointF &point);
void mouseReleaseEvent(KoPointerEvent *event);
/// Forwarded to the current KoToolBase
void keyPressEvent(QKeyEvent *event);
/// Forwarded to the current KoToolBase
void keyReleaseEvent(QKeyEvent *event);
/// Forwarded to the current KoToolBase
void wheelEvent(QWheelEvent * event, const QPointF &point);
void wheelEvent(KoPointerEvent *event);
/// Forwarded to the current KoToolBase
void explicitUserStrokeEndRequest();
/// Forwarded to the current KoToolBase
QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const;
/// Forwarded to the current KoToolBase
void inputMethodEvent(QInputMethodEvent *event);
/// Forwarded to the current KoToolBase
QMenu* popupActionsMenu();
/// Forwarded to the current KoToolBase
void deleteSelection();
/// This method gives the proxy a chance to do things. for example it is need to have working singlekey
/// shortcuts. call it from the canvas' event function and forward it to QWidget::event() later.
void processEvent(QEvent *) const;
/**
* Retrieves the entire collection of actions for the active tool
* or an empty hash if there is no active tool yet.
*/
QHash<QString, QAction *> actions() const;
/// returns true if the current tool holds a selection
bool hasSelection() const;
/// Forwarded to the current KoToolBase
void cut();
/// Forwarded to the current KoToolBase
void copy() const;
/// Forwarded to the current KoToolBase
bool paste();
/// Forwarded to the current KoToolBase
void dragMoveEvent(QDragMoveEvent *event, const QPointF &point);
/// Forwarded to the current KoToolBase
void dragLeaveEvent(QDragLeaveEvent *event);
/// Forwarded to the current KoToolBase
void dropEvent(QDropEvent *event, const QPointF &point);
/// Set the new active tool.
virtual void setActiveTool(KoToolBase *tool);
/// \internal
KoToolProxyPrivate *priv();
protected Q_SLOTS:
/// Forwarded to the current KoToolBase
void requestUndoDuringStroke();
/// Forwarded to the current KoToolBase
void requestStrokeCancellation();
/// Forwarded to the current KoToolBase
void requestStrokeEnd();
Q_SIGNALS:
/**
* A tool can have a selection that is copy-able, this signal is emitted when that status changes.
* @param hasSelection is true when the tool holds selected data.
*/
void selectionChanged(bool hasSelection);
/**
* Emitted every time a tool is changed.
* @param toolId the id of the tool.
* @see KoToolBase::toolId()
*/
void toolChanged(const QString &toolId);
protected:
virtual QPointF widgetToDocument(const QPointF &widgetPoint) const;
KoCanvasBase* canvas() const;
private:
Q_PRIVATE_SLOT(d, void timeout())
Q_PRIVATE_SLOT(d, void selectionChanged(bool))
friend class KoToolProxyPrivate;
KoToolProxyPrivate * const d;
};
#endif // _KO_TOOL_PROXY_H_
diff --git a/libs/flake/KoToolRegistry.h b/libs/flake/KoToolRegistry.h
index 1de7c0185f..44c1efffe1 100644
--- a/libs/flake/KoToolRegistry.h
+++ b/libs/flake/KoToolRegistry.h
@@ -1,62 +1,62 @@
/* This file is part of the KDE project
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_TOOL_REGISTRY_H_
#define KO_TOOL_REGISTRY_H_
#include "KoGenericRegistry.h"
#include "kritaflake_export.h"
class KoToolFactoryBase;
/**
* This singleton class keeps a register of all available flake tools,
* or rather, of the factories that the KoToolBox (and KoToolManager) will use
* to create flake tools.
*/
class KRITAFLAKE_EXPORT KoToolRegistry : public KoGenericRegistry<KoToolFactoryBase*>
{
public:
KoToolRegistry();
- ~KoToolRegistry();
+ ~KoToolRegistry() override;
/**
* Return an instance of the KoToolRegistry
* Create a new instance on first call and return the singleton.
*/
static KoToolRegistry *instance();
/**
* Add a toolfactory from a deferred plugin. This will cause the toolFactoryAdded signal
* to be emitted, which is caught by the KoToolManager which then adds the tool to all
* canvases.
*/
void addDeferred(KoToolFactoryBase *toolFactory);
private:
KoToolRegistry(const KoToolRegistry&);
KoToolRegistry operator=(const KoToolRegistry&);
void init();
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/KoToolSelection.h b/libs/flake/KoToolSelection.h
index ff10535b8e..5d1f5c2f3d 100644
--- a/libs/flake/KoToolSelection.h
+++ b/libs/flake/KoToolSelection.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTOOLSELECTION_H
#define KOTOOLSELECTION_H
#include "kritaflake_export.h"
#include <QObject>
/**
* Each tool can have a selection which is private to that tool and the specified shape
* that it comes with.
* This object is provided for applications to operate on that selection. Copy paste
* come to mind, but also marking the selected text bold.
*/
class KRITAFLAKE_EXPORT KoToolSelection : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
* @param parent a parent for memory management purposes.
*/
explicit KoToolSelection(QObject *parent = 0);
- virtual ~KoToolSelection();
+ ~KoToolSelection() override;
/// return true if the tool currently has something selected that can be copied or deleted.
virtual bool hasSelection() {
return false;
}
};
#endif
diff --git a/libs/flake/KoTosContainer.h b/libs/flake/KoTosContainer.h
index cc8f3b7554..011941fc3b 100644
--- a/libs/flake/KoTosContainer.h
+++ b/libs/flake/KoTosContainer.h
@@ -1,132 +1,132 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2010 KO GmbH <boud@kogbmh.com>
* Copyright (C) 2010 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTOSCONTAINER_H
#define KOTOSCONTAINER_H
#include "KoShapeContainer.h"
#include "kritaflake_export.h"
class KoTosContainerPrivate;
class KoDocumentResourceManager;
/**
* Container that is used to wrap a shape with a text on top.
* Path shapes inherit from this class to make it possible to have text associated
* with them.
*/
class KRITAFLAKE_EXPORT KoTosContainer : public KoShapeContainer
{
public:
KoTosContainer();
- virtual ~KoTosContainer();
+ ~KoTosContainer() override;
// reimplemented
- virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
// reimplemented
virtual bool loadText(const KoXmlElement &element, KoShapeLoadingContext &context);
// reimplemented
virtual void saveText(KoShapeSavingContext &context) const;
/// different kinds of resizing behavior to determine how to treat text overflow
enum ResizeBehavior {
TextFollowsSize, ///< Text area is same size as content, extra text will be clipped
FollowTextSize, ///< Content shape will get resized if text grows/shrinks
IndependentSizes, ///< The text can get bigger than the content
TextFollowsPreferredTextRect ///< The size/position of the text area will follow the preferredTextRect property
};
/**
* Set the behavior that is used to resize the text or content.
* In order to determine what to do when there is too much text to fit or suddenly less
* text the user can define the wanted behavior using the ResizeBehavior
* @param resizeBehavior the new ResizeBehavior
*/
void setResizeBehavior(ResizeBehavior resizeBehavior);
/**
* Returns the current ResizeBehavior.
*/
ResizeBehavior resizeBehavior() const;
/** Sets the alignment of the text. */
void setTextAlignment(Qt::Alignment alignment);
/** Returns the alignment of all text */
Qt::Alignment textAlignment() const;
/**
* Set some plain text to be displayed on the shape.
* @param text the full text.
*/
void setPlainText(const QString &text);
/**
* Add text the current shape with the specified document resource manager.
*
* @param documentResources
* @return The created text shape or 0 in case it failed
*/
KoShape *createTextShape(KoDocumentResourceManager *documentResources = 0);
- virtual void setRunThrough(short int runThrough);
+ void setRunThrough(short int runThrough) override;
protected:
/// constructor
KoTosContainer(KoTosContainerPrivate *);
//reimplemented
- void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context);
+ void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context) override;
//reimplemented
- virtual QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
+ QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const override;
/**
* Set the current preferred text rectangle. This rect contains the coordinates of
* the embedded text shape relative to the content shape. This value is ignored if
* resizeBehavior is not TextFollowsPreferredTextRect.
* @param rect the new preferred text rectangle
*/
void setPreferredTextRect(const QRectF &rect);
/**
* Returns the current preferred text rectangle.
*/
QRectF preferredTextRect() const;
/**
* Returns the text shape
*
* @returns textshape if set or 0 in case it is not yet set
*/
KoShape *textShape() const;
- virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
+ void shapeChanged(ChangeType type, KoShape *shape = 0) override;
protected:
Q_DECLARE_PRIVATE(KoTosContainer)
};
#endif
diff --git a/libs/flake/KoTosContainerModel.h b/libs/flake/KoTosContainerModel.h
index 572c327b3d..9717ead173 100644
--- a/libs/flake/KoTosContainerModel.h
+++ b/libs/flake/KoTosContainerModel.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
Copyright (C) 2010 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTOSCONTAINERMODEL_H
#define KOTOSCONTAINERMODEL_H
#include "KoShapeContainerModel.h"
class KoTosContainerModel : public KoShapeContainerModel
{
public:
KoTosContainerModel();
- virtual ~KoTosContainerModel();
-
- virtual void add(KoShape *shape);
- virtual void remove(KoShape *shape);
- virtual void setClipped(const KoShape *shape, bool clipping);
- virtual bool isClipped(const KoShape *shape) const;
- virtual void setInheritsTransform(const KoShape *shape, bool inherit);
- virtual bool inheritsTransform(const KoShape *shape) const;
- virtual bool isChildLocked(const KoShape *child) const;
- virtual int count() const;
- virtual QList<KoShape*> shapes() const;
- virtual void containerChanged(KoShapeContainer *container, KoShape::ChangeType type);
+ ~KoTosContainerModel() override;
+
+ void add(KoShape *shape) override;
+ void remove(KoShape *shape) override;
+ void setClipped(const KoShape *shape, bool clipping) override;
+ bool isClipped(const KoShape *shape) const override;
+ void setInheritsTransform(const KoShape *shape, bool inherit) override;
+ bool inheritsTransform(const KoShape *shape) const override;
+ bool isChildLocked(const KoShape *child) const override;
+ int count() const override;
+ QList<KoShape*> shapes() const override;
+ void containerChanged(KoShapeContainer *container, KoShape::ChangeType type) override;
private:
KoShape *m_textShape;
};
#endif /* KOTOSCONTAINERMODEL_H */
diff --git a/libs/flake/KoTosContainer_p.h b/libs/flake/KoTosContainer_p.h
index 6b9d0172b9..b794b9879c 100644
--- a/libs/flake/KoTosContainer_p.h
+++ b/libs/flake/KoTosContainer_p.h
@@ -1,23 +1,23 @@
#ifndef KOTOSCONTAINER_P_H
#define KOTOSCONTAINER_P_H
#include "kritaflake_export.h"
#include "KoShapeContainer_p.h"
#include "KoTosContainer.h"
class KRITAFLAKE_EXPORT KoTosContainerPrivate : public KoShapeContainerPrivate
{
public:
explicit KoTosContainerPrivate(KoShapeContainer *q);
explicit KoTosContainerPrivate(const KoTosContainerPrivate &rhs, KoShapeContainer *q);
- virtual ~KoTosContainerPrivate();
+ ~KoTosContainerPrivate() override;
KoTosContainer::ResizeBehavior resizeBehavior;
QRectF preferredTextRect;
Qt::Alignment alignment;
};
#endif // KOTOSCONTAINER_P_H
diff --git a/libs/flake/KoUnavailShape.h b/libs/flake/KoUnavailShape.h
index cd2805f50d..16e5977aa2 100644
--- a/libs/flake/KoUnavailShape.h
+++ b/libs/flake/KoUnavailShape.h
@@ -1,76 +1,76 @@
/* This file is part of the KDE project
*
* Copyright (C) 2010 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOUNAVAILSHAPE_H
#define KOUNAVAILSHAPE_H
// Calligra
#include <KoFrameShape.h>
#include <KoShapeContainer.h>
class QPainter;
#define KoUnavailShape_SHAPEID "UnavailShapeID"
/**
* The KoUnavailShape is a frame shape that takes care of all frame
* based objects that are not handled by any of the shape plugins.
*
* The KoUnavailShape stores the data associated with the frame, even
* if this data is stored in embedded files inside the ODF container.
* To the user, it shows an empty frame with an indicator that there
* is an object here. If a preview of some type is available, the
* Unavail shape will attempt to load them read-only, in a fallback
* manner and show them in that frame. If no shape is found at all
* which supports any of the fallbacks, it will show a placeholder
* graphic, to indicate the fact that it is an unknown item.
*
* The KoUnavailShape always has to be present, and is the only shape
* that is not implemented as a plugin.
*/
class KoUnavailShape : public KoFrameShape, public KoShapeContainer {
public:
KoUnavailShape();
- virtual ~KoUnavailShape();
+ ~KoUnavailShape() override;
// Inherited methods
/// reimplemented
- void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
/// reimplemented from KoShapeContainer
- virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
/// reimplemented
- virtual void saveOdf(KoShapeSavingContext & context) const;
+ void saveOdf(KoShapeSavingContext & context) const override;
/// reimplemented
- virtual bool loadOdf( const KoXmlElement & element, KoShapeLoadingContext &context );
+ bool loadOdf( const KoXmlElement & element, KoShapeLoadingContext &context ) override;
/// Load the real contents of the frame shape.
- virtual bool loadOdfFrameElement(const KoXmlElement& frameElement,
- KoShapeLoadingContext& context);
+ bool loadOdfFrameElement(const KoXmlElement& frameElement,
+ KoShapeLoadingContext& context) override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/KoVectorPatternBackground.cpp b/libs/flake/KoVectorPatternBackground.cpp
index 5e8484220a..522a4a643b 100644
--- a/libs/flake/KoVectorPatternBackground.cpp
+++ b/libs/flake/KoVectorPatternBackground.cpp
@@ -1,176 +1,176 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "KoVectorPatternBackground.h"
#include <QTransform>
#include <KoShape.h>
#include <KoShapePainter.h>
#include "KoShapeBackground_p.h"
#include <KoBakedShapeRenderer.h>
#include <KoViewConverter.h>
class KoVectorPatternBackgroundPrivate : public KoShapeBackgroundPrivate
{
public:
KoVectorPatternBackgroundPrivate()
{
}
- ~KoVectorPatternBackgroundPrivate()
+ ~KoVectorPatternBackgroundPrivate() override
{
qDeleteAll(shapes);
shapes.clear();
}
QList<KoShape*> shapes;
KoFlake::CoordinateSystem referenceCoordinates =
KoFlake::ObjectBoundingBox;
KoFlake::CoordinateSystem contentCoordinates =
KoFlake::UserSpaceOnUse;
QRectF referenceRect;
QTransform patternTransform;
};
KoVectorPatternBackground::KoVectorPatternBackground()
: KoShapeBackground(*(new KoVectorPatternBackgroundPrivate()))
{
}
KoVectorPatternBackground::~KoVectorPatternBackground()
{
}
bool KoVectorPatternBackground::compareTo(const KoShapeBackground *other) const
{
Q_UNUSED(other);
return false;
}
void KoVectorPatternBackground::setReferenceCoordinates(KoFlake::CoordinateSystem value)
{
Q_D(KoVectorPatternBackground);
d->referenceCoordinates = value;
}
KoFlake::CoordinateSystem KoVectorPatternBackground::referenceCoordinates() const
{
Q_D(const KoVectorPatternBackground);
return d->referenceCoordinates;
}
void KoVectorPatternBackground::setContentCoordinates(KoFlake::CoordinateSystem value)
{
Q_D(KoVectorPatternBackground);
d->contentCoordinates = value;
}
KoFlake::CoordinateSystem KoVectorPatternBackground::contentCoordinates() const
{
Q_D(const KoVectorPatternBackground);
return d->contentCoordinates;
}
void KoVectorPatternBackground::setReferenceRect(const QRectF &value)
{
Q_D(KoVectorPatternBackground);
d->referenceRect = value;
}
QRectF KoVectorPatternBackground::referenceRect() const
{
Q_D(const KoVectorPatternBackground);
return d->referenceRect;
}
void KoVectorPatternBackground::setPatternTransform(const QTransform &value)
{
Q_D(KoVectorPatternBackground);
d->patternTransform = value;
}
QTransform KoVectorPatternBackground::patternTransform() const
{
Q_D(const KoVectorPatternBackground);
return d->patternTransform;
}
void KoVectorPatternBackground::setShapes(const QList<KoShape*> value)
{
Q_D(KoVectorPatternBackground);
qDeleteAll(d->shapes);
d->shapes.clear();
d->shapes = value;
}
QList<KoShape *> KoVectorPatternBackground::shapes() const
{
Q_D(const KoVectorPatternBackground);
return d->shapes;
}
void KoVectorPatternBackground::paint(QPainter &painter, const KoViewConverter &converter_Unused, KoShapePaintingContext &context_Unused, const QPainterPath &fillPath) const
{
Q_UNUSED(context_Unused);
Q_UNUSED(converter_Unused);
Q_D(const KoVectorPatternBackground);
const QPainterPath dstShapeOutline = fillPath;
const QRectF dstShapeBoundingBox = dstShapeOutline.boundingRect();
KoBakedShapeRenderer renderer(dstShapeOutline, QTransform(),
QTransform(),
d->referenceRect,
d->contentCoordinates != KoFlake::UserSpaceOnUse,
dstShapeBoundingBox,
d->referenceCoordinates != KoFlake::UserSpaceOnUse,
d->patternTransform);
QPainter *patchPainter = renderer.bakeShapePainter();
KoViewConverter converter;
KoShapePainter p;
p.setShapes(d->shapes);
p.paint(*patchPainter, converter);
// uncomment for debug
// renderer.patchImage().save("dd_patch_image.png");
painter.setPen(Qt::NoPen);
renderer.renderShape(painter);
}
bool KoVectorPatternBackground::hasTransparency() const
{
return true;
}
void KoVectorPatternBackground::fillStyle(KoGenStyle &, KoShapeSavingContext &)
{
// noop
}
bool KoVectorPatternBackground::loadStyle(KoOdfLoadingContext &, const QSizeF &Size)
{
Q_UNUSED(Size);
return true;
}
diff --git a/libs/flake/KoVectorPatternBackground.h b/libs/flake/KoVectorPatternBackground.h
index eba915be77..a8d5625fec 100644
--- a/libs/flake/KoVectorPatternBackground.h
+++ b/libs/flake/KoVectorPatternBackground.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOVECTORPATTERNBACKGROUND_H
#define KOVECTORPATTERNBACKGROUND_H
#include <KoShapeBackground.h>
#include <KoFlakeCoordinateSystem.h>
class KoShape;
class QPointF;
class QRectF;
class QTransform;
class KoVectorPatternBackgroundPrivate;
class KoVectorPatternBackground : public KoShapeBackground
{
public:
KoVectorPatternBackground();
- ~KoVectorPatternBackground();
+ ~KoVectorPatternBackground() override;
bool compareTo(const KoShapeBackground *other) const override;
void setReferenceCoordinates(KoFlake::CoordinateSystem value);
KoFlake::CoordinateSystem referenceCoordinates() const;
/**
* In ViewBox just use the same mode as for referenceCoordinates
*/
void setContentCoordinates(KoFlake::CoordinateSystem value);
KoFlake::CoordinateSystem contentCoordinates() const;
void setReferenceRect(const QRectF &value);
QRectF referenceRect() const;
void setPatternTransform(const QTransform &value);
QTransform patternTransform() const;
void setShapes(const QList<KoShape*> value);
QList<KoShape*> shapes() const;
void paint(QPainter &painter, const KoViewConverter &converter_Unused, KoShapePaintingContext &context_Unused, const QPainterPath &fillPath) const override;
bool hasTransparency() const override;
void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) override;
private:
Q_DECLARE_PRIVATE(KoVectorPatternBackground)
Q_DISABLE_COPY(KoVectorPatternBackground)
};
#endif // KOVECTORPATTERNBACKGROUND_H
diff --git a/libs/flake/SimpleShapeContainerModel.h b/libs/flake/SimpleShapeContainerModel.h
index 384198ba0b..764bce536d 100644
--- a/libs/flake/SimpleShapeContainerModel.h
+++ b/libs/flake/SimpleShapeContainerModel.h
@@ -1,130 +1,130 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007, 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Boudewijn Rempt <boud@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLESHAPECONTAINERMODEL_H
#define SIMPLESHAPECONTAINERMODEL_H
#include "KoShapeContainerModel.h"
#include <kis_debug.h>
/// \internal
class SimpleShapeContainerModel: public KoShapeContainerModel
{
public:
SimpleShapeContainerModel() {}
- ~SimpleShapeContainerModel() {}
+ ~SimpleShapeContainerModel() override {}
SimpleShapeContainerModel(const SimpleShapeContainerModel &rhs)
: KoShapeContainerModel(rhs),
m_inheritsTransform(rhs.m_inheritsTransform),
m_clipped(rhs.m_clipped)
{
Q_FOREACH (KoShape *shape, rhs.m_members) {
m_members << shape->cloneShape();
}
KIS_ASSERT_RECOVER(m_members.size() == m_inheritsTransform.size() &&
m_members.size() == m_clipped.size())
{
qDeleteAll(m_members);
m_members.clear();
m_inheritsTransform.clear();
m_clipped.clear();
}
}
- void add(KoShape *child) {
+ void add(KoShape *child) override {
if (m_members.contains(child))
return;
m_members.append(child);
m_clipped.append(false);
m_inheritsTransform.append(true);
}
- void setClipped(const KoShape *shape, bool value) {
+ void setClipped(const KoShape *shape, bool value) override {
const int index = indexOf(shape);
KIS_SAFE_ASSERT_RECOVER_RETURN(index >= 0);
m_clipped[index] = value;
}
- bool isClipped(const KoShape *shape) const {
+ bool isClipped(const KoShape *shape) const override {
const int index = indexOf(shape);
KIS_SAFE_ASSERT_RECOVER(index >= 0) { return false;}
return m_clipped[index];
}
- void remove(KoShape *shape) {
+ void remove(KoShape *shape) override {
const int index = indexOf(shape);
KIS_SAFE_ASSERT_RECOVER_RETURN(index >= 0);
m_members.removeAt(index);
m_clipped.removeAt(index);
m_inheritsTransform.removeAt(index);
}
- int count() const {
+ int count() const override {
return m_members.count();
}
- QList<KoShape*> shapes() const {
+ QList<KoShape*> shapes() const override {
return QList<KoShape*>(m_members);
}
- void containerChanged(KoShapeContainer *, KoShape::ChangeType) { }
- bool isChildLocked(const KoShape *child) const {
+ void containerChanged(KoShapeContainer *, KoShape::ChangeType) override { }
+ bool isChildLocked(const KoShape *child) const override {
Q_ASSERT(child->parent());
if (child->parent()) {
return child->isGeometryProtected() || child->parent()->isGeometryProtected();
}
else {
return child->isGeometryProtected();
}
}
- void setInheritsTransform(const KoShape *shape, bool value) {
+ void setInheritsTransform(const KoShape *shape, bool value) override {
const int index = indexOf(shape);
KIS_SAFE_ASSERT_RECOVER_RETURN(index >= 0);
m_inheritsTransform[index] = value;
}
- bool inheritsTransform(const KoShape *shape) const {
+ bool inheritsTransform(const KoShape *shape) const override {
const int index = indexOf(shape);
KIS_SAFE_ASSERT_RECOVER(index >= 0) { return true;}
return m_inheritsTransform[index];
}
- void proposeMove(KoShape *shape, QPointF &move)
+ void proposeMove(KoShape *shape, QPointF &move) override
{
KoShapeContainer *parent = shape->parent();
bool allowedToMove = true;
while (allowedToMove && parent) {
allowedToMove = parent->isEditable();
parent = parent->parent();
}
if (! allowedToMove) {
move.setX(0);
move.setY(0);
}
}
private:
int indexOf(const KoShape *shape) const {
// workaround indexOf constness!
return m_members.indexOf(const_cast<KoShape*>(shape));
}
private: // members
QList <KoShape *> m_members;
QList <bool> m_inheritsTransform;
QList <bool> m_clipped;
};
#endif
diff --git a/libs/flake/commands/KoConnectionShapeTypeCommand.h b/libs/flake/commands/KoConnectionShapeTypeCommand.h
index 6bf9026544..ff275bdb72 100644
--- a/libs/flake/commands/KoConnectionShapeTypeCommand.h
+++ b/libs/flake/commands/KoConnectionShapeTypeCommand.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KoConnectionShapeTypeCommand_H
#define KoConnectionShapeTypeCommand_H
#include "KoConnectionShape.h"
#include <kundo2command.h>
/// The undo / redo command for configuring an KoConnection shape
class KoConnectionShapeTypeCommand : public KUndo2Command
{
public:
/**
* Changes the tyoe of a connection shape
* @param connection the connection shape to change type of
* @param type the connection type
* @param parent the optional parent command
*/
KoConnectionShapeTypeCommand(KoConnectionShape *connection, KoConnectionShape::Type type, KUndo2Command *parent = 0);
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
KoConnectionShape *m_connection;
KoConnectionShape::Type m_oldType;
KoConnectionShape::Type m_newType;
};
#endif // KoConnectionShapeTypeCommand_H
diff --git a/libs/flake/commands/KoMultiPathPointJoinCommand.h b/libs/flake/commands/KoMultiPathPointJoinCommand.h
index b1505f3ff3..ff359873cf 100644
--- a/libs/flake/commands/KoMultiPathPointJoinCommand.h
+++ b/libs/flake/commands/KoMultiPathPointJoinCommand.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOMULTIPATHPOINTJOINCOMMAND_H
#define KOMULTIPATHPOINTJOINCOMMAND_H
#include <KoMultiPathPointMergeCommand.h>
class KRITAFLAKE_EXPORT KoMultiPathPointJoinCommand : public KoMultiPathPointMergeCommand
{
public:
KoMultiPathPointJoinCommand(const KoPathPointData &pointData1,
const KoPathPointData &pointData2,
KoShapeBasedDocumentBase *controller,
KoSelection *selection,
KUndo2Command *parent = 0);
protected:
- virtual KUndo2Command *createMergeCommand(const KoPathPointData &pointData1,
- const KoPathPointData &pointData2);
+ KUndo2Command *createMergeCommand(const KoPathPointData &pointData1,
+ const KoPathPointData &pointData2) override;
};
#endif // KOMULTIPATHPOINTJOINCOMMAND_H
diff --git a/libs/flake/commands/KoMultiPathPointMergeCommand.h b/libs/flake/commands/KoMultiPathPointMergeCommand.h
index 597593ba0c..ccb361ed3a 100644
--- a/libs/flake/commands/KoMultiPathPointMergeCommand.h
+++ b/libs/flake/commands/KoMultiPathPointMergeCommand.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOMULTIPATHPOINTMERGECOMMAND_H
#define KOMULTIPATHPOINTMERGECOMMAND_H
#include <kundo2command.h>
#include "kritaflake_export.h"
#include <QScopedPointer>
class KoSelection;
class KoPathShape;
class KoPathPointData;
class KoShapeBasedDocumentBase;
class KRITAFLAKE_EXPORT KoMultiPathPointMergeCommand : public KUndo2Command
{
public:
KoMultiPathPointMergeCommand(const KoPathPointData &pointData1,
const KoPathPointData &pointData2,
KoShapeBasedDocumentBase *controller,
KoSelection *selection,
KUndo2Command *parent = 0);
- ~KoMultiPathPointMergeCommand();
+ ~KoMultiPathPointMergeCommand() override;
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
KoPathShape *testingCombinedPath() const;
protected:
virtual KUndo2Command *createMergeCommand(const KoPathPointData &pointData1,
const KoPathPointData &pointData2);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KOMULTIPATHPOINTMERGECOMMAND_H
diff --git a/libs/flake/commands/KoParameterHandleMoveCommand.h b/libs/flake/commands/KoParameterHandleMoveCommand.h
index d21d8140f0..173c71efd4 100644
--- a/libs/flake/commands/KoParameterHandleMoveCommand.h
+++ b/libs/flake/commands/KoParameterHandleMoveCommand.h
@@ -1,64 +1,64 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPARAMETERHANDLEMOVECOMMAND_H
#define KOPARAMETERHANDLEMOVECOMMAND_H
#include <kundo2command.h>
#include <QPointF>
#include "kritaflake_export.h"
class KoParameterShape;
/// The undo / redo command for changing a parameter
class KoParameterHandleMoveCommand : public KUndo2Command
{
public:
/**
* Constructor.
* @param shape the shape this command works on
* @param handleId the ID under which the parameterShape knows the handle in KoParameterShape::moveHandle()
* @param startPoint The old position
* @param endPoint The new position
* @param keyModifiers the key modifiers used while moving.
* @param parent the parent command if this is a compound undo command.
*/
KoParameterHandleMoveCommand(KoParameterShape *shape, int handleId, const QPointF &startPoint, const QPointF &endPoint, Qt::KeyboardModifiers keyModifiers, KUndo2Command *parent = 0);
- virtual ~KoParameterHandleMoveCommand();
+ ~KoParameterHandleMoveCommand() override;
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
KoParameterShape *m_shape;
int m_handleId;
QPointF m_startPoint;
QPointF m_endPoint;
Qt::KeyboardModifiers m_keyModifiers;
};
#endif // KOPARAMETERHANDLEMOVECOMMAND_H
diff --git a/libs/flake/commands/KoParameterToPathCommand.h b/libs/flake/commands/KoParameterToPathCommand.h
index e184ad7f53..7c19c079b8 100644
--- a/libs/flake/commands/KoParameterToPathCommand.h
+++ b/libs/flake/commands/KoParameterToPathCommand.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPARAMETERTOPATHCOMMAND_H
#define KOPARAMETERTOPATHCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "kritaflake_export.h"
class KoParameterShape;
class KoParameterToPathCommandPrivate;
/// The undo / redo command for changing a KoParameterShape into a KoPathShape
class KRITAFLAKE_EXPORT KoParameterToPathCommand : public KUndo2Command
{
public:
/**
* Constructor.
* @param shape the shape this command works on
* @param parent the parent command if this is a compound undo command.
*/
explicit KoParameterToPathCommand(KoParameterShape *shape, KUndo2Command *parent = 0);
/**
* Constructor.
* @param shapes the list of shapes this command works on
* @param parent the parent command if this is a compound undo command.
*/
explicit KoParameterToPathCommand(const QList<KoParameterShape*> &shapes, KUndo2Command *parent = 0);
- virtual ~KoParameterToPathCommand();
+ ~KoParameterToPathCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoParameterToPathCommandPrivate * const d;
};
#endif // KOPARAMETERTOPATHCOMMAND_H
diff --git a/libs/flake/commands/KoPathBreakAtPointCommand.h b/libs/flake/commands/KoPathBreakAtPointCommand.h
index d9708b8952..837268f7fc 100644
--- a/libs/flake/commands/KoPathBreakAtPointCommand.h
+++ b/libs/flake/commands/KoPathBreakAtPointCommand.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHBREAKATPOINTCOMMAND_H
#define KOPATHBREAKATPOINTCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "KoPathPointData.h"
class KoPathPoint;
/// Command to break a subpath at points.
class KoPathBreakAtPointCommand : public KUndo2Command
{
public:
/**
* Command to break a subpath at points.
*
* The paths are broken at the given points. New points will be inserted after
* the given points and then the paths will be split after the given points.
*
* @param pointDataList List of point data where the path should be split.
* @param parent the parent command used for macro commands
*/
explicit KoPathBreakAtPointCommand(const QList<KoPathPointData> &pointDataList, KUndo2Command *parent = 0);
- ~KoPathBreakAtPointCommand();
+ ~KoPathBreakAtPointCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
QList<KoPathPointData> m_pointDataList;
QList<KoPathPoint*> m_points;
// used for storing where to open the subpath. In case it not used for the open
// status use .second to the store offset caused by a open of a subpath.
QList<KoPathPointIndex> m_closedIndex;
bool m_deletePoints;
};
#endif // KOPATHBREAKATPOINTCOMMAND_H
diff --git a/libs/flake/commands/KoPathCombineCommand.h b/libs/flake/commands/KoPathCombineCommand.h
index 4c3ddb8bf8..18244d64d9 100644
--- a/libs/flake/commands/KoPathCombineCommand.h
+++ b/libs/flake/commands/KoPathCombineCommand.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHCOMBINECOMMAND_H
#define KOPATHCOMBINECOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "kritaflake_export.h"
class KoShapeBasedDocumentBase;
class KoPathShape;
class KoPathPointData;
/// The undo / redo command for combining two or more paths into one
class KRITAFLAKE_EXPORT KoPathCombineCommand : public KUndo2Command
{
public:
/**
* Command for combining a list of paths into one single path.
* @param controller the controller to used for removing/inserting.
* @param paths the list of paths to combine
* @param parent the parent command used for macro commands
*/
KoPathCombineCommand(KoShapeBasedDocumentBase *controller, const QList<KoPathShape*> &paths, KUndo2Command *parent = 0);
- virtual ~KoPathCombineCommand();
+ ~KoPathCombineCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
KoPathShape *combinedPath() const;
KoPathPointData originalToCombined(KoPathPointData pd) const;
private:
class Private;
Private * const d;
};
#endif // KOPATHCOMBINECOMMAND_H
diff --git a/libs/flake/commands/KoPathFillRuleCommand.h b/libs/flake/commands/KoPathFillRuleCommand.h
index 96b2573bf4..b73ef9852f 100644
--- a/libs/flake/commands/KoPathFillRuleCommand.h
+++ b/libs/flake/commands/KoPathFillRuleCommand.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHFILLRULECOMMAND_H
#define KOPATHFILLRULECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoPathShape;
/// The undo / redo command for setting the fill rule of a path shape
class KRITAFLAKE_EXPORT KoPathFillRuleCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape background.
* @param shapes a set of all the path shapes that should get the new fill rule
* @param fillRule the new fill rule
* @param parent the parent command used for macro commands
*/
KoPathFillRuleCommand(const QList<KoPathShape*> &shapes, Qt::FillRule fillRule, KUndo2Command *parent = 0);
- virtual ~KoPathFillRuleCommand();
+ ~KoPathFillRuleCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif // KOPATHFILLRULECOMMAND_H
diff --git a/libs/flake/commands/KoPathPointInsertCommand.h b/libs/flake/commands/KoPathPointInsertCommand.h
index 4e50efa902..400dcc4975 100644
--- a/libs/flake/commands/KoPathPointInsertCommand.h
+++ b/libs/flake/commands/KoPathPointInsertCommand.h
@@ -1,62 +1,62 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTINSERTCOMMAND_H
#define KOPATHPOINTINSERTCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "KoPathPointData.h"
#include "kritaflake_export.h"
class KoPathPointInsertCommandPrivate;
class KoPathPoint;
/// The undo / redo command for inserting path points
class KRITAFLAKE_EXPORT KoPathPointInsertCommand : public KUndo2Command
{
public:
/**
* Command to insert path points.
*
* This splits the segments at the given position by inserting new points.
* The De Casteljau algorithm is used for calculating the position of the new
* points.
*
* @param pointDataList describing the segments to split
* @param insertPosition the position to insert at [0..1]
* @param parent the parent command used for macro commands
*/
KoPathPointInsertCommand(const QList<KoPathPointData> &pointDataList, qreal insertPosition, KUndo2Command *parent = 0);
- virtual ~KoPathPointInsertCommand();
+ ~KoPathPointInsertCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
/// Returns list of inserted points
QList<KoPathPoint*> insertedPoints() const;
private:
KoPathPointInsertCommandPrivate * const d;
};
#endif // KOPATHPOINTINSERTCOMMAND_H
diff --git a/libs/flake/commands/KoPathPointMergeCommand.h b/libs/flake/commands/KoPathPointMergeCommand.h
index a33d634c45..c33c738a0c 100644
--- a/libs/flake/commands/KoPathPointMergeCommand.h
+++ b/libs/flake/commands/KoPathPointMergeCommand.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTMERGECOMMAND_H
#define KOPATHPOINTMERGECOMMAND_H
#include <kundo2command.h>
#include "kritaflake_export.h"
class KoPathPointData;
/// The undo / redo command for merging two subpath end points
class KRITAFLAKE_EXPORT KoPathPointMergeCommand : public KUndo2Command
{
public:
/**
* Command to merge two subpath end points.
*
* The points have to be from the same path shape.
*
* @param pointData1 the data of the first point to merge
* @param pointData2 the data of the second point to merge
* @param parent the parent command used for macro commands
*/
KoPathPointMergeCommand(const KoPathPointData &pointData1, const KoPathPointData &pointData2, KUndo2Command *parent = 0);
- ~KoPathPointMergeCommand();
+ ~KoPathPointMergeCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
KoPathPointData mergedPointData() const;
private:
class Private;
Private * const d;
};
#endif // KOPATHPOINTMERGECOMMAND_H
diff --git a/libs/flake/commands/KoPathPointMoveCommand.h b/libs/flake/commands/KoPathPointMoveCommand.h
index 93a2e9ceb5..c031bad1f9 100644
--- a/libs/flake/commands/KoPathPointMoveCommand.h
+++ b/libs/flake/commands/KoPathPointMoveCommand.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2009 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTMOVECOMMAND_H
#define KOPATHPOINTMOVECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include "KoPathPointData.h"
class KoPathPointMoveCommandPrivate;
class QPointF;
/// The undo / redo command for path point moving.
class KRITAFLAKE_EXPORT KoPathPointMoveCommand : public KUndo2Command
{
public:
/**
* Command to move path points.
* @param pointData the path points to move
* @param offset the offset by which the point is moved in document coordinates
* @param parent the parent command used for macro commands
*/
KoPathPointMoveCommand(const QList<KoPathPointData> &pointData, const QPointF &offset, KUndo2Command *parent = 0);
/**
* Command to move path points.
* @param pointData the path points to move
* @param offsets the offsets by which the points are moved in document coordinates
* @param parent the parent command used for macro commands
*/
KoPathPointMoveCommand(const QList<KoPathPointData> &pointData, const QList<QPointF> &offsets, KUndo2Command *parent = 0);
- ~KoPathPointMoveCommand();
+ ~KoPathPointMoveCommand() override;
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
KoPathPointMoveCommandPrivate * const d;
};
#endif // KOPATHPOINTMOVECOMMAND_H
diff --git a/libs/flake/commands/KoPathPointRemoveCommand.h b/libs/flake/commands/KoPathPointRemoveCommand.h
index 1d8a469900..bbe1e10ff0 100644
--- a/libs/flake/commands/KoPathPointRemoveCommand.h
+++ b/libs/flake/commands/KoPathPointRemoveCommand.h
@@ -1,69 +1,69 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTREMOVECOMMAND_H
#define KOPATHPOINTREMOVECOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "KoPathPointData.h"
#include "kritaflake_export.h"
class KoShapeController;
class KoPathPointRemoveCommandPrivate;
/// The undo / redo command for removing path points.
class KRITAFLAKE_EXPORT KoPathPointRemoveCommand : public KUndo2Command
{
public:
/**
* @brief Create command for removing points from path shapes
*
* This will create the command for removing points from path shapes. If all
* points from a path shape are deleted it will delete the path shape. If all
* points from a subpath are deleted it will delete the subpath.
*
* @param pointDataList List of point data to remove
* @param shapeController shape controller in charge
* @param parent the parent command used for macro commands
*/
static KUndo2Command *createCommand(const QList<KoPathPointData> &pointDataList, KoShapeController *shapeController, KUndo2Command *parent = 0);
/**
* @brief Command to remove a points from path shapes
*
* Don't use this directly use createCommand instead.
*
* @param pointDataList List of point data to remove.
* @param parent the parent command used for macro commands
*/
explicit KoPathPointRemoveCommand(const QList<KoPathPointData> &pointDataList, KUndo2Command *parent = 0);
- ~KoPathPointRemoveCommand();
+ ~KoPathPointRemoveCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoPathPointRemoveCommandPrivate *d;
};
#endif // KOPATHPOINTREMOVECOMMAND_H
diff --git a/libs/flake/commands/KoPathPointTypeCommand.h b/libs/flake/commands/KoPathPointTypeCommand.h
index 7b0b5756d6..849ec8b804 100644
--- a/libs/flake/commands/KoPathPointTypeCommand.h
+++ b/libs/flake/commands/KoPathPointTypeCommand.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTTYPECOMMAND_H
#define KOPATHPOINTTYPECOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "KoPathBaseCommand.h"
#include "KoPathPoint.h"
#include "KoPathPointData.h"
#include "kritaflake_export.h"
/// The undo / redo command for changing the path point type.
class KRITAFLAKE_EXPORT KoPathPointTypeCommand : public KoPathBaseCommand
{
public:
/// The type of the point
enum PointType {
Corner,
Smooth,
Symmetric,
Line,
Curve
};
/**
* Command to change the type of the given points
* @param pointDataList List of point for changing the points
* @param pointType the new point type to set
* @param parent the parent command used for macro commands
*/
KoPathPointTypeCommand(const QList<KoPathPointData> &pointDataList, PointType pointType, KUndo2Command *parent = 0);
- ~KoPathPointTypeCommand();
+ ~KoPathPointTypeCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
// used for storing the data for undo
struct PointData {
PointData(const KoPathPointData pointData)
: m_pointData(pointData) {}
KoPathPointData m_pointData;
// old control points in document coordinates
QPointF m_oldControlPoint1;
QPointF m_oldControlPoint2;
KoPathPoint::PointProperties m_oldProperties;
bool m_hadControlPoint1;
bool m_hadControlPoint2;
};
bool appendPointData(KoPathPointData data);
void undoChanges(const QList<PointData> &data);
PointType m_pointType;
QList<PointData> m_oldPointData;
QList<PointData> m_additionalPointData;
};
#endif // KOPATHPOINTTYPECOMMAND_H
diff --git a/libs/flake/commands/KoPathReverseCommand.h b/libs/flake/commands/KoPathReverseCommand.h
index a2cdb2b38b..1a934c9030 100644
--- a/libs/flake/commands/KoPathReverseCommand.h
+++ b/libs/flake/commands/KoPathReverseCommand.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHREVERSECOMMAND_H
#define KOPATHREVERSECOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "kritaflake_export.h"
class KoPathShape;
/// The undo / redo command for reversing path directions
class KRITAFLAKE_EXPORT KoPathReverseCommand : public KUndo2Command
{
public:
/**
* Command for reversing directions of a list of paths
* @param paths the list of paths to reverse
* @param parent the parent command used for macro commands
*/
explicit KoPathReverseCommand(const QList<KoPathShape*> &paths, KUndo2Command *parent = 0);
- virtual ~KoPathReverseCommand();
+ ~KoPathReverseCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif // KOPATHREVERSECOMMAND_H
diff --git a/libs/flake/commands/KoPathSegmentBreakCommand.h b/libs/flake/commands/KoPathSegmentBreakCommand.h
index 3e101f91ff..a09344a38d 100644
--- a/libs/flake/commands/KoPathSegmentBreakCommand.h
+++ b/libs/flake/commands/KoPathSegmentBreakCommand.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHSEGMENTBREAKCOMMAND_H
#define KOPATHSEGMENTBREAKCOMMAND_H
#include <kundo2command.h>
#include "KoPathPointData.h"
/// The undo / redo command for breaking a subpath by removing the segment
class KoPathSegmentBreakCommand : public KUndo2Command
{
public:
/**
* Command to break a subpath by removing the segement
*
* The segment following the given point will be removed.
*
* @param pointData describing the point
* @param parent the parent command used for macro commands
*/
explicit KoPathSegmentBreakCommand(const KoPathPointData &pointData, KUndo2Command *parent = 0);
- ~KoPathSegmentBreakCommand();
+ ~KoPathSegmentBreakCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoPathPointData m_pointData;
KoPathPointIndex m_startIndex;
bool m_broken;
};
#endif // KOPATHSEGMENTBREAKCOMMAND_H
diff --git a/libs/flake/commands/KoPathSegmentTypeCommand.h b/libs/flake/commands/KoPathSegmentTypeCommand.h
index ec39be4ce5..8ade64fb4f 100644
--- a/libs/flake/commands/KoPathSegmentTypeCommand.h
+++ b/libs/flake/commands/KoPathSegmentTypeCommand.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2009 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHSEGMENTTYPECOMMAND_H
#define KOPATHSEGMENTTYPECOMMAND_H
#include <kundo2command.h>
#include <QList>
#include <QPointF>
#include "KoPathPoint.h"
#include "KoPathPointData.h"
#include "kritaflake_export.h"
/// The undo / redo command for changing segments to curves/lines
class KRITAFLAKE_EXPORT KoPathSegmentTypeCommand : public KUndo2Command
{
public:
/// Segment Types
enum SegmentType {
Curve = 1,
Line = 2
};
/**
* Command for changing the segment type ( curve/line )
* @param pointData point data identifying the segement that should be changed.
* @param segmentType to which the segment should be changed to
* @param parent the parent command used for macro commands
*/
KoPathSegmentTypeCommand(const KoPathPointData &pointData, SegmentType segmentType, KUndo2Command *parent = 0);
/**
* Command for changing the segment type ( curve/line )
* @param pointDataList List of point data identifying the segements that should be changed.
* @param segmentType to which the segments should be changed to
* @param parent the parent command used for macro commands
*/
KoPathSegmentTypeCommand(const QList<KoPathPointData> &pointDataList, SegmentType segmentType, KUndo2Command *parent = 0);
- ~KoPathSegmentTypeCommand();
+ ~KoPathSegmentTypeCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
// used for storing the data for undo
struct SegmentTypeData {
// old control points in document coordinates
QPointF m_controlPoint1;
QPointF m_controlPoint2;
KoPathPoint::PointProperties m_properties1;
KoPathPoint::PointProperties m_properties2;
};
void initialize(const QList<KoPathPointData> &pointDataList);
QList<KoPathPointData> m_pointDataList;
QList<SegmentTypeData> m_segmentData;
SegmentType m_segmentType;
};
#endif // KOPATHSEGMENTTYPECOMMAND_H
diff --git a/libs/flake/commands/KoPathShapeMarkerCommand.h b/libs/flake/commands/KoPathShapeMarkerCommand.h
index 83d7ef7844..fe7581f9da 100644
--- a/libs/flake/commands/KoPathShapeMarkerCommand.h
+++ b/libs/flake/commands/KoPathShapeMarkerCommand.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Jeremy Lugagne <lugagne.jeremy@gmail.com>
* Copyright (C) 2011 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KoPathShapeMarkerCommand_H
#define KoPathShapeMarkerCommand_H
#include "kritaflake_export.h"
#include <QScopedPointer>
#include "KoFlake.h"
#include <kundo2command.h>
#include <QList>
class KoPathShape;
class KoMarker;
/// The undo / redo command for setting the shape marker
class KRITAFLAKE_EXPORT KoPathShapeMarkerCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape marker.
* @param shapes a set of all the shapes that should get the new marker.
* @param marker the new marker, the same for all given shapes
* @param position the position - start or end - of the marker on the shape
* @param parent the parent command used for macro commands
*/
KoPathShapeMarkerCommand(const QList<KoPathShape*> &shapes, KoMarker *marker, KoFlake::MarkerPosition position, KUndo2Command *parent = 0);
- ~KoPathShapeMarkerCommand();
+ ~KoPathShapeMarkerCommand() override;
void redo() override;
void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KoPathShapeMarkerCommand_H
diff --git a/libs/flake/commands/KoShapeAlignCommand.h b/libs/flake/commands/KoShapeAlignCommand.h
index 2893ddcec6..f55ac5d847 100644
--- a/libs/flake/commands/KoShapeAlignCommand.h
+++ b/libs/flake/commands/KoShapeAlignCommand.h
@@ -1,63 +1,63 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEALIGNCOMMAND_H
#define KOSHAPEALIGNCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class QRectF;
/// The undo / redo command for aligning shapes
class KRITAFLAKE_EXPORT KoShapeAlignCommand : public KUndo2Command
{
public:
/// The different alignment options for this command
enum Align {
HorizontalLeftAlignment, ///< Align left
HorizontalCenterAlignment, ///< Align Centered horizontally
HorizontalRightAlignment, ///< Align Right
VerticalBottomAlignment, ///< Align bottom
VerticalCenterAlignment, ///< Align centered vertically
VerticalTopAlignment ///< Align top
};
/**
* Command to align a set of shapes in a rect
* @param shapes a set of all the shapes that should be aligned
* @param align the aligment type
* @param boundingRect the rect the shape will be aligned in
* @param parent the parent command used for macro commands
*/
KoShapeAlignCommand(const QList<KoShape*> &shapes, Align align, const QRectF &boundingRect, KUndo2Command *parent = 0);
- virtual ~KoShapeAlignCommand();
+ ~KoShapeAlignCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeBackgroundCommand.h b/libs/flake/commands/KoShapeBackgroundCommand.h
index 01d82683a7..ed72225d95 100644
--- a/libs/flake/commands/KoShapeBackgroundCommand.h
+++ b/libs/flake/commands/KoShapeBackgroundCommand.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEBACKGROUNDCOMMAND_H
#define KOSHAPEBACKGROUNDCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
#include <QSharedPointer>
class KoShape;
class KoShapeBackground;
/// The undo / redo command for setting the shape background
class KRITAFLAKE_EXPORT KoShapeBackgroundCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape background.
* @param shapes a set of all the shapes that should get the new background.
* @param fill the new shape background
* @param parent the parent command used for macro commands
*/
KoShapeBackgroundCommand(const QList<KoShape*> &shapes, QSharedPointer<KoShapeBackground> fill, KUndo2Command *parent = 0);
/**
* Command to set a new shape background.
* @param shape a single shape that should get the new background.
* @param fill the new shape background
* @param parent the parent command used for macro commands
*/
KoShapeBackgroundCommand(KoShape *shape, QSharedPointer<KoShapeBackground> fill, KUndo2Command *parent = 0);
/**
* Command to set new shape backgrounds.
* @param shapes a set of all the shapes that should get a new background.
* @param fills the new backgrounds, one for each shape
* @param parent the parent command used for macro commands
*/
KoShapeBackgroundCommand(const QList<KoShape*> &shapes, const QList<QSharedPointer<KoShapeBackground> > &fills, KUndo2Command *parent = 0);
- virtual ~KoShapeBackgroundCommand();
+ ~KoShapeBackgroundCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeClipCommand.h b/libs/flake/commands/KoShapeClipCommand.h
index b58da4dc0a..77f064ec9c 100644
--- a/libs/flake/commands/KoShapeClipCommand.h
+++ b/libs/flake/commands/KoShapeClipCommand.h
@@ -1,66 +1,66 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECLIPCOMMAND_H
#define KOSHAPECLIPCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoPathShape;
class KoShapeBasedDocumentBase;
/// The undo / redo command for setting the shape clip path
class KRITAFLAKE_EXPORT KoShapeClipCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape clipping path for multiple shape.
* @param controller the controller to used for deleting.
* @param shapes a set of all the shapes that should get the clipping path.
* @param clipPathShapes the path shapes to be used a clipping path
* @param parent the parent command used for macro commands
*/
KoShapeClipCommand(KoShapeBasedDocumentBase *controller, const QList<KoShape*> &shapes, const QList<KoPathShape*> &clipPathShapes, KUndo2Command *parent = 0);
/**
* Command to set a new shape clipping path for a single shape
* @param controller the controller to used for deleting.
* @param shape a single shape that should get the new shadow.
* @param clipPathShapes the path shapes to be used a clipping path
* @param parent the parent command used for macro commands
*/
KoShapeClipCommand(KoShapeBasedDocumentBase *controller, KoShape *shape, const QList<KoPathShape*> &clipPathShapes, KUndo2Command *parent = 0);
/// Destroys the command
- virtual ~KoShapeClipCommand();
+ ~KoShapeClipCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif // KOSHAPECLIPCOMMAND_H
diff --git a/libs/flake/commands/KoShapeConnectionChangeCommand.h b/libs/flake/commands/KoShapeConnectionChangeCommand.h
index 13395062b0..cebebfbfaa 100644
--- a/libs/flake/commands/KoShapeConnectionChangeCommand.h
+++ b/libs/flake/commands/KoShapeConnectionChangeCommand.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECONNECTIONCHANGECOMMAND_H
#define KOSHAPECONNECTIONCHANGECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include "KoConnectionShape.h"
/// A command to add a connection between two shapes
class KRITAFLAKE_EXPORT KoShapeConnectionChangeCommand : public KUndo2Command
{
public:
/**
* Creates command to connect aconnection shape to a shape
* @param connection the connection shape to connect to the shape
* @param connectionHandle the handle of the connection to connect to
* @param oldConnectedShape the old shape we were connected to
* @param newConnectedShape the new shape to connect to
* @param connectionPointId the id of the connection point to connect to
* @param parent the parent undo command
*/
KoShapeConnectionChangeCommand(KoConnectionShape *connection, KoConnectionShape::HandleId connectionHandle,
KoShape *oldConnectedShape, int oldConnectionPointId,
KoShape *newConnectedShape, int newConnectionPointId, KUndo2Command *parent = 0);
/// Destroys the command
- virtual ~KoShapeConnectionChangeCommand();
+ ~KoShapeConnectionChangeCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif // KOSHAPECONNECTIONCHANGECOMMAND_H
diff --git a/libs/flake/commands/KoShapeCreateCommand.h b/libs/flake/commands/KoShapeCreateCommand.h
index 9494e17dd6..82a7e6f8d8 100644
--- a/libs/flake/commands/KoShapeCreateCommand.h
+++ b/libs/flake/commands/KoShapeCreateCommand.h
@@ -1,62 +1,62 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECREATECOMMAND_H
#define KOSHAPECREATECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
class KoShape;
class KoShapeBasedDocumentBase;
/// The undo / redo command for creating shapes
class KRITAFLAKE_EXPORT KoShapeCreateCommand : public KUndo2Command
{
public:
/**
* Command used on creation of new shapes
* @param controller the controller used to add/remove the shape from
* @param shape the shape thats just been created.
* @param parent the parent command used for macro commands
*/
KoShapeCreateCommand(KoShapeBasedDocumentBase *controller, KoShape *shape,
KUndo2Command *parent = 0);
/**
* Command used on creation of new shapes
* @param controller the controller used to add/remove the shape from
* @param shapes the shapes that have just been created.
* @param parent the parent command used for macro commands
*/
KoShapeCreateCommand(KoShapeBasedDocumentBase *controller, const QList<KoShape*> shape,
KUndo2Command *parent = 0);
- virtual ~KoShapeCreateCommand();
+ ~KoShapeCreateCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeDeleteCommand.h b/libs/flake/commands/KoShapeDeleteCommand.h
index 95ed5b839d..811b1ac2c9 100644
--- a/libs/flake/commands/KoShapeDeleteCommand.h
+++ b/libs/flake/commands/KoShapeDeleteCommand.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEDELETECOMMAND_H
#define KOSHAPEDELETECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoShapeBasedDocumentBase;
/// The undo / redo command for deleting shapes
class KRITAFLAKE_EXPORT KoShapeDeleteCommand : public KUndo2Command
{
public:
/**
* Command to delete a single shape by means of a shape controller.
* @param controller the controller to used for deleting.
* @param shape a single shape that should be deleted.
* @param parent the parent command used for macro commands
*/
KoShapeDeleteCommand(KoShapeBasedDocumentBase *controller, KoShape *shape, KUndo2Command *parent = 0);
/**
* Command to delete a set of shapes by means of a shape controller.
* @param controller the controller to used for deleting.
* @param shapes a set of all the shapes that should be deleted.
* @param parent the parent command used for macro commands
*/
KoShapeDeleteCommand(KoShapeBasedDocumentBase *controller, const QList<KoShape*> &shapes, KUndo2Command *parent = 0);
- virtual ~KoShapeDeleteCommand();
+ ~KoShapeDeleteCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeDistributeCommand.h b/libs/flake/commands/KoShapeDistributeCommand.h
index 4f05653de4..d81b1c7397 100644
--- a/libs/flake/commands/KoShapeDistributeCommand.h
+++ b/libs/flake/commands/KoShapeDistributeCommand.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEDISTRIBUTECOMMAND_H
#define KOSHAPEDISTRIBUTECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
/// The undo / redo command for distributing shapes
class KRITAFLAKE_EXPORT KoShapeDistributeCommand : public KUndo2Command
{
public:
/// The different options to ditribute with this command
enum Distribute {
HorizontalCenterDistribution, ///< Horizontal centered
HorizontalGapsDistribution, ///< Horizontal Gaps
HorizontalLeftDistribution, ///< Horizontal Left
HorizontalRightDistribution, ///< Horizontal Right
VerticalCenterDistribution, ///< Vertical centered
VerticalGapsDistribution, ///< Vertical Gaps
VerticalBottomDistribution, ///< Vertical bottom
VerticalTopDistribution ///< Vertical top
};
/**
* Command to align a set of shapes in a rect
* @param shapes a set of all the shapes that should be distributed
* @param distribute the distribution type
* @param boundingRect the rect the shapes will be distributed in
* @param parent the parent command used for macro commands
*/
KoShapeDistributeCommand(const QList<KoShape*> &shapes, Distribute distribute,
const QRectF &boundingRect, KUndo2Command *parent = 0);
- virtual ~KoShapeDistributeCommand();
+ ~KoShapeDistributeCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeGroupCommand.h b/libs/flake/commands/KoShapeGroupCommand.h
index 4cacf58807..73002c1bd3 100644
--- a/libs/flake/commands/KoShapeGroupCommand.h
+++ b/libs/flake/commands/KoShapeGroupCommand.h
@@ -1,95 +1,95 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEGROUPCOMMAND_H
#define KOSHAPEGROUPCOMMAND_H
#include "kritaflake_export.h"
#include <QList>
#include <kundo2command.h>
class KoShape;
class KoShapeGroup;
class KoShapeContainer;
class KoShapeGroupCommandPrivate;
/// The undo / redo command for grouping shapes
class KRITAFLAKE_EXPORT KoShapeGroupCommand : public KUndo2Command
{
public:
/**
* Create command to group a set of shapes into a predefined container.
* This uses the KoShapeGroupCommand(KoShapeGroup *container, const QList<KoShape *> &shapes, KUndo2Command *parent = 0);
* constructor.
* The createCommand will make sure that the group will have the z-index and the parent of the top most shape in the group.
*
* @param container the group to group the shapes under.
* @param parent the parent command if the resulting command is a compound undo command.
* @param shapes a list of all the shapes that should be grouped.
*/
static KoShapeGroupCommand *createCommand(KoShapeGroup *container, const QList<KoShape *> &shapes, KUndo2Command *parent = 0);
/**
* Command to group a set of shapes into a predefined container.
* @param container the container to group the shapes under.
* @param shapes a list of all the shapes that should be grouped.
* @param clipped a list of the same length as the shapes list with one bool for each shape.
* See KoShapeContainer::isClipped()
* @param inheritTransform a list of the same length as the shapes list with one bool for each shape.
* See KoShapeContainer::inheritsTransform()
* @param parent the parent command used for macro commands
*/
KoShapeGroupCommand(KoShapeContainer *container, const QList<KoShape *> &shapes,
const QList<bool> &clipped, const QList<bool> &inheritTransform, KUndo2Command *parent = 0);
/**
* Command to group a set of shapes into a predefined container.
* @param container the container to group the shapes under.
* @param shapes a list of all the shapes that should be grouped.
* @param clipped shows whether the shapes should be clipped by the container
* See KoShapeContainer::isClipped()
* @param inheritTransform shows whether the shapes should inherit the parent transformation
* See KoShapeContainer::inheritsTransform()
* @param parent the parent command used for macro commands
*/
KoShapeGroupCommand(KoShapeContainer *container, const QList<KoShape *> &shapes,
bool clipped, bool inheritTransform, bool shouldNormalize, KUndo2Command *parent = 0);
/**
* Command to group a set of shapes into a predefined container.
* Convenience constructor since KoShapeGroup does not allow clipping.
* @param container the group to group the shapes under.
* @param parent the parent command if the resulting command is a compound undo command.
* @param shapes a list of all the shapes that should be grouped.
*/
KoShapeGroupCommand(KoShapeGroup *container, const QList<KoShape *> &shapes, KUndo2Command *parent = 0);
- virtual ~KoShapeGroupCommand();
+ ~KoShapeGroupCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
protected:
KoShapeGroupCommandPrivate *d;
KoShapeGroupCommand(KoShapeGroupCommandPrivate &, KUndo2Command *parent);
};
#endif
diff --git a/libs/flake/commands/KoShapeKeepAspectRatioCommand.h b/libs/flake/commands/KoShapeKeepAspectRatioCommand.h
index 24f13cc3ed..dc03eff77c 100644
--- a/libs/flake/commands/KoShapeKeepAspectRatioCommand.h
+++ b/libs/flake/commands/KoShapeKeepAspectRatioCommand.h
@@ -1,56 +1,56 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Peter Simonsson <peter.simonsson@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEKEEPASPECTRATIOCOMMAND_H
#define KOSHAPEKEEPASPECTRATIOCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
/**
* Command that changes the keepAspectRatio property of KoShape
*/
class KRITAFLAKE_EXPORT KoShapeKeepAspectRatioCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param shapes the shapes affected by the command
* @param oldKeepAspectRatio the old settings
* @param newKeepAspectRatio the new settings
* @param parent the parent command
*/
KoShapeKeepAspectRatioCommand(const QList<KoShape*> &shapes, const QList<bool> &oldKeepAspectRatio, const QList<bool> &newKeepAspectRatio, KUndo2Command* parent = 0);
- ~KoShapeKeepAspectRatioCommand();
+ ~KoShapeKeepAspectRatioCommand() override;
/// Execute the command
- virtual void redo();
+ void redo() override;
/// Unexecute the command
- virtual void undo();
+ void undo() override;
private:
QList<KoShape*> m_shapes;
QList<bool> m_oldKeepAspectRatio;
QList<bool> m_newKeepAspectRatio;
};
#endif
diff --git a/libs/flake/commands/KoShapeLockCommand.h b/libs/flake/commands/KoShapeLockCommand.h
index f908103fce..5ede501321 100644
--- a/libs/flake/commands/KoShapeLockCommand.h
+++ b/libs/flake/commands/KoShapeLockCommand.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPELOCKCOMMAND_H
#define KOSHAPELOCKCOMMAND_H
#include <kundo2command.h>
#include <QList>
class KoShape;
/// The undo / redo command to lock a set of shapes position and size
class KoShapeLockCommand : public KUndo2Command
{
public:
/**
* Command to lock a set of shapes position and size
* @param shapes a set of shapes that should change lock state
* @param oldLock list of old lock states the same length as @p shapes
* @param newLock list of new lock states the same length as @p shapes
* @param parent the parent command used for macro commands
*/
KoShapeLockCommand(const QList<KoShape*> &shapes, const QList<bool> &oldLock, const QList<bool> &newLock,
KUndo2Command *parent = 0);
- ~KoShapeLockCommand();
+ ~KoShapeLockCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
QList<KoShape*> m_shapes; /// the shapes to set background for
QList<bool> m_oldLock; /// old lock states
QList<bool> m_newLock; /// new lock states
};
#endif
diff --git a/libs/flake/commands/KoShapeMoveCommand.h b/libs/flake/commands/KoShapeMoveCommand.h
index 711222440a..ac93bc3893 100644
--- a/libs/flake/commands/KoShapeMoveCommand.h
+++ b/libs/flake/commands/KoShapeMoveCommand.h
@@ -1,65 +1,65 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEMOVECOMMAND_H
#define KOSHAPEMOVECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
#include <QPointF>
#include <KoFlake.h>
class KoShape;
/// The undo / redo command for shape moving.
class KRITAFLAKE_EXPORT KoShapeMoveCommand : public KUndo2Command
{
public:
/**
* Constructor.
* @param shapes the set of objects that are moved.
* @param previousPositions the known set of previous positions for each of the objects.
* this list naturally must have the same amount of items as the shapes set.
* @param newPositions the new positions for the shapes.
* this list naturally must have the same amount of items as the shapes set.
* @param parent the parent command used for macro commands
*/
KoShapeMoveCommand(const QList<KoShape*> &shapes, QList<QPointF> &previousPositions, QList<QPointF> &newPositions,
KoFlake::AnchorPosition anchor = KoFlake::Center, KUndo2Command *parent = 0);
KoShapeMoveCommand(const QList<KoShape*> &shapes, const QPointF &offset, KUndo2Command *parent = 0);
- ~KoShapeMoveCommand();
+ ~KoShapeMoveCommand() override;
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeRenameCommand.h b/libs/flake/commands/KoShapeRenameCommand.h
index 76b9764b0c..28b2e8fbf3 100644
--- a/libs/flake/commands/KoShapeRenameCommand.h
+++ b/libs/flake/commands/KoShapeRenameCommand.h
@@ -1,46 +1,46 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPERENAMECOMMAND_H
#define KOSHAPERENAMECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
class QString;
class KoShape;
/// API docs go here
class KRITAFLAKE_EXPORT KoShapeRenameCommand : public KUndo2Command
{
public:
KoShapeRenameCommand(KoShape *shape, const QString &newName, KUndo2Command *parent = 0);
- virtual ~KoShapeRenameCommand();
+ ~KoShapeRenameCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif /* KOSHAPERENAMECOMMAND_H */
diff --git a/libs/flake/commands/KoShapeReorderCommand.h b/libs/flake/commands/KoShapeReorderCommand.h
index 109f696a5c..f04ae2391e 100644
--- a/libs/flake/commands/KoShapeReorderCommand.h
+++ b/libs/flake/commands/KoShapeReorderCommand.h
@@ -1,89 +1,89 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEREORDERCOMMAND_H
#define KOSHAPEREORDERCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoShapeManager;
class KoShapeReorderCommandPrivate;
/// This command allows you to change the zIndex of a number of shapes.
class KRITAFLAKE_EXPORT KoShapeReorderCommand : public KUndo2Command
{
public:
/**
* Constructor.
* @param shapes the set of objects that are moved.
* @param newIndexes the new indexes for the shapes.
* this list naturally must have the same amount of items as the shapes set.
* @param parent the parent command used for macro commands
*/
KoShapeReorderCommand(const QList<KoShape*> &shapes, QList<int> &newIndexes, KUndo2Command *parent = 0);
- ~KoShapeReorderCommand();
+ ~KoShapeReorderCommand() override;
/// An enum for defining what kind of reordering to use.
enum MoveShapeType {
RaiseShape, ///< raise the selected shape to the level that it is above the shape that is on top of it.
LowerShape, ///< Lower the selected shape to the level that it is below the shape that is below it.
BringToFront, ///< Raise the selected shape to be on top of all shapes.
SendToBack ///< Lower the selected shape to be below all other shapes.
};
/**
* Create a new KoShapeReorderCommand by calculating the new indexes required to move the shapes
* according to the move parameter.
* @param shapes all the shapes that should be moved.
* @param manager the shapeManager that contains all the shapes that could have their indexes changed.
* @param move the moving type.
* @param parent the parent command for grouping purposes.
* @return command for reording the shapes or 0 if no reordering happend
*/
static KoShapeReorderCommand *createCommand(const QList<KoShape*> &shapes, KoShapeManager *manager,
MoveShapeType move, KUndo2Command *parent = 0);
/**
* @brief mergeInShape adjust zIndex of all the \p shapes and \p newShape to
* avoid collisions between \p shapes and \p newShape.
*
* Note1: \p newShape may or may not be contained in \p shapes, there
* is no difference.
* Note2: the collisions inside \p shapes are ignored. They are just
* adjusted to avoid collisions with \p newShape only
* @param parent the parent command for grouping purposes.
* @return command for reording the shapes or 0 if no reordering happend
*/
static KoShapeReorderCommand *mergeInShape(QList<KoShape*> shapes, KoShape *newShape,
KUndo2Command *parent = 0);
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoShapeReorderCommandPrivate * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeResizeCommand.h b/libs/flake/commands/KoShapeResizeCommand.h
index 3d9a01b05f..c8115f9679 100644
--- a/libs/flake/commands/KoShapeResizeCommand.h
+++ b/libs/flake/commands/KoShapeResizeCommand.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPERESIZECOMMAND_H
#define KOSHAPERESIZECOMMAND_H
#include "kritaflake_export.h"
#include "kundo2command.h"
#include "kis_command_utils.h"
#include <QList>
#include <QPointF>
#include <KoFlake.h>
#include <QScopedPointer>
class KoShape;
class KRITAFLAKE_EXPORT KoShapeResizeCommand : public KisCommandUtils::SkipFirstRedoBase
{
public:
KoShapeResizeCommand(const QList<KoShape*> &shapes,
qreal scaleX, qreal scaleY,
const QPointF &absoluteStillPoint, bool useGLobalMode,
bool usePostScaling, const QTransform &postScalingCoveringTransform,
KUndo2Command *parent = 0);
- ~KoShapeResizeCommand();
+ ~KoShapeResizeCommand() override;
void redoImpl() override;
void undoImpl() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
class Private;
QScopedPointer<Private> const m_d;
};
#endif // KOSHAPERESIZECOMMAND_H
diff --git a/libs/flake/commands/KoShapeRunAroundCommand.h b/libs/flake/commands/KoShapeRunAroundCommand.h
index e7e0cda302..906dc9b1bd 100644
--- a/libs/flake/commands/KoShapeRunAroundCommand.h
+++ b/libs/flake/commands/KoShapeRunAroundCommand.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPERUNAROUNDCOMMAND_H
#define KOSHAPERUNAROUNDCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include "KoShape.h"
/// API docs go here
class KRITAFLAKE_EXPORT KoShapeRunAroundCommand : public KUndo2Command
{
public:
KoShapeRunAroundCommand(KoShape *shape, KoShape::TextRunAroundSide side, int runThrough, qreal distanceLeft, qreal distanceTop, qreal distanceRight, qreal distanceBottom, qreal threshold, KoShape::TextRunAroundContour contour, KUndo2Command *parent = 0);
- virtual ~KoShapeRunAroundCommand();
+ ~KoShapeRunAroundCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif /* KOSHAPERUNAROUNDCOMMAND_H */
diff --git a/libs/flake/commands/KoShapeShadowCommand.h b/libs/flake/commands/KoShapeShadowCommand.h
index 62e6c450dd..3ca40f3acb 100644
--- a/libs/flake/commands/KoShapeShadowCommand.h
+++ b/libs/flake/commands/KoShapeShadowCommand.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPESHADOWCOMMAND_H
#define KOSHAPESHADOWCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoShapeShadow;
/// The undo / redo command for setting the shape shadow
class KRITAFLAKE_EXPORT KoShapeShadowCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape shadow.
* @param shapes a set of all the shapes that should get the new shadow.
* @param shadow the new shadow, the same for all given shapes
* @param parent the parent command used for macro commands
*/
KoShapeShadowCommand(const QList<KoShape*> & shapes, KoShapeShadow *shadow, KUndo2Command *parent = 0);
/**
* Command to set new shape shadows.
* @param shapes a set of all the shapes that should get a new shadow.
* @param shadows the new shadows, one for each shape
* @param parent the parent command used for macro commands
*/
KoShapeShadowCommand(const QList<KoShape*> &shapes, const QList<KoShapeShadow*> &shadows, KUndo2Command *parent = 0);
/**
* Command to set a new shape shadow.
* @param shape a single shape that should get the new shadow.
* @param shadow the new shadow
* @param parent the parent command used for macro commands
*/
KoShapeShadowCommand(KoShape *shape, KoShapeShadow *shadow, KUndo2Command *parent = 0);
- virtual ~KoShapeShadowCommand();
+ ~KoShapeShadowCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif // KOSHAPESHADOWCOMMAND_H
diff --git a/libs/flake/commands/KoShapeShearCommand.h b/libs/flake/commands/KoShapeShearCommand.h
index d4a7b1e6a5..598cef6417 100644
--- a/libs/flake/commands/KoShapeShearCommand.h
+++ b/libs/flake/commands/KoShapeShearCommand.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPESHEARCOMMAND_H
#define KOSHAPESHEARCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoShapeShearCommandPrivate;
/// The undo / redo command for shape shearing.
class KRITAFLAKE_EXPORT KoShapeShearCommand : public KUndo2Command
{
public:
/**
* Comand to rotate a selection of shapes. Note that it just alters the rotated
* property of those shapes, and nothing more.
* @param shapes all the shapes that should be rotated
* @param previousShearXs a list with the same amount of items as shapes with the
* old shearX values
* @param previousShearYs a list with the same amount of items as shapes with the
* old shearY values
* @param newShearXs a list with the same amount of items as shapes with the new values.
* @param newShearYs a list with the same amount of items as shapes with the new values.
* @param parent the parent command used for macro commands
*/
KoShapeShearCommand(const QList<KoShape*> &shapes, const QList<qreal> &previousShearXs, const QList<qreal> &previousShearYs, const QList<qreal> &newShearXs, const QList<qreal> &newShearYs, KUndo2Command *parent = 0);
- ~KoShapeShearCommand();
+ ~KoShapeShearCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoShapeShearCommandPrivate * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeSizeCommand.h b/libs/flake/commands/KoShapeSizeCommand.h
index 2fb6bba616..ba1edf9279 100644
--- a/libs/flake/commands/KoShapeSizeCommand.h
+++ b/libs/flake/commands/KoShapeSizeCommand.h
@@ -1,56 +1,56 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPESIZECOMMAND_H
#define KOSHAPESIZECOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
/// The undo / redo command for shape sizing.
class KRITAFLAKE_EXPORT KoShapeSizeCommand : public KUndo2Command
{
public:
/**
* The undo / redo command for shape sizing.
* @param shapes all the shapes that will be rezised at the same time
* @param previousSizes the old sizes; in a list with a member for each shape
* @param newSizes the new sizes; in a list with a member for each shape
* @param parent the parent command used for macro commands
*/
KoShapeSizeCommand(const QList<KoShape*> &shapes, const QList<QSizeF> &previousSizes,
const QList<QSizeF> &newSizes, KUndo2Command *parent = 0);
- ~KoShapeSizeCommand();
+ ~KoShapeSizeCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeStrokeCommand.h b/libs/flake/commands/KoShapeStrokeCommand.h
index 19e0609881..021bcc2fcf 100644
--- a/libs/flake/commands/KoShapeStrokeCommand.h
+++ b/libs/flake/commands/KoShapeStrokeCommand.h
@@ -1,77 +1,77 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPESTROKECOMMAND_H
#define KOSHAPESTROKECOMMAND_H
#include "kritaflake_export.h"
#include <KoFlakeTypes.h>
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoShapeStrokeModel;
/// The undo / redo command for setting the shape stroke
class KRITAFLAKE_EXPORT KoShapeStrokeCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape stroke.
* @param shapes a set of all the shapes that should get the new stroke.
* @param stroke the new stroke, the same for all given shapes
* @param parent the parent command used for macro commands
*/
KoShapeStrokeCommand(const QList<KoShape*> &shapes, KoShapeStrokeModelSP stroke, KUndo2Command *parent = 0);
/**
* Command to set new shape strokes.
* @param shapes a set of all the shapes that should get a new stroke.
* @param strokes the new strokes, one for each shape
* @param parent the parent command used for macro commands
*/
KoShapeStrokeCommand(const QList<KoShape*> &shapes, const QList<KoShapeStrokeModelSP> &strokes, KUndo2Command *parent = 0);
/**
* Command to set a new shape stroke.
* @param shape a single shape that should get the new stroke.
* @param stroke the new stroke
* @param parent the parent command used for macro commands
*/
KoShapeStrokeCommand(KoShape* shape, KoShapeStrokeModelSP stroke, KUndo2Command *parent = 0);
- virtual ~KoShapeStrokeCommand();
+ ~KoShapeStrokeCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/flake/commands/KoShapeTransformCommand.h b/libs/flake/commands/KoShapeTransformCommand.h
index 4a51014689..ed5b6cfbc5 100644
--- a/libs/flake/commands/KoShapeTransformCommand.h
+++ b/libs/flake/commands/KoShapeTransformCommand.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPETRANSFORMCOMMAND_H
#define KOSHAPETRANSFORMCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
class KoShape;
class QTransform;
/**
* A command to transform a selection of shapes with the same transformation.
*/
class KRITAFLAKE_EXPORT KoShapeTransformCommand : public KUndo2Command
{
public:
/**
* A command to transform a selection of shapes to the new state.
* Each shape passed has an old state and a new state of transformation passed in.
* @param shapes all the shapes that should be transformed
* @param oldState the old shapes transformations
* @param newState the new shapes transformations
* @see KoShape::transformation()
* @see KoShape::setTransformation()
*/
KoShapeTransformCommand(const QList<KoShape*> &shapes, const QList<QTransform> &oldState, const QList<QTransform> &newState, KUndo2Command * parent = 0);
- ~KoShapeTransformCommand();
+ ~KoShapeTransformCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
class Private;
Private * const d;
};
#endif // KOSHAPETRANSFORMCOMMAND_H
diff --git a/libs/flake/commands/KoShapeTransparencyCommand.h b/libs/flake/commands/KoShapeTransparencyCommand.h
index 4cad1f9b25..c451237973 100644
--- a/libs/flake/commands/KoShapeTransparencyCommand.h
+++ b/libs/flake/commands/KoShapeTransparencyCommand.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPETRANSPARENCYCOMMAND_H
#define KOSHAPETRANSPARENCYCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
/// The undo / redo command for setting the shape transparency
class KRITAFLAKE_EXPORT KoShapeTransparencyCommand : public KUndo2Command
{
public:
/**
* Command to set a new shape transparency.
* @param shapes a set of all the shapes that should get the new background.
* @param transparency the new shape transparency
* @param parent the parent command used for macro commands
*/
KoShapeTransparencyCommand(const QList<KoShape*> &shapes, qreal transparency, KUndo2Command *parent = 0);
/**
* Command to set a new shape transparency.
* @param shape a single shape that should get the new transparency.
* @param transparency the new shape transparency
* @param parent the parent command used for macro commands
*/
KoShapeTransparencyCommand(KoShape *shape, qreal transparency, KUndo2Command *parent = 0);
/**
* Command to set new shape transparencies.
* @param shapes a set of all the shapes that should get a new transparency.
* @param fills the new transparencies, one for each shape
* @param parent the parent command used for macro commands
*/
KoShapeTransparencyCommand(const QList<KoShape*> &shapes, const QList<qreal> &transparencies, KUndo2Command *parent = 0);
- virtual ~KoShapeTransparencyCommand();
+ ~KoShapeTransparencyCommand() override;
/// redo the command
void redo() override;
/// revert the actions done in redo
void undo() override;
int id() const override;
bool mergeWith(const KUndo2Command *command) override;
private:
class Private;
Private * const d;
};
#endif // KOSHAPETRANSPARENCYCOMMAND_H
diff --git a/libs/flake/commands/KoShapeUnclipCommand.h b/libs/flake/commands/KoShapeUnclipCommand.h
index 1c92c6128a..f7229290d1 100644
--- a/libs/flake/commands/KoShapeUnclipCommand.h
+++ b/libs/flake/commands/KoShapeUnclipCommand.h
@@ -1,63 +1,63 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEUNCLIPCOMMAND_H
#define KOSHAPEUNCLIPCOMMAND_H
#include "kritaflake_export.h"
#include <kundo2command.h>
#include <QList>
class KoShape;
class KoShapeBasedDocumentBase;
/// The undo / redo command for removing the shape clip path
class KRITAFLAKE_EXPORT KoShapeUnclipCommand : public KUndo2Command
{
public:
/**
* Command to remove clip path from multiple shapes.
* @param controller the controller to used for adding the clip shapes.
* @param shapes a set of all the shapes to remove the clip path from.
* @param parent the parent command used for macro commands
*/
KoShapeUnclipCommand(KoShapeBasedDocumentBase *controller, const QList<KoShape*> &shapes, KUndo2Command *parent = 0);
/**
* Command to remove clip path from a single shape.
* @param controller the controller to used for adding the clip shapes.
* @param shape a single shape to remove the clip path from.
* @param parent the parent command used for macro commands
*/
KoShapeUnclipCommand(KoShapeBasedDocumentBase *controller, KoShape *shape, KUndo2Command *parent = 0);
/// Destroys the command
- virtual ~KoShapeUnclipCommand();
+ ~KoShapeUnclipCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
class Private;
Private * const d;
};
#endif // KOSHAPEUNCLIPCOMMAND_H
diff --git a/libs/flake/commands/KoShapeUngroupCommand.h b/libs/flake/commands/KoShapeUngroupCommand.h
index 595431bb47..7471e681ed 100644
--- a/libs/flake/commands/KoShapeUngroupCommand.h
+++ b/libs/flake/commands/KoShapeUngroupCommand.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPEUNGROUPCOMMAND_H
#define KOSHAPEUNGROUPCOMMAND_H
#include "KoShapeGroupCommand.h"
#include "kritaflake_export.h"
#include <kundo2command.h>
/// The undo / redo command for ungrouping shapes
class KRITAFLAKE_EXPORT KoShapeUngroupCommand : public KoShapeGroupCommand
{
public:
/**
* Command to ungroup a set of shapes from one parent container.
* @param container the group to ungroup the shapes from.
* @param shapes a list of all the shapes that should be ungrouped.
* @param parent the parent command used for macro commands
*/
KoShapeUngroupCommand(KoShapeContainer *container, const QList<KoShape *> &shapes,
const QList<KoShape *> &topLevelShapes = QList<KoShape*>(), KUndo2Command *parent = 0);
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
};
#endif
diff --git a/libs/flake/commands/KoSubpathJoinCommand.h b/libs/flake/commands/KoSubpathJoinCommand.h
index c308988922..32ec8c2a7e 100644
--- a/libs/flake/commands/KoSubpathJoinCommand.h
+++ b/libs/flake/commands/KoSubpathJoinCommand.h
@@ -1,65 +1,65 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSUBPATHJOINCOMMAND_H
#define KOSUBPATHJOINCOMMAND_H
#include <kundo2command.h>
#include <QPointF>
#include "KoPathPoint.h"
#include "KoPathPointData.h"
/// The undo / redo command for joining two subpath end points
class KoSubpathJoinCommand : public KUndo2Command
{
public:
/**
* Command to join two subpath end points.
*
* The points have to be from the same path shape.
*
* @param pointData1 the data of the first point to join
* @param pointData2 the data of the second point to join
* @param parent the parent command used for macro commands
*/
KoSubpathJoinCommand(const KoPathPointData &pointData1, const KoPathPointData &pointData2, KUndo2Command *parent = 0);
- ~KoSubpathJoinCommand();
+ ~KoSubpathJoinCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoPathPointData m_pointData1;
KoPathPointData m_pointData2;
KoPathPointIndex m_splitIndex;
// the control points have to be stored in document positions
QPointF m_oldControlPoint1;
QPointF m_oldControlPoint2;
KoPathPoint::PointProperties m_oldProperties1;
KoPathPoint::PointProperties m_oldProperties2;
enum Reverse {
ReverseFirst = 1,
ReverseSecond = 2
};
int m_reverse;
};
#endif // KOSUBPATHJOINCOMMAND_H
diff --git a/libs/flake/commands/KoSubpathRemoveCommand.h b/libs/flake/commands/KoSubpathRemoveCommand.h
index b8873570d7..34fc93cfcc 100644
--- a/libs/flake/commands/KoSubpathRemoveCommand.h
+++ b/libs/flake/commands/KoSubpathRemoveCommand.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSUBPATHREMOVECOMMAND_H
#define KOSUBPATHREMOVECOMMAND_H
#include <kundo2command.h>
#include <QList>
#include "KoPathShape.h"
#include "kritaflake_export.h"
/// The undo / redo command for removing a subpath
class KRITAFLAKE_EXPORT KoSubpathRemoveCommand : public KUndo2Command
{
public:
/**
* Create a new command to remove a subpath.
* @param pathShape the shape to work on.
* @param subpathIndex the index. See KoPathShape::removeSubpath()
* @param parent the parent command if the resulting command is a compound undo command.
*/
KoSubpathRemoveCommand(KoPathShape *pathShape, int subpathIndex, KUndo2Command *parent = 0);
- ~KoSubpathRemoveCommand();
+ ~KoSubpathRemoveCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoPathShape *m_pathShape;
int m_subpathIndex;
KoSubpath *m_subpath;
};
#endif // KOSUBPATHREMOVECOMMAND_H
diff --git a/libs/flake/svg/SvgShapeFactory.h b/libs/flake/svg/SvgShapeFactory.h
index a2efee10da..28a097b42d 100644
--- a/libs/flake/svg/SvgShapeFactory.h
+++ b/libs/flake/svg/SvgShapeFactory.h
@@ -1,42 +1,42 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGSHAPEFACTORY_H
#define SVGSHAPEFACTORY_H
#include "kritaflake_export.h"
#include "KoShapeFactoryBase.h"
/// Use this shape factory to load embedded svg files from odf
class KRITAFLAKE_EXPORT SvgShapeFactory : public KoShapeFactoryBase
{
public:
SvgShapeFactory();
- ~SvgShapeFactory();
+ ~SvgShapeFactory() override;
// reimplemented from KoShapeFactoryBase
- virtual bool supports(const KoXmlElement &element, KoShapeLoadingContext &context) const;
+ bool supports(const KoXmlElement &element, KoShapeLoadingContext &context) const override;
// reimplemented from KoShapeFactoryBase
- virtual KoShape *createShapeFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ KoShape *createShapeFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// Adds an instance of this factory to the shape registry, if not already registered
static void addToRegistry();
};
#endif // SVGSHAPEFACTORY_H
diff --git a/libs/flake/tests/MockShapes.h b/libs/flake/tests/MockShapes.h
index be291ee737..6aa0c34679 100644
--- a/libs/flake/tests/MockShapes.h
+++ b/libs/flake/tests/MockShapes.h
@@ -1,255 +1,255 @@
/*
* This file is part of Calligra tests
*
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MOCKSHAPES_H
#define MOCKSHAPES_H
#include <KoSelectedShapesProxySimple.h>
#include <KoShapeGroup.h>
#include <KoCanvasBase.h>
#include <KoShapeBasedDocumentBase.h>
#include <KoShapeContainerModel.h>
#include <QPainter>
#include "KoShapeManager.h"
#include "FlakeDebug.h"
#include "KoSnapData.h"
#include "KoUnit.h"
#include "kritaflake_export.h"
class KRITAFLAKE_EXPORT MockShape : public KoShape
{
public:
MockShape() : paintedCount(0) {}
- void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) {
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) override {
Q_UNUSED(painter);
Q_UNUSED(converter);
//qDebug() << "Shape" << kBacktrace( 10 );
paintedCount++;
}
- virtual void saveOdf(KoShapeSavingContext &) const {}
- virtual bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) {
+ void saveOdf(KoShapeSavingContext &) const override {}
+ bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) override {
return true;
}
int paintedCount;
};
class KRITAFLAKE_EXPORT MockContainer : public KoShapeContainer
{
public:
MockContainer(KoShapeContainerModel *model = 0) : KoShapeContainer(model), paintedCount(0) {}
- void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) {
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) override {
Q_UNUSED(painter);
Q_UNUSED(converter);
//qDebug() << "Container:" << kBacktrace( 10 );
paintedCount++;
}
- virtual void saveOdf(KoShapeSavingContext &) const {}
- virtual bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) {
+ void saveOdf(KoShapeSavingContext &) const override {}
+ bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) override {
return true;
}
int paintedCount;
};
class KRITAFLAKE_EXPORT MockGroup : public KoShapeGroup
{
- void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) {
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &) override {
Q_UNUSED(painter);
Q_UNUSED(converter);
}
};
class KoToolProxy;
class KRITAFLAKE_EXPORT MockShapeController : public KoShapeBasedDocumentBase
{
public:
- void addShapes(const QList<KoShape*> shapes) {
+ void addShapes(const QList<KoShape*> shapes) override {
Q_FOREACH (KoShape *shape, shapes) {
m_shapes.insert(shape);
if (m_shapeManager) {
m_shapeManager->addShape(shape);
}
}
}
- void removeShape(KoShape* shape) {
+ void removeShape(KoShape* shape) override {
m_shapes.remove(shape);
if (m_shapeManager) {
m_shapeManager->remove(shape);
}
}
bool contains(KoShape* shape) {
return m_shapes.contains(shape);
}
void setShapeManager(KoShapeManager *shapeManager) {
m_shapeManager = shapeManager;
}
- QRectF documentRectInPixels() const {
+ QRectF documentRectInPixels() const override {
return QRectF(0,0,100,100);
}
- qreal pixelsPerInch() const {
+ qreal pixelsPerInch() const override {
return 72.0;
}
private:
QSet<KoShape * > m_shapes;
KoShapeManager *m_shapeManager = 0;
};
class KRITAFLAKE_EXPORT MockCanvas : public KoCanvasBase
{
Q_OBJECT
public:
MockCanvas(KoShapeBasedDocumentBase *aKoShapeBasedDocumentBase =0)//made for TestSnapStrategy.cpp
: KoCanvasBase(aKoShapeBasedDocumentBase),
m_shapeManager(new KoShapeManager(this)),
m_selectedShapesProxy(new KoSelectedShapesProxySimple(m_shapeManager.data()))
{
if (MockShapeController *controller = dynamic_cast<MockShapeController*>(aKoShapeBasedDocumentBase)) {
controller->setShapeManager(m_shapeManager.data());
}
}
- ~MockCanvas() {}
+ ~MockCanvas() override {}
void setHorz(qreal pHorz){
m_horz = pHorz;
}
void setVert(qreal pVert){
m_vert = pVert;
}
- void gridSize(QPointF *offset, QSizeF *spacing) const {
+ void gridSize(QPointF *offset, QSizeF *spacing) const override {
Q_UNUSED(offset);
spacing->setWidth(m_horz);
spacing->setHeight(m_vert);
}
- bool snapToGrid() const {
+ bool snapToGrid() const override {
return true;
}
- void addCommand(KUndo2Command*) { }
- KoShapeManager *shapeManager() const {
+ void addCommand(KUndo2Command*) override { }
+ KoShapeManager *shapeManager() const override {
return m_shapeManager.data();
}
- KoSelectedShapesProxy *selectedShapesProxy() const {
+ KoSelectedShapesProxy *selectedShapesProxy() const override {
return m_selectedShapesProxy.data();
}
- void updateCanvas(const QRectF&) {}
- KoToolProxy * toolProxy() const {
+ void updateCanvas(const QRectF&) override {}
+ KoToolProxy * toolProxy() const override {
return 0;
}
- KoViewConverter *viewConverter() const {
+ KoViewConverter *viewConverter() const override {
return 0;
}
- QWidget* canvasWidget() {
+ QWidget* canvasWidget() override {
return 0;
}
- const QWidget* canvasWidget() const {
+ const QWidget* canvasWidget() const override {
return 0;
}
- KoUnit unit() const {
+ KoUnit unit() const override {
return KoUnit(KoUnit::Millimeter);
}
- void updateInputMethodInfo() {}
- void setCursor(const QCursor &) {}
+ void updateInputMethodInfo() override {}
+ void setCursor(const QCursor &) override {}
private:
QScopedPointer<KoShapeManager> m_shapeManager;
QScopedPointer<KoSelectedShapesProxy> m_selectedShapesProxy;
qreal m_horz;
qreal m_vert;
};
class KRITAFLAKE_EXPORT MockContainerModel : public KoShapeContainerModel
{
public:
MockContainerModel() {
resetCounts();
}
/// reimplemented
- void add(KoShape *child) {
+ void add(KoShape *child) override {
m_children.append(child); // note that we explicitly do not check for duplicates here!
}
/// reimplemented
- void remove(KoShape *child) {
+ void remove(KoShape *child) override {
m_children.removeAll(child);
}
/// reimplemented
- void setClipped(const KoShape *, bool) { } // ignored
+ void setClipped(const KoShape *, bool) override { } // ignored
/// reimplemented
- bool isClipped(const KoShape *) const {
+ bool isClipped(const KoShape *) const override {
return false;
}// ignored
/// reimplemented
- bool isChildLocked(const KoShape *child) const {
+ bool isChildLocked(const KoShape *child) const override {
return child->isGeometryProtected();
}
/// reimplemented
- int count() const {
+ int count() const override {
return m_children.count();
}
/// reimplemented
- QList<KoShape*> shapes() const {
+ QList<KoShape*> shapes() const override {
return m_children;
}
/// reimplemented
- void containerChanged(KoShapeContainer *, KoShape::ChangeType) {
+ void containerChanged(KoShapeContainer *, KoShape::ChangeType) override {
m_containerChangedCalled++;
}
/// reimplemented
- void proposeMove(KoShape *, QPointF &) {
+ void proposeMove(KoShape *, QPointF &) override {
m_proposeMoveCalled++;
}
/// reimplemented
- void childChanged(KoShape *, KoShape::ChangeType) {
+ void childChanged(KoShape *, KoShape::ChangeType) override {
m_childChangedCalled++;
}
- void setInheritsTransform(const KoShape *, bool) {
+ void setInheritsTransform(const KoShape *, bool) override {
}
- bool inheritsTransform(const KoShape *) const {
+ bool inheritsTransform(const KoShape *) const override {
return false;
}
int containerChangedCalled() const {
return m_containerChangedCalled;
}
int childChangedCalled() const {
return m_childChangedCalled;
}
int proposeMoveCalled() const {
return m_proposeMoveCalled;
}
void resetCounts() {
m_containerChangedCalled = 0;
m_childChangedCalled = 0;
m_proposeMoveCalled = 0;
}
private:
QList<KoShape*> m_children;
int m_containerChangedCalled, m_childChangedCalled, m_proposeMoveCalled;
};
#endif
diff --git a/libs/flake/tests/TestShapeGroupCommand.h b/libs/flake/tests/TestShapeGroupCommand.h
index 79e4643fad..d03c010426 100644
--- a/libs/flake/tests/TestShapeGroupCommand.h
+++ b/libs/flake/tests/TestShapeGroupCommand.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TESTSHAPEGROUPCOMMAND_H
#define TESTSHAPEGROUPCOMMAND_H
#include <QObject>
class KoShapeGroup;
class KUndo2Command;
class MockShape;
class TestShapeGroupCommand : public QObject
{
Q_OBJECT
public:
TestShapeGroupCommand();
- ~TestShapeGroupCommand();
+ ~TestShapeGroupCommand() override;
private Q_SLOTS:
void init();
void cleanup();
void testToplevelGroup();
void testSublevelGroup();
void testAddToToplevelGroup();
void testAddToSublevelGroup();
void testGroupStrokeShapes();
private:
KoShapeGroup *toplevelGroup, *sublevelGroup, *strokeGroup;
KUndo2Command *cmd1, *cmd2, *strokeCmd;
MockShape *toplevelShape1, *toplevelShape2;
MockShape *sublevelShape1, *sublevelShape2;
MockShape *extraShape1, *extraShape2;
MockShape *strokeShape1, *strokeShape2;
};
#endif // TESTSHAPEGROUPCOMMAND_H
diff --git a/libs/flake/tests/TestShapeReorderCommand.h b/libs/flake/tests/TestShapeReorderCommand.h
index 946229ef5b..2acc339128 100644
--- a/libs/flake/tests/TestShapeReorderCommand.h
+++ b/libs/flake/tests/TestShapeReorderCommand.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TESTSHAPEREORDERCOMMAND_H
#define TESTSHAPEREORDERCOMMAND_H
#include <QObject>
class TestShapeReorderCommand : public QObject
{
Q_OBJECT
public:
TestShapeReorderCommand();
- ~TestShapeReorderCommand();
+ ~TestShapeReorderCommand() override;
private Q_SLOTS:
void testZIndexSorting();
void testRunThroughSorting();
void testParentChildSorting();
void testBringToFront();
void testSendToBack();
void testMoveUp();
void testMoveDown();
void testMoveUpOverlapping();
void testMoveDownOverlapping();
void testSendToBackChildren();
void testNoCommand();
void testMergeInShape();
void testMergeInShapeDistant();
};
#endif // TESTSHAPEREORDERCOMMAND_H
diff --git a/libs/flake/tools/KoCreateShapeStrategy.h b/libs/flake/tools/KoCreateShapeStrategy.h
index 569101cc0a..f6971d16ae 100644
--- a/libs/flake/tools/KoCreateShapeStrategy.h
+++ b/libs/flake/tools/KoCreateShapeStrategy.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCREATESHAPESTRATEGY_H
#define KOCREATESHAPESTRATEGY_H
#include "KoShapeRubberSelectStrategy.h"
#include <QPointF>
#include <QPainterPath>
class KoCreateShapesTool;
/**
* A strategy for the KoCreateShapesTool.
*/
class KoCreateShapeStrategy : public KoShapeRubberSelectStrategy
{
public:
/**
* Constructor that starts to create a new shape.
* @param tool the parent tool which controls this strategy
* @param clicked the initial point that the user depressed (in pt).
*/
KoCreateShapeStrategy(KoCreateShapesTool *tool, const QPointF &clicked);
- virtual ~KoCreateShapeStrategy() {}
+ ~KoCreateShapeStrategy() override {}
- void finishInteraction(Qt::KeyboardModifiers modifiers);
- KUndo2Command* createCommand();
- void paint(QPainter &painter, const KoViewConverter &converter);
- void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command* createCommand() override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
private:
QPainterPath m_outline;
QRectF m_outlineBoundingRect;
Q_DECLARE_PRIVATE(KoShapeRubberSelectStrategy)
};
#endif
diff --git a/libs/flake/tools/KoCreateShapesTool.h b/libs/flake/tools/KoCreateShapesTool.h
index a0e1cae2c2..89fd409b57 100644
--- a/libs/flake/tools/KoCreateShapesTool.h
+++ b/libs/flake/tools/KoCreateShapesTool.h
@@ -1,87 +1,87 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCREATESHAPESTOOL_H
#define KOCREATESHAPESTOOL_H
#include "KoInteractionTool.h"
#include "kritaflake_export.h"
#include <QString>
class KoCanvasBase;
class KoProperties;
class KoCreateShapesToolPrivate;
#define KoCreateShapesTool_ID "CreateShapesTool"
/**
* A tool to create shapes with.
*/
class KRITAFLAKE_EXPORT KoCreateShapesTool : public KoInteractionTool
{
public:
/**
* Create a new tool; typically not called by applications, only by the KoToolManager
* @param canvas the canvas this tool works for.
*/
explicit KoCreateShapesTool(KoCanvasBase *canvas);
/// destructor
- virtual ~KoCreateShapesTool();
- virtual void mouseReleaseEvent(KoPointerEvent *event);
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ ~KoCreateShapesTool() override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
- void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/**
* Each shape-type has an Id; as found in KoShapeFactoryBase::id().id(), to choose which
* shape this controller should actually create; set the id before the user starts to
* create the new shape.
* @param id the SHAPEID of the to be generated shape
*/
void setShapeId(const QString &id);
/**
* return the shape Id that is to be created.
* @return the shape Id that is to be created.
*/
QString shapeId() const;
/**
* Set the shape properties that the create controller will use for the next shape it will
* create. The tool does not take ownership of the object.
* @param properties the properties or 0 if the default shape should be created.
*/
void setShapeProperties(const KoProperties *properties);
/**
* return the properties to be used for creating the next shape
* @return the properties to be used for creating the next shape
*/
const KoProperties *shapeProperties();
protected:
- virtual KoInteractionStrategy *createStrategy(KoPointerEvent *event);
+ KoInteractionStrategy *createStrategy(KoPointerEvent *event) override;
private:
Q_DECLARE_PRIVATE(KoCreateShapesTool)
};
#endif
diff --git a/libs/flake/tools/KoCreateShapesToolFactory.h b/libs/flake/tools/KoCreateShapesToolFactory.h
index b6fac210d9..51ab3cea93 100644
--- a/libs/flake/tools/KoCreateShapesToolFactory.h
+++ b/libs/flake/tools/KoCreateShapesToolFactory.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCREATESHAPESTOOLFACTORY_H
#define KOCREATESHAPESTOOLFACTORY_H
#include "KoToolFactoryBase.h"
/// The factory for the KoCreateShapesTool
class KoCreateShapesToolFactory : public KoToolFactoryBase
{
public:
/// Constructor
KoCreateShapesToolFactory();
/// Destructor
- ~KoCreateShapesToolFactory();
+ ~KoCreateShapesToolFactory() override;
- KoToolBase* createTool(KoCanvasBase *canvas);
+ KoToolBase* createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/libs/flake/tools/KoInteractionTool.h b/libs/flake/tools/KoInteractionTool.h
index a028a6bc4a..36f2f86924 100644
--- a/libs/flake/tools/KoInteractionTool.h
+++ b/libs/flake/tools/KoInteractionTool.h
@@ -1,106 +1,106 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006-2007, 2010 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINTERACTIONTOOL_H
#define KOINTERACTIONTOOL_H
#include "KoToolBase.h"
#include "kritaflake_export.h"
class KoInteractionStrategy;
class KoInteractionStrategyFactory;
class KoInteractionToolPrivate;
#define KoInteractionTool_ID "InteractionTool"
/**
* The interaction tool adds to the normal KoToolBase class the concept of strategies
* as a means to get one tool to have different actions the user can perform using the mouse.
* Each time the user presses the mouse until she releases the mouse a strategy object
* will be created, used and disgarded.
* If the usage of a tool fits this pattern you need to inherit from this class instead of the
* plain KoToolBase and reimplement your createStrategy() method which returns a tool-specific
* strategy where all the real interaction code is placed.
* A tool can then become as simple as this;
* @code
class MyTool : public KoInteractionTool
{
public:
MyTool::MyTool(KoCanvasBase *canvas) : KoInteractionTool( canvas ) { }
KoInteractionStrategy *MyTool::createStrategy(KoPointerEvent *event) {
return new MyStrategy(this, m_canvas, event->point);
}
};
* @endcode
* Whereas your strategy (MyStrategy in the example) will contain the interaction code.
*/
class KRITAFLAKE_EXPORT KoInteractionTool : public KoToolBase
{
Q_OBJECT
public:
/**
* Constructor for basic interaction tool where user actions are translated
* and handled by interaction strategies of type KoInteractionStrategy.
* @param canvas the canvas this tool will be working for.
*/
explicit KoInteractionTool(KoCanvasBase *canvas);
- virtual ~KoInteractionTool();
+ ~KoInteractionTool() override;
public:
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
- virtual void mousePressEvent(KoPointerEvent *event);
- virtual void mouseMoveEvent(KoPointerEvent *event);
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void keyReleaseEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
protected:
/// \internal
KoInteractionTool(KoInteractionToolPrivate &dd);
KoInteractionStrategy *currentStrategy(); ///< the strategy that is 'in progress'
/// Cancels the current strategy and deletes it.
void cancelCurrentStrategy();
/**
* Reimplement this factory method to create your strategy to be used for mouse interaction.
* @returns a new strategy, or 0 when there is nothing to do.
*/
KoInteractionStrategy *createStrategyBase(KoPointerEvent *event);
virtual KoInteractionStrategy *createStrategy(KoPointerEvent *event) = 0;
void addInteractionFactory(KoInteractionStrategyFactory *factory);
void removeInteractionFactory(const QString &id);
bool hasInteractioFactory(const QString &id);
bool tryUseCustomCursor();
private:
KoInteractionTool(const KoInteractionTool&);
KoInteractionTool& operator=(const KoInteractionTool&);
Q_DECLARE_PRIVATE(KoInteractionTool)
};
#endif /* KOINTERACTIONTOOL_H */
diff --git a/libs/flake/tools/KoPanTool.h b/libs/flake/tools/KoPanTool.h
index 918d818821..30d40e8e6e 100644
--- a/libs/flake/tools/KoPanTool.h
+++ b/libs/flake/tools/KoPanTool.h
@@ -1,73 +1,73 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPANTOOL_H
#define KOPANTOOL_H
#include "KoToolBase.h"
#include <QPointF>
class KoCanvasController;
#define KoPanTool_ID "PanTool"
/**
* This is the tool that allows you to move the canvas by dragging it and 'panning' around.
*/
class KoPanTool : public KoToolBase
{
public:
/**
* Constructor.
* @param canvas the canvas this tool works on.
*/
explicit KoPanTool(KoCanvasBase *canvas);
/// reimplemented from superclass
- virtual bool wantsAutoScroll() const;
+ bool wantsAutoScroll() const override;
/// reimplemented from superclass
- virtual void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mouseReleaseEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
/// reimplemented from superclass
- virtual void paint(QPainter &, const KoViewConverter &) {}
+ void paint(QPainter &, const KoViewConverter &) override {}
/// reimplemented from superclass
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
/// reimplemented method
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
/// set the canvasController this tool works on.
void setCanvasController(KoCanvasController *controller) {
m_controller = controller;
}
private:
QPointF documentToViewport(const QPointF &p);
KoCanvasController *m_controller;
QPointF m_lastPosition;
Q_DECLARE_PRIVATE(KoToolBase)
};
#endif
diff --git a/libs/flake/tools/KoPanToolFactory.h b/libs/flake/tools/KoPanToolFactory.h
index 4b15a7e459..272b9965ed 100644
--- a/libs/flake/tools/KoPanToolFactory.h
+++ b/libs/flake/tools/KoPanToolFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPANTOOLFACTORY_H
#define KOPANTOOLFACTORY_H
#include "KoToolFactoryBase.h"
/// Factory for the KoPanTool
class KoPanToolFactory : public KoToolFactoryBase
{
public:
/// constructor
KoPanToolFactory();
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/libs/flake/tools/KoParameterChangeStrategy.h b/libs/flake/tools/KoParameterChangeStrategy.h
index d123037cb0..55200c2c54 100644
--- a/libs/flake/tools/KoParameterChangeStrategy.h
+++ b/libs/flake/tools/KoParameterChangeStrategy.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPARAMETERCHANGESTRATEGY_H
#define KOPARAMETERCHANGESTRATEGY_H
#include "kritaflake_export.h"
#include "KoInteractionStrategy.h"
#include <QPointF>
class KoParameterShape;
class KoParameterChangeStrategyPrivate;
/// Strategy for changing control points of parametric shapes
class KRITAFLAKE_EXPORT KoParameterChangeStrategy : public KoInteractionStrategy
{
public:
/**
* Constructs a strategy for changing control points of parametric shapes.
* @param tool the tool the strategy belongs to
* @param parameterShape the parametric shapes the strategy is working on
* @param handleId the id of the handle to modify
*/
KoParameterChangeStrategy(KoToolBase *tool, KoParameterShape *parameterShape, int handleId);
- virtual ~KoParameterChangeStrategy();
+ ~KoParameterChangeStrategy() override;
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual KUndo2Command* createCommand();
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command* createCommand() override;
protected:
/// constructor
KoParameterChangeStrategy(KoParameterChangeStrategyPrivate &);
private:
Q_DECLARE_PRIVATE(KoParameterChangeStrategy)
};
#endif /* KOPARAMETERCHANGESTRATEGY_H */
diff --git a/libs/flake/tools/KoPathConnectionPointStrategy.h b/libs/flake/tools/KoPathConnectionPointStrategy.h
index 2059b6ee34..33d78779f1 100644
--- a/libs/flake/tools/KoPathConnectionPointStrategy.h
+++ b/libs/flake/tools/KoPathConnectionPointStrategy.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
*
* Copyright (C) 2007 Boudewijn Rempt <boud@kde.org>
* Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_PATH_CONNECTION_POINT_STRATEGY
#define KO_PATH_CONNECTION_POINT_STRATEGY
#include "kritaflake_export.h"
#include "KoParameterChangeStrategy.h"
class KoConnectionShape;
class QPointF;
class KoPathConnectionPointStrategyPrivate;
/**
* @brief Strategy for moving end points of a connection shape.
*/
class KRITAFLAKE_EXPORT KoPathConnectionPointStrategy : public KoParameterChangeStrategy
{
public:
KoPathConnectionPointStrategy(KoToolBase *tool, KoConnectionShape *parameterShape, int handleId);
- virtual ~KoPathConnectionPointStrategy();
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual KUndo2Command* createCommand();
+ ~KoPathConnectionPointStrategy() override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command* createCommand() override;
private:
Q_DECLARE_PRIVATE(KoPathConnectionPointStrategy)
};
#endif
diff --git a/libs/flake/tools/KoPathControlPointMoveStrategy.h b/libs/flake/tools/KoPathControlPointMoveStrategy.h
index 01e6a59891..29c9da590f 100644
--- a/libs/flake/tools/KoPathControlPointMoveStrategy.h
+++ b/libs/flake/tools/KoPathControlPointMoveStrategy.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHCONTROLPOINTMOVESTRATEGY_H
#define KOPATHCONTROLPOINTMOVESTRATEGY_H
#include <QPointF>
#include "KoInteractionStrategy.h"
#include "KoPathPoint.h"
#include "KoPathPointData.h"
class KoPathTool;
/**
* /internal
* @brief Strategy for moving points of a path shape.
*/
class KoPathControlPointMoveStrategy : public KoInteractionStrategy
{
public:
KoPathControlPointMoveStrategy(KoPathTool *tool, const KoPathPointData &point,
KoPathPoint::PointType type, const QPointF &pos);
- virtual ~KoPathControlPointMoveStrategy();
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual KUndo2Command* createCommand();
+ ~KoPathControlPointMoveStrategy() override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command* createCommand() override;
private:
/// the last mouse position
QPointF m_lastPosition;
/// the accumulated point move amount
QPointF m_move;
KoPathTool *m_tool;
KoPathPointData m_pointData;
KoPathPoint::PointType m_pointType;
};
#endif /* KOPATHCONTROLPOINTMOVESTRATEGY_H */
diff --git a/libs/flake/tools/KoPathPointMoveStrategy.h b/libs/flake/tools/KoPathPointMoveStrategy.h
index 8f3f9e237a..7fee7f457a 100644
--- a/libs/flake/tools/KoPathPointMoveStrategy.h
+++ b/libs/flake/tools/KoPathPointMoveStrategy.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTMOVESTRATEGY_H
#define KOPATHPOINTMOVESTRATEGY_H
#include <QPointF>
#include "KoInteractionStrategy.h"
class KoPathTool;
/**
* @brief Strategy for moving points of a path shape.
*/
class KoPathPointMoveStrategy : public KoInteractionStrategy
{
public:
KoPathPointMoveStrategy(KoPathTool *tool, const QPointF &pos);
- virtual ~KoPathPointMoveStrategy();
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual KUndo2Command *createCommand();
+ ~KoPathPointMoveStrategy() override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command *createCommand() override;
private:
QPointF m_originalPosition;
/// the accumulated point move amount
QPointF m_move;
/// pointer to the path tool
KoPathTool *m_tool;
};
#endif /* KOPATHPOINTMOVESTRATEGY_H */
diff --git a/libs/flake/tools/KoPathPointRubberSelectStrategy.h b/libs/flake/tools/KoPathPointRubberSelectStrategy.h
index 9817c8c4d1..9d53e0a535 100644
--- a/libs/flake/tools/KoPathPointRubberSelectStrategy.h
+++ b/libs/flake/tools/KoPathPointRubberSelectStrategy.h
@@ -1,46 +1,46 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHPOINTRUBBERSELECTSTRATEGY_H
#define KOPATHPOINTRUBBERSELECTSTRATEGY_H
#include "KoShapeRubberSelectStrategy.h"
class KoPathTool;
/**
* @brief Strategy to rubber select points of a path shape
*/
class KoPathPointRubberSelectStrategy : public KoShapeRubberSelectStrategy
{
public:
KoPathPointRubberSelectStrategy(KoPathTool *tool, const QPointF &clicked);
- virtual ~KoPathPointRubberSelectStrategy() {}
+ ~KoPathPointRubberSelectStrategy() override {}
void handleMouseMove(const QPointF &p, Qt::KeyboardModifiers modifiers) override;
void finishInteraction(Qt::KeyboardModifiers modifiers) override;
private:
/// pointer to the path tool
KoPathTool *m_tool;
Q_DECLARE_PRIVATE(KoShapeRubberSelectStrategy)
};
#endif /* KOPATHPOINTRUBBERSELECTSTRATEGY_H */
diff --git a/libs/flake/tools/KoPathSegmentChangeStrategy.h b/libs/flake/tools/KoPathSegmentChangeStrategy.h
index c6705b6681..950281f672 100644
--- a/libs/flake/tools/KoPathSegmentChangeStrategy.h
+++ b/libs/flake/tools/KoPathSegmentChangeStrategy.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHSEGMENTCHANGESTRATEGY_H
#define KOPATHSEGMENTCHANGESTRATEGY_H
#include "KoInteractionStrategy.h"
#include "KoPathSegment.h"
#include "KoPathPointData.h"
#include <QPointF>
class KoPathTool;
class KoPathShape;
/**
* @brief Strategy for deforming a segment of a path shape.
*/
class KoPathSegmentChangeStrategy : public KoInteractionStrategy
{
public:
KoPathSegmentChangeStrategy(KoPathTool *tool, const QPointF &pos, const KoPathPointData &segment, qreal segmentParam);
- virtual ~KoPathSegmentChangeStrategy();
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual KUndo2Command *createCommand();
+ ~KoPathSegmentChangeStrategy() override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command *createCommand() override;
private:
QPointF m_originalPosition;
QPointF m_lastPosition;
/// the accumulated point move amount
QPointF m_move;
/// pointer to the path tool
KoPathTool *m_tool;
KoPathShape *m_path;
KoPathSegment m_segment;
qreal m_segmentParam;
QPointF m_ctrlPoint1Move;
QPointF m_ctrlPoint2Move;
KoPathPointData m_pointData1;
KoPathPointData m_pointData2;
int m_originalSegmentDegree;
};
#endif // KOPATHSEGMENTCHANGESTRATEGY_H
diff --git a/libs/flake/tools/KoPathTool.h b/libs/flake/tools/KoPathTool.h
index 336fa8601b..4af6dac00b 100644
--- a/libs/flake/tools/KoPathTool.h
+++ b/libs/flake/tools/KoPathTool.h
@@ -1,156 +1,156 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2012 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHTOOL_H
#define KOPATHTOOL_H
#include "KoPathShape.h"
#include "KoToolBase.h"
#include "KoPathToolSelection.h"
#include "kis_signal_auto_connection.h"
#include <QList>
#include <QCursor>
class QButtonGroup;
class KoCanvasBase;
class KoInteractionStrategy;
class KoPathToolHandle;
class KoParameterShape;
class KUndo2Command;
class QAction;
class QMenu;
/// The tool for editing a KoPathShape or a KoParameterShape.
/// See KoCreatePathTool for code handling the initial path creation.
class KRITAFLAKE_EXPORT KoPathTool : public KoToolBase
{
Q_OBJECT
public:
explicit KoPathTool(KoCanvasBase *canvas);
- ~KoPathTool();
+ ~KoPathTool() override;
void paint(QPainter &painter, const KoViewConverter &converter) override;
void repaintDecorations() override;
void mousePressEvent(KoPointerEvent *event) override;
void mouseMoveEvent(KoPointerEvent *event) override;
void mouseReleaseEvent(KoPointerEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mouseDoubleClickEvent(KoPointerEvent *event) override;
void activate(ToolActivation activation, const QSet<KoShape*> &shapes) override;
void deactivate() override;
void deleteSelection() override;
KoToolSelection* selection() override;
- void requestUndoDuringStroke();
+ void requestUndoDuringStroke() override;
void requestStrokeCancellation() override;
void requestStrokeEnd() override;
void explicitUserStrokeEndRequest() override;
/// repaints the specified rect
void repaint(const QRectF &repaintRect);
QMenu* popupActionsMenu() override;
public Q_SLOTS:
- void documentResourceChanged(int key, const QVariant & res);
+ void documentResourceChanged(int key, const QVariant & res) override;
Q_SIGNALS:
void typeChanged(int types);
void singleShapeChanged(KoPathShape* path);
protected:
/// reimplemented
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
private:
struct PathSegment;
void updateOptionsWidget();
PathSegment* segmentAtPoint(const QPointF &point);
private Q_SLOTS:
void pointTypeChanged(QAction *type);
void insertPoints();
void removePoints();
void segmentToLine();
void segmentToCurve();
void convertToPath();
void joinPoints();
void mergePoints();
void breakAtPoint();
void breakAtSegment();
void pointSelectionChanged();
void updateActions();
void pointToLine();
void pointToCurve();
void slotSelectionChanged();
private:
void clearActivePointSelectionReferences();
void initializeWithShapes(const QList<KoShape*> shapes);
KUndo2Command* createPointToCurveCommand(const QList<KoPathPointData> &points);
void repaintSegment(PathSegment *pathSegment);
void mergePointsImpl(bool doJoin);
protected:
KoPathToolSelection m_pointSelection; ///< the point selection
QCursor m_selectCursor;
private:
KoPathToolHandle * m_activeHandle; ///< the currently active handle
int m_handleRadius; ///< the radius of the control point handles
uint m_grabSensitivity; ///< the grab sensitivity
QPointF m_lastPoint; ///< needed for interaction strategy
PathSegment *m_activeSegment;
// make a frind so that it can test private member/methods
friend class TestPathTool;
KoInteractionStrategy *m_currentStrategy; ///< the rubber selection strategy
QButtonGroup *m_pointTypeGroup;
QAction *m_actionPathPointCorner;
QAction *m_actionPathPointSmooth;
QAction *m_actionPathPointSymmetric;
QAction *m_actionCurvePoint;
QAction *m_actionLinePoint;
QAction *m_actionLineSegment;
QAction *m_actionCurveSegment;
QAction *m_actionAddPoint;
QAction *m_actionRemovePoint;
QAction *m_actionBreakPoint;
QAction *m_actionBreakSegment;
QAction *m_actionJoinSegment;
QAction *m_actionMergePoints;
QAction *m_actionConvertToPath;
QCursor m_moveCursor;
bool m_activatedTemporarily;
QScopedPointer<QMenu> m_contextMenu;
KisSignalAutoConnectionsStore m_canvasConnections;
Q_DECLARE_PRIVATE(KoToolBase)
};
#endif
diff --git a/libs/flake/tools/KoPathToolFactory.h b/libs/flake/tools/KoPathToolFactory.h
index 2aacfe562c..e5b6804e7c 100644
--- a/libs/flake/tools/KoPathToolFactory.h
+++ b/libs/flake/tools/KoPathToolFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHTOOLFACTORY_H
#define KOPATHTOOLFACTORY_H
#include <KoToolFactoryBase.h>
/// Factory for the KoPathTool
class KoPathToolFactory : public KoToolFactoryBase
{
public:
KoPathToolFactory();
- ~KoPathToolFactory();
+ ~KoPathToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/libs/flake/tools/KoPathToolHandle.h b/libs/flake/tools/KoPathToolHandle.h
index a363a6ed7b..76fdac465a 100644
--- a/libs/flake/tools/KoPathToolHandle.h
+++ b/libs/flake/tools/KoPathToolHandle.h
@@ -1,99 +1,99 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007,2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHTOOLHANDLE_H
#define KOPATHTOOLHANDLE_H
#include <KoPathPoint.h>
#include "KoInteractionStrategy.h"
#include <QList>
#include <QRect>
class KoPathTool;
class KoParameterShape;
class KoViewConverter;
class KoPointerEvent;
class QPainter;
class KoPathShape;
class KisHandlePainterHelper;
class KoPathToolHandle
{
public:
explicit KoPathToolHandle(KoPathTool *tool);
virtual ~KoPathToolHandle();
virtual void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius) = 0;
virtual void repaint() const = 0;
virtual KoInteractionStrategy * handleMousePress(KoPointerEvent *event) = 0;
// test if handle is still valid
virtual bool check(const QList<KoPathShape*> &selectedShapes) = 0;
virtual void trySelectHandle() {};
protected:
uint handleRadius() const;
KoPathTool *m_tool;
};
class PointHandle : public KoPathToolHandle
{
public:
PointHandle(KoPathTool *tool, KoPathPoint *activePoint, KoPathPoint::PointType activePointType);
- void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius);
- void repaint() const;
- KoInteractionStrategy *handleMousePress(KoPointerEvent *event);
- virtual bool check(const QList<KoPathShape*> &selectedShapes);
+ void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius) override;
+ void repaint() const override;
+ KoInteractionStrategy *handleMousePress(KoPointerEvent *event) override;
+ bool check(const QList<KoPathShape*> &selectedShapes) override;
KoPathPoint *activePoint() const;
KoPathPoint::PointType activePointType() const;
void trySelectHandle() override;
private:
KoPathPoint *m_activePoint;
KoPathPoint::PointType m_activePointType;
mutable QRectF m_oldRepaintedRect;
};
class ParameterHandle : public KoPathToolHandle
{
public:
ParameterHandle(KoPathTool *tool, KoParameterShape *parameterShape, int handleId);
- void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius);
- void repaint() const;
- KoInteractionStrategy *handleMousePress(KoPointerEvent *event);
- bool check(const QList<KoPathShape*> &selectedShapes);
+ void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius) override;
+ void repaint() const override;
+ KoInteractionStrategy *handleMousePress(KoPointerEvent *event) override;
+ bool check(const QList<KoPathShape*> &selectedShapes) override;
protected:
KoParameterShape *m_parameterShape;
int m_handleId;
};
class ConnectionHandle : public ParameterHandle
{
public:
ConnectionHandle(KoPathTool *tool, KoParameterShape *parameterShape, int handleId);
// XXX: Later: create a paint even to distinguish a connection
// handle from another handle type
- KoInteractionStrategy *handleMousePress(KoPointerEvent *event);
+ KoInteractionStrategy *handleMousePress(KoPointerEvent *event) override;
};
#endif // KOPATHTOOLHANDLE_H
diff --git a/libs/flake/tools/KoPathToolSelection.h b/libs/flake/tools/KoPathToolSelection.h
index 85abe777e3..b694a8d783 100644
--- a/libs/flake/tools/KoPathToolSelection.h
+++ b/libs/flake/tools/KoPathToolSelection.h
@@ -1,160 +1,160 @@
/* This file is part of the KDE project
* Copyright (C) 2006,2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006,2007 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPATHTOOLSELECTION_H
#define KOPATHTOOLSELECTION_H
#include <KoToolSelection.h>
#include <KoPathShape.h>
class KoPathTool;
class KoPathPoint;
class KoPathPointData;
class KoViewConverter;
class QPainter;
/**
* @brief Handle the selection of points
*
* This class handles the selection of points. It makes sure
* the canvas is repainted when the selection changes.
*/
class KRITAFLAKE_EXPORT KoPathToolSelection : public KoToolSelection
{
Q_OBJECT
public:
explicit KoPathToolSelection(KoPathTool *tool);
- ~KoPathToolSelection();
+ ~KoPathToolSelection() override;
/// @brief Draw the selected points
void paint(QPainter &painter, const KoViewConverter &converter, qreal handleRadius);
/**
* @brief Add a point to the selection
*
* @param point to add to the selection
* @param clear if true the selection will be cleared before adding the point
*/
void add(KoPathPoint *point, bool clear);
/**
* @brief Remove a point form the selection
*
* @param point to remove from the selection
*/
void remove(KoPathPoint *point);
/**
* @brief Clear the selection
*/
void clear();
/**
* @brief Select points in rect
*
* @param rect the selection rectangle in document coordinates
* @param clearSelection if set clear the current selection before the selection
*/
void selectPoints(const QRectF &rect, bool clearSelection);
/**
* @brief Get the number of path objects in the selection
*
* @return number of path object in the point selection
*/
int objectCount() const;
/**
* @brief Get the number of path points in the selection
*
* @return number of points in the selection
*/
int size() const;
/**
* @brief Check if a point is in the selection
*
* @return true when the point is in the selection, false otherwise
*/
bool contains(KoPathPoint *point);
/**
* @brief Get all selected points
*
* @return set of selected points
*/
const QSet<KoPathPoint *> &selectedPoints() const;
/**
* @brief Get the point data of all selected points
*
* This is subject to change
*/
QList<KoPathPointData> selectedPointsData() const;
/**
* @brief Get the point data of all selected segments
*
* This is subject to change
*/
QList<KoPathPointData> selectedSegmentsData() const;
/// Returns list of selected shapes
QList<KoPathShape*> selectedShapes() const;
/// Sets list of selected shapes
void setSelectedShapes(const QList<KoPathShape*> shapes);
/**
* @brief trigger a repaint
*/
void repaint();
/**
* @brief Update the selection to contain only valid points
*
* This function checks which points are no longer valid and removes them
* from the selection.
* If e.g. some points are selected and the shape which contains the points
* is removed by undo, the points are no longer valid and have therefore to
* be removed from the selection.
*/
void update();
/// reimplemented from KoToolSelection
- virtual bool hasSelection();
+ bool hasSelection() override;
Q_SIGNALS:
void selectionChanged();
private:
typedef QMap<KoPathShape *, QSet<KoPathPoint *> > PathShapePointMap;
QSet<KoPathPoint *> m_selectedPoints;
PathShapePointMap m_shapePointMap;
KoPathTool *m_tool;
QList<KoPathShape*> m_selectedShapes;
};
#endif // PATHTOOLSELECTION_H
diff --git a/libs/flake/tools/KoShapeRubberSelectStrategy.h b/libs/flake/tools/KoShapeRubberSelectStrategy.h
index 5981814e13..13beb562ab 100644
--- a/libs/flake/tools/KoShapeRubberSelectStrategy.h
+++ b/libs/flake/tools/KoShapeRubberSelectStrategy.h
@@ -1,74 +1,74 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPERUBBERSELECTSTRATEGY_H
#define KOSHAPERUBBERSELECTSTRATEGY_H
#include "KoInteractionStrategy.h"
#include <QRectF>
#include "kritaflake_export.h"
class KoToolBase;
class KoShapeRubberSelectStrategyPrivate;
/**
* Implement the rubber band selection of flake objects.
*
* When the user selects stuff in left-to-right way, selection is in "covering"
* (or "containing") mode, when in "left-to-right" in "crossing" mode
*/
class KRITAFLAKE_EXPORT KoShapeRubberSelectStrategy : public KoInteractionStrategy
{
public:
/**
* Constructor that initiates the rubber select.
* A rubber select is basically rectangle area that the user drags out
* from @p clicked to a point later provided in the handleMouseMove() continuously
* showing a semi-transarant 'rubber-mat' over the objects it is about to select.
* @param tool the parent tool which controls this strategy
* @param clicked the initial point that the user depressed (in pt).
* @param useSnapToGrid use the snap-to-grid settings while doing the rubberstamp.
*/
KoShapeRubberSelectStrategy(KoToolBase *tool, const QPointF &clicked, bool useSnapToGrid = false);
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual KUndo2Command *createCommand();
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command *createCommand() override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
protected:
/// constructor
KoShapeRubberSelectStrategy(KoShapeRubberSelectStrategyPrivate &);
enum SelectionMode {
CrossingSelection,
CoveringSelection
};
virtual SelectionMode currentMode() const;
private:
Q_DECLARE_PRIVATE(KoShapeRubberSelectStrategy)
};
#endif /* KOSHAPERUBBERSELECTSTRATEGY_H */
diff --git a/libs/flake/tools/KoZoomStrategy.h b/libs/flake/tools/KoZoomStrategy.h
index bff94e6e2b..88630de0e0 100644
--- a/libs/flake/tools/KoZoomStrategy.h
+++ b/libs/flake/tools/KoZoomStrategy.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMSTRATEGY_H
#define KOZOOMSTRATEGY_H
#include "KoShapeRubberSelectStrategy.h"
class KoCanvasController;
class KoZoomTool;
/**
* //internal
* This is a strategy for the KoZoomTool which will be used to do the actual zooming
*/
class KoZoomStrategy : public KoShapeRubberSelectStrategy
{
public:
/**
* constructor
* @param tool the parent tool this strategy is for
* @param controller the canvas controller that wraps the canvas the tool is acting on.
* @param clicked the location (in documnet points) where the interaction starts.
*/
KoZoomStrategy(KoZoomTool *tool, KoCanvasController *controller, const QPointF &clicked);
void forceZoomOut();
void forceZoomIn();
/// Execute the zoom
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual void cancelInteraction();
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ void cancelInteraction() override;
protected:
SelectionMode currentMode() const override;
private:
KoCanvasController *m_controller;
bool m_forceZoomOut;
Q_DECLARE_PRIVATE(KoShapeRubberSelectStrategy)
};
#endif
diff --git a/libs/flake/tools/KoZoomTool.h b/libs/flake/tools/KoZoomTool.h
index 4a63c1e4aa..8a9a2a7bd9 100644
--- a/libs/flake/tools/KoZoomTool.h
+++ b/libs/flake/tools/KoZoomTool.h
@@ -1,77 +1,77 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMTOOL_H
#define KOZOOMTOOL_H
#include "KoInteractionTool.h"
#include <QCursor>
class KoCanvasBase;
class KoCanvasController;
/// \internal
class KoZoomTool : public KoInteractionTool
{
public:
/**
* Create a new tool; typically not called by applications, only by the KoToolManager
* @param canvas the canvas this tool works for.
*/
explicit KoZoomTool(KoCanvasBase *canvas);
/// reimplemented method
- virtual void wheelEvent(KoPointerEvent *event);
+ void wheelEvent(KoPointerEvent *event) override;
/// reimplemented method
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mouseReleaseEvent(KoPointerEvent *event) override;
/// reimplemented method
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented method
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
/// reimplemented method
- virtual void keyReleaseEvent(QKeyEvent *event);
+ void keyReleaseEvent(QKeyEvent *event) override;
/// reimplemented method
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
/// reimplemented method
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
void setCanvasController(KoCanvasController *controller) {
m_controller = controller;
}
void setZoomInMode(bool zoomIn);
protected:
- QWidget *createOptionWidget();
+ QWidget *createOptionWidget() override;
private:
- virtual KoInteractionStrategy *createStrategy(KoPointerEvent *event);
+ KoInteractionStrategy *createStrategy(KoPointerEvent *event) override;
void updateCursor(bool swap);
KoCanvasController *m_controller;
QCursor m_inCursor;
QCursor m_outCursor;
bool m_temporary;
bool m_zoomInMode;
};
#endif
diff --git a/libs/flake/tools/KoZoomToolFactory.h b/libs/flake/tools/KoZoomToolFactory.h
index f3900875c6..f1e286207b 100644
--- a/libs/flake/tools/KoZoomToolFactory.h
+++ b/libs/flake/tools/KoZoomToolFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMTOOLFACTORY_H
#define KOZOOMTOOLFACTORY_H
#include "KoToolFactoryBase.h"
/// Factory for the KoZoomTool
class KoZoomToolFactory : public KoToolFactoryBase
{
public:
/// constructor
KoZoomToolFactory();
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/libs/flake/tools/KoZoomToolWidget.h b/libs/flake/tools/KoZoomToolWidget.h
index cffb3c6ef6..aff3e89019 100644
--- a/libs/flake/tools/KoZoomToolWidget.h
+++ b/libs/flake/tools/KoZoomToolWidget.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Martin Pfeiffer <hubipete@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMTOOLWIDGET_H
#define KOZOOMTOOLWIDGET_H
#include <QWidget>
#include <QPixmap>
#include "ui_KoZoomToolWidget.h"
class KoZoomTool;
class KoZoomToolWidget : public QWidget, Ui::ZoomToolWidget
{
Q_OBJECT
public:
explicit KoZoomToolWidget(KoZoomTool* tool, QWidget *parent = 0);
- ~KoZoomToolWidget();
+ ~KoZoomToolWidget() override;
protected:
- bool eventFilter(QObject *object, QEvent *event);
+ bool eventFilter(QObject *object, QEvent *event) override;
private Q_SLOTS:
void changeZoomMode();
private:
void paintBirdEye();
bool m_dirtyThumbnail;
QRect m_birdEyeRect;
QPixmap m_thumbnail;
KoZoomTool *m_tool;
};
#endif
diff --git a/libs/flake/tools/PathToolOptionWidget.h b/libs/flake/tools/PathToolOptionWidget.h
index 495089e9db..e7837cddb8 100644
--- a/libs/flake/tools/PathToolOptionWidget.h
+++ b/libs/flake/tools/PathToolOptionWidget.h
@@ -1,69 +1,69 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PATHTOOLOPTIONWIDGET_H
#define PATHTOOLOPTIONWIDGET_H
#include <QWidget>
#include <QFlags>
#include <ui_PathToolOptionWidgetBase.h>
class KoPathTool;
class KoPathShape;
class KoShapeConfigWidgetBase;
class KoCanvasBase;
class PathToolOptionWidget : public QWidget
{
Q_OBJECT
public:
enum Type {
PlainPath = 1,
ParametricShape = 2
};
Q_DECLARE_FLAGS(Types, Type)
explicit PathToolOptionWidget(KoPathTool *tool, QWidget *parent = 0);
- ~PathToolOptionWidget();
+ ~PathToolOptionWidget() override;
public Q_SLOTS:
void setSelectionType(int type);
void setCurrentShape(KoPathShape *pathShape);
private Q_SLOTS:
void slotShapePropertyChanged();
Q_SIGNALS:
void sigRequestUpdateActions();
protected:
- void showEvent(QShowEvent *event);
+ void showEvent(QShowEvent *event) override;
private:
Ui::PathToolOptionWidgetBase widget;
KoPathShape *m_currentShape;
KoShapeConfigWidgetBase *m_currentPanel;
KoCanvasBase *m_canvas;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(PathToolOptionWidget::Types)
#endif
diff --git a/libs/ui/KisSelectedShapesProxy.h b/libs/global/KisReadWriteLockPolicy.h
similarity index 52%
copy from libs/ui/KisSelectedShapesProxy.h
copy to libs/global/KisReadWriteLockPolicy.h
index 79b957073b..565e8c4ec3 100644
--- a/libs/ui/KisSelectedShapesProxy.h
+++ b/libs/global/KisReadWriteLockPolicy.h
@@ -1,51 +1,50 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef KISSELECTEDSHAPESPROXY_H
-#define KISSELECTEDSHAPESPROXY_H
+#ifndef KISREADWRITELOCKPOLICY_H
+#define KISREADWRITELOCKPOLICY_H
-#include <QObject>
-#include <QScopedPointer>
-#include <KoSelectedShapesProxy.h>
+#include <boost/utility.hpp>
-class KoShapeManager;
+#include <QReadLocker>
+#include <QWriteLocker>
+#include "KisUpgradeToWriteLocker.h"
-class KisSelectedShapesProxy : public KoSelectedShapesProxy
-{
- Q_OBJECT
-public:
- KisSelectedShapesProxy(KoShapeManager *globalShapeManager);
- ~KisSelectedShapesProxy();
-
- void setShapeManager(KoShapeManager *manager);
-
- KoSelection *selection();
+struct NormalLockPolicy {
+ typedef QReadLocker ReadLocker;
+ typedef QWriteLocker WriteLocker;
+};
+struct UpgradeLockPolicy {
+ struct FakeLocker : private boost::noncopyable {
+ FakeLocker(QReadWriteLock *) {}
+ };
-Q_SIGNALS:
- void selectionChanged();
- void selectionContentChanged();
- void currentLayerChanged(const KoShapeLayer *layer);
+ typedef FakeLocker ReadLocker;
+ typedef KisUpgradeToWriteLocker WriteLocker;
+};
+struct NoLockPolicy {
+ struct FakeLocker : private boost::noncopyable {
+ FakeLocker(QReadWriteLock *) {}
+ };
-private:
- struct Private;
- QScopedPointer<Private> m_d;
+ typedef FakeLocker ReadLocker;
+ typedef FakeLocker WriteLocker;
};
-
-#endif // KISSELECTEDSHAPESPROXY_H
+#endif // KISREADWRITELOCKPOLICY_H
diff --git a/libs/global/KisUpgradeToWriteLocker.h b/libs/global/KisUpgradeToWriteLocker.h
new file mode 100644
index 0000000000..edecf80fb6
--- /dev/null
+++ b/libs/global/KisUpgradeToWriteLocker.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KISUPGRADETOWRITELOCKER_H
+#define KISUPGRADETOWRITELOCKER_H
+
+#include <QReadLocker>
+#include <QReadWriteLock>
+
+/**
+ * @brief The KisUpgradeToWriteLocker class is use for RAII style unlocking
+ * the read lock and then locking the lock for write. We basically "upgrade"
+ * the lock to a write one.
+ *
+ * WARNING: during the *upgrade* the lock passes the "unlocked" state, so
+ * all the protected data you acquired during the "read" phase might
+ * have become invalidated!
+ */
+class KisUpgradeToWriteLocker
+{
+public:
+ KisUpgradeToWriteLocker(QReadLocker *locker)
+ : m_locker(locker)
+ {
+ m_locker->unlock();
+ m_locker->readWriteLock()->lockForWrite();
+ }
+
+ ~KisUpgradeToWriteLocker() {
+ m_locker->readWriteLock()->unlock();
+ m_locker->relock();
+ }
+
+private:
+ QReadLocker *m_locker;
+};
+
+
+
+#endif // KISUPGRADETOWRITELOCKER_H
diff --git a/libs/global/kis_algebra_2d.h b/libs/global/kis_algebra_2d.h
index d001586026..e95cab697b 100644
--- a/libs/global/kis_algebra_2d.h
+++ b/libs/global/kis_algebra_2d.h
@@ -1,564 +1,569 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ALGEBRA_2D_H
#define __KIS_ALGEBRA_2D_H
#include <QPoint>
#include <QPointF>
#include <QVector>
#include <QPolygonF>
#include <QTransform>
#include <cmath>
#include <kis_global.h>
#include <kritaglobal_export.h>
#include <functional>
class QPainterPath;
class QTransform;
namespace KisAlgebra2D {
template <class T>
struct PointTypeTraits
{
};
template <>
struct PointTypeTraits<QPoint>
{
typedef int value_type;
typedef qreal calculation_type;
typedef QRect rect_type;
};
template <>
struct PointTypeTraits<QPointF>
{
typedef qreal value_type;
typedef qreal calculation_type;
typedef QRectF rect_type;
};
template <class T>
typename PointTypeTraits<T>::value_type dotProduct(const T &a, const T &b)
{
return a.x() * b.x() + a.y() * b.y();
}
template <class T>
typename PointTypeTraits<T>::value_type crossProduct(const T &a, const T &b)
{
return a.x() * b.y() - a.y() * b.x();
}
template <class T>
qreal norm(const T &a)
{
return std::sqrt(pow2(a.x()) + pow2(a.y()));
}
template <class Point>
Point normalize(const Point &a)
{
const qreal length = norm(a);
return (1.0 / length) * a;
}
/**
* Usual sign() function with positive zero
*/
template <typename T>
T signPZ(T x) {
return x >= T(0) ? T(1) : T(-1);
}
/**
* Usual sign() function with zero returning zero
*/
template <typename T>
T signZZ(T x) {
return x == T(0) ? T(0) : x > T(0) ? T(1) : T(-1);
}
/**
* Copies the sign of \p y into \p x and returns the result
*/
template <typename T>
inline T copysign(T x, T y) {
T strippedX = qAbs(x);
return y >= T(0) ? strippedX : -strippedX;
}
template <class T>
T leftUnitNormal(const T &a)
{
T result = a.x() != 0 ? T(-a.y() / a.x(), 1) : T(-1, 0);
qreal length = norm(result);
result *= (crossProduct(a, result) >= 0 ? 1 : -1) / length;
return -result;
}
template <class T>
T rightUnitNormal(const T &a)
{
return -leftUnitNormal(a);
}
template <class T>
T inwardUnitNormal(const T &a, int polygonDirection)
{
return polygonDirection * leftUnitNormal(a);
}
/**
* \return 1 if the polygon is counterclockwise
* -1 if the polygon is clockwise
*
* Note: the sign is flipped because our 0y axis
* is reversed
*/
template <class T>
int polygonDirection(const QVector<T> &polygon) {
typename PointTypeTraits<T>::value_type doubleSum = 0;
const int numPoints = polygon.size();
for (int i = 1; i <= numPoints; i++) {
int prev = i - 1;
int next = i == numPoints ? 0 : i;
doubleSum +=
(polygon[next].x() - polygon[prev].x()) *
(polygon[next].y() + polygon[prev].y());
}
return doubleSum >= 0 ? 1 : -1;
}
template <typename T>
bool isInRange(T x, T a, T b) {
T length = qAbs(a - b);
return qAbs(x - a) <= length && qAbs(x - b) <= length;
}
void KRITAGLOBAL_EXPORT adjustIfOnPolygonBoundary(const QPolygonF &poly, int polygonDirection, QPointF *pt);
/**
* Let \p pt, \p base1 are two vectors. \p base1 is uniformly scaled
* and then rotated into \p base2 using transformation matrix S *
* R. The function applies the same transformation to \pt and returns
* the result.
**/
QPointF KRITAGLOBAL_EXPORT transformAsBase(const QPointF &pt, const QPointF &base1, const QPointF &base2);
qreal KRITAGLOBAL_EXPORT angleBetweenVectors(const QPointF &v1, const QPointF &v2);
namespace Private {
inline void resetEmptyRectangle(const QPoint &pt, QRect *rc) {
*rc = QRect(pt, QSize(1, 1));
}
inline void resetEmptyRectangle(const QPointF &pt, QRectF *rc) {
static const qreal eps = 1e-10;
*rc = QRectF(pt, QSizeF(eps, eps));
}
}
template <class Point, class Rect>
inline void accumulateBounds(const Point &pt, Rect *bounds)
{
if (bounds->isEmpty()) {
Private::resetEmptyRectangle(pt, bounds);
}
if (pt.x() > bounds->right()) {
bounds->setRight(pt.x());
}
if (pt.x() < bounds->left()) {
bounds->setLeft(pt.x());
}
if (pt.y() > bounds->bottom()) {
bounds->setBottom(pt.y());
}
if (pt.y() < bounds->top()) {
bounds->setTop(pt.y());
}
}
template <template <class T> class Container, class Point, class Rect>
inline void accumulateBounds(const Container<Point> &points, Rect *bounds)
{
Q_FOREACH (const Point &pt, points) {
accumulateBounds(pt, bounds);
}
}
template <template <class T> class Container, class Point>
inline typename PointTypeTraits<Point>::rect_type
accumulateBounds(const Container<Point> &points)
{
typename PointTypeTraits<Point>::rect_type result;
Q_FOREACH (const Point &pt, points) {
accumulateBounds(pt, &result);
}
return result;
}
template <class Point, class Rect>
inline Point clampPoint(Point pt, const Rect &bounds)
{
if (pt.x() > bounds.right()) {
pt.rx() = bounds.right();
}
if (pt.x() < bounds.left()) {
pt.rx() = bounds.left();
}
if (pt.y() > bounds.bottom()) {
pt.ry() = bounds.bottom();
}
if (pt.y() < bounds.top()) {
pt.ry() = bounds.top();
}
return pt;
}
template <class Size>
auto maxDimension(Size size) -> decltype(size.width()) {
return qMax(size.width(), size.height());
}
+template <class Size>
+auto minDimension(Size size) -> decltype(size.width()) {
+ return qMin(size.width(), size.height());
+}
+
QPainterPath KRITAGLOBAL_EXPORT smallArrow();
/**
* Multiply width and height of \p rect by \p coeff keeping the
* center of the rectangle pinned
*/
template <class Rect>
Rect blowRect(const Rect &rect, qreal coeff)
{
typedef decltype(rect.x()) CoordType;
CoordType w = rect.width() * coeff;
CoordType h = rect.height() * coeff;
return rect.adjusted(-w, -h, w, h);
}
QPoint KRITAGLOBAL_EXPORT ensureInRect(QPoint pt, const QRect &bounds);
QPointF KRITAGLOBAL_EXPORT ensureInRect(QPointF pt, const QRectF &bounds);
template <class Rect>
Rect ensureRectNotSmaller(Rect rc, const decltype(Rect().size()) &size)
{
typedef decltype(Rect().size()) Size;
typedef decltype(Rect().top()) ValueType;
if (rc.width() < size.width() ||
rc.height() < size.height()) {
ValueType width = qMax(rc.width(), size.width());
ValueType height = qMax(rc.height(), size.height());
rc = Rect(rc.topLeft(), Size(width, height));
}
return rc;
}
template <class Size>
Size ensureSizeNotSmaller(const Size &size, const Size &bounds)
{
Size result = size;
const auto widthBound = qAbs(bounds.width());
auto width = result.width();
if (qAbs(width) < widthBound) {
width = copysign(widthBound, width);
result.setWidth(width);
}
const auto heightBound = qAbs(bounds.height());
auto height = result.height();
if (qAbs(height) < heightBound) {
height = copysign(heightBound, height);
result.setHeight(height);
}
return result;
}
/**
* Attempt to intersect a line to the area of the a rectangle.
*
* If the line intersects the rectange, it will be modified to represent the intersecting line segment and true is returned.
* If the line does not intersect the area, it remains unmodified and false will be returned.
*
* @param segment
* @param area
* @return true if successful
*/
bool KRITAGLOBAL_EXPORT intersectLineRect(QLineF &line, const QRect rect);
template <class Point>
inline Point abs(const Point &pt) {
return Point(qAbs(pt.x()), qAbs(pt.y()));
}
class RightHalfPlane {
public:
RightHalfPlane(const QPointF &a, const QPointF &b)
: m_a(a), m_p(b - a), m_norm_p_inv(1.0 / norm(m_p))
{
}
RightHalfPlane(const QLineF &line)
: RightHalfPlane(line.p1(), line.p2())
{
}
qreal valueSq(const QPointF &pt) const {
const qreal val = value(pt);
return signZZ(val) * pow2(val);
}
qreal value(const QPointF &pt) const {
return crossProduct(m_p, pt - m_a) * m_norm_p_inv;
}
int pos(const QPointF &pt) const {
return signZZ(value(pt));
}
QLineF getLine() const {
return QLineF(m_a, m_a + m_p);
}
private:
const QPointF m_a;
const QPointF m_p;
const qreal m_norm_p_inv;
};
class OuterCircle {
public:
OuterCircle(const QPointF &c, qreal radius)
: m_c(c),
m_radius(radius),
m_radius_sq(pow2(radius)),
m_fadeCoeff(1.0 / (pow2(radius + 1.0) - m_radius_sq))
{
}
qreal valueSq(const QPointF &pt) const {
const qreal val = value(pt);
return signZZ(val) * pow2(val);
}
qreal value(const QPointF &pt) const {
return kisDistance(pt, m_c) - m_radius;
}
int pos(const QPointF &pt) const {
return signZZ(valueSq(pt));
}
qreal fadeSq(const QPointF &pt) const {
const qreal valSq = kisSquareDistance(pt, m_c);
return (valSq - m_radius_sq) * m_fadeCoeff;
}
private:
const QPointF m_c;
const qreal m_radius;
const qreal m_radius_sq;
const qreal m_fadeCoeff;
};
QVector<QPoint> KRITAGLOBAL_EXPORT sampleRectWithPoints(const QRect &rect);
QVector<QPointF> KRITAGLOBAL_EXPORT sampleRectWithPoints(const QRectF &rect);
QRect KRITAGLOBAL_EXPORT approximateRectFromPoints(const QVector<QPoint> &points);
QRectF KRITAGLOBAL_EXPORT approximateRectFromPoints(const QVector<QPointF> &points);
QRect KRITAGLOBAL_EXPORT approximateRectWithPointTransform(const QRect &rect, std::function<QPointF(QPointF)> func);
/**
* Cuts off a portion of a rect \p rc defined by a half-plane \p p
* \return the bounding rect of the resulting polygon
*/
KRITAGLOBAL_EXPORT
QRectF cutOffRect(const QRectF &rc, const KisAlgebra2D::RightHalfPlane &p);
/**
* Solves a quadratic equation in a form:
*
* a * x^2 + b * x + c = 0
*
* WARNING: Please note that \p a *must* be nonzero! Otherwise the
* equation is not quadratic! And this function doesn't check that!
*
* \return the number of solutions. It can be 0, 1 or 2.
*
* \p x1, \p x2 --- the found solution. The variables are filled with
* data iff the corresponding solution is found. That
* is: 0 solutions --- variabled are not touched, 1
* solution --- x1 is filled with the result, 2
* solutions --- x1 and x2 are filled.
*/
KRITAGLOBAL_EXPORT
int quadraticEquation(qreal a, qreal b, qreal c, qreal *x1, qreal *x2);
/**
* Finds the points of intersections between two circles
* \return the found circles, the result can have 0, 1 or 2 points
*/
KRITAGLOBAL_EXPORT
QVector<QPointF> intersectTwoCircles(const QPointF &c1, qreal r1,
const QPointF &c2, qreal r2);
KRITAGLOBAL_EXPORT
QTransform mapToRect(const QRectF &rect);
/**
* Scale the relative point \pt into the bounds of \p rc. The point might be
* outside the rectangle.
*/
inline QPointF relativeToAbsolute(const QPointF &pt, const QRectF &rc) {
return rc.topLeft() + QPointF(pt.x() * rc.width(), pt.y() * rc.height());
}
/**
* Get the relative position of \p pt inside rectangle \p rc. The point can be
* outside the rectangle.
*/
inline QPointF absoluteToRelative(const QPointF &pt, const QRectF &rc) {
if (!rc.isValid()) return QPointF();
const QPointF rel = pt - rc.topLeft();
return QPointF(rel.x() / rc.width(), rel.y() / rc.height());
}
/**
* Compare the matrices with tolerance \p delta
*/
bool KRITAGLOBAL_EXPORT fuzzyMatrixCompare(const QTransform &t1, const QTransform &t2, qreal delta);
/**
* Compare two rectangles with tolerance \p tolerance. The tolerance means that the
* coordinates of top left and bottom right corners should not differ more than \p tolerance
* pixels.
*/
template<class Rect, typename Difference = decltype(Rect::width())>
bool fuzzyCompareRects(const Rect &r1, const Rect &r2, Difference tolerance) {
typedef decltype(r1.topLeft()) Point;
const Point d1 = abs(r1.topLeft() - r2.topLeft());
const Point d2 = abs(r1.bottomRight() - r2.bottomRight());
const Difference maxError = std::max({d1.x(), d1.y(), d2.x(), d2.y()});
return maxError < tolerance;
}
struct KRITAGLOBAL_EXPORT DecomposedMatix {
DecomposedMatix();
DecomposedMatix(const QTransform &t0);
inline QTransform scaleTransform() const
{
return QTransform::fromScale(scaleX, scaleY);
}
inline QTransform shearTransform() const
{
QTransform t;
t.shear(shearXY, 0);
return t;
}
inline QTransform rotateTransform() const
{
QTransform t;
t.rotate(angle);
return t;
}
inline QTransform translateTransform() const
{
return QTransform::fromTranslate(dx, dy);
}
inline QTransform projectTransform() const
{
return
QTransform(
1,0,proj[0],
0,1,proj[1],
0,0,proj[2]);
}
inline QTransform transform() const {
return
scaleTransform() *
shearTransform() *
rotateTransform() *
translateTransform() *
projectTransform();
}
inline bool isValid() const {
return valid;
}
qreal scaleX = 1.0;
qreal scaleY = 1.0;
qreal shearXY = 0.0;
qreal angle = 0.0;
qreal dx = 0.0;
qreal dy = 0.0;
qreal proj[3] = {0.0, 0.0, 1.0};
private:
bool valid = true;
};
}
#endif /* __KIS_ALGEBRA_2D_H */
diff --git a/libs/global/kis_assert_exception.h b/libs/global/kis_assert_exception.h
index 74e688be75..c9d95f206d 100644
--- a/libs/global/kis_assert_exception.h
+++ b/libs/global/kis_assert_exception.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ASSERT_EXCEPTION_H
#define __KIS_ASSERT_EXCEPTION_H
#include <stdexcept>
#include <QException>
class KisAssertException : public std::runtime_error, public QException
{
public:
KisAssertException(const std::string& what_arg)
: std::runtime_error(what_arg)
{
}
- QException* clone() const { return new KisAssertException(*this); }
- void raise() const { throw *this; }
+ QException* clone() const override { return new KisAssertException(*this); }
+ void raise() const override { throw *this; }
};
#endif /* __KIS_ASSERT_EXCEPTION_H */
diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
index 693622f780..516254123b 100644
--- a/libs/image/CMakeLists.txt
+++ b/libs/image/CMakeLists.txt
@@ -1,389 +1,388 @@
add_subdirectory( tests )
add_subdirectory( tiles3 )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/metadata
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty
${CMAKE_CURRENT_SOURCE_DIR}/brushengine
${CMAKE_CURRENT_SOURCE_DIR}/commands
${CMAKE_CURRENT_SOURCE_DIR}/commands_new
${CMAKE_CURRENT_SOURCE_DIR}/filter
${CMAKE_CURRENT_SOURCE_DIR}/floodfill
${CMAKE_CURRENT_SOURCE_DIR}/generator
${CMAKE_CURRENT_SOURCE_DIR}/layerstyles
${CMAKE_CURRENT_SOURCE_DIR}/processing
${CMAKE_CURRENT_SOURCE_DIR}/recorder
${CMAKE_SOURCE_DIR}/sdk/tests
)
include_directories(SYSTEM
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
if(FFTW3_FOUND)
include_directories(${FFTW3_INCLUDE_DIR})
endif()
if(HAVE_VC)
include_directories(SYSTEM ${Vc_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
ko_compile_for_all_implementations(__per_arch_circle_mask_generator_objs kis_brush_mask_applicator_factories.cpp)
else()
set(__per_arch_circle_mask_generator_objs kis_brush_mask_applicator_factories.cpp)
endif()
set(kritaimage_LIB_SRCS
tiles3/kis_tile.cc
tiles3/kis_tile_data.cc
tiles3/kis_tile_data_store.cc
tiles3/kis_tile_data_pooler.cc
tiles3/kis_tiled_data_manager.cc
tiles3/kis_memento_manager.cc
tiles3/kis_hline_iterator.cpp
tiles3/kis_vline_iterator.cpp
tiles3/kis_random_accessor.cc
tiles3/swap/kis_abstract_compression.cpp
tiles3/swap/kis_lzf_compression.cpp
tiles3/swap/kis_abstract_tile_compressor.cpp
tiles3/swap/kis_legacy_tile_compressor.cpp
tiles3/swap/kis_tile_compressor_2.cpp
tiles3/swap/kis_chunk_allocator.cpp
tiles3/swap/kis_memory_window.cpp
tiles3/swap/kis_swapped_data_store.cpp
tiles3/swap/kis_tile_data_swapper.cpp
kis_distance_information.cpp
kis_painter.cc
kis_marker_painter.cpp
kis_progress_updater.cpp
brushengine/kis_paint_information.cc
brushengine/kis_random_source.cpp
brushengine/kis_stroke_random_source.cpp
brushengine/kis_paintop.cc
brushengine/kis_paintop_factory.cpp
brushengine/kis_paintop_preset.cpp
brushengine/kis_paintop_registry.cc
brushengine/kis_paintop_settings.cpp
brushengine/kis_paintop_settings_update_proxy.cpp
brushengine/kis_no_size_paintop_settings.cpp
brushengine/kis_locked_properties.cc
brushengine/kis_locked_properties_proxy.cpp
brushengine/kis_locked_properties_server.cpp
brushengine/kis_paintop_config_widget.cpp
brushengine/kis_uniform_paintop_property.cpp
brushengine/kis_combo_based_paintop_property.cpp
brushengine/kis_slider_based_paintop_property.cpp
brushengine/kis_standard_uniform_properties_factory.cpp
commands/kis_deselect_global_selection_command.cpp
commands/kis_image_change_layers_command.cpp
commands/kis_image_command.cpp
commands/kis_image_set_projection_color_space_command.cpp
commands/kis_image_layer_add_command.cpp
commands/kis_image_layer_move_command.cpp
commands/kis_image_layer_remove_command.cpp
commands/kis_image_layer_remove_command_impl.cpp
commands/kis_image_lock_command.cpp
commands/kis_layer_command.cpp
commands/kis_node_command.cpp
commands/kis_node_compositeop_command.cpp
commands/kis_node_opacity_command.cpp
commands/kis_node_property_list_command.cpp
commands/kis_reselect_global_selection_command.cpp
commands/kis_set_global_selection_command.cpp
commands_new/kis_saved_commands.cpp
commands_new/kis_processing_command.cpp
commands_new/kis_image_resize_command.cpp
commands_new/kis_image_set_resolution_command.cpp
commands_new/kis_node_move_command2.cpp
commands_new/kis_set_layer_style_command.cpp
commands_new/kis_selection_move_command2.cpp
commands_new/kis_update_command.cpp
commands_new/kis_switch_current_time_command.cpp
commands_new/kis_change_projection_color_command.cpp
commands_new/kis_activate_selection_mask_command.cpp
processing/kis_do_nothing_processing_visitor.cpp
processing/kis_simple_processing_visitor.cpp
processing/kis_crop_processing_visitor.cpp
processing/kis_crop_selections_processing_visitor.cpp
processing/kis_transform_processing_visitor.cpp
processing/kis_mirror_processing_visitor.cpp
filter/kis_filter.cc
filter/kis_filter_configuration.cc
filter/kis_color_transformation_configuration.cc
filter/kis_filter_registry.cc
filter/kis_color_transformation_filter.cc
generator/kis_generator.cpp
generator/kis_generator_layer.cpp
generator/kis_generator_registry.cpp
floodfill/kis_fill_interval_map.cpp
floodfill/kis_scanline_fill.cpp
lazybrush/kis_min_cut_worker.cpp
lazybrush/kis_lazy_fill_tools.cpp
lazybrush/kis_multiway_cut.cpp
lazybrush/kis_colorize_mask.cpp
lazybrush/kis_colorize_stroke_strategy.cpp
KisDelayedUpdateNodeInterface.cpp
kis_adjustment_layer.cc
kis_selection_based_layer.cpp
kis_node_filter_interface.cpp
kis_base_accessor.cpp
kis_base_node.cpp
kis_base_processor.cpp
kis_bookmarked_configuration_manager.cc
kis_clone_info.cpp
kis_clone_layer.cpp
kis_colorspace_convert_visitor.cpp
kis_config_widget.cpp
kis_convolution_kernel.cc
kis_convolution_painter.cc
kis_gaussian_kernel.cpp
kis_cubic_curve.cpp
kis_default_bounds.cpp
kis_default_bounds_base.cpp
kis_effect_mask.cc
kis_fast_math.cpp
kis_fill_painter.cc
kis_filter_mask.cpp
kis_filter_strategy.cc
kis_transform_mask.cpp
kis_transform_mask_params_interface.cpp
kis_recalculate_transform_mask_job.cpp
kis_recalculate_generator_layer_job.cpp
kis_transform_mask_params_factory_registry.cpp
kis_safe_transform.cpp
kis_gradient_painter.cc
kis_gradient_shape_strategy.cpp
kis_cached_gradient_shape_strategy.cpp
kis_polygonal_gradient_shape_strategy.cpp
kis_iterator_ng.cpp
kis_async_merger.cpp
kis_merge_walker.cc
kis_updater_context.cpp
kis_update_job_item.cpp
kis_stroke_strategy_undo_command_based.cpp
kis_simple_stroke_strategy.cpp
kis_stroke_job_strategy.cpp
kis_stroke_strategy.cpp
kis_stroke.cpp
kis_strokes_queue.cpp
kis_simple_update_queue.cpp
kis_update_scheduler.cpp
kis_queues_progress_updater.cpp
kis_composite_progress_proxy.cpp
kis_sync_lod_cache_stroke_strategy.cpp
kis_lod_capable_layer_offset.cpp
kis_update_time_monitor.cpp
kis_group_layer.cc
kis_count_visitor.cpp
kis_histogram.cc
kis_image_interfaces.cpp
kis_image_animation_interface.cpp
kis_time_range.cpp
kis_node_graph_listener.cpp
kis_image.cc
kis_image_signal_router.cpp
kis_image_config.cpp
kis_projection_updates_filter.cpp
kis_suspend_projection_updates_stroke_strategy.cpp
kis_regenerate_frame_stroke_strategy.cpp
kis_switch_time_stroke_strategy.cpp
kis_crop_saved_extra_data.cpp
kis_thread_safe_signal_compressor.cpp
kis_timed_signal_threshold.cpp
kis_layer.cc
kis_indirect_painting_support.cpp
kis_abstract_projection_plane.cpp
kis_layer_projection_plane.cpp
kis_layer_utils.cpp
kis_mask_projection_plane.cpp
kis_projection_leaf.cpp
kis_mask.cc
kis_base_mask_generator.cpp
kis_rect_mask_generator.cpp
kis_circle_mask_generator.cpp
kis_gauss_circle_mask_generator.cpp
kis_gauss_rect_mask_generator.cpp
${__per_arch_circle_mask_generator_objs}
kis_curve_circle_mask_generator.cpp
kis_curve_rect_mask_generator.cpp
kis_math_toolbox.cpp
kis_memory_statistics_server.cpp
kis_name_server.cpp
kis_node.cpp
kis_node_facade.cpp
kis_node_progress_proxy.cpp
kis_busy_progress_indicator.cpp
kis_node_visitor.cpp
kis_paint_device.cc
kis_paint_device_debug_utils.cpp
kis_fixed_paint_device.cpp
kis_paint_layer.cc
kis_perspective_math.cpp
kis_pixel_selection.cpp
kis_processing_information.cpp
kis_properties_configuration.cc
kis_random_accessor_ng.cpp
kis_random_generator.cc
kis_random_sub_accessor.cpp
kis_wrapped_random_accessor.cpp
kis_selection.cc
kis_selection_mask.cpp
kis_update_outline_job.cpp
kis_update_selection_job.cpp
kis_serializable_configuration.cc
kis_transaction_data.cpp
kis_transform_worker.cc
kis_perspectivetransform_worker.cpp
bsplines/kis_bspline_1d.cpp
bsplines/kis_bspline_2d.cpp
bsplines/kis_nu_bspline_2d.cpp
kis_warptransform_worker.cc
kis_cage_transform_worker.cpp
kis_liquify_transform_worker.cpp
kis_green_coordinates_math.cpp
kis_transparency_mask.cc
- kis_inpaint_mask.cpp
kis_undo_adapter.cpp
kis_macro_based_undo_store.cpp
kis_surrogate_undo_adapter.cpp
kis_legacy_undo_adapter.cpp
kis_post_execution_undo_adapter.cpp
kis_processing_visitor.cpp
kis_processing_applicator.cpp
krita_utils.cpp
kis_outline_generator.cpp
kis_layer_composition.cpp
kis_selection_filters.cpp
KisProofingConfiguration.h
metadata/kis_meta_data_entry.cc
metadata/kis_meta_data_filter.cc
metadata/kis_meta_data_filter_p.cc
metadata/kis_meta_data_filter_registry.cc
metadata/kis_meta_data_filter_registry_model.cc
metadata/kis_meta_data_io_backend.cc
metadata/kis_meta_data_merge_strategy.cc
metadata/kis_meta_data_merge_strategy_p.cc
metadata/kis_meta_data_merge_strategy_registry.cc
metadata/kis_meta_data_parser.cc
metadata/kis_meta_data_schema.cc
metadata/kis_meta_data_schema_registry.cc
metadata/kis_meta_data_store.cc
metadata/kis_meta_data_type_info.cc
metadata/kis_meta_data_validator.cc
metadata/kis_meta_data_value.cc
recorder/kis_action_recorder.cc
recorder/kis_macro.cc
recorder/kis_macro_player.cc
recorder/kis_node_query_path.cc
recorder/kis_play_info.cc
recorder/kis_recorded_action.cc
recorder/kis_recorded_action_factory_registry.cc
recorder/kis_recorded_action_load_context.cpp
recorder/kis_recorded_action_save_context.cpp
recorder/kis_recorded_filter_action.cpp
recorder/kis_recorded_fill_paint_action.cpp
recorder/kis_recorded_node_action.cc
recorder/kis_recorded_paint_action.cpp
recorder/kis_recorded_path_paint_action.cpp
recorder/kis_recorded_shape_paint_action.cpp
kis_keyframe.cpp
kis_keyframe_channel.cpp
kis_keyframe_commands.cpp
kis_scalar_keyframe_channel.cpp
kis_raster_keyframe_channel.cpp
kis_onion_skin_compositor.cpp
kis_onion_skin_cache.cpp
kis_idle_watcher.cpp
kis_psd_layer_style.cpp
kis_layer_properties_icons.cpp
layerstyles/kis_multiple_projection.cpp
layerstyles/kis_layer_style_filter.cpp
layerstyles/kis_layer_style_filter_environment.cpp
layerstyles/kis_layer_style_filter_projection_plane.cpp
layerstyles/kis_layer_style_projection_plane.cpp
layerstyles/kis_ls_drop_shadow_filter.cpp
layerstyles/kis_ls_satin_filter.cpp
layerstyles/kis_ls_stroke_filter.cpp
layerstyles/kis_ls_bevel_emboss_filter.cpp
layerstyles/kis_ls_overlay_filter.cpp
layerstyles/kis_ls_utils.cpp
layerstyles/gimp_bump_map.cpp
KisProofingConfiguration.cpp
)
set(einspline_SRCS
3rdparty/einspline/bspline_create.cpp
3rdparty/einspline/bspline_data.cpp
3rdparty/einspline/multi_bspline_create.cpp
3rdparty/einspline/nubasis.cpp
3rdparty/einspline/nubspline_create.cpp
3rdparty/einspline/nugrid.cpp
)
add_library(kritaimage SHARED ${kritaimage_LIB_SRCS} ${einspline_SRCS})
generate_export_header(kritaimage BASE_NAME kritaimage)
target_link_libraries(kritaimage
PUBLIC
kritaversion
kritawidgets
kritaglobal kritapsd
kritaodf kritapigment
kritacommand
kritawidgetutils
Qt5::Concurrent
)
target_link_libraries(kritaimage PUBLIC ${Boost_SYSTEM_LIBRARY})
if(OPENEXR_FOUND)
target_link_libraries(kritaimage PUBLIC ${OPENEXR_LIBRARIES})
endif()
if(FFTW3_FOUND)
target_link_libraries(kritaimage PRIVATE ${FFTW3_LIBRARIES})
endif()
if(HAVE_VC)
target_link_libraries(kritaimage PUBLIC ${Vc_LIBRARIES})
endif()
if (NOT GSL_FOUND)
message (WARNING "KRITA WARNING! No GNU Scientific Library was found! Krita's Shaped Gradients might be non-normalized! Please install GSL library.")
else ()
target_link_libraries(kritaimage PRIVATE ${GSL_LIBRARIES} ${GSL_CBLAS_LIBRARIES})
endif ()
target_include_directories(kritaimage
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/brushengine>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/filter>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/generator>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/layerstyles>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/metadata>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/processing>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/recorder>
)
set_target_properties(kritaimage PROPERTIES
VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION}
)
install(TARGETS kritaimage ${INSTALL_TARGETS_DEFAULT_ARGS})
########### install schemas #############
install( FILES
metadata/schemas/dc.schema
metadata/schemas/exif.schema
metadata/schemas/tiff.schema
metadata/schemas/mkn.schema
metadata/schemas/xmp.schema
metadata/schemas/xmpmm.schema
metadata/schemas/xmprights.schema
DESTINATION ${DATA_INSTALL_DIR}/krita/metadata/schemas)
diff --git a/libs/image/brushengine/kis_callback_based_paintop_property.h b/libs/image/brushengine/kis_callback_based_paintop_property.h
index 882096fe00..460c4cf58b 100644
--- a/libs/image/brushengine/kis_callback_based_paintop_property.h
+++ b/libs/image/brushengine/kis_callback_based_paintop_property.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CALLBACK_BASED_PAINTOP_PROPERTY_H
#define __KIS_CALLBACK_BASED_PAINTOP_PROPERTY_H
#include <functional>
template <class ParentClass>
class KisCallbackBasedPaintopProperty : public ParentClass
{
public:
KisCallbackBasedPaintopProperty(typename ParentClass::Type type,
const QString &id,
const QString &name,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent)
: ParentClass(type, id, name, settings, parent) {}
KisCallbackBasedPaintopProperty(const QString &id,
const QString &name,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent)
: ParentClass(id, name, settings, parent) {}
typedef std::function<void (KisUniformPaintOpProperty*)> Callback;
typedef std::function<bool (const KisUniformPaintOpProperty*)> VisibleCallback;
void setReadCallback(Callback func) { m_readFunc = func; }
void setWriteCallback(Callback func) { m_writeFunc = func; }
void setIsVisibleCallback(VisibleCallback func) { m_visibleFunc = func; }
protected:
- virtual void readValueImpl() { if (m_readFunc) m_readFunc(this); }
- virtual void writeValueImpl() { if (m_writeFunc) m_writeFunc(this); }
- virtual bool isVisible() const { return m_visibleFunc ? m_visibleFunc(this) : true; }
+ void readValueImpl() override { if (m_readFunc) m_readFunc(this); }
+ void writeValueImpl() override { if (m_writeFunc) m_writeFunc(this); }
+ bool isVisible() const override { return m_visibleFunc ? m_visibleFunc(this) : true; }
private:
Callback m_readFunc;
Callback m_writeFunc;
VisibleCallback m_visibleFunc;
};
#endif /* __KIS_CALLBACK_BASED_PAINTOP_PROPERTY_H */
diff --git a/libs/image/brushengine/kis_combo_based_paintop_property.h b/libs/image/brushengine/kis_combo_based_paintop_property.h
index 8b389c21bb..71434fba2a 100644
--- a/libs/image/brushengine/kis_combo_based_paintop_property.h
+++ b/libs/image/brushengine/kis_combo_based_paintop_property.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COMBO_BASED_PAINTOP_PROPERTY_H
#define __KIS_COMBO_BASED_PAINTOP_PROPERTY_H
#include <QScopedPointer>
#include "kis_uniform_paintop_property.h"
#include "kis_types.h"
#include "kritaimage_export.h"
class QIcon;
class KRITAIMAGE_EXPORT KisComboBasedPaintOpProperty : public KisUniformPaintOpProperty
{
public:
KisComboBasedPaintOpProperty(const QString &id,
const QString &name,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent);
- ~KisComboBasedPaintOpProperty();
+ ~KisComboBasedPaintOpProperty() override;
// callback-compatible c-tor
KisComboBasedPaintOpProperty(Type type,
const QString &id,
const QString &name,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent);
QList<QString> items() const;
void setItems(const QList<QString> &list);
QList<QIcon> icons() const;
void setIcons(const QList<QIcon> &list);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#include "kis_callback_based_paintop_property.h"
extern template class KRITAIMAGE_EXPORT KisCallbackBasedPaintopProperty<KisComboBasedPaintOpProperty>;
typedef KisCallbackBasedPaintopProperty<KisComboBasedPaintOpProperty> KisComboBasedPaintOpPropertyCallback;
#endif /* __KIS_COMBO_BASED_PAINTOP_PROPERTY_H */
diff --git a/libs/image/brushengine/kis_locked_properties_proxy.h b/libs/image/brushengine/kis_locked_properties_proxy.h
index 08e05ec01f..db3d96a8e2 100644
--- a/libs/image/brushengine/kis_locked_properties_proxy.h
+++ b/libs/image/brushengine/kis_locked_properties_proxy.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LOCKED_PROPERTIES_PROXY_H
#define KIS_LOCKED_PROPERTIES_PROXY_H
#include "kis_properties_configuration.h"
/**
* This class acts as a proxy for all transfers between KisLockedPropertiesServer
* and KisPaintOpSettings while using setConfiguration and writeConfiguration
* methods. It is used to override the local settings of a * paintop with the
* settings present in the KisLockedProperties List.
*
* Settings with the "_previous" suffix are used to save the local settings of
* a preset in the preset itself. Whenever the user selects the option of going
* back to the previous configuration of the preset or "unlocks" an option
* -- these settings are restored and the settings with the "_previous"
* suffix are destroyed.
*/
class KisLockedPropertiesServer;
class KisLockedPropertiesProxy: public KisPropertiesConfiguration
{
public:
KisLockedPropertiesProxy(KisPropertiesConfiguration *, KisLockedPropertiesSP);
- ~KisLockedPropertiesProxy();
+ ~KisLockedPropertiesProxy() override;
using KisPropertiesConfiguration::getProperty;
- QVariant getProperty(const QString &name) const;
+ QVariant getProperty(const QString &name) const override;
using KisPropertiesConfiguration::setProperty;
- void setProperty(const QString & name, const QVariant & value);
+ void setProperty(const QString & name, const QVariant & value) override;
private:
Q_DISABLE_COPY(KisLockedPropertiesProxy)
mutable KisLockedPropertiesSP m_lockedProperties;
KisPropertiesConfiguration* m_parent;
};
typedef KisPinnedSharedPtr<KisLockedPropertiesProxy> KisLockedPropertiesProxySP;
typedef KisWeakSharedPtr<KisLockedPropertiesProxy> KisLockedPropertiesProxyWSP;
#endif // KIS_LOCKED_PROPERTIES_PROXY_H
diff --git a/libs/image/brushengine/kis_locked_properties_server.h b/libs/image/brushengine/kis_locked_properties_server.h
index c1866d3f1f..3c24f53a3b 100644
--- a/libs/image/brushengine/kis_locked_properties_server.h
+++ b/libs/image/brushengine/kis_locked_properties_server.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LOCKED_PROPERTIES_SERVER_H
#define KIS_LOCKED_PROPERTIES_SERVER_H
#include <brushengine/kis_locked_properties_proxy.h>
#include "kis_properties_configuration.h"
class KisLockedPropertiesProxy;
/**
* The KisLockedPropertiesServer class
* This static class stores an object of KisLockedProperties and generates a KisLockedPropertiesProxy used
* by other classes/objects to access the LockedProperties object.
*/
class KRITAIMAGE_EXPORT KisLockedPropertiesServer: public QObject
{
public:
KisLockedPropertiesServer();
- ~KisLockedPropertiesServer();
+ ~KisLockedPropertiesServer() override;
static KisLockedPropertiesServer* instance();
KisLockedPropertiesSP lockedProperties();
void addToLockedProperties(KisPropertiesConfigurationSP p);
void removeFromLockedProperties(KisPropertiesConfigurationSP p);
void setPropertiesFromLocked(bool value);
bool propertiesFromLocked();
KisLockedPropertiesProxySP createLockedPropertiesProxy(KisPropertiesConfiguration *settings);
KisLockedPropertiesProxySP createLockedPropertiesProxy(KisPropertiesConfigurationSP settings);
bool hasProperty(const QString &p);
private:
KisLockedPropertiesSP m_lockedProperties;
bool m_propertiesFromLocked;
};
#endif // KIS_LOCKED_PROPERTIES_SERVER_H
diff --git a/libs/image/brushengine/kis_paintop_config_widget.h b/libs/image/brushengine/kis_paintop_config_widget.h
index 4e987ff367..4b4a0ceba5 100644
--- a/libs/image/brushengine/kis_paintop_config_widget.h
+++ b/libs/image/brushengine/kis_paintop_config_widget.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_CONFIG_WIDGET_H_
#define KIS_PAINTOP_CONFIG_WIDGET_H_
#include "kritaimage_export.h"
#include "kis_config_widget.h"
#include "kis_image.h"
#include <kis_debug.h>
#include <kis_properties_configuration.h>
class KisPaintopLodLimitations;
/**
* Base class for widgets that are used to edit and display paintop settings.
*/
class KRITAIMAGE_EXPORT KisPaintOpConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisPaintOpConfigWidget(QWidget * parent = 0, Qt::WFlags f = 0);
- virtual ~KisPaintOpConfigWidget();
+ ~KisPaintOpConfigWidget() override;
void writeConfigurationSafe(KisPropertiesConfigurationSP config) const;
void setConfigurationSafe(const KisPropertiesConfigurationSP config);
protected:
- virtual void setConfiguration(const KisPropertiesConfigurationSP config) = 0;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override = 0;
virtual void writeConfiguration(KisPropertiesConfigurationSP config) const = 0;
public:
virtual KisPaintopLodLimitations lodLimitations() const = 0;
virtual void setImage(KisImageWSP image);
virtual void setNode(KisNodeWSP node);
/**
* This is true for all of the paintop widget except for the Custom brush tab in the Brush tip dialog
*/
virtual bool presetIsValid();
/**
* Some paintops are more complicated and require full canvas with layers, projections and KisImage etc.
* Example is duplicate paintop. In this case simple canvas like scratchbox does not work.
* Every paintop supports the scratchbox by default, override and return false if paintop does not.
*/
virtual bool supportScratchBox();
protected:
KisImageWSP m_image;
KisNodeWSP m_node;
mutable int m_isInsideUpdateCall;
};
#endif
diff --git a/libs/image/brushengine/kis_paintop_factory.h b/libs/image/brushengine/kis_paintop_factory.h
index a44dd707cb..b09adf701e 100644
--- a/libs/image/brushengine/kis_paintop_factory.h
+++ b/libs/image/brushengine/kis_paintop_factory.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_FACTORY_H_
#define KIS_PAINTOP_FACTORY_H_
#include "kis_types.h"
#include "kritaimage_export.h"
#include <QObject>
#include <QString>
#include <QStringList>
#include <kis_threaded_text_rendering_workaround.h>
class KisPainter;
class KisPaintOp;
class QWidget;
class KisPaintOpConfigWidget;
/**
* The paintop factory is responsible for creating paintops of the specified class.
* If there is an optionWidget, the derived paintop itself must support settings,
* and it's up to the factory to do that.
*/
class KRITAIMAGE_EXPORT KisPaintOpFactory : public QObject
{
Q_OBJECT
public:
enum PaintopVisibility {
AUTO,
ALWAYS,
NEVER
};
/**
* @param whiteListedCompositeOps list of compositeops that don't work with this paintop
*/
KisPaintOpFactory(const QStringList & whiteListedCompositeOps = QStringList());
- virtual ~KisPaintOpFactory() {}
+ ~KisPaintOpFactory() override {}
static QString categoryStable();
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
virtual void preinitializePaintOpIfNeeded(const KisPaintOpSettingsSP settings);
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
/**
* Create a KisPaintOp with the given settings and painter.
* @param settings the settings associated with the input device
* @param painter the painter used to draw
*/
virtual KisPaintOp * createOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) = 0;
virtual QString id() const = 0;
virtual QString name() const = 0;
virtual QString category() const = 0;
/**
* List of usually hidden compositeops that are useful for this paintop.
*/
QStringList whiteListedCompositeOps() const;
/**
* The filename of the pixmap we can use to represent this paintop in the ui.
*/
virtual QString pixmap();
/**
* Create and return an settings object for this paintop.
*/
virtual KisPaintOpSettingsSP settings() = 0;
/**
* create a widget that can display paintop settings
*/
virtual KisPaintOpConfigWidget* createConfigWidget(QWidget* parent) = 0;
/**
* Set the priority of this paintop, as it is shown in the UI; lower number means
* it will be show more to the front of the list.
* @param newPriority the priority
*/
void setPriority(int newPriority);
int priority() const;
/**
* This method will be called by the registry after all paintops are loaded
* Overwrite to let the factory do something.
*/
virtual void processAfterLoading() {}
private:
QStringList m_whiteListedCompositeOps;
int m_priority;
PaintopVisibility m_visibility;
};
#endif
diff --git a/libs/image/brushengine/kis_paintop_preset.h b/libs/image/brushengine/kis_paintop_preset.h
index f023f1d309..8a7e5c1ff7 100644
--- a/libs/image/brushengine/kis_paintop_preset.h
+++ b/libs/image/brushengine/kis_paintop_preset.h
@@ -1,138 +1,138 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_PRESET_H
#define KIS_PAINTOP_PRESET_H
#include <resources/KoResource.h>
#include "KoID.h"
#include "kis_types.h"
#include "kis_shared.h"
#include "kritaimage_export.h"
#include <brushengine/kis_uniform_paintop_property.h>
class KisPaintopSettingsUpdateProxy;
class KisPaintOpConfigWidget;
/**
* A KisPaintOpPreset contains a particular set of settings
* associated with a paintop, like brush, paintopsettings.
* A new property in this class is to make it dirty. That means the
* user can now temporarily save any tweaks in the Preset throughout
* the session. The Dirty Preset setting/unsetting is handled by KisPaintOpPresetSettings
*/
class KRITAIMAGE_EXPORT KisPaintOpPreset : public KoResource, public KisShared
{
public:
KisPaintOpPreset();
KisPaintOpPreset(const QString& filename);
- ~KisPaintOpPreset();
+ ~KisPaintOpPreset() override;
KisPaintOpPresetSP clone() const;
/// set the id of the paintop plugin
void setPaintOp(const KoID & paintOp);
/// return the id of the paintop plugin
KoID paintOp() const;
/// replace the current settings object with the specified settings
void setSettings(KisPaintOpSettingsSP settings);
void setOriginalSettings(KisPaintOpSettingsSP originalSettings);
/// return the settings that define this paintop preset
KisPaintOpSettingsSP settings() const;
KisPaintOpSettingsSP originalSettings() const;
- bool load();
- bool loadFromDevice(QIODevice *dev);
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
- bool save();
- bool saveToDevice(QIODevice* dev) const;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
void toXML(QDomDocument& doc, QDomElement& elt) const;
void fromXML(const QDomElement& elt);
bool removable() const {
return true;
}
- QString defaultFileExtension() const {
+ QString defaultFileExtension() const override {
return ".kpp";
}
void setPresetDirty(bool value);
bool isPresetDirty() const;
/**
* Never use manual save/restore calls to
* isPresetDirty()/setPresetDirty()! They will lead to
* hard-to-tack-down bugs when the dirty state will not be
* restored on jumps like 'return', 'break' or exception.
*/
class DirtyStateSaver {
public:
DirtyStateSaver(KisPaintOpPreset *preset)
: m_preset(preset), m_isDirty(preset->isPresetDirty())
{
}
~DirtyStateSaver() {
m_preset->setPresetDirty(m_isDirty);
}
private:
KisPaintOpPreset *m_preset;
bool m_isDirty;
};
/**
* @brief The UpdatedPostponer class
* @see KisPaintopSettingsUpdateProxy::postponeSettingsChanges()
*/
class UpdatedPostponer{
public:
UpdatedPostponer(KisPaintOpPreset *preset);
~UpdatedPostponer();
private:
KisPaintopSettingsUpdateProxy *m_updateProxy;
};
void setOptionsWidget(KisPaintOpConfigWidget *widget);
KisPaintopSettingsUpdateProxy* updateProxy() const;
KisPaintopSettingsUpdateProxy* updateProxyNoCreate() const;
QList<KisUniformPaintOpPropertySP> uniformProperties();
private:
struct Private;
Private * const m_d;
};
Q_DECLARE_METATYPE(KisPaintOpPresetSP)
#endif
diff --git a/libs/image/brushengine/kis_paintop_registry.h b/libs/image/brushengine/kis_paintop_registry.h
index b9fb57392c..6d2a98c1cd 100644
--- a/libs/image/brushengine/kis_paintop_registry.h
+++ b/libs/image/brushengine/kis_paintop_registry.h
@@ -1,105 +1,105 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_REGISTRY_H_
#define KIS_PAINTOP_REGISTRY_H_
#include <QObject>
#include "KoGenericRegistry.h"
#include "kis_paintop.h"
#include <brushengine/kis_paintop_factory.h>
#include "kis_types.h"
#include <brushengine/kis_paintop_settings.h>
#include <brushengine/kis_paintop_preset.h>
#include <kis_threaded_text_rendering_workaround.h>
#include <kritaimage_export.h>
class KisPaintOp;
class KisPainter;
/**
* Manages the loading and creating of all paintop plugins.
*/
class KRITAIMAGE_EXPORT KisPaintOpRegistry : public QObject, public KoGenericRegistry<KisPaintOpFactory*>
{
Q_OBJECT
public:
KisPaintOpRegistry();
- virtual ~KisPaintOpRegistry();
+ ~KisPaintOpRegistry() override;
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
void preinitializePaintOpIfNeeded(const KisPaintOpPresetSP preset);
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
/**
* Create and return a paintop based on the given preset. A preset defines
* a paintop, a settings object and possible a brush tip.
*/
KisPaintOp* paintOp(const KisPaintOpPresetSP preset, KisPainter * painter, KisNodeSP node, KisImageSP image) const;
/**
* Create and return an (abstracted) configuration widget
* for using the specified paintop with the specified input device,
* with the specified parent as widget parent. Returns 0 if there
* are no settings available for the given device.
*/
KisPaintOpSettingsSP settings(const KoID& id) const;
/**
* @return a default preset for the given paintop.
*/
KisPaintOpPresetSP defaultPreset(const KoID& id) const;
// Get the name of the icon to show in the toolchest
QString pixmap(const KoID & id) const;
/**
* This function return a list of all the keys in KoID format by using the name() method
* on the objects stored in the registry.
*/
QList<KoID> listKeys() const;
public:
static KisPaintOpRegistry* instance();
private:
KisPaintOpRegistry(const KisPaintOpRegistry&);
KisPaintOpRegistry operator=(const KisPaintOpRegistry&);
void initRegistry();
// So the settings can get a paintop to render their sample image
friend class KisPaintOpSettings;
/**
* Return a newly created paintop. You are responsible for deleting
*/
KisPaintOp * paintOp(const QString& id, const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image) const;
};
#endif // KIS_PAINTOP_REGISTRY_H_
diff --git a/libs/image/brushengine/kis_paintop_settings.h b/libs/image/brushengine/kis_paintop_settings.h
index af615106cd..1be1e04447 100644
--- a/libs/image/brushengine/kis_paintop_settings.h
+++ b/libs/image/brushengine/kis_paintop_settings.h
@@ -1,282 +1,282 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_SETTINGS_H_
#define KIS_PAINTOP_SETTINGS_H_
#include "kis_types.h"
#include "kritaimage_export.h"
#include <QImage>
#include <QScopedPointer>
#include "kis_properties_configuration.h"
#include <brushengine/kis_paint_information.h>
#include <brushengine/kis_uniform_paintop_property.h>
class KisPaintOpConfigWidget;
class KisPaintopSettingsUpdateProxy;
/**
* This class is used to cache the settings for a paintop
* between two creations. There is one KisPaintOpSettings per input device (mouse, tablet,
* etc...).
*
* The settings may be stored in a preset or a recorded brush stroke. Note that if your
* paintop's settings subclass has data that is not stored as a property, that data is not
* saved and restored.
*
* The object also contains a pointer to its parent KisPaintOpPreset object.This is to control the DirtyPreset
* property of KisPaintOpPreset. Whenever the settings are changed/modified from the original -- the preset is
* set to dirty.
*/
class KRITAIMAGE_EXPORT KisPaintOpSettings : public KisPropertiesConfiguration
{
public:
KisPaintOpSettings();
- virtual ~KisPaintOpSettings();
+ ~KisPaintOpSettings() override;
KisPaintOpSettings(const KisPaintOpSettings &rhs);
/**
*
*/
virtual void setOptionsWidget(KisPaintOpConfigWidget* widget);
/**
* This function is called by a tool when the mouse is pressed. It's useful if
* the paintop needs mouse interaction for instance in the case of the clone op.
* If the tool is supposed to ignore the event, the paint op should return false
* and if the tool is supposed to use the event, return true.
*/
virtual bool mousePressEvent(const KisPaintInformation &paintInformation, Qt::KeyboardModifiers modifiers, KisNodeWSP currentNode);
/**
* Clone the current settings object. Override this if your settings instance doesn't
* store everything as properties.
*/
virtual KisPaintOpSettingsSP clone() const;
/**
* @return the node the paintop is working on.
*/
KisNodeSP node() const;
/**
* Call this function when the paint op is selected or the tool is activated
*/
virtual void activate();
/**
* XXX: Remove this after 2.0, when the paint operation (incremental/non incremental) will
* be completely handled in the paintop, not in the tool. This is a filthy hack to move
* the option to the right place, at least.
* @return true if we paint incrementally, false if we paint like Photoshop. By default, paintops
* do not support non-incremental.
*/
virtual bool paintIncremental() {
return true;
}
/**
* @return the composite op it to which the indirect painting device
* should be initialized to. This is used by clone op to reset
* the composite op to COMPOSITE_COPY
*/
virtual QString indirectPaintingCompositeOp() const;
/**
* Whether this paintop wants to deposit paint even when not moving, i.e. the
* tool needs to activate its timer.
*/
virtual bool isAirbrushing() const {
return false;
}
/**
* If this paintop deposit the paint even when not moving, the tool needs to know the rate of it in miliseconds
*/
virtual int rate() const {
return 100;
}
/**
* This enum defines the current mode for painting an outline.
*/
enum OutlineMode {
CursorIsOutline = 1, ///< When this mode is set, an outline is painted around the cursor
CursorIsCircleOutline,
CursorNoOutline,
CursorTiltOutline,
CursorColorOutline
};
/**
* Returns the brush outline in pixel coordinates. Tool is responsible for conversion into view coordinates.
* Outline mode has to be passed to the paintop which builds the outline as some paintops have to paint outline
* always like clone paintop indicating the duplicate position
*/
virtual QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode);
/**
* Helpers for drawing the brush outline
*/
static QPainterPath ellipseOutline(qreal width, qreal height, qreal scale, qreal rotation);
/**
* Helper for drawing a triangle representing the tilt of the stylus.
*
* @param start is the offset from the brush's outline's bounding box
* @param lengthScale is used for deciding the size of the triangle.
* Brush diameter or width are common choices for this.
* @param angle is the angle between the two sides of the triangle.
*/
static QPainterPath makeTiltIndicator(KisPaintInformation const& info,
QPointF const& start, qreal lengthScale, qreal angle);
/**
* Set paintop opacity directly in the properties
*/
void setPaintOpOpacity(qreal value);
/**
* Set paintop flow directly in the properties
*/
void setPaintOpFlow(qreal value);
/**
* Set paintop composite mode directly in the properties
*/
void setPaintOpCompositeOp(const QString &value);
/**
* @return opacity saved in the properties
*/
qreal paintOpOpacity();
/**
* @return flow saved in the properties
*/
qreal paintOpFlow();
/**
* @return composite mode saved in the properties
*/
QString paintOpCompositeOp();
/**
* Set paintop size directly in the properties
*/
virtual void setPaintOpSize(qreal value) = 0;
/**
* @return size saved in the properties
*/
virtual qreal paintOpSize() const = 0;
void setEraserMode(bool value);
bool eraserMode();
qreal savedEraserSize() const;
void setSavedEraserSize(qreal value);
qreal savedBrushSize() const;
void setSavedBrushSize(qreal value);
qreal savedEraserOpacity() const;
void setSavedEraserOpacity(qreal value);
qreal savedBrushOpacity() const;
void setSavedBrushOpacity(qreal value);
QString effectivePaintOpCompositeOp();
void setPreset(KisPaintOpPresetWSP preset);
KisPaintOpPresetWSP preset() const;
/**
* @return filename of the 3D brush model, empty if no brush is set
*/
virtual QString modelName() const;
/**
* Set filename of 3D brush model. By default no brush is set
*/
void setModelName(const QString & modelName);
/// Check if the settings are valid, setting might be invalid through missing brushes etc
/// Overwrite if the settings of a paintop can be invalid
/// @return state of the settings, default implementation is true
virtual bool isValid() const;
/// Check if the settings are loadable, that might the case if we can fallback to something
/// Overwrite if the settings can do some kind of fallback
/// @return loadable state of the settings, by default implementation return the same as isValid()
virtual bool isLoadable();
/**
* These methods are populating properties with runtime
* information about canvas rotation/mirroring. This information
* is set directly by KisToolFreehand. Later the data is accessed
* by the pressure options to make a final decision.
*/
void setCanvasRotation(qreal angle);
void setCanvasMirroring(bool xAxisMirrored, bool yAxisMirrored);
/**
* Overrides the method in KisPropertiesCofiguration to allow
* onPropertyChanged() callback
*/
- void setProperty(const QString & name, const QVariant & value);
+ void setProperty(const QString & name, const QVariant & value) override;
virtual QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
static bool isLodUserAllowed(const KisPropertiesConfigurationSP config);
static void setLodUserAllowed(KisPropertiesConfigurationSP config, bool value);
/**
* @return the option widget of the paintop (can be 0 is no option widgets is set)
*/
KisPaintOpConfigWidget* optionsWidget() const;
/**
* This function is called to set random offsets to the brush whenever the mouse is clicked. It is
* specific to when the pattern option is set.
*
*/
virtual void setRandomOffset(const KisPaintInformation &paintInformation);
protected:
/**
* The callback is called every time when a property changes
*/
virtual void onPropertyChanged();
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/libs/image/brushengine/kis_paintop_settings_update_proxy.h b/libs/image/brushengine/kis_paintop_settings_update_proxy.h
index 70fecd1fa8..d44ec5933b 100644
--- a/libs/image/brushengine/kis_paintop_settings_update_proxy.h
+++ b/libs/image/brushengine/kis_paintop_settings_update_proxy.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINTOP_SETTINGS_UPDATE_PROXY_H
#define __KIS_PAINTOP_SETTINGS_UPDATE_PROXY_H
#include <QScopedPointer>
#include <QObject>
class KisPaintopSettingsUpdateProxy : public QObject
{
Q_OBJECT
public:
KisPaintopSettingsUpdateProxy(QObject *parent = 0);
- ~KisPaintopSettingsUpdateProxy();
+ ~KisPaintopSettingsUpdateProxy() override;
void notifySettingsChanged();
void notifyUniformPropertiesChanged();
/**
* Blocks all sigSettingsChanged() signals until unpostponeSettingsChanges()
* is called. Used to perform "atomic" writing operations.
*
* @see unpostponeSettingsChanges()
*/
void postponeSettingsChanges();
/**
* Unblocks sigSettingsChanged() and emits one signal if there were at least one
* dropped signal while the block was held.
*/
void unpostponeSettingsChanges();
Q_SIGNALS:
void sigSettingsChanged();
void sigUniformPropertiesChanged();
private Q_SLOTS:
void slotDeliverSettingsChanged();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_PAINTOP_SETTINGS_UPDATE_PROXY_H */
diff --git a/libs/image/brushengine/kis_uniform_paintop_property.h b/libs/image/brushengine/kis_uniform_paintop_property.h
index 89b22e1e06..9ca94fd234 100644
--- a/libs/image/brushengine/kis_uniform_paintop_property.h
+++ b/libs/image/brushengine/kis_uniform_paintop_property.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UNIFORM_PAINT_OP_PROPERTY_H
#define __KIS_UNIFORM_PAINT_OP_PROPERTY_H
#include <QScopedPointer>
#include <QObject>
#include "kritaimage_export.h"
#include "kis_types.h"
class KRITAIMAGE_EXPORT KisUniformPaintOpProperty : public QObject
{
Q_OBJECT
public:
enum Type {
Int = 0,
Double,
Bool,
Combo
};
public:
KisUniformPaintOpProperty(Type type,
const QString &id,
const QString &name,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent);
KisUniformPaintOpProperty(const QString &id,
const QString &name,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent);
- ~KisUniformPaintOpProperty();
+ ~KisUniformPaintOpProperty() override;
QString id() const;
QString name() const;
Type type() const;
QVariant value() const;
QWidget *createPropertyWidget();
KisPaintOpSettingsSP settings() const;
virtual bool isVisible() const;
public Q_SLOTS:
void setValue(const QVariant &value);
void requestReadValue();
Q_SIGNALS:
void valueChanged(const QVariant &value);
protected:
virtual void readValueImpl();
virtual void writeValueImpl();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
template<class T> class QSharedPointer;
template<class T> class QWeakPointer;
template<class T> class QList;
typedef QSharedPointer<KisUniformPaintOpProperty> KisUniformPaintOpPropertySP;
typedef QWeakPointer<KisUniformPaintOpProperty> KisUniformPaintOpPropertyWSP;
#include "kis_callback_based_paintop_property.h"
extern template class KRITAIMAGE_EXPORT KisCallbackBasedPaintopProperty<KisUniformPaintOpProperty>;
typedef KisCallbackBasedPaintopProperty<KisUniformPaintOpProperty> KisUniformPaintOpPropertyCallback;
#endif /* __KIS_UNIFORM_PAINT_OP_PROPERTY_H */
diff --git a/libs/image/commands/kis_change_filter_command.h b/libs/image/commands/kis_change_filter_command.h
index 7634b4059f..847b3b799d 100644
--- a/libs/image/commands/kis_change_filter_command.h
+++ b/libs/image/commands/kis_change_filter_command.h
@@ -1,96 +1,96 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CHANGE_FILTER_COMMAND_H
#define KIS_CHANGE_FILTER_COMMAND_H
#include <kundo2command.h>
#include <QRect>
#include "kis_types.h"
#include <klocalizedstring.h>
#include "filter/kis_filter_configuration.h"
#include "kis_node.h"
#include "kis_node_filter_interface.h"
#include "filter/kis_filter_registry.h"
#include "filter/kis_filter.h"
#include "generator/kis_generator_registry.h"
#include "generator/kis_generator.h"
class KisChangeFilterCmd : public KUndo2Command
{
public:
KisChangeFilterCmd(KisNodeSP node,
const QString &filterNameBefore,
const QString &xmlBefore,
const QString &filterNameAfter,
const QString &xmlAfter,
bool useGeneratorRegistry)
: KUndo2Command(kundo2_i18n("Change Filter")) {
m_node = node;
m_filterInterface = dynamic_cast<KisNodeFilterInterface*>(node.data());
Q_ASSERT(m_filterInterface);
m_useGeneratorRegistry = useGeneratorRegistry;
m_xmlBefore = xmlBefore;
m_xmlAfter = xmlAfter;
m_filterNameBefore = filterNameBefore;
m_filterNameAfter = filterNameAfter;
}
public:
- virtual void redo() {
+ void redo() override {
m_filterInterface->setFilter(createConfiguration(m_filterNameAfter, m_xmlAfter));
m_node->setDirty();
}
- virtual void undo() {
+ void undo() override {
m_filterInterface->setFilter(createConfiguration(m_filterNameBefore, m_xmlBefore));
m_node->setDirty();
}
private:
KisFilterConfigurationSP createConfiguration(const QString &name, const QString &data)
{
KisFilterConfigurationSP config;
if (m_useGeneratorRegistry) {
KisGeneratorSP generator = KisGeneratorRegistry::instance()->value(name);
config = generator->defaultConfiguration();
} else {
KisFilterSP filter = KisFilterRegistry::instance()->value(name);
config = filter->defaultConfiguration();
}
config->fromXML(data);
return config;
}
private:
KisNodeSP m_node;
KisNodeFilterInterface *m_filterInterface;
bool m_useGeneratorRegistry;
QString m_xmlBefore;
QString m_xmlAfter;
QString m_filterNameBefore;
QString m_filterNameAfter;
};
#endif
diff --git a/libs/image/commands/kis_deselect_global_selection_command.h b/libs/image/commands/kis_deselect_global_selection_command.h
index dcb5fa3aec..39030beb8f 100644
--- a/libs/image/commands/kis_deselect_global_selection_command.h
+++ b/libs/image/commands/kis_deselect_global_selection_command.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DESELECT_GLOBAL_SELECTION_COMMAND_H_
#define KIS_DESELECT_GLOBAL_SELECTION_COMMAND_H_
#include <kritaimage_export.h>
#include <kundo2command.h>
#include "kis_types.h"
/// The command for deselection the global selection of KisImage
class KRITAIMAGE_EXPORT KisDeselectGlobalSelectionCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param image the image
* @param parent the parent command
*/
KisDeselectGlobalSelectionCommand(KisImageWSP image, KUndo2Command * parent = 0);
- virtual ~KisDeselectGlobalSelectionCommand();
+ ~KisDeselectGlobalSelectionCommand() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
KisImageWSP m_image;
KisSelectionSP m_oldSelection;
};
#endif
diff --git a/libs/image/commands/kis_image_change_layers_command.h b/libs/image/commands/kis_image_change_layers_command.h
index 03d83495b7..5a70a1d723 100644
--- a/libs/image/commands/kis_image_change_layers_command.h
+++ b/libs/image/commands/kis_image_change_layers_command.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_CHANGE_LAYERS_COMMAND_H_
#define KIS_IMAGE_CHANGE_LAYERS_COMMAND_H_
#include <kritaimage_export.h>
#include "kis_types.h"
#include "kis_image_command.h"
class KisImageChangeLayersCommand : public KisImageCommand
{
public:
KisImageChangeLayersCommand(KisImageWSP image, KisNodeSP oldRootLayer, KisNodeSP newRootLayer);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
KisNodeSP m_oldRootLayer;
KisNodeSP m_newRootLayer;
};
#endif
diff --git a/libs/image/commands/kis_image_command.h b/libs/image/commands/kis_image_command.h
index e627996d0f..0c8b0c04f1 100644
--- a/libs/image/commands/kis_image_command.h
+++ b/libs/image/commands/kis_image_command.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_COMMAND_H_
#define KIS_IMAGE_COMMAND_H_
#include <kritaimage_export.h>
#include <kundo2command.h>
#include <QSize>
#include <QRect>
#include "kis_types.h"
#include "kis_paint_device.h"
/// the base command for commands altering a KisImage
class KRITAIMAGE_EXPORT KisImageCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param name The name that will be shown in the ui
* @param image The image the command will be working on.
*/
KisImageCommand(const KUndo2MagicString& name, KisImageWSP image, KUndo2Command *parent = 0);
- virtual ~KisImageCommand();
+ ~KisImageCommand() override;
protected:
/**
* Used for performing the smallest update
* after a node has been removed from stack.
* First tries to setDirty() node's siblings.
* If it doesn't help, performs full refresh.
*/
class UpdateTarget
{
public:
UpdateTarget(KisImageWSP image, KisNodeSP removedNode, const QRect &updateRect);
void update();
private:
KisImageWSP m_image;
QRect m_updateRect;
int m_removedNodeIndex;
KisNodeSP m_removedNodeParent;
};
protected:
KisImageWSP m_image;
};
#endif // KIS_IMAGE_COMMAND_H_
diff --git a/libs/image/commands/kis_image_layer_add_command.h b/libs/image/commands/kis_image_layer_add_command.h
index a683caecff..aff0848dac 100644
--- a/libs/image/commands/kis_image_layer_add_command.h
+++ b/libs/image/commands/kis_image_layer_add_command.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_LAYER_ADD_COMMAND_H_
#define KIS_IMAGE_LAYER_ADD_COMMAND_H_
#include <kritaimage_export.h>
#include "kis_types.h"
#include "kis_image_command.h"
/// The command for adding a layer
class KRITAIMAGE_EXPORT KisImageLayerAddCommand : public KisImageCommand
{
public:
/**
* Constructor
* @param image The image the command will be working on.
* @param layer the layer to add
*/
KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, KisNodeSP aboveThis, bool doRedoUpdates = true, bool doUndoUpdates = true);
KisImageLayerAddCommand(KisImageWSP image, KisNodeSP layer, KisNodeSP parent, quint32 index, bool doRedoUpdates = true, bool doUndoUpdates = true);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
KisNodeSP m_layer;
KisNodeSP m_parent;
KisNodeSP m_aboveThis;
quint32 m_index;
bool m_doRedoUpdates;
bool m_doUndoUpdates;
};
#endif
diff --git a/libs/image/commands/kis_image_layer_move_command.h b/libs/image/commands/kis_image_layer_move_command.h
index 8a532f8ab3..4b98dd98e7 100644
--- a/libs/image/commands/kis_image_layer_move_command.h
+++ b/libs/image/commands/kis_image_layer_move_command.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_LAYER_MOVE_COMMAND_H_
#define KIS_IMAGE_LAYER_MOVE_COMMAND_H_
#include <kritaimage_export.h>
#include <QSize>
#include <QBitArray>
#include "kis_types.h"
#include "kis_image_command.h"
/// The command for layer moves inside the layer stack
class KRITAIMAGE_EXPORT KisImageLayerMoveCommand : public KisImageCommand
{
public:
/**
* Command for layer moves inside the layer stack
*
* @param image the image
* @param layer the moved layer
* @param newParent the next parent of the layer
* @param newAbove the layer that will be below the layer after the move
*/
KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, KisNodeSP newAbove, bool doUpdates = true);
KisImageLayerMoveCommand(KisImageWSP image, KisNodeSP node, KisNodeSP newParent, quint32 index);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
KisNodeSP m_layer;
KisNodeSP m_prevParent;
KisNodeSP m_prevAbove;
KisNodeSP m_newParent;
KisNodeSP m_newAbove;
quint32 m_index;
bool m_useIndex;
bool m_doUpdates;
};
#endif
diff --git a/libs/image/commands/kis_image_layer_remove_command.h b/libs/image/commands/kis_image_layer_remove_command.h
index f224d9341c..f7dbe9cf9e 100644
--- a/libs/image/commands/kis_image_layer_remove_command.h
+++ b/libs/image/commands/kis_image_layer_remove_command.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_IMAGE_LAYER_REMOVE_COMMAND_H
#define __KIS_IMAGE_LAYER_REMOVE_COMMAND_H
#include "kritaimage_export.h"
#include "kis_types.h"
#include "kis_image_command.h"
class KRITAIMAGE_EXPORT KisImageLayerRemoveCommand : public KisImageCommand
{
public:
KisImageLayerRemoveCommand(KisImageWSP image,
KisNodeSP node,
bool doRedoUpdates = true,
bool doUndoUpdates = true);
- ~KisImageLayerRemoveCommand();
+ ~KisImageLayerRemoveCommand() override;
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
void addSubtree(KisImageWSP image, KisNodeSP node);
private:
KisNodeSP m_node;
bool m_doRedoUpdates;
bool m_doUndoUpdates;
};
#endif /* __KIS_IMAGE_LAYER_REMOVE_COMMAND_H */
diff --git a/libs/image/commands/kis_image_layer_remove_command_impl.h b/libs/image/commands/kis_image_layer_remove_command_impl.h
index 991471d47d..7a89a7a6da 100644
--- a/libs/image/commands/kis_image_layer_remove_command_impl.h
+++ b/libs/image/commands/kis_image_layer_remove_command_impl.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_LAYER_REMOVE_COMMAND_IMPL_H_
#define KIS_IMAGE_LAYER_REMOVE_COMMAND_IMPL_H_
#include <QList>
#include <kritaimage_export.h>
#include "kis_types.h"
#include "kis_image_command.h"
/// The command for removing a single node. It should be used inside
/// KisImageLayerRemoveCommand only
class KRITAIMAGE_EXPORT KisImageLayerRemoveCommandImpl : public KisImageCommand
{
public:
/**
* Constructor
* @param image The image the command will be working on.
* @param node the node to remove
*/
KisImageLayerRemoveCommandImpl(KisImageWSP image, KisNodeSP node, KUndo2Command *parent = 0);
- ~KisImageLayerRemoveCommandImpl();
+ ~KisImageLayerRemoveCommandImpl() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/image/commands/kis_image_lock_command.h b/libs/image/commands/kis_image_lock_command.h
index 62559aec9e..f925477e7a 100644
--- a/libs/image/commands/kis_image_lock_command.h
+++ b/libs/image/commands/kis_image_lock_command.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_LOCK_COMMAND_H_
#define KIS_IMAGE_LOCK_COMMAND_H_
#include "kis_types.h"
#include "kis_image_command.h"
/**
* The command for image locking inside macro commands.
*
* It will ensurce that the image is properly locked during the execution
* of macro commands. Place it at the start and end of the macro command.
*/
class KisImageLockCommand : public KisImageCommand
{
public:
/**
* Constructor
* @param image The image the command will be working on.
* @param lockImage Locking state of the image, while redo.
*/
KisImageLockCommand(KisImageWSP image, bool lockImage);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
};
#endif
diff --git a/libs/image/commands/kis_image_set_projection_color_space_command.h b/libs/image/commands/kis_image_set_projection_color_space_command.h
index 40c26b7a07..bb6e096f9d 100644
--- a/libs/image/commands/kis_image_set_projection_color_space_command.h
+++ b/libs/image/commands/kis_image_set_projection_color_space_command.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_SET_PROJECTION_COLOR_SPACE_COMMAND_H_
#define KIS_IMAGE_SET_PROJECTION_COLOR_SPACE_COMMAND_H_
#include "kis_image_command.h"
class KoColorSpace;
class KisImageSetProjectionColorSpaceCommand : public KisImageCommand
{
public:
KisImageSetProjectionColorSpaceCommand(KisImageWSP image, const KoColorSpace * afterColorSpace);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
const KoColorSpace * m_beforeColorSpace;
const KoColorSpace * m_afterColorSpace;
};
#endif /* KIS_IMAGE_SET_PROJECTION_COLOR_SPACE_COMMAND_H_ */
diff --git a/libs/image/commands/kis_layer_command.h b/libs/image/commands/kis_layer_command.h
index 067a21a5c4..e367a3d1d6 100644
--- a/libs/image/commands/kis_layer_command.h
+++ b/libs/image/commands/kis_layer_command.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LAYER_COMMAND_H_
#define KIS_LAYER_COMMAND_H_
#include <kundo2command.h>
#include <kritaimage_export.h>
#include "kis_types.h"
class KisLayer;
/// the base command for commands altering a layer
class KRITAIMAGE_EXPORT KisLayerCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param name The name that will be shown in the ui
* @param layer The layer the command will be working on.
*/
KisLayerCommand(const KUndo2MagicString& name, KisLayerSP layer);
- virtual ~KisLayerCommand();
+ ~KisLayerCommand() override;
protected:
KisLayerSP m_layer;
};
#endif
diff --git a/libs/image/commands/kis_node_command.h b/libs/image/commands/kis_node_command.h
index e19164891f..bc4c54a553 100644
--- a/libs/image/commands/kis_node_command.h
+++ b/libs/image/commands/kis_node_command.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_COMMAND_H_
#define KIS_NODE_COMMAND_H_
#include <kritaimage_export.h>
#include <kundo2command.h>
#include "kis_types.h"
class KisNode;
/// the base command for commands altering a node
class KRITAIMAGE_EXPORT KisNodeCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param name The name that will be shown in the ui
* @param node The node the command will be working on.
*/
KisNodeCommand(const KUndo2MagicString& name, KisNodeSP node);
- virtual ~KisNodeCommand();
+ ~KisNodeCommand() override;
protected:
KisNodeSP m_node;
};
#endif /* KIS_NODE_COMMAND_H_*/
diff --git a/libs/image/commands/kis_node_compositeop_command.h b/libs/image/commands/kis_node_compositeop_command.h
index 321f4d14e7..5688616864 100644
--- a/libs/image/commands/kis_node_compositeop_command.h
+++ b/libs/image/commands/kis_node_compositeop_command.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_COMPOSITEOP_COMMAND_H
#define KIS_NODE_COMPOSITEOP_COMMAND_H
#include "kis_node_command.h"
/// The command for setting the composite op
class KRITAIMAGE_EXPORT KisNodeCompositeOpCommand : public KisNodeCommand
{
public:
/**
* Constructor
* @param node The node the command will be working on.
* @param oldCompositeOp the old node composite op
* @param newCompositeOp the new node composite op
*/
KisNodeCompositeOpCommand(KisNodeSP node, const QString& oldCompositeOp, const QString& newCompositeOp);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
QString m_oldCompositeOp;
QString m_newCompositeOp;
};
#endif /* KIS_NODE_COMPOSITEOP_COMMAND_H */
diff --git a/libs/image/commands/kis_node_opacity_command.h b/libs/image/commands/kis_node_opacity_command.h
index 3316623623..ba3f85f959 100644
--- a/libs/image/commands/kis_node_opacity_command.h
+++ b/libs/image/commands/kis_node_opacity_command.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_OPACITY_COMMAND_H
#define KIS_NODE_OPACITY_COMMAND_H
#include "kis_node_command.h"
/// The command for setting the node opacity
class KRITAIMAGE_EXPORT KisNodeOpacityCommand : public KisNodeCommand
{
public:
/**
* Constructor
* @param node The node the command will be working on.
* @param oldOpacity the old node opacity
* @param newOpacity the new node opacity
*/
KisNodeOpacityCommand(KisNodeSP node, quint8 oldOpacity, quint8 newOpacity);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
quint8 m_oldOpacity;
quint8 m_newOpacity;
};
#endif /* KIS_NODE_OPACITY_COMMAND_H */
diff --git a/libs/image/commands/kis_node_property_list_command.h b/libs/image/commands/kis_node_property_list_command.h
index 6fe4bf2946..583f96bac1 100644
--- a/libs/image/commands/kis_node_property_list_command.h
+++ b/libs/image/commands/kis_node_property_list_command.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_NODE_PROPERTY_LIST_COMMAND_H_
#define KIS_IMAGE_NODE_PROPERTY_LIST_COMMAND_H_
#include "kis_node_command.h"
#include "kis_base_node.h"
/// The command for changing the property list of a layer
class KRITAIMAGE_EXPORT KisNodePropertyListCommand : public KisNodeCommand
{
public:
/**
* Constructor
* @param node the layer to add
*/
KisNodePropertyListCommand(KisNodeSP node, KisBaseNode::PropertyList newPropertyList);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
typedef KisBaseNode::PropertyList PropertyList;
static void setNodePropertiesNoUndo(KisNodeSP node, KisImageSP image, PropertyList proplist);
private:
void doUpdate(const KisBaseNode::PropertyList &oldPropertyList,
const KisBaseNode::PropertyList &newPropertyList);
private:
KisBaseNode::PropertyList m_newPropertyList;
KisBaseNode::PropertyList m_oldPropertyList;
};
#endif
diff --git a/libs/image/commands/kis_reselect_global_selection_command.h b/libs/image/commands/kis_reselect_global_selection_command.h
index f823b609f9..c27a7b848c 100644
--- a/libs/image/commands/kis_reselect_global_selection_command.h
+++ b/libs/image/commands/kis_reselect_global_selection_command.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_RESELECT_GLOBAL_SELECTION_COMMAND_H
#define KIS_RESELECT_GLOBAL_SELECTION_COMMAND_H
#include <kritaimage_export.h>
#include <kundo2command.h>
#include "kis_types.h"
/// The command for deselection the global selection of KisImage
class KRITAIMAGE_EXPORT KisReselectGlobalSelectionCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param image the image
* @param parent the parent command
*/
KisReselectGlobalSelectionCommand(KisImageWSP image, KUndo2Command * parent = 0);
- virtual ~KisReselectGlobalSelectionCommand();
+ ~KisReselectGlobalSelectionCommand() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
KisImageWSP m_image;
bool m_canReselect;
};
#endif
diff --git a/libs/image/commands/kis_set_global_selection_command.h b/libs/image/commands/kis_set_global_selection_command.h
index 2615157401..f2929bfc37 100644
--- a/libs/image/commands/kis_set_global_selection_command.h
+++ b/libs/image/commands/kis_set_global_selection_command.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SET_GLOBAL_SELECTION_COMMAND_H
#define KIS_SET_GLOBAL_SELECTION_COMMAND_H
#include <kritaimage_export.h>
#include <kundo2command.h>
#include "kis_types.h"
/**
* This command sets the global selection of the image. No saving
* of the previous selection for "Reselect" action happens
*/
class KRITAIMAGE_EXPORT KisSetGlobalSelectionCommand : public KUndo2Command
{
public:
/**
* Constructor
* @param image the image to set the global selection on
* @param selection the selection that will be set a global selection,
* null selection will remove the selection
*/
KisSetGlobalSelectionCommand(KisImageWSP image, KisSelectionSP selection);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
KisImageWSP m_image;
KisSelectionSP m_newSelection;
KisSelectionSP m_oldSelection;
};
/**
* Sets initial selection for the image. Nothing is selected,
* but the defaultBounds are set properly
*/
class KRITAIMAGE_EXPORT KisSetEmptyGlobalSelectionCommand : public KisSetGlobalSelectionCommand
{
public:
KisSetEmptyGlobalSelectionCommand(KisImageWSP image);
};
#endif //KIS_SET_GLOBAL_SELECTION_COMMAND_H
diff --git a/libs/image/commands_new/kis_activate_selection_mask_command.h b/libs/image/commands_new/kis_activate_selection_mask_command.h
index 4a59a21cca..b2c92c3c98 100644
--- a/libs/image/commands_new/kis_activate_selection_mask_command.h
+++ b/libs/image/commands_new/kis_activate_selection_mask_command.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ACTIVATE_SELECTION_MASK_COMMAND_H
#define __KIS_ACTIVATE_SELECTION_MASK_COMMAND_H
#include <klocalizedstring.h>
#include "kundo2command.h"
#include "kritaimage_export.h"
#include "kis_types.h"
class KRITAIMAGE_EXPORT KisActivateSelectionMaskCommand : public KUndo2Command
{
public:
KisActivateSelectionMaskCommand(KisSelectionMaskSP selectionMask, bool value);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
private:
KisSelectionMaskSP m_selectionMask;
KisSelectionMaskSP m_previousActiveMask;
bool m_value;
bool m_previousValue;
};
#endif /* __KIS_ACTIVATE_SELECTION_MASK_COMMAND_H */
diff --git a/libs/image/commands_new/kis_change_projection_color_command.h b/libs/image/commands_new/kis_change_projection_color_command.h
index e57e9aea40..10d059b9ea 100644
--- a/libs/image/commands_new/kis_change_projection_color_command.h
+++ b/libs/image/commands_new/kis_change_projection_color_command.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CHANGE_PROJECTION_COLOR_COMMAND_H
#define __KIS_CHANGE_PROJECTION_COLOR_COMMAND_H
#include "kritaimage_export.h"
#include "kis_types.h"
#include <KoColor.h>
#include <kundo2command.h>
class KRITAIMAGE_EXPORT KisChangeProjectionColorCommand : public KUndo2Command
{
public:
KisChangeProjectionColorCommand(KisImageSP image, const KoColor &newColor, KUndo2Command *parent = 0);
- ~KisChangeProjectionColorCommand();
+ ~KisChangeProjectionColorCommand() override;
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
- int id() const;
- bool mergeWith(const KUndo2Command* command);
+ int id() const override;
+ bool mergeWith(const KUndo2Command* command) override;
private:
KisImageWSP m_image;
KoColor m_oldColor;
KoColor m_newColor;
};
#endif /* __KIS_CHANGE_PROJECTION_COLOR_COMMAND_H */
diff --git a/libs/image/commands_new/kis_image_resize_command.h b/libs/image/commands_new/kis_image_resize_command.h
index 992594a380..45d50bf42c 100644
--- a/libs/image/commands_new/kis_image_resize_command.h
+++ b/libs/image/commands_new/kis_image_resize_command.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_RESIZE_COMMAND_H_
#define KIS_IMAGE_RESIZE_COMMAND_H_
#include "kritaimage_export.h"
#include "kis_types.h"
#include <kundo2command.h>
#include <QSize>
class KRITAIMAGE_EXPORT KisImageResizeCommand : public KUndo2Command
{
public:
KisImageResizeCommand(KisImageWSP image, const QSize& newRect);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
QSize m_sizeBefore;
QSize m_sizeAfter;
KisImageWSP m_image;
};
#endif
diff --git a/libs/image/commands_new/kis_image_set_resolution_command.h b/libs/image/commands_new/kis_image_set_resolution_command.h
index 41cdea9d8c..c0acbca39b 100644
--- a/libs/image/commands_new/kis_image_set_resolution_command.h
+++ b/libs/image/commands_new/kis_image_set_resolution_command.h
@@ -1,69 +1,69 @@
/*
* Copyright (c) 2010 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_SET_RESOLUTION_COMMAND_H
#define KIS_IMAGE_SET_RESOLUTION_COMMAND_H
#include "kritaimage_export.h"
#include "kis_types.h"
#include <kundo2command.h>
class KRITAIMAGE_EXPORT KisImageSetResolutionCommand : public KUndo2Command
{
public:
KisImageSetResolutionCommand(KisImageWSP image, qreal newXRes, qreal newYRes, KUndo2Command *parent = 0);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
private:
KisImageWSP m_image;
qreal m_newXRes;
qreal m_newYRes;
qreal m_oldXRes;
qreal m_oldYRes;
};
/**
* A special workaround command for updating the shapes. It resets
* shapes always (for both undo() and redo() actions) after all the
* child commands are finished. Usually, it should have the only child
* KisImageSetResolutionCommand.
*
* Usecase: When you change the resolution of the image, the
* projection of the vector layer is still rendered in old
* resolution. So you should reset it and render again.
*/
class KRITAIMAGE_EXPORT KisResetShapesCommand : public KUndo2Command
{
public:
KisResetShapesCommand(KisNodeSP rootNode);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
private:
void resetNode(KisNodeSP node);
private:
KisNodeSP m_rootNode;
};
#endif // KIS_IMAGE_SET_RESOLUTION_COMMAND_H
diff --git a/libs/image/commands_new/kis_move_command_common.h b/libs/image/commands_new/kis_move_command_common.h
index 99c2f96722..3b39da6654 100644
--- a/libs/image/commands_new/kis_move_command_common.h
+++ b/libs/image/commands_new/kis_move_command_common.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@kde.org>
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MOVE_COMMAND_COMMON_H
#define KIS_MOVE_COMMAND_COMMON_H
#include <QPoint>
#include <klocalizedstring.h>
#include "kundo2command.h"
#include "kritaimage_export.h"
#include "kis_types.h"
/**
* KisMoveCommandCommon is a general template for a command that moves
* entities capable of setX() and setY() actions. Generally in Krita
* you should now move the device itself, only the node containing
* that device. But the case of the selections is a bit special, so we
* move them separately.
*/
template <class ObjectSP>
class KRITAIMAGE_EXPORT KisMoveCommandCommon : public KUndo2Command
{
public:
KisMoveCommandCommon(ObjectSP object, const QPoint& oldPos, const QPoint& newPos, KUndo2Command *parent = 0)
: KUndo2Command(kundo2_i18n("Move"), parent),
m_oldPos(oldPos),
m_newPos(newPos),
m_object(object)
{
}
- void redo() {
+ void redo() override {
moveTo(m_newPos);
}
- void undo() {
+ void undo() override {
moveTo(m_oldPos);
}
private:
void moveTo(const QPoint& pos) {
/**
* FIXME: Hack alert:
* Our iterators don't have guarantees on thread-safety
* when the offset varies. When it is fixed, remove the locking.
* see: KisIterator::stressTest(), KisToolMove::mousePressEvent()
*/
m_object->setX(pos.x());
m_object->setY(pos.y());
}
private:
QPoint m_oldPos;
QPoint m_newPos;
protected:
ObjectSP m_object;
};
#endif
diff --git a/libs/image/commands_new/kis_node_move_command2.h b/libs/image/commands_new/kis_node_move_command2.h
index 5b49195fa4..6ae06cbe69 100644
--- a/libs/image/commands_new/kis_node_move_command2.h
+++ b/libs/image/commands_new/kis_node_move_command2.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@kde.org>
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_MOVE_COMMAND2_H
#define KIS_NODE_MOVE_COMMAND2_H
#include "kis_move_command_common.h"
class KRITAIMAGE_EXPORT KisNodeMoveCommand2 : public KisMoveCommandCommon<KisNodeSP>
{
public:
KisNodeMoveCommand2(KisNodeSP object, const QPoint& oldPos, const QPoint& newPos, KUndo2Command *parent = 0);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
static void tryNotifySelection(KisNodeSP node);
};
#endif
diff --git a/libs/image/commands_new/kis_processing_command.h b/libs/image/commands_new/kis_processing_command.h
index e35ef7a246..06495a6cbb 100644
--- a/libs/image/commands_new/kis_processing_command.h
+++ b/libs/image/commands_new/kis_processing_command.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PROCESSING_COMMAND_H
#define __KIS_PROCESSING_COMMAND_H
#include <kundo2command.h>
#include "kis_types.h"
#include "kis_surrogate_undo_adapter.h"
class KisProcessingVisitor;
class KRITAIMAGE_EXPORT KisProcessingCommand : public KUndo2Command
{
public:
KisProcessingCommand(KisProcessingVisitorSP visitor, KisNodeSP node, KUndo2Command *parent = 0);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
private:
KisProcessingVisitorSP m_visitor;
KisNodeSP m_node;
KisSurrogateUndoAdapter m_undoAdapter;
bool m_visitorExecuted;
};
#endif /* __KIS_PROCESSING_COMMAND_H */
diff --git a/libs/image/commands_new/kis_saved_commands.h b/libs/image/commands_new/kis_saved_commands.h
index a5fce66142..f15e7ee290 100644
--- a/libs/image/commands_new/kis_saved_commands.h
+++ b/libs/image/commands_new/kis_saved_commands.h
@@ -1,101 +1,101 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SAVED_COMMANDS_H
#define __KIS_SAVED_COMMANDS_H
#include <kundo2command.h>
#include "kis_types.h"
#include "kis_stroke_job_strategy.h"
class KisStrokesFacade;
class KRITAIMAGE_EXPORT KisSavedCommandBase : public KUndo2Command
{
public:
KisSavedCommandBase(const KUndo2MagicString &name, KisStrokesFacade *strokesFacade);
- virtual ~KisSavedCommandBase();
+ ~KisSavedCommandBase() override;
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
protected:
virtual void addCommands(KisStrokeId id, bool undo) = 0;
KisStrokesFacade* strokesFacade();
private:
void runStroke(bool undo);
private:
KisStrokesFacade *m_strokesFacade;
bool m_skipOneRedo;
};
class KRITAIMAGE_EXPORT KisSavedCommand : public KisSavedCommandBase
{
public:
KisSavedCommand(KUndo2CommandSP command, KisStrokesFacade *strokesFacade);
- virtual int timedId();
- void setTimedID(int timedID);
+ int timedId() override;
+ void setTimedID(int timedID) override;
- int id() const;
- bool mergeWith(const KUndo2Command* command);
+ int id() const override;
+ bool mergeWith(const KUndo2Command* command) override;
- virtual bool timedMergeWith(KUndo2Command *other);
- virtual QVector<KUndo2Command*> mergeCommandsVector();
- virtual void setTime();
- virtual QTime time();
- virtual void setEndTime();
- virtual QTime endTime();
- virtual bool isMerged();
+ bool timedMergeWith(KUndo2Command *other) override;
+ QVector<KUndo2Command*> mergeCommandsVector() override;
+ void setTime() override;
+ QTime time() override;
+ void setEndTime() override;
+ QTime endTime() override;
+ bool isMerged() override;
protected:
- void addCommands(KisStrokeId id, bool undo);
+ void addCommands(KisStrokeId id, bool undo) override;
private:
KUndo2CommandSP m_command;
};
class KRITAIMAGE_EXPORT KisSavedMacroCommand : public KisSavedCommandBase
{
public:
KisSavedMacroCommand(const KUndo2MagicString &name, KisStrokesFacade *strokesFacade);
- ~KisSavedMacroCommand();
+ ~KisSavedMacroCommand() override;
- int id() const;
- bool mergeWith(const KUndo2Command* command);
+ int id() const override;
+ bool mergeWith(const KUndo2Command* command) override;
void setMacroId(int value);
void addCommand(KUndo2CommandSP command,
KisStrokeJobData::Sequentiality sequentiality = KisStrokeJobData::SEQUENTIAL,
KisStrokeJobData::Exclusivity exclusivity = KisStrokeJobData::NORMAL);
void performCancel(KisStrokeId id, bool strokeUndo);
protected:
- void addCommands(KisStrokeId id, bool undo);
+ void addCommands(KisStrokeId id, bool undo) override;
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_SAVED_COMMANDS_H */
diff --git a/libs/image/commands_new/kis_selection_move_command2.h b/libs/image/commands_new/kis_selection_move_command2.h
index 7488585618..047928e0e3 100644
--- a/libs/image/commands_new/kis_selection_move_command2.h
+++ b/libs/image/commands_new/kis_selection_move_command2.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SELECTION_MOVE_COMMAND2_H
#define KIS_SELECTION_MOVE_COMMAND2_H
#include "kis_move_command_common.h"
/**
* A specialized class for moving a selection without its flattening and recalculation
* of the outline cache. See details in a comment to KisMoveCommandCommon.
*/
class KRITAIMAGE_EXPORT KisSelectionMoveCommand2 : public KisMoveCommandCommon<KisSelectionSP>
{
public:
KisSelectionMoveCommand2(KisSelectionSP object, const QPoint& oldPos, const QPoint& newPos, KUndo2Command *parent = 0);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
};
#endif
diff --git a/libs/image/commands_new/kis_set_layer_style_command.h b/libs/image/commands_new/kis_set_layer_style_command.h
index fa22094259..455d71e9d0 100644
--- a/libs/image/commands_new/kis_set_layer_style_command.h
+++ b/libs/image/commands_new/kis_set_layer_style_command.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@kde.org>
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SET_LAYER_STYLE_COMMAND_H
#define KIS_SET_LAYER_STYLE_COMMAND_H
#include <klocalizedstring.h>
#include "kundo2command.h"
#include "kritaimage_export.h"
#include "kis_types.h"
#include "kis_psd_layer_style.h"
class KRITAIMAGE_EXPORT KisSetLayerStyleCommand : public KUndo2Command
{
public:
KisSetLayerStyleCommand(KisLayerSP layer, KisPSDLayerStyleSP oldStyle, KisPSDLayerStyleSP newStyle, KUndo2Command *parent = 0);
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
static void updateLayerStyle(KisLayerSP layer, KisPSDLayerStyleSP style);
private:
KisLayerSP m_layer;
KisPSDLayerStyleSP m_oldStyle;
KisPSDLayerStyleSP m_newStyle;
};
#endif
diff --git a/libs/image/commands_new/kis_switch_current_time_command.h b/libs/image/commands_new/kis_switch_current_time_command.h
index f4a9538512..f432c674ba 100644
--- a/libs/image/commands_new/kis_switch_current_time_command.h
+++ b/libs/image/commands_new/kis_switch_current_time_command.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SWITCH_CURRENT_TIME_COMMAND_H
#define __KIS_SWITCH_CURRENT_TIME_COMMAND_H
#include "kritaimage_export.h"
#include "kis_types.h"
#include <kundo2command.h>
class KisImageAnimationInterface;
class KRITAIMAGE_EXPORT KisSwitchCurrentTimeCommand : public KUndo2Command
{
public:
KisSwitchCurrentTimeCommand(KisImageAnimationInterface *animation, int oldTime, int newTime, KUndo2Command *parent = 0);
- ~KisSwitchCurrentTimeCommand();
+ ~KisSwitchCurrentTimeCommand() override;
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
- int id() const;
- bool mergeWith(const KUndo2Command* command);
+ int id() const override;
+ bool mergeWith(const KUndo2Command* command) override;
private:
KisImageAnimationInterface *m_animation;
int m_oldTime;
int m_newTime;
};
#endif /* __KIS_SWITCH_CURRENT_TIME_COMMAND_H */
diff --git a/libs/image/commands_new/kis_update_command.h b/libs/image/commands_new/kis_update_command.h
index 87adc4bf33..e1d5791ac4 100644
--- a/libs/image/commands_new/kis_update_command.h
+++ b/libs/image/commands_new/kis_update_command.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UPDATE_COMMAND_H
#define __KIS_UPDATE_COMMAND_H
#include "kundo2command.h"
#include "kritaimage_export.h"
#include "kis_types.h"
class KisUpdatesFacade;
class KRITAIMAGE_EXPORT KisUpdateCommand : public KUndo2Command
{
public:
KisUpdateCommand(KisNodeSP node, QRect dirtyRect,
KisUpdatesFacade *updatesFacade,
bool needsFullRefresh = false);
- ~KisUpdateCommand();
+ ~KisUpdateCommand() override;
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
private:
void update();
private:
KisNodeSP m_node;
QRect m_dirtyRect;
KisUpdatesFacade *m_updatesFacade;
bool m_needsFullRefresh;
};
#endif /* __KIS_UPDATE_COMMAND_H */
diff --git a/libs/image/filter/kis_color_transformation_configuration.h b/libs/image/filter/kis_color_transformation_configuration.h
index 1d53ac057e..ea10984ae1 100644
--- a/libs/image/filter/kis_color_transformation_configuration.h
+++ b/libs/image/filter/kis_color_transformation_configuration.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2015 Thorsten Zachmann <zachmann@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_TRANSFORMATION_CONFIGURATION_H_
#define _KIS_COLOR_TRANSFORMATION_CONFIGURATION_H_
#include "kis_filter_configuration.h"
#include "kritaimage_export.h"
class KoColorSpace;
class KisColorTransformationFilter;
class KisColorTransformationConfiguration;
typedef KisSharedPtr<KisColorTransformationConfiguration> KisColorTransformationConfigurationSP;
class KRITAIMAGE_EXPORT KisColorTransformationConfiguration : public KisFilterConfiguration
{
public:
KisColorTransformationConfiguration(const QString & name, qint32 version);
KisColorTransformationConfiguration(const KisColorTransformationConfiguration &rhs);
- virtual ~KisColorTransformationConfiguration();
+ ~KisColorTransformationConfiguration() override;
KoColorTransformation *colorTransformation(const KoColorSpace *cs, const KisColorTransformationFilter *filter) const;
private:
struct Private;
Private* const d;
};
#endif /* _KIS_COLOR_TRANSFORMATION_CONFIGURATION_H_ */
diff --git a/libs/image/filter/kis_color_transformation_filter.h b/libs/image/filter/kis_color_transformation_filter.h
index d2c7a4b971..52b8eacbbb 100644
--- a/libs/image/filter/kis_color_transformation_filter.h
+++ b/libs/image/filter/kis_color_transformation_filter.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_TRANSFORMATION_FILTER_H_
#define _KIS_COLOR_TRANSFORMATION_FILTER_H_
#include "kis_filter.h"
#include "kritaimage_export.h"
/**
* This is a base class for filters that implement a filter for
* \ref KoColorTransformation based filters.
*/
class KRITAIMAGE_EXPORT KisColorTransformationFilter : public KisFilter
{
public:
KisColorTransformationFilter(const KoID& id, const KoID & category, const QString & entry);
- virtual ~KisColorTransformationFilter();
- virtual void processImpl(KisPaintDeviceSP device,
+ ~KisColorTransformationFilter() override;
+ void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
/**
* Create the color transformation that will be applied on the device.
*/
virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const = 0;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/libs/image/filter/kis_filter.h b/libs/image/filter/kis_filter.h
index 40b0ee31bb..ec9e787382 100644
--- a/libs/image/filter/kis_filter.h
+++ b/libs/image/filter/kis_filter.h
@@ -1,141 +1,141 @@
/*
* Copyright (c) 2004,2006-2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_FILTER_H_
#define _KIS_FILTER_H_
#include <list>
#include <QString>
#include <klocalizedstring.h>
#include "KoID.h"
#include "KoColorSpace.h"
#include "kis_types.h"
#include "kis_base_processor.h"
#include "kritaimage_export.h"
/**
* Basic interface of a Krita filter.
*/
class KRITAIMAGE_EXPORT KisFilter : public KisBaseProcessor
{
public:
static KoID categoryAdjust();
static KoID categoryArtistic();
static KoID categoryBlur();
static KoID categoryColors();
static KoID categoryEdgeDetection();
static KoID categoryEmboss();
static KoID categoryEnhance();
static KoID categoryMap();
static KoID categoryNonPhotorealistic();
static KoID categoryOther();
public:
/**
* Construct a Krita filter
*/
KisFilter(const KoID& id, const KoID & category, const QString & entry);
- virtual ~KisFilter();
+ ~KisFilter() override;
public:
/**
* Override this function with the implementation of your filter.
*
* This is a low level function that expects all the conditions
* for the @param device be met. Use usual process() methods
* instead.
*
* @param device the paint device to filter
* @param applyRect the rectangle where the filter is applied
* @param config the parameters of the filter
* @param progressUpdater to pass on the progress the filter is making
*/
virtual void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater = 0 ) const = 0;
/**
* Filter \p src device and write the result into \p dst device.
* If \p dst is an alpha color space device, it will get special
* treatment.
*
* @param src the source paint device
* @param dst the destination paint device
* @param selection the selection
* @param applyRect the rectangle where the filter is applied
* @param config the parameters of the filter
* @param progressUpdater to pass on the progress the filter is making
*/
void process(const KisPaintDeviceSP src,
KisPaintDeviceSP dst,
KisSelectionSP selection,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater = 0 ) const;
/**
* A convenience method for a two-device process() function
*/
void process(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater = 0 ) const;
/**
* Some filters need pixels outside the current processing rect to compute the new
* value (for instance, convolution filters)
*/
virtual QRect neededRect(const QRect & rect, const KisFilterConfigurationSP config, int lod) const;
/**
* Similar to \ref neededRect: some filters will alter a lot of pixels that are
* near to each other at the same time. So when you changed a single rectangle
* in a device, the actual rectangle that will feel the influence of this change
* might be bigger. Use this function to determine that rect.
*/
virtual QRect changedRect(const QRect & rect, const KisFilterConfigurationSP config, int lod) const;
/**
* Returns true if the filter is capable of handling LoD scaled planes
* when generating preview.
*/
virtual bool supportsLevelOfDetail(const KisFilterConfigurationSP config, int lod) const;
virtual bool needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const;
protected:
QString configEntryGroup() const;
void setSupportsLevelOfDetail(bool value);
private:
bool m_supportsLevelOfDetail;
};
#endif
diff --git a/libs/image/filter/kis_filter_configuration.h b/libs/image/filter/kis_filter_configuration.h
index dbe9858c9a..3b4196826f 100644
--- a/libs/image/filter/kis_filter_configuration.h
+++ b/libs/image/filter/kis_filter_configuration.h
@@ -1,139 +1,139 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_FILTER_CONFIGURATION_H_
#define _KIS_FILTER_CONFIGURATION_H_
#include <QMetaType>
#include "kis_properties_configuration.h"
#include "kis_types.h"
#include "kritaimage_export.h"
/**
* KisFilterConfiguration does inherit neither KisShared or QSharedData
* so sometimes there might be problem with broken QSharedPointer counters.
* This macro activates debugging routines for such stuff.
*
* In the future, please either port the entire KisNodeFilterInterface
* into KisFilterConfigurationSP or derive filter configuration
* interface from QSharedData to handle these cases.
*/
#define SANITY_CHECK_FILTER_CONFIGURATION_OWNER
/**
* A KisFilterConfiguration is the serializable representation of
* the filter parameters. Filters can subclass this class to implement
* direct accessors to properties, but properties not in the map will
* not be serialized.
*
* XXX: Use KoProperties here!
*/
class KRITAIMAGE_EXPORT KisFilterConfiguration : public KisPropertiesConfiguration
{
public:
/**
* Create a new filter config.
*/
KisFilterConfiguration(const QString & name, qint32 version);
protected:
/**
* Deep copy the filter configFile
*/
KisFilterConfiguration(const KisFilterConfiguration & rhs);
public:
- virtual ~KisFilterConfiguration();
+ ~KisFilterConfiguration() override;
public:
/**
* This function is use to convert from legacy XML as used in .kra file.
*/
virtual void fromLegacyXML(const QDomElement&);
using KisPropertiesConfiguration::fromXML;
using KisPropertiesConfiguration::toXML;
- virtual void fromXML(const QDomElement&);
- virtual void toXML(QDomDocument&, QDomElement&) const;
+ void fromXML(const QDomElement&) override;
+ void toXML(QDomDocument&, QDomElement&) const override;
/**
* Get the unique, language independent name of the filter.
*/
const QString & name() const;
/**
* Get the version of the filter that has created this config
*/
qint32 version() const;
/**
* Check if that configuration is compatible with this paint device.
* The default implementation always return true.
*/
virtual bool isCompatible(const KisPaintDeviceSP) const;
/**
* @return an array with each colorspace channel a true/false bit
* that indicates whether the channel should be filtered or left
* alone. It is up to the filter to decide whether channels that
* are to be left alone are copied to the dest file or not.
*/
QBitArray channelFlags() const;
/**
* Set the channel flags. An empty array is allowed; that means
* that all channels are to be filtered. Filters can optimize on
* that. The array must be in the order of the pixel layout.
*/
void setChannelFlags(QBitArray channelFlags);
/**
* These functions exist solely to allow plugins to reimplement them as
* needed, while allowing consumers to implement support for them without
* linking directly to the plugin. In particular, the filter management
* in Sketch requires this.
*/
virtual void setCurve(const KisCubicCurve &curve);
virtual const KisCubicCurve& curve() const;
virtual void setCurves(QList<KisCubicCurve> &curves);
virtual const QList<KisCubicCurve>& curves() const;
#ifdef SANITY_CHECK_FILTER_CONFIGURATION_OWNER
private:
friend class KisNodeFilterInterface;
int sanityRefUsageCounter();
int sanityDerefUsageCounter();
#endif /* SANITY_CHECK_FILTER_CONFIGURATION_OWNER */
protected:
void setVersion(qint32 version);
private:
struct Private;
Private* const d;
};
Q_DECLARE_METATYPE(KisFilterConfiguration*)
#endif // _KIS_FILTER_CONFIGURATION_H_
diff --git a/libs/image/filter/kis_filter_registry.h b/libs/image/filter/kis_filter_registry.h
index 50cf6e2501..ed95db5720 100644
--- a/libs/image/filter/kis_filter_registry.h
+++ b/libs/image/filter/kis_filter_registry.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILTER_REGISTRY_H_
#define KIS_FILTER_REGISTRY_H_
#include <QObject>
#include "kis_filter.h"
#include "kis_types.h"
#include "KoGenericRegistry.h"
#include <kritaimage_export.h>
class QString;
class KisFilterConfiguration;
class KRITAIMAGE_EXPORT KisFilterRegistry : public QObject, public KoGenericRegistry<KisFilterSP>
{
Q_OBJECT
public:
- virtual ~KisFilterRegistry();
+ ~KisFilterRegistry() override;
static KisFilterRegistry* instance();
void add(KisFilterSP item);
void add(const QString &id, KisFilterSP item);
KisFilterConfigurationSP cloneConfiguration(const KisFilterConfigurationSP);
Q_SIGNALS:
void filterAdded(QString id);
private:
KisFilterRegistry(QObject *parent);
KisFilterRegistry(const KisFilterRegistry&);
KisFilterRegistry operator=(const KisFilterRegistry&);
};
#endif // KIS_FILTERSPACE_REGISTRY_H_
diff --git a/libs/image/generator/kis_generator.h b/libs/image/generator/kis_generator.h
index df327919eb..55c393abf5 100644
--- a/libs/image/generator/kis_generator.h
+++ b/libs/image/generator/kis_generator.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_GENERATOR_H_
#define _KIS_GENERATOR_H_
#include <QString>
#include <klocalizedstring.h>
#include "KoID.h"
#include "KoColorSpace.h"
#include "kis_types.h"
#include "kis_base_processor.h"
#include "kritaimage_export.h"
class KisProcessingInformation;
/**
* Basic interface of a Krita generator: a generator is a program
* that can fill a paint device with a color. A generator can have a
* preferred colorspace.
*
* Generators can have initial parameter settings that determine the
* way a particular generator works, but also state that allows the generator
* to continue from one invocation of generate to another (handy for, e.g.,
* painting)
*/
class KRITAIMAGE_EXPORT KisGenerator : public KisBaseProcessor
{
friend class KisGeneratorConfigurationFactory;
public:
KisGenerator(const KoID& id, const KoID & category, const QString & entry);
- virtual ~KisGenerator();
+ ~KisGenerator() override;
public:
/**
* Override this function with the implementation of your generator.
*
* @param dst the destination paint device
* @param size the size of the area that is to be filled
* @param config the parameters of the filter
*/
virtual void generate(KisProcessingInformation dst,
const QSize& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
) const = 0;
/**
* Provided for convenience when no progress reporting is needed.
*/
virtual void generate(KisProcessingInformation dst,
const QSize& size,
const KisFilterConfigurationSP config
) const;
/**
* @param _imageArea the rectangle of the image
* @return the rectangle that is affected by this generator, if the generator
* is supposed to affect all pixels, then the function should return
* @p _imageArea
*/
virtual QRect generatedRect(QRect _imageArea, const KisFilterConfigurationSP = 0) const;
protected:
/// @return the name of config group in KConfig
QString configEntryGroup() const;
};
#endif
diff --git a/libs/image/generator/kis_generator_layer.h b/libs/image/generator/kis_generator_layer.h
index dff2247f87..eab61dabf4 100644
--- a/libs/image/generator/kis_generator_layer.h
+++ b/libs/image/generator/kis_generator_layer.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GENERATOR_LAYER_H_
#define KIS_GENERATOR_LAYER_H_
#include "kis_selection_based_layer.h"
#include <kritaimage_export.h>
#include <QScopedPointer>
class KisFilterConfiguration;
/**
* A generator layer is a special kind of layer that can be prefilled
* with some pixel pattern generated by a KisGenerator plugin.
* A KisGenerator is similar to a filter, but doesn't take
* input pixel data and creates new pixel data.
*
* It is not possible to destructively paint on a generator layer.
*
* XXX: what about threadedness?
*/
class KRITAIMAGE_EXPORT KisGeneratorLayer : public KisSelectionBasedLayer
{
Q_OBJECT
public:
/**
* Create a new Generator layer with the given configuration
* and selection. Note that the selection will be _copied_
* (using COW, though).
*/
KisGeneratorLayer(KisImageWSP image, const QString &name, KisFilterConfigurationSP kfc, KisSelectionSP selection);
KisGeneratorLayer(const KisGeneratorLayer& rhs);
- virtual ~KisGeneratorLayer();
+ ~KisGeneratorLayer() override;
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisGeneratorLayer(*this));
}
- void setFilter(KisFilterConfigurationSP filterConfig);
+ void setFilter(KisFilterConfigurationSP filterConfig) override;
- bool accept(KisNodeVisitor &);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
- QIcon icon() const;
- KisBaseNode::PropertyList sectionModelProperties() const;
+ QIcon icon() const override;
+ KisBaseNode::PropertyList sectionModelProperties() const override;
/**
* re-run the generator. This happens over the bounds
* of the associated selection.
*/
void update();
using KisSelectionBasedLayer::setDirty;
- void setDirty(const QRect & rect);
- void setX(qint32 x);
- void setY(qint32 y);
+ void setDirty(const QRect & rect) override;
+ void setX(qint32 x) override;
+ void setY(qint32 y) override;
private Q_SLOTS:
void slotDelayedStaticUpdate();
public:
// KisIndirectPaintingSupport
KisLayer* layer() {
return this;
}
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/image/generator/kis_generator_registry.h b/libs/image/generator/kis_generator_registry.h
index 800e214a96..6d92841bce 100644
--- a/libs/image/generator/kis_generator_registry.h
+++ b/libs/image/generator/kis_generator_registry.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GENERATOR_REGISTRY_H_
#define KIS_GENERATOR_REGISTRY_H_
#include <QObject>
#include "kis_generator.h"
#include "kis_types.h"
#include "KoGenericRegistry.h"
#include <kritaimage_export.h>
class QString;
class KisFilterConfiguration;
/**
* XXX_DOCS
*/
class KRITAIMAGE_EXPORT KisGeneratorRegistry : public QObject, public KoGenericRegistry<KisGeneratorSP>
{
Q_OBJECT
public:
- virtual ~KisGeneratorRegistry();
+ ~KisGeneratorRegistry() override;
static KisGeneratorRegistry* instance();
void add(KisGeneratorSP item);
void add(const QString &id, KisGeneratorSP item);
KisFilterConfigurationSP cloneConfiguration(const KisFilterConfigurationSP kfc);
Q_SIGNALS:
void generatorAdded(QString id);
private:
KisGeneratorRegistry(QObject *parent);
KisGeneratorRegistry(const KisGeneratorRegistry&);
KisGeneratorRegistry operator=(const KisGeneratorRegistry&);
};
#endif // KIS_GENERATOR_REGISTRY_H_
diff --git a/libs/image/kis_abstract_projection_plane.h b/libs/image/kis_abstract_projection_plane.h
index 63c51c7a1c..bed5b115d1 100644
--- a/libs/image/kis_abstract_projection_plane.h
+++ b/libs/image/kis_abstract_projection_plane.h
@@ -1,105 +1,105 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ABSTRACT_PROJECTION_PLANE_H
#define __KIS_ABSTRACT_PROJECTION_PLANE_H
#include "kis_types.h"
#include "kis_layer.h"
class QRect;
class KisPainter;
/**
* An interface of the node to the compositioning
* system. Compositioning system KisAsyncMerger knows nothing about
* the internals of the layer, it just knows that the layer can:
*
* 1) recalculate() its internal representation if it is filthy
*
* 2) apply() itself onto a global projection using, writing all its data
* to the projection.
*
* 3) report parameters of these operations using needRect(),
* changeRect() and accessRect() methods, which mean the same as
* the corresponding methods of KisNode, but include more
* transformations for the layer, e.g. Layer Styles and
* Pass-through mode.
*/
class KRITAIMAGE_EXPORT KisAbstractProjectionPlane
{
public:
KisAbstractProjectionPlane();
virtual ~KisAbstractProjectionPlane();
/**
* Is called by the async merger when the node is filthy and
* should recalculate its internal representation. For usual
* layers it means just calling updateProjection().
*/
virtual QRect recalculate(const QRect& rect, KisNodeSP filthyNode) = 0;
/**
* Writes the data of the projection plane onto a global
* projection using \p painter object.
*/
virtual void apply(KisPainter *painter, const QRect &rect) = 0;
/**
* Works like KisNode::needRect(), but includes more
* transformations of the layer
*/
virtual QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos = KisLayer::N_FILTHY) const = 0;
/**
* Works like KisNode::changeRect(), but includes more
* transformations of the layer
*/
virtual QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos = KisLayer::N_FILTHY) const = 0;
/**
* Works like KisNode::needRect(), but includes more
* transformations of the layer
*/
virtual QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos = KisLayer::N_FILTHY) const = 0;
/**
* Returns a list of devices which should synchronize the lod cache on update
*/
virtual KisPaintDeviceList getLodCapableDevices() const = 0;
};
/**
* A simple implementation of KisAbstractProjectionPlane interface
* that does nothing.
*/
class KisDumbProjectionPlane : public KisAbstractProjectionPlane
{
public:
- QRect recalculate(const QRect& rect, KisNodeSP filthyNode);
- void apply(KisPainter *painter, const QRect &rect);
+ QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
+ void apply(KisPainter *painter, const QRect &rect) override;
- QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
+ QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
- KisPaintDeviceList getLodCapableDevices() const;
+ KisPaintDeviceList getLodCapableDevices() const override;
};
#endif /* __KIS_ABSTRACT_PROJECTION_PLANE_H */
diff --git a/libs/image/kis_adjustment_layer.h b/libs/image/kis_adjustment_layer.h
index fd003c3ff7..10c2dd64ab 100644
--- a/libs/image/kis_adjustment_layer.h
+++ b/libs/image/kis_adjustment_layer.h
@@ -1,123 +1,123 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
/**
* @file
* This file is part of the Krita calligra application. It handles
* a contains a KisFilter OR a KisLayer, and this class is created
* to influence the rendering of layers below this one. Can also
* function as a fixating layer.
*
* @author Boudewijn Rempt
* @author comments by hscott
* @since 1.5
*/
#ifndef KIS_ADJUSTMENT_LAYER_H_
#define KIS_ADJUSTMENT_LAYER_H_
#include <QObject>
#include <kritaimage_export.h>
#include "kis_selection_based_layer.h"
class KisFilterConfiguration;
/**
* @class KisAdjustmentLayer Contains a KisFilter and a KisSelection.
* If the selection is present, it is a mask used by the adjustment layer
* to know where to apply the filter, thus the combination is used
* to influence the rendering of the layers under this layer
* in the layerstack. AdjustmentLayers also function as a kind
* of "fixating layers".
*/
class KRITAIMAGE_EXPORT KisAdjustmentLayer : public KisSelectionBasedLayer
{
Q_OBJECT
public:
/**
* creates a new adjustment layer with the given
* configuration and selection. Note that the selection
* will be _copied_ (with COW, though).
* @param image the image to set this AdjustmentLayer to
* @param name name of the adjustment layer
* @param kfc the configuration for the adjustment layer filter
* @param selection is a mask used by the adjustment layer to
* know where to apply the filter.
*/
KisAdjustmentLayer(KisImageWSP image, const QString &name, KisFilterConfigurationSP kfc, KisSelectionSP selection);
KisAdjustmentLayer(const KisAdjustmentLayer& rhs);
- virtual ~KisAdjustmentLayer();
+ ~KisAdjustmentLayer() override;
- bool accept(KisNodeVisitor &);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
/**
* clones this AdjustmentLayer into a KisNodeSP type.
* @return the KisNodeSP returned
*/
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisAdjustmentLayer(*this));
}
/**
* gets the adjustmentLayer's tool filter
* @return QIcon returns the QIcon tool filter
*/
- QIcon icon() const;
+ QIcon icon() const override;
/**
* gets the AdjustmentLayer properties describing whether
* or not the node is locked, visible, and the filter
* name is it is a filter. Overrides sectionModelProperties
* in KisLayer, and KisLayer overrides
* sectionModelProperties in KisBaseNode.
* @return KisBaseNode::PropertyList returns a list
* of the properties
*/
- KisBaseNode::PropertyList sectionModelProperties() const;
+ KisBaseNode::PropertyList sectionModelProperties() const override;
public:
/**
* \see KisNodeFilterInterface::setFilter()
*/
- void setFilter(KisFilterConfigurationSP filterConfig);
+ void setFilter(KisFilterConfigurationSP filterConfig) override;
- void setChannelFlags(const QBitArray & channelFlags);
+ void setChannelFlags(const QBitArray & channelFlags) override;
protected:
// override from KisLayer
- QRect incomingChangeRect(const QRect &rect) const;
+ QRect incomingChangeRect(const QRect &rect) const override;
// override from KisNode
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
public Q_SLOTS:
/**
* gets this AdjustmentLayer. Overrides function in
* KisIndirectPaintingSupport
* @return this AdjustmentLayer
*/
KisLayer* layer() {
return this;
}
};
#endif // KIS_ADJUSTMENT_LAYER_H_
diff --git a/libs/image/kis_base_node.h b/libs/image/kis_base_node.h
index a715f5b9fe..5ee2b50ddc 100644
--- a/libs/image/kis_base_node.h
+++ b/libs/image/kis_base_node.h
@@ -1,565 +1,565 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BASE_NODE_H
#define _KIS_BASE_NODE_H
#include <QObject>
#include <QIcon>
#include <QUuid>
#include <QString>
#include <KoID.h>
#include "kis_shared.h"
#include "kis_paint_device.h"
#include "kis_processing_visitor.h" // included, not forward declared for msvc
class KoProperties;
class KoColorSpace;
class KoCompositeOp;
class KisNodeVisitor;
class KisUndoAdapter;
class KisKeyframeChannel;
#include "kritaimage_export.h"
/**
* A KisBaseNode is the base class for all components of an image:
* nodes, layers masks, selections. A node has a number of properties,
* can be represented as a thumbnail and knows what to do when it gets
* a certain paint device to process. A KisBaseNode does not know
* anything about its peers. You should not directly inherit from a
* KisBaseNode; inherit from KisNode instead.
*/
class KRITAIMAGE_EXPORT KisBaseNode : public QObject, public KisShared
{
Q_OBJECT
public:
/**
* Describes a property of a document section.
*
* FIXME: using a QList instead of QMap and not having an untranslated identifier,
* either enum or string, forces applications to rely on the order of properties
* or to compare the translated strings. This makes it hard to robustly extend the
* properties of document section items.
*/
struct Property
{
QString id;
/** i18n-ed name, suitable for displaying */
QString name;
/** Whether the property is a boolean (e.g. locked, visible) which can be toggled directly from the widget itself. */
bool isMutable;
/** Provide these if the property isMutable. */
QIcon onIcon;
QIcon offIcon;
/** If the property isMutable, provide a boolean. Otherwise, a string suitable for displaying. */
QVariant state;
/** If the property is mutable, specifies whether it can be put into stasis. When a property
is in stasis, a new state is created, and the old one is stored in stateInStasis. When
stasis ends, the old value is restored and the new one discarded */
bool canHaveStasis;
/** If the property isMutable and canHaveStasis, indicate whether it is in stasis or not */
bool isInStasis;
/** If the property isMutable and canHaveStasis, provide this value to store the property's
state while in stasis */
bool stateInStasis;
bool operator==(const Property &rhs) const {
return rhs.name == name;
}
Property(): isMutable( false ) { }
/// Constructor for a mutable property.
Property( const KoID &n, const QIcon &on, const QIcon &off, bool isOn )
: id(n.id()), name( n.name() ), isMutable( true ), onIcon( on ), offIcon( off ), state( isOn ), canHaveStasis( false ) { }
/** Constructor for a mutable property accepting stasis */
Property( const KoID &n, const QIcon &on, const QIcon &off, bool isOn,
bool _isInStasis, bool _stateInStasis )
: id(n.id()), name(n.name()), isMutable( true ), onIcon( on ), offIcon( off ), state( isOn ),
canHaveStasis( true ), isInStasis( _isInStasis ), stateInStasis( _stateInStasis ) { }
/// Constructor for a nonmutable property.
Property( const KoID &n, const QString &s )
: id(n.id()), name(n.name()), isMutable( false ), state( s ) { }
};
/** Return this type for PropertiesRole. */
typedef QList<Property> PropertyList;
public:
/**
* Create a new, empty base node. The node is unnamed, unlocked
* visible and unlinked.
*/
KisBaseNode();
/**
* Create a copy of this node.
*/
KisBaseNode(const KisBaseNode & rhs);
/**
* Delete this node
*/
- virtual ~KisBaseNode();
+ ~KisBaseNode() override;
/**
* Return the paintdevice you can use to change pixels on. For a
* paint layer these will be paint pixels, for an adjustment layer or a mask
* the selection paint device.
*
* @return the paint device to paint on. Can be 0 if the actual
* node type does not support painting.
*/
virtual KisPaintDeviceSP paintDevice() const = 0;
/**
* @return the rendered representation of a node
* before the effect masks have had their go at it. Can be 0.
*/
virtual KisPaintDeviceSP original() const = 0;
/**
* @return the fully rendered representation of this layer: its
* rendered original and its effect masks. Can be 0.
*/
virtual KisPaintDeviceSP projection() const = 0;
virtual const KoColorSpace *colorSpace() const = 0;
/**
* Return the opacity of this layer, scaled to a range between 0
* and 255.
* XXX: Allow true float opacity
*/
quint8 opacity() const; //0-255
/**
* Set the opacity for this layer. The range is between 0 and 255.
* The layer will be marked dirty.
*
* XXX: Allow true float opacity
*/
void setOpacity(quint8 val); //0-255
/**
* return the 8-bit opacity of this layer scaled to the range
* 0-100
*
* XXX: Allow true float opacity
*/
quint8 percentOpacity() const; //0-100
/**
* Set the opacity of this layer with a number between 0 and 100;
* the number will be scaled to between 0 and 255.
* XXX: Allow true float opacity
*/
void setPercentOpacity(quint8 val); //0-100
/**
* Return the composite op associated with this layer.
*/
virtual const KoCompositeOp *compositeOp() const = 0;
const QString& compositeOpId() const;
/**
* Set a new composite op for this layer. The layer will be marked
* dirty.
*/
void setCompositeOpId(const QString& compositeOpId);
/**
* @return unique id, which is now used by clone layers.
*/
QUuid uuid() const;
/**
* Set the uuid of node. This should only be used when loading
* existing node and in constructor.
*/
void setUuid(const QUuid& id);
/**
* return the name of this node. This is the same as the
* QObject::objectName.
*/
QString name() const {
return objectName();
}
/**
* set the QObject::objectName. This is also the user-visible name
* of the layer. The reason for this is that we want to see the
* layer name also when debugging.
*/
void setName(const QString& name) {
setObjectName(name);
baseNodeChangedCallback();
}
/**
* @return the icon used to represent the node type, for instance
* in the layerbox and in the menu.
*/
virtual QIcon icon() const {
return QIcon();
}
/**
* Return a the properties of this base node (locked, visible etc,
* with the right icons for their representation and their state.
*
* Subclasses can extend this list with new properties, like
* opacity for layers or visualized for masks.
*
* The order of properties is, unfortunately, for now, important,
* so take care which properties superclasses of your class
* define.
*
* KisBaseNode defines visible = 0, locked = 1
* KisLayer defines opacity = 2, compositeOp = 3
* KisMask defines active = 2 (KisMask does not inherit kislayer)
*/
virtual PropertyList sectionModelProperties() const;
/**
* Change the section model properties.
*/
virtual void setSectionModelProperties(const PropertyList &properties);
/**
* Return all the properties of this layer as a KoProperties-based
* serializable key-value list.
*/
KoProperties & nodeProperties() const;
/**
* Merge the specified properties with the properties of this
* layer. Whereever these properties overlap, the value of the
* node properties is changed. No properties on the node are
* deleted. If there are new properties in this list, they will be
* added on the node.
*/
void mergeNodeProperties(const KoProperties & properties);
/**
* Compare the given properties list with the properties of this
* node.
*
* @return false only if the same property exists in both lists
* but with a different value. Properties that are not in both
* lists are disregarded.
*/
bool check(const KoProperties & properties) const;
/**
* Accept the KisNodeVisitor (for the Visitor design pattern),
* should call the correct function on the KisNodeVisitor for this
* node type, so you need to override it for all leaf classes in
* the node inheritance hierarchy.
*
* return false if the visitor could not successfully act on this
* node instance.
*/
virtual bool accept(KisNodeVisitor &) {
return false;
}
/**
* Accept the KisNodeVisitor (for the Visitor design pattern),
* should call the correct function on the KisProcessingVisitor
* for this node type, so you need to override it for all leaf
* classes in the node inheritance hierarchy.
*
* The processing visitor differs from node visitor in the way
* that it accepts undo adapter, that allows the processing to
* be multithreaded
*/
virtual void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) {
Q_UNUSED(visitor);
Q_UNUSED(undoAdapter);
}
/**
* @return a thumbnail in requested size. The thumbnail is a rgba
* QImage and may have transparent parts. Returns a fully
* transparent QImage of the requested size if the current node
* type cannot generate a thumbnail. If the requested size is too
* big, return a null QImage.
*/
virtual QImage createThumbnail(qint32 w, qint32 h);
/**
* @return a thumbnail in requested size for the defined timestamp.
* The thumbnail is a rgba Image and may have transparent parts.
* Returns a fully transparent QImage of the requested size if the
* current node type cannot generate a thumbnail. If the requested
* size is too big, return a null QImage.
*/
virtual QImage createThumbnailForFrame(qint32 w, qint32 h, int time);
/**
* Ask this node to re-read the pertinent settings from the krita
* configuration.
*/
virtual void updateSettings() {
}
/**
* @return true if this node is visible (i.e, active (except for
* selection masks where visible and active properties are
* different)) in the graph
*/
virtual bool visible(bool recursive = false) const;
/**
* Set the visible status of this node. Visible nodes are active
* in the graph (except for selections masks which can be active
* while hidden), that is to say, they are taken into account
* when merging. Invisible nodes play no role in the final image
*, but will be modified when modifying all layers, for instance
* when cropping.
*
* Toggling the visibility of a node will not automatically lead
* to recomposition.
*
* @param visible the new visibility state
* @param isLoading if true, the property is set during loading.
*/
virtual void setVisible(bool visibile, bool loading = false);
/**
* Return the locked status of this node. Locked nodes cannot be
* edited.
*/
bool userLocked() const;
/**
* Set the locked status of this node. Locked nodes cannot be
* edited.
*/
void setUserLocked(bool l);
/**
* @return true if the node can be edited:
*
* if checkVisibility is true, then the node is only editable if it is visible and not locked.
* if checkVisibility is false, then the node is editable if it's not locked.
*/
bool isEditable(bool checkVisibility = true) const;
/**
* @return true if the node is editable and has a paintDevice()
* which which can be used for accessing pixels. It is an
* equivalent to (isEditable() && paintDevice())
*/
bool hasEditablePaintDevice() const;
/**
* @return the x-offset of this layer in the image plane.
*/
virtual qint32 x() const {
return 0;
}
/**
* Set the x offset of this layer in the image place.
* Re-implement this where it makes sense, by default it does
* nothing. It should not move child nodes.
*/
virtual void setX(qint32) {
}
/**
* @return the y-offset of this layer in the image plane.
*/
virtual qint32 y() const {
return 0;
}
/**
* Set the y offset of this layer in the image place.
* Re-implement this where it makes sense, by default it does
* nothing. It should not move child nodes.
*/
virtual void setY(qint32) {
}
/**
* Returns an approximation of where the bounds on actual data are
* in this node.
*/
virtual QRect extent() const {
return QRect();
}
/**
* Returns the exact bounds of where the actual data resides in
* this node.
*/
virtual QRect exactBounds() const {
return QRect();
}
/**
* Sets the state of the node to the value of @param collapsed
*/
void setCollapsed(bool collapsed);
/**
* returns the collapsed state of this node
*/
bool collapsed() const;
/**
* Sets a color label index associated to the layer. The actual
* color of the label and the number of available colors is
* defined by Krita GUI configuration.
*/
void setColorLabelIndex(int index);
/**
* \see setColorLabelIndex
*/
int colorLabelIndex() const;
/**
* Returns true if the offset of the node can be changed in a LodN
* stroke. Currently, all the nodes except shape layers support that.
*/
bool supportsLodMoves() const;
/**
* Return the keyframe channels associated with this node
* @return list of keyframe channels
*/
QList<KisKeyframeChannel *> keyframeChannels() const;
/**
* Get the keyframe channel with given id.
* If the channel does not yet exist and the node supports the requested
* channel, it will be created if create is true.
* @param id internal name for channel
* @param create attempt to create the channel if it does not exist yet
* @return keyframe channel with the id, or null if not found
*/
KisKeyframeChannel *getKeyframeChannel(const QString &id, bool create);
KisKeyframeChannel *getKeyframeChannel(const QString &id) const;
bool useInTimeline() const;
void setUseInTimeline(bool value);
bool isAnimated() const;
virtual void enableAnimation();
virtual void setImage(KisImageWSP image);
protected:
void setSupportsLodMoves(bool value);
/**
* FIXME: This method is a workaround for getting parent node
* on a level of KisBaseNode. In fact, KisBaseNode should inherit
* KisNode (in terms of current Krita) to be able to traverse
* the node stack
*/
virtual KisBaseNodeSP parentCallback() const {
return KisBaseNodeSP();
}
virtual void notifyParentVisibilityChanged(bool value) {
Q_UNUSED(value);
}
/**
* This callback is called when some meta state of the base node
* that can be interesting to the UI has changed. E.g. visibility,
* lockness, opacity, compositeOp and etc. This signal is
* forwarded by the KisNode and KisNodeGraphListener to the model
* in KisLayerBox, so it can update its controls when information
* changes.
*/
virtual void baseNodeChangedCallback() {
}
virtual void baseNodeInvalidateAllFramesCallback() {
}
/**
* Add a keyframe channel for this node. The channel will be added
* to the common hash table which will be available to the UI.
*
* WARNING: the \p channel object *NOT* become owned by the node!
* The caller must ensure manually that the lifetime of
* the object coincide with the lifetime of the node.
*/
virtual void addKeyframeChannel(KisKeyframeChannel* channel);
/**
* Attempt to create the requested channel. Used internally by getKeyframeChannel.
* Subclasses should implement this method to catch any new channel types they support.
* @param id channel to create
* @return newly created channel or null
*/
virtual KisKeyframeChannel * requestKeyframeChannel(const QString &id);
Q_SIGNALS:
/**
* This signal is emitted when the visibility of the layer is changed with \ref setVisible.
*/
void visibilityChanged(bool);
/**
* This signal is emitted when the node is locked or unlocked with \ref setUserLocked.
*/
void userLockingChanged(bool);
void keyframeChannelAdded(KisKeyframeChannel *channel);
private:
struct Private;
Private * const m_d;
};
Q_DECLARE_METATYPE( KisBaseNode::PropertyList )
#endif
diff --git a/libs/image/kis_brush_mask_applicators.h b/libs/image/kis_brush_mask_applicators.h
index 0e7b760be2..b61c6bdbd6 100644
--- a/libs/image/kis_brush_mask_applicators.h
+++ b/libs/image/kis_brush_mask_applicators.h
@@ -1,214 +1,214 @@
/*
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_BRUSH_MASK_APPLICATORS_H
#define __KIS_BRUSH_MASK_APPLICATORS_H
#include "kis_brush_mask_applicator_base.h"
#include "kis_global.h"
// 3x3 supersampling
#define SUPERSAMPLING 3
#if defined(_WIN32) || defined(_WIN64)
#include <stdlib.h>
#define srand48 srand
inline double drand48() {
return double(rand()) / RAND_MAX;
}
#endif
#include <random>
template<class MaskGenerator, Vc::Implementation _impl>
struct KisBrushMaskScalarApplicator : public KisBrushMaskApplicatorBase
{
KisBrushMaskScalarApplicator(MaskGenerator *maskGenerator)
: m_maskGenerator(maskGenerator)
{
}
- void process(const QRect &rect) {
+ void process(const QRect &rect) override {
processScalar(rect);
}
protected:
void processScalar(const QRect &rect);
protected:
MaskGenerator *m_maskGenerator;
};
#if defined HAVE_VC
template<class MaskGenerator, Vc::Implementation _impl>
struct KisBrushMaskVectorApplicator : public KisBrushMaskScalarApplicator<MaskGenerator, _impl>
{
KisBrushMaskVectorApplicator(MaskGenerator *maskGenerator)
: KisBrushMaskScalarApplicator<MaskGenerator, _impl>(maskGenerator)
{
}
void process(const QRect &rect) {
startProcessing(rect, TypeHelper<MaskGenerator, _impl>());
}
protected:
void processVector(const QRect &rect);
private:
template<class U, Vc::Implementation V> struct TypeHelper {};
private:
template<class U>
inline void startProcessing(const QRect &rect, TypeHelper<U, Vc::ScalarImpl>) {
KisBrushMaskScalarApplicator<MaskGenerator, _impl>::processScalar(rect);
}
template<class U, Vc::Implementation V>
inline void startProcessing(const QRect &rect, TypeHelper<U, V>) {
MaskGenerator *m_maskGenerator = KisBrushMaskScalarApplicator<MaskGenerator, _impl>::m_maskGenerator;
if (m_maskGenerator->shouldVectorize()) {
processVector(rect);
} else {
KisBrushMaskScalarApplicator<MaskGenerator, _impl>::processScalar(rect);
}
}
};
template<class MaskGenerator, Vc::Implementation _impl>
void KisBrushMaskVectorApplicator<MaskGenerator, _impl>::processVector(const QRect &rect)
{
const MaskProcessingData *m_d = KisBrushMaskApplicatorBase::m_d;
MaskGenerator *m_maskGenerator = KisBrushMaskScalarApplicator<MaskGenerator, _impl>::m_maskGenerator;
qreal random = 1.0;
quint8* dabPointer = m_d->device->data() + rect.y() * rect.width() * m_d->pixelSize;
quint8 alphaValue = OPACITY_TRANSPARENT_U8;
// this offset is needed when brush size is smaller then fixed device size
int offset = (m_d->device->bounds().width() - rect.width()) * m_d->pixelSize;
int width = rect.width();
// We need to calculate with a multiple of the width of the simd register
int alignOffset = 0;
if (width % Vc::float_v::size() != 0) {
alignOffset = Vc::float_v::size() - (width % Vc::float_v::size());
}
int simdWidth = width + alignOffset;
float *buffer = Vc::malloc<float, Vc::AlignOnCacheline>(simdWidth);
typename MaskGenerator::FastRowProcessor processor(m_maskGenerator);
for (int y = rect.y(); y < rect.y() + rect.height(); y++) {
processor.template process<_impl>(buffer, simdWidth, y, m_d->cosa, m_d->sina, m_d->centerX, m_d->centerY);
if (m_d->randomness != 0.0 || m_d->density != 1.0) {
for (int x = 0; x < width; x++) {
if (m_d->randomness!= 0.0){
random = (1.0 - m_d->randomness) + m_d->randomness * float(rand()) / RAND_MAX;
}
alphaValue = quint8( (OPACITY_OPAQUE_U8 - buffer[x]*255) * random);
// avoid computation of random numbers if density is full
if (m_d->density != 1.0){
// compute density only for visible pixels of the mask
if (alphaValue != OPACITY_TRANSPARENT_U8){
if ( !(m_d->density >= drand48()) ){
alphaValue = OPACITY_TRANSPARENT_U8;
}
}
}
m_d->colorSpace->applyAlphaU8Mask(dabPointer, &alphaValue, 1);
dabPointer += m_d->pixelSize;
}
} else {
m_d->colorSpace->applyInverseNormedFloatMask(dabPointer, buffer, width);
dabPointer += width * m_d->pixelSize;
}//endfor x
dabPointer += offset;
}//endfor y
Vc::free(buffer);
}
#endif /* defined HAVE_VC */
template<class MaskGenerator, Vc::Implementation _impl>
void KisBrushMaskScalarApplicator<MaskGenerator, _impl>::processScalar(const QRect &rect)
{
const MaskProcessingData *m_d = KisBrushMaskApplicatorBase::m_d;
MaskGenerator *m_maskGenerator = KisBrushMaskScalarApplicator<MaskGenerator, _impl>::m_maskGenerator;
std::random_device rand_dev;
std::default_random_engine rand_engine{rand_dev()};
std::uniform_real_distribution<> rand_distr(0.0f, 1.0f);
qreal random = 1.0;
quint8* dabPointer = m_d->device->data() + rect.y() * rect.width() * m_d->pixelSize;
quint8 alphaValue = OPACITY_TRANSPARENT_U8;
// this offset is needed when brush size is smaller then fixed device size
int offset = (m_d->device->bounds().width() - rect.width()) * m_d->pixelSize;
int supersample = (m_maskGenerator->shouldSupersample() ? SUPERSAMPLING : 1);
double invss = 1.0 / supersample;
int samplearea = pow2(supersample);
for (int y = rect.y(); y < rect.y() + rect.height(); y++) {
for (int x = rect.x(); x < rect.x() + rect.width(); x++) {
int value = 0;
for (int sy = 0; sy < supersample; sy++) {
for (int sx = 0; sx < supersample; sx++) {
double x_ = x + sx * invss - m_d->centerX;
double y_ = y + sy * invss - m_d->centerY;
double maskX = m_d->cosa * x_ - m_d->sina * y_;
double maskY = m_d->sina * x_ + m_d->cosa * y_;
value += m_maskGenerator->valueAt(maskX, maskY);
}
}
if (supersample != 1) value /= samplearea;
if (m_d->randomness!= 0.0){
random = (1.0 - m_d->randomness) + m_d->randomness * rand_distr(rand_engine);
}
alphaValue = quint8( (OPACITY_OPAQUE_U8 - value) * random);
// avoid computation of random numbers if density is full
if (m_d->density != 1.0){
// compute density only for visible pixels of the mask
if (alphaValue != OPACITY_TRANSPARENT_U8){
if ( !(m_d->density >= rand_distr(rand_engine)) ){
alphaValue = OPACITY_TRANSPARENT_U8;
}
}
}
m_d->colorSpace->applyAlphaU8Mask(dabPointer, &alphaValue, 1);
dabPointer += m_d->pixelSize;
}//endfor x
dabPointer += offset;
}//endfor y
}
#endif /* __KIS_BRUSH_MASK_APPLICATORS_H */
diff --git a/libs/image/kis_busy_progress_indicator.h b/libs/image/kis_busy_progress_indicator.h
index 8358d37db8..dd5a407094 100644
--- a/libs/image/kis_busy_progress_indicator.h
+++ b/libs/image/kis_busy_progress_indicator.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_BUSY_PROGRESS_INDICATOR_H
#define __KIS_BUSY_PROGRESS_INDICATOR_H
#include <QObject>
#include <QScopedPointer>
class KoProgressProxy;
class KisBusyProgressIndicator : public QObject
{
Q_OBJECT
public:
explicit KisBusyProgressIndicator(KoProgressProxy *progressProxy);
- ~KisBusyProgressIndicator();
+ ~KisBusyProgressIndicator() override;
public:
/**
* To be called when progressProxy is and will be no longer available
* and this object is going to be deleted as well.
*/
void prepareDestroying();
public Q_SLOTS:
/**
* Trigger update of progress state.
*/
void update();
private Q_SLOTS:
/**
* Call only via emitting sigStartTimer, to ensure it is called in
* the context of the QObject's thread.
*/
void slotStartTimer();
void timerFinished();
Q_SIGNALS:
void sigStartTimer();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_BUSY_PROGRESS_INDICATOR_H */
diff --git a/libs/image/kis_cached_gradient_shape_strategy.h b/libs/image/kis_cached_gradient_shape_strategy.h
index 7045917d13..10071dedd3 100644
--- a/libs/image/kis_cached_gradient_shape_strategy.h
+++ b/libs/image/kis_cached_gradient_shape_strategy.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CACHED_GRADIENT_SHAPE_STRATEGY_H
#define __KIS_CACHED_GRADIENT_SHAPE_STRATEGY_H
#include "kis_gradient_shape_strategy.h"
#include "kritaimage_export.h"
#include <QScopedPointer>
class QRect;
class KRITAIMAGE_EXPORT KisCachedGradientShapeStrategy : public KisGradientShapeStrategy
{
public:
KisCachedGradientShapeStrategy(const QRect &rc, qreal xStep, qreal yStep, KisGradientShapeStrategy *baseStrategy);
- ~KisCachedGradientShapeStrategy();
+ ~KisCachedGradientShapeStrategy() override;
- double valueAt(double x, double y) const;
+ double valueAt(double x, double y) const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_CACHED_GRADIENT_SHAPE_STRATEGY_H */
diff --git a/libs/image/kis_change_profile_visitor.h b/libs/image/kis_change_profile_visitor.h
index 0042952300..0f0928f3e7 100644
--- a/libs/image/kis_change_profile_visitor.h
+++ b/libs/image/kis_change_profile_visitor.h
@@ -1,140 +1,140 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CHANGE_PROFILE_VISITOR_H_
#define KIS_CHANGE_PROFILE_VISITOR_H_
#include "KoColorSpace.h"
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kis_paint_layer.h"
#include "lazybrush/kis_colorize_mask.h"
#include "kis_adjustment_layer.h"
#include "generator/kis_generator_layer.h"
#include "kis_group_layer.h"
class KisExternalLayer;
// #include "kis_external_layer_iface.h"
#include <kritaimage_export.h>
/**
* The Change Profile visitor walks over all layers and if the current
* layer has the specified colorspace AND the specified old profile, sets
* the colorspace to the same colorspace with the NEW profile, without doing
* conversions. This is essential if you have loaded an image that didn't
* have an embedded profile to which you want to attach the right profile.
*/
class KRITAIMAGE_EXPORT KisChangeProfileVisitor : public KisNodeVisitor
{
public:
using KisNodeVisitor::visit;
KisChangeProfileVisitor(const KoColorSpace * oldColorSpace,
const KoColorSpace *dstColorSpace)
: KisNodeVisitor()
, m_oldColorSpace(oldColorSpace)
, m_dstColorSpace(dstColorSpace) {
}
- ~KisChangeProfileVisitor() {
+ ~KisChangeProfileVisitor() override {
}
- bool visit(KisExternalLayer *) {
+ bool visit(KisExternalLayer *) override {
return true;
}
- bool visit(KisGroupLayer * layer) {
+ bool visit(KisGroupLayer * layer) override {
// Clear the projection, we will have to re-render everything.
layer->resetCache();
KisLayerSP child = dynamic_cast<KisLayer*>(layer->firstChild().data());
while (child) {
child->accept(*this);
child = dynamic_cast<KisLayer*>(child->nextSibling().data());
}
return true;
}
- bool visit(KisPaintLayer *layer) {
+ bool visit(KisPaintLayer *layer) override {
return updatePaintDevice(layer);
}
- bool visit(KisGeneratorLayer *layer) {
+ bool visit(KisGeneratorLayer *layer) override {
return updatePaintDevice(layer);
}
- bool visit(KisAdjustmentLayer * layer) {
+ bool visit(KisAdjustmentLayer * layer) override {
layer->resetCache();
return true;
}
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisCloneLayer*) {
+ bool visit(KisCloneLayer*) override {
return true;
}
- bool visit(KisFilterMask*) {
+ bool visit(KisFilterMask*) override {
return true;
}
- bool visit(KisTransformMask*) {
+ bool visit(KisTransformMask*) override {
return true;
}
- bool visit(KisTransparencyMask*) {
+ bool visit(KisTransparencyMask*) override {
return true;
}
- bool visit(KisSelectionMask*) {
+ bool visit(KisSelectionMask*) override {
return true;
}
- bool visit(KisColorizeMask *mask) {
+ bool visit(KisColorizeMask *mask) override {
if (mask->colorSpace()->colorModelId() == m_oldColorSpace->colorModelId()) {
mask->setProfile(m_dstColorSpace->profile());
}
return true;
}
private:
bool updatePaintDevice(KisLayer *layer) {
if (!layer) return false;
if (!layer->paintDevice()) return false;
if (!layer->paintDevice()->colorSpace()) return false;
const KoColorSpace *cs = layer->paintDevice()->colorSpace();
if (cs->colorModelId() == m_oldColorSpace->colorModelId()) {
layer->paintDevice()->setProfile(m_dstColorSpace->profile());
if (layer->projection() != layer->paintDevice()) {
layer->projection()->setProfile(m_dstColorSpace->profile());
}
}
return true;
}
const KoColorSpace *m_oldColorSpace;
const KoColorSpace *m_dstColorSpace;
};
#endif // KIS_CHANGE_PROFILE_VISITOR_H_
diff --git a/libs/image/kis_circle_mask_generator.h b/libs/image/kis_circle_mask_generator.h
index 9fbbe1fba4..c6aaa04143 100644
--- a/libs/image/kis_circle_mask_generator.h
+++ b/libs/image/kis_circle_mask_generator.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2008-2009 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CIRCLE_MASK_GENERATOR_H_
#define _KIS_CIRCLE_MASK_GENERATOR_H_
#include "kritaimage_export.h"
#include "kis_mask_generator.h"
#include <QScopedPointer>
/**
* Create, serialize and deserialize an elliptical 8-bit mask.
*/
class KRITAIMAGE_EXPORT KisCircleMaskGenerator : public KisMaskGenerator
{
public:
struct FastRowProcessor;
public:
KisCircleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges);
KisCircleMaskGenerator(const KisCircleMaskGenerator &rhs);
- virtual ~KisCircleMaskGenerator();
- KisMaskGenerator* clone() const;
+ ~KisCircleMaskGenerator() override;
+ KisMaskGenerator* clone() const override;
- virtual quint8 valueAt(qreal x, qreal y) const;
+ quint8 valueAt(qreal x, qreal y) const override;
- virtual bool shouldSupersample() const;
+ bool shouldSupersample() const override;
- virtual bool shouldVectorize() const;
+ bool shouldVectorize() const override;
- KisBrushMaskApplicatorBase* applicator();
+ KisBrushMaskApplicatorBase* applicator() override;
- virtual void setSoftness(qreal softness);
- virtual void setScale(qreal scaleX, qreal scaleY);
+ void setSoftness(qreal softness) override;
+ void setScale(qreal scaleX, qreal scaleY) override;
private:
qreal norme(qreal a, qreal b) const {
return a*a + b * b;
}
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/libs/image/kis_clone_layer.h b/libs/image/kis_clone_layer.h
index 27ba05124a..de7ac79316 100644
--- a/libs/image/kis_clone_layer.h
+++ b/libs/image/kis_clone_layer.h
@@ -1,135 +1,135 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CLONE_LAYER_H_
#define KIS_CLONE_LAYER_H_
#include <QObject>
#include "kis_types.h"
#include "kis_layer.h"
#include <kritaimage_export.h>
#include "kis_clone_info.h"
class KisNodeVisitor;
enum CopyLayerType {
COPY_PROJECTION,
COPY_ORIGINAL
};
/**
* A copy layer adds the contents of another layer in another place in
* the layer stack. It is possible to add more effect masks to the
* copy. You can either copy the original data or the projection data
* produced by the original layer + original effect masks. There is no
* physical copy of the data; if the original changes, the copy
* changes too. The copy layer can be positioned differently from the
* original layer.
**/
class KRITAIMAGE_EXPORT KisCloneLayer : public KisLayer
{
Q_OBJECT
public:
KisCloneLayer(KisLayerSP from, KisImageWSP image, const QString &name, quint8 opacity);
KisCloneLayer(const KisCloneLayer& rhs);
- virtual ~KisCloneLayer();
+ ~KisCloneLayer() override;
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisCloneLayer(*this));
}
/**
* When the source layer of the clone is removed from the stack
* we should substitute the clone with a usual paint layer,
* because the source might become unreachable quite soon. This
* method builds a paint layer representation of this clone.
*/
KisLayerSP reincarnateAsPaintLayer() const;
- bool allowAsChild(KisNodeSP) const;
+ bool allowAsChild(KisNodeSP) const override;
- KisPaintDeviceSP original() const;
- KisPaintDeviceSP paintDevice() const;
- bool needProjection() const;
+ KisPaintDeviceSP original() const override;
+ KisPaintDeviceSP paintDevice() const override;
+ bool needProjection() const override;
- QIcon icon() const;
- KisBaseNode::PropertyList sectionModelProperties() const;
+ QIcon icon() const override;
+ KisBaseNode::PropertyList sectionModelProperties() const override;
- qint32 x() const;
- qint32 y() const;
+ qint32 x() const override;
+ qint32 y() const override;
- void setX(qint32);
- void setY(qint32);
+ void setX(qint32) override;
+ void setY(qint32) override;
/// Returns an approximation of where the bounds on actual data are in this layer
- QRect extent() const;
+ QRect extent() const override;
/// Returns the exact bounds of where the actual data resides in this layer
- QRect exactBounds() const;
+ QRect exactBounds() const override;
- bool accept(KisNodeVisitor &);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
/**
* Used when loading: loading is done in two passes, and the copy
* from layer is set when all layers have been created, not during
* loading.
*/
void setCopyFromInfo(KisCloneInfo info);
KisCloneInfo copyFromInfo() const;
void setCopyFrom(KisLayerSP layer);
KisLayerSP copyFrom() const;
void setCopyType(CopyLayerType type);
CopyLayerType copyType() const;
/**
* This function is called by the original to notify
* us that it is dirty
*/
void setDirtyOriginal(const QRect &rect);
QRect needRectOnSourceForMasks(const QRect &rc) const;
- void syncLodCache();
+ void syncLodCache() override;
protected:
// override from KisNode
- QRect accessRect(const QRect &rect, PositionToFilthy pos) const;
+ QRect accessRect(const QRect &rect, PositionToFilthy pos) const override;
// override from KisLayer
void copyOriginalToProjection(const KisPaintDeviceSP original,
KisPaintDeviceSP projection,
- const QRect& rect) const;
+ const QRect& rect) const override;
- void notifyParentVisibilityChanged(bool value);
- QRect outgoingChangeRect(const QRect &rect) const;
+ void notifyParentVisibilityChanged(bool value) override;
+ QRect outgoingChangeRect(const QRect &rect) const override;
private:
struct Private;
Private * const m_d;
};
#endif // KIS_CLONE_LAYER_H_
diff --git a/libs/image/kis_colorspace_convert_visitor.h b/libs/image/kis_colorspace_convert_visitor.h
index a2ad8a7459..348e5331ba 100644
--- a/libs/image/kis_colorspace_convert_visitor.h
+++ b/libs/image/kis_colorspace_convert_visitor.h
@@ -1,94 +1,94 @@
/*
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORSPACE_CONVERT_VISITOR_H_
#define KIS_COLORSPACE_CONVERT_VISITOR_H_
#include <KoColorConversionTransformation.h>
#include <KoColorSpace.h>
#include <kritaimage_export.h>
#include "kis_types.h"
#include "kis_node_visitor.h"
/**
* This will convert all layers to the destination color space.
*/
class KRITAIMAGE_EXPORT KisColorSpaceConvertVisitor : public KisNodeVisitor
{
public:
KisColorSpaceConvertVisitor(KisImageWSP image,
const KoColorSpace *srcColorSpace,
const KoColorSpace *dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags);
- virtual ~KisColorSpaceConvertVisitor();
+ ~KisColorSpaceConvertVisitor() override;
public:
- bool visit(KisPaintLayer *layer);
- bool visit(KisGroupLayer *layer);
- bool visit(KisAdjustmentLayer* layer);
- bool visit(KisGeneratorLayer * layer);
+ bool visit(KisPaintLayer *layer) override;
+ bool visit(KisGroupLayer *layer) override;
+ bool visit(KisAdjustmentLayer* layer) override;
+ bool visit(KisGeneratorLayer * layer) override;
- bool visit(KisExternalLayer *) {
+ bool visit(KisExternalLayer *) override {
return true;
}
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisCloneLayer*) {
+ bool visit(KisCloneLayer*) override {
return true;
}
- bool visit(KisFilterMask*) {
+ bool visit(KisFilterMask*) override {
return true;
}
- bool visit(KisTransformMask*) {
+ bool visit(KisTransformMask*) override {
return true;
}
- bool visit(KisTransparencyMask*) {
+ bool visit(KisTransparencyMask*) override {
return true;
}
- bool visit(KisSelectionMask*) {
+ bool visit(KisSelectionMask*) override {
return true;
}
- bool visit(KisColorizeMask *mask);
+ bool visit(KisColorizeMask *mask) override;
private:
bool convertPaintDevice(KisLayer* layer);
KisImageWSP m_image;
const KoColorSpace *m_srcColorSpace;
const KoColorSpace *m_dstColorSpace;
KoColorConversionTransformation::Intent m_renderingIntent;
KoColorConversionTransformation::ConversionFlags m_conversionFlags;
QBitArray m_emptyChannelFlags;
};
#endif // KIS_COLORSPACE_CONVERT_VISITOR_H_
diff --git a/libs/image/kis_composite_progress_proxy.h b/libs/image/kis_composite_progress_proxy.h
index 5e9f27f27a..82ad6339c6 100644
--- a/libs/image/kis_composite_progress_proxy.h
+++ b/libs/image/kis_composite_progress_proxy.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COMPOSITE_PROGRESS_PROXY_H
#define __KIS_COMPOSITE_PROGRESS_PROXY_H
#include <QList>
#include <KoProgressProxy.h>
#include "kritaimage_export.h"
class KRITAIMAGE_EXPORT KisCompositeProgressProxy : public KoProgressProxy
{
public:
void addProxy(KoProgressProxy *proxy);
void removeProxy(KoProgressProxy *proxy);
- int maximum() const;
- void setValue(int value);
- void setRange(int minimum, int maximum);
- void setFormat(const QString &format);
+ int maximum() const override;
+ void setValue(int value) override;
+ void setRange(int minimum, int maximum) override;
+ void setFormat(const QString &format) override;
private:
QList<KoProgressProxy*> m_proxies;
QList<KoProgressProxy*> m_uniqueProxies;
};
#endif /* __KIS_COMPOSITE_PROGRESS_PROXY_H */
diff --git a/libs/image/kis_config_widget.h b/libs/image/kis_config_widget.h
index 872920b9b1..8f4c2186e8 100644
--- a/libs/image/kis_config_widget.h
+++ b/libs/image/kis_config_widget.h
@@ -1,92 +1,92 @@
/*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2004-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CONFIG_WIDGET_H_
#define _KIS_CONFIG_WIDGET_H_
#include <QWidget>
#include <kritaimage_export.h>
#include "kis_signal_compressor.h"
#include <kis_properties_configuration.h>
class KisViewManager;
/**
* Empty base class. Configurable resources like filters, paintops etc.
* can build their own configuration widgets that inherit this class.
* The configuration widget should emit sigConfigurationItemChanged
* when it wants a preview updated; there is a timer that
* waits a little time to see if there are more changes coming
* and then emits sigConfigurationUpdated.
*/
class KRITAIMAGE_EXPORT KisConfigWidget : public QWidget
{
Q_OBJECT
protected:
KisConfigWidget(QWidget * parent = 0, Qt::WFlags f = 0, int delay = 200);
public:
- virtual ~KisConfigWidget();
+ ~KisConfigWidget() override;
/**
* @param config the configuration for this configuration widget.
*/
virtual void setConfiguration(const KisPropertiesConfigurationSP config) = 0;
/**
* @return the configuration
*/
virtual KisPropertiesConfigurationSP configuration() const = 0;
/**
* Sets the view object that can be used by the configuration
* widget for richer functionality
*/
virtual void setView(KisViewManager *view);
Q_SIGNALS:
/**
* emitted whenever it makes sense to update the preview
*/
void sigConfigurationUpdated();
/**
* Subclasses should emit this signal whenever the preview should be
* be recalculated. This kicks of a timer, so it's perfectly fine
* to connect this to the changed signals of the widgets in your configuration
* widget.
*/
void sigConfigurationItemChanged();
void sigSaveLockedConfig(KisPropertiesConfigurationSP p);
void sigDropLockedConfig(KisPropertiesConfigurationSP p);
private Q_SLOTS:
void slotConfigChanged();
private:
KisSignalCompressor m_compressor;
};
#endif
diff --git a/libs/image/kis_convolution_worker_spatial.h b/libs/image/kis_convolution_worker_spatial.h
index 23b33c805f..35946dc86e 100644
--- a/libs/image/kis_convolution_worker_spatial.h
+++ b/libs/image/kis_convolution_worker_spatial.h
@@ -1,386 +1,386 @@
/*
* Copyright (c) 2005, 2008, 2010 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2009, 2010 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CONVOLUTION_WORKER_SPATIAL_H
#define KIS_CONVOLUTION_WORKER_SPATIAL_H
#include "kis_convolution_worker.h"
#include "kis_math_toolbox.h"
template <class _IteratorFactory_>
class KisConvolutionWorkerSpatial : public KisConvolutionWorker<_IteratorFactory_>
{
public:
KisConvolutionWorkerSpatial(KisPainter *painter, KoUpdater *progress)
: KisConvolutionWorker<_IteratorFactory_>(painter, progress)
, m_alphaCachePos(-1)
, m_alphaRealPos(-1)
, m_pixelPtrCache(0)
, m_pixelPtrCacheCopy(0)
, m_minClamp(0)
, m_maxClamp(0)
, m_absoluteOffset(0)
{
}
- ~KisConvolutionWorkerSpatial() {
+ ~KisConvolutionWorkerSpatial() override {
}
inline void loadPixelToCache(qreal **cache, const quint8 *data, int index) {
// no alpha is rare case, so just multiply by 1.0 in that case
qreal alphaValue = m_alphaRealPos >= 0 ?
m_toDoubleFuncPtr[m_alphaCachePos](data, m_alphaRealPos) : 1.0;
for (quint32 k = 0; k < m_convolveChannelsNo; ++k) {
if (k != (quint32)m_alphaCachePos) {
const quint32 channelPos = m_convChannelList[k]->pos();
cache[index][k] = m_toDoubleFuncPtr[k](data, channelPos) * alphaValue;
} else {
cache[index][k] = alphaValue;
}
}
}
- virtual void execute(const KisConvolutionKernelSP kernel, const KisPaintDeviceSP src, QPoint srcPos, QPoint dstPos, QSize areaSize, const QRect& dataRect) {
+ void execute(const KisConvolutionKernelSP kernel, const KisPaintDeviceSP src, QPoint srcPos, QPoint dstPos, QSize areaSize, const QRect& dataRect) override {
// store some kernel characteristics
m_kw = kernel->width();
m_kh = kernel->height();
m_khalfWidth = (m_kw - 1) / 2;
m_khalfHeight = (m_kh - 1) / 2;
m_cacheSize = m_kw * m_kh;
m_pixelSize = src->colorSpace()->pixelSize();
quint32 channelCount = src->colorSpace()->channelCount();
m_kernelData = new qreal[m_cacheSize];
qreal *kernelDataPtr = m_kernelData;
// fill in data
for (quint32 r = 0; r < kernel->height(); r++) {
for (quint32 c = 0; c < kernel->width(); c++) {
*kernelDataPtr = (*(kernel->data()))(r, c);
kernelDataPtr++;
}
}
// Make the area we cover as small as possible
if (this->m_painter->selection()) {
QRect r = this->m_painter->selection()->selectedRect().intersect(QRect(srcPos, areaSize));
dstPos += r.topLeft() - srcPos;
srcPos = r.topLeft();
areaSize = r.size();
}
if (areaSize.width() == 0 || areaSize.height() == 0)
return;
// Don't convolve with an even sized kernel
Q_ASSERT((m_kw & 0x01) == 1 || (m_kh & 0x01) == 1 || kernel->factor() != 0);
// find out which channels need be convolved
m_convChannelList = this->convolvableChannelList(src);
m_convolveChannelsNo = m_convChannelList.count();
for (int i = 0; i < m_convChannelList.size(); i++) {
if (m_convChannelList[i]->channelType() == KoChannelInfo::ALPHA) {
m_alphaCachePos = i;
m_alphaRealPos = m_convChannelList[i]->pos();
}
}
bool hasProgressUpdater = this->m_progress;
if (hasProgressUpdater)
this->m_progress->setProgress(0);
// Iterate over all pixels in our rect, create a cache of pixels around the current pixel and convolve them.
m_pixelPtrCache = new qreal*[m_cacheSize];
m_pixelPtrCacheCopy = new qreal*[m_cacheSize];
for (quint32 c = 0; c < m_cacheSize; ++c) {
m_pixelPtrCache[c] = new qreal[channelCount];
m_pixelPtrCacheCopy[c] = new qreal[channelCount];
}
// decide caching strategy
enum TraversingDirection { Horizontal, Vertical };
TraversingDirection traversingDirection = Vertical;
if (m_kw > m_kh) {
traversingDirection = Horizontal;
}
KisMathToolbox mathToolbox;
m_toDoubleFuncPtr = QVector<PtrToDouble>(m_convolveChannelsNo);
if (!mathToolbox.getToDoubleChannelPtr(m_convChannelList, m_toDoubleFuncPtr))
return;
m_fromDoubleFuncPtr = QVector<PtrFromDouble>(m_convolveChannelsNo);
if (!mathToolbox.getFromDoubleChannelPtr(m_convChannelList, m_fromDoubleFuncPtr))
return;
m_kernelFactor = kernel->factor() ? 1.0 / kernel->factor() : 1;
m_maxClamp = new qreal[m_convChannelList.count()];
m_minClamp = new qreal[m_convChannelList.count()];
m_absoluteOffset = new qreal[m_convChannelList.count()];
for (quint16 i = 0; i < m_convChannelList.count(); ++i) {
m_minClamp[i] = mathToolbox.minChannelValue(m_convChannelList[i]);
m_maxClamp[i] = mathToolbox.maxChannelValue(m_convChannelList[i]);
m_absoluteOffset[i] = (m_maxClamp[i] - m_minClamp[i]) * kernel->offset();
}
qint32 row = srcPos.y();
qint32 col = srcPos.x();
// populate pixelPtrCacheCopy for starting position (0, 0)
qint32 i = 0;
typename _IteratorFactory_::HLineConstIterator hitInitSrc = _IteratorFactory_::createHLineConstIterator(src, col - m_khalfWidth, row - m_khalfHeight, m_kw, dataRect);
for (quint32 krow = 0; krow < m_kh; ++krow) {
do {
const quint8* data = hitInitSrc->oldRawData();
loadPixelToCache(m_pixelPtrCacheCopy, data, i);
++i;
} while (hitInitSrc->nextPixel());
hitInitSrc->nextRow();
}
if (traversingDirection == Horizontal) {
if(hasProgressUpdater) {
this->m_progress->setRange(0, areaSize.height());
}
typename _IteratorFactory_::HLineIterator hitDst = _IteratorFactory_::createHLineIterator(this->m_painter->device(), dstPos.x(), dstPos.y(), areaSize.width(), dataRect);
typename _IteratorFactory_::HLineConstIterator hitSrc = _IteratorFactory_::createHLineConstIterator(src, srcPos.x(), srcPos.y(), areaSize.width(), dataRect);
typename _IteratorFactory_::HLineConstIterator khitSrc = _IteratorFactory_::createHLineConstIterator(src, col - m_khalfWidth, row + m_khalfHeight, m_kw, dataRect);
for (int prow = 0; prow < areaSize.height(); ++prow) {
// reload cache from copy
for (quint32 i = 0; i < m_cacheSize; ++i)
memcpy(m_pixelPtrCache[i], m_pixelPtrCacheCopy[i], channelCount * sizeof(qreal));
typename _IteratorFactory_::VLineConstIterator kitSrc = _IteratorFactory_::createVLineConstIterator(src, col + m_khalfWidth, row - m_khalfHeight, m_kh, dataRect);
for (int pcol = 0; pcol < areaSize.width(); ++pcol) {
// write original channel values
memcpy(hitDst->rawData(), hitSrc->oldRawData(), m_pixelSize);
convolveCache(hitDst->rawData());
++col;
kitSrc->nextColumn();
hitDst->nextPixel();
hitSrc->nextPixel();
moveKernelRight(kitSrc, m_pixelPtrCache);
}
row++;
khitSrc->nextRow();
hitDst->nextRow();
hitSrc->nextRow();
col = srcPos.x();
moveKernelDown(khitSrc, m_pixelPtrCacheCopy);
if (hasProgressUpdater) {
this->m_progress->setValue(prow);
if (this->m_progress->interrupted()) {
cleanUp();
return;
}
}
}
} else if (traversingDirection == Vertical) {
if(hasProgressUpdater) {
this->m_progress->setRange(0, areaSize.width());
}
typename _IteratorFactory_::VLineIterator vitDst = _IteratorFactory_::createVLineIterator(this->m_painter->device(), dstPos.x(), dstPos.y(), areaSize.height(), dataRect);
typename _IteratorFactory_::VLineConstIterator vitSrc = _IteratorFactory_::createVLineConstIterator(src, srcPos.x(), srcPos.y(), areaSize.height(), dataRect);
typename _IteratorFactory_::VLineConstIterator kitSrc = _IteratorFactory_::createVLineConstIterator(src, col + m_khalfWidth, row - m_khalfHeight, m_kh, dataRect);
for (int pcol = 0; pcol < areaSize.width(); pcol++) {
// reload cache from copy
for (quint32 i = 0; i < m_cacheSize; ++i)
memcpy(m_pixelPtrCache[i], m_pixelPtrCacheCopy[i], channelCount * sizeof(qreal));
typename _IteratorFactory_::HLineConstIterator khitSrc = _IteratorFactory_::createHLineConstIterator(src, col - m_khalfWidth, row + m_khalfHeight, m_kw, dataRect);
for (int prow = 0; prow < areaSize.height(); prow++) {
// write original channel values
memcpy(vitDst->rawData(), vitSrc->oldRawData(), m_pixelSize);
convolveCache(vitDst->rawData());
++row;
khitSrc->nextRow();
vitDst->nextPixel();
vitSrc->nextPixel();
moveKernelDown(khitSrc, m_pixelPtrCache);
}
++col;
kitSrc->nextColumn();
vitDst->nextColumn();
vitSrc->nextColumn();
row = srcPos.y();
moveKernelRight(kitSrc, m_pixelPtrCacheCopy);
if (hasProgressUpdater) {
this->m_progress->setValue(pcol);
if (this->m_progress->interrupted()) {
cleanUp();
return;
}
}
}
}
cleanUp();
}
inline void limitValue(qreal *value, qreal lowBound, qreal highBound) {
if (*value > highBound) {
*value = highBound;
} else if (!(*value >= lowBound)) { // value < lowBound or value == NaN
// IEEE compliant comparisons with NaN are always false
*value = lowBound;
}
}
template <bool additionalMultiplierActive>
inline qreal convolveOneChannelFromCache(quint8* dstPtr, quint32 channel, qreal additionalMultiplier = 0.0) {
qreal interimConvoResult = 0;
for (quint32 pIndex = 0; pIndex < m_cacheSize; ++pIndex) {
qreal cacheValue = m_pixelPtrCache[pIndex][channel];
interimConvoResult += m_kernelData[m_cacheSize - pIndex - 1] * cacheValue;
}
qreal channelPixelValue;
if (additionalMultiplierActive) {
channelPixelValue = (interimConvoResult * m_kernelFactor) * additionalMultiplier + m_absoluteOffset[channel];
} else {
channelPixelValue = interimConvoResult * m_kernelFactor + m_absoluteOffset[channel];
}
limitValue(&channelPixelValue, m_minClamp[channel], m_maxClamp[channel]);
const quint32 channelPos = m_convChannelList[channel]->pos();
m_fromDoubleFuncPtr[channel](dstPtr, channelPos, channelPixelValue);
return channelPixelValue;
}
inline void convolveCache(quint8* dstPtr) {
if (m_alphaCachePos >= 0) {
qreal alphaValue = convolveOneChannelFromCache<false>(dstPtr, m_alphaCachePos);
// TODO: we need a special case for applying LoG filter,
// when the alpha i suniform and therefore should not be
// filtered!
//alphaValue = 255.0;
if (alphaValue != 0.0) {
qreal alphaValueInv = 1.0 / alphaValue;
for (quint32 k = 0; k < m_convolveChannelsNo; ++k) {
if (k == (quint32)m_alphaCachePos) continue;
convolveOneChannelFromCache<true>(dstPtr, k, alphaValueInv);
}
} else {
for (quint32 k = 0; k < m_convolveChannelsNo; ++k) {
if (k == (quint32)m_alphaCachePos) continue;
const qreal zeroValue = 0.0;
const quint32 channelPos = m_convChannelList[k]->pos();
m_fromDoubleFuncPtr[k](dstPtr, channelPos, zeroValue);
}
}
} else {
for (quint32 k = 0; k < m_convolveChannelsNo; ++k) {
convolveOneChannelFromCache<false>(dstPtr, k);
}
}
}
inline void moveKernelRight(typename _IteratorFactory_::VLineConstIterator& kitSrc, qreal **pixelPtrCache) {
qreal** d = pixelPtrCache;
for (quint32 krow = 0; krow < m_kh; ++krow) {
qreal* first = *d;
memmove(d, d + 1, (m_kw - 1) * sizeof(qreal *));
*(d + m_kw - 1) = first;
d += m_kw;
}
qint32 i = m_kw - 1;
do {
const quint8* data = kitSrc->oldRawData();
loadPixelToCache(pixelPtrCache, data, i);
i += m_kw;
} while (kitSrc->nextPixel());
}
inline void moveKernelDown(typename _IteratorFactory_::HLineConstIterator& kitSrc, qreal **pixelPtrCache) {
quint8 **tmp = new quint8*[m_kw];
memcpy(tmp, pixelPtrCache, m_kw * sizeof(qreal *));
memmove(pixelPtrCache, pixelPtrCache + m_kw, (m_kw * m_kh - m_kw) * sizeof(quint8 *));
memcpy(pixelPtrCache + m_kw *(m_kh - 1), tmp, m_kw * sizeof(quint8 *));
delete[] tmp;
qint32 i = m_kw * (m_kh - 1);
do {
const quint8* data = kitSrc->oldRawData();
loadPixelToCache(pixelPtrCache, data, i);
i++;
} while (kitSrc->nextPixel());
}
void cleanUp() {
for (quint32 c = 0; c < m_cacheSize; ++c) {
delete[] m_pixelPtrCache[c];
delete[] m_pixelPtrCacheCopy[c];
}
delete[] m_kernelData;
delete[] m_pixelPtrCache;
delete[] m_pixelPtrCacheCopy;
delete[] m_minClamp;
delete[] m_maxClamp;
delete[] m_absoluteOffset;
}
private:
quint32 m_kw, m_kh;
quint32 m_khalfWidth, m_khalfHeight;
quint32 m_convolveChannelsNo;
quint32 m_cacheSize, m_pixelSize;
int m_alphaCachePos;
int m_alphaRealPos;
qreal *m_kernelData;
qreal** m_pixelPtrCache, ** m_pixelPtrCacheCopy;
qreal* m_minClamp, *m_maxClamp, *m_absoluteOffset;
qreal m_kernelFactor;
QList<KoChannelInfo *> m_convChannelList;
QVector<PtrToDouble> m_toDoubleFuncPtr;
QVector<PtrFromDouble> m_fromDoubleFuncPtr;
};
#endif
diff --git a/libs/image/kis_count_visitor.h b/libs/image/kis_count_visitor.h
index 5f39cb775b..b83740acb5 100644
--- a/libs/image/kis_count_visitor.h
+++ b/libs/image/kis_count_visitor.h
@@ -1,124 +1,124 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COUNT_VISITOR
#define KIS_COUNT_VISITOR
#include "kritaimage_export.h"
#include <KoProperties.h>
#include "kis_node_visitor.h"
#include "kis_node.h"
#include "kis_paint_layer.h"
#include "kis_group_layer.h"
#include "kis_adjustment_layer.h"
#include "kis_external_layer_iface.h"
#include "kis_clone_layer.h"
#include "kis_filter_mask.h"
#include "kis_transform_mask.h"
#include "kis_transparency_mask.h"
#include "kis_selection_mask.h"
#include "lazybrush/kis_colorize_mask.h"
#include "generator/kis_generator_layer.h"
/**
* The count visitor traverses the node stack for nodes that conform
* to certain properties. You can set the types of nodes to count and
* add a list of properties to check. The children of nodes that are
* not counted will be checked and counted if they conform to the
* requirements.
*/
class KRITAIMAGE_EXPORT KisCountVisitor : public KisNodeVisitor
{
public:
using KisNodeVisitor::visit;
KisCountVisitor(const QStringList & nodeTypes, const KoProperties & properties)
: m_nodeTypes(nodeTypes)
, m_properties(properties)
, m_count(0) {
}
quint32 count() {
return m_count;
}
- bool visit(KisNode* node) {
+ bool visit(KisNode* node) override {
return check(node);
}
- bool visit(KisPaintLayer *layer) {
+ bool visit(KisPaintLayer *layer) override {
return check(layer);
}
- bool visit(KisGroupLayer *layer) {
+ bool visit(KisGroupLayer *layer) override {
return check(layer);
}
- bool visit(KisAdjustmentLayer *layer) {
+ bool visit(KisAdjustmentLayer *layer) override {
return check(layer);
}
- bool visit(KisExternalLayer *layer) {
+ bool visit(KisExternalLayer *layer) override {
return check(layer);
}
- bool visit(KisCloneLayer *layer) {
+ bool visit(KisCloneLayer *layer) override {
return check(layer);
}
- bool visit(KisFilterMask *mask) {
+ bool visit(KisFilterMask *mask) override {
return check(mask);
}
- bool visit(KisTransformMask *mask) {
+ bool visit(KisTransformMask *mask) override {
return check(mask);
}
- bool visit(KisTransparencyMask *mask) {
+ bool visit(KisTransparencyMask *mask) override {
return check(mask);
}
- bool visit(KisGeneratorLayer * layer) {
+ bool visit(KisGeneratorLayer * layer) override {
return check(layer);
}
- bool visit(KisSelectionMask* mask) {
+ bool visit(KisSelectionMask* mask) override {
return check(mask);
}
- bool visit(KisColorizeMask* mask) {
+ bool visit(KisColorizeMask* mask) override {
return check(mask);
}
private:
bool inList(KisNode* node);
bool check(KisNode * node);
const QStringList m_nodeTypes;
const KoProperties m_properties;
quint32 m_count;
};
#endif
diff --git a/libs/image/kis_crop_saved_extra_data.h b/libs/image/kis_crop_saved_extra_data.h
index 9e2f3f7974..4647023525 100644
--- a/libs/image/kis_crop_saved_extra_data.h
+++ b/libs/image/kis_crop_saved_extra_data.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CROP_SAVED_EXTRA_DATA_H
#define __KIS_CROP_SAVED_EXTRA_DATA_H
#include <QRect>
#include "kundo2commandextradata.h"
#include "kis_types.h"
#include "kritaimage_export.h"
class KRITAIMAGE_EXPORT KisCropSavedExtraData : public KUndo2CommandExtraData
{
public:
enum Type {
CROP_IMAGE,
RESIZE_IMAGE,
CROP_LAYER
};
public:
KisCropSavedExtraData(Type type, QRect cropRect, KisNodeSP cropNode = 0);
- ~KisCropSavedExtraData();
+ ~KisCropSavedExtraData() override;
inline Type type() const {
return m_type;
}
inline QRect cropRect() const {
return m_cropRect;
}
inline KisNodeSP cropNode() const {
return m_cropNode;
}
private:
Type m_type;
QRect m_cropRect;
KisNodeSP m_cropNode;
};
#endif /* __KIS_CROP_SAVED_EXTRA_DATA_H */
diff --git a/libs/image/kis_curve_circle_mask_generator.h b/libs/image/kis_curve_circle_mask_generator.h
index 7aae27a8d9..a5db1ae129 100644
--- a/libs/image/kis_curve_circle_mask_generator.h
+++ b/libs/image/kis_curve_circle_mask_generator.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CURVE_CIRCLE_MASK_GENERATOR_H_
#define _KIS_CURVE_CIRCLE_MASK_GENERATOR_H_
#include <QScopedPointer>
#include "kritaimage_export.h"
#include <QList>
#include <QVector>
class KisCubicCurve;
class QDomElement;
class QDomDocument;
class QPointF;
/**
* This mask generator use softness/hardness defined by user curve
* It used to be soft brush paintop.
*/
class KRITAIMAGE_EXPORT KisCurveCircleMaskGenerator : public KisMaskGenerator
{
public:
KisCurveCircleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes,const KisCubicCurve& curve, bool antialiasEdges);
KisCurveCircleMaskGenerator(const KisCurveCircleMaskGenerator &rhs);
- virtual ~KisCurveCircleMaskGenerator();
- KisMaskGenerator* clone() const;
+ ~KisCurveCircleMaskGenerator() override;
+ KisMaskGenerator* clone() const override;
- virtual quint8 valueAt(qreal x, qreal y) const;
+ quint8 valueAt(qreal x, qreal y) const override;
- void setScale(qreal scaleX, qreal scaleY);
+ void setScale(qreal scaleX, qreal scaleY) override;
- bool shouldSupersample() const;
+ bool shouldSupersample() const override;
- virtual void toXML(QDomDocument& , QDomElement&) const;
- virtual void setSoftness(qreal softness);
+ void toXML(QDomDocument& , QDomElement&) const override;
+ void setSoftness(qreal softness) override;
static void transformCurveForSoftness(qreal softness,const QList<QPointF> &points, int curveResolution, QVector<qreal> &result);
private:
qreal norme(qreal a, qreal b) const {
return a*a + b*b;
}
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/libs/image/kis_curve_rect_mask_generator.h b/libs/image/kis_curve_rect_mask_generator.h
index 0b6c3edbc1..2427e8daf2 100644
--- a/libs/image/kis_curve_rect_mask_generator.h
+++ b/libs/image/kis_curve_rect_mask_generator.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CURVE_RECT_MASK_GENERATOR_H_
#define _KIS_CURVE_RECT_MASK_GENERATOR_H_
#include "kritaimage_export.h"
class KisCubicCurve;
class QDomElement;
class QDomDocument;
#include "kis_mask_generator.h"
/**
* Curve based softness for this rectangular mask generator
*/
class KRITAIMAGE_EXPORT KisCurveRectangleMaskGenerator : public KisMaskGenerator
{
public:
KisCurveRectangleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, const KisCubicCurve& curve, bool antialiasEdges);
KisCurveRectangleMaskGenerator(const KisCurveRectangleMaskGenerator &rhs);
- virtual ~KisCurveRectangleMaskGenerator();
- KisMaskGenerator* clone() const;
+ ~KisCurveRectangleMaskGenerator() override;
+ KisMaskGenerator* clone() const override;
- virtual quint8 valueAt(qreal x, qreal y) const;
+ quint8 valueAt(qreal x, qreal y) const override;
- void setScale(qreal scaleX, qreal scaleY);
+ void setScale(qreal scaleX, qreal scaleY) override;
- virtual void toXML(QDomDocument& , QDomElement&) const;
+ void toXML(QDomDocument& , QDomElement&) const override;
- virtual void setSoftness(qreal softness);
+ void setSoftness(qreal softness) override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/image/kis_datamanager.h b/libs/image/kis_datamanager.h
index 469accf79a..3b45d115e8 100644
--- a/libs/image/kis_datamanager.h
+++ b/libs/image/kis_datamanager.h
@@ -1,349 +1,349 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DATAMANAGER_H_
#define KIS_DATAMANAGER_H_
#include <QtGlobal>
class QRect;
class KisPaintDeviceWriter;
class QIODevice;
#include <tiles3/kis_tiled_data_manager.h>
#include <tiles3/kis_memento.h>
#define ACTUAL_DATAMGR KisTiledDataManager
/**
* KisDataManager defines the interface that modules responsible for
* storing and retrieving data must inmplement. Data modules, like
* the tile manager, are responsible for:
*
* * Storing undo/redo data
* * Offering ordered and unordered iterators over rects of pixels
* * (eventually) efficiently loading and saving data in a format
* that may allow deferred loading.
*
* A datamanager knows nothing about the type of pixel data except
* how many quint8's a single pixel takes.
*/
class KisDataManager : public ACTUAL_DATAMGR
{
public:
/**
* Create a new datamanger where every pixel will take pixelSize bytes and will be initialized
* by default with defPixel. The value of defPixel is copied, the caller still owns the pointer.
*
* Note that if pixelSize > size of the defPixel array, we will happily read beyond the
* defPixel array.
*/
KisDataManager(quint32 pixelSize, const quint8 *defPixel) : ACTUAL_DATAMGR(pixelSize, defPixel) {}
KisDataManager(const KisDataManager& dm) : ACTUAL_DATAMGR(dm) { }
- ~KisDataManager() {
+ ~KisDataManager() override {
}
public:
/**
* Sets the default pixel. New data will be initialised with this pixel. The pixel is copied: the
* caller still owns the pointer.
*/
inline void setDefaultPixel(const quint8 *defPixel) {
return ACTUAL_DATAMGR::setDefaultPixel(defPixel);
}
/**
* Get a pointer to the default pixel.
*/
inline const quint8 *defaultPixel() const {
return ACTUAL_DATAMGR::defaultPixel();
}
/**
* Reguests a memento from the data manager. There is only one memento active
* at any given moment for a given paint device and all and any
* write actions on the datamanger builds undo data into this memento
* necessary to rollback the transaction.
*/
inline KisMementoSP getMemento() {
return ACTUAL_DATAMGR::getMemento();
}
/**
* Restores the image data to the state at the time of the getMemento() call.
*
* Note that rollback should be performed with mementos in the reverse order of
* their creation, as mementos only store incremental changes
*/
inline void rollback(KisMementoSP memento) {
ACTUAL_DATAMGR::rollback(memento);
}
/**
* Restores the image data to the state at the time of the rollback call of the memento.
*
* Note that rollforward must only be called when an rollback have previously been performed, and
* no intermittent actions have been performed (though it's ok to rollback other mementos and
* roll them forward again)
*/
inline void rollforward(KisMementoSP memento) {
ACTUAL_DATAMGR::rollforward(memento);
}
/**
* @returns true if there is a memento active. This means that
* iterators can rely on the oldData() function.
*/
inline bool hasCurrentMemento() const {
return ACTUAL_DATAMGR::hasCurrentMemento();
}
public:
/**
* Reads and writes the tiles
*
*/
inline bool write(KisPaintDeviceWriter &writer) {
return ACTUAL_DATAMGR::write(writer);
}
inline bool read(QIODevice *io) {
return ACTUAL_DATAMGR::read(io);
}
inline void purge(const QRect& area) {
ACTUAL_DATAMGR::purge(area);
}
/**
* The tiles may be not allocated directly from the glibc, but
* instead can be allocated in bigger blobs. After you freed quite
* a lot of data and are sure you won't need it anymore, you can
* release these pools to save the memory.
*/
static inline void releaseInternalPools() {
ACTUAL_DATAMGR::releaseInternalPools();
}
public:
/**
* Returns the number of bytes a pixel takes
*/
inline quint32 pixelSize() const {
return ACTUAL_DATAMGR::pixelSize();
}
/**
* Return the extent of the data in x,y,w,h.
*/
inline void extent(qint32 &x, qint32 &y, qint32 &w, qint32 &h) const {
return ACTUAL_DATAMGR::extent(x, y, w, h);
}
QRect extent() const {
return ACTUAL_DATAMGR::extent();
}
QRegion region() const {
return ACTUAL_DATAMGR::region();
}
public:
/**
* Crop or extend the data to x, y, w, h.
*/
inline void setExtent(qint32 x, qint32 y, qint32 w, qint32 h) {
return ACTUAL_DATAMGR::setExtent(x, y, w, h);
}
inline void setExtent(const QRect & rect) {
setExtent(rect.x(), rect.y(), rect.width(), rect.height());
}
public:
/**
* Clear the specified rect to the specified value.
*/
inline void clear(qint32 x, qint32 y,
qint32 w, qint32 h,
quint8 def) {
ACTUAL_DATAMGR::clear(x, y, w, h, def);
}
/**
* Clear the specified rect to the specified pixel value.
*/
inline void clear(qint32 x, qint32 y,
qint32 w, qint32 h,
const quint8 * def) {
ACTUAL_DATAMGR::clear(x, y, w, h, def);
}
/**
* Clear all back to default values.
*/
inline void clear() {
ACTUAL_DATAMGR::clear();
}
public:
/**
* Clones rect from another datamanager. The cloned area will be
* shared between both datamanagers as much as possible using
* copy-on-write. Parts of the rect that cannot be shared
* (cross tiles) are deep-copied,
*/
inline void bitBlt(KisTiledDataManagerSP srcDM, const QRect &rect) {
ACTUAL_DATAMGR::bitBlt(const_cast<KisTiledDataManager*>(srcDM.data()), rect);
}
/**
* The same as \ref bitBlt() but reads old data
*/
inline void bitBltOldData(KisTiledDataManagerSP srcDM, const QRect &rect) {
ACTUAL_DATAMGR::bitBltOldData(const_cast<KisTiledDataManager*>(srcDM.data()), rect);
}
/**
* Clones rect from another datamanager in a rough and fast way.
* All the tiles touched by rect will be shared, between both
* devices, that means it will copy a bigger area than was
* requested. This method is supposed to be used for bitBlt'ing
* into temporary paint devices.
*/
inline void bitBltRough(KisTiledDataManagerSP srcDM, const QRect &rect) {
ACTUAL_DATAMGR::bitBltRough(const_cast<KisTiledDataManager*>(srcDM.data()), rect);
}
/**
* The same as \ref bitBltRough() but reads old data
*/
inline void bitBltRoughOldData(KisTiledDataManagerSP srcDM, const QRect &rect) {
ACTUAL_DATAMGR::bitBltRoughOldData(const_cast<KisTiledDataManager*>(srcDM.data()), rect);
}
public:
/**
* Write the specified data to x, y. There is no checking on pixelSize!
*/
inline void setPixel(qint32 x, qint32 y, const quint8 * data) {
ACTUAL_DATAMGR::setPixel(x, y, data);
}
/**
* Copy the bytes in the specified rect to a chunk of memory.
* The pixelSize in bytes is w * h * pixelSize
*/
inline void readBytes(quint8 * data,
qint32 x, qint32 y,
qint32 w, qint32 h,
qint32 dataRowStride = -1) const {
ACTUAL_DATAMGR::readBytes(data, x, y, w, h, dataRowStride);
}
/**
* Copy the bytes to the specified rect. w * h * pixelSize bytes
* will be read, whether the caller prepared them or not.
*/
inline void writeBytes(const quint8 * data,
qint32 x, qint32 y,
qint32 w, qint32 h,
qint32 dataRowStride = -1) {
ACTUAL_DATAMGR::writeBytes(data, x, y, w, h, dataRowStride);
}
/**
* Copy the bytes in the paint device into a vector of arrays of bytes,
* where the number of arrays is the number of channels in the
* paint device. If the specified area is larger than the paint
* device's extent, the default pixel will be read.
*
* @param channelsize a vector with for every channel its size in bytes
*/
QVector<quint8*> readPlanarBytes(QVector<qint32> channelsizes, qint32 x, qint32 y, qint32 w, qint32 h) const {
return ACTUAL_DATAMGR::readPlanarBytes(channelsizes, x, y, w, h);
}
/**
* Write the data in the separate arrays to the channels. If there
* are less vectors than channels, the remaining channels will not
* be copied. If any of the arrays points to 0, the channel in
* that location will not be touched. If the specified area is
* larger than the paint device, the paint device will be
* extended. There are no guards: if the area covers more pixels
* than there are bytes in the arrays, krita will happily fill
* your paint device with areas of memory you never wanted to be
* read. Krita may also crash.
*
* @param planes a vector with a byte array for every plane
* @param channelsize a vector with for every channel its size in
* bytes
*
* XXX: what about undo?
*/
void writePlanarBytes(QVector<quint8*> planes, QVector<qint32> channelsizes, qint32 x, qint32 y, qint32 w, qint32 h) {
ACTUAL_DATAMGR::writePlanarBytes(planes, channelsizes, x, y, w, h);
}
/**
* Get the number of contiguous columns starting at x, valid for all values
* of y between minY and maxY.
*/
inline qint32 numContiguousColumns(qint32 x, qint32 minY, qint32 maxY) const {
return ACTUAL_DATAMGR::numContiguousColumns(x, minY, maxY);
}
/**
* Get the number of contiguous rows starting at y, valid for all
* values of x between minX and maxX.
*/
inline qint32 numContiguousRows(qint32 y, qint32 minX, qint32 maxX) const {
return ACTUAL_DATAMGR::numContiguousRows(y, minX, maxX);
}
/**
* Get the row stride at pixel (x, y). This is the number of bytes
* to add to a pointer to pixel (x, y) to access (x, y + 1).
*/
inline qint32 rowStride(qint32 x, qint32 y) const {
return ACTUAL_DATAMGR::rowStride(x, y);
}
protected:
friend class KisRectIterator;
friend class KisHLineIterator;
friend class KisVLineIterator;
};
#endif // KIS_DATAMANAGER_H_
diff --git a/libs/image/kis_default_bounds.h b/libs/image/kis_default_bounds.h
index c32449a319..ed8c89fff5 100644
--- a/libs/image/kis_default_bounds.h
+++ b/libs/image/kis_default_bounds.h
@@ -1,79 +1,79 @@
/*
* Copyright (c) 2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DEFAULT_BOUNDS_H
#define KIS_DEFAULT_BOUNDS_H
#include <QRect>
#include "kis_types.h"
#include "kis_default_bounds_base.h"
class KisDefaultBounds;
class KisSelectionDefaultBounds;
class KisSelectionEmptyBounds;
typedef KisSharedPtr<KisDefaultBounds> KisDefaultBoundsSP;
typedef KisSharedPtr<KisSelectionDefaultBounds> KisSelectionDefaultBoundsSP;
typedef KisSharedPtr<KisSelectionEmptyBounds> KisSelectionEmptyBoundsSP;
class KRITAIMAGE_EXPORT KisDefaultBounds : public KisDefaultBoundsBase
{
public:
KisDefaultBounds(KisImageWSP image = 0);
- virtual ~KisDefaultBounds();
+ ~KisDefaultBounds() override;
- QRect bounds() const;
- bool wrapAroundMode() const;
- int currentLevelOfDetail() const;
- int currentTime() const;
- bool externalFrameActive() const;
+ QRect bounds() const override;
+ bool wrapAroundMode() const override;
+ int currentLevelOfDetail() const override;
+ int currentTime() const override;
+ bool externalFrameActive() const override;
protected:
friend class KisPaintDeviceTest;
static const QRect infiniteRect;
private:
Q_DISABLE_COPY(KisDefaultBounds)
struct Private;
Private * const m_d;
};
class KRITAIMAGE_EXPORT KisSelectionDefaultBounds : public KisDefaultBounds
{
public:
KisSelectionDefaultBounds(KisPaintDeviceSP parentPaintDevice, KisImageWSP image = 0);
- ~KisSelectionDefaultBounds();
+ ~KisSelectionDefaultBounds() override;
- QRect bounds() const;
+ QRect bounds() const override;
private:
Q_DISABLE_COPY(KisSelectionDefaultBounds)
struct Private;
Private * const m_d;
};
class KRITAIMAGE_EXPORT KisSelectionEmptyBounds : public KisDefaultBounds
{
public:
KisSelectionEmptyBounds(KisImageWSP image);
- virtual ~KisSelectionEmptyBounds();
- QRect bounds() const;
+ ~KisSelectionEmptyBounds() override;
+ QRect bounds() const override;
};
#endif // KIS_DEFAULT_BOUNDS_H
diff --git a/libs/image/kis_do_something_command.h b/libs/image/kis_do_something_command.h
index 7251099536..b66f9c01ab 100644
--- a/libs/image/kis_do_something_command.h
+++ b/libs/image/kis_do_something_command.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DO_SOMETHING_COMMAND_H
#define __KIS_DO_SOMETHING_COMMAND_H
#include <kundo2command.h>
template <template <class T> class DoSomethingOp, class LayerType>
class KisDoSomethingCommand : public KUndo2Command
{
public:
KisDoSomethingCommand(LayerType layer, bool finalUpdate)
: m_layer(layer),
m_finalUpdate(finalUpdate) {}
- void undo() {
+ void undo() override {
DoSomethingOp<LayerType> op;
if (!m_finalUpdate) {
op(m_layer);
}
}
- void redo() {
+ void redo() override {
DoSomethingOp<LayerType> op;
if (m_finalUpdate) {
op(m_layer);
}
}
private:
LayerType m_layer;
bool m_finalUpdate;
};
namespace KisDoSomethingCommandOps {
template <class LayerType>
struct ResetOp
{
void operator() (LayerType layer) {
layer->resetCache();
}
};
template <class LayerType>
struct UpdateOp
{
void operator() (LayerType layer) {
layer->update();
}
};
}
#endif /* __KIS_DO_SOMETHING_COMMAND_H */
diff --git a/libs/image/kis_effect_mask.h b/libs/image/kis_effect_mask.h
index 1698a17f7b..526ae9fc5c 100644
--- a/libs/image/kis_effect_mask.h
+++ b/libs/image/kis_effect_mask.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_EFFECT_MASK_
#define _KIS_EFFECT_MASK_
#include "kis_mask.h"
/**
* An effect mask is a single channel mask that applies a particular
* effect to the layer the mask belongs to. It differs from an
* adjustment layer in that it only works on its parent layer, while
* adjustment layers work on all layers below it in its layer group.
* The effect could be a filter, a transformation or anything else
* that messes up pixels.
*/
class KRITAIMAGE_EXPORT KisEffectMask : public KisMask
{
Q_OBJECT
public:
/**
* Create an empty effect mask.
*/
KisEffectMask();
- virtual ~KisEffectMask();
+ ~KisEffectMask() override;
KisEffectMask(const KisEffectMask& rhs);
- QIcon icon() const;
+ QIcon icon() const override;
using KisMask::apply;
};
#endif //_KIS_EFFECT_MASK_
diff --git a/libs/image/kis_external_layer_iface.h b/libs/image/kis_external_layer_iface.h
index 22a9f653ca..9cb1b1f50b 100644
--- a/libs/image/kis_external_layer_iface.h
+++ b/libs/image/kis_external_layer_iface.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2006 Bart Coppens <kde@bartcoppens.be>
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_EXTERNAL_LAYER_IFACE_
#define KIS_EXTERNAL_LAYER_IFACE_
#include "kis_icon_utils.h"
#include "kis_types.h"
#include "kis_image.h"
#include "kis_layer.h"
class QString;
class QIcon;
class KUndo2Command;
/**
A base interface for layers that are implemented outside the Krita
core.
*/
class KisExternalLayer : public KisLayer
{
public:
KisExternalLayer(KisImageWSP image, const QString &name, quint8 opacity)
: KisLayer(image, name, opacity) {}
- virtual QIcon icon() const {
+ QIcon icon() const override {
return KisIconUtils::loadIcon("view-refresh");
}
virtual void resetCache() {
}
virtual KUndo2Command* crop(const QRect & rect) {
Q_UNUSED(rect);
return 0;
}
virtual KUndo2Command* transform(const QTransform &transform) {
Q_UNUSED(transform);
return 0;
}
virtual bool supportsPerspectiveTransform() const {
return false;
}
};
#endif // KIS_EXTERNAL_IFACE_LAYER_IFACE_
diff --git a/libs/image/kis_filter_mask.h b/libs/image/kis_filter_mask.h
index ab23ddb3ed..ba2cdaa874 100644
--- a/libs/image/kis_filter_mask.h
+++ b/libs/image/kis_filter_mask.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_FILTER_MASK_
#define _KIS_FILTER_MASK_
#include "kis_types.h"
#include "kis_effect_mask.h"
#include "kis_node_filter_interface.h"
class KisFilterConfiguration;
/**
An filter mask is a single channel mask that applies a particular
filter to the layer the mask belongs to. It differs from an
adjustment layer in that it only works on its parent layer, while
adjustment layers work on all layers below it in its layer group.
*/
class KRITAIMAGE_EXPORT KisFilterMask : public KisEffectMask, public KisNodeFilterInterface
{
Q_OBJECT
public:
/**
* Create an empty filter mask.
*/
KisFilterMask();
- virtual ~KisFilterMask();
+ ~KisFilterMask() override;
- QIcon icon() const;
+ QIcon icon() const override;
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisFilterMask(*this));
}
- bool accept(KisNodeVisitor &v);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &v) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
KisFilterMask(const KisFilterMask& rhs);
- void setFilter(KisFilterConfigurationSP filterConfig);
+ void setFilter(KisFilterConfigurationSP filterConfig) override;
QRect decorateRect(KisPaintDeviceSP &src,
KisPaintDeviceSP &dst,
const QRect & rc,
- PositionToFilthy maskPos) const;
+ PositionToFilthy maskPos) const override;
- QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
+ QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
};
#endif //_KIS_FILTER_MASK_
diff --git a/libs/image/kis_filter_strategy.h b/libs/image/kis_filter_strategy.h
index 33b6f89d97..1cd5e36daf 100644
--- a/libs/image/kis_filter_strategy.h
+++ b/libs/image/kis_filter_strategy.h
@@ -1,206 +1,206 @@
/*
* Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILTER_STRATEGY_H_
#define KIS_FILTER_STRATEGY_H_
#include <klocalizedstring.h>
#include "KoGenericRegistry.h"
#include "KoID.h"
#include "kritaimage_export.h"
class KRITAIMAGE_EXPORT KisFilterStrategy
{
public:
KisFilterStrategy(KoID id) : m_id(id) {}
virtual ~KisFilterStrategy() {}
QString id() {
return m_id.id();
}
QString name() {
return m_id.name();
}
virtual qreal valueAt(qreal /*t*/) const {
return 0;
}
virtual qint32 intValueAt(qint32 t) const {
return qint32(255*valueAt(t / 256.0));
}
qreal support() {
return supportVal;
}
qint32 intSupport() {
return intSupportVal;
}
virtual bool boxSpecial() {
return false;
}
virtual QString description() {
return QString();
}
protected:
qreal supportVal;
qint32 intSupportVal;
KoID m_id;
};
class KRITAIMAGE_EXPORT KisHermiteFilterStrategy : public KisFilterStrategy
{
public:
KisHermiteFilterStrategy() : KisFilterStrategy(KoID("Hermite", i18n("Hermite"))) {
supportVal = 1.0; intSupportVal = 256;
}
- virtual ~KisHermiteFilterStrategy() {}
+ ~KisHermiteFilterStrategy() override {}
- virtual qint32 intValueAt(qint32 t) const;
- virtual qreal valueAt(qreal t) const;
+ qint32 intValueAt(qint32 t) const override;
+ qreal valueAt(qreal t) const override;
};
class KRITAIMAGE_EXPORT KisBicubicFilterStrategy : public KisFilterStrategy
{
public:
KisBicubicFilterStrategy() : KisFilterStrategy(KoID("Bicubic", i18n("Bicubic"))) {
supportVal = 2.0; intSupportVal = 512;
}
- virtual ~KisBicubicFilterStrategy() {}
+ ~KisBicubicFilterStrategy() override {}
- virtual QString description() {
+ QString description() override {
return i18n("Adds pixels using the color of surrounding pixels. Produces smoother tonal gradations than Bilinear.");
}
- virtual qint32 intValueAt(qint32 t) const;
+ qint32 intValueAt(qint32 t) const override;
};
class KRITAIMAGE_EXPORT KisBoxFilterStrategy : public KisFilterStrategy
{
public:
KisBoxFilterStrategy() : KisFilterStrategy(KoID("Box", i18n("Box"))) {
supportVal = 0.5; intSupportVal = 128;
}
- virtual ~KisBoxFilterStrategy() {}
+ ~KisBoxFilterStrategy() override {}
- virtual QString description() {
+ QString description() override {
return i18n("Replicate pixels in the image. Preserves all the original detail, but can produce jagged effects.");
}
- virtual qint32 intValueAt(qint32 t) const;
- virtual qreal valueAt(qreal t) const;
- virtual bool boxSpecial() {
+ qint32 intValueAt(qint32 t) const override;
+ qreal valueAt(qreal t) const override;
+ bool boxSpecial() override {
return true;
}
};
class KRITAIMAGE_EXPORT KisBilinearFilterStrategy : public KisFilterStrategy
{
public:
KisBilinearFilterStrategy() : KisFilterStrategy(KoID("Bilinear", i18n("Bilinear"))) {
supportVal = 1.0; intSupportVal = 256;
}
- virtual ~KisBilinearFilterStrategy() {}
+ ~KisBilinearFilterStrategy() override {}
- virtual QString description() {
+ QString description() override {
return i18n("Adds pixels averaging the color values of surrounding pixels. Produces medium quality results when the image is scaled from half to two times the original size.");
}
- virtual qint32 intValueAt(qint32 t) const;
- virtual qreal valueAt(qreal t) const;
+ qint32 intValueAt(qint32 t) const override;
+ qreal valueAt(qreal t) const override;
};
class KRITAIMAGE_EXPORT KisBellFilterStrategy : public KisFilterStrategy
{
public:
KisBellFilterStrategy() : KisFilterStrategy(KoID("Bell", i18n("Bell"))) {
supportVal = 1.5; intSupportVal = 128 + 256;
}
- virtual ~KisBellFilterStrategy() {}
+ ~KisBellFilterStrategy() override {}
- virtual qreal valueAt(qreal t) const;
+ qreal valueAt(qreal t) const override;
};
class KRITAIMAGE_EXPORT KisBSplineFilterStrategy : public KisFilterStrategy
{
public:
KisBSplineFilterStrategy() : KisFilterStrategy(KoID("BSpline", i18n("BSpline"))) {
supportVal = 2.0; intSupportVal = 512;
}
- virtual ~KisBSplineFilterStrategy() {}
+ ~KisBSplineFilterStrategy() override {}
- virtual qreal valueAt(qreal t) const;
+ qreal valueAt(qreal t) const override;
};
class KRITAIMAGE_EXPORT KisLanczos3FilterStrategy : public KisFilterStrategy
{
public:
KisLanczos3FilterStrategy() : KisFilterStrategy(KoID("Lanczos3", i18n("Lanczos3"))) {
supportVal = 3.0; intSupportVal = 768;
}
- virtual ~KisLanczos3FilterStrategy() {}
+ ~KisLanczos3FilterStrategy() override {}
- virtual QString description() {
+ QString description() override {
return i18n("Offers similar results than Bicubic, but maybe a little bit sharper. Can produce light and dark halos along strong edges.");
}
- virtual qreal valueAt(qreal t) const;
+ qreal valueAt(qreal t) const override;
private:
qreal sinc(qreal x) const;
};
class KRITAIMAGE_EXPORT KisMitchellFilterStrategy : public KisFilterStrategy
{
public:
KisMitchellFilterStrategy() : KisFilterStrategy(KoID("Mitchell", i18n("Mitchell"))) {
supportVal = 2.0; intSupportVal = 256;
}
- virtual ~KisMitchellFilterStrategy() {}
+ ~KisMitchellFilterStrategy() override {}
- virtual qreal valueAt(qreal t) const;
+ qreal valueAt(qreal t) const override;
};
class KRITAIMAGE_EXPORT KisFilterStrategyRegistry : public KoGenericRegistry<KisFilterStrategy *>
{
public:
KisFilterStrategyRegistry();
- ~KisFilterStrategyRegistry();
+ ~KisFilterStrategyRegistry() override;
static KisFilterStrategyRegistry* instance();
/**
* This function return a list of all the keys in KoID format by using the name() method
* on the objects stored in the registry.
*/
QList<KoID> listKeys() const;
/**
* This function return a string formated in HTML that contains the descriptions of all objects
* (with a non empty description) stored in the registry.
*/
QString formatedDescriptions() const;
private:
KisFilterStrategyRegistry(const KisFilterStrategyRegistry&);
KisFilterStrategyRegistry operator=(const KisFilterStrategyRegistry&);
};
#endif // KIS_FILTER_STRATEGY_H_
diff --git a/libs/image/kis_full_refresh_walker.h b/libs/image/kis_full_refresh_walker.h
index ee444bafdd..abed6d5ec5 100644
--- a/libs/image/kis_full_refresh_walker.h
+++ b/libs/image/kis_full_refresh_walker.h
@@ -1,106 +1,106 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_FULL_REFRESH_WALKER_H
#define __KIS_FULL_REFRESH_WALKER_H
#include "kis_merge_walker.h"
#include "kis_refresh_subtree_walker.h"
class KisFullRefreshWalker : public KisRefreshSubtreeWalker, public KisMergeWalker
{
public:
KisFullRefreshWalker(QRect cropRect)
: KisMergeWalker(NO_FILTHY), m_firstRun(true)
{
setCropRect(cropRect);
}
- UpdateType type() const {
+ UpdateType type() const override {
return FULL_REFRESH;
}
- void startTrip(KisProjectionLeafSP startWith) {
+ void startTrip(KisProjectionLeafSP startWith) override {
if(m_firstRun) {
m_firstRun = false;
m_currentUpdateType = UPDATE;
KisMergeWalker::startTrip(startWith);
m_currentUpdateType = FULL_REFRESH;
KisRefreshSubtreeWalker::startTrip(startWith);
m_firstRun = true;
}
else {
if(m_currentUpdateType == FULL_REFRESH) {
KisRefreshSubtreeWalker::startTrip(startWith);
}
else {
KisMergeWalker::startTrip(startWith);
}
}
}
- void registerChangeRect(KisProjectionLeafSP leaf, NodePosition position) {
+ void registerChangeRect(KisProjectionLeafSP leaf, NodePosition position) override {
if(m_currentUpdateType == FULL_REFRESH) {
KisRefreshSubtreeWalker::registerChangeRect(leaf, position);
}
else {
/**
* Merge walker thinks that we changed the original of the
* dirty node (dirtyNode == startNode()), but that is not
* true in case of full refresh walker, because all the
* children of the dirty node are dirty as well, that is
* why we shouldn't rely on usual registerChangeRect()
* mechanism for this node. That is why we just unite the
* changeRects of all its children here.
*/
if(isStartLeaf(leaf)&& !leaf->isRoot()) {
KisRefreshSubtreeWalker::calculateChangeRect(leaf, requestedRect());
}
else {
KisMergeWalker::registerChangeRect(leaf, position);
}
}
}
- void registerNeedRect(KisProjectionLeafSP leaf, NodePosition position) {
+ void registerNeedRect(KisProjectionLeafSP leaf, NodePosition position) override {
if(m_currentUpdateType == FULL_REFRESH) {
KisRefreshSubtreeWalker::registerNeedRect(leaf, position);
}
else {
KisMergeWalker::registerNeedRect(leaf, position);
}
}
- void adjustMasksChangeRect(KisProjectionLeafSP firstMask) {
+ void adjustMasksChangeRect(KisProjectionLeafSP firstMask) override {
if(m_currentUpdateType == FULL_REFRESH) {
KisRefreshSubtreeWalker::adjustMasksChangeRect(firstMask);
}
else {
KisMergeWalker::adjustMasksChangeRect(firstMask);
}
}
private:
UpdateType m_currentUpdateType;
bool m_firstRun;
};
#endif /* __KIS_FULL_REFRESH_WALKER_H */
diff --git a/libs/image/kis_gauss_circle_mask_generator.h b/libs/image/kis_gauss_circle_mask_generator.h
index 4ca5176d4e..ae6158c9ee 100644
--- a/libs/image/kis_gauss_circle_mask_generator.h
+++ b/libs/image/kis_gauss_circle_mask_generator.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2011 Geoffry Song <goffrie@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_GAUSS_MASK_GENERATOR_H_
#define _KIS_GAUSS_MASK_GENERATOR_H_
#include <QScopedPointer>
#include "kritaimage_export.h"
/**
* This mask generator uses a Gaussian-blurred circle
*/
class KRITAIMAGE_EXPORT KisGaussCircleMaskGenerator : public KisMaskGenerator
{
public:
KisGaussCircleMaskGenerator(qreal diameter, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges);
KisGaussCircleMaskGenerator(const KisGaussCircleMaskGenerator &rhs);
- virtual ~KisGaussCircleMaskGenerator();
- KisMaskGenerator* clone() const;
+ ~KisGaussCircleMaskGenerator() override;
+ KisMaskGenerator* clone() const override;
- virtual quint8 valueAt(qreal x, qreal y) const;
+ quint8 valueAt(qreal x, qreal y) const override;
- void setScale(qreal scaleX, qreal scaleY);
+ void setScale(qreal scaleX, qreal scaleY) override;
private:
qreal norme(qreal a, qreal b) const {
return a*a + b*b;
}
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/libs/image/kis_gauss_rect_mask_generator.h b/libs/image/kis_gauss_rect_mask_generator.h
index e0bf7220ab..52ee731b57 100644
--- a/libs/image/kis_gauss_rect_mask_generator.h
+++ b/libs/image/kis_gauss_rect_mask_generator.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2011 Geoffry Song <goffrie@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_GAUSS_RECT_MASK_GENERATOR_H_
#define _KIS_GAUSS_RECT_MASK_GENERATOR_H_
#include "kritaimage_export.h"
/**
* This mask generator uses a Gaussian-blurred rectangle
*/
class KRITAIMAGE_EXPORT KisGaussRectangleMaskGenerator : public KisMaskGenerator
{
public:
KisGaussRectangleMaskGenerator(qreal diameter, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges);
KisGaussRectangleMaskGenerator(const KisGaussRectangleMaskGenerator &rhs);
- virtual ~KisGaussRectangleMaskGenerator();
- KisMaskGenerator* clone() const;
+ ~KisGaussRectangleMaskGenerator() override;
+ KisMaskGenerator* clone() const override;
- virtual quint8 valueAt(qreal x, qreal y) const;
- void setScale(qreal scaleX, qreal scaleY);
+ quint8 valueAt(qreal x, qreal y) const override;
+ void setScale(qreal scaleX, qreal scaleY) override;
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/libs/image/kis_gradient_painter.h b/libs/image/kis_gradient_painter.h
index 5bb7189984..c9df9bd617 100644
--- a/libs/image/kis_gradient_painter.h
+++ b/libs/image/kis_gradient_painter.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRADIENT_PAINTER_H_
#define KIS_GRADIENT_PAINTER_H_
#include <QScopedPointer>
#include <KoColor.h>
#include "kis_types.h"
#include "kis_painter.h"
#include <kritaimage_export.h>
/**
* XXX: Docs!
*/
class KRITAIMAGE_EXPORT KisGradientPainter : public KisPainter
{
public:
KisGradientPainter();
KisGradientPainter(KisPaintDeviceSP device);
KisGradientPainter(KisPaintDeviceSP device, KisSelectionSP selection);
- ~KisGradientPainter();
+ ~KisGradientPainter() override;
enum enumGradientShape {
GradientShapeLinear,
GradientShapeBiLinear,
GradientShapeRadial,
GradientShapeSquare,
GradientShapeConical,
GradientShapeConicalSymetric,
GradientShapePolygonal
};
enum enumGradientRepeat {
GradientRepeatNone,
GradientRepeatForwards,
GradientRepeatAlternate
};
void setGradientShape(enumGradientShape shape);
void precalculateShape();
/**
* Paint a gradient in the rect between startx, starty, width and height.
*/
bool paintGradient(const QPointF& gradientVectorStart,
const QPointF& gradientVectorEnd,
enumGradientRepeat repeat,
double antiAliasThreshold,
bool reverseGradient,
qint32 startx,
qint32 starty,
qint32 width,
qint32 height);
// convenience overload
bool paintGradient(const QPointF& gradientVectorStart,
const QPointF& gradientVectorEnd,
enumGradientRepeat repeat,
double antiAliasThreshold,
bool reverseGradient,
const QRect &applyRect);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif //KIS_GRADIENT_PAINTER_H_
diff --git a/libs/image/kis_group_layer.h b/libs/image/kis_group_layer.h
index 5dc79b251c..e0530a6229 100644
--- a/libs/image/kis_group_layer.h
+++ b/libs/image/kis_group_layer.h
@@ -1,124 +1,124 @@
/*
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GROUP_LAYER_H_
#define KIS_GROUP_LAYER_H_
#include "kis_layer.h"
#include "kis_types.h"
class KoColorSpace;
/**
* A KisLayer that bundles child layers into a single layer.
* The top layer is firstChild(), with index 0; the bottommost lastChild() with index childCount() - 1.
* KisLayer::nextSibling() moves towards higher indices, from the top to the bottom layer; prevSibling() the reverse.
* (Implementation detail: internally, the indices are reversed, for speed.)
**/
class KRITAIMAGE_EXPORT KisGroupLayer : public KisLayer
{
Q_OBJECT
public:
KisGroupLayer(KisImageWSP image, const QString &name, quint8 opacity);
KisGroupLayer(const KisGroupLayer& rhs);
- virtual ~KisGroupLayer();
+ ~KisGroupLayer() override;
KisNodeSP clone() const override {
return KisNodeSP(new KisGroupLayer(*this));
}
bool allowAsChild(KisNodeSP) const override;
QIcon icon() const override;
KisBaseNode::PropertyList sectionModelProperties() const override;
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override;
void setImage(KisImageWSP image) override;
- virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer) override;
- virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer) override;
+ KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer) override;
+ void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer) override;
/**
* Clear the projection
*/
void resetCache(const KoColorSpace *colorSpace = 0);
/**
* XXX: make the colorspace of a layergroup user-settable: we want
* to be able to have, for instance, a group of grayscale layers
* resulting in a grayscale projection that is then merged with an
* rgb image stack.
*/
const KoColorSpace * colorSpace() const override;
/// @return the projection of the layers in the group before the masks are applied.
KisPaintDeviceSP original() const override;
qint32 x() const override;
qint32 y() const override;
void setX(qint32 x) override;
void setY(qint32 y) override;
/// Group layers don't have a paint device, so return 0
KisPaintDeviceSP paintDevice() const override;
/**
Accect the specified visitor.
@return true if the operation succeeded, false if it failed.
*/
bool accept(KisNodeVisitor &v) override;
void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
/**
* A special method that changes the default color of the
* projection merged onto this group layer. Please note, that you
* cannot use original()->setDefaultPixel(), because original()
* device can be switched by tryOblidgeChild() mechanism randomly.
*/
void setDefaultProjectionColor(KoColor color);
/**
* \see setDefaultProjectionColor()
*/
KoColor defaultProjectionColor() const;
bool passThroughMode() const;
void setPassThroughMode(bool value);
QRect extent() const override;
QRect exactBounds() const override;
bool projectionIsValid() const;
protected:
KisLayer* onlyMeaningfulChild() const;
KisPaintDeviceSP tryObligeChild() const;
private:
bool checkCloneLayer(KisCloneLayerSP clone) const;
bool checkNodeRecursively(KisNodeSP node) const;
private:
struct Private;
Private * const m_d;
};
#endif // KIS_GROUP_LAYER_H_
diff --git a/libs/image/kis_idle_watcher.h b/libs/image/kis_idle_watcher.h
index ebac6e4f25..6e852c9275 100644
--- a/libs/image/kis_idle_watcher.h
+++ b/libs/image/kis_idle_watcher.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_IDLE_WATCHER_H
#define __KIS_IDLE_WATCHER_H
#include "kritaimage_export.h"
#include <QScopedPointer>
#include <QObject>
#include <QString>
#include "kis_types.h"
class KRITAIMAGE_EXPORT KisIdleWatcher : public QObject
{
Q_OBJECT
public:
KisIdleWatcher(int delay, QObject* parent = 0);
- ~KisIdleWatcher();
+ ~KisIdleWatcher() override;
bool isIdle() const;
void setTrackedImages(const QVector<KisImageSP> &images);
void setTrackedImage(KisImageSP image);
//Force to image modified state and start countdown to event
void startCountdown(void) { slotImageModified(); }
Q_SIGNALS:
void startedIdleMode();
private Q_SLOTS:
void slotImageModified();
void slotIdleCheckTick();
void startIdleCheck();
void stopIdleCheck();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_IDLE_WATCHER_H */
diff --git a/libs/image/kis_image.h b/libs/image/kis_image.h
index e38964bc45..48211b5be6 100644
--- a/libs/image/kis_image.h
+++ b/libs/image/kis_image.h
@@ -1,985 +1,985 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_H_
#define KIS_IMAGE_H_
#include <QObject>
#include <QString>
#include <QPainter>
#include <QRect>
#include <QRegion>
#include <QBitArray>
#include <KoColorConversionTransformation.h>
#include "kis_paint_device.h" // msvc cannot handle forward declarations, so include kis_paint_device here
#include "kis_types.h"
#include "kis_shared.h"
#include "kis_node_graph_listener.h"
#include "kis_node_facade.h"
#include "kis_image_interfaces.h"
#include "kis_strokes_queue_undo_result.h"
#include <kritaimage_export.h>
class KisDocument;
class KoColorSpace;
class KoColor;
class KisCompositeProgressProxy;
class KisActionRecorder;
class KisUndoStore;
class KisUndoAdapter;
class KisImageSignalRouter;
class KisPostExecutionUndoAdapter;
class KisFilterStrategy;
class KoColorProfile;
class KisLayerComposition;
class KisSpontaneousJob;
class KisImageAnimationInterface;
class KUndo2MagicString;
class KisProofingConfiguration;
namespace KisMetaData
{
class MergeStrategy;
}
/**
* This is the image class, it contains a tree of KisLayer stack and
* meta information about the image. And it also provides some
* functions to manipulate the whole image.
*/
class KRITAIMAGE_EXPORT KisImage : public QObject,
public KisStrokesFacade,
public KisStrokeUndoFacade,
public KisUpdatesFacade,
public KisProjectionUpdateListener,
public KisNodeFacade,
public KisNodeGraphListener,
public KisShared
{
Q_OBJECT
public:
/// @param colorSpace can be null. in that case it will be initialised to a default color space.
KisImage(KisUndoStore *undoStore, qint32 width, qint32 height, const KoColorSpace *colorSpace, const QString& name);
- virtual ~KisImage();
+ ~KisImage() override;
public: // KisNodeGraphListener implementation
- void aboutToAddANode(KisNode *parent, int index);
- void nodeHasBeenAdded(KisNode *parent, int index);
- void aboutToRemoveANode(KisNode *parent, int index);
- void nodeChanged(KisNode * node);
- void invalidateAllFrames();
- void notifySelectionChanged();
- void requestProjectionUpdate(KisNode *node, const QRect& rect, bool resetAnimationCache);
- void invalidateFrames(const KisTimeRange &range, const QRect &rect);
- void requestTimeSwitch(int time);
+ void aboutToAddANode(KisNode *parent, int index) override;
+ void nodeHasBeenAdded(KisNode *parent, int index) override;
+ void aboutToRemoveANode(KisNode *parent, int index) override;
+ void nodeChanged(KisNode * node) override;
+ void invalidateAllFrames() override;
+ void notifySelectionChanged() override;
+ void requestProjectionUpdate(KisNode *node, const QRect& rect, bool resetAnimationCache) override;
+ void invalidateFrames(const KisTimeRange &range, const QRect &rect) override;
+ void requestTimeSwitch(int time) override;
public: // KisProjectionUpdateListener implementation
- void notifyProjectionUpdated(const QRect &rc);
+ void notifyProjectionUpdated(const QRect &rc) override;
public:
/**
* Makes a copy of the image with all the layers. If possible, shallow
* copies of the layers are made.
*
* \p exactCopy shows if the copied image should look *exactly* the same as
* the other one (according to it's .kra xml representation). It means that
* the layers will have the same UUID keys and, therefore, you are not
* expected to use the copied image anywhere except for saving. Don't use
* this option if you plan to work with the copied image later.
*/
KisImage *clone(bool exactCopy = false);
/**
* Render the projection onto a QImage.
*/
QImage convertToQImage(qint32 x1,
qint32 y1,
qint32 width,
qint32 height,
const KoColorProfile * profile);
/**
* Render the projection onto a QImage.
* (this is an overloaded function)
*/
QImage convertToQImage(QRect imageRect,
const KoColorProfile * profile);
/**
* XXX: docs!
*/
QImage convertToQImage(const QSize& scaledImageSize, const KoColorProfile *profile);
/**
* Calls KisUpdateScheduler::lock (XXX: APIDOX -- what does that mean?)
*/
void lock();
/**
* Calls KisUpdateScheduler::unlock (XXX: APIDOX -- what does that mean?)
*/
void unlock();
/**
* Returns true if lock() has been called more often than unlock().
*/
bool locked() const;
/**
* @return the global selection object or 0 if there is none. The
* global selection is always read-write.
*/
KisSelectionSP globalSelection() const;
/**
* Retrieve the next automatic layername (XXX: fix to add option to return Mask X)
*/
QString nextLayerName(const QString &baseName = "") const;
/**
* Set the automatic layer name counter one back.
*/
void rollBackLayerName();
/**
* Resize the image to the specified rect. The resize
* method handles the creating on an undo step itself.
*
* @param newRect the rect describing the new width, height and offset
* of the image
*/
void resizeImage(const QRect& newRect);
/**
* Crop the image to the specified rect. The crop
* method handles the creating on an undo step itself.
*
* @param newRect the rect describing the new width, height and offset
* of the image
*/
void cropImage(const QRect& newRect);
/**
* Crop a node to @newRect. The node will *not* be moved anywhere,
* it just drops some content
*/
void cropNode(KisNodeSP node, const QRect& newRect);
/// XXX: ApiDox
void scaleImage(const QSize &size, qreal xres, qreal yres, KisFilterStrategy *filterStrategy);
/// XXX: ApiDox
void scaleNode(KisNodeSP node, qreal scaleX, qreal scaleY, KisFilterStrategy *filterStrategy);
/**
* Execute a rotate transform on all layers in this image.
* Image is resized to fit rotated image.
*/
void rotateImage(double radians);
/**
* Execute a rotate transform on on a subtree of this image.
* Image is not resized.
*/
void rotateNode(KisNodeSP node, double radians);
/**
* Execute a shear transform on all layers in this image.
*/
void shear(double angleX, double angleY);
/**
* Shear a node and all its children.
* @param angleX, @param angleY are given in degrees.
*/
void shearNode(KisNodeSP node, double angleX, double angleY);
/**
* Convert the image and all its layers to the dstColorSpace
*/
void convertImageColorSpace(const KoColorSpace *dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags);
/**
* Set the color space of the projection (and the root layer)
* to dstColorSpace. No conversion is done for other layers,
* their colorspace can differ.
* NOTE: Note conversion is done, only regeneration, so no rendering
* intent needed
*/
void convertProjectionColorSpace(const KoColorSpace *dstColorSpace);
// Get the profile associated with this image
const KoColorProfile * profile() const;
/**
* Set the profile of the image to the new profile and do the same for
* all layers that have the same colorspace and profile of the image.
* It doesn't do any pixel conversion.
*
* This is essential if you have loaded an image that didn't
* have an embedded profile to which you want to attach the right profile.
*
* This does not create an undo action; only call it when creating or
* loading an image.
*
* @returns false if the profile could not be assigned
*/
bool assignImageProfile(const KoColorProfile *profile);
/**
* Returns the current undo adapter. You can add new commands to the
* undo stack using the adapter. This adapter is used for a backward
* compatibility for old commands created before strokes. It blocks
* all the porcessing at the scheduler, waits until it's finished
* adn executes commands exclusively.
*/
KisUndoAdapter* undoAdapter() const;
/**
* This adapter is used by the strokes system. The commands are added
* to it *after* redo() is done (in the scheduler context). They are
* wrapped into a special command and added to the undo stack. redo()
* in not called.
*/
- KisPostExecutionUndoAdapter* postExecutionUndoAdapter() const;
+ KisPostExecutionUndoAdapter* postExecutionUndoAdapter() const override;
/**
* Replace current undo store with the new one. The old store
* will be deleted.
* This method is used by KisDocument for dropping all the commands
* during file loading.
*/
void setUndoStore(KisUndoStore *undoStore);
/**
* Return current undo store of the image
*/
KisUndoStore* undoStore();
/**
* @return the action recorder associated with this image
*/
KisActionRecorder* actionRecorder() const;
/**
* Tell the image it's modified; this emits the sigImageModified
* signal. This happens when the image needs to be saved
*/
void setModified();
/**
* The default colorspace of this image: new layers will have this
* colorspace and the projection will have this colorspace.
*/
const KoColorSpace * colorSpace() const;
/**
* X resolution in pixels per pt
*/
double xRes() const;
/**
* Y resolution in pixels per pt
*/
double yRes() const;
/**
* Set the resolution in pixels per pt.
*/
void setResolution(double xres, double yres);
/**
* Convert a document coordinate to a pixel coordinate.
*
* @param documentCoord PostScript Pt coordinate to convert.
*/
QPointF documentToPixel(const QPointF &documentCoord) const;
/**
* Convert a document coordinate to an integer pixel coordinate.
*
* @param documentCoord PostScript Pt coordinate to convert.
*/
QPoint documentToIntPixel(const QPointF &documentCoord) const;
/**
* Convert a document rectangle to a pixel rectangle.
*
* @param documentRect PostScript Pt rectangle to convert.
*/
QRectF documentToPixel(const QRectF &documentRect) const;
/**
* Convert a document rectangle to an integer pixel rectangle.
*
* @param documentRect PostScript Pt rectangle to convert.
*/
QRect documentToIntPixel(const QRectF &documentRect) const;
/**
* Convert a pixel coordinate to a document coordinate.
*
* @param pixelCoord pixel coordinate to convert.
*/
QPointF pixelToDocument(const QPointF &pixelCoord) const;
/**
* Convert an integer pixel coordinate to a document coordinate.
* The document coordinate is at the centre of the pixel.
*
* @param pixelCoord pixel coordinate to convert.
*/
QPointF pixelToDocument(const QPoint &pixelCoord) const;
/**
* Convert a document rectangle to an integer pixel rectangle.
*
* @param pixelCoord pixel coordinate to convert.
*/
QRectF pixelToDocument(const QRectF &pixelCoord) const;
/**
* Return the width of the image
*/
qint32 width() const;
/**
* Return the height of the image
*/
qint32 height() const;
/**
* Return the size of the image
*/
QSize size() const {
return QSize(width(), height());
}
/**
* @return the root node of the image node graph
*/
KisGroupLayerSP rootLayer() const;
/**
* Return the projection; that is, the complete, composited
* representation of this image.
*/
KisPaintDeviceSP projection() const;
/**
* Return the number of layers (not other nodes) that are in this
* image.
*/
qint32 nlayers() const;
/**
* Return the number of layers (not other node types) that are in
* this image and that are hidden.
*/
qint32 nHiddenLayers() const;
/**
* Merge all visible layers and discard hidden ones.
*/
void flatten();
/**
* Merge the specified layer with the layer
* below this layer, remove the specified layer.
*/
void mergeDown(KisLayerSP l, const KisMetaData::MergeStrategy* strategy);
/**
* flatten the layer: that is, the projection becomes the layer
* and all subnodes are removed. If this is not a paint layer, it will morph
* into a paint layer.
*/
void flattenLayer(KisLayerSP layer);
/**
* Merges layers in \p mergedLayers and creates a new layer above
* \p putAfter
*/
void mergeMultipleLayers(QList<KisNodeSP> mergedLayers, KisNodeSP putAfter);
/// @return the exact bounds of the image in pixel coordinates.
QRect bounds() const;
/**
* Returns the actual bounds of the image, taking LevelOfDetail
* into account. This value is used as a bounds() value of
* KisDefaultBounds object.
*/
QRect effectiveLodBounds() const;
/// use if the layers have changed _completely_ (eg. when flattening)
void notifyLayersChanged();
/**
* Sets the default color of the root layer projection. All the layers
* will be merged on top of this very color
*/
void setDefaultProjectionColor(const KoColor &color);
/**
* \see setDefaultProjectionColor()
*/
KoColor defaultProjectionColor() const;
void setRootLayer(KisGroupLayerSP rootLayer);
/**
* Add an annotation for this image. This can be anything: Gamma, EXIF, etc.
* Note that the "icc" annotation is reserved for the color strategies.
* If the annotation already exists, overwrite it with this one.
*/
void addAnnotation(KisAnnotationSP annotation);
/** get the annotation with the given type, can return 0 */
KisAnnotationSP annotation(const QString& type);
/** delete the annotation, if the image contains it */
void removeAnnotation(const QString& type);
/**
* Start of an iteration over the annotations of this image (including the ICC Profile)
*/
vKisAnnotationSP_it beginAnnotations();
/** end of an iteration over the annotations of this image */
vKisAnnotationSP_it endAnnotations();
/**
* Called before the image is delted and sends the sigAboutToBeDeleted signal
*/
void notifyAboutToBeDeleted();
KisImageSignalRouter* signalRouter();
/**
* Returns whether we can reselect current global selection
*
* \see reselectGlobalSelection()
*/
bool canReselectGlobalSelection();
/**
* Returns the layer compositions for the image
*/
QList<KisLayerCompositionSP> compositions();
/**
* Adds a new layer composition, will be saved with the image
*/
void addComposition(KisLayerCompositionSP composition);
/**
* Remove the layer compostion
*/
void removeComposition(KisLayerCompositionSP composition);
/**
* Permit or deny the wrap-around mode for all the paint devices
* of the image. Note that permitting the wraparound mode will not
* necessarily activate it right now. To be activated the wrap
* around mode should be 1) permitted; 2) supported by the
* currently running stroke.
*/
void setWrapAroundModePermitted(bool value);
/**
* \return whether the wrap-around mode is permitted for this
* image. If the wrap around mode is permitted and the
* currently running stroke supports it, the mode will be
* activated for all paint devices of the image.
*
* \see setWrapAroundMode
*/
bool wrapAroundModePermitted() const;
/**
* \return whether the wraparound mode is activated for all the
* devices of the image. The mode is activated when both
* factors are true: the user permitted it and the stroke
* supports it
*/
bool wrapAroundModeActive() const;
/**
* \return curent level of detail which is used when processing the image.
* Current working zoom = 2 ^ (- currentLevelOfDetail()). Default value is
* null, which means we work on the original image.
*/
int currentLevelOfDetail() const;
/**
* Notify KisImage which level of detail should be used in the
* lod-mode. Setting the mode does not guarantee the LOD to be
* used. It will be activated only when the stokes supports it.
*/
void setDesiredLevelOfDetail(int lod);
/**
* Relative position of the mirror axis center
* 0,0 - topleft corner of the image
* 1,1 - bottomright corner of the image
*/
QPointF mirrorAxesCenter() const;
/**
* Sets the relative position of the axes center
* \see mirrorAxesCenter() for details
*/
void setMirrorAxesCenter(const QPointF &value) const;
public Q_SLOTS:
/**
* Explicitly start regeneration of LoD planes of all the devices
* in the image. This call should be performed when the user is idle,
* just to make the quality of image updates better.
*/
void explicitRegenerateLevelOfDetail();
public:
/**
* Blocks usage of level of detail functionality. After this method
* has been called, no new strokes will use LoD.
*/
void setLevelOfDetailBlocked(bool value);
/**
* \see setLevelOfDetailBlocked()
*/
bool levelOfDetailBlocked() const;
/**
* Notifies that the node collapsed state has changed
*/
void notifyNodeCollpasedChanged();
KisImageAnimationInterface *animationInterface() const;
/**
* @brief setProofingConfiguration, this sets the image's proofing configuration, and signals
* the proofingConfiguration has changed.
* @param proofingConfig - the kis proofing config that will be used instead.
*/
void setProofingConfiguration(KisProofingConfigurationSP proofingConfig);
/**
* @brief proofingConfiguration
* @return the proofing configuration of the image.
*/
KisProofingConfigurationSP proofingConfiguration() const;
public:
bool startIsolatedMode(KisNodeSP node);
void stopIsolatedMode();
KisNodeSP isolatedModeRoot() const;
Q_SIGNALS:
/**
* Emitted whenever an action has caused the image to be
* recomposited.
*
* @param rc The rect that has been recomposited.
*/
void sigImageUpdated(const QRect &);
/**
Emitted whenever the image has been modified, so that it
doesn't match with the version saved on disk.
*/
void sigImageModified();
/**
* The signal is emitted when the size of the image is changed.
* \p oldStillPoint and \p newStillPoint give the receiver the
* hint about how the new and old rect of the image correspond to
* each other. They specify the point of the image around which
* the conversion was done. This point will stay still on the
* user's screen. That is the \p newStillPoint of the new image
* will be painted at the same screen position, where \p
* oldStillPoint of the old image was painted.
*
* \param oldStillPoint is a still point represented in *old*
* image coordinates
*
* \param newStillPoint is a still point represented in *new*
* image coordinates
*/
void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint);
void sigProfileChanged(const KoColorProfile * profile);
void sigColorSpaceChanged(const KoColorSpace* cs);
void sigResolutionChanged(double xRes, double yRes);
void sigRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes);
/**
* Inform the model that a node was changed
*/
void sigNodeChanged(KisNodeSP node);
/**
* Inform that the image is going to be deleted
*/
void sigAboutToBeDeleted();
/**
* The signal is emitted right after a node has been connected
* to the graph of the nodes.
*
* WARNING: you must not request any graph-related information
* about the node being run in a not-scheduler thread. If you need
* information about the parent/siblings of the node connect
* with Qt::DirectConnection, get needed information and then
* emit another Qt::AutoConnection signal to pass this information
* to your thread. See details of the implementation
* in KisDummiesfacadeBase.
*/
void sigNodeAddedAsync(KisNodeSP node);
/**
* This signal is emitted right before a node is going to removed
* from the graph of the nodes.
*
* WARNING: you must not request any graph-related information
* about the node being run in a not-scheduler thread.
*
* \see comment in sigNodeAddedAsync()
*/
void sigRemoveNodeAsync(KisNodeSP node);
/**
* Emitted when the root node of the image has changed.
* It happens, e.g. when we flatten the image. When
* this happens the receiver should reload information
* about the image
*/
void sigLayersChangedAsync();
/**
* Emitted when the UI has requested the undo of the last stroke's
* operation. The point is, we cannot deal with the internals of
* the stroke without its creator knowing about it (which most
* probably cause a crash), so we just forward this request from
* the UI to the creator of the stroke.
*
* If your tool supports undoing part of its work, just listen to
* this signal and undo when it comes
*/
void sigUndoDuringStrokeRequested();
/**
* Emitted when the UI has requested the cancellation of
* the stroke. The point is, we cannot cancel the stroke
* without its creator knowing about it (which most probably
* cause a crash), so we just forward this request from the UI
* to the creator of the stroke.
*
* If your tool supports cancelling of its work in the middle
* of operation, just listen to this signal and cancel
* the stroke when it comes
*/
void sigStrokeCancellationRequested();
/**
* Emitted when the image decides that the stroke should better
* be ended. The point is, we cannot just end the stroke
* without its creator knowing about it (which most probably
* cause a crash), so we just forward this request from the UI
* to the creator of the stroke.
*
* If your tool supports long strokes that may involve multiple
* mouse actions in one stroke, just listen to this signal and
* end the stroke when it comes.
*/
void sigStrokeEndRequested();
/**
* Same as sigStrokeEndRequested() but is not emitted when the active node
* is changed.
*/
void sigStrokeEndRequestedActiveNodeFiltered();
/**
* Emitted when the isolated mode status has changed.
*
* Can be used by the receivers to catch a fact of forcefully
* stopping the isolated mode by the image when some complex
* action was requested
*/
void sigIsolatedModeChanged();
/**
* Emitted when one or more nodes changed the collapsed state
*
*/
void sigNodeCollapsedChanged();
/**
* Emitted when the proofing configuration of the image is being changed.
*
*/
void sigProofingConfigChanged();
public Q_SLOTS:
KisCompositeProgressProxy* compositeProgressProxy();
bool isIdle(bool allowLocked = false);
/**
* @brief barrierLock APIDOX
* @param readOnly
*/
void barrierLock(bool readOnly = false);
/**
* @brief barrierLock APIDOX
* @param readOnly
*/
bool tryBarrierLock(bool readOnly = false);
/**
* @brief barrierLock APIDOX
* @param readOnly
*/
void waitForDone();
- KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy);
- void addJob(KisStrokeId id, KisStrokeJobData *data);
- void endStroke(KisStrokeId id);
- bool cancelStroke(KisStrokeId id);
+ KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override;
+ void addJob(KisStrokeId id, KisStrokeJobData *data) override;
+ void endStroke(KisStrokeId id) override;
+ bool cancelStroke(KisStrokeId id) override;
/**
* @brief blockUpdates block updating the image projection
*/
- void blockUpdates();
+ void blockUpdates() override;
/**
* @brief unblockUpdates unblock updating the image project. This
* only restarts the scheduler and does not schedule a full refresh.
*/
- void unblockUpdates();
+ void unblockUpdates() override;
/**
* Disables notification of the UI about the changes in the image.
* This feature is used by KisProcessingApplicator. It is needed
* when we change the size of the image. In this case, the whole
* image will be reloaded into UI by sigSizeChanged(), so there is
* no need to inform the UI about individual dirty rects.
*/
- void disableUIUpdates();
+ void disableUIUpdates() override;
/**
* \see disableUIUpdates
*/
- void enableUIUpdates();
+ void enableUIUpdates() override;
/**
* Disables the processing of all the setDirty() requests that
* come to the image. The incoming requests are effectively
* *dropped*.
*
* This feature is used by KisProcessingApplicator. For many cases
* it provides its own updates interface, which recalculates the
* whole subtree of nodes. But while we change any particular
* node, it can ask for an update itself. This method is a way of
* blocking such intermediate (and excessive) requests.
*
* NOTE: this is a convenience function for setProjectionUpdatesFilter()
* that installs a predefined filter that eats everything. Please
* note that these calls are *not* recursive
*/
- void disableDirtyRequests();
+ void disableDirtyRequests() override;
/**
* \see disableDirtyRequests()
*/
- void enableDirtyRequests();
+ void enableDirtyRequests() override;
/**
* Installs a filter object that will filter all the incoming projection update
* requests. If the filter return true, the incoming update is dropped.
*
* NOTE: you cannot set filters recursively!
*/
- void setProjectionUpdatesFilter(KisProjectionUpdatesFilterSP filter);
+ void setProjectionUpdatesFilter(KisProjectionUpdatesFilterSP filter) override;
/**
* \see setProjectionUpdatesFilter()
*/
- KisProjectionUpdatesFilterSP projectionUpdatesFilter() const;
+ KisProjectionUpdatesFilterSP projectionUpdatesFilter() const override;
- void refreshGraphAsync(KisNodeSP root = KisNodeSP());
- void refreshGraphAsync(KisNodeSP root, const QRect &rc);
- void refreshGraphAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect);
+ void refreshGraphAsync(KisNodeSP root = KisNodeSP()) override;
+ void refreshGraphAsync(KisNodeSP root, const QRect &rc) override;
+ void refreshGraphAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect) override;
/**
* Triggers synchronous recomposition of the projection
*/
void refreshGraph(KisNodeSP root = KisNodeSP());
void refreshGraph(KisNodeSP root, const QRect& rc, const QRect &cropRect);
void initialRefreshGraph();
/**
* Initiate a stack regeneration skipping the recalculation of the
* filthy node's projection.
*
* Works exactly as pseudoFilthy->setDirty() with the only
* exception that pseudoFilthy::updateProjection() will not be
* called. That is used by KisRecalculateTransformMaskJob to avoid
* cyclic dependencies.
*/
void requestProjectionUpdateNoFilthy(KisNodeSP pseudoFilthy, const QRect &rc, const QRect &cropRect);
/**
* Adds a spontaneous job to the updates queue.
*
* A spontaneous job may do some trivial tasks in the background,
* like updating the outline of selection or purging unused tiles
* from the existing paint devices.
*/
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);
/**
* This method is called by the UI (*not* by the creator of the
* stroke) when it thinks the current stroke should undo its last
* action, for example, when the user presses Ctrl+Z while some
* stroke is active.
*
* If the creator of the stroke supports undoing of intermediate
* actions, it will be notified about this request and can undo
* its last action.
*/
void requestUndoDuringStroke();
/**
* This method is called by the UI (*not* by the creator of the
* stroke) when it thinks current stroke should be cancelled. If
* there is a running stroke that has already been detached from
* its creator (ended or cancelled), it will be forcefully
* cancelled and reverted. If there is an open stroke present, and
* if its creator supports cancelling, it will be notified about
* the request and the stroke will be cancelled
*/
void requestStrokeCancellation();
/**
* This method requests the last stroke executed on the image to become undone.
* If the stroke is not ended, or if all the Lod0 strokes are completed, the method
* returns UNDO_FAIL. If the last Lod0 is going to be finished soon, then UNDO_WAIT
* is returned and the caller should just wait for its completion and call global undo
* instead. UNDO_OK means one unfinished stroke has been undone.
*/
UndoResult tryUndoUnfinishedLod0Stroke();
/**
* This method is called when image or some other part of Krita
* (*not* the creator of the stroke) decides that the stroke
* should be ended. If the creator of the stroke supports it, it
* will be notified and the stroke will be cancelled
*/
void requestStrokeEnd();
/**
* Same as requestStrokeEnd() but is called by view manager when
* the current node is changed. Use to dintinguish
* sigStrokeEndRequested() and
* sigStrokeEndRequestedActiveNodeFiltered() which are used by
* KisNodeJugglerCompressed
*/
void requestStrokeEndActiveNode();
private:
KisImage(const KisImage& rhs, KisUndoStore *undoStore, bool exactCopy);
KisImage& operator=(const KisImage& rhs);
void emitSizeChanged();
void resizeImageImpl(const QRect& newRect, bool cropLayers);
void rotateImpl(const KUndo2MagicString &actionName, KisNodeSP rootNode,
bool resizeImage, double radians);
void shearImpl(const KUndo2MagicString &actionName, KisNodeSP rootNode,
bool resizeImage, double angleX, double angleY,
const QPointF &origin);
void safeRemoveTwoNodes(KisNodeSP node1, KisNodeSP node2);
void refreshHiddenArea(KisNodeSP rootNode, const QRect &preparedArea);
void requestProjectionUpdateImpl(KisNode *node,
const QRect& rect,
const QRect &cropRect);
friend class KisImageResizeCommand;
void setSize(const QSize& size);
friend class KisImageSetProjectionColorSpaceCommand;
void setProjectionColorSpace(const KoColorSpace * colorSpace);
friend class KisDeselectGlobalSelectionCommand;
friend class KisReselectGlobalSelectionCommand;
friend class KisSetGlobalSelectionCommand;
friend class KisImageTest;
friend class Document; // For libkis
/**
* Replaces the current global selection with globalSelection. If
* \p globalSelection is empty, removes the selection object, so that
* \ref globalSelection() will return 0 after that.
*/
void setGlobalSelection(KisSelectionSP globalSelection);
/**
* Deselects current global selection.
* \ref globalSelection() will return 0 after that.
*/
void deselectGlobalSelection();
/**
* Reselects current deselected selection
*
* \see deselectGlobalSelection()
*/
void reselectGlobalSelection();
private:
class KisImagePrivate;
KisImagePrivate * m_d;
};
#endif // KIS_IMAGE_H_
diff --git a/libs/image/kis_image_animation_interface.h b/libs/image/kis_image_animation_interface.h
index f9af07ccff..04a400d151 100644
--- a/libs/image/kis_image_animation_interface.h
+++ b/libs/image/kis_image_animation_interface.h
@@ -1,208 +1,208 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_IMAGE_ANIMATION_INTERFACE_H
#define __KIS_IMAGE_ANIMATION_INTERFACE_H
#include <QObject>
#include <QScopedPointer>
#include "kis_types.h"
#include "kritaimage_export.h"
class KisUpdatesFacade;
class KisTimeRange;
class KoColor;
namespace KisLayerUtils {
struct SwitchFrameCommand;
}
class KRITAIMAGE_EXPORT KisImageAnimationInterface : public QObject
{
Q_OBJECT
public:
KisImageAnimationInterface(KisImage *image);
KisImageAnimationInterface(const KisImageAnimationInterface &rhs, KisImage *newImage);
- ~KisImageAnimationInterface();
+ ~KisImageAnimationInterface() override;
/**
* Returns true of the image has at least one animated layer
*/
bool hasAnimation() const;
/**
* Returns currently active frame of the underlying image. Some strokes
* can override this value and it will report a different value.
*/
int currentTime() const;
/**
* Same as currentTime, except it isn't changed when background strokes
* are running.
*/
int currentUITime() const;
/**
* While any non-current frame is being regenerated by the
* strategy, the image is kept in a special state, named
* 'externalFrameActive'. Is this state the following applies:
*
* 1) All the animated paint devices switch its state into
* frameId() defined by global time.
*
* 2) All animation-not-capable devices switch to a temporary
* content device, which *is in undefined state*. The stroke
* should regenerate the image projection manually.
*/
bool externalFrameActive() const;
void requestTimeSwitchWithUndo(int time);
void requestTimeSwitchNonGUI(int time, bool useUndo = false);
public Q_SLOTS:
/**
* Switches current frame (synchronously) and starts an
* asynchronous regeneration of the entire image.
*/
void switchCurrentTimeAsync(int frameId, bool useUndo = false);
public:
/**
* Start a backgroud thread that will recalculate some extra frame.
* The result will be reported using two types of signals:
*
* 1) KisImage::sigImageUpdated() will be emitted for every chunk
* of updated area.
*
* 2) sigFrameReady() will be emitted in the end of the operation.
* IMPORTANT: to get the result you must connect to this signal
* with Qt::DirectConnection and fetch the result from
* frameProjection(). After the signal handler is exited, the
* data will no longer be available.
*/
void requestFrameRegeneration(int frameId, const QRegion &dirtyRegion);
void notifyNodeChanged(const KisNode *node, const QRect &rect, bool recursive);
void invalidateFrames(const KisTimeRange &range, const QRect &rect);
/**
* Changes the default color of the "external frame" projection of
* the image's root layer. Please note that this command should be
* executed from a context of an exclusive job!
*/
void setDefaultProjectionColor(const KoColor &color);
/**
* The current time range selected by user.
* @return current time range
*/
const KisTimeRange& fullClipRange() const;
void setFullClipRange(const KisTimeRange range);
const KisTimeRange &playbackRange() const;
void setPlaybackRange(const KisTimeRange range);
int framerate() const;
/**
* @return **absolute** file name of the audio channel file
*/
QString audioChannelFileName() const;
/**
* Sets **absolute** file name of the audio channel file. Dont' try to pass
* a relative path, it'll assert!
*/
void setAudioChannelFileName(const QString &fileName);
/**
* @return is the audio channel is currently muted
*/
bool isAudioMuted() const;
/**
* Mutes the audio channel
*/
void setAudioMuted(bool value);
/**
* Returns the preferred audio value in rangle [0, 1]
*/
qreal audioVolume() const;
/**
* Set the preferred volume for the audio channel in range [0, 1]
*/
void setAudioVolume(qreal value);
public Q_SLOTS:
void setFramerate(int fps);
public:
KisImageWSP image() const;
int totalLength();
private:
// interface for:
friend class KisRegenerateFrameStrokeStrategy;
friend class KisAnimationFrameCacheTest;
friend struct KisLayerUtils::SwitchFrameCommand;
friend class KisImageTest;
void saveAndResetCurrentTime(int frameId, int *savedValue);
void restoreCurrentTime(int *savedValue);
void notifyFrameReady();
void notifyFrameCancelled();
KisUpdatesFacade* updatesFacade() const;
void blockFrameInvalidation(bool value);
friend class KisSwitchTimeStrokeStrategy;
void explicitlySetCurrentTime(int frameId);
Q_SIGNALS:
void sigFrameReady(int time);
void sigFrameCancelled();
void sigUiTimeChanged(int newTime);
void sigFramesChanged(const KisTimeRange &range, const QRect &rect);
void sigInternalRequestTimeSwitch(int frameId, bool useUndo);
void sigFramerateChanged();
void sigFullClipRangeChanged();
void sigPlaybackRangeChanged();
/**
* Emitted when the audio channel of the document is changed
*/
void sigAudioChannelChanged();
/**
* Emitted when audion volume changes. Please note that it doesn't change
* when you mute the channel! When muting, sigAudioChannelChanged() is used instead!
*/
void sigAudioVolumeChanged();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_IMAGE_ANIMATION_INTERFACE_H */
diff --git a/libs/image/kis_image_config.cpp b/libs/image/kis_image_config.cpp
index 0258ccc41a..3910efc653 100644
--- a/libs/image/kis_image_config.cpp
+++ b/libs/image/kis_image_config.cpp
@@ -1,455 +1,455 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_image_config.h"
#include <ksharedconfig.h>
#include <KoConfig.h>
#include <KoColorProfile.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorConversionTransformation.h>
#include "kis_debug.h"
#include <QThread>
#include <QApplication>
#include <QColor>
#include <QDir>
#include "kis_global.h"
#include <cmath>
#ifdef Q_OS_OSX
#include <errno.h>
#endif
KisImageConfig::KisImageConfig(bool readOnly)
: m_config( KSharedConfig::openConfig()->group(QString())),
m_readOnly(readOnly)
{
}
KisImageConfig::~KisImageConfig()
{
if (m_readOnly) return;
if (qApp->thread() != QThread::currentThread()) {
dbgKrita << "KisImageConfig: requested config synchronization from nonGUI thread! Called from" << kisBacktrace();
return;
}
m_config.sync();
}
bool KisImageConfig::enableProgressReporting(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("enableProgressReporting", true) : true;
}
void KisImageConfig::setEnableProgressReporting(bool value)
{
m_config.writeEntry("enableProgressReporting", value);
}
bool KisImageConfig::enablePerfLog(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("enablePerfLog", false) :false;
}
void KisImageConfig::setEnablePerfLog(bool value)
{
m_config.writeEntry("enablePerfLog", value);
}
qreal KisImageConfig::transformMaskOffBoundsReadArea() const
{
return m_config.readEntry("transformMaskOffBoundsReadArea", 0.5);
}
int KisImageConfig::updatePatchHeight() const
{
return m_config.readEntry("updatePatchHeight", 512);
}
void KisImageConfig::setUpdatePatchHeight(int value)
{
m_config.writeEntry("updatePatchHeight", value);
}
int KisImageConfig::updatePatchWidth() const
{
return m_config.readEntry("updatePatchWidth", 512);
}
void KisImageConfig::setUpdatePatchWidth(int value)
{
m_config.writeEntry("updatePatchWidth", value);
}
qreal KisImageConfig::maxCollectAlpha() const
{
return m_config.readEntry("maxCollectAlpha", 2.5);
}
qreal KisImageConfig::maxMergeAlpha() const
{
return m_config.readEntry("maxMergeAlpha", 1.);
}
qreal KisImageConfig::maxMergeCollectAlpha() const
{
return m_config.readEntry("maxMergeCollectAlpha", 1.5);
}
qreal KisImageConfig::schedulerBalancingRatio() const
{
/**
* updates-queue-size / strokes-queue-size
*/
return m_config.readEntry("schedulerBalancingRatio", 100.);
}
void KisImageConfig::setSchedulerBalancingRatio(qreal value)
{
m_config.writeEntry("schedulerBalancingRatio", value);
}
int KisImageConfig::maxSwapSize(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("maxSwapSize", 4096) : 4096; // in MiB
}
void KisImageConfig::setMaxSwapSize(int value)
{
m_config.writeEntry("maxSwapSize", value);
}
int KisImageConfig::swapSlabSize() const
{
return m_config.readEntry("swapSlabSize", 64); // in MiB
}
void KisImageConfig::setSwapSlabSize(int value)
{
m_config.writeEntry("swapSlabSize", value);
}
int KisImageConfig::swapWindowSize() const
{
return m_config.readEntry("swapWindowSize", 16); // in MiB
}
void KisImageConfig::setSwapWindowSize(int value)
{
m_config.writeEntry("swapWindowSize", value);
}
int KisImageConfig::tilesHardLimit() const
{
qreal hp = qreal(memoryHardLimitPercent()) / 100.0;
qreal pp = qreal(memoryPoolLimitPercent()) / 100.0;
return totalRAM() * hp * (1 - pp);
}
int KisImageConfig::tilesSoftLimit() const
{
qreal sp = qreal(memorySoftLimitPercent()) / 100.0;
return tilesHardLimit() * sp;
}
int KisImageConfig::poolLimit() const
{
qreal hp = qreal(memoryHardLimitPercent()) / 100.0;
qreal pp = qreal(memoryPoolLimitPercent()) / 100.0;
return totalRAM() * hp * pp;
}
qreal KisImageConfig::memoryHardLimitPercent(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("memoryHardLimitPercent", 50.) : 50.;
}
void KisImageConfig::setMemoryHardLimitPercent(qreal value)
{
m_config.writeEntry("memoryHardLimitPercent", value);
}
qreal KisImageConfig::memorySoftLimitPercent(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("memorySoftLimitPercent", 2.) : 2.;
}
void KisImageConfig::setMemorySoftLimitPercent(qreal value)
{
m_config.writeEntry("memorySoftLimitPercent", value);
}
qreal KisImageConfig::memoryPoolLimitPercent(bool requestDefault) const
{
return !requestDefault ?
- m_config.readEntry("memoryPoolLimitPercent", 2.) : 2.;
+ m_config.readEntry("memoryPoolLimitPercent", 0.0) : 0.0;
}
void KisImageConfig::setMemoryPoolLimitPercent(qreal value)
{
m_config.writeEntry("memoryPoolLimitPercent", value);
}
QString KisImageConfig::swapDir(bool requestDefault)
{
QString swap = QDir::tempPath();
return !requestDefault ?
m_config.readEntry("swaplocation", swap) : swap;
}
void KisImageConfig::setSwapDir(const QString &swapDir)
{
m_config.writeEntry("swaplocation", swapDir);
}
int KisImageConfig::numberOfOnionSkins() const
{
return m_config.readEntry("numberOfOnionSkins", 10);
}
void KisImageConfig::setNumberOfOnionSkins(int value)
{
m_config.writeEntry("numberOfOnionSkins", value);
}
int KisImageConfig::onionSkinTintFactor() const
{
return m_config.readEntry("onionSkinTintFactor", 192);
}
void KisImageConfig::setOnionSkinTintFactor(int value)
{
m_config.writeEntry("onionSkinTintFactor", value);
}
int KisImageConfig::onionSkinOpacity(int offset) const
{
int value = m_config.readEntry("onionSkinOpacity_" + QString::number(offset), -1);
if (value < 0) {
const int num = numberOfOnionSkins();
const qreal dx = qreal(qAbs(offset)) / num;
value = 0.7 * exp(-pow2(dx) / 0.5) * 255;
}
return value;
}
void KisImageConfig::setOnionSkinOpacity(int offset, int value)
{
m_config.writeEntry("onionSkinOpacity_" + QString::number(offset), value);
}
bool KisImageConfig::onionSkinState(int offset) const
{
bool enableByDefault = (qAbs(offset) <= 2);
return m_config.readEntry("onionSkinState_" + QString::number(offset), enableByDefault);
}
void KisImageConfig::setOnionSkinState(int offset, bool value)
{
m_config.writeEntry("onionSkinState_" + QString::number(offset), value);
}
QColor KisImageConfig::onionSkinTintColorBackward() const
{
return m_config.readEntry("onionSkinTintColorBackward", QColor(Qt::red));
}
void KisImageConfig::setOnionSkinTintColorBackward(const QColor &value)
{
m_config.writeEntry("onionSkinTintColorBackward", value);
}
QColor KisImageConfig::onionSkinTintColorForward() const
{
return m_config.readEntry("oninSkinTintColorForward", QColor(Qt::green));
}
void KisImageConfig::setOnionSkinTintColorForward(const QColor &value)
{
m_config.writeEntry("oninSkinTintColorForward", value);
}
bool KisImageConfig::lazyFrameCreationEnabled(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("lazyFrameCreationEnabled", true) : true;
}
void KisImageConfig::setLazyFrameCreationEnabled(bool value)
{
m_config.writeEntry("lazyFrameCreationEnabled", value);
}
#if defined Q_OS_LINUX
#include <sys/sysinfo.h>
#elif defined Q_OS_FREEBSD || defined Q_OS_NETBSD || defined Q_OS_OPENBSD
#include <sys/sysctl.h>
#elif defined Q_OS_WIN
#include <windows.h>
#elif defined Q_OS_OSX
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#include <kis_debug.h>
int KisImageConfig::totalRAM()
{
// let's think that default memory size is 1000MiB
int totalMemory = 1000; // MiB
int error = 1;
#if defined Q_OS_LINUX
struct sysinfo info;
error = sysinfo(&info);
if(!error) {
totalMemory = info.totalram * info.mem_unit / (1UL << 20);
}
#elif defined Q_OS_FREEBSD || defined Q_OS_NETBSD || defined Q_OS_OPENBSD
u_long physmem;
# if defined HW_PHYSMEM64 // NetBSD only
int mib[] = {CTL_HW, HW_PHYSMEM64};
# else
int mib[] = {CTL_HW, HW_PHYSMEM};
# endif
size_t len = sizeof(physmem);
error = sysctl(mib, 2, &physmem, &len, 0, 0);
if(!error) {
totalMemory = physmem >> 20;
}
#elif defined Q_OS_WIN
MEMORYSTATUSEX status;
status.dwLength = sizeof(status);
error = !GlobalMemoryStatusEx(&status);
if (!error) {
totalMemory = status.ullTotalPhys >> 20;
}
// For 32 bit windows, the total memory available is at max the 2GB per process memory limit.
# if defined ENV32BIT
totalMemory = qMin(totalMemory, 2000);
# endif
#elif defined Q_OS_OSX
int mib[2] = { CTL_HW, HW_MEMSIZE };
u_int namelen = sizeof(mib) / sizeof(mib[0]);
uint64_t size;
size_t len = sizeof(size);
errno = 0;
if (sysctl(mib, namelen, &size, &len, 0, 0) >= 0) {
totalMemory = size >> 20;
error = 0;
}
else {
dbgKrita << "sysctl(\"hw.memsize\") raised error" << strerror(errno);
}
#endif
if (error) {
warnKrita << "Cannot get the size of your RAM. Using 1 GiB by default.";
}
return totalMemory;
}
bool KisImageConfig::showAdditionalOnionSkinsSettings(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("showAdditionalOnionSkinsSettings", true) : true;
}
void KisImageConfig::setShowAdditionalOnionSkinsSettings(bool value)
{
m_config.writeEntry("showAdditionalOnionSkinsSettings", value);
}
int KisImageConfig::defaultFrameColorLabel() const
{
return m_config.readEntry("defaultFrameColorLabel", 0);
}
void KisImageConfig::setDefaultFrameColorLabel(int label)
{
m_config.writeEntry("defaultFrameColorLabel", label);
}
KisProofingConfigurationSP KisImageConfig::defaultProofingconfiguration()
{
KisProofingConfiguration *proofingConfig= new KisProofingConfiguration();
proofingConfig->proofingProfile = m_config.readEntry("defaultProofingProfileName", "Chemical proof");
proofingConfig->proofingModel = m_config.readEntry("defaultProofingProfileModel", "CMYKA");
proofingConfig->proofingDepth = m_config.readEntry("defaultProofingProfileDepth", "U8");
proofingConfig->intent = (KoColorConversionTransformation::Intent)m_config.readEntry("defaultProofingProfileIntent", 3);
if (m_config.readEntry("defaultProofingBlackpointCompensation", true)) {
proofingConfig->conversionFlags |= KoColorConversionTransformation::ConversionFlag::BlackpointCompensation;
} else {
proofingConfig->conversionFlags = proofingConfig->conversionFlags & ~KoColorConversionTransformation::ConversionFlag::BlackpointCompensation;
}
QColor def(Qt::green);
m_config.readEntry("defaultProofingGamutwarning", def);
KoColor col(KoColorSpaceRegistry::instance()->rgb8());
col.fromQColor(def);
col.setOpacity(1.0);
proofingConfig->warningColor = col;
proofingConfig->adaptationState = (double)m_config.readEntry("defaultProofingAdaptationState", 1.0);
return toQShared(proofingConfig);
}
void KisImageConfig::setDefaultProofingConfig(const KoColorSpace *proofingSpace, int proofingIntent, bool blackPointCompensation, KoColor warningColor, double adaptationState)
{
m_config.writeEntry("defaultProofingProfileName", proofingSpace->profile()->name());
m_config.writeEntry("defaultProofingProfileModel", proofingSpace->colorModelId().id());
m_config.writeEntry("defaultProofingProfileDepth", proofingSpace->colorDepthId().id());
m_config.writeEntry("defaultProofingProfileIntent", proofingIntent);
m_config.writeEntry("defaultProofingBlackpointCompensation", blackPointCompensation);
QColor c;
c = warningColor.toQColor();
m_config.writeEntry("defaultProofingGamutwarning", c);
m_config.writeEntry("defaultProofingAdaptationState",adaptationState);
}
bool KisImageConfig::useLodForColorizeMask(bool requestDefault) const
{
return !requestDefault ?
m_config.readEntry("useLodForColorizeMask", false) : false;
}
void KisImageConfig::setUseLodForColorizeMask(bool value)
{
m_config.writeEntry("useLodForColorizeMask", value);
}
diff --git a/libs/image/kis_image_signal_router.h b/libs/image/kis_image_signal_router.h
index 16e6f7e7ab..be8f68c66e 100644
--- a/libs/image/kis_image_signal_router.h
+++ b/libs/image/kis_image_signal_router.h
@@ -1,178 +1,178 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_IMAGE_SIGNAL_ROUTER_H
#define __KIS_IMAGE_SIGNAL_ROUTER_H
#include <QObject>
#include <QVector>
#include <QRectF>
#include "kritaimage_export.h"
#include "kis_types.h"
class KoColorSpace;
class KoColorProfile;
enum KisImageSignalTypeEnum {
LayersChangedSignal,
ModifiedSignal,
SizeChangedSignal,
ProfileChangedSignal,
ColorSpaceChangedSignal,
ResolutionChangedSignal,
NodeReselectionRequestSignal
};
/**
* A special signal which handles stillPoint capabilities of the image
*
* \see KisImage::sigSizeChanged()
*/
struct ComplexSizeChangedSignal {
ComplexSizeChangedSignal() {}
ComplexSizeChangedSignal(QPointF _oldStillPoint, QPointF _newStillPoint)
: oldStillPoint(_oldStillPoint),
newStillPoint(_newStillPoint)
{
}
/**
* A helper method calculating the still points from image areas
* we process. It works as if the source image was "cropped" by \p
* portionOfOldImage, and this portion formed the new image of size
* \p transformedIntoImageOfSize.
*
* Note, that \p portionOfTheImage may be equal to the image bounds().
*/
ComplexSizeChangedSignal(const QRect &portionOfOldImage, const QSize &transformedIntoImageOfSize)
{
oldStillPoint = QRectF(portionOfOldImage).center();
newStillPoint = QRectF(QPointF(), QSizeF(transformedIntoImageOfSize)).center();
}
ComplexSizeChangedSignal inverted() const {
return ComplexSizeChangedSignal(newStillPoint, oldStillPoint);
}
QPointF oldStillPoint;
QPointF newStillPoint;
};
/**
* A special signal which handles emitting signals for node reselection
*
* \see KisImage::sigRequestNodeReselection()
*/
struct ComplexNodeReselectionSignal {
ComplexNodeReselectionSignal() {}
ComplexNodeReselectionSignal(KisNodeSP _newActiveNode, KisNodeList _newSelectedNodes,
KisNodeSP _oldActiveNode = KisNodeSP(), KisNodeList _oldSelectedNodes = KisNodeList())
: newActiveNode(_newActiveNode),
newSelectedNodes(_newSelectedNodes),
oldActiveNode(_oldActiveNode),
oldSelectedNodes(_oldSelectedNodes)
{
}
ComplexNodeReselectionSignal inverted() const {
return ComplexNodeReselectionSignal(oldActiveNode, oldSelectedNodes, newActiveNode, newSelectedNodes);
}
KisNodeSP newActiveNode;
KisNodeList newSelectedNodes;
KisNodeSP oldActiveNode;
KisNodeList oldSelectedNodes;
};
struct KisImageSignalType {
KisImageSignalType() {}
KisImageSignalType(KisImageSignalTypeEnum _id)
: id(_id)
{
}
KisImageSignalType(ComplexSizeChangedSignal signal)
: id(SizeChangedSignal),
sizeChangedSignal(signal)
{
}
KisImageSignalType(ComplexNodeReselectionSignal signal)
: id(NodeReselectionRequestSignal),
nodeReselectionSignal(signal)
{
}
KisImageSignalType inverted() const {
KisImageSignalType t;
t.id = id;
t.sizeChangedSignal = sizeChangedSignal.inverted();
t.nodeReselectionSignal = nodeReselectionSignal.inverted();
return t;
}
KisImageSignalTypeEnum id;
ComplexSizeChangedSignal sizeChangedSignal;
ComplexNodeReselectionSignal nodeReselectionSignal;
};
typedef QVector<KisImageSignalType> KisImageSignalVector;
class KRITAIMAGE_EXPORT KisImageSignalRouter : public QObject
{
Q_OBJECT
public:
KisImageSignalRouter(KisImageWSP image);
- ~KisImageSignalRouter();
+ ~KisImageSignalRouter() override;
void emitNotification(KisImageSignalType type);
void emitNotifications(KisImageSignalVector notifications);
void emitNodeChanged(KisNodeSP node);
void emitNodeHasBeenAdded(KisNode *parent, int index);
void emitAboutToRemoveANode(KisNode *parent, int index);
private Q_SLOTS:
void slotNotification(KisImageSignalType type);
Q_SIGNALS:
void sigNotification(KisImageSignalType type);
// Notifications
void sigImageModified();
void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint);
void sigProfileChanged(const KoColorProfile * profile);
void sigColorSpaceChanged(const KoColorSpace* cs);
void sigResolutionChanged(double xRes, double yRes);
void sigRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes);
// Graph change signals
void sigNodeChanged(KisNodeSP node);
void sigNodeAddedAsync(KisNodeSP node);
void sigRemoveNodeAsync(KisNodeSP node);
void sigLayersChangedAsync();
private:
KisImageWSP m_image;
};
#endif /* __KIS_IMAGE_SIGNAL_ROUTER_H */
diff --git a/libs/image/kis_inpaint_mask.cpp b/libs/image/kis_inpaint_mask.cpp
deleted file mode 100644
index f5bd1e5cee..0000000000
--- a/libs/image/kis_inpaint_mask.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2017 Eugene Ingerman
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "kis_inpaint_mask.h"
-
-#include "kis_debug.h"
-
-#include <KoIcon.h>
-#include <kis_icon.h>
-#include <KoColor.h>
-#include <KoColorSpace.h>
-#include <KoCompositeOpRegistry.h>
-#include "kis_paint_device.h"
-#include "kis_painter.h"
-#include "kis_node_visitor.h"
-#include "kis_processing_visitor.h"
-#include "KoColorSpaceRegistry.h"
-
-KisInpaintMask::KisInpaintMask()
- : KisTransparencyMask()
-{
-}
-
-KisInpaintMask::KisInpaintMask(const KisInpaintMask& rhs)
- : KisTransparencyMask(rhs)
-{
-}
-
-KisInpaintMask::~KisInpaintMask()
-{
-}
-
-QRect KisInpaintMask::decorateRect(KisPaintDeviceSP &src,
- KisPaintDeviceSP &dst,
- const QRect & rc,
- PositionToFilthy maskPos) const
-{
- Q_UNUSED(maskPos);
- KIS_ASSERT(dst != src);
-
- if (src != dst) {
- KisPainter::copyAreaOptimized(rc.topLeft(), src, dst, rc);
- src->fill(rc, KoColor(Qt::magenta, src->colorSpace()));
- }
-
- return rc;
-}
-
-
diff --git a/libs/image/kis_inpaint_mask.h b/libs/image/kis_inpaint_mask.h
deleted file mode 100644
index 52cc2dfb69..0000000000
--- a/libs/image/kis_inpaint_mask.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2017 Eugene Ingerman
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef _KIS_INPAINT_MASK_
-#define _KIS_INPAINT_MASK_
-
-#include "kis_types.h"
-#include "kis_transparency_mask.h"
-
-class QRect;
-
-/**
- * A inpaint mask is a single channel mask that works with inpaint operation to denote area affected by inpaint operation.
- *
- */
-class KRITAIMAGE_EXPORT KisInpaintMask : public KisTransparencyMask
-{
- Q_OBJECT
-
-public:
-
- KisInpaintMask();
- KisInpaintMask(const KisInpaintMask& rhs);
- virtual ~KisInpaintMask();
-
- KisNodeSP clone() const
- {
- return KisNodeSP(new KisInpaintMask(*this));
- }
-
- QRect decorateRect(KisPaintDeviceSP &src, KisPaintDeviceSP &dst,
- const QRect & rc,
- PositionToFilthy maskPos) const;
-};
-
-#endif //_KIS_INPAINT_MASK_
diff --git a/libs/image/kis_iterator_ng.h b/libs/image/kis_iterator_ng.h
index a7507cb68c..b467a4f3b1 100644
--- a/libs/image/kis_iterator_ng.h
+++ b/libs/image/kis_iterator_ng.h
@@ -1,113 +1,113 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ITERATOR_NG_H_
#define _KIS_ITERATOR_NG_H_
#include "kis_base_accessor.h"
class KRITAIMAGE_EXPORT KisBaseConstIteratorNG : public KisBaseConstAccessor
{
Q_DISABLE_COPY(KisBaseConstIteratorNG)
public:
KisBaseConstIteratorNG() {}
- virtual ~KisBaseConstIteratorNG();
+ ~KisBaseConstIteratorNG() override;
/**
* Move to the next pixel
* @return false if there is no more pixel in the line
*/
virtual bool nextPixel() = 0;
/**
* Move to the next pixels
*/
virtual bool nextPixels(qint32 n) = 0;
/**
* @return return number of consequential numbers of pixels, useful for optimization
*/
virtual qint32 nConseqPixels() const = 0;
};
//class KRITAIMAGE_EXPORT KisBaseIteratorNG : public virtual KisBaseConstIteratorNG, public virtual KisBaseAccessor
//{
// Q_DISABLE_COPY(KisBaseIteratorNG)
//public:
// KisBaseIteratorNG() {}
// virtual ~KisBaseIteratorNG();
//};
/**
* Iterates over the line of a paint device.
*/
class KRITAIMAGE_EXPORT KisHLineConstIteratorNG : public virtual KisBaseConstIteratorNG
{
Q_DISABLE_COPY(KisHLineConstIteratorNG)
public:
KisHLineConstIteratorNG() {}
- virtual ~KisHLineConstIteratorNG();
+ ~KisHLineConstIteratorNG() override;
/**
* Move to the next row
*/
virtual void nextRow() = 0;
virtual void resetPixelPos() = 0;
virtual void resetRowPos() = 0;
};
/**
* Also support writing.
*/
class KRITAIMAGE_EXPORT KisHLineIteratorNG : public KisHLineConstIteratorNG, public KisBaseAccessor
{
Q_DISABLE_COPY(KisHLineIteratorNG)
public:
KisHLineIteratorNG() {}
- virtual ~KisHLineIteratorNG();
+ ~KisHLineIteratorNG() override;
};
/**
* Iterates over the column of a paint device.
*/
class KRITAIMAGE_EXPORT KisVLineConstIteratorNG : public virtual KisBaseConstIteratorNG
{
Q_DISABLE_COPY(KisVLineConstIteratorNG)
public:
KisVLineConstIteratorNG() {}
- virtual ~KisVLineConstIteratorNG();
+ ~KisVLineConstIteratorNG() override;
/**
* Move to the next row
*/
virtual void nextColumn() = 0;
virtual void resetPixelPos() = 0;
virtual void resetColumnPos() = 0;
};
/**
* Also support writing.
*/
class KRITAIMAGE_EXPORT KisVLineIteratorNG : public KisVLineConstIteratorNG, public KisBaseAccessor
{
Q_DISABLE_COPY(KisVLineIteratorNG)
public:
KisVLineIteratorNG() {}
- virtual ~KisVLineIteratorNG();
+ ~KisVLineIteratorNG() override;
};
#include "kis_sequential_iterator.h"
#endif
diff --git a/libs/image/kis_keyframe_channel.h b/libs/image/kis_keyframe_channel.h
index f559496af0..94f8ff9b21 100644
--- a/libs/image/kis_keyframe_channel.h
+++ b/libs/image/kis_keyframe_channel.h
@@ -1,165 +1,165 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_KEYFRAME_CHANNEL_H
#define KIS_KEYFRAME_CHANNEL_H
#include <QVariant>
#include <QDomElement>
#include <kundo2command.h>
#include "kis_types.h"
#include "KoID.h"
#include "kritaimage_export.h"
#include "kis_keyframe.h"
#include "kis_default_bounds.h"
class KisTimeRange;
class KRITAIMAGE_EXPORT KisKeyframeChannel : public QObject
{
Q_OBJECT
public:
// Standard Keyframe Ids
static const KoID Content;
static const KoID Opacity;
static const KoID TransformArguments;
static const KoID TransformPositionX;
static const KoID TransformPositionY;
static const KoID TransformScaleX;
static const KoID TransformScaleY;
static const KoID TransformShearX;
static const KoID TransformShearY;
static const KoID TransformRotationX;
static const KoID TransformRotationY;
static const KoID TransformRotationZ;
public:
KisKeyframeChannel(const KoID& id, KisDefaultBoundsBaseSP defaultBounds);
KisKeyframeChannel(const KisKeyframeChannel &rhs, KisNodeWSP newParentNode);
- ~KisKeyframeChannel();
+ ~KisKeyframeChannel() override;
QString id() const;
QString name() const;
void setNode(KisNodeWSP node);
KisNodeWSP node() const;
KisKeyframeSP addKeyframe(int time, KUndo2Command *parentCommand = 0);
bool deleteKeyframe(KisKeyframeSP keyframe, KUndo2Command *parentCommand = 0);
bool moveKeyframe(KisKeyframeSP keyframe, int newTime, KUndo2Command *parentCommand = 0);
KisKeyframeSP copyKeyframe(const KisKeyframeSP keyframe, int newTime, KUndo2Command *parentCommand = 0);
KisKeyframeSP copyExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, int dstTime, KUndo2Command *parentCommand = 0);
KisKeyframeSP keyframeAt(int time) const;
KisKeyframeSP activeKeyframeAt(int time) const;
KisKeyframeSP currentlyActiveKeyframe() const;
KisKeyframeSP firstKeyframe() const;
KisKeyframeSP nextKeyframe(KisKeyframeSP keyframe) const;
KisKeyframeSP previousKeyframe(KisKeyframeSP keyframe) const;
KisKeyframeSP lastKeyframe() const;
/**
* Calculates a pseudo-unique keyframes hash. The hash changes
* every time any frame is added/removed/moved
*/
int framesHash() const;
QSet<int> allKeyframeIds() const;
/**
* Get the set of frames affected by any changes to the value
* of the active keyframe at the given time.
*/
KisTimeRange affectedFrames(int time) const;
/**
* Get a set of frames for which the channel gives identical
* results, compared to the given frame.
*
* Note: this set may be different than the set of affected frames
* due to interpolation.
*/
KisTimeRange identicalFrames(int time) const;
int keyframeCount() const;
int keyframeRowIndexOf(KisKeyframeSP keyframe) const;
KisKeyframeSP keyframeAtRow(int row) const;
int keyframeInsertionRow(int time) const;
virtual bool hasScalarValue() const = 0;
virtual qreal minScalarValue() const;
virtual qreal maxScalarValue() const;
virtual qreal scalarValue(const KisKeyframeSP keyframe) const;
virtual void setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand = 0);
virtual QDomElement toXML(QDomDocument doc, const QString &layerFilename);
virtual void loadXML(const QDomElement &channelNode);
int currentTime() const;
Q_SIGNALS:
void sigKeyframeAboutToBeAdded(KisKeyframeSP keyframe);
void sigKeyframeAdded(KisKeyframeSP keyframe);
void sigKeyframeAboutToBeRemoved(KisKeyframeSP keyframe);
void sigKeyframeRemoved(KisKeyframeSP keyframe);
void sigKeyframeAboutToBeMoved(KisKeyframeSP keyframe, int toTime);
void sigKeyframeMoved(KisKeyframeSP keyframe, int fromTime);
void sigKeyframeChanged(KisKeyframeSP keyframe);
protected:
typedef QMap<int, KisKeyframeSP> KeyframesMap;
KeyframesMap &keys();
const KeyframesMap &constKeys() const;
KeyframesMap::const_iterator activeKeyIterator(int time) const;
virtual KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) = 0;
virtual void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand) = 0;
virtual void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame) = 0;
virtual QRect affectedRect(KisKeyframeSP key) = 0;
virtual void requestUpdate(const KisTimeRange &range, const QRect &rect);
virtual KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode) = 0;
virtual void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) = 0;
private:
KisKeyframeSP replaceKeyframeAt(int time, KisKeyframeSP newKeyframe);
void insertKeyframeLogical(KisKeyframeSP keyframe);
void removeKeyframeLogical(KisKeyframeSP keyframe);
bool deleteKeyframeImpl(KisKeyframeSP keyframe, KUndo2Command *parentCommand, bool recreate);
void moveKeyframeImpl(KisKeyframeSP keyframe, int newTime);
friend class KisMoveFrameCommand;
friend class KisReplaceKeyframeCommand;
private:
KisKeyframeSP insertKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
struct Private;
QScopedPointer<Private> m_d;
};
#endif // KIS_KEYFRAME_CHANNEL_H
diff --git a/libs/image/kis_keyframe_commands.h b/libs/image/kis_keyframe_commands.h
index e0fed5f70c..288ef21f51 100644
--- a/libs/image/kis_keyframe_commands.h
+++ b/libs/image/kis_keyframe_commands.h
@@ -1,57 +1,57 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_KEYFRAME_COMMANDS_H
#define KIS_KEYFRAME_COMMANDS_H
#include "kis_keyframe_channel.h"
#include "kundo2command.h"
#include "kritaimage_export.h"
class KRITAIMAGE_EXPORT KisReplaceKeyframeCommand : public KUndo2Command
{
public:
KisReplaceKeyframeCommand(KisKeyframeChannel *channel, int time, KisKeyframeSP keyframe, KUndo2Command *parentCommand);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
void doSwap(bool insert);
private:
KisKeyframeChannel *m_channel;
int m_time;
KisKeyframeSP m_keyframe;
KisKeyframeSP m_existingKeyframe;
};
class KRITAIMAGE_EXPORT KisMoveFrameCommand : public KUndo2Command
{
public:
KisMoveFrameCommand(KisKeyframeChannel *channel, KisKeyframeSP keyframe, int oldTime, int newTime, KUndo2Command *parentCommand);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
KisKeyframeChannel *m_channel;
KisKeyframeSP m_keyframe;
int m_oldTime;
int m_newTime;
};
#endif
diff --git a/libs/image/kis_layer.h b/libs/image/kis_layer.h
index 6829386e7d..5168f7d64c 100644
--- a/libs/image/kis_layer.h
+++ b/libs/image/kis_layer.h
@@ -1,389 +1,389 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LAYER_H_
#define KIS_LAYER_H_
#include <QRect>
#include <QRegion>
#include <QMetaType>
#include <QObject>
#include "kritaimage_export.h"
#include "kis_base_node.h"
#include "kis_types.h"
#include "kis_node.h"
#include "kis_psd_layer_style.h"
template <class T>
class QStack;
class QBitArray;
class KisCloneLayer;
class KisPSDLayerStyle;
class KisAbstractProjectionPlane;
namespace KisMetaData
{
class Store;
}
/**
* Abstract class that represents the concept of a Layer in Krita. This is not related
* to the paint devices: this is merely an abstraction of how layers can be stacked and
* rendered differently.
* Regarding the previous-, first-, next- and lastChild() calls, first means that it the layer
* is at the top of the group in the layerlist, using next will iterate to the bottom to last,
* whereas previous will go up to first again.
*
*
* TODO: Add a layer mode whereby the projection of the layer is used
* as a clipping path?
**/
class KRITAIMAGE_EXPORT KisLayer : public KisNode
{
Q_OBJECT
public:
/**
* @param image is the pointer of the image or null
* @param opacity is a value between OPACITY_TRANSPARENT_U8 and OPACITY_OPAQUE_U8
**/
KisLayer(KisImageWSP image, const QString &name, quint8 opacity);
KisLayer(const KisLayer& rhs);
- virtual ~KisLayer();
+ ~KisLayer() override;
/// returns the image's colorSpace or null, if there is no image
- virtual const KoColorSpace * colorSpace() const override;
+ const KoColorSpace * colorSpace() const override;
/// returns the layer's composite op for the colorspace of the layer's parent.
const KoCompositeOp * compositeOp() const override;
KisPSDLayerStyleSP layerStyle() const;
void setLayerStyle(KisPSDLayerStyleSP layerStyle);
/**
* \see a comment in KisNode::projectionPlane()
*/
- virtual KisAbstractProjectionPlaneSP projectionPlane() const override;
+ KisAbstractProjectionPlaneSP projectionPlane() const override;
/**
* The projection plane representing the layer itself without any
* styles or anything else. It is used by the layer styles projection
* plane to stack up the planes.
*/
virtual KisAbstractProjectionPlaneSP internalProjectionPlane() const;
QRect partialChangeRect(KisNodeSP lastNode, const QRect& rect);
void buildProjectionUpToNode(KisPaintDeviceSP projection, KisNodeSP lastNode, const QRect& rect);
virtual bool needProjection() const;
/**
* Return the fully rendered representation of this layer: its
* data and its effect masks
*/
KisPaintDeviceSP projection() const override;
/**
* Return the layer data before the effect masks have had their go
* at it.
*/
- virtual KisPaintDeviceSP original() const override = 0;
+ KisPaintDeviceSP original() const override = 0;
/**
* @return the selection associated with this layer, if there is
* one. Otherwise, return 0;
*/
virtual KisSelectionMaskSP selectionMask() const;
/**
* @return the selection contained in the first KisSelectionMask associated
* with this layer or the image, if either exists, otherwise, return 0.
*/
virtual KisSelectionSP selection() const;
- virtual KisBaseNode::PropertyList sectionModelProperties() const override;
- virtual void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override;
+ KisBaseNode::PropertyList sectionModelProperties() const override;
+ void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override;
/**
* set/unset the channel flag for the alpha channel of this layer
*/
void disableAlphaChannel(bool disable);
/**
* returns true if the channel flag for the alpha channel
* of this layer is not set.
* returns false otherwise.
*/
bool alphaChannelDisabled() const;
/**
* set the channelflags for this layer to the specified bit array.
* The bit array must have exactly the same number of channels as
* the colorspace this layer is in, or be empty, in which case all
* channels are active.
*/
virtual void setChannelFlags(const QBitArray & channelFlags);
/**
* Return a bit array where each bit indicates whether a
* particular channel is active or not. If the channelflags bit
* array is empty, all channels are active.
*/
QBitArray & channelFlags() const;
/**
* Returns true if this layer is temporary: i.e., it should not
* appear in the layerbox, even though it is temporarily in the
* layer stack and taken into account on recomposition.
*/
bool temporary() const;
/**
* Set to true if this layer should not appear in the layerbox,
* even though it is temporarily in the layer stack and taken into
* account on recomposition.
*/
void setTemporary(bool t);
/// returns the image this layer belongs to, or null if there is no image
KisImageWSP image() const;
/**
* Set the image this layer belongs to.
*/
void setImage(KisImageWSP image) override;
/**
* Create and return a layer that is the result of merging
* this with layer.
*
* This method is designed to be called only within KisImage::mergeLayerDown().
*
* Decendands override this to create specific merged types when possible.
* The KisLayer one creates a KisPaintLayerSP via a bitBlt, and can work on all layer types.
*
* Decendants that perform there own version do NOT call KisLayer::createMergedLayer
*/
virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer);
virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer);
/**
* Clones should be informed about updates of the original
* layer, so this is a way to register them
*/
void registerClone(KisCloneLayerWSP clone);
/**
* Deregisters the clone from the update list
*
* \see registerClone()
*/
void unregisterClone(KisCloneLayerWSP clone);
/**
* Return the list of the clones of this node. Be careful
* with the list, because it is not thread safe.
*/
const QList<KisCloneLayerWSP> registeredClones() const;
/**
* Returns whether we have a clone.
*
* Be careful with it. It is not thread safe to add/remove
* clone while checking hasClones(). So there should be no updates.
*/
bool hasClones() const;
/**
* It is calles by the async merger after projection update is done
*/
void updateClones(const QRect &rect);
public:
qint32 x() const override;
qint32 y() const override;
void setX(qint32 x) override;
void setY(qint32 y) override;
/**
* Returns an approximation of where the bounds
* of actual data of this layer are
*/
QRect extent() const override;
/**
* Returns the exact bounds of where the actual data
* of this layer resides
*/
QRect exactBounds() const override;
QImage createThumbnail(qint32 w, qint32 h) override;
QImage createThumbnailForFrame(qint32 w, qint32 h, int time) override;
public:
/**
* Returns true if there are any effect masks present
*/
bool hasEffectMasks() const;
/**
* @return the list of effect masks
*/
QList<KisEffectMaskSP> effectMasks(KisNodeSP lastNode = KisNodeSP()) const;
/**
* Get the group layer that contains this layer.
*/
KisLayerSP parentLayer() const;
/**
* @return the metadata object associated with this object.
*/
KisMetaData::Store* metaData();
protected:
// override from KisNode
QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
protected:
/**
* Ask the layer to assemble its data & apply all the effect masks
* to it.
*/
QRect updateProjection(const QRect& rect, KisNodeSP filthyNode);
/**
* Layers can override this method to get some special behavior
* when copying data from \p original to \p projection, e.g. blend
* in indirect painting device. If you need to modify data
* outside \p rect, please also override outgoingChangeRect()
* method.
*/
virtual void copyOriginalToProjection(const KisPaintDeviceSP original,
KisPaintDeviceSP projection,
const QRect& rect) const;
/**
* For KisLayer classes change rect transformation consists of two
* parts: incoming and outgoing.
*
* 1) incomingChangeRect(rect) chande rect transformation
* performed by the transformations done basing on global
* projection. It is performed in KisAsyncMerger +
* KisUpdateOriginalVisitor classes. It happens before data
* coming to KisLayer::original() therefore it is
* 'incoming'. See KisAdjustmentLayer for example of usage.
*
* 2) outgoingChangeRect(rect) change rect transformation that
* happens in KisLayer::copyOriginalToProjection(). It applies
* *only* when the layer is 'filthy', that is was the cause of
* the merge process. See KisCloneLayer for example of usage.
*
* The flow of changed areas can be illustrated in the
* following way:
*
* 1. Current projection of size R1 is stored in KisAsyncMerger::m_currentProjection
* |
* | <-- KisUpdateOriginalVisitor writes data into layer's original() device.
* | The changed area on KisLayer::original() is
* | R2 = KisLayer::incomingChangeRect(R1)
* |
* 2. KisLayer::original() / changed rect: R2
* |
* | <-- KisLayer::updateProjection() starts composing a layer
* | It calls KisLayer::copyOriginalToProjection() which copies some area
* | to a temporaty device. The temporary device now stores
* | R3 = KisLayer::outgoingChangeRect(R2)
* |
* 3. Temporary device / changed rect: R3
* |
* | <-- KisLayer::updateProjection() continues composing a layer. It merges a mask.
* | R4 = KisMask::changeRect(R3)
* |
* 4. KisLayer::original() / changed rect: R4
*
* So in the end rect R4 will be passed up to the next layers in the stack.
*/
virtual QRect incomingChangeRect(const QRect &rect) const;
/**
* \see incomingChangeRect()
*/
virtual QRect outgoingChangeRect(const QRect &rect) const;
/**
* @param rectVariesFlag (out param) a flag, showing whether
* a rect varies from mask to mask
* @return an area that should be updated because of
* the change of @requestedRect of the layer
*/
QRect masksChangeRect(const QList<KisEffectMaskSP> &masks,
const QRect &requestedRect,
bool &rectVariesFlag) const;
/**
* Get needRects for all masks
* @param changeRect requested rect to be updated on final
* projection. Should be a return value
* of @ref masksChangedRect()
* @param applyRects (out param) a stack of the rects where filters
* should be applied
* @param rectVariesFlag (out param) a flag, showing whether
* a rect varies from mask to mask
* @return a needRect that should be prepared on the layer's
* paintDevice for all masks to succeed
*/
QRect masksNeedRect(const QList<KisEffectMaskSP> &masks,
const QRect &changeRect,
QStack<QRect> &applyRects,
bool &rectVariesFlag) const;
QRect applyMasks(const KisPaintDeviceSP source,
KisPaintDeviceSP destination,
const QRect &requestedRect,
KisNodeSP filthyNode, KisNodeSP lastNode) const;
bool canMergeAndKeepBlendOptions(KisLayerSP otherLayer);
private:
friend class KisLayerProjectionPlane;
friend class KisTransformMask;
friend class KisLayerTest;
private:
QRect layerExtentImpl(bool exactBounds) const;
private:
struct Private;
Private * const m_d;
};
Q_DECLARE_METATYPE(KisLayerSP)
#endif // KIS_LAYER_H_
diff --git a/libs/image/kis_layer_projection_plane.h b/libs/image/kis_layer_projection_plane.h
index 5353500f56..d7a59cf06c 100644
--- a/libs/image/kis_layer_projection_plane.h
+++ b/libs/image/kis_layer_projection_plane.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LAYER_PROJECTION_PLANE_H
#define __KIS_LAYER_PROJECTION_PLANE_H
#include "kis_abstract_projection_plane.h"
#include <QScopedPointer>
/**
* An implementation of the KisAbstractProjectionPlane interface for a
* layer object
*/
class KisLayerProjectionPlane : public KisAbstractProjectionPlane
{
public:
KisLayerProjectionPlane(KisLayer *layer);
- ~KisLayerProjectionPlane();
+ ~KisLayerProjectionPlane() override;
- QRect recalculate(const QRect& rect, KisNodeSP filthyNode);
- void apply(KisPainter *painter, const QRect &rect);
+ QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
+ void apply(KisPainter *painter, const QRect &rect) override;
- QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
+ QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
- KisPaintDeviceList getLodCapableDevices() const;
+ KisPaintDeviceList getLodCapableDevices() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_LAYER_PROJECTION_PLANE_H */
diff --git a/libs/image/kis_layer_utils.h b/libs/image/kis_layer_utils.h
index 6086f6baa5..03e8850632 100644
--- a/libs/image/kis_layer_utils.h
+++ b/libs/image/kis_layer_utils.h
@@ -1,204 +1,204 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LAYER_UTILS_H
#define __KIS_LAYER_UTILS_H
#include <functional>
#include "kundo2command.h"
#include "kis_types.h"
#include "kritaimage_export.h"
#include "kis_command_utils.h"
class KoProperties;
class KoColor;
class QUuid;
namespace KisMetaData
{
class MergeStrategy;
}
namespace KisLayerUtils
{
KRITAIMAGE_EXPORT void sortMergableNodes(KisNodeSP root, QList<KisNodeSP> &inputNodes, QList<KisNodeSP> &outputNodes);
KRITAIMAGE_EXPORT KisNodeList sortMergableNodes(KisNodeSP root, KisNodeList nodes);
KRITAIMAGE_EXPORT void filterMergableNodes(KisNodeList &nodes, bool allowMasks = false);
KRITAIMAGE_EXPORT bool checkIsChildOf(KisNodeSP node, const KisNodeList &parents);
/**
* Returns true if:
* o \p node is a clone of some layer in \p nodes
* o \p node is a clone any child layer of any layer in \p nodes
* o \p node is a clone of a clone of a ..., that in the end points
* to any layer in \p nodes of their children.
*/
KRITAIMAGE_EXPORT bool checkIsCloneOf(KisNodeSP node, const KisNodeList &nodes);
KRITAIMAGE_EXPORT KisNodeList sortAndFilterMergableInternalNodes(KisNodeList nodes, bool allowMasks = false);
KRITAIMAGE_EXPORT void mergeDown(KisImageSP image, KisLayerSP layer, const KisMetaData::MergeStrategy* strategy);
KRITAIMAGE_EXPORT QSet<int> fetchLayerFrames(KisNodeSP node);
KRITAIMAGE_EXPORT QSet<int> fetchLayerFramesRecursive(KisNodeSP rootNode);
KRITAIMAGE_EXPORT void mergeMultipleLayers(KisImageSP image, KisNodeList mergedNodes, KisNodeSP putAfter);
KRITAIMAGE_EXPORT void newLayerFromVisible(KisImageSP image, KisNodeSP putAfter);
KRITAIMAGE_EXPORT bool tryMergeSelectionMasks(KisImageSP image, KisNodeList mergedNodes, KisNodeSP putAfter);
KRITAIMAGE_EXPORT void flattenLayer(KisImageSP image, KisLayerSP layer);
KRITAIMAGE_EXPORT void flattenImage(KisImageSP image);
KRITAIMAGE_EXPORT void addCopyOfNameTag(KisNodeSP node);
KRITAIMAGE_EXPORT KisNodeList findNodesWithProps(KisNodeSP root, const KoProperties &props, bool excludeRoot);
KRITAIMAGE_EXPORT void changeImageDefaultProjectionColor(KisImageSP image, const KoColor &color);
typedef QMap<int, QSet<KisNodeSP> > FrameJobs;
void updateFrameJobs(FrameJobs *jobs, KisNodeSP node);
void updateFrameJobsRecursive(FrameJobs *jobs, KisNodeSP rootNode);
struct SwitchFrameCommand : public KisCommandUtils::FlipFlopCommand {
struct SharedStorage {
/**
* For some reason the absence of a destructor in the SharedStorage
* makes Krita crash on exit. Seems like some compiler weirdness... (DK)
*/
~SharedStorage();
int value;
};
typedef QSharedPointer<SharedStorage> SharedStorageSP;
public:
SwitchFrameCommand(KisImageSP image, int time, bool finalize, SharedStorageSP storage);
- ~SwitchFrameCommand();
+ ~SwitchFrameCommand() override;
private:
- void init();
- void end();
+ void init() override;
+ void end() override;
private:
KisImageWSP m_image;
int m_newTime;
SharedStorageSP m_storage;
};
/**
* A command to keep correct set of selected/active nodes thoroughout
* the action.
*/
class KRITAIMAGE_EXPORT KeepNodesSelectedCommand : public KisCommandUtils::FlipFlopCommand
{
public:
KeepNodesSelectedCommand(const KisNodeList &selectedBefore,
const KisNodeList &selectedAfter,
KisNodeSP activeBefore,
KisNodeSP activeAfter,
KisImageSP image,
bool finalize, KUndo2Command *parent = 0);
- void end();
+ void end() override;
private:
KisNodeList m_selectedBefore;
KisNodeList m_selectedAfter;
KisNodeSP m_activeBefore;
KisNodeSP m_activeAfter;
KisImageWSP m_image;
};
KRITAIMAGE_EXPORT KisLayerSP constructDefaultLayer(KisImageSP image);
class KRITAIMAGE_EXPORT RemoveNodeHelper {
public:
virtual ~RemoveNodeHelper();
protected:
virtual void addCommandImpl(KUndo2Command *cmd) = 0;
void safeRemoveMultipleNodes(KisNodeList nodes, KisImageSP image);
private:
bool checkIsSourceForClone(KisNodeSP src, const KisNodeList &nodes);
static bool scanForLastLayer(KisImageWSP image, KisNodeList nodesToRemove);
};
struct SimpleRemoveLayers : private KisLayerUtils::RemoveNodeHelper, public KisCommandUtils::AggregateCommand {
SimpleRemoveLayers(const KisNodeList &nodes,
KisImageSP image);
- void populateChildCommands();
+ void populateChildCommands() override;
protected:
- virtual void addCommandImpl(KUndo2Command *cmd);
+ void addCommandImpl(KUndo2Command *cmd) override;
private:
KisNodeList m_nodes;
KisImageSP m_image;
KisNodeList m_selectedNodes;
KisNodeSP m_activeNode;
};
class KRITAIMAGE_EXPORT KisSimpleUpdateCommand : public KisCommandUtils::FlipFlopCommand
{
public:
KisSimpleUpdateCommand(KisNodeList nodes, bool finalize, KUndo2Command *parent = 0);
- void end();
+ void end() override;
static void updateNodes(const KisNodeList &nodes);
private:
KisNodeList m_nodes;
};
template <typename T>
bool checkNodesDiffer(KisNodeList nodes, std::function<T(KisNodeSP)> checkerFunc)
{
bool valueDiffers = false;
bool initialized = false;
T currentValue = T();
Q_FOREACH (KisNodeSP node, nodes) {
if (!initialized) {
currentValue = checkerFunc(node);
initialized = true;
} else if (currentValue != checkerFunc(node)) {
valueDiffers = true;
break;
}
}
return valueDiffers;
}
/**
* Applies \p func to \p node and all its children recursively
*/
void KRITAIMAGE_EXPORT recursiveApplyNodes(KisNodeSP node, std::function<void(KisNodeSP)> func);
/**
* Walks through \p node and all its children recursively until
* \p func returns true. When \p func returns true, the node is
* considered to be found, the search is stopped and the found
* node is returned to the caller.
*/
KisNodeSP KRITAIMAGE_EXPORT recursiveFindNode(KisNodeSP node, std::function<bool(KisNodeSP)> func);
/**
* Recursively searches for a node with specified Uuid
*/
KisNodeSP KRITAIMAGE_EXPORT findNodeByUuid(KisNodeSP root, const QUuid &uuid);
};
#endif /* __KIS_LAYER_UTILS_H */
diff --git a/libs/image/kis_legacy_undo_adapter.h b/libs/image/kis_legacy_undo_adapter.h
index 07e72cdd06..f8f269e2ed 100644
--- a/libs/image/kis_legacy_undo_adapter.h
+++ b/libs/image/kis_legacy_undo_adapter.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LEGACY_UNDO_ADAPTER_H
#define __KIS_LEGACY_UNDO_ADAPTER_H
#include "kis_undo_adapter.h"
#include "kis_types.h"
/**
* KisLegacyUndoAdapter -- blocks the strokes and updates queue,
* and then adds the command to a store
*/
class KRITAIMAGE_EXPORT KisLegacyUndoAdapter : public KisUndoAdapter
{
public:
KisLegacyUndoAdapter(KisUndoStore *undoStore, KisImageWSP image);
- const KUndo2Command* presentCommand();
- void undoLastCommand();
- void addCommand(KUndo2Command *cmd);
- void beginMacro(const KUndo2MagicString& macroName);
- void endMacro();
+ const KUndo2Command* presentCommand() override;
+ void undoLastCommand() override;
+ void addCommand(KUndo2Command *cmd) override;
+ void beginMacro(const KUndo2MagicString& macroName) override;
+ void endMacro() override;
private:
KisImageWSP m_image;
qint32 m_macroCounter;
};
#endif /* __KIS_LEGACY_UNDO_ADAPTER_H */
diff --git a/libs/image/kis_macro_based_undo_store.h b/libs/image/kis_macro_based_undo_store.h
index 0a46290d78..8ffe35dead 100644
--- a/libs/image/kis_macro_based_undo_store.h
+++ b/libs/image/kis_macro_based_undo_store.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MACRO_BASED_UNDO_STORE_H
#define __KIS_MACRO_BASED_UNDO_STORE_H
#include <QScopedPointer>
#include "kis_undo_store.h"
class KisSavedMacroCommand;
/**
* This undo store is supposed to be stacked with a KisPostExecutionUndoAdapter.
*
* That chain looks like:
* KisPostExecutionUndoAdapter ->
* KisMacroBasedUndoStore ->
* KisSavedMacroCommand;
*
* So the store calls redo() on every command that is added via
* addCommand();
*/
class KisMacroBasedUndoStore : public KisUndoStore
{
public:
KisMacroBasedUndoStore(KisSavedMacroCommand *command);
- ~KisMacroBasedUndoStore();
-
- const KUndo2Command* presentCommand();
- void undoLastCommand();
- void addCommand(KUndo2Command *cmd);
- void beginMacro(const KUndo2MagicString& macroName);
- void endMacro();
- void purgeRedoState();
+ ~KisMacroBasedUndoStore() override;
+
+ const KUndo2Command* presentCommand() override;
+ void undoLastCommand() override;
+ void addCommand(KUndo2Command *cmd) override;
+ void beginMacro(const KUndo2MagicString& macroName) override;
+ void endMacro() override;
+ void purgeRedoState() override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_MACRO_BASED_UNDO_STORE_H */
diff --git a/libs/image/kis_mask.h b/libs/image/kis_mask.h
index 6a0e2520eb..1bf951bae0 100644
--- a/libs/image/kis_mask.h
+++ b/libs/image/kis_mask.h
@@ -1,219 +1,219 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
* (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.b
*/
#ifndef _KIS_MASK_
#define _KIS_MASK_
#include <QRect>
#include "kis_types.h"
#include "kis_global.h"
#include "kis_node.h"
#include "kis_indirect_painting_support.h"
#include <kritaimage_export.h>
/**
KisMask is the base class for all single channel
mask-like paint devices in Krita. Masks can be rendered in different
ways at different moments during the rendering stack. Masks are
"owned" by layers (of any type), and cannot occur by themselves on
themselves.
The properties that masks implement are made available through the
iterators created on their parent layer, or through iterators that
can be created on the paint device that holds the mask data: masks
are just paint devices, too.
Masks should show up in the layerbox as sub-layers for the layer they
are associated with and be ccp'able and draggable to other layers.
Examples of masks are:
- filter masks: like the alpha filter mask that is the most common
type of mask and is simply known as "mask" in the
gui. Other filter masks use any of krita's filters to
filter the pixels of their parent. (In this they
differ from adjustment layers, which filter all
layers under them in their group stack).
- selections: the selection mask is rendered after composition and
zooming and determines the selectedness of the pixels of the parent
layer.
- painterly overlays: painterly overlays indicate a particular
property of the pixel in the parent paint device they are associated
with, like wetness, height or gravity.
XXX: For now, all masks are 8 bit. Make the channel depth settable.
*/
class KRITAIMAGE_EXPORT KisMask : public KisNode, public KisIndirectPaintingSupport
{
Q_OBJECT
public:
/**
* Create a new KisMask.
*/
KisMask(const QString & name);
/**
* Copy the mask
*/
KisMask(const KisMask& rhs);
- virtual ~KisMask();
+ ~KisMask() override;
void setImage(KisImageWSP image) override;
bool allowAsChild(KisNodeSP node) const override;
/**
* @brief initSelection initializes the selection for the mask from
* the given selection's projection.
* @param copyFrom the selection we base the mask on
* @param parentLayer the parent of this mask; it determines the default bounds of the mask.
*/
void initSelection(KisSelectionSP copyFrom, KisLayerSP parentLayer);
/**
* @brief initSelection initializes the selection for the mask from
* the given paint device.
* @param copyFromDevice the paint device we base the mask on
* @param parentLayer the parent of this mask; it determines the default bounds of the mask.
*/
void initSelection(KisPaintDeviceSP copyFromDevice, KisLayerSP parentLayer);
/**
* @brief initSelection initializes an empty selection
* @param parentLayer the parent of this mask; it determines the default bounds of the mask.
*/
void initSelection(KisLayerSP parentLayer);
const KoColorSpace * colorSpace() const override;
const KoCompositeOp * compositeOp() const override;
/**
* Return the selection associated with this mask. A selection can
* contain both a paint device and shapes.
*/
KisSelectionSP selection() const;
/**
* @return the selection: if you paint on mask, you paint on the selections
*/
KisPaintDeviceSP paintDevice() const override;
/**
* @return the same as paintDevice()
*/
KisPaintDeviceSP original() const override;
/**
* @return the same as paintDevice()
*/
KisPaintDeviceSP projection() const override;
KisAbstractProjectionPlaneSP projectionPlane() const override;
/**
* Change the selection to the specified selection object. The
* selection is deep copied.
*/
void setSelection(KisSelectionSP selection);
/**
* Selected the specified rect with the specified amount of selectedness.
*/
void select(const QRect & rc, quint8 selectedness = MAX_SELECTED);
/**
* The extent and bounds of the mask are those of the selection inside
*/
QRect extent() const override;
QRect exactBounds() const override;
/**
* overridden from KisBaseNode
*/
qint32 x() const override;
/**
* overridden from KisBaseNode
*/
void setX(qint32 x) override;
/**
* overridden from KisBaseNode
*/
qint32 y() const override;
/**
* overridden from KisBaseNode
*/
void setY(qint32 y) override;
/**
* Usually masks themselves do not have any paint device and
* all their final effect on the layer stack is computed using
* the changeRect() of the dirty rect of the parent layer. Their
* extent() and exectBounds() methods work the same way: by taking
* the extent of the parent layer and computing the rect basing
* on it. But some of the masks like Colorize Mask may have their
* own "projection", which is painted independently from the changed
* area of the parent layer. This additional "non-dependent" extent
* is added to the extent of the parent layer.
*/
virtual QRect nonDependentExtent() const;
QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
QImage createThumbnail(qint32 w, qint32 h) override;
void testingInitSelection(const QRect &rect, KisLayerSP parentLayer);
protected:
/**
* Apply the effect the projection using the mask as a selection.
* Made public in KisEffectMask
*/
void apply(KisPaintDeviceSP projection, const QRect & applyRect, const QRect & needRect, PositionToFilthy maskPos) const;
virtual QRect decorateRect(KisPaintDeviceSP &src,
KisPaintDeviceSP &dst,
const QRect & rc,
PositionToFilthy maskPos) const;
KisKeyframeChannel *requestKeyframeChannel(const QString &id) override;
private:
friend class KisMaskProjectionPlane;
private:
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/image/kis_mask_projection_plane.h b/libs/image/kis_mask_projection_plane.h
index 56bb5315e2..646a24c42d 100644
--- a/libs/image/kis_mask_projection_plane.h
+++ b/libs/image/kis_mask_projection_plane.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MASK_PROJECTION_PLANE_H
#define __KIS_MASK_PROJECTION_PLANE_H
#include "kis_abstract_projection_plane.h"
#include <QScopedPointer>
/**
* An implementation of the KisAbstractProjectionPlane interface for a
* layer object.
*
* Please note that recalculate() and apply() methods are not defined
* for masks, because the KisLayer code still uses tranditional
* methods of KisMask directly.
*/
class KisMaskProjectionPlane : public KisAbstractProjectionPlane
{
public:
KisMaskProjectionPlane(KisMask *mask);
- ~KisMaskProjectionPlane();
+ ~KisMaskProjectionPlane() override;
- QRect recalculate(const QRect& rect, KisNodeSP filthyNode);
- void apply(KisPainter *painter, const QRect &rect);
+ QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
+ void apply(KisPainter *painter, const QRect &rect) override;
- QRect needRect(const QRect &rect, KisNode::PositionToFilthy pos) const;
- QRect changeRect(const QRect &rect, KisNode::PositionToFilthy pos) const;
- QRect accessRect(const QRect &rect, KisNode::PositionToFilthy pos) const;
+ QRect needRect(const QRect &rect, KisNode::PositionToFilthy pos) const override;
+ QRect changeRect(const QRect &rect, KisNode::PositionToFilthy pos) const override;
+ QRect accessRect(const QRect &rect, KisNode::PositionToFilthy pos) const override;
- KisPaintDeviceList getLodCapableDevices() const;
+ KisPaintDeviceList getLodCapableDevices() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_MASK_PROJECTION_PLANE_H */
diff --git a/libs/image/kis_memory_statistics_server.h b/libs/image/kis_memory_statistics_server.h
index dee556cf6b..092b8c13ff 100644
--- a/libs/image/kis_memory_statistics_server.h
+++ b/libs/image/kis_memory_statistics_server.h
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MEMORY_STATISTICS_SERVER_H
#define __KIS_MEMORY_STATISTICS_SERVER_H
#include <QtGlobal>
#include <QObject>
#include <QScopedPointer>
#include "kritaimage_export.h"
#include "kis_types.h"
class KRITAIMAGE_EXPORT KisMemoryStatisticsServer : public QObject
{
Q_OBJECT
public:
struct Statistics
{
Statistics()
: imageSize(0),
totalMemorySize(0),
realMemorySize(0),
historicalMemorySize(0),
poolSize(0),
swapSize(0),
totalMemoryLimit(0),
tilesHardLimit(0),
tilesSoftLimit(0),
tilesPoolLimit(0)
{
}
qint64 imageSize;
qint64 totalMemorySize;
qint64 realMemorySize;
qint64 historicalMemorySize;
qint64 poolSize;
qint64 swapSize;
qint64 totalMemoryLimit;
qint64 tilesHardLimit;
qint64 tilesSoftLimit;
qint64 tilesPoolLimit;
};
public:
KisMemoryStatisticsServer();
- ~KisMemoryStatisticsServer();
+ ~KisMemoryStatisticsServer() override;
static KisMemoryStatisticsServer* instance();
Statistics fetchMemoryStatistics(KisImageSP image) const;
public Q_SLOTS:
void notifyImageChanged();
Q_SIGNALS:
void sigUpdateMemoryStatistics();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_MEMORY_STATISTICS_SERVER_H */
diff --git a/libs/image/kis_merge_walker.h b/libs/image/kis_merge_walker.h
index 5b404868b3..b582ca66a3 100644
--- a/libs/image/kis_merge_walker.h
+++ b/libs/image/kis_merge_walker.h
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MERGE_WALKER_H
#define __KIS_MERGE_WALKER_H
#include "kis_types.h"
#include "kis_base_rects_walker.h"
class KisMergeWalker;
typedef KisSharedPtr<KisMergeWalker> KisMergeWalkerSP;
class KRITAIMAGE_EXPORT KisMergeWalker : public virtual KisBaseRectsWalker
{
public:
/**
* NO_FILTHY flag notifies the walker that there should be no (!)
* filthy node in the update. It means that the projection() of
* the node is already guaranteed to be ready, we just need to
* update all the higher-level nodes. Used by KisTransformMask
* regeneration code.
*/
enum Flags {
DEFAULT = 0,
NO_FILTHY
};
KisMergeWalker(QRect cropRect, Flags flags = DEFAULT);
- virtual ~KisMergeWalker();
+ ~KisMergeWalker() override;
- UpdateType type() const;
+ UpdateType type() const override;
protected:
KisMergeWalker() : m_flags(DEFAULT) {}
KisMergeWalker(Flags flags) : m_flags(flags) {}
/**
* Begins visiting nodes starting with @startWith.
* First it climbs to the top of the graph, collecting
* changeRects (it calls @registerChangeRect for every node).
* Then it goes down to the bottom collecting needRects
* for every branch.
*/
- void startTrip(KisProjectionLeafSP startWith);
+ void startTrip(KisProjectionLeafSP startWith) override;
using KisBaseRectsWalker::startTrip;
void startTripWithMask(KisProjectionLeafSP filthyMask);
private:
/**
* Visits a node @leaf and goes on crowling
* towards the top of the graph, caling visitHigherNode() or
* startTrip() one more time. After the top is reached
* returns back to the @leaf.
*/
void visitHigherNode(KisProjectionLeafSP leaf, NodePosition positionToFilthy);
/**
* Visits a node @leaf and goes on crowling
* towards the bottom of the graph, caling visitLowerNode() or
* startTrip() one more time.
*/
void visitLowerNode(KisProjectionLeafSP leaf);
private:
const Flags m_flags;
};
#endif /* __KIS_MERGE_WALKER_H */
diff --git a/libs/image/kis_node.h b/libs/image/kis_node.h
index cceda7f22d..751344ff79 100644
--- a/libs/image/kis_node.h
+++ b/libs/image/kis_node.h
@@ -1,403 +1,403 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_NODE_H
#define _KIS_NODE_H
#include "kis_types.h"
#include "kis_base_node.h"
#include "kritaimage_export.h"
#include <QVector>
class QRect;
class QStringList;
class KoProperties;
class KisNodeVisitor;
class KisNodeGraphListener;
class KisNodeProgressProxy;
class KisBusyProgressIndicator;
class KisAbstractProjectionPlane;
class KisProjectionLeaf;
class KisKeyframeChannel;
class KisTimeRange;
class KisUndoAdapter;
/**
* A KisNode is a KisBaseNode that knows about its direct peers, parent
* and children and whether it can have children.
*
* THREAD-SAFETY: All const methods of this class and setDirty calls
* are considered to be thread-safe(!). All the others
* especially add(), remove() and setParent() must be
* protected externally.
*
* NOTE: your subclasses must have the Q_OBJECT declaration, even if
* you do not define new signals or slots.
*/
class KRITAIMAGE_EXPORT KisNode : public KisBaseNode
{
friend class KisFilterMaskTest;
Q_OBJECT
public:
/**
* The struct describing the position of the node
* against the filthy node.
* NOTE: please change KisBaseRectsWalker::getPositionToFilthy
* when changing this struct
*/
enum PositionToFilthy {
N_ABOVE_FILTHY = 0x08,
N_FILTHY_PROJECTION = 0x20,
N_FILTHY = 0x40,
N_BELOW_FILTHY = 0x80
};
/**
* Create an empty node without a parent.
*/
KisNode();
/**
* Create a copy of this node. The copy will not have a parent
* node.
*/
KisNode(const KisNode & rhs);
/**
* Delete this node
*/
- virtual ~KisNode();
+ ~KisNode() override;
virtual KisNodeSP clone() const = 0;
- virtual bool accept(KisNodeVisitor &v);
- virtual void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &v) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
/**
* Re-implement this method to add constraints for the
* subclasses that can be added as children to this node
*
* @return false if the given node is not allowed as a child to this node
*/
virtual bool allowAsChild(KisNodeSP) const = 0;
/**
* Set the entire node extent dirty; this percolates up to parent
* nodes all the way to the root node. By default this is the
* empty rect (through KisBaseNode::extent())
*/
virtual void setDirty();
/**
* Add the given rect to the set of dirty rects for this node;
* this percolates up to parent nodes all the way to the root
* node.
*/
virtual void setDirty(const QRect & rect);
/**
* Add the given rects to the set of dirty rects for this node;
* this percolates up to parent nodes all the way to the root
* node.
*/
virtual void setDirty(const QVector<QRect> &rects);
/**
* Add the given region to the set of dirty rects for this node;
* this percolates up to parent nodes all the way to the root
* node, if propagate is true;
*/
virtual void setDirty(const QRegion &region);
/**
* @brief setDirtyDontResetAnimationCache does almost the same thing as usual
* setDirty() call, but doesn't reset the animation cache (since onlion skins are
* not used when rendering animation.
*/
void setDirtyDontResetAnimationCache();
/**
* Informs that the frames in the given range are no longer valid
* and need to be recached.
* @param range frames to invalidate
*/
void invalidateFrames(const KisTimeRange &range, const QRect &rect);
/**
* Informs that the current world time should be changed.
* Might be caused by e.g. undo operation
*/
void requestTimeSwitch(int time);
/**
* \return a pointer to a KisAbstractProjectionPlane interface of
* the node. This interface is used by the image merging
* framework to get information and to blending for the
* layer.
*
* Please note the difference between need/change/accessRect and
* the projectionPlane() interface. The former one gives
* information about internal composition of the layer, and the
* latter one about the total composition, including layer styles,
* pass-through blending and etc.
*/
virtual KisAbstractProjectionPlaneSP projectionPlane() const;
/**
* Synchronizes LoD caches of the node with the current state of it.
* The current level of detail is fetched from the image pointed by
* default bounds object
*/
virtual void syncLodCache();
virtual KisPaintDeviceList getLodCapableDevices() const;
/**
* The rendering of the image may not always happen in the order
* of the main graph. Pass-through nodes ake some subgraphs
* linear, so it the order of rendering change. projectionLeaf()
* is a special interface of KisNode that represents "a graph for
* projection rendering". Therefore the nodes in projectionLeaf()
* graph may have a different order the main one.
*/
virtual KisProjectionLeafSP projectionLeaf() const;
protected:
/**
* \return internal changeRect() of the node. Do not mix with \see
* projectionPlane()
*
* Some filters will cause a change of pixels those are outside
* a requested rect. E.g. we change a rect of 2x2, then we want to
* apply a convolution filter with kernel 4x4 (changeRect is
* (2+2*3)x(2+2*3)=8x8) to that area. The rect that should be updated
* on the layer will be exaclty 8x8. More than that the needRect for
* that update will be 14x14. See \ref needeRect.
*/
virtual QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
/**
* \return internal needRect() of the node. Do not mix with \see
* projectionPlane()
*
* Some filters need pixels outside the current processing rect to
* compute the new value (for instance, convolution filters)
* See \ref changeRect
* See \ref accessRect
*/
virtual QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
/**
* \return internal accessRect() of the node. Do not mix with \see
* projectionPlane()
*
* Shows the area of image, that may be accessed during accessing
* the node.
*
* Example. You have a layer that needs to prepare some rect on a
* projection, say expectedRect. To perform this, the projection
* of all the layers below of the size needRect(expectedRect)
* should be calculeated by the merger beforehand and the layer
* will access some other area of image inside the rect
* accessRect(expectedRect) during updateProjection call.
*
* This knowledge about real access rect of a node is used by the
* scheduler to avoid collisions between two multithreaded updaters
* and so avoid flickering of the image.
*
* Currently, this method has nondefault value for shifted clone
* layers only.
*/
virtual QRect accessRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
public: // Graph methods
/**
* @return the graph sequence number calculated by the associated
* graph listener. You can use it for checking for changes in the
* graph.
*/
int graphSequenceNumber() const;
/**
* @return the graph listener this node belongs to. 0 if the node
* does not belong to a grap listener.
*/
KisNodeGraphListener * graphListener() const;
/**
* Set the graph listener for this node. The graphlistener will be
* informed before and after the list of child nodes has changed.
*/
void setGraphListener(KisNodeGraphListener * graphListener);
/**
* Returns the parent node of this node. This is 0 only for a root
* node; otherwise this will be an actual Node
*/
KisNodeSP parent() const;
/**
* Returns the first child node of this node, or 0 if there are no
* child nodes.
*/
KisNodeSP firstChild() const;
/**
* Returns the last child node of this node, or 0 if there are no
* child nodes.
*/
KisNodeSP lastChild() const;
/**
* Returns the previous sibling of this node in the parent's list.
* This is the node *above* this node in the composition stack. 0
* is returned if this child has no more previous siblings (==
* firstChild())
*/
KisNodeSP prevSibling() const;
/**
* Returns the next sibling of this node in the parent's list.
* This is the node *below* this node in the composition stack. 0
* is returned if this child has no more next siblings (==
* lastChild())
*/
KisNodeSP nextSibling() const;
/**
* Returns how many direct child nodes this node has (not
* recursive).
*/
quint32 childCount() const;
/**
* Retrieve the child node at the specified index.
*
* @return 0 if there is no node at this index.
*/
KisNodeSP at(quint32 index) const;
/**
* Retrieve the index of the specified child node.
*
* @return -1 if the specified node is not a child node of this
* node.
*/
int index(const KisNodeSP node) const;
/**
* Return a list of child nodes of the current node that conform
* to the specified constraints. There are no guarantees about the
* order of the nodes in the list. The function is not recursive.
*
* @param nodeTypes. if not empty, only nodes that inherit the
* classnames in this stringlist will be returned.
* @param properties. if not empty, only nodes for which
* KisNodeBase::check(properties) returns true will be returned.
*/
QList<KisNodeSP> childNodes(const QStringList & nodeTypes, const KoProperties & properties) const;
/**
* @brief findChildByName finds the first child that has the given name
* @param name the name to look for
* @return the first child with the given name
*/
KisNodeSP findChildByName(const QString &name);
public:
/**
* @return the node progress proxy used by this node, if this node has no progress
* proxy, it will return the proxy of its parent, if the parent has no progress proxy
* it will return 0
*/
KisNodeProgressProxy* nodeProgressProxy() const;
KisBusyProgressIndicator* busyProgressIndicator() const;
private:
/**
* Create a node progress proxy for this node. You need to create a progress proxy only
* if the node is going to appear in the layerbox, and it needs to be created before
* the layer box is made aware of the proxy.
*/
void createNodeProgressProxy();
protected:
- KisBaseNodeSP parentCallback() const;
- void notifyParentVisibilityChanged(bool value);
- void baseNodeChangedCallback();
- void baseNodeInvalidateAllFramesCallback();
+ KisBaseNodeSP parentCallback() const override;
+ void notifyParentVisibilityChanged(bool value) override;
+ void baseNodeChangedCallback() override;
+ void baseNodeInvalidateAllFramesCallback() override;
protected:
- virtual void addKeyframeChannel(KisKeyframeChannel* channel);
+ void addKeyframeChannel(KisKeyframeChannel* channel) override;
private:
friend class KisNodeFacade;
friend class KisNodeTest;
friend class KisLayer; // Note: only for setting the preview mask!
/**
* Set the parent of this node.
*/
void setParent(KisNodeWSP parent);
/**
* Add the specified node above the specified node. If aboveThis
* is 0, the node is added at the bottom.
*/
bool add(KisNodeSP newNode, KisNodeSP aboveThis);
/**
* Removes the node at the specified index from the child nodes.
*
* @return false if there is no node at this index
*/
bool remove(quint32 index);
/**
* Removes the node from the child nodes.
*
* @return false if there's no such node in this node.
*/
bool remove(KisNodeSP node);
KisNodeSP prevChildImpl(KisNodeSP child);
KisNodeSP nextChildImpl(KisNodeSP child);
private:
struct Private;
Private * const m_d;
};
Q_DECLARE_METATYPE(KisNodeSP)
Q_DECLARE_METATYPE(KisNodeWSP)
#endif
diff --git a/libs/image/kis_node_progress_proxy.h b/libs/image/kis_node_progress_proxy.h
index 852769481b..7e1257ce9b 100644
--- a/libs/image/kis_node_progress_proxy.h
+++ b/libs/image/kis_node_progress_proxy.h
@@ -1,73 +1,73 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_NODE_PROGRESS_PROXY_H_
#define _KIS_NODE_PROGRESS_PROXY_H_
#include <KoProgressProxy.h>
#include <QObject>
#include <kis_types.h>
#include "kritaimage_export.h"
/**
* This class implements \ref KoProgressProxy and allows node to report progress.
*/
class KRITAIMAGE_EXPORT KisNodeProgressProxy : public QObject, public KoProgressProxy
{
Q_OBJECT
friend class KisNode;
/**
* Create a proxy to report progress when processing, this proxy is associated
* with a node, it will report progress in the node progress bar. This proxy
* will be deleted when @p _node is deleted.
*/
explicit KisNodeProgressProxy(KisNode* _node);
- ~KisNodeProgressProxy();
+ ~KisNodeProgressProxy() override;
public:
- virtual int maximum() const ;
- virtual void setValue(int value);
- virtual void setRange(int minimum, int maximum);
- virtual void setFormat(const QString & format);
+ int maximum() const override ;
+ void setValue(int value) override;
+ void setRange(int minimum, int maximum) override;
+ void setFormat(const QString & format) override;
/**
* @return the current percentage (return -1 if no progress)
*/
int percentage() const;
Q_SIGNALS:
/**
* Emitted when the percentage of the proxy is changed.
* @param _percentage is the progress value in percent
* @param _node is the node that own this \ref KisNodeProgressProxy
*/
void percentageChanged(int _percentage, const KisNodeSP& _node);
private:
/**
* To be called when the node is and will be no longer available
* and this object is going to be deleted as well.
*/
void prepareDestroying();
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/image/kis_onion_skin_compositor.h b/libs/image/kis_onion_skin_compositor.h
index a10871bda3..2e64f7e256 100644
--- a/libs/image/kis_onion_skin_compositor.h
+++ b/libs/image/kis_onion_skin_compositor.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ONION_SKIN_COMPOSITOR_H
#define KIS_ONION_SKIN_COMPOSITOR_H
#include "kis_types.h"
#include "kritaimage_export.h"
class KRITAIMAGE_EXPORT KisOnionSkinCompositor : public QObject
{
Q_OBJECT
public:
KisOnionSkinCompositor();
- ~KisOnionSkinCompositor();
+ ~KisOnionSkinCompositor() override;
static KisOnionSkinCompositor *instance();
void composite(const KisPaintDeviceSP sourceDevice, KisPaintDeviceSP targetDevice, const QRect &rect);
QRect calculateFullExtent(const KisPaintDeviceSP device);
QRect calculateExtent(const KisPaintDeviceSP device);
int configSeqNo() const;
void setColorLabelFilter(QList<int> colors);
public Q_SLOTS:
void configChanged();
Q_SIGNALS:
void sigOnionSkinChanged();
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/image/kis_paint_device.h b/libs/image/kis_paint_device.h
index e0b47c9152..9b3247b781 100644
--- a/libs/image/kis_paint_device.h
+++ b/libs/image/kis_paint_device.h
@@ -1,868 +1,868 @@
/*
* Copyright (c) 2002 patrick julien <freak@codepimps.org>
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINT_DEVICE_IMPL_H_
#define KIS_PAINT_DEVICE_IMPL_H_
#include <QObject>
#include <QRect>
#include <QVector>
#include "kis_debug.h"
#include <KoColorConversionTransformation.h>
#include "kis_types.h"
#include "kis_shared.h"
#include "kis_default_bounds_base.h"
#include <kritaimage_export.h>
class KUndo2Command;
class QRect;
class QImage;
class QPoint;
class QString;
class QColor;
class QIODevice;
class KoColor;
class KoColorSpace;
class KoColorProfile;
class KisDataManager;
class KisPaintDeviceWriter;
class KisKeyframe;
class KisRasterKeyframeChannel;
class KisPaintDeviceFramesInterface;
typedef KisSharedPtr<KisDataManager> KisDataManagerSP;
/**
* A paint device contains the actual pixel data and offers methods
* to read and write pixels. A paint device has an integer x, y position
* (it is not positioned on the image with sub-pixel accuracy).
* A KisPaintDevice doesn't have any fixed size, the size changes dynamically
* when pixels are accessed by an iterator.
*/
class KRITAIMAGE_EXPORT KisPaintDevice
: public QObject
, public KisShared
{
Q_OBJECT
public:
/**
* Create a new paint device with the specified colorspace.
*
* @param colorSpace the colorspace of this paint device
* @param name for debugging purposes
*/
explicit KisPaintDevice(const KoColorSpace * colorSpace, const QString& name = QString());
/**
* Create a new paint device with the specified colorspace. The
* parent node will be notified of changes to this paint device.
*
* @param parent the node that contains this paint device
* @param colorSpace the colorspace of this paint device
* @param defaultBounds boundaries of the device in case it is empty
* @param name for debugging purposes
*/
KisPaintDevice(KisNodeWSP parent, const KoColorSpace * colorSpace, KisDefaultBoundsBaseSP defaultBounds = KisDefaultBoundsBaseSP(), const QString& name = QString());
/**
* Creates a copy of this device.
*
* If \p copyFrames is false, the newly created device clones the
* current frame of \p rhs only (default and efficient
* behavior). If \p copyFrames is true, the new device is a deep
* copy of the source with all the frames included.
*/
KisPaintDevice(const KisPaintDevice& rhs, bool copyFrames = false, KisNode *newParentNode = 0);
- virtual ~KisPaintDevice();
+ ~KisPaintDevice() override;
protected:
/**
* A special constructor for usage in KisPixelSelection. It allows
* two paint devices to share a data manager.
*
* @param explicitDataManager data manager to use inside paint device
* @param src source paint device to copy parameters from
* @param name for debugging purposes
*/
KisPaintDevice(KisDataManagerSP explicitDataManager,
KisPaintDeviceSP src, const QString& name = QString());
public:
/**
* Write the pixels of this paint device into the specified file store.
*/
bool write(KisPaintDeviceWriter &store);
/**
* Fill this paint device with the pixels from the specified file store.
*/
bool read(QIODevice *stream);
public:
/**
* set the parent node of the paint device
*/
void setParentNode(KisNodeWSP parent);
/**
* set the default bounds for the paint device when
* the default pixel is not completely transparent
*/
void setDefaultBounds(KisDefaultBoundsBaseSP bounds);
/**
* the default bounds rect of the paint device
*/
KisDefaultBoundsBaseSP defaultBounds() const;
/**
* Moves the device to these new coordinates (no incremental move)
*/
void moveTo(qint32 x, qint32 y);
/**
* Convenience method for the above.
*/
virtual void moveTo(const QPoint& pt);
/**
* Return an X,Y offset of the device in a convenient form
*/
QPoint offset() const;
/**
* The X offset of the paint device
*/
qint32 x() const;
/**
* The Y offset of the paint device
*/
qint32 y() const;
/**
* set the X offset of the paint device
*/
void setX(qint32 x);
/**
* set the Y offset of the paint device
*/
void setY(qint32 y);
/**
* Retrieve the bounds of the paint device. The size is not exact,
* but may be larger if the underlying datamanager works that way.
* For instance, the tiled datamanager keeps the extent to the nearest
* multiple of 64.
*
* If default pixel is not transparent, then the actual extent
* rect is united with the defaultBounds()->bounds() value
* (the size of the image, usually).
*/
QRect extent() const;
/// Convience method for the above
void extent(qint32 &x, qint32 &y, qint32 &w, qint32 &h) const;
/**
* Get the exact bounds of this paint device. The real solution is
* very slow because it does a linear scanline search, but it
* uses caching, so calling to this function without changing
* the device is quite cheap.
*
* Exactbounds follows these rules:
*
* <ul>
* <li>if default pixel is transparent, then exact bounds
* of actual pixel data are returned
* <li>if default pixel is not transparent, then the union
* (defaultBounds()->bounds() | nonDefaultPixelArea()) is
* returned
* </ul>
* \see calculateExactBounds()
*/
QRect exactBounds() const;
/**
* Relaxed version of the exactBounds() that can be used in tight
* loops. If the exact bounds value is present in the paint
* device cache, returns this value. If the cache is invalidated,
* returns extent() and tries to recalculate the exact bounds not
* faster than once in 1000 ms.
*/
QRect exactBoundsAmortized() const;
/**
* Retuns exact rectangle of the paint device that contains
* non-default pixels. For paint devices with fully transparent
* default pixel is equivalent to exactBounds().
*
* nonDefaultPixelArea() follows these rules:
*
* <ul>
* <li>if default pixel is transparent, then exact bounds
* of actual pixel data are returned. The same as exactBounds()
* <li>if default pixel is not transparent, then calculates the
* rectangle of non-default pixels. May be smaller or greater
* than image bounds
* </ul>
* \see calculateExactBounds()
*/
QRect nonDefaultPixelArea() const;
/**
* Returns a rough approximation of region covered by device.
* For tiled data manager, it region will consist of a number
* of rects each corresponding to a tile.
*/
QRegion region() const;
/**
* The slow version of region() that searches for exact bounds of
* each rectangle in the region
*/
QRegion regionExact() const;
/**
* Cut the paint device down to the specified rect. If the crop
* area is bigger than the paint device, nothing will happen.
*/
void crop(qint32 x, qint32 y, qint32 w, qint32 h);
/// Convience method for the above
void crop(const QRect & r);
/**
* Complete erase the current paint device. Its size will become 0. This
* does not take the selection into account.
*/
virtual void clear();
/**
* Clear the given rectangle to transparent black. The paint device will expand to
* contain the given rect.
*/
void clear(const QRect & rc);
/**
* Frees the memory occupied by the pixels containing default
* values. The extents() and exactBounds() of the image will
* probably also shrink
*/
void purgeDefaultPixels();
/**
* Sets the default pixel. New data will be initialised with this pixel. The pixel is copied: the
* caller still owns the pointer and needs to delete it to avoid memory leaks.
* If frame ID is given, set default pixel for that frame. Otherwise use active frame.
*/
void setDefaultPixel(const KoColor &defPixel);
/**
* Get a pointer to the default pixel.
* If the frame parameter is given, get the default pixel of
* specified frame. Otherwise use currently active frame.
*/
KoColor defaultPixel() const;
/**
* Fill the given rectangle with the given pixel. The paint device will expand to
* contain the given rect.
*/
void fill(const QRect & rc, const KoColor &color);
/**
* Overloaded function. For legacy purposes only.
* Please use fill(const QRect & rc, const KoColor &color) instead
*/
void fill(qint32 x, qint32 y, qint32 w, qint32 h, const quint8 *fillPixel);
public:
/**
* Prepares the device for fastBitBlt opreration. It clears
* the device, switches x,y shifts and colorspace if needed.
* After this call fastBitBltPossible will return true.
* May be used for initialization of temporary devices.
*/
void prepareClone(KisPaintDeviceSP src);
/**
* Make this device to become a clone of \a src. It will have the same
* x,y shifts, colorspace and will share pixels inside \a rect.
* After calling this function:
* (this->extent() >= this->exactBounds() == rect).
*
* Rule of thumb:
*
* "Use makeCloneFrom() or makeCloneFromRough() if and only if you
* are the only owner of the destination paint device and you are
* 100% sure no other thread has access to it"
*/
void makeCloneFrom(KisPaintDeviceSP src, const QRect &rect);
/**
* Make this device to become a clone of \a src. It will have the same
* x,y shifts, colorspace and will share pixels inside \a rect.
* Be careful, this function will copy *at least* \a rect
* of pixels. Actual copy area will be a bigger - it will
* be aligned by tiles borders. So after calling this function:
* (this->extent() == this->exactBounds() >= rect).
*
* Rule of thumb:
*
* "Use makeCloneFrom() or makeCloneFromRough() if and only if you
* are the only owner of the destination paint device and you are
* 100% sure no other thread has access to it"
*/
void makeCloneFromRough(KisPaintDeviceSP src, const QRect &minimalRect);
protected:
friend class KisPaintDeviceTest;
friend class DataReaderThread;
/**
* Checks whether a src paint device can be used as source
* of fast bitBlt operation. The result of the check may
* depend on whether color spaces coinside, whether there is
* any shift of tiles between the devices and etc.
*
* WARNING: This check must be done <i>before</i> performing any
* fast bitBlt operation!
*
* \see fastBitBlt
* \see fastBitBltRough
*/
bool fastBitBltPossible(KisPaintDeviceSP src);
/**
* Clones rect from another paint device. The cloned area will be
* shared between both paint devices as much as possible using
* copy-on-write. Parts of the rect that cannot be shared
* (cross tiles) are deep-copied,
*
* \see fastBitBltPossible
* \see fastBitBltRough
*/
void fastBitBlt(KisPaintDeviceSP src, const QRect &rect);
/**
* The same as \ref fastBitBlt() but reads old data
*/
void fastBitBltOldData(KisPaintDeviceSP src, const QRect &rect);
/**
* Clones rect from another paint device in a rough and fast way.
* All the tiles touched by rect will be shared, between both
* devices, that means it will copy a bigger area than was
* requested. This method is supposed to be used for bitBlt'ing
* into temporary paint devices.
*
* \see fastBitBltPossible
* \see fastBitBlt
*/
void fastBitBltRough(KisPaintDeviceSP src, const QRect &rect);
/**
* The same as \ref fastBitBltRough() but reads old data
*/
void fastBitBltRoughOldData(KisPaintDeviceSP src, const QRect &rect);
public:
/**
* Read the bytes representing the rectangle described by x, y, w, h into
* data. If data is not big enough, Krita will gladly overwrite the rest
* of your precious memory.
*
* Since this is a copy, you need to make sure you have enough memory.
*
* Reading from areas not previously initialized will read the default
* pixel value into data but not initialize that region.
*/
void readBytes(quint8 * data, qint32 x, qint32 y, qint32 w, qint32 h) const;
/**
* Read the bytes representing the rectangle rect into
* data. If data is not big enough, Krita will gladly overwrite the rest
* of your precious memory.
*
* Since this is a copy, you need to make sure you have enough memory.
*
* Reading from areas not previously initialized will read the default
* pixel value into data but not initialize that region.
* @param data The address of the memory to receive the bytes read
* @param rect The rectangle in the paint device to read from
*/
void readBytes(quint8 * data, const QRect &rect) const;
/**
* Copy the bytes in data into the rect specified by x, y, w, h. If the
* data is too small or uninitialized, Krita will happily read parts of
* memory you never wanted to be read.
*
* If the data is written to areas of the paint device not previously initialized,
* the paint device will grow.
*/
void writeBytes(const quint8 * data, qint32 x, qint32 y, qint32 w, qint32 h);
/**
* Copy the bytes in data into the rectangle rect. If the
* data is too small or uninitialized, Krita will happily read parts of
* memory you never wanted to be read.
*
* If the data is written to areas of the paint device not previously initialized,
* the paint device will grow.
* @param data The address of the memory to write bytes from
* @param rect The rectangle in the paint device to write to
*/
void writeBytes(const quint8 * data, const QRect &rect);
/**
* Copy the bytes in the paint device into a vector of arrays of bytes,
* where the number of arrays is the number of channels in the
* paint device. If the specified area is larger than the paint
* device's extent, the default pixel will be read.
*/
QVector<quint8*> readPlanarBytes(qint32 x, qint32 y, qint32 w, qint32 h) const;
/**
* Write the data in the separate arrays to the channes. If there
* are less vectors than channels, the remaining channels will not
* be copied. If any of the arrays points to 0, the channel in
* that location will not be touched. If the specified area is
* larger than the paint device, the paint device will be
* extended. There are no guards: if the area covers more pixels
* than there are bytes in the arrays, krita will happily fill
* your paint device with areas of memory you never wanted to be
* read. Krita may also crash.
*
* XXX: what about undo?
*/
void writePlanarBytes(QVector<quint8*> planes, qint32 x, qint32 y, qint32 w, qint32 h);
/**
* Converts the paint device to a different colorspace
*
* @return a command that can be used to undo the conversion.
*/
KUndo2Command* convertTo(const KoColorSpace * dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags());
/**
* Changes the profile of the colorspace of this paint device to the given
* profile. If the given profile is 0, nothing happens.
*/
bool setProfile(const KoColorProfile * profile);
/**
* Fill this paint device with the data from image; starting at (offsetX, offsetY)
* @param srcProfileName name of the RGB profile to interpret the image as. 0 is interpreted as sRGB
*/
void convertFromQImage(const QImage& image, const KoColorProfile *profile, qint32 offsetX = 0, qint32 offsetY = 0);
/**
* Create an RGBA QImage from a rectangle in the paint device.
*
* @param x Left coordinate of the rectangle
* @param y Top coordinate of the rectangle
* @param w Width of the rectangle in pixels
* @param h Height of the rectangle in pixels
* @param dstProfile RGB profile to use in conversion. May be 0, in which
* case it's up to the color strategy to choose a profile (most
* like sRGB).
*/
QImage convertToQImage(const KoColorProfile *dstProfile, qint32 x, qint32 y, qint32 w, qint32 h,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags()) const;
/**
* Overridden method for convenience
*/
QImage convertToQImage(const KoColorProfile *dstProfile,
const QRect &rc,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags()) const;
/**
* Create an RGBA QImage from a rectangle in the paint device. The
* rectangle is defined by the parent image's bounds.
*
* @param dstProfile RGB profile to use in conversion. May be 0, in which
* case it's up to the color strategy to choose a profile (most
* like sRGB).
*/
QImage convertToQImage(const KoColorProfile * dstProfile,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags()) const;
/**
* Creates a paint device thumbnail of the paint device, retaining
* the aspect ratio. The width and height of the returned device
* won't exceed \p maxw and \p maxw, but they may be smaller.
*
* @param maxw: maximum width
* @param maxh: maximum height
* @param rect: only this rect will be used for the thumbnail
*
*/
KisPaintDeviceSP createThumbnailDevice(qint32 w, qint32 h, QRect rect = QRect(), QRect outputRect = QRect()) const;
KisPaintDeviceSP createThumbnailDeviceOversampled(qint32 w, qint32 h, qreal oversample, QRect rect = QRect(), QRect outputRect = QRect()) const;
/**
* Creates a thumbnail of the paint device, retaining the aspect ratio.
* The width and height of the returned QImage won't exceed \p maxw and \p maxw, but they may be smaller.
* The colors are not corrected for display!
*
* @param maxw: maximum width
* @param maxh: maximum height
* @param rect: only this rect will be used for the thumbnail
* @param oversample: ratio used for antialiasing
*/
QImage createThumbnail(qint32 maxw, qint32 maxh, QRect rect, qreal oversample = 1,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags());
/**
* Cached version of createThumbnail(qint32 maxw, qint32 maxh, const KisSelection *selection, QRect rect)
*/
QImage createThumbnail(qint32 maxw, qint32 maxh, qreal oversample = 1,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags());
/**
* Fill c and opacity with the values found at x and y.
*
* The color values will be transformed from the profile of
* this paint device to the display profile.
*
* @return true if the operation was successful.
*/
bool pixel(qint32 x, qint32 y, QColor *c) const;
/**
* Fill kc with the values found at x and y. This method differs
* from the above in using KoColor, which can be of any colorspace
*
* The color values will be transformed from the profile of
* this paint device to the display profile.
*
* @return true if the operation was successful.
*/
bool pixel(qint32 x, qint32 y, KoColor * kc) const;
/**
* Set the specified pixel to the specified color. Note that this
* bypasses KisPainter. the PaintDevice is here used as an equivalent
* to QImage, not QPixmap. This means that this is not undoable; also,
* there is no compositing with an existing value at this location.
*
* The color values will be transformed from the display profile to
* the paint device profile.
*
* Note that this will use 8-bit values and may cause a significant
* degradation when used on 16-bit or hdr quality images.
*
* @return true if the operation was successful
*/
bool setPixel(qint32 x, qint32 y, const QColor& c);
/// Convience method for the above
bool setPixel(qint32 x, qint32 y, const KoColor& kc);
/**
* @return the colorspace of the pixels in this paint device
*/
const KoColorSpace* colorSpace() const;
/**
* There is quite a common technique in Krita. It is used in
* cases, when we want to paint something over a paint device
* using the composition, opacity or selection. E.g. painting a
* dab in a paint op, filling the selection in the Fill Tool.
* Such work is usually done in the following way:
*
* 1) Create a paint device
*
* 2) Fill it with the desired color or data
*
* 3) Create a KisPainter and set all the properties of the
* trasaction: selection, compositeOp, opacity and etc.
*
* 4) Paint a newly created paint device over the destination
* device.
*
* The following two methods (createCompositionSourceDevice() or
* createCompositionSourceDeviceFixed())should be used for the
* accomplishing the step 1). The point is that the desired color
* space of the temporary device may not coincide with the color
* space of the destination. That is the case, for example, for
* the alpha8() colorspace used in the selections. So for such
* devices the temporary target would have a different (grayscale)
* color space.
*
* So there are two rules of thumb:
*
* 1) If you need a temporary device which you are going to fill
* with some data and then paint over the paint device, create
* it with either createCompositionSourceDevice() or
* createCompositionSourceDeviceFixed().
*
* 2) Do *not* expect that the color spaces of the destination and
* the temporary device would coincide. If you need to copy a
* single pixel from one device to another, you can use
* KisCrossDeviceColorPicker class, that will handle all the
* necessary conversions for you.
*
* \see createCompositionSourceDeviceFixed()
* \see compositionSourceColorSpace()
* \see KisCrossDeviceColorPicker
* \see KisCrossDeviceColorPickerInt
*/
KisPaintDeviceSP createCompositionSourceDevice() const;
/**
* The same as createCompositionSourceDevice(), but initializes the
* newly created device with the content of \p cloneSource
*
* \see createCompositionSourceDevice()
*/
KisPaintDeviceSP createCompositionSourceDevice(KisPaintDeviceSP cloneSource) const;
/**
* The same as createCompositionSourceDevice(), but initializes
* the newly created device with the *rough* \p roughRect of
* \p cloneSource.
*
* "Rough rect" means that it may copy a bit more than
* requested. It is expected that the caller will not use the area
* outside \p roughRect.
*
* \see createCompositionSourceDevice()
*/
KisPaintDeviceSP createCompositionSourceDevice(KisPaintDeviceSP cloneSource, const QRect roughRect) const;
/**
* This is a convenience method for createCompositionSourceDevice()
*
* \see createCompositionSourceDevice()
*/
KisFixedPaintDeviceSP createCompositionSourceDeviceFixed() const;
/**
* This is a lowlevel method for the principle used in
* createCompositionSourceDevice(). In most of the cases the paint
* device creation methods should be used instead of this function.
*
* \see createCompositionSourceDevice()
* \see createCompositionSourceDeviceFixed()
*/
virtual const KoColorSpace* compositionSourceColorSpace() const;
/**
* @return the internal datamanager that keeps the pixels.
*/
KisDataManagerSP dataManager() const;
/**
* Replace the pixel data, color strategy, and profile.
*/
void setDataManager(KisDataManagerSP data, const KoColorSpace * colorSpace = 0);
/**
* Return the number of bytes a pixel takes.
*/
quint32 pixelSize() const;
/**
* Return the number of channels a pixel takes
*/
quint32 channelCount() const;
/**
* Create a keyframe channel for the content on this device.
* @param id identifier for the channel
* @param node the parent node for the channel
* @return keyframe channel
*/
KisRasterKeyframeChannel *createKeyframeChannel(const KoID &id);
KisRasterKeyframeChannel* keyframeChannel() const;
/**
* An interface to modify/load/save frames stored inside this device
*/
KisPaintDeviceFramesInterface* framesInterface();
public:
/**
* Add the specified rect to the parent layer's set of dirty rects
* (if there is a parent layer)
*/
void setDirty(const QRect & rc);
/**
* Add the specified region to the parent layer's dirty region
* (if there is a parent layer)
*/
void setDirty(const QRegion & region);
/**
* Set the parent layer completely dirty, if this paint device has
* as parent layer.
*/
void setDirty();
void setDirty(const QVector<QRect> rects);
/**
* Called by KisTransactionData when it thinks current time should
* be changed. And the requests is forwarded to the image if
* needed.
*/
void requestTimeSwitch(int time);
/**
* \return a sequence number corresponding to the current paint
* device state. Every time the paint device is changed,
* the sequence number is increased
*/
int sequenceNumber() const;
public:
KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w);
KisHLineConstIteratorSP createHLineConstIteratorNG(qint32 x, qint32 y, qint32 w) const;
KisVLineIteratorSP createVLineIteratorNG(qint32 x, qint32 y, qint32 h);
KisVLineConstIteratorSP createVLineConstIteratorNG(qint32 x, qint32 y, qint32 h) const;
KisRandomAccessorSP createRandomAccessorNG(qint32 x, qint32 y);
KisRandomConstAccessorSP createRandomConstAccessorNG(qint32 x, qint32 y) const;
/**
* Create an iterator that will "artificially" extend the paint device with the
* value of the border when trying to access values outside the range of data.
*
* @param rc indicates the rectangle that truly contains data
*/
KisRepeatHLineConstIteratorSP createRepeatHLineConstIterator(qint32 x, qint32 y, qint32 w, const QRect& _dataWidth) const;
/**
* Create an iterator that will "artificially" extend the paint device with the
* value of the border when trying to access values outside the range of data.
*
* @param rc indicates the rectangle that trully contains data
*/
KisRepeatVLineConstIteratorSP createRepeatVLineConstIterator(qint32 x, qint32 y, qint32 h, const QRect& _dataWidth) const;
/**
* This function create a random accessor which can easily access to sub pixel values.
* @param selection an up-to-date selection that has the same origin as the paint device
*/
KisRandomSubAccessorSP createRandomSubAccessor() const;
/** Clear the selected pixels from the paint device */
void clearSelection(KisSelectionSP selection);
Q_SIGNALS:
void profileChanged(const KoColorProfile * profile);
void colorSpaceChanged(const KoColorSpace *colorspace);
public:
friend class PaintDeviceCache;
/**
* Caclculates exact bounds of the device. Used internally
* by a transparent caching system. The solution is very slow
* because it does a linear scanline search. So the complexity
* is n*n at worst.
*
* \see exactBounds(), nonDefaultPixelArea()
*/
QRect calculateExactBounds(bool nonDefaultOnly) const;
public:
struct MemoryReleaseObject : public QObject {
- ~MemoryReleaseObject();
+ ~MemoryReleaseObject() override;
};
static MemoryReleaseObject* createMemoryReleaseObject();
public:
struct LodDataStruct {
virtual ~LodDataStruct();
};
QRegion regionForLodSyncing() const;
LodDataStruct* createLodDataStruct(int lod);
void updateLodDataStruct(LodDataStruct *dst, const QRect &srcRect);
void uploadLodDataStruct(LodDataStruct *dst);
void setProjectionDevice(bool value);
void tesingFetchLodDevice(KisPaintDeviceSP targetDevice);
private:
KisPaintDevice& operator=(const KisPaintDevice&);
void init(const KoColorSpace *colorSpace,
KisDefaultBoundsBaseSP defaultBounds,
KisNodeWSP parent, const QString& name);
// Only KisPainter is allowed to have access to these low-level methods
friend class KisPainter;
/**
* Return a vector with in order the size in bytes of the channels
* in the colorspace of this paint device.
*/
QVector<qint32> channelSizes() const;
void emitColorSpaceChanged();
void emitProfileChanged();
private:
friend class KisPaintDeviceFramesInterface;
protected:
friend class KisSelectionTest;
KisNodeWSP parentNode() const;
private:
struct Private;
Private * const m_d;
};
#endif // KIS_PAINT_DEVICE_IMPL_H_
diff --git a/libs/image/kis_paint_device_cache.h b/libs/image/kis_paint_device_cache.h
index 39062ba664..bbc967089f 100644
--- a/libs/image/kis_paint_device_cache.h
+++ b/libs/image/kis_paint_device_cache.h
@@ -1,170 +1,170 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINT_DEVICE_CACHE_H
#define __KIS_PAINT_DEVICE_CACHE_H
#include "kis_lock_free_cache.h"
#include <QElapsedTimer>
class KisPaintDeviceCache
{
public:
KisPaintDeviceCache(KisPaintDevice *paintDevice)
: m_paintDevice(paintDevice),
m_exactBoundsCache(paintDevice),
m_nonDefaultPixelAreaCache(paintDevice),
m_regionCache(paintDevice),
m_sequenceNumber(0)
{
}
KisPaintDeviceCache(const KisPaintDeviceCache &rhs)
: m_paintDevice(rhs.m_paintDevice),
m_exactBoundsCache(rhs.m_paintDevice),
m_nonDefaultPixelAreaCache(rhs.m_paintDevice),
m_regionCache(rhs.m_paintDevice),
m_sequenceNumber(0)
{
}
void setupCache() {
invalidate();
}
void invalidate() {
m_thumbnailsValid = false;
m_exactBoundsCache.invalidate();
m_nonDefaultPixelAreaCache.invalidate();
m_regionCache.invalidate();
m_sequenceNumber++;
}
QRect exactBounds() {
return m_exactBoundsCache.getValue();
}
QRect exactBoundsAmortized() {
QRect bounds;
bool result = m_exactBoundsCache.tryGetValue(bounds);
if (!result) {
/**
* The calculation of the exact bounds might be too slow
* in some special cases, e.g. for an empty canvas of 7k
* by 6k. So we just always return extent, when the exact
* bounds is not available.
*/
bounds = m_paintDevice->extent();
}
return bounds;
}
QRect nonDefaultPixelArea() {
return m_nonDefaultPixelAreaCache.getValue();
}
QRegion region() {
return m_regionCache.getValue();
}
QImage createThumbnail(qint32 w, qint32 h, qreal oversample, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) {
QImage thumbnail;
if (h == 0 || w == 0) {
return thumbnail;
}
if (m_thumbnailsValid) {
thumbnail = findThumbnail(w, h, oversample);
}
else {
m_thumbnails.clear();
m_thumbnailsValid = true;
}
if (thumbnail.isNull()) {
thumbnail = m_paintDevice->createThumbnail(w, h, QRect(), oversample, renderingIntent, conversionFlags);
cacheThumbnail(w, h, oversample, thumbnail);
}
return thumbnail;
}
int sequenceNumber() const {
return m_sequenceNumber;
}
private:
inline QImage findThumbnail(qint32 w, qint32 h, qreal oversample) {
QImage resultImage;
if (m_thumbnails.contains(w) && m_thumbnails[w].contains(h) && m_thumbnails[w][h].contains(oversample)) {
resultImage = m_thumbnails[w][h][oversample];
}
return resultImage;
}
inline void cacheThumbnail(qint32 w, qint32 h, qreal oversample, QImage image) {
m_thumbnails[w][h][oversample] = image;
}
private:
KisPaintDevice *m_paintDevice;
struct ExactBoundsCache : KisLockFreeCache<QRect> {
ExactBoundsCache(KisPaintDevice *paintDevice) : m_paintDevice(paintDevice) {}
- QRect calculateNewValue() const {
+ QRect calculateNewValue() const override {
return m_paintDevice->calculateExactBounds(false);
}
private:
KisPaintDevice *m_paintDevice;
};
struct NonDefaultPixelCache : KisLockFreeCache<QRect> {
NonDefaultPixelCache(KisPaintDevice *paintDevice) : m_paintDevice(paintDevice) {}
- QRect calculateNewValue() const {
+ QRect calculateNewValue() const override {
return m_paintDevice->calculateExactBounds(true);
}
private:
KisPaintDevice *m_paintDevice;
};
struct RegionCache : KisLockFreeCache<QRegion> {
RegionCache(KisPaintDevice *paintDevice) : m_paintDevice(paintDevice) {}
- QRegion calculateNewValue() const {
+ QRegion calculateNewValue() const override {
return m_paintDevice->dataManager()->region();
}
private:
KisPaintDevice *m_paintDevice;
};
ExactBoundsCache m_exactBoundsCache;
NonDefaultPixelCache m_nonDefaultPixelAreaCache;
RegionCache m_regionCache;
bool m_thumbnailsValid;
QMap<int, QMap<int, QMap<qreal,QImage> > > m_thumbnails;
QAtomicInt m_sequenceNumber;
};
#endif /* __KIS_PAINT_DEVICE_CACHE_H */
diff --git a/libs/image/kis_paint_device_data.h b/libs/image/kis_paint_device_data.h
index 8e9d2555f7..a12a14fb95 100644
--- a/libs/image/kis_paint_device_data.h
+++ b/libs/image/kis_paint_device_data.h
@@ -1,284 +1,284 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINT_DEVICE_DATA_H
#define __KIS_PAINT_DEVICE_DATA_H
#include "KoAlwaysInline.h"
#include "kundo2command.h"
struct DirectDataAccessPolicy {
DirectDataAccessPolicy(KisDataManager *dataManager, KisIteratorCompleteListener *completionListener)
: m_dataManager(dataManager),
m_completionListener(completionListener){}
KisHLineConstIteratorSP createConstIterator(const QRect &rect) {
const int xOffset = 0;
const int yOffset = 0;
return new KisHLineIterator2(m_dataManager, rect.x(), rect.y(), rect.width(), xOffset, yOffset, false, m_completionListener);
}
KisHLineIteratorSP createIterator(const QRect &rect) {
const int xOffset = 0;
const int yOffset = 0;
return new KisHLineIterator2(m_dataManager, rect.x(), rect.y(), rect.width(), xOffset, yOffset, true, m_completionListener);
}
int pixelSize() const {
return m_dataManager->pixelSize();
}
KisDataManager *m_dataManager;
KisIteratorCompleteListener *m_completionListener;
};
class KisPaintDeviceData
{
public:
KisPaintDeviceData(KisPaintDevice *paintDevice)
: m_cache(paintDevice),
m_x(0), m_y(0),
m_colorSpace(0),
m_levelOfDetail(0),
m_cacheInvalidator(this)
{
}
KisPaintDeviceData(const KisPaintDeviceData *rhs, bool cloneContent)
: m_dataManager(cloneContent ?
new KisDataManager(*rhs->m_dataManager) :
new KisDataManager(rhs->m_dataManager->pixelSize(), rhs->m_dataManager->defaultPixel())),
m_cache(rhs->m_cache),
m_x(rhs->m_x),
m_y(rhs->m_y),
m_colorSpace(rhs->m_colorSpace),
m_levelOfDetail(rhs->m_levelOfDetail),
m_cacheInvalidator(this)
{
m_cache.setupCache();
}
void init(const KoColorSpace *cs, KisDataManagerSP dataManager) {
m_colorSpace = cs;
m_dataManager = dataManager;
m_cache.setupCache();
}
class ChangeColorSpaceCommand : public KUndo2Command {
public:
ChangeColorSpaceCommand(KisPaintDeviceData *data,
KisDataManagerSP oldDm, KisDataManagerSP newDm,
const KoColorSpace *oldCs, const KoColorSpace *newCs,
KUndo2Command *parent)
: KUndo2Command(parent),
m_firstRun(true),
m_data(data),
m_oldDm(oldDm),
m_newDm(newDm),
m_oldCs(oldCs),
m_newCs(newCs)
{
}
void forcedRedo() {
m_data->m_dataManager = m_newDm;
m_data->m_colorSpace = m_newCs;
m_data->m_cache.setupCache();
}
- void redo() {
+ void redo() override {
KUndo2Command::redo();
if (!m_firstRun) {
m_firstRun = false;
return;
}
forcedRedo();
}
- void undo() {
+ void undo() override {
m_data->m_dataManager = m_oldDm;
m_data->m_colorSpace = m_oldCs;
m_data->m_cache.setupCache();
KUndo2Command::undo();
}
private:
bool m_firstRun;
KisPaintDeviceData *m_data;
KisDataManagerSP m_oldDm;
KisDataManagerSP m_newDm;
const KoColorSpace *m_oldCs;
const KoColorSpace *m_newCs;
};
void assignColorSpace(const KoColorSpace *dstColorSpace) {
KIS_ASSERT_RECOVER_RETURN(m_colorSpace->pixelSize() == dstColorSpace->pixelSize());
m_colorSpace = dstColorSpace;
m_cache.invalidate();
}
void convertDataColorSpace(const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags, KUndo2Command *parentCommand) {
typedef KisSequentialIteratorBase<ReadOnlyIteratorPolicy<DirectDataAccessPolicy>, DirectDataAccessPolicy> InternalSequentialConstIterator;
typedef KisSequentialIteratorBase<WritableIteratorPolicy<DirectDataAccessPolicy>, DirectDataAccessPolicy> InternalSequentialIterator;
if (m_colorSpace == dstColorSpace || *m_colorSpace == *dstColorSpace) {
return;
}
QRect rc = m_dataManager->region().boundingRect();
const int dstPixelSize = dstColorSpace->pixelSize();
QScopedArrayPointer<quint8> dstDefaultPixel(new quint8[dstPixelSize]);
memset(dstDefaultPixel.data(), 0, dstPixelSize);
m_colorSpace->convertPixelsTo(m_dataManager->defaultPixel(), dstDefaultPixel.data(), dstColorSpace, 1, renderingIntent, conversionFlags);
KisDataManagerSP dstDataManager = new KisDataManager(dstPixelSize, dstDefaultPixel.data());
if (!rc.isEmpty()) {
InternalSequentialConstIterator srcIt(DirectDataAccessPolicy(m_dataManager.data(), cacheInvalidator()), rc);
InternalSequentialIterator dstIt(DirectDataAccessPolicy(dstDataManager.data(), cacheInvalidator()), rc);
int nConseqPixels = 0;
do {
nConseqPixels = srcIt.nConseqPixels();
const quint8 *srcData = srcIt.rawDataConst();
quint8 *dstData = dstIt.rawData();
m_colorSpace->convertPixelsTo(srcData, dstData,
dstColorSpace,
nConseqPixels,
renderingIntent, conversionFlags);
} while(srcIt.nextPixels(nConseqPixels) &&
dstIt.nextPixels(nConseqPixels));
}
// becomes owned by the parent
ChangeColorSpaceCommand *cmd =
new ChangeColorSpaceCommand(this,
m_dataManager, dstDataManager,
m_colorSpace, dstColorSpace,
parentCommand);
cmd->forcedRedo();
}
void prepareClone(const KisPaintDeviceData *srcData, bool copyContent = false) {
m_x = srcData->x();
m_y = srcData->y();
if (copyContent) {
m_dataManager = new KisDataManager(*srcData->dataManager());
} else if (m_dataManager->pixelSize() !=
srcData->dataManager()->pixelSize()) {
// NOTE: we don't check default pixel value! it is the task of
// the higher level!
m_dataManager = new KisDataManager(srcData->dataManager()->pixelSize(), srcData->dataManager()->defaultPixel());
m_cache.setupCache();
} else {
m_dataManager->clear();
const quint8 *srcDefPixel = srcData->dataManager()->defaultPixel();
const int cmp =
memcmp(srcDefPixel,
m_dataManager->defaultPixel(),
m_dataManager->pixelSize());
if (cmp != 0) {
m_dataManager->setDefaultPixel(srcDefPixel);
}
}
m_levelOfDetail = srcData->levelOfDetail();
m_colorSpace = srcData->colorSpace();
m_cache.invalidate();
}
ALWAYS_INLINE KisDataManagerSP dataManager() const {
return m_dataManager;
}
ALWAYS_INLINE KisPaintDeviceCache* cache() {
return &m_cache;
}
ALWAYS_INLINE qint32 x() const {
return m_x;
}
ALWAYS_INLINE void setX(qint32 value) {
m_x = value;
}
ALWAYS_INLINE qint32 y() const {
return m_y;
}
ALWAYS_INLINE void setY(qint32 value) {
m_y = value;
}
ALWAYS_INLINE const KoColorSpace* colorSpace() const {
return m_colorSpace;
}
ALWAYS_INLINE qint32 levelOfDetail() const {
return m_levelOfDetail;
}
ALWAYS_INLINE void setLevelOfDetail(qint32 value) {
m_levelOfDetail = value;
}
ALWAYS_INLINE KisIteratorCompleteListener* cacheInvalidator() {
return &m_cacheInvalidator;
}
private:
struct CacheInvalidator : public KisIteratorCompleteListener {
CacheInvalidator(KisPaintDeviceData *_q) : q(_q) {}
- void notifyWritableIteratorCompleted() {
+ void notifyWritableIteratorCompleted() override {
q->cache()->invalidate();
}
private:
KisPaintDeviceData *q;
};
private:
KisDataManagerSP m_dataManager;
KisPaintDeviceCache m_cache;
qint32 m_x;
qint32 m_y;
const KoColorSpace* m_colorSpace;
qint32 m_levelOfDetail;
CacheInvalidator m_cacheInvalidator;
};
#endif /* __KIS_PAINT_DEVICE_DATA_H */
diff --git a/libs/image/kis_paint_device_strategies.h b/libs/image/kis_paint_device_strategies.h
index e8899b3eb7..de4ba6a60d 100644
--- a/libs/image/kis_paint_device_strategies.h
+++ b/libs/image/kis_paint_device_strategies.h
@@ -1,450 +1,450 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINT_DEVICE_STRATEGIES_H
#define __KIS_PAINT_DEVICE_STRATEGIES_H
#include "kis_wrapped_rect.h"
#include "kis_wrapped_hline_iterator.h"
#include "kis_wrapped_vline_iterator.h"
#include "kis_wrapped_random_accessor.h"
class KisPaintDevice::Private::KisPaintDeviceStrategy
{
public:
KisPaintDeviceStrategy(KisPaintDevice *device,
KisPaintDevice::Private *d)
: m_device(device), m_d(d)
{
}
virtual ~KisPaintDeviceStrategy() {
}
virtual void move(const QPoint& pt) {
m_d->setX(pt.x());
m_d->setY(pt.y());
m_d->cache()->invalidate();
}
virtual QRect extent() const {
QRect extent;
qint32 x, y, w, h;
m_d->dataManager()->extent(x, y, w, h);
x += m_d->x();
y += m_d->y();
extent = QRect(x, y, w, h);
quint8 defaultOpacity = m_device->defaultPixel().opacityU8();
if (defaultOpacity != OPACITY_TRANSPARENT_U8)
extent |= m_d->defaultBounds->bounds();
return extent;
}
virtual QRegion region() const {
return m_d->cache()->region().translated(m_d->x(), m_d->y());
}
virtual void crop(const QRect &rect) {
m_d->dataManager()->setExtent(rect.translated(-m_d->x(), -m_d->y()));
m_d->cache()->invalidate();
}
virtual void clear(const QRect & rc) {
KisDataManagerSP dm = m_d->dataManager();
dm->clear(rc.x() - m_d->x(), rc.y() - m_d->y(),
rc.width(), rc.height(),
dm->defaultPixel());
m_d->cache()->invalidate();
}
virtual void fill(const QRect &rc, const quint8 *fillPixel) {
m_d->dataManager()->clear(rc.x() - m_d->x(),
rc.y() - m_d->y(),
rc.width(),
rc.height(),
fillPixel);
m_d->cache()->invalidate();
}
virtual KisHLineIteratorSP createHLineIteratorNG(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY) {
return new KisHLineIterator2(dataManager, x, y, w, offsetX, offsetY, true, m_d->cacheInvalidator());
}
virtual KisHLineConstIteratorSP createHLineConstIteratorNG(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY) const {
return new KisHLineIterator2(dataManager, x, y, w, offsetX, offsetY, false, m_d->cacheInvalidator());
}
virtual KisVLineIteratorSP createVLineIteratorNG(qint32 x, qint32 y, qint32 w) {
m_d->cache()->invalidate();
return new KisVLineIterator2(m_d->dataManager().data(), x, y, w, m_d->x(), m_d->y(), true, m_d->cacheInvalidator());
}
virtual KisVLineConstIteratorSP createVLineConstIteratorNG(qint32 x, qint32 y, qint32 w) const {
return new KisVLineIterator2(m_d->dataManager().data(), x, y, w, m_d->x(), m_d->y(), false, m_d->cacheInvalidator());
}
virtual KisRandomAccessorSP createRandomAccessorNG(qint32 x, qint32 y) {
m_d->cache()->invalidate();
return new KisRandomAccessor2(m_d->dataManager().data(), x, y, m_d->x(), m_d->y(), true, m_d->cacheInvalidator());
}
virtual KisRandomConstAccessorSP createRandomConstAccessorNG(qint32 x, qint32 y) const {
return new KisRandomAccessor2(m_d->dataManager().data(), x, y, m_d->x(), m_d->y(), false, m_d->cacheInvalidator());
}
virtual void fastBitBlt(KisPaintDeviceSP src, const QRect &rect) {
Q_ASSERT(m_device->fastBitBltPossible(src));
fastBitBltImpl(src->dataManager(), rect);
}
virtual void fastBitBltOldData(KisPaintDeviceSP src, const QRect &rect) {
Q_ASSERT(m_device->fastBitBltPossible(src));
m_d->dataManager()->bitBltOldData(src->dataManager(), rect.translated(-m_d->x(), -m_d->y()));
m_d->cache()->invalidate();
}
virtual void fastBitBltRough(KisPaintDeviceSP src, const QRect &rect) {
Q_ASSERT(m_device->fastBitBltPossible(src));
fastBitBltRoughImpl(src->dataManager(), rect);
}
virtual void fastBitBltRough(KisDataManagerSP srcDataManager, const QRect &rect) {
fastBitBltRoughImpl(srcDataManager, rect);
}
virtual void fastBitBltRoughOldData(KisPaintDeviceSP src, const QRect &rect) {
Q_ASSERT(m_device->fastBitBltPossible(src));
m_d->dataManager()->bitBltRoughOldData(src->dataManager(), rect.translated(-m_d->x(), -m_d->y()));
m_d->cache()->invalidate();
}
virtual void readBytes(quint8 *data, const QRect &rect) const {
readBytesImpl(data, rect, -1);
}
virtual void writeBytes(const quint8 * data, const QRect &rect) {
writeBytesImpl(data, rect, -1);
}
virtual QVector<quint8*> readPlanarBytes(qint32 x, qint32 y, qint32 w, qint32 h) const {
return m_d->dataManager()->readPlanarBytes(m_device->channelSizes(), x, y, w, h);
}
virtual void writePlanarBytes(QVector<quint8*> planes, qint32 x, qint32 y, qint32 w, qint32 h) {
m_d->dataManager()->writePlanarBytes(planes, m_device->channelSizes(), x, y, w, h);
m_d->cache()->invalidate();
}
protected:
virtual void readBytesImpl(quint8 *data, const QRect &rect, int dataRowStride) const {
m_d->dataManager()->readBytes(data,
rect.x() - m_d->x(),
rect.y() - m_d->y(),
rect.width(),
rect.height(),
dataRowStride);
}
virtual void writeBytesImpl(const quint8 * data, const QRect &rect, int dataRowStride) {
m_d->dataManager()->writeBytes(data,
rect.x() - m_d->x(),
rect.y() - m_d->y(),
rect.width(),
rect.height(),
dataRowStride);
m_d->cache()->invalidate();
}
virtual void fastBitBltImpl(KisDataManagerSP srcDataManager, const QRect &rect)
{
m_d->dataManager()->bitBlt(srcDataManager, rect.translated(-m_d->x(), -m_d->y()));
m_d->cache()->invalidate();
}
virtual void fastBitBltRoughImpl(KisDataManagerSP srcDataManager, const QRect &rect)
{
m_d->dataManager()->bitBltRough(srcDataManager, rect.translated(-m_d->x(), -m_d->y()));
m_d->cache()->invalidate();
}
protected:
KisPaintDevice *m_device;
KisPaintDevice::Private * const m_d;
};
class KisPaintDevice::Private::KisPaintDeviceWrappedStrategy : public KisPaintDeviceStrategy
{
public:
KisPaintDeviceWrappedStrategy(const QRect &wrapRect,
KisPaintDevice *device,
KisPaintDevice::Private *d)
: KisPaintDeviceStrategy(device, d),
m_wrapRect(wrapRect)
{
}
const QRect wrapRect() const {
return m_wrapRect;
}
- void move(const QPoint& pt) {
+ void move(const QPoint& pt) override {
QPoint offset (pt.x() - m_device->x(), pt.y() - m_device->y());
QRect exactBoundsBeforeMove = m_device->exactBounds();
KisPaintDeviceStrategy::move(pt);
QRegion borderRegion(exactBoundsBeforeMove.translated(offset.x(), offset.y()));
borderRegion -= m_wrapRect;
const int pixelSize = m_device->pixelSize();
Q_FOREACH (const QRect &rc, borderRegion.rects()) {
KisRandomConstAccessorSP srcIt = KisPaintDeviceStrategy::createRandomConstAccessorNG(rc.x(), rc.y());
KisRandomAccessorSP dstIt = createRandomAccessorNG(rc.x(), rc.y());
int rows = 1;
int columns = 1;
for (int y = rc.y(); y <= rc.bottom(); y += rows) {
int rows = qMin(srcIt->numContiguousRows(y), dstIt->numContiguousRows(y));
rows = qMin(rows, rc.bottom() - y + 1);
for (int x = rc.x(); x <= rc.right(); x += columns) {
int columns = qMin(srcIt->numContiguousColumns(x), dstIt->numContiguousColumns(x));
columns = qMin(columns, rc.right() - x + 1);
srcIt->moveTo(x, y);
dstIt->moveTo(x, y);
int srcRowStride = srcIt->rowStride(x, y);
int dstRowStride = dstIt->rowStride(x, y);
const quint8 *srcPtr = srcIt->rawDataConst();
quint8 *dstPtr = dstIt->rawData();
for (int i = 0; i < rows; i++) {
memcpy(dstPtr, srcPtr, pixelSize * columns);
srcPtr += srcRowStride;
dstPtr += dstRowStride;
}
}
}
}
}
- QRect extent() const {
+ QRect extent() const override {
return KisPaintDeviceStrategy::extent() & m_wrapRect;
}
- QRegion region() const {
+ QRegion region() const override {
return KisPaintDeviceStrategy::region() & m_wrapRect;
}
- void crop(const QRect &rect) {
+ void crop(const QRect &rect) override {
KisPaintDeviceStrategy::crop(rect & m_wrapRect);
}
- void clear(const QRect &rect) {
+ void clear(const QRect &rect) override {
KisWrappedRect splitRect(rect, m_wrapRect);
Q_FOREACH (const QRect &rc, splitRect) {
KisPaintDeviceStrategy::clear(rc);
}
}
- void fill(const QRect &rect, const quint8 *fillPixel) {
+ void fill(const QRect &rect, const quint8 *fillPixel) override {
KisWrappedRect splitRect(rect, m_wrapRect);
Q_FOREACH (const QRect &rc, splitRect) {
KisPaintDeviceStrategy::fill(rc, fillPixel);
}
}
- virtual KisHLineIteratorSP createHLineIteratorNG(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY) {
+ KisHLineIteratorSP createHLineIteratorNG(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY) override {
KisWrappedRect splitRect(QRect(x, y, w, m_wrapRect.height()), m_wrapRect);
if (!splitRect.isSplit()) {
return KisPaintDeviceStrategy::createHLineIteratorNG(dataManager, x, y, w, offsetX, offsetY);
}
return new KisWrappedHLineIterator(dataManager, splitRect, offsetX, offsetY, true, m_d->cacheInvalidator());
}
- virtual KisHLineConstIteratorSP createHLineConstIteratorNG(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY) const {
+ KisHLineConstIteratorSP createHLineConstIteratorNG(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY) const override {
KisWrappedRect splitRect(QRect(x, y, w, m_wrapRect.height()), m_wrapRect);
if (!splitRect.isSplit()) {
return KisPaintDeviceStrategy::createHLineConstIteratorNG(dataManager, x, y, w, offsetX, offsetY);
}
return new KisWrappedHLineIterator(dataManager, splitRect, offsetX, offsetY, false, m_d->cacheInvalidator());
}
- virtual KisVLineIteratorSP createVLineIteratorNG(qint32 x, qint32 y, qint32 h) {
+ KisVLineIteratorSP createVLineIteratorNG(qint32 x, qint32 y, qint32 h) override {
m_d->cache()->invalidate();
KisWrappedRect splitRect(QRect(x, y, m_wrapRect.width(), h), m_wrapRect);
if (!splitRect.isSplit()) {
return KisPaintDeviceStrategy::createVLineIteratorNG(x, y, h);
}
return new KisWrappedVLineIterator(m_d->dataManager().data(), splitRect, m_d->x(), m_d->y(), true, m_d->cacheInvalidator());
}
- virtual KisVLineConstIteratorSP createVLineConstIteratorNG(qint32 x, qint32 y, qint32 h) const {
+ KisVLineConstIteratorSP createVLineConstIteratorNG(qint32 x, qint32 y, qint32 h) const override {
KisWrappedRect splitRect(QRect(x, y, m_wrapRect.width(), h), m_wrapRect);
if (!splitRect.isSplit()) {
return KisPaintDeviceStrategy::createVLineConstIteratorNG(x, y, h);
}
return new KisWrappedVLineIterator(m_d->dataManager().data(), splitRect, m_d->x(), m_d->y(), false, m_d->cacheInvalidator());
}
- virtual KisRandomAccessorSP createRandomAccessorNG(qint32 x, qint32 y) {
+ KisRandomAccessorSP createRandomAccessorNG(qint32 x, qint32 y) override {
m_d->cache()->invalidate();
return new KisWrappedRandomAccessor(m_d->dataManager().data(), x, y, m_d->x(), m_d->y(), true, m_d->cacheInvalidator(), m_wrapRect);
}
- virtual KisRandomConstAccessorSP createRandomConstAccessorNG(qint32 x, qint32 y) const {
+ KisRandomConstAccessorSP createRandomConstAccessorNG(qint32 x, qint32 y) const override {
return new KisWrappedRandomAccessor(m_d->dataManager().data(), x, y, m_d->x(), m_d->y(), false, m_d->cacheInvalidator(), m_wrapRect);
}
- void fastBitBltImpl(KisDataManagerSP srcDataManager, const QRect &rect) {
+ void fastBitBltImpl(KisDataManagerSP srcDataManager, const QRect &rect) override {
KisWrappedRect splitRect(rect, m_wrapRect);
Q_FOREACH (const QRect &rc, splitRect) {
KisPaintDeviceStrategy::fastBitBltImpl(srcDataManager, rc);
}
}
- void fastBitBltOldData(KisPaintDeviceSP src, const QRect &rect) {
+ void fastBitBltOldData(KisPaintDeviceSP src, const QRect &rect) override {
KisWrappedRect splitRect(rect, m_wrapRect);
Q_FOREACH (const QRect &rc, splitRect) {
KisPaintDeviceStrategy::fastBitBltOldData(src, rc);
}
}
- virtual void fastBitBltRoughImpl(KisDataManagerSP srcDataManager, const QRect &rect)
+ void fastBitBltRoughImpl(KisDataManagerSP srcDataManager, const QRect &rect) override
{
// no rough version in wrapped mode
fastBitBltImpl(srcDataManager, rect);
}
- void fastBitBltRoughOldData(KisPaintDeviceSP src, const QRect &rect) {
+ void fastBitBltRoughOldData(KisPaintDeviceSP src, const QRect &rect) override {
// no rough version in wrapped mode
fastBitBltOldData(src, rect);
}
- void readBytes(quint8 *data, const QRect &rect) const {
+ void readBytes(quint8 *data, const QRect &rect) const override {
KisWrappedRect splitRect(rect, m_wrapRect);
if (!splitRect.isSplit()) {
KisPaintDeviceStrategy::readBytes(data, rect);
} else {
const int pixelSize = m_device->pixelSize();
int leftWidth = splitRect[KisWrappedRect::TOPLEFT].width();
int rightWidth = splitRect[KisWrappedRect::TOPRIGHT].width();
int totalHeight = rect.height();
int totalWidth = rect.width();
int dataRowStride = totalWidth * pixelSize;
int bufOffset = 0;
int row = 0;
while (row < totalHeight) {
int leftIndex = KisWrappedRect::TOPLEFT + bufOffset;
int rightIndex = KisWrappedRect::TOPRIGHT + bufOffset;
QPoint leftRectOrigin = splitRect[leftIndex].topLeft();
QPoint rightRectOrigin = splitRect[rightIndex].topLeft();
int height = qMin(splitRect[leftIndex].height(), totalHeight - row);
int col = 0;
while (col < totalWidth) {
int width;
quint8 *dataPtr;
width = qMin(leftWidth, totalWidth - col);
dataPtr = data + pixelSize * (col + row * totalWidth);
readBytesImpl(dataPtr, QRect(leftRectOrigin, QSize(width, height)), dataRowStride);
col += width;
if (col >= totalWidth) break;
width = qMin(rightWidth, totalWidth - col);
dataPtr = data + pixelSize * (col + row * totalWidth);
readBytesImpl(dataPtr, QRect(rightRectOrigin, QSize(width, height)), dataRowStride);
col += width;
}
row += height;
bufOffset = (bufOffset + 2) % 4;
}
}
}
- void writeBytes(const quint8 *data, const QRect &rect) {
+ void writeBytes(const quint8 *data, const QRect &rect) override {
KisWrappedRect splitRect(rect, m_wrapRect);
if (!splitRect.isSplit()) {
KisPaintDeviceStrategy::writeBytes(data, rect);
} else {
const int pixelSize = m_device->pixelSize();
int totalWidth = rect.width();
int dataRowStride = totalWidth * pixelSize;
QRect rc;
QPoint origin;
const quint8 *dataPtr;
origin.rx() = 0;
origin.ry() = 0;
rc = splitRect.topLeft();
dataPtr = data + pixelSize * (origin.x() + totalWidth * origin.y());
writeBytesImpl(dataPtr, rc, dataRowStride);
origin.rx() = splitRect.topLeft().width();
origin.ry() = 0;
rc = splitRect.topRight();
dataPtr = data + pixelSize * (origin.x() + totalWidth * origin.y());
writeBytesImpl(dataPtr, rc, dataRowStride);
origin.rx() = 0;
origin.ry() = splitRect.topLeft().height();
rc = splitRect.bottomLeft();
dataPtr = data + pixelSize * (origin.x() + totalWidth * origin.y());
writeBytesImpl(dataPtr, rc, dataRowStride);
origin.rx() = splitRect.topLeft().width();
origin.ry() = splitRect.topLeft().height();
rc = splitRect.bottomRight();
dataPtr = data + pixelSize * (origin.x() + totalWidth * origin.y());
writeBytesImpl(dataPtr, rc, dataRowStride);
}
}
private:
QRect m_wrapRect;
};
#endif /* __KIS_PAINT_DEVICE_STRATEGIES_H */
diff --git a/libs/image/kis_paint_layer.h b/libs/image/kis_paint_layer.h
index cd1f38679b..472af11f57 100644
--- a/libs/image/kis_paint_layer.h
+++ b/libs/image/kis_paint_layer.h
@@ -1,177 +1,177 @@
/*
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINT_LAYER_H_
#define KIS_PAINT_LAYER_H_
#include "kis_types.h"
#include "kis_layer.h"
#include "kis_indirect_painting_support.h"
#include <QBitArray>
class KoColorSpace;
/**
- * This layer is of a type that can be d on. A paint layer can
+ * This layer is of a type that can be drawn on. A paint layer can
* have any number of effect masks, a transparency mask, a local
* selection and a protection mask.
*
* The protection mask can be read/write, read-only or write-only.
* The transparency mask has two rendering forms: as a selection mask
* and by changing the transparency of the paint layer's pixels.
*/
class KRITAIMAGE_EXPORT KisPaintLayer : public KisLayer, public KisIndirectPaintingSupport
{
Q_OBJECT
public:
/**
* Construct a paint layer with the given parameters. The default bounds of the paintdevice are overwriten.
* @param image this layer belongs to, or null, if it shouldn't belong to any image
* @param name of the layer
* @param opacity in the range between OPACITY_TRANSPARENT_U8 and OPACITY_OPAQUE_U8
* @param dev is the paint device, that should be used
*/
KisPaintLayer(KisImageWSP image, const QString& name, quint8 opacity, KisPaintDeviceSP dev);
/**
* Construct a paint layer with the given parameters
* @param image this layer belongs to. it must not be null and it must have a valid color space.
* @param name of the layer
* @param opacity in the range between OPACITY_TRANSPARENT_U8 and OPACITY_OPAQUE_U8
*/
KisPaintLayer(KisImageWSP image, const QString& name, quint8 opacity);
/**
* Construct a paint layer with the given parameters
* @param image this layer belongs to, or null, if it shouldn't belong to any image. image must not be null, if colorSpace is null
* @param name of the layer
* @param opacity in the range between OPACITY_TRANSPARENT_U8 and OPACITY_OPAQUE_U8
* @param colorSpace is the color space, that should be used to construct the paint device. it can be null, if the image is valid.
*/
KisPaintLayer(KisImageWSP image, const QString& name, quint8 opacity, const KoColorSpace * colorSpace);
/**
* Copy Constructor
*/
KisPaintLayer(const KisPaintLayer& rhs);
- virtual ~KisPaintLayer();
+ ~KisPaintLayer() override;
KisNodeSP clone() const override {
return KisNodeSP(new KisPaintLayer(*this));
}
bool allowAsChild(KisNodeSP) const override;
const KoColorSpace * colorSpace() const override;
bool needProjection() const override;
QIcon icon() const override;
void setImage(KisImageWSP image) override;
KisBaseNode::PropertyList sectionModelProperties() const override;
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override;
public:
QRect extent() const override;
QRect exactBounds() const override;
bool accept(KisNodeVisitor &v) override;
void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
/**
* set the channelflags for locking certain channels (used by painting tools)
* for this layer to the specified bit array.
* The bit array must have exactly the same number of channels as
* the colorspace this layer is in, or be empty, in which case all
* channels are active.
*/
void setChannelLockFlags(const QBitArray& channelFlags);
/**
* Return a bit array where each bit indicates whether a
* particular channel is locked or not (used by painting tools).
* If the channelflags bit array is empty, all channels are active.
*/
const QBitArray& channelLockFlags() const;
/**
* Returns the paintDevice that accompanies this layer
*/
KisPaintDeviceSP paintDevice() const override;
/**
* Returns the original pixels before masks have been applied.
*/
KisPaintDeviceSP original() const override;
/**
* @returns true when painting should not affect the alpha channel
*/
bool alphaLocked() const;
/**
* @param l if true, the alpha channel will be protected from modification
*/
void setAlphaLocked(bool lock);
/**
* @return true if onion skins should be rendered on this layer
*/
bool onionSkinEnabled() const;
/**
* @param state whether onion skins should be rendered
*/
void setOnionSkinEnabled(bool state);
KisPaintDeviceList getLodCapableDevices() const override;
public Q_SLOTS:
void slotExternalUpdateOnionSkins();
public:
// KisIndirectPaintingSupport
KisLayer* layer() {
return this;
}
protected:
// override from KisLayer
void copyOriginalToProjection(const KisPaintDeviceSP original,
KisPaintDeviceSP projection,
const QRect& rect) const override;
KisKeyframeChannel *requestKeyframeChannel(const QString &id) override;
private:
void init(KisPaintDeviceSP paintDevice, const QBitArray &paintChannelFlags = QBitArray());
struct Private;
Private * const m_d;
};
typedef KisSharedPtr<KisPaintLayer> KisPaintLayerSP;
#endif // KIS_PAINT_LAYER_H_
diff --git a/libs/image/kis_pixel_selection.h b/libs/image/kis_pixel_selection.h
index 4db95de4ce..0dfffc4330 100644
--- a/libs/image/kis_pixel_selection.h
+++ b/libs/image/kis_pixel_selection.h
@@ -1,167 +1,167 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PIXEL_SELECTION_H_
#define KIS_PIXEL_SELECTION_H_
#include <QRect>
#include <QPainterPath>
#include "kis_types.h"
#include "kis_global.h"
#include "kis_paint_device.h"
#include "kis_selection_component.h"
#include "kis_selection.h"
#include <kritaimage_export.h>
/**
* KisPixelSelection contains a byte-map representation of a layer, where
* the value of a byte signifies whether a corresponding pixel is selected, or not.
*/
class KRITAIMAGE_EXPORT KisPixelSelection : public KisPaintDevice, public KisSelectionComponent
{
public:
/**
* Create a new KisPixelSelection. This selection will not have a
* parent paint device.
*/
KisPixelSelection(KisDefaultBoundsBaseSP defaultBounds = KisDefaultBoundsBaseSP(), KisSelectionWSP parentSelection = KisSelectionWSP());
/**
* Copy the selection
*/
KisPixelSelection(const KisPixelSelection& rhs);
- virtual ~KisPixelSelection();
+ ~KisPixelSelection() override;
- KisSelectionComponent* clone(KisSelection*);
+ KisSelectionComponent* clone(KisSelection*) override;
- const KoColorSpace* compositionSourceColorSpace() const;
+ const KoColorSpace* compositionSourceColorSpace() const override;
bool read(QIODevice *stream);
/**
* Fill the specified rect with the specified selectedness.
*/
void select(const QRect & r, quint8 selectedness = MAX_SELECTED);
/**
* Invert the total selection. This will also invert the default value
* of the selection paint device, from MIN_SELECTED to MAX_SELECTED or
* back.
*/
void invert();
/**
* Set the specified rect to MIN_SELECTED.
*/
void clear(const QRect & r);
/**
* Reset the entire selection. The selectedRect and selectedExactRect
* will be empty. The selection will be completely deselected.
*/
- void clear();
+ void clear() override;
/**
* Copies alpha channel form the specified \p src device
*/
void copyAlphaFrom(KisPaintDeviceSP src, const QRect &processRect);
/**
* Apply a selection to the selection using the specified selection mode
*/
void applySelection(KisPixelSelectionSP selection, SelectionAction action);
/// Tests if the rect is totally outside the selection
bool isTotallyUnselected(const QRect & r) const;
/**
* Rough, but fastish way of determining the area
* of the tiles used by the selection.
*/
QRect selectedRect() const;
/**
* Slow, but exact way of determining the rectangle
* that encloses the selection.
*/
QRect selectedExactRect() const;
/**
* @brief outline returns the outline of the current selection
* @return a vector of polygons that can be used to draw the outline
*/
QVector<QPolygon> outline() const;
/**
* Overridden from KisPaintDevice to handle outline cache moves
*/
- void moveTo(const QPoint& pt);
+ void moveTo(const QPoint& pt) override;
using KisPaintDevice::moveTo;
- bool isEmpty() const;
- QPainterPath outlineCache() const;
- bool outlineCacheValid() const;
- void recalculateOutlineCache();
+ bool isEmpty() const override;
+ QPainterPath outlineCache() const override;
+ bool outlineCacheValid() const override;
+ void recalculateOutlineCache() override;
void setOutlineCache(const QPainterPath &cache);
void invalidateOutlineCache();
bool thumbnailImageValid() const;
QImage thumbnailImage() const;
QTransform thumbnailImageTransform() const;
void recalculateThumbnailImage(const QColor &maskColor);
void setParentSelection(KisSelectionWSP selection);
KisSelectionWSP parentSelection() const;
- virtual void renderToProjection(KisPaintDeviceSP projection);
- virtual void renderToProjection(KisPaintDeviceSP projection, const QRect& r);
+ void renderToProjection(KisPaintDeviceSP projection) override;
+ void renderToProjection(KisPaintDeviceSP projection, const QRect& r) override;
private:
/**
* Add a selection
*/
void addSelection(KisPixelSelectionSP selection);
/**
* Subtracts a selection
*/
void subtractSelection(KisPixelSelectionSP selection);
/**
* Intersects a selection using min-T-norm for this.
*/
void intersectSelection(KisPixelSelectionSP selection);
private:
// We don't want these methods to be used on selections:
using KisPaintDevice::extent;
using KisPaintDevice::exactBounds;
private:
struct Private;
Private * const m_d;
};
#endif // KIS_PIXEL_SELECTION_H_
diff --git a/libs/image/kis_polygonal_gradient_shape_strategy.h b/libs/image/kis_polygonal_gradient_shape_strategy.h
index 3808ed57a0..739e6ba27d 100644
--- a/libs/image/kis_polygonal_gradient_shape_strategy.h
+++ b/libs/image/kis_polygonal_gradient_shape_strategy.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H
#define __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H
#include "kis_gradient_shape_strategy.h"
#include <QPolygonF>
#include <QPainterPath>
#include "kritaimage_export.h"
class KRITAIMAGE_EXPORT KisPolygonalGradientShapeStrategy : public KisGradientShapeStrategy
{
public:
KisPolygonalGradientShapeStrategy(const QPainterPath &selectionPath,
qreal exponent);
- ~KisPolygonalGradientShapeStrategy();
+ ~KisPolygonalGradientShapeStrategy() override;
- double valueAt(double x, double y) const;
+ double valueAt(double x, double y) const override;
static QPointF testingCalculatePathCenter(int numSamples, const QPainterPath &path, qreal exponent, bool searchForMax);
private:
QPainterPath m_selectionPath;
qreal m_exponent;
qreal m_minWeight;
qreal m_maxWeight;
qreal m_scaleCoeff;
};
#endif /* __KIS_POLYGONAL_GRADIENT_SHAPE_STRATEGY_H */
diff --git a/libs/image/kis_progress_updater.h b/libs/image/kis_progress_updater.h
index 23234ee422..5e0d1aa0db 100644
--- a/libs/image/kis_progress_updater.h
+++ b/libs/image/kis_progress_updater.h
@@ -1,53 +1,53 @@
/*
* This file is part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PROGRESS_UPDATER_H
#define KIS_PROGRESS_UPDATER_H
#include <KoProgressUpdater.h>
#include <kritaimage_export.h>
class KRITAIMAGE_EXPORT KisProgressInterface
{
public:
virtual ~KisProgressInterface() {};
virtual void detachUpdater(KoProgressUpdater* updater) = 0;
virtual void attachUpdater(KoProgressUpdater* updater) = 0;
};
/**
* KisProgressUpdater is an updater that disengages itself automatically
* from the updater widget when done.
*/
class KRITAIMAGE_EXPORT KisProgressUpdater : public KoProgressUpdater
{
public:
KisProgressUpdater(KisProgressInterface* progressInterface, KoProgressProxy* proxy,
KoProgressUpdater::Mode mode = KoProgressUpdater::Threaded);
- virtual ~KisProgressUpdater();
+ ~KisProgressUpdater() override;
private:
KisProgressInterface* m_interface;
};
#endif // KIS_PROGRESS_UPDATER_H
diff --git a/libs/image/kis_projection_updates_filter.h b/libs/image/kis_projection_updates_filter.h
index 8cb9f2240d..9910cc0355 100644
--- a/libs/image/kis_projection_updates_filter.h
+++ b/libs/image/kis_projection_updates_filter.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PROJECTION_UPDATES_FILTER_H
#define __KIS_PROJECTION_UPDATES_FILTER_H
#include <QSharedPointer>
class KisImage;
class KisNode;
class QRect;
class KisProjectionUpdatesFilter
{
public:
virtual ~KisProjectionUpdatesFilter();
/**
* \return true if an update should be dropped by the image
*/
virtual bool filter(KisImage *image, KisNode *node, const QRect& rect, bool resetAnimationCache) = 0;
};
/**
* A dummy filter implementation that eats all the updates
*/
class KisDropAllProjectionUpdatesFilter : public KisProjectionUpdatesFilter
{
public:
- bool filter(KisImage *image, KisNode *node, const QRect& rect, bool resetAnimationCache);
+ bool filter(KisImage *image, KisNode *node, const QRect& rect, bool resetAnimationCache) override;
};
#endif /* __KIS_PROJECTION_UPDATES_FILTER_H */
diff --git a/libs/image/kis_properties_configuration.h b/libs/image/kis_properties_configuration.h
index d8e444f897..380ef027ad 100644
--- a/libs/image/kis_properties_configuration.h
+++ b/libs/image/kis_properties_configuration.h
@@ -1,169 +1,169 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PROPERTIES_CONFIGURATION_H_
#define _KIS_PROPERTIES_CONFIGURATION_H_
#include <QString>
#include <QMap>
#include <QVariant>
#include <kis_debug.h>
#include <kis_cubic_curve.h>
#include <KoColor.h>
class QDomElement;
class QDomDocument;
#include "kis_serializable_configuration.h"
#include "kritaimage_export.h"
#include "kis_types.h"
/**
* KisPropertiesConfiguration is a map-based properties class that can
* be serialized and deserialized.
*
* It differs from the base class KisSerializableConfiguration in that
* it provides a number of convenience methods to get at the data and
*/
class KRITAIMAGE_EXPORT KisPropertiesConfiguration : public KisSerializableConfiguration
{
public:
/**
* Create a new properties config.
*/
KisPropertiesConfiguration();
- virtual ~KisPropertiesConfiguration();
+ ~KisPropertiesConfiguration() override;
/**
* Deep copy the properties \p rhs
*/
KisPropertiesConfiguration(const KisPropertiesConfiguration& rhs);
/**
* Deep copy the properties \p rhs
*/
KisPropertiesConfiguration& operator=(const KisPropertiesConfiguration& rhs);
public:
/**
* Fill the properties configuration object from the XML encoded representation in s.
* This function use the "Legacy" style XML of the 1.x .kra file format.
* @param xml the string that will be parsed as xml
* @param clear if true, the properties map will be emptied.
* @return true is the xml document could be parsed
*/
- virtual bool fromXML(const QString& xml, bool clear = true);
+ bool fromXML(const QString& xml, bool clear = true) override;
/**
* Fill the properties configuration object from the XML encoded representation in s.
* This function use the "Legacy" style XML of the 1.x .kra file format.
*
* Note: the existing properties will not be cleared
*/
- virtual void fromXML(const QDomElement&);
+ void fromXML(const QDomElement&) override;
/**
* Create a serialized version of this properties config
* This function use the "Legacy" style XML of the 1.x .kra file format.
*/
- virtual void toXML(QDomDocument&, QDomElement&) const;
+ void toXML(QDomDocument&, QDomElement&) const override;
/**
* Create a serialized version of this properties config
* This function use the "Legacy" style XML of the 1.x .kra file format.
*/
- virtual QString toXML() const;
+ QString toXML() const override;
/**
* @return true if the map contains a property with the specified name
*/
bool hasProperty(const QString& name) const;
/**
* Set the property with name to value.
*/
virtual void setProperty(const QString & name, const QVariant & value);
/**
* Set value to the value associated with property name
*
* XXX: API alert: a setter that is prefixed with get?
*
* @return false if the specified property did not exist.
*/
virtual bool getProperty(const QString & name, QVariant & value) const;
virtual QVariant getProperty(const QString & name) const;
template <typename T>
T getPropertyLazy(const QString & name, const T &defaultValue) const {
QVariant value = getProperty(name);
return value.isValid() ? value.value<T>() : defaultValue;
}
int getInt(const QString & name, int def = 0) const;
double getDouble(const QString & name, double def = 0.0) const;
float getFloat(const QString& name, float def = 0.0) const;
bool getBool(const QString & name, bool def = false) const;
QString getString(const QString & name, const QString & def = QString()) const;
KisCubicCurve getCubicCurve(const QString & name, const KisCubicCurve & curve = KisCubicCurve()) const;
KoColor getColor(const QString& name, const KoColor& color = KoColor()) const;
QMap<QString, QVariant> getProperties() const;
/// Clear the map of properties
void clearProperties();
/// Marks a property that should not be saved by toXML
void setPropertyNotSaved(const QString & name);
void removeProperty(const QString & name);
public:
void dump() const;
private:
struct Private;
Private* const d;
};
class KRITAIMAGE_EXPORT KisPropertiesConfigurationFactory : public KisSerializableConfigurationFactory
{
public:
KisPropertiesConfigurationFactory();
- virtual ~KisPropertiesConfigurationFactory();
- virtual KisSerializableConfigurationSP createDefault();
- virtual KisSerializableConfigurationSP create(const QDomElement& e);
+ ~KisPropertiesConfigurationFactory() override;
+ KisSerializableConfigurationSP createDefault() override;
+ KisSerializableConfigurationSP create(const QDomElement& e) override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/image/kis_queues_progress_updater.h b/libs/image/kis_queues_progress_updater.h
index cb1ef4052a..c33ddcb0da 100644
--- a/libs/image/kis_queues_progress_updater.h
+++ b/libs/image/kis_queues_progress_updater.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_QUEUES_PROGRESS_UPDATER_H
#define __KIS_QUEUES_PROGRESS_UPDATER_H
#include <QObject>
#include "kritaimage_export.h"
class KoProgressProxy;
class KRITAIMAGE_EXPORT KisQueuesProgressUpdater : public QObject
{
Q_OBJECT
public:
KisQueuesProgressUpdater(KoProgressProxy *progressProxy, QObject *parent = 0);
- ~KisQueuesProgressUpdater();
+ ~KisQueuesProgressUpdater() override;
void updateProgress(int queueSizeMetric, const QString &jobName);
void hide();
private Q_SLOTS:
void startTicking();
void stopTicking();
void timerTicked();
Q_SIGNALS:
void sigStartTicking();
void sigStopTicking();
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_QUEUES_PROGRESS_UPDATER_H */
diff --git a/libs/image/kis_random_accessor_ng.h b/libs/image/kis_random_accessor_ng.h
index cb88de9b87..c4f1dce27c 100644
--- a/libs/image/kis_random_accessor_ng.h
+++ b/libs/image/kis_random_accessor_ng.h
@@ -1,44 +1,44 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RANDOM_ACCESSOR_NG_H_
#define _KIS_RANDOM_ACCESSOR_NG_H_
#include "kis_base_accessor.h"
class KRITAIMAGE_EXPORT KisRandomConstAccessorNG : public KisBaseConstAccessor
{
Q_DISABLE_COPY(KisRandomConstAccessorNG)
public:
KisRandomConstAccessorNG() {}
- virtual ~KisRandomConstAccessorNG();
+ ~KisRandomConstAccessorNG() override;
virtual void moveTo(qint32 x, qint32 y) = 0;
virtual qint32 numContiguousColumns(qint32 x) const = 0;
virtual qint32 numContiguousRows(qint32 y) const = 0;
virtual qint32 rowStride(qint32 x, qint32 y) const = 0;
};
class KRITAIMAGE_EXPORT KisRandomAccessorNG : public KisRandomConstAccessorNG, public KisBaseAccessor
{
Q_DISABLE_COPY(KisRandomAccessorNG)
public:
KisRandomAccessorNG() {}
- virtual ~KisRandomAccessorNG();
+ ~KisRandomAccessorNG() override;
};
#endif
diff --git a/libs/image/kis_raster_keyframe_channel.cpp b/libs/image/kis_raster_keyframe_channel.cpp
index 2c18f15de1..25b4152f69 100644
--- a/libs/image/kis_raster_keyframe_channel.cpp
+++ b/libs/image/kis_raster_keyframe_channel.cpp
@@ -1,296 +1,296 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_raster_keyframe_channel.h"
#include "kis_node.h"
#include "kis_dom_utils.h"
#include "kis_global.h"
#include "kis_paint_device.h"
#include "kis_paint_device_frames_interface.h"
#include "kis_time_range.h"
#include "kundo2command.h"
#include "kis_onion_skin_compositor.h"
struct KisRasterKeyframe : public KisKeyframe
{
KisRasterKeyframe(KisRasterKeyframeChannel *channel, int time, int frameId)
: KisKeyframe(channel, time)
, frameId(frameId)
{}
KisRasterKeyframe(const KisRasterKeyframe *rhs, KisKeyframeChannel *channel)
: KisKeyframe(rhs, channel)
, frameId(rhs->frameId)
{}
int frameId;
- KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const
+ KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const override
{
return toQShared(new KisRasterKeyframe(this, channel));
}
};
struct KisRasterKeyframeChannel::Private
{
Private(KisPaintDeviceWSP paintDevice, const QString filenameSuffix)
: paintDevice(paintDevice),
filenameSuffix(filenameSuffix),
onionSkinsEnabled(false)
{}
KisPaintDeviceWSP paintDevice;
QMap<int, QString> frameFilenames;
QString filenameSuffix;
bool onionSkinsEnabled;
};
KisRasterKeyframeChannel::KisRasterKeyframeChannel(const KoID &id, const KisPaintDeviceWSP paintDevice, KisDefaultBoundsBaseSP defaultBounds)
: KisKeyframeChannel(id, defaultBounds),
m_d(new Private(paintDevice, QString()))
{
}
KisRasterKeyframeChannel::KisRasterKeyframeChannel(const KisRasterKeyframeChannel &rhs, const KisNodeWSP newParentNode, const KisPaintDeviceWSP newPaintDevice)
: KisKeyframeChannel(rhs, newParentNode),
m_d(new Private(newPaintDevice, rhs.m_d->filenameSuffix))
{
KIS_ASSERT_RECOVER_NOOP(&rhs != this);
m_d->frameFilenames = rhs.m_d->frameFilenames;
m_d->onionSkinsEnabled = rhs.m_d->onionSkinsEnabled;
}
KisRasterKeyframeChannel::~KisRasterKeyframeChannel()
{
}
int KisRasterKeyframeChannel::frameId(KisKeyframeSP keyframe) const
{
KisRasterKeyframe *key = dynamic_cast<KisRasterKeyframe*>(keyframe.data());
Q_ASSERT(key != 0);
return key->frameId;
}
int KisRasterKeyframeChannel::frameIdAt(int time) const
{
KisKeyframeSP activeKey = activeKeyframeAt(time);
if (activeKey.isNull()) return -1;
return frameId(activeKey);
}
void KisRasterKeyframeChannel::fetchFrame(KisKeyframeSP keyframe, KisPaintDeviceSP targetDevice)
{
m_d->paintDevice->framesInterface()->fetchFrame(frameId(keyframe), targetDevice);
}
void KisRasterKeyframeChannel::importFrame(int time, KisPaintDeviceSP sourceDevice, KUndo2Command *parentCommand)
{
KisKeyframeSP keyframe = addKeyframe(time, parentCommand);
const int frame = frameId(keyframe);
m_d->paintDevice->framesInterface()->uploadFrame(frame, sourceDevice);
}
QRect KisRasterKeyframeChannel::frameExtents(KisKeyframeSP keyframe)
{
return m_d->paintDevice->framesInterface()->frameBounds(frameId(keyframe));
}
QString KisRasterKeyframeChannel::frameFilename(int frameId) const
{
return m_d->frameFilenames.value(frameId, QString());
}
void KisRasterKeyframeChannel::setFilenameSuffix(const QString &suffix)
{
m_d->filenameSuffix = suffix;
}
void KisRasterKeyframeChannel::setFrameFilename(int frameId, const QString &filename)
{
Q_ASSERT(!m_d->frameFilenames.contains(frameId));
m_d->frameFilenames.insert(frameId, filename);
}
QString KisRasterKeyframeChannel::chooseFrameFilename(int frameId, const QString &layerFilename)
{
QString filename;
if (m_d->frameFilenames.isEmpty()) {
// Use legacy naming convention for first keyframe
filename = layerFilename + m_d->filenameSuffix;
} else {
filename = layerFilename + m_d->filenameSuffix + ".f" + QString::number(frameId);
}
setFrameFilename(frameId, filename);
return filename;
}
KisKeyframeSP KisRasterKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand)
{
KisRasterKeyframe *keyframe;
if (!copySrc) {
int frameId = m_d->paintDevice->framesInterface()->createFrame(false, 0, QPoint(), parentCommand);
keyframe = new KisRasterKeyframe(this, time, frameId);
} else {
int srcFrame = frameId(copySrc);
int frameId = m_d->paintDevice->framesInterface()->createFrame(true, srcFrame, QPoint(), parentCommand);
KisRasterKeyframe *srcKeyframe = dynamic_cast<KisRasterKeyframe*>(copySrc.data());
Q_ASSERT(srcKeyframe);
keyframe = new KisRasterKeyframe(srcKeyframe, this);
keyframe->setTime(time);
keyframe->frameId = frameId;
}
return toQShared(keyframe);
}
void KisRasterKeyframeChannel::destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand)
{
m_d->paintDevice->framesInterface()->deleteFrame(frameId(key), parentCommand);
}
void KisRasterKeyframeChannel::uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame)
{
KisRasterKeyframeChannel *srcRasterChannel = dynamic_cast<KisRasterKeyframeChannel*>(srcChannel);
KIS_ASSERT_RECOVER_RETURN(srcRasterChannel);
const int srcId = srcRasterChannel->frameIdAt(srcTime);
const int dstId = frameId(dstFrame);
m_d->paintDevice->framesInterface()->
uploadFrame(srcId,
dstId,
srcRasterChannel->m_d->paintDevice);
}
QRect KisRasterKeyframeChannel::affectedRect(KisKeyframeSP key)
{
KeyframesMap::iterator it = keys().find(key->time());
QRect rect;
// Calculate changed area as the union of the current and previous keyframe.
// This makes sure there are no artifacts left over from the previous frame
// where the new one doesn't cover the area.
if (it == keys().begin()) {
// Using the *next* keyframe at the start of the timeline avoids artifacts
// when deleting or moving the first key
it++;
} else {
it--;
}
if (it != keys().end()) {
rect = m_d->paintDevice->framesInterface()->frameBounds(frameId(it.value()));
}
rect |= m_d->paintDevice->framesInterface()->frameBounds(frameId(key));
if (m_d->onionSkinsEnabled) {
const QRect dirtyOnionSkinsRect =
KisOnionSkinCompositor::instance()->calculateFullExtent(m_d->paintDevice);
rect |= dirtyOnionSkinsRect;
}
return rect;
}
QDomElement KisRasterKeyframeChannel::toXML(QDomDocument doc, const QString &layerFilename)
{
m_d->frameFilenames.clear();
return KisKeyframeChannel::toXML(doc, layerFilename);
}
void KisRasterKeyframeChannel::loadXML(const QDomElement &channelNode)
{
m_d->frameFilenames.clear();
KisKeyframeChannel::loadXML(channelNode);
}
void KisRasterKeyframeChannel::saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename)
{
int frame = frameId(keyframe);
QString filename = frameFilename(frame);
if (filename.isEmpty()) {
filename = chooseFrameFilename(frame, layerFilename);
}
keyframeElement.setAttribute("frame", filename);
QPoint offset = m_d->paintDevice->framesInterface()->frameOffset(frame);
KisDomUtils::saveValue(&keyframeElement, "offset", offset);
}
KisKeyframeSP KisRasterKeyframeChannel::loadKeyframe(const QDomElement &keyframeNode)
{
int time = keyframeNode.attribute("time").toUInt();
QPoint offset;
KisDomUtils::loadValue(keyframeNode, "offset", &offset);
QString frameFilename = keyframeNode.attribute("frame");
KisKeyframeSP keyframe;
if (m_d->frameFilenames.isEmpty()) {
// First keyframe loaded: use the existing frame
Q_ASSERT(keyframeCount() == 1);
keyframe = constKeys().begin().value();
// Remove from keys. It will get reinserted with new time once we return
keys().remove(keyframe->time());
keyframe->setTime(time);
m_d->paintDevice->framesInterface()->setFrameOffset(frameId(keyframe), offset);
} else {
KUndo2Command tempCommand;
int frameId = m_d->paintDevice->framesInterface()->createFrame(false, 0, offset, &tempCommand);
keyframe = toQShared(new KisRasterKeyframe(this, time, frameId));
}
setFrameFilename(frameId(keyframe), frameFilename);
return keyframe;
}
bool KisRasterKeyframeChannel::hasScalarValue() const
{
return false;
}
void KisRasterKeyframeChannel::setOnionSkinsEnabled(bool value)
{
m_d->onionSkinsEnabled = value;
}
bool KisRasterKeyframeChannel::onionSkinsEnabled() const
{
return m_d->onionSkinsEnabled;
}
diff --git a/libs/image/kis_raster_keyframe_channel.h b/libs/image/kis_raster_keyframe_channel.h
index 7c275771ec..ce0c08bc4d 100644
--- a/libs/image/kis_raster_keyframe_channel.h
+++ b/libs/image/kis_raster_keyframe_channel.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RASTER_KEYFRAME_CHANNEL_H
#define _KIS_RASTER_KEYFRAME_CHANNEL_H
#include "kis_keyframe_channel.h"
class KRITAIMAGE_EXPORT KisRasterKeyframeChannel : public KisKeyframeChannel
{
Q_OBJECT
public:
KisRasterKeyframeChannel(const KoID& id, const KisPaintDeviceWSP paintDevice, KisDefaultBoundsBaseSP defaultBounds);
KisRasterKeyframeChannel(const KisRasterKeyframeChannel &rhs, const KisNodeWSP newParentNode, const KisPaintDeviceWSP newPaintDevice);
- ~KisRasterKeyframeChannel();
+ ~KisRasterKeyframeChannel() override;
public:
/**
* Return the ID of the active frame at a given time. The active frame is
* defined by the keyframe at the given time or the last keyframe before it.
* @param time
* @return active frame id
*/
int frameIdAt(int time) const;
/**
* Copy the active frame at given time to target device.
* @param keyframe keyframe to copy from
* @param targetDevice device to copy the frame to
*/
void fetchFrame(KisKeyframeSP keyframe, KisPaintDeviceSP targetDevice);
/**
* Copy the content of the sourceDevice into a new keyframe at given time
* @param time position of new keyframe
* @param sourceDevice source for content
*/
void importFrame(int time, KisPaintDeviceSP sourceDevice, KUndo2Command *parentCommand);
QRect frameExtents(KisKeyframeSP keyframe);
QString frameFilename(int frameId) const;
/**
* When choosing filenames for frames, this will be appended to the node filename
*/
void setFilenameSuffix(const QString &suffix);
- bool hasScalarValue() const;
+ bool hasScalarValue() const override;
- QDomElement toXML(QDomDocument doc, const QString &layerFilename);
- void loadXML(const QDomElement &channelNode);
+ QDomElement toXML(QDomDocument doc, const QString &layerFilename) override;
+ void loadXML(const QDomElement &channelNode) override;
void setOnionSkinsEnabled(bool value);
bool onionSkinsEnabled() const;
protected:
- KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
- void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand);
- void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame);
+ KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) override;
+ void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand) override;
+ void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame) override;
- QRect affectedRect(KisKeyframeSP key);
+ QRect affectedRect(KisKeyframeSP key) override;
- void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename);
- KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode);
+ void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) override;
+ KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode) override;
private:
void setFrameFilename(int frameId, const QString &filename);
QString chooseFrameFilename(int frameId, const QString &layerFilename);
int frameId(KisKeyframeSP keyframe) const;
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/image/kis_recalculate_generator_layer_job.h b/libs/image/kis_recalculate_generator_layer_job.h
index fa1da88098..d98b68777a 100644
--- a/libs/image/kis_recalculate_generator_layer_job.h
+++ b/libs/image/kis_recalculate_generator_layer_job.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_RECALCULATE_GENERATOR_LAYER_JOB_H
#define __KIS_RECALCULATE_GENERATOR_LAYER_JOB_H
#include "kis_types.h"
#include "kis_spontaneous_job.h"
class KRITAIMAGE_EXPORT KisRecalculateGeneratorLayerJob : public KisSpontaneousJob
{
public:
KisRecalculateGeneratorLayerJob(KisGeneratorLayerSP layer);
- bool overrides(const KisSpontaneousJob *otherJob);
- void run();
- int levelOfDetail() const;
+ bool overrides(const KisSpontaneousJob *otherJob) override;
+ void run() override;
+ int levelOfDetail() const override;
private:
KisGeneratorLayerSP m_layer;
};
#endif /* __KIS_RECALCULATE_GENERATOR_LAYER_JOB_H */
diff --git a/libs/image/kis_recalculate_transform_mask_job.h b/libs/image/kis_recalculate_transform_mask_job.h
index 2281332bab..f770d5079f 100644
--- a/libs/image/kis_recalculate_transform_mask_job.h
+++ b/libs/image/kis_recalculate_transform_mask_job.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_RECALCULATE_TRANSFORM_MASK_JOB_H
#define __KIS_RECALCULATE_TRANSFORM_MASK_JOB_H
#include "kis_types.h"
#include "kis_spontaneous_job.h"
class KRITAIMAGE_EXPORT KisRecalculateTransformMaskJob : public KisSpontaneousJob
{
public:
KisRecalculateTransformMaskJob(KisTransformMaskSP mask);
- bool overrides(const KisSpontaneousJob *otherJob);
- void run();
- int levelOfDetail() const;
+ bool overrides(const KisSpontaneousJob *otherJob) override;
+ void run() override;
+ int levelOfDetail() const override;
private:
KisTransformMaskSP m_mask;
};
#endif /* __KIS_RECALCULATE_TRANSFORM_MASK_JOB_H */
diff --git a/libs/image/kis_rect_mask_generator.h b/libs/image/kis_rect_mask_generator.h
index 3d29d612d0..aec2dda7ee 100644
--- a/libs/image/kis_rect_mask_generator.h
+++ b/libs/image/kis_rect_mask_generator.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2008-2009 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECT_MASK_GENERATOR_H_
#define _KIS_RECT_MASK_GENERATOR_H_
#include <QScopedPointer>
#include "kritaimage_export.h"
#include "kis_mask_generator.h"
/**
* Represent, serialize and deserialize a rectangular 8-bit mask.
*/
class KRITAIMAGE_EXPORT KisRectangleMaskGenerator : public KisMaskGenerator
{
public:
KisRectangleMaskGenerator(qreal radius, qreal ratio, qreal fh, qreal fv, int spikes, bool antialiasEdges);
KisRectangleMaskGenerator(const KisRectangleMaskGenerator &rhs);
- virtual ~KisRectangleMaskGenerator();
+ ~KisRectangleMaskGenerator() override;
- KisMaskGenerator* clone() const;
+ KisMaskGenerator* clone() const override;
- virtual bool shouldSupersample() const;
- virtual quint8 valueAt(qreal x, qreal y) const;
- void setScale(qreal scaleX, qreal scaleY);
- void setSoftness(qreal softness);
+ bool shouldSupersample() const override;
+ quint8 valueAt(qreal x, qreal y) const override;
+ void setScale(qreal scaleX, qreal scaleY) override;
+ void setSoftness(qreal softness) override;
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/libs/image/kis_refresh_subtree_walker.h b/libs/image/kis_refresh_subtree_walker.h
index 2c80572b01..4965f55019 100644
--- a/libs/image/kis_refresh_subtree_walker.h
+++ b/libs/image/kis_refresh_subtree_walker.h
@@ -1,128 +1,128 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_REFRESH_SUBTREE_WALKER_H
#define __KIS_REFRESH_SUBTREE_WALKER_H
#include "kis_types.h"
#include "kis_base_rects_walker.h"
class KRITAIMAGE_EXPORT KisRefreshSubtreeWalker : public virtual KisBaseRectsWalker
{
public:
KisRefreshSubtreeWalker(QRect cropRect)
{
setCropRect(cropRect);
}
- UpdateType type() const {
+ UpdateType type() const override {
return UNSUPPORTED;
}
- virtual ~KisRefreshSubtreeWalker()
+ ~KisRefreshSubtreeWalker() override
{
}
protected:
KisRefreshSubtreeWalker() {}
QRect calculateChangeRect(KisProjectionLeafSP startWith,
const QRect &requestedRect) {
if(!startWith->isLayer())
return requestedRect;
QRect childrenRect;
QRect tempRect = requestedRect;
bool changeRectVaries = false;
KisProjectionLeafSP currentLeaf = startWith->firstChild();
KisProjectionLeafSP prevLeaf;
KisProjectionLeafSP nextLeaf;
while(currentLeaf) {
nextLeaf = currentLeaf->nextSibling();
if(currentLeaf->isLayer()) {
tempRect |= calculateChangeRect(currentLeaf, requestedRect);
if(!changeRectVaries)
changeRectVaries = tempRect != requestedRect;
childrenRect = tempRect;
prevLeaf = currentLeaf;
}
currentLeaf = nextLeaf;
}
tempRect |= startWith->projectionPlane()->changeRect(requestedRect | childrenRect);
if(!changeRectVaries)
changeRectVaries = tempRect != requestedRect;
setExplicitChangeRect(startWith, tempRect, changeRectVaries);
return tempRect;
}
- void startTrip(KisProjectionLeafSP startWith) {
+ void startTrip(KisProjectionLeafSP startWith) override {
setExplicitChangeRect(startWith, requestedRect(), false);
if (isStartLeaf(startWith)) {
KisProjectionLeafSP extraUpdateLeaf = startWith;
if (startWith->isMask()) {
/**
* When the mask is the root of the update, update
* its parent projection using N_EXTRA method.
*
* This special update is necessary because the following
* wolker will work in N_ABOVE_FILTHY mode only
*/
extraUpdateLeaf = startWith->parent();
}
NodePosition pos = N_EXTRA | calculateNodePosition(extraUpdateLeaf);
registerNeedRect(extraUpdateLeaf, pos);
}
KisProjectionLeafSP currentLeaf = startWith->lastChild();
while(currentLeaf) {
NodePosition pos = N_FILTHY | calculateNodePosition(currentLeaf);
registerNeedRect(currentLeaf, pos);
currentLeaf = currentLeaf->prevSibling();
}
currentLeaf = startWith->lastChild();
while(currentLeaf) {
if(currentLeaf->canHaveChildLayers()) {
startTrip(currentLeaf);
}
currentLeaf = currentLeaf->prevSibling();
}
}
};
#endif /* __KIS_REFRESH_SUBTREE_WALKER_H */
diff --git a/libs/image/kis_regenerate_frame_stroke_strategy.h b/libs/image/kis_regenerate_frame_stroke_strategy.h
index b4ba1d223f..89435f85bd 100644
--- a/libs/image/kis_regenerate_frame_stroke_strategy.h
+++ b/libs/image/kis_regenerate_frame_stroke_strategy.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H
#define __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H
#include <kis_simple_stroke_strategy.h>
#include <QScopedPointer>
class KisImageAnimationInterface;
class KisRegenerateFrameStrokeStrategy : public KisSimpleStrokeStrategy
{
public:
enum Type {
EXTERNAL_FRAME,
CURRENT_FRAME
};
public:
/**
* Constructs a strategy that refreshes an external frame in the
* background without ending/cancelling any running actions
*/
KisRegenerateFrameStrokeStrategy(int frameId,
const QRegion &dirtyRegion,
KisImageAnimationInterface *interface);
/**
* Regenerates current frame without affecting the frames cache.
* Used for redrawing the image after switching frames.
*
* NOTE: in contrast to the other c-tor, refreshing current frame
* *does* end all the running stroke, because it is not a
* background action, but a distinct user action.
*/
KisRegenerateFrameStrokeStrategy(KisImageAnimationInterface *interface);
- ~KisRegenerateFrameStrokeStrategy();
+ ~KisRegenerateFrameStrokeStrategy() override;
- void initStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
- void finishStrokeCallback();
- void cancelStrokeCallback();
+ void initStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
- KisStrokeStrategy* createLodClone(int levelOfDetail);
- void suspendStrokeCallback();
- void resumeStrokeCallback();
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
+ void suspendStrokeCallback() override;
+ void resumeStrokeCallback() override;
static QList<KisStrokeJobData*> createJobsData(KisImageWSP image);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H */
diff --git a/libs/image/kis_repeat_iterators_pixel.h b/libs/image/kis_repeat_iterators_pixel.h
index 4bfa09643c..7d76bf318a 100644
--- a/libs/image/kis_repeat_iterators_pixel.h
+++ b/libs/image/kis_repeat_iterators_pixel.h
@@ -1,268 +1,268 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_REPEAT_ITERATORS_PIXEL_H_
#define _KIS_REPEAT_ITERATORS_PIXEL_H_
#include <QRect>
#include "kis_shared.h"
#include "tiles3/kis_hline_iterator.h"
#include "tiles3/kis_vline_iterator.h"
template<class T>
class KisRepeatHLineIteratorPixelBase;
template<class T>
class KisRepeatVLineIteratorPixelBase;
/**
* This iterator is an iterator that will "artificially" extend the paint device with the
* value of the border when trying to access values outside the range of data.
*/
template<class T>
class KisRepeatLineIteratorPixelBase : public KisShared
{
Q_DISABLE_COPY(KisRepeatLineIteratorPixelBase)
public:
friend class KisRepeatHLineIteratorPixelBase<T>;
friend class KisRepeatVLineIteratorPixelBase<T>;
/**
* @param rc indicates the rectangle that truly contains data
*/
inline KisRepeatLineIteratorPixelBase(KisDataManager *dm, qint32 x, qint32 y, qint32 offsetx, qint32 offsety, const QRect& _rc, KisIteratorCompleteListener *completeListener);
virtual inline ~KisRepeatLineIteratorPixelBase();
public:
inline qint32 x() const {
return m_realX;
}
inline qint32 y() const {
return m_realY;
}
inline const quint8 * oldRawData() const {
return m_iterator->oldRawData();
}
private:
KisDataManager* m_dm;
qint32 m_realX, m_realY;
qint32 m_offsetX, m_offsetY;
QRect m_dataRect;
T* m_iterator;
KisIteratorCompleteListener *m_completeListener;
};
/**
* This iterator is an iterator that will "artificially" extend the paint device with the
* value of the border when trying to access values outside the range of data.
*/
template<class T>
class KisRepeatHLineIteratorPixelBase : public KisRepeatLineIteratorPixelBase<T>
{
public:
/**
* @param rc indicates the rectangle that trully contains data
*/
inline KisRepeatHLineIteratorPixelBase(KisDataManager *dm, qint32 x, qint32 y, qint32 w, qint32 offsetx, qint32 offsety, const QRect& _rc, KisIteratorCompleteListener *completeListener);
- virtual inline ~KisRepeatHLineIteratorPixelBase();
+ inline ~KisRepeatHLineIteratorPixelBase() override;
inline bool nextPixel();
/**
* Reach next row.
*/
inline void nextRow();
private:
void createIterator();
private:
qint32 m_startX;
qint32 m_startIteratorX;
qint32 m_width;
};
/**
* This iterator is an iterator that will "artificially" extend the paint device with the
* value of the border when trying to access values outside the range of data.
*/
template<class T>
class KisRepeatVLineIteratorPixelBase : public KisRepeatLineIteratorPixelBase<T>
{
public:
/**
* @param rc indicates the rectangle that trully contains data
*/
inline KisRepeatVLineIteratorPixelBase(KisDataManager *dm, qint32 x, qint32 y, qint32 h, qint32 offsetx, qint32 offsety, const QRect& _rc, KisIteratorCompleteListener *completeListener);
- virtual inline ~KisRepeatVLineIteratorPixelBase();
+ inline ~KisRepeatVLineIteratorPixelBase() override;
inline KisRepeatVLineIteratorPixelBase<T> & operator ++();
inline bool nextPixel();
/**
* Reach next row.
*/
inline void nextColumn();
private:
void createIterator();
private:
qint32 m_startY;
qint32 m_startIteratorY;
qint32 m_height;
};
//------------------------ Implementations ------------------------//
//---------------- KisRepeatLineIteratorPixelBase -----------------//
template<class T>
KisRepeatLineIteratorPixelBase<T>::KisRepeatLineIteratorPixelBase(KisDataManager *dm, qint32 x, qint32 y, qint32 offsetx, qint32 offsety, const QRect& _rc, KisIteratorCompleteListener *completeListener) :
m_dm(dm),
m_realX(x), m_realY(y),
m_offsetX(offsetx), m_offsetY(offsety),
m_dataRect(_rc),
m_iterator(0),
m_completeListener(completeListener)
{
}
template<class T>
KisRepeatLineIteratorPixelBase<T>::~KisRepeatLineIteratorPixelBase()
{
delete m_iterator;
}
//---------------- KisRepeatHLineIteratorPixelBase ----------------//
template<class T>
KisRepeatHLineIteratorPixelBase<T>::KisRepeatHLineIteratorPixelBase(KisDataManager *dm, qint32 x, qint32 y, qint32 w, qint32 offsetx, qint32 offsety, const QRect& _rc, KisIteratorCompleteListener *completeListener)
: KisRepeatLineIteratorPixelBase<T>(dm, x, y, offsetx, offsety , _rc, completeListener),
m_startX(x), m_startIteratorX(x),
m_width(w)
{
// Compute the startx value of the iterator
if (m_startIteratorX < _rc.left()) {
m_startIteratorX = _rc.left();
}
createIterator();
}
template<class T>
KisRepeatHLineIteratorPixelBase<T>::~KisRepeatHLineIteratorPixelBase()
{
}
template<class T>
inline bool KisRepeatHLineIteratorPixelBase<T>::nextPixel()
{
Q_ASSERT(this->m_iterator);
if (this->m_realX >= this->m_dataRect.x() && this->m_realX < this->m_dataRect.x() + this->m_dataRect.width() - 1) {
this->m_iterator->nextPixel();
}
++this->m_realX;
return (this->m_realX < m_startX + m_width);
}
template<class T>
inline void KisRepeatHLineIteratorPixelBase<T>::nextRow()
{
if (this->m_realY >= this->m_dataRect.y() && this->m_realY < this->m_dataRect.y() + this->m_dataRect.height() - 1) {
this->m_iterator->nextRow();
} else {
createIterator();
}
this->m_realX = this->m_startX;
++this->m_realY;
}
template<class T>
void KisRepeatHLineIteratorPixelBase<T>::createIterator()
{
// Cleanup
delete this->m_iterator;
qint32 startY = this->m_realY;
if (startY < this->m_dataRect.y()) {
startY = this->m_dataRect.top();
}
if (startY > (this->m_dataRect.y() + this->m_dataRect.height() - 1)) {
startY = (this->m_dataRect.y() + this->m_dataRect.height() - 1);
}
int width = this->m_dataRect.x() + this->m_dataRect.width() - this->m_startIteratorX;
this->m_iterator = new T(this->m_dm, this->m_startIteratorX, startY, width, this->m_offsetX, this->m_offsetY, false, this->m_completeListener);
this->m_realX = this->m_startX;
}
//---------------- KisRepeatVLineIteratorPixelBase ----------------//
template<class T>
KisRepeatVLineIteratorPixelBase<T>::KisRepeatVLineIteratorPixelBase(KisDataManager *dm, qint32 x, qint32 y, qint32 h, qint32 offsetx, qint32 offsety, const QRect& _rc, KisIteratorCompleteListener *completeListener)
: KisRepeatLineIteratorPixelBase<T>(dm, x, y, offsetx, offsety , _rc, completeListener),
m_startY(y), m_startIteratorY(y),
m_height(h)
{
// Compute the startx value of the iterator
if (m_startIteratorY < _rc.top()) {
m_startIteratorY = _rc.top();
}
createIterator();
}
template<class T>
KisRepeatVLineIteratorPixelBase<T>::~KisRepeatVLineIteratorPixelBase()
{
}
template<class T>
inline bool KisRepeatVLineIteratorPixelBase<T>::nextPixel()
{
Q_ASSERT(this->m_iterator);
if (this->m_realY >= this->m_dataRect.y() && this->m_realY < this->m_dataRect.y() + this->m_dataRect.height() - 1) {
this->m_iterator->nextPixel();
}
++this->m_realY;
return (this->m_realY < m_startY + m_height);
}
template<class T>
inline void KisRepeatVLineIteratorPixelBase<T>::nextColumn()
{
if (this->m_realX >= this->m_dataRect.x() && this->m_realX < this->m_dataRect.x() + this->m_dataRect.width() - 1) {
this->m_iterator->nextColumn();
} else {
createIterator();
}
this->m_realY = this->m_startY;
++this->m_realX;
}
template<class T>
void KisRepeatVLineIteratorPixelBase<T>::createIterator()
{
// Cleanup
delete this->m_iterator;
qint32 startX = this->m_realX;
if (startX < this->m_dataRect.x()) {
startX = this->m_dataRect.x();
}
if (startX > (this->m_dataRect.x() + this->m_dataRect.width() - 1)) {
startX = (this->m_dataRect.x() + this->m_dataRect.width() - 1);
}
int height = this->m_dataRect.y() + this->m_dataRect.height() - this->m_startIteratorY;
this->m_iterator = new T(this->m_dm, startX, this->m_startIteratorY, height, this->m_offsetX, this->m_offsetY, false, this->m_completeListener);
this->m_realY = this->m_startY;
}
#endif
diff --git a/libs/image/kis_scalar_keyframe_channel.cpp b/libs/image/kis_scalar_keyframe_channel.cpp
index 00d6c912a5..045b32774b 100644
--- a/libs/image/kis_scalar_keyframe_channel.cpp
+++ b/libs/image/kis_scalar_keyframe_channel.cpp
@@ -1,472 +1,472 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_scalar_keyframe_channel.h"
#include "kis_node.h"
#include "kundo2command.h"
#include "kis_time_range.h"
#include <kis_global.h>
#include <kis_dom_utils.h>
struct KisScalarKeyframe : public KisKeyframe
{
KisScalarKeyframe(KisKeyframeChannel *channel, int time, qreal value)
: KisKeyframe(channel, time)
, value(value)
{}
KisScalarKeyframe(const KisScalarKeyframe *rhs, KisKeyframeChannel *channel)
: KisKeyframe(rhs, channel)
, value(rhs->value)
{}
qreal value;
- KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const
+ KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const override
{
return toQShared(new KisScalarKeyframe(this, channel));
}
};
KisScalarKeyframeChannel::AddKeyframeCommand::AddKeyframeCommand(KisScalarKeyframeChannel *channel, int time, qreal value, KUndo2Command *parentCommand)
: KisReplaceKeyframeCommand(channel, time, channel->createKeyframe(time, value, parentCommand), parentCommand)
{}
struct KisScalarKeyframeChannel::Private
{
public:
Private(qreal min, qreal max, KisKeyframe::InterpolationMode defaultInterpolation)
: minValue(min), maxValue(max), firstFreeIndex(0), defaultInterpolation(defaultInterpolation)
{}
qreal minValue;
qreal maxValue;
int firstFreeIndex;
KisKeyframe::InterpolationMode defaultInterpolation;
struct SetValueCommand;
struct SetTangentsCommand;
struct SetInterpolationModeCommand;
};
KisScalarKeyframeChannel::KisScalarKeyframeChannel(const KoID &id, qreal minValue, qreal maxValue, KisDefaultBoundsBaseSP defaultBounds, KisKeyframe::InterpolationMode defaultInterpolation)
: KisKeyframeChannel(id, defaultBounds),
m_d(new Private(minValue, maxValue, defaultInterpolation))
{
}
KisScalarKeyframeChannel::~KisScalarKeyframeChannel()
{}
bool KisScalarKeyframeChannel::hasScalarValue() const
{
return true;
}
qreal KisScalarKeyframeChannel::minScalarValue() const
{
return m_d->minValue;
}
qreal KisScalarKeyframeChannel::maxScalarValue() const
{
return m_d->maxValue;
}
qreal KisScalarKeyframeChannel::scalarValue(const KisKeyframeSP keyframe) const
{
KisScalarKeyframe *key = dynamic_cast<KisScalarKeyframe*>(keyframe.data());
Q_ASSERT(key != 0);
return key->value;
}
struct KisScalarKeyframeChannel::Private::SetValueCommand : public KUndo2Command
{
SetValueCommand(KisScalarKeyframeChannel *channel, KisKeyframeSP keyframe, qreal oldValue, qreal newValue, KUndo2Command *parentCommand)
: KUndo2Command(parentCommand),
m_channel(channel),
m_keyframe(keyframe),
m_oldValue(oldValue),
m_newValue(newValue)
{
}
void redo() override {
setValue(m_newValue);
}
void undo() override {
setValue(m_oldValue);
}
void setValue(qreal value) {
KisScalarKeyframe *key = dynamic_cast<KisScalarKeyframe*>(m_keyframe.data());
Q_ASSERT(key != 0);
key->value = value;
m_channel->notifyKeyframeChanged(m_keyframe);
}
private:
KisScalarKeyframeChannel *m_channel;
KisKeyframeSP m_keyframe;
qreal m_oldValue;
qreal m_newValue;
};
struct KisScalarKeyframeChannel::Private::SetTangentsCommand : public KUndo2Command
{
SetTangentsCommand(KisScalarKeyframeChannel *channel, KisKeyframeSP keyframe,
KisKeyframe::InterpolationTangentsMode oldMode, QPointF oldLeftTangent, QPointF oldRightTangent,
KisKeyframe::InterpolationTangentsMode newMode, QPointF newLeftTangent, QPointF newRightTangent,
KUndo2Command *parentCommand)
: KUndo2Command(parentCommand),
m_channel(channel),
m_keyframe(keyframe),
m_oldMode(oldMode),
m_oldLeftTangent(oldLeftTangent),
m_oldRightTangent(oldRightTangent),
m_newMode(newMode),
m_newLeftTangent(newLeftTangent),
m_newRightTangent(newRightTangent)
{
}
void redo() override {
m_keyframe->setTangentsMode(m_newMode);
m_keyframe->setInterpolationTangents(m_newLeftTangent, m_newRightTangent);
m_channel->notifyKeyframeChanged(m_keyframe);
}
void undo() override {
m_keyframe->setTangentsMode(m_oldMode);
m_keyframe->setInterpolationTangents(m_oldLeftTangent, m_oldRightTangent);
m_channel->notifyKeyframeChanged(m_keyframe);
}
private:
KisScalarKeyframeChannel *m_channel;
KisKeyframeSP m_keyframe;
KisKeyframe::InterpolationTangentsMode m_oldMode;
QPointF m_oldLeftTangent;
QPointF m_oldRightTangent;
KisKeyframe::InterpolationTangentsMode m_newMode;
QPointF m_newLeftTangent;
QPointF m_newRightTangent;
};
struct KisScalarKeyframeChannel::Private::SetInterpolationModeCommand : public KUndo2Command
{
SetInterpolationModeCommand(KisScalarKeyframeChannel *channel, KisKeyframeSP keyframe, KisKeyframe::InterpolationMode oldMode, KisKeyframe::InterpolationMode newMode, KUndo2Command *parentCommand)
: KUndo2Command(parentCommand),
m_channel(channel),
m_keyframe(keyframe),
m_oldMode(oldMode),
m_newMode(newMode)
{
}
void redo() override {
m_keyframe->setInterpolationMode(m_newMode);
m_channel->notifyKeyframeChanged(m_keyframe);
}
void undo() override {
m_keyframe->setInterpolationMode(m_oldMode);
m_channel->notifyKeyframeChanged(m_keyframe);
}
private:
KisScalarKeyframeChannel *m_channel;
KisKeyframeSP m_keyframe;
KisKeyframe::InterpolationMode m_oldMode;
KisKeyframe::InterpolationMode m_newMode;
};
void KisScalarKeyframeChannel::setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand)
{
QScopedPointer<KUndo2Command> tempCommand;
if (!parentCommand) {
tempCommand.reset(new KUndo2Command());
parentCommand = tempCommand.data();
}
qreal oldValue = scalarValue(keyframe);
KUndo2Command *cmd = new Private::SetValueCommand(this, keyframe, oldValue, value, parentCommand);
cmd->redo();
}
void KisScalarKeyframeChannel::setInterpolationMode(KisKeyframeSP keyframe, KisKeyframe::InterpolationMode mode, KUndo2Command *parentCommand)
{
QScopedPointer<KUndo2Command> tempCommand;
if (!parentCommand) {
tempCommand.reset(new KUndo2Command());
parentCommand = tempCommand.data();
}
KisKeyframe::InterpolationMode oldMode = keyframe->interpolationMode();
KUndo2Command *cmd = new Private::SetInterpolationModeCommand(this, keyframe, oldMode, mode, parentCommand);
cmd->redo();
}
void KisScalarKeyframeChannel::setInterpolationTangents(KisKeyframeSP keyframe, KisKeyframe::InterpolationTangentsMode mode, QPointF leftTangent, QPointF rightTangent, KUndo2Command *parentCommand)
{
QScopedPointer<KUndo2Command> tempCommand;
if (!parentCommand) {
tempCommand.reset(new KUndo2Command());
parentCommand = tempCommand.data();
}
KisKeyframe::InterpolationTangentsMode oldMode = keyframe->tangentsMode();
QPointF oldLeftTangent = keyframe->leftTangent();
QPointF oldRightTangent = keyframe->rightTangent();
KUndo2Command *cmd = new Private::SetTangentsCommand(this, keyframe, oldMode, oldLeftTangent, oldRightTangent, mode, leftTangent, rightTangent, parentCommand);
cmd->redo();
}
qreal cubicBezier(qreal p0, qreal delta1, qreal delta2, qreal p3, qreal t) {
qreal p1 = p0 + delta1;
qreal p2 = p3 + delta2;
qreal c = 1-t;
return c*c*c * p0 + 3*c*c*t * p1 + 3*c*t*t * p2 + t*t*t * p3;
}
void normalizeTangents(const QPointF point1, QPointF &rightTangent, QPointF &leftTangent, const QPointF point2)
{
// To ensure that the curve is monotonic wrt time,
// check that control points lie between the endpoints.
// If not, force them into range by scaling down the tangents
float interval = point2.x() - point1.x();
if (rightTangent.x() < 0) rightTangent *= 0;
if (leftTangent.x() > 0) leftTangent *= 0;
if (rightTangent.x() > interval) {
rightTangent *= interval / rightTangent.x();
}
if (leftTangent.x() < -interval) {
leftTangent *= interval / -leftTangent.x();
}
}
QPointF KisScalarKeyframeChannel::interpolate(QPointF point1, QPointF rightTangent, QPointF leftTangent, QPointF point2, qreal t)
{
normalizeTangents(point1, rightTangent, leftTangent, point2);
qreal x = cubicBezier(point1.x(), rightTangent.x(), leftTangent.x(), point2.x(), t);
qreal y = cubicBezier(point1.y(), rightTangent.y(), leftTangent.y(), point2.y(), t);
return QPointF(x,y);
}
qreal findCubicCurveParameter(int time0, qreal delta0, qreal delta1, int time1, int time)
{
if (time == time0) return 0.0;
if (time == time1) return 1.0;
qreal min_t = 0.0;
qreal max_t = 1.0;
while (true) {
qreal t = (max_t + min_t) / 2;
qreal time_t = cubicBezier(time0, delta0, delta1, time1, t);
if (time_t < time - 0.05) {
min_t = t;
} else if (time_t > time + 0.05) {
max_t = t;
} else {
// Close enough
return t;
}
}
}
qreal KisScalarKeyframeChannel::interpolatedValue(int time) const
{
KisKeyframeSP activeKey = activeKeyframeAt(time);
if (activeKey.isNull()) return qQNaN();
KisKeyframeSP nextKey = nextKeyframe(activeKey);
qreal result = qQNaN();
if (time == activeKey->time() || nextKey.isNull()) {
result = scalarValue(activeKey);
} else {
switch (activeKey->interpolationMode()) {
case KisKeyframe::Constant:
result = scalarValue(activeKey);
break;
case KisKeyframe::Linear:
{
int time0 = activeKey->time();
int time1 = nextKey->time();
qreal value0 = scalarValue(activeKey);
qreal value1 = scalarValue(nextKey);
result = value0 + (value1 - value0) * (time - time0) / (time1 - time0);
}
break;
case KisKeyframe::Bezier:
{
QPointF point0 = QPointF(activeKey->time(), scalarValue(activeKey));
QPointF point1 = QPointF(nextKey->time(), scalarValue(nextKey));
QPointF tangent0 = activeKey->rightTangent();
QPointF tangent1 = nextKey->leftTangent();
normalizeTangents(point0, tangent0, tangent1, point1);
qreal t = findCubicCurveParameter(point0.x(), tangent0.x(), tangent1.x(), point1.x(), time);
result = interpolate(point0, tangent0, tangent1, point1, t).y();
}
break;
default:
KIS_ASSERT_RECOVER_BREAK(false);
break;
}
}
if (result > m_d->maxValue) return m_d->maxValue;
if (result < m_d->minValue) return m_d->minValue;
return result;
}
qreal KisScalarKeyframeChannel::currentValue() const
{
return interpolatedValue(currentTime());
}
KisKeyframeSP KisScalarKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand)
{
if (copySrc) {
KisScalarKeyframe *srcKeyframe = dynamic_cast<KisScalarKeyframe*>(copySrc.data());
Q_ASSERT(srcKeyframe);
KisScalarKeyframe *keyframe = new KisScalarKeyframe(srcKeyframe, this);
keyframe->setTime(time);
return toQShared(keyframe);
} else {
return createKeyframe(time, 0, parentCommand);
}
}
KisKeyframeSP KisScalarKeyframeChannel::createKeyframe(int time, qreal value, KUndo2Command *parentCommand)
{
Q_UNUSED(parentCommand);
KisScalarKeyframe *keyframe = new KisScalarKeyframe(this, time, value);
keyframe->setInterpolationMode(m_d->defaultInterpolation);
return toQShared(keyframe);
}
void KisScalarKeyframeChannel::destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand)
{
Q_UNUSED(parentCommand);
Q_UNUSED(key);
}
void KisScalarKeyframeChannel::uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame)
{
KisScalarKeyframeChannel *srcScalarChannel = dynamic_cast<KisScalarKeyframeChannel*>(srcChannel);
KIS_ASSERT_RECOVER_RETURN(srcScalarChannel);
KisKeyframeSP srcFrame = srcScalarChannel->keyframeAt(srcTime);
KIS_ASSERT_RECOVER_RETURN(srcFrame);
KisScalarKeyframe *dstKey = dynamic_cast<KisScalarKeyframe*>(dstFrame.data());
dstKey->value = srcChannel->scalarValue(srcFrame);
notifyKeyframeChanged(dstFrame);
}
QRect KisScalarKeyframeChannel::affectedRect(KisKeyframeSP key)
{
Q_UNUSED(key);
if (node()) {
return node()->extent();
} else {
return QRect();
}
}
void KisScalarKeyframeChannel::saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename)
{
Q_UNUSED(layerFilename);
keyframeElement.setAttribute("value", KisDomUtils::toString(scalarValue(keyframe)));
QString interpolationMode;
if (keyframe->interpolationMode() == KisKeyframe::Constant) interpolationMode = "constant";
if (keyframe->interpolationMode() == KisKeyframe::Linear) interpolationMode = "linear";
if (keyframe->interpolationMode() == KisKeyframe::Bezier) interpolationMode = "bezier";
QString tangentsMode;
if (keyframe->tangentsMode() == KisKeyframe::Smooth) tangentsMode = "smooth";
if (keyframe->tangentsMode() == KisKeyframe::Sharp) tangentsMode = "sharp";
keyframeElement.setAttribute("interpolation", interpolationMode);
keyframeElement.setAttribute("tangents", tangentsMode);
KisDomUtils::saveValue(&keyframeElement, "leftTangent", keyframe->leftTangent());
KisDomUtils::saveValue(&keyframeElement, "rightTangent", keyframe->rightTangent());
}
KisKeyframeSP KisScalarKeyframeChannel::loadKeyframe(const QDomElement &keyframeNode)
{
int time = keyframeNode.toElement().attribute("time").toUInt();
qreal value = KisDomUtils::toDouble(keyframeNode.toElement().attribute("value"));
KUndo2Command tempParentCommand;
KisKeyframeSP keyframe = createKeyframe(time, KisKeyframeSP(), &tempParentCommand);
setScalarValue(keyframe, value);
QString interpolationMode = keyframeNode.toElement().attribute("interpolation");
if (interpolationMode == "constant") {
keyframe->setInterpolationMode(KisKeyframe::Constant);
} else if (interpolationMode == "linear") {
keyframe->setInterpolationMode(KisKeyframe::Linear);
} else if (interpolationMode == "bezier") {
keyframe->setInterpolationMode(KisKeyframe::Bezier);
}
QString tangentsMode = keyframeNode.toElement().attribute("tangents");
if (tangentsMode == "smooth") {
keyframe->setTangentsMode(KisKeyframe::Smooth);
} else if (tangentsMode == "sharp") {
keyframe->setTangentsMode(KisKeyframe::Sharp);
}
QPointF leftTangent;
QPointF rightTangent;
KisDomUtils::loadValue(keyframeNode, "leftTangent", &leftTangent);
KisDomUtils::loadValue(keyframeNode, "rightTangent", &rightTangent);
keyframe->setInterpolationTangents(leftTangent, rightTangent);
return keyframe;
}
void KisScalarKeyframeChannel::notifyKeyframeChanged(KisKeyframeSP keyframe)
{
QRect rect = affectedRect(keyframe);
KisTimeRange range = affectedFrames(keyframe->time());
requestUpdate(range, rect);
emit sigKeyframeChanged(keyframe);
}
diff --git a/libs/image/kis_scalar_keyframe_channel.h b/libs/image/kis_scalar_keyframe_channel.h
index b05f17e0ee..ee32a06017 100644
--- a/libs/image/kis_scalar_keyframe_channel.h
+++ b/libs/image/kis_scalar_keyframe_channel.h
@@ -1,69 +1,69 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SCALAR_KEYFRAME_CHANNEL_H
#define _KIS_SCALAR_KEYFRAME_CHANNEL_H
#include "kis_keyframe_channel.h"
#include "kis_keyframe_commands.h"
class KRITAIMAGE_EXPORT KisScalarKeyframeChannel : public KisKeyframeChannel
{
Q_OBJECT
public:
struct AddKeyframeCommand : public KisReplaceKeyframeCommand
{
AddKeyframeCommand(KisScalarKeyframeChannel *channel, int time, qreal value, KUndo2Command *parentCommand);
};
KisScalarKeyframeChannel(const KoID& id, qreal minValue, qreal maxValue, KisDefaultBoundsBaseSP defaultBounds, KisKeyframe::InterpolationMode defaultInterpolation=KisKeyframe::Constant);
- ~KisScalarKeyframeChannel();
+ ~KisScalarKeyframeChannel() override;
- bool hasScalarValue() const;
- qreal minScalarValue() const;
- qreal maxScalarValue() const;
- qreal scalarValue(const KisKeyframeSP keyframe) const;
- void setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand = 0);
+ bool hasScalarValue() const override;
+ qreal minScalarValue() const override;
+ qreal maxScalarValue() const override;
+ qreal scalarValue(const KisKeyframeSP keyframe) const override;
+ void setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand = 0) override;
void setInterpolationMode(KisKeyframeSP keyframe, KisKeyframe::InterpolationMode mode, KUndo2Command *parentCommand = 0);
void setInterpolationTangents(KisKeyframeSP keyframe, KisKeyframe::InterpolationTangentsMode, QPointF leftTangent, QPointF rightTangent, KUndo2Command *parentCommand);
qreal interpolatedValue(int time) const;
qreal currentValue() const;
static QPointF interpolate(QPointF point1, QPointF rightTangent, QPointF leftTangent, QPointF point2, qreal t);
protected:
- KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
+ KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) override;
KisKeyframeSP createKeyframe(int time, qreal value, KUndo2Command *parentCommand);
- void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand);
- void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame);
+ void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand) override;
+ void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame) override;
- QRect affectedRect(KisKeyframeSP key);
+ QRect affectedRect(KisKeyframeSP key) override;
- void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename);
- KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode);
+ void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) override;
+ KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode) override;
private:
void notifyKeyframeChanged(KisKeyframeSP keyframe);
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/image/kis_selection_based_layer.h b/libs/image/kis_selection_based_layer.h
index e6f455865d..aa8a9448d9 100644
--- a/libs/image/kis_selection_based_layer.h
+++ b/libs/image/kis_selection_based_layer.h
@@ -1,210 +1,210 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
* (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef KIS_SELECTION_BASED_LAYER_H_
#define KIS_SELECTION_BASED_LAYER_H_
#include <QObject>
#include "kis_types.h"
#include "kis_layer.h"
#include "kis_indirect_painting_support.h"
#include <kritaimage_export.h>
#include "kis_node_filter_interface.h"
class KisFilterConfiguration;
/**
* @class KisSelectionBasedLayer describes base behaviour for
* selection base classes like KisAdjustmentLayer and KisGeneratorLayer.
* These classes should have a persistent selection that controls
* the area where filter/generators are applied. The area outside
* this selection is not affected by the layer
*/
class KRITAIMAGE_EXPORT KisSelectionBasedLayer : public KisLayer, public KisIndirectPaintingSupport, public KisNodeFilterInterface
{
Q_OBJECT
public:
/**
* creates a new layer with the given selection.
* Note that the selection will be _copied_ (with COW, though).
* @param image the image to set this layer to
* @param name name of the layer
* @param selection is a mask used by the layer to know
* where to apply the filter/generator.
*/
KisSelectionBasedLayer(KisImageWSP image, const QString &name, KisSelectionSP selection, KisFilterConfigurationSP filterConfig, bool useGeneratorRegistry = false);
KisSelectionBasedLayer(const KisSelectionBasedLayer& rhs);
- virtual ~KisSelectionBasedLayer();
+ ~KisSelectionBasedLayer() override;
/**
* tells whether the @node can be a child of this layer
* @param node to be connected node
* @return tells if to be connected is a child of KisMask
*/
bool allowAsChild(KisNodeSP node) const override;
void setImage(KisImageWSP image) override;
KisPaintDeviceSP original() const override;
KisPaintDeviceSP paintDevice() const override;
bool needProjection() const override;
/**
* resets cached projection of lower layer to a new device
* @return void
*/
void resetCache();
/**
* for KisLayer::setDirty(const QRegion&)
*/
using KisLayer::setDirty;
/**
* Mark a layer as dirty. We can't use KisLayer's one
* as our extent() function doesn't fit for this
*/
void setDirty() override;
public:
/**
* Returns the selection of the layer
*
* Do not mix it with selection() which returns
* the currently active selection of the image
*/
KisSelectionSP internalSelection() const;
/**
* sets the selection of this layer to a copy of
* selection
* @param selection the selection to set
* @return void
*/
void setInternalSelection(KisSelectionSP selection);
/**
* When painted in indirect painting mode, the internal selection
* might not contain actual selection, because a part of it is
* stored on an indirect painting device. This method returns the
* merged copy of the real selection. The area in \p rect only is
* guaranteed to be prepared. The content of the rest of the
* selection is undefined.
*/
KisSelectionSP fetchComposedInternalSelection(const QRect &rect) const;
/**
* gets this layer's x coordinate, taking selection into account
* @return x-coordinate value
*/
qint32 x() const override;
/**
* gets this layer's y coordinate, taking selection into account
* @return y-coordinate value
*/
qint32 y() const override;
/**
* sets this layer's y coordinate, taking selection into account
* @param x x coordinate
*/
void setX(qint32 x) override;
/**
* sets this layer's y coordinate, taking selection into account
* @param y y coordinate
*/
void setY(qint32 y) override;
public:
/**
* gets an approximation of where the bounds on actual data
* are in this layer, taking selection into account
*/
QRect extent() const override;
/**
* returns the exact bounds of where the actual data resides
* in this layer, taking selection into account
*/
QRect exactBounds() const override;
/**
* copies the image and reformats it to thumbnail size
* and returns the new thumbnail image.
* @param w width of the thumbnail to create
* @param h height of the thumbnail to create
* @return the thumbnail image created.
*/
QImage createThumbnail(qint32 w, qint32 h) override;
protected:
// override from KisLayer
void copyOriginalToProjection(const KisPaintDeviceSP original,
KisPaintDeviceSP projection,
const QRect& rect) const override;
// override from KisNode
QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
protected:
void initSelection();
QRect cropChangeRectBySelection(const QRect &rect) const;
/**
* Sets if the selection should be used in
* copyOriginalToProjection() method.
*
* Default value is 'true'. The descendants should override it to
* get desired behaviour.
*
* Must be called only once in the child's constructor
*/
void setUseSelectionInProjection(bool value) const;
KisKeyframeChannel *requestKeyframeChannel(const QString &id) override;
public Q_SLOTS:
void slotImageSizeChanged();
/**
* gets this layer. Overriddes function in
* KisIndirectPaintingSupport
* @return this AdjustmentLayer
*/
KisLayer* layer() {
return this;
}
private:
struct Private;
Private * const m_d;
};
#endif /* KIS_SELECTION_BASED_LAYER_H_ */
diff --git a/libs/image/kis_selection_filters.h b/libs/image/kis_selection_filters.h
index 1a72adf1cf..d70d94db80 100644
--- a/libs/image/kis_selection_filters.h
+++ b/libs/image/kis_selection_filters.h
@@ -1,155 +1,155 @@
/*
* Copyright (c) 2005 Michael Thaler
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SELECTION_FILTERS_H
#define KIS_SELECTION_FILTERS_H
#include "kis_types.h"
#include "kritaimage_export.h"
#include <QRect>
#include <QString>
class KUndo2MagicString;
class KRITAIMAGE_EXPORT KisSelectionFilter
{
public:
virtual ~KisSelectionFilter();
virtual void process(KisPixelSelectionSP pixelSelection,
const QRect &rect) = 0;
virtual KUndo2MagicString name();
virtual QRect changeRect(const QRect &rect);
protected:
void computeBorder(qint32 *circ, qint32 xradius, qint32 yradius);
void rotatePointers(quint8 **p, quint32 n);
void computeTransition(quint8* transition, quint8** buf, qint32 width);
};
class KRITAIMAGE_EXPORT KisErodeSelectionFilter : public KisSelectionFilter
{
public:
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
};
class KRITAIMAGE_EXPORT KisDilateSelectionFilter : public KisSelectionFilter
{
public:
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
};
class KRITAIMAGE_EXPORT KisBorderSelectionFilter : public KisSelectionFilter
{
public:
KisBorderSelectionFilter(qint32 xRadius, qint32 yRadius);
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
private:
qint32 m_xRadius;
qint32 m_yRadius;
};
class KRITAIMAGE_EXPORT KisFeatherSelectionFilter : public KisSelectionFilter
{
public:
KisFeatherSelectionFilter(qint32 radius);
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
private:
qint32 m_radius;
};
class KRITAIMAGE_EXPORT KisGrowSelectionFilter : public KisSelectionFilter
{
public:
KisGrowSelectionFilter(qint32 xRadius, qint32 yRadius);
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
private:
qint32 m_xRadius;
qint32 m_yRadius;
};
class KRITAIMAGE_EXPORT KisShrinkSelectionFilter : public KisSelectionFilter
{
public:
KisShrinkSelectionFilter(qint32 xRadius, qint32 yRadius, bool edgeLock);
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
private:
qint32 m_xRadius;
qint32 m_yRadius;
qint32 m_edgeLock;
};
class KRITAIMAGE_EXPORT KisSmoothSelectionFilter : public KisSelectionFilter
{
public:
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
};
class KRITAIMAGE_EXPORT KisInvertSelectionFilter : public KisSelectionFilter
{
public:
- KUndo2MagicString name();
+ KUndo2MagicString name() override;
- QRect changeRect(const QRect &rect);
+ QRect changeRect(const QRect &rect) override;
- void process(KisPixelSelectionSP pixelSelection, const QRect &rect);
+ void process(KisPixelSelectionSP pixelSelection, const QRect &rect) override;
};
#endif // KIS_SELECTION_FILTERS_H
diff --git a/libs/image/kis_selection_mask.h b/libs/image/kis_selection_mask.h
index de164ac1ca..1ef431b48b 100644
--- a/libs/image/kis_selection_mask.h
+++ b/libs/image/kis_selection_mask.h
@@ -1,82 +1,82 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SELECTION_MASK_
#define _KIS_SELECTION_MASK_
#include <QRect>
#include "kis_base_node.h"
#include "kis_types.h"
#include "kis_mask.h"
/**
* An selection mask is a single channel mask that applies a
* particular selection to the layer the mask belongs to. A selection
* can contain both vector and pixel selection components.
*/
class KRITAIMAGE_EXPORT KisSelectionMask : public KisMask
{
Q_OBJECT
public:
/**
* Create an empty selection mask. There is filter and no layer
* associated with this mask.
*/
KisSelectionMask(KisImageWSP image);
- virtual ~KisSelectionMask();
+ ~KisSelectionMask() override;
KisSelectionMask(const KisSelectionMask& rhs);
- QIcon icon() const;
+ QIcon icon() const override;
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisSelectionMask(*this));
}
/// Set the selection of this adjustment layer to a copy of selection.
void setSelection(KisSelectionSP selection);
- bool accept(KisNodeVisitor &v);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &v) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
- virtual KisBaseNode::PropertyList sectionModelProperties() const;
- virtual void setSectionModelProperties(const KisBaseNode::PropertyList &properties);
+ KisBaseNode::PropertyList sectionModelProperties() const override;
+ void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override;
- void setVisible(bool visible, bool isLoading = false);
+ void setVisible(bool visible, bool isLoading = false) override;
bool active() const;
void setActive(bool active);
/**
* This method works like the one in KisSelection, but it
* compressed the incoming events instead of processing each of
* them separately.
*/
void notifySelectionChangedCompressed();
private:
Q_PRIVATE_SLOT(m_d, void slotSelectionChangedCompressed());
KisImageWSP image() const;
struct Private;
Private * const m_d;
};
#endif //_KIS_SELECTION_MASK_
diff --git a/libs/image/kis_simple_stroke_strategy.h b/libs/image/kis_simple_stroke_strategy.h
index f530f1fbe2..de599f6a6a 100644
--- a/libs/image/kis_simple_stroke_strategy.h
+++ b/libs/image/kis_simple_stroke_strategy.h
@@ -1,82 +1,82 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SIMPLE_STROKE_STRATEGY_H
#define __KIS_SIMPLE_STROKE_STRATEGY_H
#include <QVector>
#include "kis_stroke_strategy.h"
#include "kis_stroke_job_strategy.h"
class KRITAIMAGE_EXPORT KisSimpleStrokeStrategy : public KisStrokeStrategy
{
public:
enum JobType {
JOB_INIT = 0,
JOB_CANCEL,
JOB_FINISH,
JOB_DOSTROKE,
JOB_SUSPEND,
JOB_RESUME,
NJOBS
};
public:
KisSimpleStrokeStrategy(QString id = QString(), const KUndo2MagicString &name = KUndo2MagicString());
- KisStrokeJobStrategy* createInitStrategy();
- KisStrokeJobStrategy* createFinishStrategy();
- KisStrokeJobStrategy* createCancelStrategy();
- KisStrokeJobStrategy* createDabStrategy();
- KisStrokeJobStrategy* createSuspendStrategy();
- KisStrokeJobStrategy* createResumeStrategy();
+ KisStrokeJobStrategy* createInitStrategy() override;
+ KisStrokeJobStrategy* createFinishStrategy() override;
+ KisStrokeJobStrategy* createCancelStrategy() override;
+ KisStrokeJobStrategy* createDabStrategy() override;
+ KisStrokeJobStrategy* createSuspendStrategy() override;
+ KisStrokeJobStrategy* createResumeStrategy() override;
- KisStrokeJobData* createInitData();
- KisStrokeJobData* createFinishData();
- KisStrokeJobData* createCancelData();
- KisStrokeJobData* createSuspendData();
- KisStrokeJobData* createResumeData();
+ KisStrokeJobData* createInitData() override;
+ KisStrokeJobData* createFinishData() override;
+ KisStrokeJobData* createCancelData() override;
+ KisStrokeJobData* createSuspendData() override;
+ KisStrokeJobData* createResumeData() override;
virtual void initStrokeCallback();
virtual void finishStrokeCallback();
virtual void cancelStrokeCallback();
virtual void doStrokeCallback(KisStrokeJobData *data);
virtual void suspendStrokeCallback();
virtual void resumeStrokeCallback();
protected:
void enableJob(JobType type, bool enable = true,
KisStrokeJobData::Sequentiality sequentiality = KisStrokeJobData::SEQUENTIAL,
KisStrokeJobData::Exclusivity exclusivity = KisStrokeJobData::NORMAL);
protected:
KisSimpleStrokeStrategy(const KisSimpleStrokeStrategy &rhs);
private:
KisStrokeJobStrategy* createStrategy(JobType type);
KisStrokeJobData* createData(JobType type);
private:
QVector<bool> m_jobEnabled;
QVector<KisStrokeJobData::Sequentiality> m_jobSequentiality;
QVector<KisStrokeJobData::Exclusivity> m_jobExclusivity;
};
#endif /* __KIS_SIMPLE_STROKE_STRATEGY_H */
diff --git a/libs/image/kis_stroke_job.h b/libs/image/kis_stroke_job.h
index 49a66dc142..35f28ea195 100644
--- a/libs/image/kis_stroke_job.h
+++ b/libs/image/kis_stroke_job.h
@@ -1,95 +1,95 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_STROKE_JOB_H
#define __KIS_STROKE_JOB_H
#include "kis_runnable.h"
#include "kis_stroke_job_strategy.h"
class KisStrokeJob : public KisRunnable
{
public:
KisStrokeJob(KisStrokeJobStrategy *strategy,
KisStrokeJobData *data,
int levelOfDetail,
bool isCancellable)
: m_dabStrategy(strategy),
m_dabData(data),
m_levelOfDetail(levelOfDetail),
m_isCancellable(isCancellable)
{
}
- ~KisStrokeJob() {
+ ~KisStrokeJob() override {
delete m_dabData;
}
- void run() {
+ void run() override {
m_dabStrategy->run(m_dabData);
}
bool isSequential() const {
// Default value is 'SEQUENTIAL'
return m_dabData ? m_dabData->isSequential() : true;
}
bool isBarrier() const {
// Default value is simply 'SEQUENTIAL', *not* 'BARRIER'
return m_dabData ? m_dabData->isBarrier() : false;
}
bool isExclusive() const {
// Default value is 'NORMAL'
return m_dabData ? m_dabData->isExclusive() : false;
}
int levelOfDetail() const {
return m_levelOfDetail;
}
bool isCancellable() const {
return m_isCancellable;
}
private:
// for testing use only, do not use in real code
friend QString getJobName(KisStrokeJob *job);
friend QString getCommandName(KisStrokeJob *job);
friend int cancelSeqNo(KisStrokeJob *job);
KisStrokeJobStrategy* testingGetDabStrategy() {
return m_dabStrategy;
}
KisStrokeJobData* testingGetDabData() {
return m_dabData;
}
private:
// Shared between different jobs
KisStrokeJobStrategy *m_dabStrategy;
// Owned by the job
KisStrokeJobData *m_dabData;
int m_levelOfDetail;
bool m_isCancellable;
};
#endif /* __KIS_STROKE_JOB_H */
diff --git a/libs/image/kis_stroke_strategy_undo_command_based.h b/libs/image/kis_stroke_strategy_undo_command_based.h
index 1099dc47df..e2a888f370 100644
--- a/libs/image/kis_stroke_strategy_undo_command_based.h
+++ b/libs/image/kis_stroke_strategy_undo_command_based.h
@@ -1,140 +1,140 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_STROKE_STRATEGY_UNDO_COMMAND_BASED_H
#define __KIS_STROKE_STRATEGY_UNDO_COMMAND_BASED_H
#include <kundo2command.h>
#include <QVector>
#include <QMutex>
#include "kis_types.h"
#include "kis_simple_stroke_strategy.h"
class KisStrokeJob;
class KisSavedMacroCommand;
class KisStrokeUndoFacade;
class KRITAIMAGE_EXPORT KisStrokeStrategyUndoCommandBased : public KisSimpleStrokeStrategy
{
public:
class Data : public KisStrokeJobData {
public:
Data(KUndo2CommandSP _command,
bool _undo = false,
Sequentiality _sequentiality = SEQUENTIAL,
Exclusivity _exclusivity = NORMAL)
: KisStrokeJobData(_sequentiality, _exclusivity),
command(_command),
undo(_undo)
{
}
Data(KUndo2Command *_command,
bool _undo = false,
Sequentiality _sequentiality = SEQUENTIAL,
Exclusivity _exclusivity = NORMAL)
: KisStrokeJobData(_sequentiality, _exclusivity),
command(_command),
undo(_undo)
{
}
KUndo2CommandSP command;
bool undo;
};
public:
KisStrokeStrategyUndoCommandBased(const KUndo2MagicString &name,
bool undo,
KisStrokeUndoFacade *undoFacade,
KUndo2CommandSP initCommand = KUndo2CommandSP(0),
KUndo2CommandSP finishCommand = KUndo2CommandSP(0));
using KisSimpleStrokeStrategy::setExclusive;
- void initStrokeCallback();
- void finishStrokeCallback();
- void cancelStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
+ void initStrokeCallback() override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
/**
* Set extra data that will be assigned to the command
* represecting this action. Using extra data has the following
* restrictions:
*
* 1) The \p data must be set *before* the stroke has been started.
* Setting the \p data after the stroke has been started with
* image->startStroke(strokeId) leads to an undefined behaviour.
*
* 2) \p data becomes owned by the strategy/command right after
* setting it. Don't try to change it afterwards.
*/
void setCommandExtraData(KUndo2CommandExtraData *data);
/**
* Sets the id of this action. Will be used for merging the undo commands
*
* The \p value must be set *before* the stroke has been started.
* Setting the \p value after the stroke has been started with
* image->startStroke(strokeId) leads to an undefined behaviour.
*/
void setMacroId(int value);
/**
* The undo-command-based is a low-level strategy, so it allows
* changing its wraparound mode status.
*
* WARNING: the switch must be called *before* the stroke has been
* started! Otherwise the mode will not be activated.
*/
using KisStrokeStrategy::setSupportsWrapAroundMode;
void setUsedWhileUndoRedo(bool value);
protected:
void runAndSaveCommand(KUndo2CommandSP command,
KisStrokeJobData::Sequentiality sequentiality,
KisStrokeJobData::Exclusivity exclusivity);
void notifyCommandDone(KUndo2CommandSP command,
KisStrokeJobData::Sequentiality sequentiality,
KisStrokeJobData::Exclusivity exclusivity);
KisStrokeStrategyUndoCommandBased(const KisStrokeStrategyUndoCommandBased &rhs);
virtual void postProcessToplevelCommand(KUndo2Command *command);
private:
void executeCommand(KUndo2CommandSP command, bool undo);
private:
bool m_undo;
KUndo2CommandSP m_initCommand;
KUndo2CommandSP m_finishCommand;
KisStrokeUndoFacade *m_undoFacade;
QScopedPointer<KUndo2CommandExtraData> m_commandExtraData;
int m_macroId;
// protects done commands only
QMutex m_mutex;
KisSavedMacroCommand *m_macroCommand;
};
#endif /* __KIS_STROKE_STRATEGY_UNDO_COMMAND_BASED_H */
diff --git a/libs/image/kis_surrogate_undo_adapter.h b/libs/image/kis_surrogate_undo_adapter.h
index ab91fcf7ee..1e74567d12 100644
--- a/libs/image/kis_surrogate_undo_adapter.h
+++ b/libs/image/kis_surrogate_undo_adapter.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SURROGATE_UNDO_ADAPTER_H
#define __KIS_SURROGATE_UNDO_ADAPTER_H
#include "kis_undo_adapter.h"
class KisSurrogateUndoStore;
class KUndo2MagicString;
class KRITAIMAGE_EXPORT KisSurrogateUndoAdapter : public KisUndoAdapter
{
public:
KisSurrogateUndoAdapter();
- ~KisSurrogateUndoAdapter();
+ ~KisSurrogateUndoAdapter() override;
- const KUndo2Command* presentCommand();
- void undoLastCommand();
- void addCommand(KUndo2Command *command);
- void beginMacro(const KUndo2MagicString& macroName);
- void endMacro();
+ const KUndo2Command* presentCommand() override;
+ void undoLastCommand() override;
+ void addCommand(KUndo2Command *command) override;
+ void beginMacro(const KUndo2MagicString& macroName) override;
+ void endMacro() override;
void undo();
void redo();
void undoAll();
void redoAll();
private:
KisSurrogateUndoStore *m_undoStore;
};
#endif /* __KIS_SURROGATE_UNDO_ADAPTER_H */
diff --git a/libs/image/kis_suspend_projection_updates_stroke_strategy.h b/libs/image/kis_suspend_projection_updates_stroke_strategy.h
index 74ed02fbd3..1cc30bc0b3 100644
--- a/libs/image/kis_suspend_projection_updates_stroke_strategy.h
+++ b/libs/image/kis_suspend_projection_updates_stroke_strategy.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SUSPEND_PROJECTION_UPDATES_STROKE_STRATEGY_H
#define __KIS_SUSPEND_PROJECTION_UPDATES_STROKE_STRATEGY_H
#include <kis_simple_stroke_strategy.h>
#include <QScopedPointer>
class KisSuspendProjectionUpdatesStrokeStrategy : public KisSimpleStrokeStrategy
{
public:
KisSuspendProjectionUpdatesStrokeStrategy(KisImageWSP image, bool suspend);
- ~KisSuspendProjectionUpdatesStrokeStrategy();
+ ~KisSuspendProjectionUpdatesStrokeStrategy() override;
static QList<KisStrokeJobData*> createSuspendJobsData(KisImageWSP image);
static QList<KisStrokeJobData*> createResumeJobsData(KisImageWSP image);
private:
- void doStrokeCallback(KisStrokeJobData *data);
- void cancelStrokeCallback();
+ void doStrokeCallback(KisStrokeJobData *data) override;
+ void cancelStrokeCallback() override;
void resumeAndIssueUpdates(bool dropUpdates);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_SUSPEND_PROJECTION_UPDATES_STROKE_STRATEGY_H */
diff --git a/libs/image/kis_switch_time_stroke_strategy.h b/libs/image/kis_switch_time_stroke_strategy.h
index d4bed05e9d..18cd47144e 100644
--- a/libs/image/kis_switch_time_stroke_strategy.h
+++ b/libs/image/kis_switch_time_stroke_strategy.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SWITCH_TIME_STROKE_STRATEGY_H
#define __KIS_SWITCH_TIME_STROKE_STRATEGY_H
#include <kis_simple_stroke_strategy.h>
#include <QScopedPointer>
class KisImageAnimationInterface;
class KisPostExecutionUndoAdapter;
class KisSwitchTimeStrokeStrategy : public KisSimpleStrokeStrategy
{
public:
struct SharedToken {
SharedToken(int initialTime, bool needsRegeneration);
~SharedToken();
bool tryResetDestinationTime(int time, bool needsRegeneration);
int fetchTime() const;
private:
struct Private;
QScopedPointer<Private> m_d;
};
typedef QSharedPointer<SharedToken> SharedTokenSP;
typedef QWeakPointer<SharedToken> SharedTokenWSP;
public:
/**
* Switches current time to \p frameId
*
* NOTE: switching time *does* end all the running stroke, because it is
* not a background action, but a distinct user action.
*/
KisSwitchTimeStrokeStrategy(int frameId,
bool needsRegeneration,
KisImageAnimationInterface *interface,
KisPostExecutionUndoAdapter *undoAdapter);
- ~KisSwitchTimeStrokeStrategy();
+ ~KisSwitchTimeStrokeStrategy() override;
- void initStrokeCallback();
- KisStrokeStrategy* createLodClone(int levelOfDetail);
+ void initStrokeCallback() override;
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
SharedTokenSP token() const;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_SWITCH_TIME_STROKE_STRATEGY_H */
diff --git a/libs/image/kis_sync_lod_cache_stroke_strategy.h b/libs/image/kis_sync_lod_cache_stroke_strategy.h
index e8a969e7e9..d9eef2ecc3 100644
--- a/libs/image/kis_sync_lod_cache_stroke_strategy.h
+++ b/libs/image/kis_sync_lod_cache_stroke_strategy.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SYNC_LOD_CACHE_STROKE_STRATEGY_H
#define __KIS_SYNC_LOD_CACHE_STROKE_STRATEGY_H
#include <kis_simple_stroke_strategy.h>
#include <QScopedPointer>
class KisSyncLodCacheStrokeStrategy : public KisSimpleStrokeStrategy
{
public:
KisSyncLodCacheStrokeStrategy(KisImageWSP image, bool forgettable);
- ~KisSyncLodCacheStrokeStrategy();
+ ~KisSyncLodCacheStrokeStrategy() override;
static QList<KisStrokeJobData*> createJobsData(KisImageWSP image);
private:
- void doStrokeCallback(KisStrokeJobData *data);
- void finishStrokeCallback();
- void cancelStrokeCallback();
+ void doStrokeCallback(KisStrokeJobData *data) override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_SYNC_LOD_CACHE_STROKE_STRATEGY_H */
diff --git a/libs/image/kis_timed_signal_threshold.h b/libs/image/kis_timed_signal_threshold.h
index 242cb63022..d6e60fb67b 100644
--- a/libs/image/kis_timed_signal_threshold.h
+++ b/libs/image/kis_timed_signal_threshold.h
@@ -1,77 +1,77 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TIMED_SIGNAL_THRESHOLD_H
#define __KIS_TIMED_SIGNAL_THRESHOLD_H
#include "kritaimage_export.h"
#include <QScopedPointer>
#include <QObject>
/**
* Emits the timeout() signal if and only if the flow of start()
* events has been coming for a consecutive \p delay of milliseconds.
* If the events were not coming for \p cancelDelay of milliseconds the
* counting is dropped and the new period is started.
*/
class KRITAIMAGE_EXPORT KisTimedSignalThreshold : public QObject
{
Q_OBJECT
public:
KisTimedSignalThreshold(int delay, int cancelDelay = -1, QObject *parent = 0);
- ~KisTimedSignalThreshold();
+ ~KisTimedSignalThreshold() override;
public Q_SLOTS:
/**
* Stops counting and emits the signal forcefully
*/
void forceDone();
/**
* Start/continue counting and if the signal flow is stable enough
* (longer than \p delay and shorter than \p cancelDelay), the
* timeout signal in emitted.
*/
void start();
/**
* Stops counting the signals flow
*/
void stop();
/**
* Enable or disable emitting the signal
*/
void setEnabled(bool value);
/**
* The peiod of time, after which the the signal will be emitted
*/
void setDelayThreshold(int delay, int cancelDelay = -1);
Q_SIGNALS:
void timeout();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_TIMED_SIGNAL_THRESHOLD_H */
diff --git a/libs/image/kis_transaction_data.h b/libs/image/kis_transaction_data.h
index bbc56d9ba9..74a82b6861 100644
--- a/libs/image/kis_transaction_data.h
+++ b/libs/image/kis_transaction_data.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TRANSACTION_DATA_H_
#define KIS_TRANSACTION_DATA_H_
#include <kundo2command.h>
#include "kis_types.h"
#include <kritaimage_export.h>
/**
* A tile based undo command.
*
* Ordinary KUndo2Command subclasses store parameters and apply the action in
* the redo() command, however, Krita doesn't work like this. Undo replaces
* the current tiles in a paint device with the old tiles, redo replaces them
* again with the new tiles without actually executing the command that changed
* the image data again.
*/
class KRITAIMAGE_EXPORT KisTransactionData : public KUndo2Command
{
public:
KisTransactionData(const KUndo2MagicString& name, KisPaintDeviceSP device, bool resetSelectionOutlineCache, KUndo2Command* parent);
- virtual ~KisTransactionData();
+ ~KisTransactionData() override;
public:
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
virtual void endTransaction();
protected:
virtual void saveSelectionOutlineCache();
virtual void restoreSelectionOutlineCache(bool undo);
private:
void init(KisPaintDeviceSP device);
void startUpdates();
void possiblyNotifySelectionChanged();
void possiblyResetOutlineCache();
private:
class Private;
Private * const m_d;
};
#endif /* KIS_TRANSACTION_DATA_H_ */
diff --git a/libs/image/kis_transform_mask.h b/libs/image/kis_transform_mask.h
index 7c96afc5c3..e2d4c7489e 100644
--- a/libs/image/kis_transform_mask.h
+++ b/libs/image/kis_transform_mask.h
@@ -1,94 +1,94 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TRANSFORM_MASK_
#define _KIS_TRANSFORM_MASK_
#include <QScopedPointer>
#include "kis_types.h"
#include "kis_effect_mask.h"
#include "KisDelayedUpdateNodeInterface.h"
/**
Transform a layer according to a matrix transform
*/
class KRITAIMAGE_EXPORT KisTransformMask : public KisEffectMask, public KisDelayedUpdateNodeInterface
{
Q_OBJECT
public:
/**
* Create an empty filter mask.
*/
KisTransformMask();
- virtual ~KisTransformMask();
+ ~KisTransformMask() override;
- QIcon icon() const;
+ QIcon icon() const override;
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisTransformMask(*this));
}
- KisPaintDeviceSP paintDevice() const;
+ KisPaintDeviceSP paintDevice() const override;
- bool accept(KisNodeVisitor &v);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor &v) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
KisTransformMask(const KisTransformMask& rhs);
QRect decorateRect(KisPaintDeviceSP &src,
KisPaintDeviceSP &dst,
const QRect & rc,
- PositionToFilthy maskPos) const;
+ PositionToFilthy maskPos) const override;
- QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
+ QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
- QRect extent() const;
- QRect exactBounds() const;
+ QRect extent() const override;
+ QRect exactBounds() const override;
void setTransformParams(KisTransformMaskParamsInterfaceSP params);
KisTransformMaskParamsInterfaceSP transformParams() const;
void recaclulateStaticImage();
KisPaintDeviceSP buildPreviewDevice();
- void setX(qint32 x);
- void setY(qint32 y);
+ void setX(qint32 x) override;
+ void setY(qint32 y) override;
void forceUpdateTimedNode() override;
protected:
- KisKeyframeChannel *requestKeyframeChannel(const QString &id);
+ KisKeyframeChannel *requestKeyframeChannel(const QString &id) override;
private Q_SLOTS:
void slotDelayedStaticUpdate();
Q_SIGNALS:
void initiateDelayedStaticUpdate() const;
void forceTerminateDelayedStaticUpdate() const;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif //_KIS_TRANSFORM_MASK_
diff --git a/libs/image/kis_transform_mask_params_interface.h b/libs/image/kis_transform_mask_params_interface.h
index 51eebf9292..2cead5f2c1 100644
--- a/libs/image/kis_transform_mask_params_interface.h
+++ b/libs/image/kis_transform_mask_params_interface.h
@@ -1,103 +1,103 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H
#define __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H
#include "kritaimage_export.h"
#include "kis_types.h"
#include "kis_default_bounds_base.h"
#include <QScopedPointer>
class QTransform;
class QDomElement;
class KisKeyframeChannel;
class KRITAIMAGE_EXPORT KisTransformMaskParamsInterface
{
public:
virtual ~KisTransformMaskParamsInterface();
virtual QTransform finalAffineTransform() const = 0;
virtual bool isAffine() const = 0;
virtual bool isHidden() const = 0;
virtual void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const = 0;
virtual QString id() const = 0;
virtual void toXML(QDomElement *e) const = 0;
virtual void translate(const QPointF &offset) = 0;
virtual QRect nonAffineChangeRect(const QRect &rc) = 0;
virtual QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds) = 0;
virtual void clearChangedFlag() = 0;
virtual bool hasChanged() const = 0;
};
class KRITAIMAGE_EXPORT KisAnimatedTransformParamsInterface
{
public:
virtual ~KisAnimatedTransformParamsInterface();
virtual KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds) = 0;
};
class QDomElement;
class KRITAIMAGE_EXPORT KisDumbTransformMaskParams : public KisTransformMaskParamsInterface
{
public:
KisDumbTransformMaskParams();
KisDumbTransformMaskParams(const QTransform &transform);
KisDumbTransformMaskParams(bool isHidden);
- ~KisDumbTransformMaskParams();
+ ~KisDumbTransformMaskParams() override;
- QTransform finalAffineTransform() const;
- bool isAffine() const;
- bool isHidden() const;
- void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const;
+ QTransform finalAffineTransform() const override;
+ bool isAffine() const override;
+ bool isHidden() const override;
+ void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const override;
- QString id() const;
- void toXML(QDomElement *e) const;
+ QString id() const override;
+ void toXML(QDomElement *e) const override;
static KisTransformMaskParamsInterfaceSP fromXML(const QDomElement &e);
- void translate(const QPointF &offset);
+ void translate(const QPointF &offset) override;
// for tesing purposes only
QTransform testingGetTransform() const;
void testingSetTransform(const QTransform &t);
- QRect nonAffineChangeRect(const QRect &rc);
- QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds);
+ QRect nonAffineChangeRect(const QRect &rc) override;
+ QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds) override;
bool isAnimated() const;
KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds);
- void clearChangedFlag();
- bool hasChanged() const;
+ void clearChangedFlag() override;
+ bool hasChanged() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_TRANSFORM_MASK_PARAMS_INTERFACE_H */
diff --git a/libs/image/kis_transparency_mask.h b/libs/image/kis_transparency_mask.h
index 3f921e8417..c231787d72 100644
--- a/libs/image/kis_transparency_mask.h
+++ b/libs/image/kis_transparency_mask.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TRANSPARENCY_MASK_
#define _KIS_TRANSPARENCY_MASK_
#include "kis_types.h"
#include "kis_effect_mask.h"
class QRect;
/**
* A transparency mask is a single channel mask that applies a particular
* transparency to the layer the mask belongs to. It differs from an
* adjustment layer in that it only works on its parent layer, while
* adjustment layers work on all layers below it in its layer group.
*
* XXX: Use KisConfig::useProjections() to enable/disable the caching of
* the projection.
*/
class KRITAIMAGE_EXPORT KisTransparencyMask : public KisEffectMask
{
Q_OBJECT
public:
KisTransparencyMask();
KisTransparencyMask(const KisTransparencyMask& rhs);
- virtual ~KisTransparencyMask();
+ ~KisTransparencyMask() override;
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new KisTransparencyMask(*this));
}
QRect decorateRect(KisPaintDeviceSP &src, KisPaintDeviceSP &dst,
const QRect & rc,
- PositionToFilthy maskPos) const;
- QIcon icon() const;
- bool accept(KisNodeVisitor &v);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ PositionToFilthy maskPos) const override;
+ QIcon icon() const override;
+ bool accept(KisNodeVisitor &v) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
- QRect extent() const;
- QRect exactBounds() const;
+ QRect extent() const override;
+ QRect exactBounds() const override;
- QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const;
+ QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override;
};
#endif //_KIS_TRANSPARENCY_MASK_
diff --git a/libs/image/kis_undo_adapter.h b/libs/image/kis_undo_adapter.h
index c0731772ba..ad98c0928f 100644
--- a/libs/image/kis_undo_adapter.h
+++ b/libs/image/kis_undo_adapter.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_UNDO_ADAPTER_H_
#define KIS_UNDO_ADAPTER_H_
#include <QObject>
#include <kritaimage_export.h>
#include <kis_undo_store.h>
class KRITAIMAGE_EXPORT KisUndoAdapter : public QObject
{
Q_OBJECT
public:
KisUndoAdapter(KisUndoStore *undoStore, QObject *parent = 0);
- virtual ~KisUndoAdapter();
+ ~KisUndoAdapter() override;
public:
void emitSelectionChanged();
virtual const KUndo2Command* presentCommand() = 0;
virtual void undoLastCommand() = 0;
virtual void addCommand(KUndo2Command *cmd) = 0;
virtual void beginMacro(const KUndo2MagicString& macroName) = 0;
virtual void endMacro() = 0;
inline void setUndoStore(KisUndoStore *undoStore) {
m_undoStore = undoStore;
}
Q_SIGNALS:
void selectionChanged();
protected:
inline KisUndoStore* undoStore() {
return m_undoStore;
}
private:
Q_DISABLE_COPY(KisUndoAdapter)
KisUndoStore *m_undoStore;
};
#endif // KIS_UNDO_ADAPTER_H_
diff --git a/libs/image/kis_update_job_item.h b/libs/image/kis_update_job_item.h
index b9062bdbf0..39e534c777 100644
--- a/libs/image/kis_update_job_item.h
+++ b/libs/image/kis_update_job_item.h
@@ -1,204 +1,204 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UPDATE_JOB_ITEM_H
#define __KIS_UPDATE_JOB_ITEM_H
#include <QRunnable>
#include <QReadWriteLock>
#include "kis_stroke_job.h"
#include "kis_spontaneous_job.h"
#include "kis_base_rects_walker.h"
#include "kis_async_merger.h"
class KisUpdateJobItem : public QObject, public QRunnable
{
Q_OBJECT
public:
enum Type {
EMPTY,
MERGE,
STROKE,
SPONTANEOUS
};
public:
KisUpdateJobItem(QReadWriteLock *exclusiveJobLock)
: m_exclusiveJobLock(exclusiveJobLock),
m_type(EMPTY),
m_runnableJob(0)
{
setAutoDelete(false);
}
- ~KisUpdateJobItem()
+ ~KisUpdateJobItem() override
{
delete m_runnableJob;
}
- void run() {
+ void run() override {
if(m_exclusive) {
m_exclusiveJobLock->lockForWrite();
} else {
m_exclusiveJobLock->lockForRead();
}
if(m_type == MERGE) {
runMergeJob();
} else {
Q_ASSERT(m_type == STROKE || m_type == SPONTANEOUS);
m_runnableJob->run();
delete m_runnableJob;
m_runnableJob = 0;
}
setDone();
emit sigDoSomeUsefulWork();
emit sigJobFinished();
m_exclusiveJobLock->unlock();
}
inline void runMergeJob() {
Q_ASSERT(m_type == MERGE);
// dbgKrita << "Executing merge job" << m_walker->changeRect()
// << "on thread" << QThread::currentThreadId();
m_merger.startMerge(*m_walker);
QRect changeRect = m_walker->changeRect();
emit sigContinueUpdate(changeRect);
}
inline void setWalker(KisBaseRectsWalkerSP walker) {
m_type = MERGE;
m_accessRect = walker->accessRect();
m_changeRect = walker->changeRect();
m_walker = walker;
m_exclusive = false;
m_runnableJob = 0;
}
inline void setStrokeJob(KisStrokeJob *strokeJob) {
m_type = STROKE;
m_runnableJob = strokeJob;
m_exclusive = strokeJob->isExclusive();
m_walker = 0;
m_accessRect = m_changeRect = QRect();
}
inline void setSpontaneousJob(KisSpontaneousJob *spontaneousJob) {
m_type = SPONTANEOUS;
m_runnableJob = spontaneousJob;
m_exclusive = false;
m_walker = 0;
m_accessRect = m_changeRect = QRect();
}
inline void setDone() {
m_walker = 0;
m_runnableJob = 0;
m_type = EMPTY;
}
inline bool isRunning() const {
return m_type != EMPTY;
}
inline Type type() const {
return m_type;
}
inline const QRect& accessRect() const {
return m_accessRect;
}
inline const QRect& changeRect() const {
return m_changeRect;
}
Q_SIGNALS:
void sigContinueUpdate(const QRect& rc);
void sigDoSomeUsefulWork();
void sigJobFinished();
private:
/**
* Open walker and stroke job for the testing suite.
* Please, do not use it in production code.
*/
friend class KisSimpleUpdateQueueTest;
friend class KisStrokesQueueTest;
friend class KisUpdateSchedulerTest;
friend class KisTestableUpdaterContext;
inline KisBaseRectsWalkerSP walker() const {
return m_walker;
}
inline KisStrokeJob* strokeJob() const {
KisStrokeJob *job = dynamic_cast<KisStrokeJob*>(m_runnableJob);
Q_ASSERT(job);
return job;
}
inline void testingSetDone() {
if(m_type == STROKE) {
delete m_runnableJob;
}
setDone();
}
private:
/**
* \see KisUpdaterContext::m_exclusiveJobLock
*/
QReadWriteLock *m_exclusiveJobLock;
bool m_exclusive;
volatile Type m_type;
/**
* Runnable jobs part
* The job is owned by the context and deleted after completion
*/
KisRunnable *m_runnableJob;
/**
* Merge jobs part
*/
KisBaseRectsWalkerSP m_walker;
KisAsyncMerger m_merger;
/**
* These rects cache actual values from the walker
* to eliminate concurrent access to a walker structure
*/
QRect m_accessRect;
QRect m_changeRect;
};
#endif /* __KIS_UPDATE_JOB_ITEM_H */
diff --git a/libs/image/kis_update_outline_job.h b/libs/image/kis_update_outline_job.h
index c116b192de..e64dc01bf0 100644
--- a/libs/image/kis_update_outline_job.h
+++ b/libs/image/kis_update_outline_job.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UPDATE_OUTLINE_JOB_H
#define __KIS_UPDATE_OUTLINE_JOB_H
#include <QColor>
#include "kis_spontaneous_job.h"
#include "kis_selection.h"
class KRITAIMAGE_EXPORT KisUpdateOutlineJob : public KisSpontaneousJob
{
public:
KisUpdateOutlineJob(KisSelectionSP selection, bool updateThumbnail, const QColor &maskColor);
- bool overrides(const KisSpontaneousJob *otherJob);
- void run();
- int levelOfDetail() const;
+ bool overrides(const KisSpontaneousJob *otherJob) override;
+ void run() override;
+ int levelOfDetail() const override;
private:
KisSelectionSP m_selection;
bool m_updateThumbnail;
QColor m_maskColor;
};
#endif /* __KIS_UPDATE_OUTLINE_JOB_H */
diff --git a/libs/image/kis_update_scheduler.h b/libs/image/kis_update_scheduler.h
index bfc1fd7727..1fc6ceede1 100644
--- a/libs/image/kis_update_scheduler.h
+++ b/libs/image/kis_update_scheduler.h
@@ -1,241 +1,241 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UPDATE_SCHEDULER_H
#define __KIS_UPDATE_SCHEDULER_H
#include <QObject>
#include "kritaimage_export.h"
#include "kis_types.h"
#include "kis_image_interfaces.h"
#include "kis_stroke_strategy_factory.h"
#include "kis_strokes_queue_undo_result.h"
class QRect;
class KoProgressProxy;
class KisProjectionUpdateListener;
class KisSpontaneousJob;
class KisPostExecutionUndoAdapter;
class KRITAIMAGE_EXPORT KisUpdateScheduler : public QObject, public KisStrokesFacade
{
Q_OBJECT
public:
KisUpdateScheduler(KisProjectionUpdateListener *projectionUpdateListener, QObject *parent = 0);
- virtual ~KisUpdateScheduler();
+ ~KisUpdateScheduler() override;
/**
* Sets the proxy that is going to be notified about the progress
* of processing of the queues. If you want to switch the proxy
* on runtime, you should do it under the lock held.
*
* \see lock(), unlock()
*/
void setProgressProxy(KoProgressProxy *progressProxy);
/**
* Blocks processing of the queues.
* The function will wait until all the executing jobs
* are finished.
* NOTE: you may add new jobs while the block held, but they
* will be delayed until unlock() is called.
*
* \see unlock()
*/
void lock();
/**
* Unblocks the process and calls processQueues()
*
* \see processQueues()
*/
void unlock(bool resetLodLevels = true);
/**
* Called when it is necessary to reread configuration
*/
void updateSettings();
/**
* Waits until all the running jobs are finished.
*
* If some other thread adds jobs in parallel, then you may
* wait forever. If you you don't want it, consider lock() instead.
*
* \see lock()
*/
void waitForDone();
/**
* Waits until the queues become empty, then blocks the processing.
* To unblock processing you should use unlock().
*
* If some other thread adds jobs in parallel, then you may
* wait forever. If you you don't want it, consider lock() instead.
*
* \see unlock(), lock()
*/
void barrierLock();
/**
* Works like barrier lock, but returns false immediately if barrierLock
* can't be acquired.
*
* \see barrierLock()
*/
bool tryBarrierLock();
/**
* Tells if there are no strokes or updates are running at the
* moment. Internally calls to tryBarrierLock(), so it is not O(1).
*/
bool isIdle();
/**
* Blocks all the updates from execution. It doesn't affect
* strokes execution in any way. This type of lock is supposed
* to be held by the strokes themselves when they need a short
* access to some parts of the projection of the image.
*
* From all the other places you should use usual lock()/unlock()
* methods
*
* \see lock(), unlock()
*/
void blockUpdates();
/**
* Unblocks updates from execution previously locked by blockUpdates()
*
* \see blockUpdates()
*/
void unblockUpdates();
void updateProjection(KisNodeSP node, const QRect& rc, const QRect &cropRect);
void updateProjectionNoFilthy(KisNodeSP node, const QRect& rc, const QRect &cropRect);
void fullRefreshAsync(KisNodeSP root, const QRect& rc, const QRect &cropRect);
void fullRefresh(KisNodeSP root, const QRect& rc, const QRect &cropRect);
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);
- KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy);
- void addJob(KisStrokeId id, KisStrokeJobData *data);
- void endStroke(KisStrokeId id);
- bool cancelStroke(KisStrokeId id);
+ KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override;
+ void addJob(KisStrokeId id, KisStrokeJobData *data) override;
+ void endStroke(KisStrokeId id) override;
+ bool cancelStroke(KisStrokeId id) override;
/**
* Sets the desired level of detail on which the strokes should
* work. Please note that this configuration will be applied
* starting from the next stroke. Please also note that this value
* is not guaranteed to coincide with the one returned by
* currentLevelOfDetail()
*/
void setDesiredLevelOfDetail(int lod);
/**
* Explicitly start regeneration of LoD planes of all the devices
* in the image. This call should be performed when the user is idle,
* just to make the quality of image updates better.
*/
void explicitRegenerateLevelOfDetail();
/**
* Install a factory of a stroke strategy, that will be started
* every time when the scheduler needs to synchronize LOD caches
* of all the paint devices of the image.
*/
void setLod0ToNStrokeStrategyFactory(const KisLodSyncStrokeStrategyFactory &factory);
/**
* Install a factory of a stroke strategy, that will be started
* every time when the scheduler needs to postpone all the updates
* of the *LOD0* strokes.
*/
void setSuspendUpdatesStrokeStrategyFactory(const KisSuspendResumeStrategyFactory &factory);
/**
* \see setSuspendUpdatesStrokeStrategyFactory()
*/
void setResumeUpdatesStrokeStrategyFactory(const KisSuspendResumeStrategyFactory &factory);
KisPostExecutionUndoAdapter* lodNPostExecutionUndoAdapter() const;
/**
* tryCancelCurrentStrokeAsync() checks whether there is a
* *running* stroke (which is being executed at this very moment)
* which is not still open by the owner (endStroke() or
* cancelStroke() have already been called) and cancels it.
*
* \return true if some stroke has been found and cancelled
*
* \note This method is *not* part of KisStrokesFacade! It is too
* low level for KisImage. In KisImage it is combined with
* more high level requestStrokeCancellation().
*/
bool tryCancelCurrentStrokeAsync();
UndoResult tryUndoLastStrokeAsync();
bool wrapAroundModeSupported() const;
int currentLevelOfDetail() const;
protected:
// Trivial constructor for testing support
KisUpdateScheduler();
void connectSignals();
void processQueues();
private Q_SLOTS:
void continueUpdate(const QRect &rect);
void doSomeUsefulWork();
void spareThreadAppeared();
private:
friend class UpdatesBlockTester;
bool haveUpdatesRunning();
void tryProcessUpdatesQueue();
void wakeUpWaitingThreads();
void progressUpdate();
protected:
struct Private;
Private * const m_d;
};
class KisTestableUpdaterContext;
class KisTestableSimpleUpdateQueue;
class KRITAIMAGE_EXPORT KisTestableUpdateScheduler : public KisUpdateScheduler
{
public:
KisTestableUpdateScheduler(KisProjectionUpdateListener *projectionUpdateListener,
qint32 threadCount);
KisTestableUpdaterContext* updaterContext();
KisTestableSimpleUpdateQueue* updateQueue();
using KisUpdateScheduler::processQueues;
};
#endif /* __KIS_UPDATE_SCHEDULER_H */
diff --git a/libs/image/kis_update_selection_job.h b/libs/image/kis_update_selection_job.h
index 07d4901cd1..60401491b7 100644
--- a/libs/image/kis_update_selection_job.h
+++ b/libs/image/kis_update_selection_job.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UPDATE_SELECTION_JOB_H
#define __KIS_UPDATE_SELECTION_JOB_H
#include "kis_spontaneous_job.h"
#include "kis_selection.h"
class KRITAIMAGE_EXPORT KisUpdateSelectionJob : public KisSpontaneousJob
{
public:
KisUpdateSelectionJob(KisSelectionSP selection, const QRect &updateRect = QRect());
- bool overrides(const KisSpontaneousJob *otherJob);
- void run();
- int levelOfDetail() const;
+ bool overrides(const KisSpontaneousJob *otherJob) override;
+ void run() override;
+ int levelOfDetail() const override;
private:
KisSelectionSP m_selection;
QRect m_updateRect;
};
#endif /* __KIS_UPDATE_SELECTION_JOB_H */
diff --git a/libs/image/kis_updater_context.h b/libs/image/kis_updater_context.h
index 673883399b..c4e18b1824 100644
--- a/libs/image/kis_updater_context.h
+++ b/libs/image/kis_updater_context.h
@@ -1,173 +1,173 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UPDATER_CONTEXT_H
#define __KIS_UPDATER_CONTEXT_H
#include <QObject>
#include <QMutex>
#include <QReadWriteLock>
#include <QThreadPool>
#include "kis_base_rects_walker.h"
#include "kis_async_merger.h"
#include "kis_lock_free_lod_counter.h"
class KisUpdateJobItem;
class KisSpontaneousJob;
class KisStrokeJob;
class KRITAIMAGE_EXPORT KisUpdaterContext : public QObject
{
Q_OBJECT
public:
static const int useIdealThreadCountTag;
public:
KisUpdaterContext(qint32 threadCount = useIdealThreadCountTag, QObject *parent = 0);
- virtual ~KisUpdaterContext();
+ ~KisUpdaterContext() override;
/**
* Returns the number of currently running jobs of each type.
* To use this information you should lock the context beforehand.
*
* \see lock()
*/
void getJobsSnapshot(qint32 &numMergeJobs, qint32 &numStrokeJobs);
/**
* Returns the current level of detail of all the running jobs in the
* context. If there are no jobs, returns -1.
*/
int currentLevelOfDetail() const;
/**
* Check whether there is a spare thread for running
* one more job
*/
bool hasSpareThread();
/**
* Checks whether the walker intersects with any
* of currently executing walkers. If it does,
* it is not allowed to go in. It should be called
* with the lock held.
*
* \see lock()
*/
bool isJobAllowed(KisBaseRectsWalkerSP walker);
/**
* Registers the job and starts executing it.
* The caller must ensure that the context is locked
* with lock(), job is allowed with isWalkerAllowed() and
* there is a spare thread for running it with hasSpareThread()
*
* \see lock()
* \see isWalkerAllowed()
* \see hasSpareThread()
*/
virtual void addMergeJob(KisBaseRectsWalkerSP walker);
/**
* Adds a stroke job to the context. The prerequisites are
* the same as for addMergeJob()
* \see addMergeJob()
*/
virtual void addStrokeJob(KisStrokeJob *strokeJob);
/**
* Adds a spontaneous job to the context. The prerequisites are
* the same as for addMergeJob()
* \see addMergeJob()
*/
virtual void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);
/**
* Block execution of the caller until all the jobs are finished
*/
void waitForDone();
/**
* Locks the context to guarantee an exclusive access
* to the context
*/
void lock();
/**
* Unlocks the context
*
* \see lock()
*/
void unlock();
Q_SIGNALS:
void sigContinueUpdate(const QRect& rc);
void sigDoSomeUsefulWork();
void sigSpareThreadAppeared();
protected Q_SLOTS:
void slotJobFinished();
protected:
static bool walkerIntersectsJob(KisBaseRectsWalkerSP walker,
const KisUpdateJobItem* job);
qint32 findSpareThread();
protected:
/**
* The lock is shared by all the child update job items.
* When an item wants to run a usual (non-exclusive) job,
* it locks the lock for read access. When an exclusive
* access is requested, it locks it for write
*/
QReadWriteLock m_exclusiveJobLock;
QMutex m_lock;
QVector<KisUpdateJobItem*> m_jobs;
QThreadPool m_threadPool;
KisLockFreeLodCounter m_lodCounter;
};
class KRITAIMAGE_EXPORT KisTestableUpdaterContext : public KisUpdaterContext
{
public:
/**
* Creates an explicit number of threads
*/
KisTestableUpdaterContext(qint32 threadCount);
- ~KisTestableUpdaterContext();
+ ~KisTestableUpdaterContext() override;
/**
* The only difference - it doesn't start execution
* of the job
*/
- void addMergeJob(KisBaseRectsWalkerSP walker);
- void addStrokeJob(KisStrokeJob *strokeJob);
- void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);
+ void addMergeJob(KisBaseRectsWalkerSP walker) override;
+ void addStrokeJob(KisStrokeJob *strokeJob) override;
+ void addSpontaneousJob(KisSpontaneousJob *spontaneousJob) override;
const QVector<KisUpdateJobItem*> getJobs();
void clear();
};
#endif /* __KIS_UPDATER_CONTEXT_H */
diff --git a/libs/image/kis_warptransform_worker.h b/libs/image/kis_warptransform_worker.h
index 4857d3ddc8..294e3ae1f6 100644
--- a/libs/image/kis_warptransform_worker.h
+++ b/libs/image/kis_warptransform_worker.h
@@ -1,85 +1,85 @@
/*
* kis_warptransform_worker.h - part of Krita
*
* Copyright (c) 2010 Marc Pegon <pe.marc@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WARPTRANSFORM_WORKER_H
#define KIS_WARPTRANSFORM_WORKER_H
#include "kis_types.h"
#include "kritaimage_export.h"
#include <QImage>
#include <QPolygon>
#include <QPoint>
#include <QPointF>
#include <QRect>
#include <KoUpdater.h>
/**
* Class to apply a transformation (affine, similitude, MLS) to a paintDevice
* or a QImage according an original set of points p, a new set of points q,
* and the constant alpha.
* The algorithms are based a paper entitled "Image Deformation Using
* Moving Least Squares", by Scott Schaefer (Texas A&M University), Travis
* McPhail (Rice University) and Joe Warren (Rice University)
*/
class KRITAIMAGE_EXPORT KisWarpTransformWorker : public QObject
{
Q_OBJECT
public:
typedef enum WarpType_ {AFFINE_TRANSFORM = 0, SIMILITUDE_TRANSFORM, RIGID_TRANSFORM, N_MODES} WarpType;
static QPointF affineTransformMath(QPointF v, QVector<QPointF> p, QVector<QPointF> q, qreal alpha);
static QPointF similitudeTransformMath(QPointF v, QVector<QPointF> p, QVector<QPointF> q, qreal alpha);
static QPointF rigidTransformMath(QPointF v, QVector<QPointF> p, QVector<QPointF> q, qreal alpha);
static QImage transformQImage(WarpType warpType,
const QVector<QPointF> &origPoint,
const QVector<QPointF> &transfPoint,
qreal alpha,
const QImage& srcImage,
const QPointF &srcQImageOffset,
QPointF *newOffset);
// Prepare the transformation on dev
KisWarpTransformWorker(WarpType warpType, KisPaintDeviceSP dev, QVector<QPointF> origPoint, QVector<QPointF> transfPoint, qreal alpha, KoUpdater *progress);
- ~KisWarpTransformWorker();
+ ~KisWarpTransformWorker() override;
// Perform the prepared transformation
void run();
QRect approxChangeRect(const QRect &rc);
QRect approxNeedRect(const QRect &rc, const QRect &fullBounds);
private:
struct FunctionTransformOp;
typedef QPointF (*WarpMathFunction)(QPointF, QVector<QPointF>, QVector<QPointF>, qreal);
private:
WarpMathFunction m_warpMathFunction;
QVector<QPointF> m_origPoint;
QVector<QPointF> m_transfPoint;
qreal m_alpha;
KisPaintDeviceSP m_dev;
KoUpdater *m_progress;
};
#endif
diff --git a/libs/image/kis_wrapped_random_accessor.h b/libs/image/kis_wrapped_random_accessor.h
index 670332fc53..ede527f154 100644
--- a/libs/image/kis_wrapped_random_accessor.h
+++ b/libs/image/kis_wrapped_random_accessor.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_WRAPPED_RANDOM_ACCESSOR_H
#define __KIS_WRAPPED_RANDOM_ACCESSOR_H
#include "tiles3/kis_random_accessor.h"
class KisWrappedRandomAccessor : public KisRandomAccessor2
{
public:
KisWrappedRandomAccessor(KisTiledDataManager *ktm,
qint32 x, qint32 y,
qint32 offsetX, qint32 offsetY,
bool writable,
KisIteratorCompleteListener *completeListener,
const QRect &wrapRect);
- void moveTo(qint32 x, qint32 y);
- qint32 numContiguousColumns(qint32 x) const;
- qint32 numContiguousRows(qint32 y) const;
- qint32 rowStride(qint32 x, qint32 y) const;
+ void moveTo(qint32 x, qint32 y) override;
+ qint32 numContiguousColumns(qint32 x) const override;
+ qint32 numContiguousRows(qint32 y) const override;
+ qint32 rowStride(qint32 x, qint32 y) const override;
- qint32 x() const;
- qint32 y() const;
+ qint32 x() const override;
+ qint32 y() const override;
private:
QRect m_wrapRect;
QPoint m_currentPos;
};
#endif /* __KIS_WRAPPED_RANDOM_ACCESSOR_H */
diff --git a/libs/image/layerstyles/kis_layer_style_filter_projection_plane.h b/libs/image/layerstyles/kis_layer_style_filter_projection_plane.h
index 8a78a51e59..5876b48f03 100644
--- a/libs/image/layerstyles/kis_layer_style_filter_projection_plane.h
+++ b/libs/image/layerstyles/kis_layer_style_filter_projection_plane.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LAYER_STYLE_FILTER_PROJECTION_PLANE_H
#define __KIS_LAYER_STYLE_FILTER_PROJECTION_PLANE_H
#include "kis_abstract_projection_plane.h"
#include <QScopedPointer>
#include "kis_types.h"
class KisLayerStyleFilterProjectionPlane : public KisAbstractProjectionPlane
{
public:
KisLayerStyleFilterProjectionPlane(KisLayer *sourceLayer);
- ~KisLayerStyleFilterProjectionPlane();
+ ~KisLayerStyleFilterProjectionPlane() override;
void setStyle(KisLayerStyleFilter *filter, KisPSDLayerStyleSP style);
- QRect recalculate(const QRect& rect, KisNodeSP filthyNode);
- void apply(KisPainter *painter, const QRect &rect);
+ QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
+ void apply(KisPainter *painter, const QRect &rect) override;
- QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
+ QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
- KisPaintDeviceList getLodCapableDevices() const;
+ KisPaintDeviceList getLodCapableDevices() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_LAYER_STYLE_FILTER_PROJECTION_PLANE_H */
diff --git a/libs/image/layerstyles/kis_layer_style_projection_plane.h b/libs/image/layerstyles/kis_layer_style_projection_plane.h
index 75f4e5ad3c..7a525bbc6f 100644
--- a/libs/image/layerstyles/kis_layer_style_projection_plane.h
+++ b/libs/image/layerstyles/kis_layer_style_projection_plane.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LAYER_STYLE_PROJECTION_PLANE_H
#define __KIS_LAYER_STYLE_PROJECTION_PLANE_H
#include "kis_abstract_projection_plane.h"
#include <QScopedPointer>
#include "kis_types.h"
#include <kritaimage_export.h>
class KRITAIMAGE_EXPORT KisLayerStyleProjectionPlane : public KisAbstractProjectionPlane
{
public:
KisLayerStyleProjectionPlane(KisLayer *sourceLayer);
- ~KisLayerStyleProjectionPlane();
+ ~KisLayerStyleProjectionPlane() override;
- QRect recalculate(const QRect& rect, KisNodeSP filthyNode);
- void apply(KisPainter *painter, const QRect &rect);
+ QRect recalculate(const QRect& rect, KisNodeSP filthyNode) override;
+ void apply(KisPainter *painter, const QRect &rect) override;
- QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
- QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const;
+ QRect needRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
+ QRect accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const override;
- KisPaintDeviceList getLodCapableDevices() const;
+ KisPaintDeviceList getLodCapableDevices() const override;
// a method for registering on KisLayerStyleProjectionPlaneFactory
static KisAbstractProjectionPlaneSP factoryObject(KisLayer *sourceLayer);
private:
friend class KisLayerStyleProjectionPlaneTest;
KisLayerStyleProjectionPlane(KisLayer *sourceLayer, KisPSDLayerStyleSP style);
void init(KisLayer *sourceLayer, KisPSDLayerStyleSP layerStyle);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_LAYER_STYLE_PROJECTION_PLANE_H */
diff --git a/libs/image/layerstyles/kis_ls_bevel_emboss_filter.h b/libs/image/layerstyles/kis_ls_bevel_emboss_filter.h
index 047753a9ba..8eb62778d5 100644
--- a/libs/image/layerstyles/kis_ls_bevel_emboss_filter.h
+++ b/libs/image/layerstyles/kis_ls_bevel_emboss_filter.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LS_BEVEL_EMBOSS_FILTER_H
#define KIS_LS_BEVEL_EMBOSS_FILTER_H
#include <QSharedPointer>
#include "kis_layer_style_filter.h"
#include <kritaimage_export.h>
struct psd_layer_effects_bevel_emboss;
class KRITAIMAGE_EXPORT KisLsBevelEmbossFilter : public KisLayerStyleFilter
{
public:
KisLsBevelEmbossFilter();
void processDirectly(KisPaintDeviceSP src,
KisMultipleProjection *dst,
const QRect &applyRect,
KisPSDLayerStyleSP style,
- KisLayerStyleFilterEnvironment *env) const;
+ KisLayerStyleFilterEnvironment *env) const override;
- QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
- QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+ QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
+ QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
private:
void applyBevelEmboss(KisPaintDeviceSP srcDevice,
KisMultipleProjection *dst,
const QRect &applyRect,
const psd_layer_effects_bevel_emboss *config,
KisLayerStyleFilterEnvironment *env) const;
};
#endif
diff --git a/libs/image/layerstyles/kis_ls_drop_shadow_filter.h b/libs/image/layerstyles/kis_ls_drop_shadow_filter.h
index a25839f136..db69f4231d 100644
--- a/libs/image/layerstyles/kis_ls_drop_shadow_filter.h
+++ b/libs/image/layerstyles/kis_ls_drop_shadow_filter.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LS_DROP_SHADOW_FILTER_H
#define KIS_LS_DROP_SHADOW_FILTER_H
#include <QSharedPointer>
#include "kis_layer_style_filter.h"
#include <kritaimage_export.h>
class psd_layer_effects_shadow_base;
class KRITAIMAGE_EXPORT KisLsDropShadowFilter : public KisLayerStyleFilter
{
public:
enum Mode {
DropShadow,
InnerShadow,
OuterGlow,
InnerGlow
};
KisLsDropShadowFilter(Mode mode = DropShadow);
void processDirectly(KisPaintDeviceSP src,
KisMultipleProjection *dst,
const QRect &applyRect,
KisPSDLayerStyleSP style,
- KisLayerStyleFilterEnvironment *env) const;
+ KisLayerStyleFilterEnvironment *env) const override;
- QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
- QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+ QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
+ QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
private:
const psd_layer_effects_shadow_base* getShadowStruct(KisPSDLayerStyleSP style) const;
private:
const Mode m_mode;
};
#endif
diff --git a/libs/image/layerstyles/kis_ls_overlay_filter.h b/libs/image/layerstyles/kis_ls_overlay_filter.h
index 606a4758c5..57f965e5d8 100644
--- a/libs/image/layerstyles/kis_ls_overlay_filter.h
+++ b/libs/image/layerstyles/kis_ls_overlay_filter.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LS_OVERLAY_FILTER_H
#define KIS_LS_OVERLAY_FILTER_H
#include <QSharedPointer>
#include "kis_layer_style_filter.h"
#include <kritaimage_export.h>
struct psd_layer_effects_overlay_base;
class KRITAIMAGE_EXPORT KisLsOverlayFilter : public KisLayerStyleFilter
{
public:
enum Mode {
Color,
Gradient,
Pattern
};
public:
KisLsOverlayFilter(Mode mode);
void processDirectly(KisPaintDeviceSP src,
KisMultipleProjection *dst,
const QRect &applyRect,
KisPSDLayerStyleSP style,
- KisLayerStyleFilterEnvironment *env) const;
+ KisLayerStyleFilterEnvironment *env) const override;
- QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
- QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+ QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
+ QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
private:
const psd_layer_effects_overlay_base* getOverlayStruct(KisPSDLayerStyleSP style) const;
void applyOverlay(KisPaintDeviceSP srcDevice,
KisMultipleProjection *dst,
const QRect &applyRect,
const psd_layer_effects_overlay_base *config,
KisLayerStyleFilterEnvironment *env) const;
private:
Mode m_mode;
};
#endif
diff --git a/libs/image/layerstyles/kis_ls_satin_filter.h b/libs/image/layerstyles/kis_ls_satin_filter.h
index 31f780d250..0140ef9ba8 100644
--- a/libs/image/layerstyles/kis_ls_satin_filter.h
+++ b/libs/image/layerstyles/kis_ls_satin_filter.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LS_SATIN_FILTER_H
#define KIS_LS_SATIN_FILTER_H
#include <QSharedPointer>
#include "kis_layer_style_filter.h"
#include <kritaimage_export.h>
class KRITAIMAGE_EXPORT KisLsSatinFilter : public KisLayerStyleFilter
{
public:
KisLsSatinFilter();
void processDirectly(KisPaintDeviceSP src,
KisMultipleProjection *dst,
const QRect &applyRect,
KisPSDLayerStyleSP style,
- KisLayerStyleFilterEnvironment *env) const;
+ KisLayerStyleFilterEnvironment *env) const override;
- QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
- QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+ QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
+ QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
};
#endif
diff --git a/libs/image/layerstyles/kis_ls_stroke_filter.h b/libs/image/layerstyles/kis_ls_stroke_filter.h
index e827899d83..b46a83309b 100644
--- a/libs/image/layerstyles/kis_ls_stroke_filter.h
+++ b/libs/image/layerstyles/kis_ls_stroke_filter.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LS_STROKE_FILTER_H
#define KIS_LS_STROKE_FILTER_H
#include <QSharedPointer>
#include <kritaimage_export.h>
#include "kis_layer_style_filter.h"
struct psd_layer_effects_stroke;
class KRITAIMAGE_EXPORT KisLsStrokeFilter : public KisLayerStyleFilter
{
public:
KisLsStrokeFilter();
void processDirectly(KisPaintDeviceSP src,
KisMultipleProjection *dst,
const QRect &applyRect,
KisPSDLayerStyleSP style,
- KisLayerStyleFilterEnvironment *env) const;
+ KisLayerStyleFilterEnvironment *env) const override;
- QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
- QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+ QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
+ QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const override;
private:
void applyStroke(KisPaintDeviceSP srcDevice,
KisMultipleProjection *dst,
const QRect &applyRect,
const psd_layer_effects_stroke *config,
KisLayerStyleFilterEnvironment *env) const;
};
#endif
diff --git a/libs/image/lazybrush/kis_colorize_mask.h b/libs/image/lazybrush/kis_colorize_mask.h
index 9bd63a25d6..0f25c38747 100644
--- a/libs/image/lazybrush/kis_colorize_mask.h
+++ b/libs/image/lazybrush/kis_colorize_mask.h
@@ -1,148 +1,148 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLORIZE_MASK_H
#define __KIS_COLORIZE_MASK_H
#include <QScopedPointer>
#include "kis_types.h"
#include "kis_effect_mask.h"
#include "kritaimage_export.h"
class KoColor;
class KUndo2Command;
namespace KisLazyFillTools
{
struct KeyStroke;
}
class KRITAIMAGE_EXPORT KisColorizeMask : public KisEffectMask
{
Q_OBJECT
public:
struct KeyStrokeColors {
QVector<KoColor> colors;
int transparentIndex;
};
public:
KisColorizeMask();
- ~KisColorizeMask();
+ ~KisColorizeMask() override;
KisColorizeMask(const KisColorizeMask& rhs);
void initializeCompositeOp();
const KoColorSpace* colorSpace() const override;
// assign color profile without conversion of pixel data
void setProfile(const KoColorProfile *profile);
KUndo2Command* setColorSpace(const KoColorSpace * dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent = KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::ConversionFlags conversionFlags = KoColorConversionTransformation::internalConversionFlags());
KisPaintDeviceSP paintDevice() const override;
KisPaintDeviceSP coloringProjection() const;
KisNodeSP clone() const override {
return KisNodeSP(new KisColorizeMask(*this));
}
QIcon icon() const override;
void setImage(KisImageWSP image) override;
bool accept(KisNodeVisitor &v) override;
void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
QRect decorateRect(KisPaintDeviceSP &src,
KisPaintDeviceSP &dst,
const QRect & rc,
PositionToFilthy maskPos) const override;
void setCurrentColor(const KoColor &color) override;
void mergeToLayer(KisNodeSP layer, KisPostExecutionUndoAdapter *undoAdapter, const KUndo2MagicString &transactionText,int timedID) override;
void writeMergeData(KisPainter *painter, KisPaintDeviceSP src) override;
QRect exactBounds() const override;
QRect extent() const override;
/**
* Colorize mask has its own "projection", so it should report it
* to the parent layer using non-dependent-extent property
*/
QRect nonDependentExtent() const override;
void setSectionModelProperties(const KisBaseNode::PropertyList &properties) override;
KisBaseNode::PropertyList sectionModelProperties() const override;
KeyStrokeColors keyStrokesColors() const;
void setKeyStrokesColors(KeyStrokeColors colors);
void removeKeyStroke(const KoColor &color);
QVector<KisPaintDeviceSP> allPaintDevices() const;
void resetCache();
void testingAddKeyStroke(KisPaintDeviceSP dev, const KoColor &color, bool isTransparent = false);
void testingRegenerateMask();
KisPaintDeviceSP testingFilteredSource() const;
QList<KisLazyFillTools::KeyStroke> fetchKeyStrokesDirect() const;
void setKeyStrokesDirect(const QList<KisLazyFillTools::KeyStroke> &strokes);
qint32 x() const override;
qint32 y() const override;
void setX(qint32 x) override;
void setY(qint32 y) override;
KisPaintDeviceList getLodCapableDevices() const override;
private Q_SLOTS:
void slotUpdateRegenerateFilling();
void slotRegenerationFinished();
Q_SIGNALS:
void sigKeyStrokesListChanged();
private:
// NOTE: please access this methods using model properties only!
bool needsUpdate() const;
void setNeedsUpdate(bool value);
bool showColoring() const;
void setShowColoring(bool value);
bool showKeyStrokes() const;
void setShowKeyStrokes(bool value);
private:
void rerenderFakePaintDevice();
KisImageSP fetchImage() const;
void moveAllInternalDevices(const QPoint &diff);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_COLORIZE_MASK_H */
diff --git a/libs/image/lazybrush/kis_colorize_stroke_strategy.h b/libs/image/lazybrush/kis_colorize_stroke_strategy.h
index 0d080c7348..dda84c0ba1 100644
--- a/libs/image/lazybrush/kis_colorize_stroke_strategy.h
+++ b/libs/image/lazybrush/kis_colorize_stroke_strategy.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLORIZE_STROKE_STRATEGY_H
#define __KIS_COLORIZE_STROKE_STRATEGY_H
#include <QScopedPointer>
#include <QObject>
#include "kis_types.h"
#include <kis_simple_stroke_strategy.h>
class KoColor;
class KisColorizeStrokeStrategy : public QObject, public KisSimpleStrokeStrategy
{
Q_OBJECT
public:
KisColorizeStrokeStrategy(KisPaintDeviceSP src,
KisPaintDeviceSP dst,
KisPaintDeviceSP filteredSource,
bool filteredSourceValid,
const QRect &boundingRect, KisNodeSP dirtyNode);
KisColorizeStrokeStrategy(const KisColorizeStrokeStrategy &rhs, int levelOfDetail);
- ~KisColorizeStrokeStrategy();
+ ~KisColorizeStrokeStrategy() override;
void addKeyStroke(KisPaintDeviceSP dev, const KoColor &color);
- void initStrokeCallback();
+ void initStrokeCallback() override;
- KisStrokeStrategy *createLodClone(int levelOfDetail);
+ KisStrokeStrategy *createLodClone(int levelOfDetail) override;
Q_SIGNALS:
void sigFinished();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_COLORIZE_STROKE_STRATEGY_H */
diff --git a/libs/image/metadata/kis_exif_info_visitor.h b/libs/image/metadata/kis_exif_info_visitor.h
index f830821d51..16995cd575 100644
--- a/libs/image/metadata/kis_exif_info_visitor.h
+++ b/libs/image/metadata/kis_exif_info_visitor.h
@@ -1,95 +1,95 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_EXIF_INFO_VISITOR_H
#define KIS_EXIF_INFO_VISITOR_H
#include <kis_node_visitor.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_filter_registry_model.h>
#include <kis_paint_layer.h>
#include <kis_group_layer.h>
class KisExifInfoVisitor : public KisNodeVisitor
{
public:
KisExifInfoVisitor() :
m_exifInfo(0),
m_countPaintLayer(0) { }
public:
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisCloneLayer*) {
+ bool visit(KisCloneLayer*) override {
return true;
}
- bool visit(KisFilterMask*) {
+ bool visit(KisFilterMask*) override {
return true;
}
- bool visit(KisTransformMask*) {
+ bool visit(KisTransformMask*) override {
return true;
}
- bool visit(KisTransparencyMask*) {
+ bool visit(KisTransparencyMask*) override {
return true;
}
- bool visit(KisSelectionMask*) {
+ bool visit(KisSelectionMask*) override {
return true;
}
- bool visit(KisColorizeMask*) {
+ bool visit(KisColorizeMask*) override {
return true;
}
- bool visit(KisExternalLayer*) {
+ bool visit(KisExternalLayer*) override {
return true;
}
- bool visit(KisGeneratorLayer*) {
+ bool visit(KisGeneratorLayer*) override {
return true;
}
- bool visit(KisAdjustmentLayer*) {
+ bool visit(KisAdjustmentLayer*) override {
return true;
}
- bool visit(KisPaintLayer* layer) {
+ bool visit(KisPaintLayer* layer) override {
m_countPaintLayer++;
if (!layer->metaData()->empty()) {
m_exifInfo = layer->metaData();
}
return true;
}
- bool visit(KisGroupLayer* layer) {
+ bool visit(KisGroupLayer* layer) override {
dbgFile << "Visiting on grouplayer" << layer->name() << "";
return visitAll(layer, true);
}
public:
inline uint countPaintLayer() {
return m_countPaintLayer;
}
inline KisMetaData::Store* exifInfo() {
return m_exifInfo;
}
private:
KisMetaData::Store* m_exifInfo;
uint m_countPaintLayer;
};
#endif
diff --git a/libs/image/metadata/kis_meta_data_filter_p.h b/libs/image/metadata/kis_meta_data_filter_p.h
index 7de9154e7c..e9f91048c2 100644
--- a/libs/image/metadata/kis_meta_data_filter_p.h
+++ b/libs/image/metadata/kis_meta_data_filter_p.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_META_DATA_FILTER_P_H
#define KIS_META_DATA_FILTER_P_H
#include "kis_meta_data_filter.h"
namespace KisMetaData
{
/**
* Filter that remove personal data in a meta store.
*/
class AnonymizerFilter : public Filter
{
public:
- virtual ~AnonymizerFilter();
- virtual QString id() const;
- virtual QString name() const;
- virtual QString description() const;
- virtual bool defaultEnabled() const;
- virtual void filter(KisMetaData::Store*) const;
+ ~AnonymizerFilter() override;
+ QString id() const override;
+ QString name() const override;
+ QString description() const override;
+ bool defaultEnabled() const override;
+ void filter(KisMetaData::Store*) const override;
};
/**
* Filter that add the name of the creation program and the date
* of the last modificiation.
*/
class ToolInfoFilter : public Filter
{
public:
- virtual ~ToolInfoFilter();
- virtual QString id() const;
- virtual QString name() const;
- virtual QString description() const;
- virtual bool defaultEnabled() const;
- virtual void filter(KisMetaData::Store*) const;
+ ~ToolInfoFilter() override;
+ QString id() const override;
+ QString name() const override;
+ QString description() const override;
+ bool defaultEnabled() const override;
+ void filter(KisMetaData::Store*) const override;
};
}
#endif
diff --git a/libs/image/metadata/kis_meta_data_filter_registry.h b/libs/image/metadata/kis_meta_data_filter_registry.h
index 6c1b692300..239440e78d 100644
--- a/libs/image/metadata/kis_meta_data_filter_registry.h
+++ b/libs/image/metadata/kis_meta_data_filter_registry.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_META_DATA_FILTER_REGISTRY_H_
#define _KIS_META_DATA_FILTER_REGISTRY_H_
#include <kritaimage_export.h>
#include "KoGenericRegistry.h"
#include "kis_meta_data_filter.h"
namespace KisMetaData
{
class KRITAIMAGE_EXPORT FilterRegistry : public KoGenericRegistry<const KisMetaData::Filter*>
{
public:
FilterRegistry();
- virtual ~FilterRegistry();
+ ~FilterRegistry() override;
static FilterRegistry* instance();
private:
FilterRegistry(const FilterRegistry&);
FilterRegistry& operator=(const FilterRegistry&);
};
}
#endif
diff --git a/libs/image/metadata/kis_meta_data_filter_registry_model.h b/libs/image/metadata/kis_meta_data_filter_registry_model.h
index 5274c97d7e..707c398a10 100644
--- a/libs/image/metadata/kis_meta_data_filter_registry_model.h
+++ b/libs/image/metadata/kis_meta_data_filter_registry_model.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_META_DATA_FILTER_REGISTRY_MODEL_H_
#define _KIS_META_DATA_FILTER_REGISTRY_MODEL_H_
#include "kis_meta_data_filter_registry.h"
#include <KoGenericRegistryModel.h>
class QStringList;
namespace KisMetaData
{
/**
* Use this model to display a list of filters (KisMetaData::Filter) that can be
* enabled or disabled.
*/
class KRITAIMAGE_EXPORT FilterRegistryModel : public KoGenericRegistryModel<const Filter*>
{
public:
FilterRegistryModel();
- ~FilterRegistryModel();
+ ~FilterRegistryModel() override;
public:
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual Qt::ItemFlags flags(const QModelIndex & index) const;
- virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex & index) const override;
+ bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override;
/// @return a list of filters that are enabled
QList<const Filter*> enabledFilters() const;
/// enable the filters in the given list; others will be disabled.
virtual void setEnabledFilters(const QStringList &enabledFilters);
private:
struct Private;
Private* const d;
};
}
#endif
diff --git a/libs/image/metadata/kis_meta_data_io_backend.h b/libs/image/metadata/kis_meta_data_io_backend.h
index e48898a2eb..115db7bad9 100644
--- a/libs/image/metadata/kis_meta_data_io_backend.h
+++ b/libs/image/metadata/kis_meta_data_io_backend.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_META_DATA_IO_BACKEND_H_
#define _KIS_META_DATA_IO_BACKEND_H_
#include <kritaimage_export.h>
#include <KoGenericRegistry.h>
class QIODevice;
namespace KisMetaData
{
class Store;
/**
* This is a the interface for input or output backend to KisMetaData.
* For instance, to add support to exif or xmp or iptc or dublin core
* or anything else, it is needed to extend this interface.
*/
class KRITAIMAGE_EXPORT IOBackend
{
public:
/**
* Tell whether the backend input/output from/to binary data
* or text (XML or RDF) data.
*/
enum BackendType {
Binary,
Text
};
enum HeaderType {
NoHeader, ///< Don't append any header
JpegHeader ///< Append Jpeg-style header
};
public:
virtual ~IOBackend() {};
virtual QString id() const = 0;
virtual QString name() const = 0;
/**
* @return the type of the backend
*/
virtual BackendType type() const = 0;
/**
* @return tell if this backend support saving
*/
virtual bool supportSaving() const = 0;
/**
* @param store the list of metadata to save
* @param ioDevice the device to where the metadata will be saved
* @param headerType determine if an header must be prepend to the binary header, and if it does,
* which type of header
* @return true if the save was successful (XXX: actually, all backends always return true...)
*/
virtual bool saveTo(Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const = 0;
/**
* @param store the list of metadata
* @return true if this backend is capable of saving all the metadata
* of the store
*/
virtual bool canSaveAllEntries(Store* store) const = 0;
/**
* @return true if this backend support loading
*/
virtual bool supportLoading() const = 0;
/**
* @param store the list of metadata to load
* @param ioDevice the device from where the metadata will be loaded
* @return true if the load was successful
*/
virtual bool loadFrom(Store* store, QIODevice* ioDevice) const = 0;
};
class KRITAIMAGE_EXPORT IOBackendRegistry : public KoGenericRegistry<IOBackend*>
{
public:
IOBackendRegistry();
- ~IOBackendRegistry();
+ ~IOBackendRegistry() override;
static IOBackendRegistry* instance();
};
}
#endif
diff --git a/libs/image/metadata/kis_meta_data_merge_strategy_p.h b/libs/image/metadata/kis_meta_data_merge_strategy_p.h
index 5c2b89d266..679a21ad9f 100644
--- a/libs/image/metadata/kis_meta_data_merge_strategy_p.h
+++ b/libs/image/metadata/kis_meta_data_merge_strategy_p.h
@@ -1,79 +1,79 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_META_DATA_MERGE_STRATEGY_P_H
#define KIS_META_DATA_MERGE_STRATEGY_P_H
#include "kis_meta_data_merge_strategy.h"
class QString;
namespace KisMetaData
{
class Schema;
class Value;
/**
* This strategy drop all meta data.
*/
class DropMergeStrategy : public MergeStrategy
{
public:
DropMergeStrategy();
- virtual ~DropMergeStrategy();
- virtual QString id() const;
- virtual QString name() const;
- virtual QString description() const;
- virtual void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const;
+ ~DropMergeStrategy() override;
+ QString id() const override;
+ QString name() const override;
+ QString description() const override;
+ void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const override;
};
class PriorityToFirstMergeStrategy : public MergeStrategy
{
public:
PriorityToFirstMergeStrategy();
- virtual ~PriorityToFirstMergeStrategy();
- virtual QString id() const;
- virtual QString name() const;
- virtual QString description() const;
- virtual void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const;
+ ~PriorityToFirstMergeStrategy() override;
+ QString id() const override;
+ QString name() const override;
+ QString description() const override;
+ void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const override;
};
class OnlyIdenticalMergeStrategy : public MergeStrategy
{
public:
OnlyIdenticalMergeStrategy();
- virtual ~OnlyIdenticalMergeStrategy();
- virtual QString id() const;
- virtual QString name() const;
- virtual QString description() const;
- virtual void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const;
+ ~OnlyIdenticalMergeStrategy() override;
+ QString id() const override;
+ QString name() const override;
+ QString description() const override;
+ void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const override;
};
class SmartMergeStrategy : public MergeStrategy
{
public:
SmartMergeStrategy();
- virtual ~SmartMergeStrategy();
- virtual QString id() const;
- virtual QString name() const;
- virtual QString description() const;
- virtual void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const;
+ ~SmartMergeStrategy() override;
+ QString id() const override;
+ QString name() const override;
+ QString description() const override;
+ void merge(Store* dst, QList<const Store*> srcs, QList<double> score) const override;
protected:
/**
* Merge multiple entries in one.
*/
void mergeEntry(Store* dst, QList<const Store*> srcs, const Schema* schema, const QString & identifier) const;
Value election(QList<const Store*> srcs, QList<double> score, const QString & key) const;
};
}
#endif
diff --git a/libs/image/metadata/kis_meta_data_merge_strategy_registry.h b/libs/image/metadata/kis_meta_data_merge_strategy_registry.h
index 3a1f395b24..9f30a2f32f 100644
--- a/libs/image/metadata/kis_meta_data_merge_strategy_registry.h
+++ b/libs/image/metadata/kis_meta_data_merge_strategy_registry.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_META_DATA_MERGE_STRATEGY_REGISTRY_H_
#define _KIS_META_DATA_MERGE_STRATEGY_REGISTRY_H_
#include <kritaimage_export.h>
#include "KoGenericRegistry.h"
#include "kis_meta_data_merge_strategy.h"
namespace KisMetaData
{
class KRITAIMAGE_EXPORT MergeStrategyRegistry : public KoGenericRegistry<const KisMetaData::MergeStrategy*>
{
public:
MergeStrategyRegistry();
- virtual ~MergeStrategyRegistry();
+ ~MergeStrategyRegistry() override;
static MergeStrategyRegistry* instance();
private:
MergeStrategyRegistry(const MergeStrategyRegistry&);
MergeStrategyRegistry& operator=(const MergeStrategyRegistry&);
};
}
#endif
diff --git a/libs/image/metadata/kis_meta_data_parser_p.h b/libs/image/metadata/kis_meta_data_parser_p.h
index 090a8ad710..f194310ae5 100644
--- a/libs/image/metadata/kis_meta_data_parser_p.h
+++ b/libs/image/metadata/kis_meta_data_parser_p.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_meta_data_parser.h"
namespace KisMetaData
{
class IntegerParser : public Parser
{
public:
- virtual Value parse(const QString&) const;
+ Value parse(const QString&) const override;
};
class TextParser : public Parser
{
public:
- virtual Value parse(const QString&) const;
+ Value parse(const QString&) const override;
};
class DateParser : public Parser
{
public:
- virtual Value parse(const QString&) const;
+ Value parse(const QString&) const override;
};
class RationalParser : public Parser
{
public:
- virtual Value parse(const QString&) const;
+ Value parse(const QString&) const override;
};
}
diff --git a/libs/image/processing/kis_crop_processing_visitor.h b/libs/image/processing/kis_crop_processing_visitor.h
index 04ccc4e024..9b8c63743b 100644
--- a/libs/image/processing/kis_crop_processing_visitor.h
+++ b/libs/image/processing/kis_crop_processing_visitor.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CROP_PROCESSING_VISITOR_H
#define __KIS_CROP_PROCESSING_VISITOR_H
#include "kis_simple_processing_visitor.h"
#include <QRect>
#include "kis_types.h"
class KRITAIMAGE_EXPORT KisCropProcessingVisitor : public KisSimpleProcessingVisitor
{
public:
KisCropProcessingVisitor(const QRect &rect, bool cropLayers, bool moveLayers);
private:
- void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter);
- void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
+ void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
public:
- void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter);
- void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter);
+ void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) override;
using KisSimpleProcessingVisitor::visit;
private:
void moveNodeImpl(KisNode *node, KisUndoAdapter *undoAdapter);
void cropPaintDeviceImpl(KisPaintDeviceSP device, KisUndoAdapter *undoAdapter);
private:
QRect m_rect;
bool m_cropLayers;
bool m_moveLayers;
};
#endif /* __KIS_CROP_PROCESSING_VISITOR_H */
diff --git a/libs/image/processing/kis_crop_selections_processing_visitor.h b/libs/image/processing/kis_crop_selections_processing_visitor.h
index 336f3798f9..262928970d 100644
--- a/libs/image/processing/kis_crop_selections_processing_visitor.h
+++ b/libs/image/processing/kis_crop_selections_processing_visitor.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CROP_SELECTIONS_PROCESSING_VISITOR_H
#define __KIS_CROP_SELECTIONS_PROCESSING_VISITOR_H
#include <QScopedPointer>
#include "kis_do_nothing_processing_visitor.h"
class QRect;
class KisCropProcessingVisitor;
class KisCropSelectionsProcessingVisitor : public KisDoNothingProcessingVisitor
{
public:
KisCropSelectionsProcessingVisitor(const QRect &rect);
- ~KisCropSelectionsProcessingVisitor();
+ ~KisCropSelectionsProcessingVisitor() override;
using KisDoNothingProcessingVisitor::visit;
- void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter);
+ void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter) override;
private:
QScopedPointer<KisCropProcessingVisitor> m_cropVisitor;
};
#endif /* __KIS_CROP_SELECTIONS_PROCESSING_VISITOR_H */
diff --git a/libs/image/processing/kis_do_nothing_processing_visitor.h b/libs/image/processing/kis_do_nothing_processing_visitor.h
index d050e1c596..3c35c84a52 100644
--- a/libs/image/processing/kis_do_nothing_processing_visitor.h
+++ b/libs/image/processing/kis_do_nothing_processing_visitor.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DO_NOTHING_PROCESSING_VISITOR_H
#define __KIS_DO_NOTHING_PROCESSING_VISITOR_H
#include "kis_processing_visitor.h"
class KRITAIMAGE_EXPORT KisDoNothingProcessingVisitor : public KisProcessingVisitor
{
public:
- ~KisDoNothingProcessingVisitor();
+ ~KisDoNothingProcessingVisitor() override;
- void visit(KisNode *node, KisUndoAdapter *undoAdapter);
- void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisColorizeMask *mask, KisUndoAdapter *undoAdapter);
+ void visit(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) override;
};
#endif /* __KIS_DO_NOTHING_PROCESSING_VISITOR_H */
diff --git a/libs/image/processing/kis_mirror_processing_visitor.h b/libs/image/processing/kis_mirror_processing_visitor.h
index b0bfe4a220..e8f294070c 100644
--- a/libs/image/processing/kis_mirror_processing_visitor.h
+++ b/libs/image/processing/kis_mirror_processing_visitor.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MIRROR_PROCESSING_VISITOR_H
#define __KIS_MIRROR_PROCESSING_VISITOR_H
#include "kis_simple_processing_visitor.h"
#include <QRect>
#include "kis_types.h"
class KRITAIMAGE_EXPORT KisMirrorProcessingVisitor : public KisSimpleProcessingVisitor
{
public:
KisMirrorProcessingVisitor(const QRect &bounds, Qt::Orientation orientation);
private:
- void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter);
- void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
+ void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
- void visitColorizeMask(KisColorizeMask *node, KisUndoAdapter *undoAdapter);
+ void visitColorizeMask(KisColorizeMask *node, KisUndoAdapter *undoAdapter) override;
private:
void transformPaintDevice(KisPaintDeviceSP device, KisUndoAdapter *undoAdapter);
QRect m_bounds;
Qt::Orientation m_orientation;
};
#endif /* __KIS_MIRROR_PROCESSING_VISITOR_H */
diff --git a/libs/image/processing/kis_simple_processing_visitor.h b/libs/image/processing/kis_simple_processing_visitor.h
index 50045f943d..dedbeec7a3 100644
--- a/libs/image/processing/kis_simple_processing_visitor.h
+++ b/libs/image/processing/kis_simple_processing_visitor.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SIMPLE_PROCESSING_VISITOR_H
#define __KIS_SIMPLE_PROCESSING_VISITOR_H
#include "kis_processing_visitor.h"
class KRITAIMAGE_EXPORT KisSimpleProcessingVisitor : public KisProcessingVisitor
{
public:
- ~KisSimpleProcessingVisitor();
+ ~KisSimpleProcessingVisitor() override;
- void visit(KisNode *node, KisUndoAdapter *undoAdapter);
- void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisColorizeMask *mask, KisUndoAdapter *undoAdapter);
+ void visit(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) override;
protected:
virtual void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter) = 0;
virtual void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) = 0;
virtual void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) = 0;
};
#endif /* __KIS_SIMPLE_PROCESSING_VISITOR_H */
diff --git a/libs/image/processing/kis_transform_processing_visitor.h b/libs/image/processing/kis_transform_processing_visitor.h
index 2fe2dffa66..e72fa64bbd 100644
--- a/libs/image/processing/kis_transform_processing_visitor.h
+++ b/libs/image/processing/kis_transform_processing_visitor.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TRANSFORM_PROCESSING_VISITOR_H
#define __KIS_TRANSFORM_PROCESSING_VISITOR_H
#include "kis_processing_visitor.h"
#include <kis_types.h>
#include <QPointF>
#include <QTransform>
class KisFilterStrategy;
class KRITAIMAGE_EXPORT KisTransformProcessingVisitor : public KisProcessingVisitor
{
public:
KisTransformProcessingVisitor(qreal xscale, qreal yscale,
qreal xshear, qreal yshear, const QPointF &shearOrigin, qreal angle,
qint32 tx, qint32 ty,
KisFilterStrategy *filter,
const QTransform &shapesCorrection = QTransform());
- void visit(KisNode *node, KisUndoAdapter *undoAdapter);
- void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter);
- void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter);
- void visit(KisColorizeMask *mask, KisUndoAdapter *undoAdapter);
+ void visit(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visit(KisPaintLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisGroupLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisAdjustmentLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisGeneratorLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisCloneLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visit(KisFilterMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisTransformMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisTransparencyMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisSelectionMask *mask, KisUndoAdapter *undoAdapter) override;
+ void visit(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) override;
private:
void transformClones(KisLayer *layer, KisUndoAdapter *undoAdapter);
void transformPaintDevice(KisPaintDeviceSP device, KisUndoAdapter *adapter, const ProgressHelper &helper);
void transformSelection(KisSelectionSP selection, KisUndoAdapter *adapter, const ProgressHelper &helper);
private:
qreal m_sx, m_sy;
qint32 m_tx, m_ty;
qreal m_shearx, m_sheary;
QPointF m_shearOrigin;
KisFilterStrategy *m_filter;
qreal m_angle;
QTransform m_shapesCorrection;
};
#endif /* __KIS_TRANSFORM_PROCESSING_VISITOR_H */
diff --git a/libs/image/recorder/kis_action_recorder.h b/libs/image/recorder/kis_action_recorder.h
index 4a12bfe709..c4fbba629f 100644
--- a/libs/image/recorder/kis_action_recorder.h
+++ b/libs/image/recorder/kis_action_recorder.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ACTION_RECORDER_H_
#define _KIS_ACTION_RECORDER_H_
#include <QObject>
#include "kritaimage_export.h"
class KisRecordedAction;
/**
* This class allows other \ref KisMacro to connect to it
* to get the action that are currently created.
*/
class KRITAIMAGE_EXPORT KisActionRecorder : public QObject
{
Q_OBJECT
public:
KisActionRecorder(QObject* parent = 0);
- ~KisActionRecorder();
+ ~KisActionRecorder() override;
public Q_SLOTS:
void addAction(const KisRecordedAction& action, const KisRecordedAction* before = 0);
Q_SIGNALS:
/**
* This signal is emitted each time an action is added to this recorder.
*/
void addedAction(const KisRecordedAction& action);
};
#endif
diff --git a/libs/image/recorder/kis_macro.h b/libs/image/recorder/kis_macro.h
index ecf5f9bb69..3f904abd4c 100644
--- a/libs/image/recorder/kis_macro.h
+++ b/libs/image/recorder/kis_macro.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MACRO_H_
#define _KIS_MACRO_H_
#include <QList>
#include <QObject>
#include <kritaimage_export.h>
#include "kis_serializable_configuration.h"
#include "kis_types.h"
class KisRecordedAction;
class KisRecordedActionLoadContext;
class KisRecordedActionSaveContext;
/**
* This is the base class for macro in Krita. It's basically a list of recorded action,KisRecordedAction
* that can be stored as XML, played, and edited.
*/
class KRITAIMAGE_EXPORT KisMacro : public QObject
{
Q_OBJECT
public:
KisMacro(QObject* parent = 0);
KisMacro(const QList<KisRecordedAction*>& _actions);
- ~KisMacro();
+ ~KisMacro() override;
public:
/**
* Append a list of actions, and make clone of them.
*/
void appendActions(const QList<KisRecordedAction*>& actions);
/**
* Remove the list of actions. Actions are deleted.
*/
void removeActions(const QList<KisRecordedAction*>& actions);
/**
* Move the action before an other one.
* @param before if null, the action is moved to the end
*/
void moveAction(const KisRecordedAction* action, const KisRecordedAction* before);
public: // serialization functions
virtual void fromXML(const QDomElement&, const KisRecordedActionLoadContext* loadContext);
virtual void toXML(QDomDocument& doc, QDomElement& e, KisRecordedActionSaveContext* saveContext) const;
const QList<KisRecordedAction*>& actions() const;
public Q_SLOTS:
/**
* add a single action, and make a clone of it.
* @param before if non null, the action will be added before that action,
* otherwise, if null, the action will be added at the end.
*/
virtual void addAction(const KisRecordedAction& action, const KisRecordedAction* before = 0);
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/image/recorder/kis_macro_player.h b/libs/image/recorder/kis_macro_player.h
index 4444fea409..c58cafc064 100644
--- a/libs/image/recorder/kis_macro_player.h
+++ b/libs/image/recorder/kis_macro_player.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MACRO_PLAYER_H_
#define _KIS_MACRO_PLAYER_H_
#include <QThread>
#include <kritaimage_export.h>
#include <kis_paint_device.h>
class KisMacro;
class KisPlayInfo;
class KoUpdater;
/**
* This class play a macro inside a thread.
*/
class KRITAIMAGE_EXPORT KisMacroPlayer : public QThread {
Q_OBJECT
public:
KisMacroPlayer(KisMacro* _macro, const KisPlayInfo& info, KoUpdater * updater = 0, QObject* _parent = 0);
- virtual ~KisMacroPlayer();
+ ~KisMacroPlayer() override;
public Q_SLOTS:
void pause();
void resume();
protected:
- virtual void run();
+ void run() override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/image/recorder/kis_recorded_action_factory_registry.h b/libs/image/recorder/kis_recorded_action_factory_registry.h
index 83cd5fdb14..b678417220 100644
--- a/libs/image/recorder/kis_recorded_action_factory_registry.h
+++ b/libs/image/recorder/kis_recorded_action_factory_registry.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_ACTION_FACTORY_REGISTRY_H_
#define _KIS_RECORDED_ACTION_FACTORY_REGISTRY_H_
#include <KoGenericRegistry.h>
class KisRecordedActionFactory;
#include <kritaimage_export.h>
class KRITAIMAGE_EXPORT KisRecordedActionFactoryRegistry : public KoGenericRegistry<KisRecordedActionFactory*>
{
public:
KisRecordedActionFactoryRegistry();
- ~KisRecordedActionFactoryRegistry();
+ ~KisRecordedActionFactoryRegistry() override;
static KisRecordedActionFactoryRegistry* instance();
};
#endif
diff --git a/libs/image/recorder/kis_recorded_fill_paint_action.h b/libs/image/recorder/kis_recorded_fill_paint_action.h
index f51475c696..4a7fd3f00d 100644
--- a/libs/image/recorder/kis_recorded_fill_paint_action.h
+++ b/libs/image/recorder/kis_recorded_fill_paint_action.h
@@ -1,65 +1,65 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_FILL_PAINT_ACTION_H_
#define _KIS_RECORDED_FILL_PAINT_ACTION_H_
#include "recorder/kis_recorded_action.h"
#include "recorder/kis_recorded_paint_action.h"
#include "kis_types.h"
#include <kritaimage_export.h>
/**
* This class will record the painting of a bezier curve.
*/
class KRITAIMAGE_EXPORT KisRecordedFillPaintAction : public KisRecordedPaintAction
{
public:
KisRecordedFillPaintAction(const KisNodeQueryPath& path, const QPoint& pt, const KisNodeQueryPath& projectionPath);
KisRecordedFillPaintAction(const KisRecordedFillPaintAction&);
- ~KisRecordedFillPaintAction();
+ ~KisRecordedFillPaintAction() override;
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
+ void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
- virtual KisRecordedAction* clone() const;
+ KisRecordedAction* clone() const override;
protected:
- virtual KisPainter* createPainter(KisPaintDeviceSP device) const;
- virtual void playPaint(const KisPlayInfo& info, KisPainter* painter) const;
+ KisPainter* createPainter(KisPaintDeviceSP device) const override;
+ void playPaint(const KisPlayInfo& info, KisPainter* painter) const override;
private:
struct Private;
Private* const d;
};
class KisRecordedFillPaintActionFactory : public KisRecordedPaintActionFactory
{
public:
KisRecordedFillPaintActionFactory();
- virtual ~KisRecordedFillPaintActionFactory();
- virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*);
+ ~KisRecordedFillPaintActionFactory() override;
+ KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
};
#endif
diff --git a/libs/image/recorder/kis_recorded_filter_action.h b/libs/image/recorder/kis_recorded_filter_action.h
index ec97cbdc80..c568117ace 100644
--- a/libs/image/recorder/kis_recorded_filter_action.h
+++ b/libs/image/recorder/kis_recorded_filter_action.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_FILTER_ACTION_H_
#define _KIS_RECORDED_FILTER_ACTION_H_
#include "recorder/kis_recorded_node_action.h"
#include <kritaimage_export.h>
class QString;
class KisFilterConfiguration;
/**
* Action representing a filter.
*/
class KRITAIMAGE_EXPORT KisRecordedFilterAction : public KisRecordedNodeAction
{
public:
/**
* @param config the filter configuration, the ownership of config remains in the caller.
*/
KisRecordedFilterAction(QString name, const KisNodeQueryPath& path, const KisFilter* filter, const KisFilterConfigurationSP config);
KisRecordedFilterAction(const KisRecordedFilterAction&);
- virtual ~KisRecordedFilterAction();
+ ~KisRecordedFilterAction() override;
using KisRecordedNodeAction::play;
- virtual void play(KisNodeSP node, const KisPlayInfo& _info, KoUpdater* _updater = 0) const;
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
- virtual KisRecordedAction* clone() const;
+ void play(KisNodeSP node, const KisPlayInfo& _info, KoUpdater* _updater = 0) const override;
+ void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
+ KisRecordedAction* clone() const override;
const KisFilter* filter() const;
const KisFilterConfigurationSP filterConfiguration() const;
/**
* Set the configuration, and takes the ownership of the config object.
*/
void setFilterConfiguration(KisFilterConfigurationSP config);
private:
struct Private;
Private* const d;
};
class KisRecordedFilterActionFactory : public KisRecordedActionFactory
{
public:
KisRecordedFilterActionFactory();
- virtual ~KisRecordedFilterActionFactory();
- virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*);
+ ~KisRecordedFilterActionFactory() override;
+ KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
};
#endif
diff --git a/libs/image/recorder/kis_recorded_node_action.h b/libs/image/recorder/kis_recorded_node_action.h
index 203c4ee086..e9a4884b0d 100644
--- a/libs/image/recorder/kis_recorded_node_action.h
+++ b/libs/image/recorder/kis_recorded_node_action.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_NODE_ACTION_H_
#define _KIS_RECORDED_NODE_ACTION_H_
#include "kis_recorded_action.h"
class KisNodeQueryPath;
/**
* Used for action that applys on nodes that are
*/
class KRITAIMAGE_EXPORT KisRecordedNodeAction : public KisRecordedAction
{
public:
KisRecordedNodeAction(const QString& id, const QString& name, const KisNodeQueryPath& path);
KisRecordedNodeAction(const KisRecordedNodeAction& _rhs);
- virtual ~KisRecordedNodeAction();
+ ~KisRecordedNodeAction() override;
/**
* Play the action on one node
*/
virtual void play(KisNodeSP node, const KisPlayInfo&, KoUpdater* _updater) const = 0;
/**
* Play the action on all the nodes returned by the nodeQueryPath
*/
- virtual void play(const KisPlayInfo& _info, KoUpdater* _updater) const;
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
+ void play(const KisPlayInfo& _info, KoUpdater* _updater) const override;
+ void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
public:
const KisNodeQueryPath& nodeQueryPath() const;
void setNodeQueryPath(const KisNodeQueryPath&);
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/image/recorder/kis_recorded_paint_action.h b/libs/image/recorder/kis_recorded_paint_action.h
index 6c726f95f0..68b33119bb 100644
--- a/libs/image/recorder/kis_recorded_paint_action.h
+++ b/libs/image/recorder/kis_recorded_paint_action.h
@@ -1,110 +1,110 @@
/*
* Copyright (c) 2007,2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_PAINT_ACTION_H_
#define _KIS_RECORDED_PAINT_ACTION_H_
#include "recorder/kis_recorded_node_action.h"
#include "kis_types.h"
#include "kis_painter.h"
class KisPainter;
class KoColor;
#include <kritaimage_export.h>
/**
* Base class for paint action.
*/
class KRITAIMAGE_EXPORT KisRecordedPaintAction : public KisRecordedNodeAction
{
public:
KisRecordedPaintAction(const QString & id,
const QString & name,
const KisNodeQueryPath& path,
KisPaintOpPresetSP paintOpPreset);
KisRecordedPaintAction(const KisRecordedPaintAction&);
- ~KisRecordedPaintAction();
+ ~KisRecordedPaintAction() override;
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
+ void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
using KisRecordedNodeAction::play;
- virtual void play(KisNodeSP node, const KisPlayInfo& info, KoUpdater* _updater = 0) const;
+ void play(KisNodeSP node, const KisPlayInfo& info, KoUpdater* _updater = 0) const override;
protected:
/**
* This function will create a painter for the given device. The default
* implementation creates a KisPainter, subclass can reimplement it if
* they want to use one of the subclass of KisPainter.
*/
virtual KisPainter* createPainter(KisPaintDeviceSP device) const;
/**
* Reimplement this function in a subclass to play the painting.
*/
virtual void playPaint(const KisPlayInfo&, KisPainter* painter) const = 0;
public:
KisPaintOpPresetSP paintOpPreset() const;
void setPaintOpPreset(KisPaintOpPresetSP preset);
/**
* @return the opacity in the range 0.0->1.0
*/
qreal opacity() const;
void setOpacity(qreal );
KoColor paintColor() const;
void setPaintColor(const KoColor& color);
KoColor backgroundColor() const;
void setBackgroundColor(const KoColor& color);
QString compositeOp();
void setCompositeOp(const QString& );
void setPaintIncremental(bool );
void setStrokeStyle(KisPainter::StrokeStyle );
void setFillStyle(KisPainter::FillStyle );
KisPainter::FillStyle fillStyle() const;
void setPattern(const KoPattern* );
void setGradient(const KoAbstractGradient* gradient);
void setGenerator(const KisFilterConfigurationSP generator);
private:
struct Private;
Private* const d;
};
class KisRecordedPaintActionFactory : public KisRecordedActionFactory
{
public:
KisRecordedPaintActionFactory(const QString & id) : KisRecordedActionFactory(id) {}
- virtual ~KisRecordedPaintActionFactory() {}
+ ~KisRecordedPaintActionFactory() override {}
protected:
void setupPaintAction(KisRecordedPaintAction* action, const QDomElement& elt, const KisRecordedActionLoadContext*);
KisPaintOpPresetSP paintOpPresetFromXML(const QDomElement& elt);
KoColor paintColorFromXML(const QDomElement& elt);
KoColor backgroundColorFromXML(const QDomElement& elt);
KoColor colorFromXML(const QDomElement& elt, const QString& elementName);
qreal opacityFromXML(const QDomElement& elt);
bool paintIncrementalFromXML(const QDomElement& elt);
QString compositeOpFromXML(const QDomElement& elt);
KisNodeQueryPath nodeQueryPathFromXML(const QDomElement& elt);
};
#endif
diff --git a/libs/image/recorder/kis_recorded_path_paint_action.h b/libs/image/recorder/kis_recorded_path_paint_action.h
index 0194c36b3a..94172cf8aa 100644
--- a/libs/image/recorder/kis_recorded_path_paint_action.h
+++ b/libs/image/recorder/kis_recorded_path_paint_action.h
@@ -1,77 +1,77 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_PATH_PAINT_ACTIONS_H_
#define _KIS_RECORDED_PATH_PAINT_ACTIONS_H_
#include "recorder/kis_recorded_action.h"
#include "recorder/kis_recorded_paint_action.h"
#include "kis_types.h"
class KisPaintInformation;
class KisPainter;
#include <kritaimage_export.h>
/**
* This class will record the painting of a bezier curve.
*/
class KRITAIMAGE_EXPORT KisRecordedPathPaintAction : public KisRecordedPaintAction
{
public:
KisRecordedPathPaintAction(const KisNodeQueryPath& path,
const KisPaintOpPresetSP paintOpPreset);
KisRecordedPathPaintAction(const KisRecordedPathPaintAction&);
- ~KisRecordedPathPaintAction();
+ ~KisRecordedPathPaintAction() override;
void addPoint(const KisPaintInformation& info);
void addLine(const KisPaintInformation& point1, const KisPaintInformation& point2);
void addPolyLine(const QList<QPointF>& points);
void addCurve(const KisPaintInformation& point1,
const QPointF& control1,
const QPointF& control2,
const KisPaintInformation& point2);
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
+ void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
- virtual KisRecordedAction* clone() const;
+ KisRecordedAction* clone() const override;
protected:
- virtual void playPaint(const KisPlayInfo& info, KisPainter* painter) const;
+ void playPaint(const KisPlayInfo& info, KisPainter* painter) const override;
private:
struct Private;
Private* const d;
};
class KisRecordedPathPaintActionFactory : public KisRecordedPaintActionFactory
{
public:
KisRecordedPathPaintActionFactory();
- virtual ~KisRecordedPathPaintActionFactory();
- virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*);
+ ~KisRecordedPathPaintActionFactory() override;
+ KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
};
#endif
diff --git a/libs/image/recorder/kis_recorded_shape_paint_action.h b/libs/image/recorder/kis_recorded_shape_paint_action.h
index af776557c1..cc190ed8d0 100644
--- a/libs/image/recorder/kis_recorded_shape_paint_action.h
+++ b/libs/image/recorder/kis_recorded_shape_paint_action.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_ELLIPSE_PAINT_ACTION_H_
#define _KIS_RECORDED_ELLIPSE_PAINT_ACTION_H_
#include "recorder/kis_recorded_action.h"
#include "recorder/kis_recorded_paint_action.h"
#include "kis_types.h"
#include <kritaimage_export.h>
/**
* This class will record the painting of a bezier curve.
*/
class KRITAIMAGE_EXPORT KisRecordedShapePaintAction : public KisRecordedPaintAction
{
public:
enum Shape {
Ellipse,
Rectangle
};
public:
KisRecordedShapePaintAction(const KisNodeQueryPath& path,
const KisPaintOpPresetSP paintOpPreset,
Shape shape,
const QRectF& rect);
KisRecordedShapePaintAction(const KisRecordedShapePaintAction&);
- ~KisRecordedShapePaintAction();
+ ~KisRecordedShapePaintAction() override;
- virtual void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const;
+ void toXML(QDomDocument& doc, QDomElement& elt, KisRecordedActionSaveContext* ) const override;
- virtual KisRecordedAction* clone() const;
+ KisRecordedAction* clone() const override;
protected:
- virtual void playPaint(const KisPlayInfo& info, KisPainter* painter) const;
+ void playPaint(const KisPlayInfo& info, KisPainter* painter) const override;
private:
struct Private;
Private* const d;
};
class KisRecordedShapePaintActionFactory : public KisRecordedPaintActionFactory
{
public:
KisRecordedShapePaintActionFactory();
- virtual ~KisRecordedShapePaintActionFactory();
- virtual KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*);
+ ~KisRecordedShapePaintActionFactory() override;
+ KisRecordedAction* fromXML(const QDomElement& elt, const KisRecordedActionLoadContext*) override;
};
#endif
diff --git a/libs/image/tests/kimageframe.h b/libs/image/tests/kimageframe.h
index 1453e85eaf..8b5656227a 100644
--- a/libs/image/tests/kimageframe.h
+++ b/libs/image/tests/kimageframe.h
@@ -1,42 +1,42 @@
/*
* Copyright 2009 Matthew Woehlke <mw_triad@users.sourceforge.net>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KIMAGEFRAME_H
#define KIMAGEFRAME_H
#include <QFrame>
class KImageFrame : public QFrame
{
Q_OBJECT
public:
KImageFrame(QWidget* parent = 0);
- virtual ~KImageFrame() {}
+ ~KImageFrame() override {}
public Q_SLOTS:
void setImage(const QImage&);
protected Q_SLOTS:
- void paintEvent(QPaintEvent*);
+ void paintEvent(QPaintEvent*) override;
protected:
QImage _image;
int _w, _h;
};
#endif
// kate: hl C++; indent-width 4; replace-tabs on;
diff --git a/libs/image/tests/kis_count_visitor_test.h b/libs/image/tests/kis_count_visitor_test.h
index 8dd4e9e874..0dbc6331e5 100644
--- a/libs/image/tests/kis_count_visitor_test.h
+++ b/libs/image/tests/kis_count_visitor_test.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COUNT_VISITOR_TESTER_H
#define KIS_COUNT_VISITOR_TESTER_H
#include <QtTest>
#include "kis_node.h"
#include <sdk/tests/testing_nodes.h>
class RootNode : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new RootNode(*this);
}
};
class TestNodeA : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeA(*this);
}
};
class TestNodeB : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeB(*this);
}
};
class TestNodeC : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeC(*this);
}
};
class KisCountVisitorTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCounting();
};
#endif
diff --git a/libs/image/tests/kis_layer_test.h b/libs/image/tests/kis_layer_test.h
index c27eb577bf..a320cb05b6 100644
--- a/libs/image/tests/kis_layer_test.h
+++ b/libs/image/tests/kis_layer_test.h
@@ -1,114 +1,114 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LAYER_TESTER_H
#define KIS_LAYER_TESTER_H
#include <QtTest>
#include "kis_layer.h"
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kis_image.h"
class TestLayer : public KisLayer
{
Q_OBJECT
public:
TestLayer(KisImageWSP image, const QString & name, quint8 opacity)
: KisLayer(image, name, opacity) {
}
KisNodeSP clone() {
return new TestLayer(*this);
}
- bool allowAsChild(KisNodeSP) const {
+ bool allowAsChild(KisNodeSP) const override {
return true;
}
virtual QString nodeType() {
return "TEST";
}
- KisPaintDeviceSP original() const {
+ KisPaintDeviceSP original() const override {
// This test doesn't use updateProjection so just return 0
return 0;
}
- KisPaintDeviceSP paintDevice() const {
+ KisPaintDeviceSP paintDevice() const override {
return 0;
}
- QIcon icon() const {
+ QIcon icon() const override {
return QIcon();
}
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestLayer(image(), name(), opacity());
}
- qint32 x() const {
+ qint32 x() const override {
return 0;
}
- void setX(qint32) {
+ void setX(qint32) override {
}
- qint32 y() const {
+ qint32 y() const override {
return 0;
}
- void setY(qint32) {
+ void setY(qint32) override {
}
- QRect extent() const {
+ QRect extent() const override {
return QRect();
}
- QRect exactBounds() const {
+ QRect exactBounds() const override {
return QRect();
}
using KisLayer::accept;
- bool accept(KisNodeVisitor& v) {
+ bool accept(KisNodeVisitor& v) override {
return v.visit(this);
}
};
class KisLayerTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCreation();
void testOrdering();
void testMoveNode();
void testMoveLayer();
void testMasksChangeRect();
void testMoveLayerWithMaskThreaded();
};
#endif
diff --git a/libs/image/tests/kis_node_facade_test.h b/libs/image/tests/kis_node_facade_test.h
index 02008fefdb..55008ba770 100644
--- a/libs/image/tests/kis_node_facade_test.h
+++ b/libs/image/tests/kis_node_facade_test.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_FACADE_TESTER_H
#define KIS_NODE_FACADE_TESTER_H
#include <QtTest>
#include "kis_node.h"
#include <sdk/tests/testing_nodes.h>
class TestNodeA : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeA(*this);
}
};
class KisNodeFacadeTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCreation();
void testOrdering();
void testMove();
};
#endif
diff --git a/libs/image/tests/kis_node_graph_listener_test.h b/libs/image/tests/kis_node_graph_listener_test.h
index 3c6c9f1e6a..0bdaf961f9 100644
--- a/libs/image/tests/kis_node_graph_listener_test.h
+++ b/libs/image/tests/kis_node_graph_listener_test.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2007 Boudewijn Rempt boud@valdyas.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_GRAPH_LISTENER_TEST_H
#define KIS_NODE_GRAPH_LISTENER_TEST_H
#include <QtTest>
#include "kis_node.h"
#include <sdk/tests/testing_nodes.h>
class TestNode : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNode(*this);
}
};
class KisNodeGraphListenerTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testUpdateOfListener();
void testRecursiveUpdateOfListener();
void testSequenceNumber();
};
#endif
diff --git a/libs/image/tests/kis_node_test.h b/libs/image/tests/kis_node_test.h
index ec49263513..e1dc9633e6 100644
--- a/libs/image/tests/kis_node_test.h
+++ b/libs/image/tests/kis_node_test.h
@@ -1,100 +1,100 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_TESTER_H
#define KIS_NODE_TESTER_H
#include <QtTest>
#include "kis_node.h"
#include <sdk/tests/testing_nodes.h>
class TestNode : public TestUtil::DefaultNode
{
Q_OBJECT
public:
KisNodeSP clone() {
return new TestNode(*this);
}
using KisNode::setDirty;
- void setDirty() {
+ void setDirty() override {
KisNode::setDirty(QRect(-1000, -1000, 2000, 200));
}
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNode(*this);
}
};
class TestNodeA : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeA(*this);
}
};
class TestNodeB : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeB(*this);
}
};
class TestNodeC : public TestUtil::DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestNodeC(*this);
}
};
class KisNodeTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testCreation();
void testOrdering();
void testSetDirty();
void testChildNodes();
void testDirtyRegion();
void propertiesStressTest();
void graphStressTest();
private:
class VisibilityKiller;
class GraphKiller;
template <class KillerClass>
void propertiesStressTestImpl();
};
#endif
diff --git a/libs/image/tests/kis_random_generator_demo.h b/libs/image/tests/kis_random_generator_demo.h
index 5be20f91a2..a5403fc16a 100644
--- a/libs/image/tests/kis_random_generator_demo.h
+++ b/libs/image/tests/kis_random_generator_demo.h
@@ -1,56 +1,56 @@
/*
* Copyright 2009 Matthew Woehlke <mw_triad@users.sourceforge.net>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KIS_RANDOM_GENERATOR_DEMO_H
#define KIS_RANDOM_GENERATOR_DEMO_H
#include "ui_kis_random_generator_demo.h"
class Noise {
public:
Noise(int wx, int wy);
virtual ~Noise();
void update(quint64 seed, int shift, int cutoff, bool chR, bool chG, bool chB);
QImage image() const;
QImage histogram() const;
quint64 min() const;
quint64 max() const;
quint64 mean() const;
private:
int _wx, _wy;
QImage _image, _hist;
quint64 _min, _max, _sum;
};
class KisRandomGeneratorDemo: public QWidget, Ui::NoiseDemoUi
{
Q_OBJECT
public:
KisRandomGeneratorDemo(QWidget* parent = 0);
- virtual ~KisRandomGeneratorDemo();
+ ~KisRandomGeneratorDemo() override;
public Q_SLOTS:
void updateNoise();
private:
bool _noUpdate;
};
#endif
// kate: hl C++; indent-width 4; replace-tabs on;
diff --git a/libs/image/tests/kis_strokes_queue_test.cpp b/libs/image/tests/kis_strokes_queue_test.cpp
index 8e16067f26..8960b80206 100644
--- a/libs/image/tests/kis_strokes_queue_test.cpp
+++ b/libs/image/tests/kis_strokes_queue_test.cpp
@@ -1,647 +1,647 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_strokes_queue_test.h"
#include <QTest>
#include "scheduler_utils.h"
#include "kis_strokes_queue.h"
#include "kis_updater_context.h"
#include "kis_update_job_item.h"
#include "kis_merge_walker.h"
void KisStrokesQueueTest::testSequentialJobs()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("tri_", false));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id);
KisTestableUpdaterContext context(2);
QVector<KisUpdateJobItem*> jobs;
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_init");
VERIFY_EMPTY(jobs[1]);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_dab");
COMPARE_NAME(jobs[1], "tri_dab");
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_dab");
VERIFY_EMPTY(jobs[1]);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_finish");
VERIFY_EMPTY(jobs[1]);
}
void KisStrokesQueueTest::testConcurrentSequentialBarrier()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("tri_", false));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id);
// make the number of threads higher
KisTestableUpdaterContext context(3);
QVector<KisUpdateJobItem*> jobs;
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_init");
VERIFY_EMPTY(jobs[1]);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_dab");
COMPARE_NAME(jobs[1], "tri_dab");
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "tri_finish");
VERIFY_EMPTY(jobs[1]);
}
void KisStrokesQueueTest::testExclusiveStrokes()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("excl_", true));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id);
// well, this walker is not initialized... but who cares?
KisBaseRectsWalkerSP walker = new KisMergeWalker(QRect());
KisTestableUpdaterContext context(2);
QVector<KisUpdateJobItem*> jobs;
context.addMergeJob(walker);
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_WALKER(jobs[0], walker);
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), true);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "excl_init");
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), true);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "excl_dab");
COMPARE_NAME(jobs[1], "excl_dab");
QCOMPARE(queue.needsExclusiveAccess(), true);
context.clear();
context.addMergeJob(walker);
queue.processQueue(context, false);
COMPARE_WALKER(jobs[0], walker);
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), true);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "excl_dab");
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), true);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "excl_finish");
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), true);
context.clear();
queue.processQueue(context, false);
QCOMPARE(queue.needsExclusiveAccess(), false);
}
void KisStrokesQueueTest::testBarrierStrokeJobs()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("nor_", false));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::BARRIER));
queue.addJob(id, new KisStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id);
// yes, this walker is not initialized again... but who cares?
KisBaseRectsWalkerSP walker = new KisMergeWalker(QRect());
bool externalJobsPending = false;
KisTestableUpdaterContext context(3);
QVector<KisUpdateJobItem*> jobs;
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_init");
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
context.clear();
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_dab");
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
// Now some updates has come...
context.addMergeJob(walker);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_dab");
COMPARE_WALKER(jobs[1], walker);
VERIFY_EMPTY(jobs[2]);
// No difference for the queue
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_dab");
COMPARE_WALKER(jobs[1], walker);
VERIFY_EMPTY(jobs[2]);
// Even more updates has come...
externalJobsPending = true;
// Still no difference for the queue
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_dab");
COMPARE_WALKER(jobs[1], walker);
VERIFY_EMPTY(jobs[2]);
// Now clear the context
context.clear();
// And still no difference for the queue
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
VERIFY_EMPTY(jobs[0]);
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
// Process the last update...
context.addMergeJob(walker);
externalJobsPending = false;
// Yep, the queue is still waiting
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_WALKER(jobs[0], walker);
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
context.clear();
// Finally, we can do our work. Barrier job is executed alone
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_dab");
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
// Barrier job has finished
context.clear();
jobs = context.getJobs();
VERIFY_EMPTY(jobs[0]);
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
// fetch the last (concurrent) one
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_dab");
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
context.clear();
// finish the stroke
queue.processQueue(context, externalJobsPending);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "nor_finish");
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
context.clear();
}
void KisStrokesQueueTest::testStrokesOverlapping()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("1_", false, true));
queue.addJob(id, 0);
// comment out this line to catch an assert
queue.endStroke(id);
id = queue.startStroke(new KisTestingStrokeStrategy("2_", false, true));
queue.addJob(id, 0);
queue.endStroke(id);
// uncomment this line to catch an assert
// queue.addJob(id, 0);
KisTestableUpdaterContext context(2);
QVector<KisUpdateJobItem*> jobs;
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "1_dab");
VERIFY_EMPTY(jobs[1]);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "2_dab");
VERIFY_EMPTY(jobs[1]);
}
void KisStrokesQueueTest::testImmediateCancel()
{
KisStrokesQueue queue;
KisTestableUpdaterContext context(2);
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("1_", false, false));
queue.cancelStroke(id);
// this should not crash
queue.processQueue(context, false);
}
void KisStrokesQueueTest::testOpenedStrokeCounter()
{
KisStrokesQueue queue;
QVERIFY(!queue.hasOpenedStrokes());
KisStrokeId id0 = queue.startStroke(new KisTestingStrokeStrategy("0"));
QVERIFY(queue.hasOpenedStrokes());
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("1"));
QVERIFY(queue.hasOpenedStrokes());
queue.endStroke(id0);
QVERIFY(queue.hasOpenedStrokes());
queue.endStroke(id1);
QVERIFY(!queue.hasOpenedStrokes());
KisTestableUpdaterContext context(2);
queue.processQueue(context, false); context.clear();
queue.processQueue(context, false); context.clear();
queue.processQueue(context, false); context.clear();
queue.processQueue(context, false); context.clear();
}
void KisStrokesQueueTest::testAsyncCancelWhileOpenedStroke()
{
KisStrokesQueue queue;
KisStrokeId id = queue.startStroke(new KisTestingStrokeStrategy("nor_", false));
queue.addJob(id, 0);
queue.addJob(id, 0);
queue.addJob(id, 0);
// no async cancelling until the stroke is ended by the owner
QVERIFY(!queue.tryCancelCurrentStrokeAsync());
queue.endStroke(id);
QVERIFY(queue.tryCancelCurrentStrokeAsync());
bool externalJobsPending = false;
KisTestableUpdaterContext context(3);
QVector<KisUpdateJobItem*> jobs;
queue.processQueue(context, externalJobsPending);
// no? really?
jobs = context.getJobs();
VERIFY_EMPTY(jobs[0]);
VERIFY_EMPTY(jobs[1]);
VERIFY_EMPTY(jobs[2]);
}
struct KisStrokesQueueTest::LodStrokesQueueTester {
LodStrokesQueueTester(bool real = false)
: fakeContext(2),
realContext(2),
context(!real ? fakeContext : realContext)
{
queue.setSuspendUpdatesStrokeStrategyFactory(
[]() {
return KisSuspendResumePair(
new KisTestingStrokeStrategy("susp_u_", false, true, true),
QList<KisStrokeJobData*>());
});
queue.setResumeUpdatesStrokeStrategyFactory(
[]() {
return KisSuspendResumePair(
new KisTestingStrokeStrategy("resu_u_", false, true, true),
QList<KisStrokeJobData*>());
});
queue.setLod0ToNStrokeStrategyFactory(
[](bool forgettable) {
Q_UNUSED(forgettable);
return KisSuspendResumePair(
new KisTestingStrokeStrategy("sync_u_", false, true, true),
QList<KisStrokeJobData*>());
});
}
KisStrokesQueue queue;
KisTestableUpdaterContext fakeContext;
KisUpdaterContext realContext;
KisUpdaterContext &context;
QVector<KisUpdateJobItem*> jobs;
void processQueueNoAdd() {
if (&context != &fakeContext) return;
fakeContext.clear();
jobs = fakeContext.getJobs();
VERIFY_EMPTY(jobs[0]);
VERIFY_EMPTY(jobs[1]);
}
void processQueue() {
processQueueNoAdd();
queue.processQueue(context, false);
if (&context == &realContext) {
context.waitForDone();
}
}
void checkOnlyJob(const QString &name) {
KIS_ASSERT(&context == &fakeContext);
jobs = fakeContext.getJobs();
COMPARE_NAME(jobs[0], name);
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), false);
}
void checkOnlyExecutedJob(const QString &name) {
realContext.waitForDone();
QVERIFY(!globalExecutedDabs.isEmpty());
QCOMPARE(globalExecutedDabs[0], name);
QCOMPARE(globalExecutedDabs.size(), 1);
globalExecutedDabs.clear();
}
};
void KisStrokesQueueTest::testStrokesLevelOfDetail()
{
LodStrokesQueueTester t;
KisStrokesQueue &queue = t.queue;
// create a stroke with LOD0 + LOD2
queue.setDesiredLevelOfDetail(2);
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy("lod_", false, true));
queue.addJob(id2, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id2);
// create a update with LOD == 0 (default one)
// well, this walker is not initialized... but who cares?
KisBaseRectsWalkerSP walker = new KisMergeWalker(QRect());
KisTestableUpdaterContext context(2);
QVector<KisUpdateJobItem*> jobs;
context.addMergeJob(walker);
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_WALKER(jobs[0], walker);
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), false);
context.clear();
jobs = context.getJobs();
VERIFY_EMPTY(jobs[0]);
VERIFY_EMPTY(jobs[1]);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "clone2_lod_dab");
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), false);
// walker of a different LOD must not be allowed
QCOMPARE(context.isJobAllowed(walker), false);
context.clear();
context.addMergeJob(walker);
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_WALKER(jobs[0], walker);
COMPARE_NAME(jobs[1], "susp_u_init");
QCOMPARE(queue.needsExclusiveAccess(), false);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "lod_dab");
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), false);
context.clear();
queue.processQueue(context, false);
jobs = context.getJobs();
COMPARE_NAME(jobs[0], "resu_u_init");
VERIFY_EMPTY(jobs[1]);
QCOMPARE(queue.needsExclusiveAccess(), false);
context.clear();
}
#include <kundo2command.h>
#include <kis_post_execution_undo_adapter.h>
struct TestUndoCommand : public KUndo2Command
{
TestUndoCommand(const QString &text) : KUndo2Command(kundo2_noi18n(text)) {}
- void undo() {
+ void undo() override {
ENTER_FUNCTION();
undoCount++;
}
- void redo() {
+ void redo() override {
ENTER_FUNCTION();
redoCount++;
}
int undoCount = 0;
int redoCount = 0;
};
void KisStrokesQueueTest::testLodUndoBase()
{
LodStrokesQueueTester t;
KisStrokesQueue &queue = t.queue;
// create a stroke with LOD0 + LOD2
queue.setDesiredLevelOfDetail(2);
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("str1_", false, true));
queue.addJob(id1, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id1);
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy("str2_", false, true));
queue.addJob(id2, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id2);
t.processQueue();
t.checkOnlyJob("clone2_str1_dab");
QSharedPointer<TestUndoCommand> undoStr1(new TestUndoCommand("str1_undo"));
queue.lodNPostExecutionUndoAdapter()->addCommand(undoStr1);
t.processQueue();
t.checkOnlyJob("clone2_str2_dab");
QSharedPointer<TestUndoCommand> undoStr2(new TestUndoCommand("str2_undo"));
queue.lodNPostExecutionUndoAdapter()->addCommand(undoStr2);
t.processQueue();
t.checkOnlyJob("susp_u_init");
t.processQueue();
t.checkOnlyJob("str1_dab");
t.processQueue();
t.checkOnlyJob("str2_dab");
t.processQueue();
t.checkOnlyJob("resu_u_init");
}
void KisStrokesQueueTest::testLodUndoBase2()
{
LodStrokesQueueTester t(true);
KisStrokesQueue &queue = t.queue;
// create a stroke with LOD0 + LOD2
queue.setDesiredLevelOfDetail(2);
KisStrokeId id1 = queue.startStroke(new KisTestingStrokeStrategy("str1_", false, true, false, true));
queue.addJob(id1, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id1);
KisStrokeId id2 = queue.startStroke(new KisTestingStrokeStrategy("str2_", false, true, false, true));
queue.addJob(id2, new KisTestingStrokeJobData(KisStrokeJobData::CONCURRENT));
queue.endStroke(id2);
t.processQueue();
t.checkOnlyExecutedJob("sync_u_init");
t.processQueue();
t.checkOnlyExecutedJob("clone2_str1_dab");
QSharedPointer<TestUndoCommand> undoStr1(new TestUndoCommand("str1_undo"));
queue.lodNPostExecutionUndoAdapter()->addCommand(undoStr1);
t.processQueue();
t.checkOnlyExecutedJob("clone2_str2_dab");
QSharedPointer<TestUndoCommand> undoStr2(new TestUndoCommand("str2_undo"));
queue.lodNPostExecutionUndoAdapter()->addCommand(undoStr2);
t.processQueue();
t.checkOnlyExecutedJob("susp_u_init");
queue.tryUndoLastStrokeAsync();
t.processQueue();
while (queue.currentStrokeName() == kundo2_noi18n("str2_undo")) {
//queue.debugPrintStrokes();
t.processQueue();
}
QCOMPARE(undoStr2->undoCount, 1);
t.checkOnlyExecutedJob("str1_dab");
t.processQueue();
t.checkOnlyExecutedJob("str2_cancel");
t.processQueue();
t.checkOnlyExecutedJob("resu_u_init");
}
QTEST_MAIN(KisStrokesQueueTest)
diff --git a/libs/image/tests/kis_walkers_test.h b/libs/image/tests/kis_walkers_test.h
index cee99f180a..5832b315bd 100644
--- a/libs/image/tests/kis_walkers_test.h
+++ b/libs/image/tests/kis_walkers_test.h
@@ -1,268 +1,268 @@
/*
* Copyright (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WALKERS_TEST_H
#define KIS_WALKERS_TEST_H
#include <QtTest>
#include "kis_image.h"
#include "kis_layer.h"
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kis_default_bounds.h"
#include "kis_paint_device.h"
#include "kis_merge_walker.h"
#include "kis_image.h"
class TestLayer : public KisLayer
{
Q_OBJECT
public:
TestLayer(KisImageWSP image, const QString & name, quint8 opacity)
: KisLayer(image, name, opacity) {
}
KisNodeSP clone() {
return new TestLayer(*this);
}
- bool allowAsChild(KisNodeSP) const {
+ bool allowAsChild(KisNodeSP) const override {
return true;
}
virtual QString nodeType() {
return "TEST";
}
- KisPaintDeviceSP original() const {
+ KisPaintDeviceSP original() const override {
// This test doesn't use updateProjection so just return 0
return 0;
}
- KisPaintDeviceSP paintDevice() const {
+ KisPaintDeviceSP paintDevice() const override {
return 0;
}
- QIcon icon() const {
+ QIcon icon() const override {
return QIcon();
}
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new TestLayer(image(), name(), opacity());
}
- qint32 x() const {
+ qint32 x() const override {
return 0;
}
- void setX(qint32) {
+ void setX(qint32) override {
}
- qint32 y() const {
+ qint32 y() const override {
return 0;
}
- void setY(qint32) {
+ void setY(qint32) override {
}
- QRect extent() const {
+ QRect extent() const override {
return QRect();
}
- QRect exactBounds() const {
+ QRect exactBounds() const override {
return QRect();
}
using KisLayer::accept;
- bool accept(KisNodeVisitor& v) {
+ bool accept(KisNodeVisitor& v) override {
return v.visit(this);
}
};
class ComplexRectsLayer : public KisLayer
{
Q_OBJECT
public:
ComplexRectsLayer(KisImageWSP image, const QString & name, quint8 opacity)
: KisLayer(image, name, opacity) {
m_device = new KisPaintDevice(this, image->colorSpace(), new KisDefaultBounds(image), "test device");
}
KisNodeSP clone() {
return new ComplexRectsLayer(*this);
}
- bool allowAsChild(KisNodeSP) const {
+ bool allowAsChild(KisNodeSP) const override {
return true;
}
virtual QString nodeType() {
return "TEST";
}
- KisPaintDeviceSP original() const {
+ KisPaintDeviceSP original() const override {
return m_device;
}
- KisPaintDeviceSP paintDevice() const {
+ KisPaintDeviceSP paintDevice() const override {
return m_device;
}
- QIcon icon() const {
+ QIcon icon() const override {
return QIcon();
}
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return new ComplexRectsLayer(image(), name(), opacity());
}
- qint32 x() const {
+ qint32 x() const override {
return 0;
}
- void setX(qint32) {
+ void setX(qint32) override {
}
- qint32 y() const {
+ qint32 y() const override {
return 0;
}
- void setY(qint32) {
+ void setY(qint32) override {
}
- QRect extent() const {
+ QRect extent() const override {
return QRect();
}
- QRect exactBounds() const {
+ QRect exactBounds() const override {
return QRect();
}
using KisLayer::accept;
- bool accept(KisNodeVisitor& v) {
+ bool accept(KisNodeVisitor& v) override {
return v.visit(this);
}
- QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const {
+ QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override {
Q_UNUSED(pos);
const qint32 delta = 3;
return rect.adjusted(-delta, -delta, delta, delta);
}
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const {
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override {
Q_UNUSED(pos);
const qint32 delta = 7;
return rect.adjusted(-delta, -delta, delta, delta);
}
private:
KisPaintDeviceSP m_device;
};
class CacheLayer : public ComplexRectsLayer
{
Q_OBJECT
public:
CacheLayer(KisImageWSP image, const QString & name, quint8 opacity)
: ComplexRectsLayer(image, name, opacity) {
}
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const {
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override {
QRect retval;
if(pos != KisNode::N_BELOW_FILTHY && pos != N_FILTHY_PROJECTION) {
const qint32 delta = 7;
retval = rect.adjusted(-delta, -delta, delta, delta);
}
return retval;
}
};
class ComplexAccessLayer : public ComplexRectsLayer
{
Q_OBJECT
public:
ComplexAccessLayer(KisImageWSP image, const QString & name, quint8 opacity)
: ComplexRectsLayer(image, name, opacity) {
}
- QRect accessRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const {
+ QRect accessRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override {
Q_UNUSED(pos);
const qint32 delta = 70;
return rect.translated(delta, 0);
}
- QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const {
+ QRect needRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override {
Q_UNUSED(pos);
return rect;
}
- QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const {
+ QRect changeRect(const QRect &rect, PositionToFilthy pos = N_FILTHY) const override {
Q_UNUSED(pos);
return rect;
}
};
class KisBaseRectsWalker;
class KisWalkersTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testUsualVisiting();
void testVisitingWithTopmostMask();
void testMergeVisiting();
void testComplexAccessVisiting();
void testCloneNotificationsVisiting();
void testRefreshSubtreeVisiting();
void testFullRefreshVisiting();
void testCachedVisiting();
void testMasksVisiting();
void testMasksVisitingNoFilthy();
void testMasksOverlapping();
void testRectsChecksum();
void testGraphStructureChecksum();
private:
void verifyResult(KisBaseRectsWalker &walker, QStringList reference,
QRect accessRect, bool changeRectVaries,
bool needRectVaries);
void verifyResult(KisBaseRectsWalker &walker, struct UpdateTestJob &job);
void checkNotification(const KisMergeWalker::CloneNotification &notification,
const QString &name,
const QRect &rect);
};
#endif
diff --git a/libs/image/tests/scheduler_utils.h b/libs/image/tests/scheduler_utils.h
index c374269599..13ff5be0e3 100644
--- a/libs/image/tests/scheduler_utils.h
+++ b/libs/image/tests/scheduler_utils.h
@@ -1,231 +1,231 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __SCHEDULER_UTILS_H
#define __SCHEDULER_UTILS_H
#include <QRect>
#include "kis_merge_walker.h"
#include "kis_stroke_strategy.h"
#include "kis_stroke_job.h"
#include "kis_spontaneous_job.h"
#include "kis_stroke.h"
#include "kis_image.h"
#define SCOMPARE(s1, s2) QCOMPARE(QString(s1), QString(s2))
#define COMPARE_WALKER(item, walker) \
QCOMPARE(item->walker(), walker)
#define COMPARE_NAME(item, name) \
QCOMPARE(getJobName(item->strokeJob()), QString(name))
#define VERIFY_EMPTY(item) \
QVERIFY(!item->isRunning())
void executeStrokeJobs(KisStroke *stroke) {
KisStrokeJob *job;
while((job = stroke->popOneJob())) {
job->run();
delete job;
}
}
bool checkWalker(KisBaseRectsWalkerSP walker, const QRect &rect, int lod = 0) {
if(walker->requestedRect() == rect && walker->levelOfDetail() == lod) {
return true;
}
else {
dbgKrita << "walker rect:" << walker->requestedRect();
dbgKrita << "expected rect:" << rect;
dbgKrita << "walker lod:" << walker->levelOfDetail();
dbgKrita << "expected lod:" << lod;
return false;
}
}
class KisNoopSpontaneousJob : public KisSpontaneousJob
{
public:
KisNoopSpontaneousJob(bool overridesEverything = false, int lod = 0)
: m_overridesEverything(overridesEverything),
m_lod(lod)
{
}
- void run() {
+ void run() override {
}
- bool overrides(const KisSpontaneousJob *otherJob) {
+ bool overrides(const KisSpontaneousJob *otherJob) override {
Q_UNUSED(otherJob);
return m_overridesEverything;
}
- int levelOfDetail() const {
+ int levelOfDetail() const override {
return m_lod;
}
private:
bool m_overridesEverything;
int m_lod;
};
static QStringList globalExecutedDabs;
class KisNoopDabStrategy : public KisStrokeJobStrategy
{
public:
KisNoopDabStrategy(QString name)
: m_name(name),
m_isMarked(false)
{}
- void run(KisStrokeJobData *data) {
+ void run(KisStrokeJobData *data) override {
Q_UNUSED(data);
globalExecutedDabs << m_name;
}
QString name() {
return m_name;
}
void setMarked() {
m_isMarked = true;
}
bool isMarked() const {
return m_isMarked;
}
private:
QString m_name;
bool m_isMarked;
};
class KisTestingStrokeJobData : public KisStrokeJobData
{
public:
KisTestingStrokeJobData(Sequentiality sequentiality = SEQUENTIAL,
Exclusivity exclusivity = NORMAL)
: KisStrokeJobData(sequentiality, exclusivity)
{
}
KisTestingStrokeJobData(const KisTestingStrokeJobData &rhs)
: KisStrokeJobData(rhs)
{
}
- KisStrokeJobData* createLodClone(int levelOfDetail) {
+ KisStrokeJobData* createLodClone(int levelOfDetail) override {
Q_UNUSED(levelOfDetail);
return new KisTestingStrokeJobData(*this);
}
};
class KisTestingStrokeStrategy : public KisStrokeStrategy
{
public:
KisTestingStrokeStrategy(const QString &prefix = QString(),
bool exclusive = false,
bool inhibitServiceJobs = false,
bool forceAllowInitJob = false,
bool forceAllowCancelJob = false)
: KisStrokeStrategy(prefix, kundo2_noi18n(prefix)),
m_prefix(prefix),
m_inhibitServiceJobs(inhibitServiceJobs),
m_forceAllowInitJob(forceAllowInitJob),
m_forceAllowCancelJob(forceAllowCancelJob),
m_cancelSeqNo(0)
{
setExclusive(exclusive);
}
KisTestingStrokeStrategy(const KisTestingStrokeStrategy &rhs, int levelOfDetail)
: KisStrokeStrategy(rhs),
m_prefix(rhs.m_prefix),
m_inhibitServiceJobs(rhs.m_inhibitServiceJobs),
m_forceAllowInitJob(rhs.m_forceAllowInitJob),
m_cancelSeqNo(rhs.m_cancelSeqNo)
{
m_prefix = QString("clone%1_%2").arg(levelOfDetail).arg(m_prefix);
}
- KisStrokeJobStrategy* createInitStrategy() {
+ KisStrokeJobStrategy* createInitStrategy() override {
return m_forceAllowInitJob || !m_inhibitServiceJobs ?
new KisNoopDabStrategy(m_prefix + "init") : 0;
}
- KisStrokeJobStrategy* createFinishStrategy() {
+ KisStrokeJobStrategy* createFinishStrategy() override {
return !m_inhibitServiceJobs ?
new KisNoopDabStrategy(m_prefix + "finish") : 0;
}
- KisStrokeJobStrategy* createCancelStrategy() {
+ KisStrokeJobStrategy* createCancelStrategy() override {
return m_forceAllowCancelJob || !m_inhibitServiceJobs ?
new KisNoopDabStrategy(m_prefix + "cancel") : 0;
}
- KisStrokeJobStrategy* createDabStrategy() {
+ KisStrokeJobStrategy* createDabStrategy() override {
return new KisNoopDabStrategy(m_prefix + "dab");
}
- KisStrokeStrategy* createLodClone(int levelOfDetail) {
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override {
return new KisTestingStrokeStrategy(*this, levelOfDetail);
}
class CancelData : public KisStrokeJobData
{
public:
CancelData(int seqNo) : m_seqNo(seqNo) {}
int seqNo() const { return m_seqNo; }
private:
int m_seqNo;
};
- KisStrokeJobData* createCancelData() {
+ KisStrokeJobData* createCancelData() override {
return new CancelData(m_cancelSeqNo++);
}
private:
QString m_prefix;
bool m_inhibitServiceJobs;
int m_forceAllowInitJob;
bool m_forceAllowCancelJob;
int m_cancelSeqNo;
};
inline QString getJobName(KisStrokeJob *job) {
KisNoopDabStrategy *pointer =
dynamic_cast<KisNoopDabStrategy*>(job->testingGetDabStrategy());
Q_ASSERT(pointer);
return pointer->name();
}
inline int cancelSeqNo(KisStrokeJob *job) {
KisTestingStrokeStrategy::CancelData *pointer =
dynamic_cast<KisTestingStrokeStrategy::CancelData*>
(job->testingGetDabData());
Q_ASSERT(pointer);
return pointer->seqNo();
}
#endif /* __SCHEDULER_UTILS_H */
diff --git a/libs/image/tiles3/kis_hline_iterator.h b/libs/image/tiles3/kis_hline_iterator.h
index 1b9a951dcf..302c6a792a 100644
--- a/libs/image/tiles3/kis_hline_iterator.h
+++ b/libs/image/tiles3/kis_hline_iterator.h
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_HLINE_ITERATOR_H_
#define _KIS_HLINE_ITERATOR_H_
#include "kis_base_iterator.h"
#include "kritaimage_export.h"
#include "kis_iterator_ng.h"
class KRITAIMAGE_EXPORT KisHLineIterator2 : public KisHLineIteratorNG, public KisBaseIterator {
KisHLineIterator2(const KisHLineIterator2&);
KisHLineIterator2& operator=(const KisHLineIterator2&);
public:
struct KisTileInfo {
KisTileSP tile;
KisTileSP oldtile;
quint8* data;
quint8* oldData;
};
public:
KisHLineIterator2(KisDataManager *dataManager, qint32 x, qint32 y, qint32 w, qint32 offsetX, qint32 offsetY, bool writable, KisIteratorCompleteListener *listener);
- ~KisHLineIterator2();
+ ~KisHLineIterator2() override;
- virtual bool nextPixel();
- virtual void nextRow();
- virtual const quint8* oldRawData() const;
- virtual const quint8* rawDataConst() const;
- virtual quint8* rawData();
- virtual qint32 nConseqPixels() const;
- virtual bool nextPixels(qint32 n);
- virtual qint32 x() const;
- virtual qint32 y() const;
+ bool nextPixel() override;
+ void nextRow() override;
+ const quint8* oldRawData() const override;
+ const quint8* rawDataConst() const override;
+ quint8* rawData() override;
+ qint32 nConseqPixels() const override;
+ bool nextPixels(qint32 n) override;
+ qint32 x() const override;
+ qint32 y() const override;
- virtual void resetPixelPos();
- virtual void resetRowPos();
+ void resetPixelPos() override;
+ void resetRowPos() override;
private:
qint32 m_offsetX;
qint32 m_offsetY;
qint32 m_x; // current x position
qint32 m_y; // current y position
qint32 m_row; // current row in tilemgr
quint32 m_index; // current col in tilemgr
quint32 m_tileWidth;
quint8 *m_data;
quint8 *m_oldData;
bool m_havePixels;
qint32 m_right;
qint32 m_left;
qint32 m_top;
qint32 m_leftCol;
qint32 m_rightCol;
qint32 m_rightmostInTile; // limited by the current tile border only
qint32 m_leftInLeftmostTile;
qint32 m_yInTile;
QVector<KisTileInfo> m_tilesCache;
quint32 m_tilesCacheSize;
private:
void switchToTile(qint32 xInTile);
void fetchTileDataForCache(KisTileInfo& kti, qint32 col, qint32 row);
void preallocateTiles();
};
#endif
diff --git a/libs/image/tiles3/kis_random_accessor.h b/libs/image/tiles3/kis_random_accessor.h
index 336a5c0f63..c823a62891 100644
--- a/libs/image/tiles3/kis_random_accessor.h
+++ b/libs/image/tiles3/kis_random_accessor.h
@@ -1,101 +1,101 @@
/*
* copyright (c) 2006,2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TILED_RANDOM_ACCESSOR_H
#define KIS_TILED_RANDOM_ACCESSOR_H
#include <QRect>
#include <kis_shared.h>
#include "kis_tiled_data_manager.h"
#include "kis_random_accessor_ng.h"
#include "kis_iterator_complete_listener.h"
class KisRandomAccessor2 : public KisRandomAccessorNG
{
struct KisTileInfo {
KisTileSP tile;
KisTileSP oldtile;
quint8* data;
const quint8* oldData;
qint32 area_x1, area_y1, area_x2, area_y2;
};
public:
KisRandomAccessor2(KisTiledDataManager *ktm, qint32 x, qint32 y, qint32 offsetX, qint32 offsetY, bool writable, KisIteratorCompleteListener *completeListener);
KisRandomAccessor2(const KisTiledRandomAccessor& lhs);
- ~KisRandomAccessor2();
+ ~KisRandomAccessor2() override;
private:
inline void lockTile(KisTileSP &tile) {
if (m_writable)
tile->lockForWrite();
else
tile->lockForRead();
}
inline void lockOldTile(KisTileSP &tile) {
// Doesn't depend on access type
tile->lockForRead();
}
inline void unlockTile(KisTileSP &tile) {
tile->unlock();
}
inline quint32 xToCol(quint32 x) const {
return m_ktm ? m_ktm->xToCol(x) : 0;
}
inline quint32 yToRow(quint32 y) const {
return m_ktm ? m_ktm->yToRow(y) : 0;
}
KisTileInfo* fetchTileData(qint32 col, qint32 row);
public:
/// Move to a given x,y position, fetch tiles and data
- void moveTo(qint32 x, qint32 y);
- quint8* rawData();
- const quint8* oldRawData() const;
- const quint8* rawDataConst() const;
- qint32 numContiguousColumns(qint32 x) const;
- qint32 numContiguousRows(qint32 y) const;
- qint32 rowStride(qint32 x, qint32 y) const;
- qint32 x() const;
- qint32 y() const;
+ void moveTo(qint32 x, qint32 y) override;
+ quint8* rawData() override;
+ const quint8* oldRawData() const override;
+ const quint8* rawDataConst() const override;
+ qint32 numContiguousColumns(qint32 x) const override;
+ qint32 numContiguousRows(qint32 y) const override;
+ qint32 rowStride(qint32 x, qint32 y) const override;
+ qint32 x() const override;
+ qint32 y() const override;
private:
KisTiledDataManager *m_ktm;
KisTileInfo** m_tilesCache;
quint32 m_tilesCacheSize;
qint32 m_pixelSize;
quint8* m_data;
const quint8* m_oldData;
bool m_writable;
int m_lastX, m_lastY;
qint32 m_offsetX, m_offsetY;
KisIteratorCompleteListener *m_completeListener;
static const quint32 CACHESIZE; // Define the number of tiles we keep in cache
};
#endif
diff --git a/libs/image/tiles3/kis_tile_data_pooler.h b/libs/image/tiles3/kis_tile_data_pooler.h
index 4f4ce37405..dde2592a9a 100644
--- a/libs/image/tiles3/kis_tile_data_pooler.h
+++ b/libs/image/tiles3/kis_tile_data_pooler.h
@@ -1,94 +1,94 @@
/*
* Copyright (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TILE_DATA_POOLER_H_
#define KIS_TILE_DATA_POOLER_H_
#include <QObject>
#include <QThread>
#include <QSemaphore>
class KisTileDataStore;
class KisTileData;
class KisTileDataPooler : public QThread
{
Q_OBJECT
public:
KisTileDataPooler(KisTileDataStore *store, qint32 memoryLimit = -1);
- virtual ~KisTileDataPooler();
+ ~KisTileDataPooler() override;
void kick();
void terminatePooler();
void testingRereadConfig();
qint64 lastPoolMemoryMetric() const;
qint64 lastRealMemoryMetric() const;
qint64 lastHistoricalMemoryMetric() const;
protected:
static const qint32 MAX_NUM_CLONES;
static const qint32 MAX_TIMEOUT;
static const qint32 MIN_TIMEOUT;
static const qint32 TIMEOUT_FACTOR;
void waitForWork();
qint32 numClonesNeeded(KisTileData *td) const;
void cloneTileData(KisTileData *td, qint32 numClones) const;
- void run();
+ void run() override;
inline int clonesMetric(KisTileData *td, int numClones);
inline int clonesMetric(KisTileData *td);
inline void tryFreeOrphanedClones(KisTileData *td);
inline qint32 needMemory(KisTileData *td);
inline qint32 canDonorMemory(KisTileData *td);
qint32 tryGetMemory(QList<KisTileData*> &donors, qint32 memoryMetric);
template<class Iter>
void getLists(Iter *iter, QList<KisTileData*> &beggers,
QList<KisTileData*> &donors,
qint32 &memoryOccupied,
qint32 &statRealMemory,
qint32 &statHistoricalMemory);
bool processLists(QList<KisTileData*> &beggers,
QList<KisTileData*> &donors,
qint32 &memoryOccupied);
private:
void debugTileStatistics();
protected:
QSemaphore m_semaphore;
QAtomicInt m_shouldExitFlag;
KisTileDataStore *m_store;
qint32 m_timeout;
bool m_lastCycleHadWork;
qint32 m_memoryLimit;
qint32 m_lastPoolMemoryMetric;
qint32 m_lastRealMemoryMetric;
qint32 m_lastHistoricalMemoryMetric;
};
#endif /* KIS_TILE_DATA_POOLER_H_ */
diff --git a/libs/image/tiles3/kis_vline_iterator.h b/libs/image/tiles3/kis_vline_iterator.h
index 68ae69ddc4..c8a63e3cc9 100644
--- a/libs/image/tiles3/kis_vline_iterator.h
+++ b/libs/image/tiles3/kis_vline_iterator.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_VLINE_ITERATOR_H_
#define _KIS_VLINE_ITERATOR_H_
#include "kis_base_iterator.h"
#include "kritaimage_export.h"
#include "kis_iterator_ng.h"
class KRITAIMAGE_EXPORT KisVLineIterator2 : public KisVLineIteratorNG, KisBaseIterator {
KisVLineIterator2(const KisVLineIterator2&);
KisVLineIterator2& operator=(const KisVLineIterator2&);
public:
struct KisTileInfo {
KisTileSP tile;
KisTileSP oldtile;
quint8* data;
quint8* oldData;
};
public:
KisVLineIterator2(KisDataManager *dataManager, qint32 x, qint32 y, qint32 h, qint32 offsetX, qint32 offsetY, bool writable, KisIteratorCompleteListener *completeListener);
- ~KisVLineIterator2();
+ ~KisVLineIterator2() override;
- virtual void resetPixelPos();
- virtual void resetColumnPos();
+ void resetPixelPos() override;
+ void resetColumnPos() override;
- virtual bool nextPixel();
- virtual void nextColumn();
- virtual const quint8* rawDataConst() const;
- virtual const quint8* oldRawData() const;
- virtual quint8* rawData();
- virtual qint32 nConseqPixels() const;
- virtual bool nextPixels(qint32 n);
- virtual qint32 x() const;
- virtual qint32 y() const;
+ bool nextPixel() override;
+ void nextColumn() override;
+ const quint8* rawDataConst() const override;
+ const quint8* oldRawData() const override;
+ quint8* rawData() override;
+ qint32 nConseqPixels() const override;
+ bool nextPixels(qint32 n) override;
+ qint32 x() const override;
+ qint32 y() const override;
private:
qint32 m_offsetX;
qint32 m_offsetY;
qint32 m_x; // current x position
qint32 m_y; // current y position
qint32 m_column; // current column in tilemgr
qint32 m_index; // current row in tilemgr
qint32 m_tileSize;
quint8 *m_data;
quint8 *m_dataBottom;
quint8 *m_oldData;
bool m_havePixels;
qint32 m_top;
qint32 m_bottom;
qint32 m_left;
qint32 m_topRow;
qint32 m_bottomRow;
qint32 m_topInTopmostTile;
qint32 m_xInTile;
qint32 m_lineStride;
QVector<KisTileInfo> m_tilesCache;
qint32 m_tilesCacheSize;
private:
void switchToTile(qint32 xInTile);
void fetchTileDataForCache(KisTileInfo& kti, qint32 col, qint32 row);
void preallocateTiles();
};
#endif
diff --git a/libs/image/tiles3/swap/kis_legacy_tile_compressor.h b/libs/image/tiles3/swap/kis_legacy_tile_compressor.h
index 3574b66e15..ba007220fb 100644
--- a/libs/image/tiles3/swap/kis_legacy_tile_compressor.h
+++ b/libs/image/tiles3/swap/kis_legacy_tile_compressor.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LEGACY_TILE_COMPRESSOR_H
#define __KIS_LEGACY_TILE_COMPRESSOR_H
#include "kis_abstract_tile_compressor.h"
class KRITAIMAGE_EXPORT KisLegacyTileCompressor : public KisAbstractTileCompressor
{
public:
KisLegacyTileCompressor();
- virtual ~KisLegacyTileCompressor();
+ ~KisLegacyTileCompressor() override;
- bool writeTile(KisTileSP tile, KisPaintDeviceWriter &store);
- bool readTile(QIODevice *stream, KisTiledDataManager *dm);
+ bool writeTile(KisTileSP tile, KisPaintDeviceWriter &store) override;
+ bool readTile(QIODevice *stream, KisTiledDataManager *dm) override;
void compressTileData(KisTileData *tileData,quint8 *buffer,
- qint32 bufferSize, qint32 &bytesWritten);
- bool decompressTileData(quint8 *buffer, qint32 bufferSize, KisTileData *tileData);
- qint32 tileDataBufferSize(KisTileData *tileData);
+ qint32 bufferSize, qint32 &bytesWritten) override;
+ bool decompressTileData(quint8 *buffer, qint32 bufferSize, KisTileData *tileData) override;
+ qint32 tileDataBufferSize(KisTileData *tileData) override;
private:
/**
* Quite self describing
*/
qint32 maxHeaderLength();
/**
* Writes header into the buffer. Buffer size
* should be maxHeaderLength() + 1 bytes at least
* (to fit terminating '\0')
*/
bool writeHeader(KisTileSP tile, quint8 *buffer);
};
#endif /* __KIS_LEGACY_TILE_COMPRESSOR_H */
diff --git a/libs/image/tiles3/swap/kis_lzf_compression.h b/libs/image/tiles3/swap/kis_lzf_compression.h
index 2256771a71..ef077e52dd 100644
--- a/libs/image/tiles3/swap/kis_lzf_compression.h
+++ b/libs/image/tiles3/swap/kis_lzf_compression.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LZF_COMPRESSION_H
#define __KIS_LZF_COMPRESSION_H
#include "kis_abstract_compression.h"
class KRITAIMAGE_EXPORT KisLzfCompression : public KisAbstractCompression
{
public:
KisLzfCompression();
- virtual ~KisLzfCompression();
+ ~KisLzfCompression() override;
- qint32 compress(const quint8* input, qint32 inputLength, quint8* output, qint32 outputLength);
- qint32 decompress(const quint8* input, qint32 inputLength, quint8* output, qint32 outputLength);
+ qint32 compress(const quint8* input, qint32 inputLength, quint8* output, qint32 outputLength) override;
+ qint32 decompress(const quint8* input, qint32 inputLength, quint8* output, qint32 outputLength) override;
- qint32 outputBufferSize(qint32 dataSize);
+ qint32 outputBufferSize(qint32 dataSize) override;
//void adjustForDataSize(qint32 dataSize);
};
#endif /* __KIS_LZF_COMPRESSION_H */
diff --git a/libs/image/tiles3/swap/kis_tile_compressor_2.h b/libs/image/tiles3/swap/kis_tile_compressor_2.h
index 0a3e935873..99d8b4cbeb 100644
--- a/libs/image/tiles3/swap/kis_tile_compressor_2.h
+++ b/libs/image/tiles3/swap/kis_tile_compressor_2.h
@@ -1,65 +1,65 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TILE_COMPRESSOR_2_H
#define __KIS_TILE_COMPRESSOR_2_H
#include "kis_abstract_tile_compressor.h"
class KisAbstractCompression;
class KRITAIMAGE_EXPORT KisTileCompressor2 : public KisAbstractTileCompressor
{
public:
KisTileCompressor2();
- virtual ~KisTileCompressor2();
+ ~KisTileCompressor2() override;
- bool writeTile(KisTileSP tile, KisPaintDeviceWriter &store);
- bool readTile(QIODevice *io, KisTiledDataManager *dm);
+ bool writeTile(KisTileSP tile, KisPaintDeviceWriter &store) override;
+ bool readTile(QIODevice *io, KisTiledDataManager *dm) override;
void compressTileData(KisTileData *tileData,quint8 *buffer,
- qint32 bufferSize, qint32 &bytesWritten);
- bool decompressTileData(quint8 *buffer, qint32 bufferSize, KisTileData *tileData);
- qint32 tileDataBufferSize(KisTileData *tileData);
+ qint32 bufferSize, qint32 &bytesWritten) override;
+ bool decompressTileData(quint8 *buffer, qint32 bufferSize, KisTileData *tileData) override;
+ qint32 tileDataBufferSize(KisTileData *tileData) override;
private:
/**
* Quite self describing
*/
qint32 maxHeaderLength();
QString getHeader(KisTileSP tile, qint32 compressedSize);
void prepareWorkBuffers(qint32 tileDataSize);
void prepareStreamingBuffer(qint32 tileDataSize);
private:
static const qint8 RAW_DATA_FLAG = 0;
static const qint8 COMPRESSED_DATA_FLAG = 1;
private:
QByteArray m_linearizationBuffer;
QByteArray m_compressionBuffer;
QByteArray m_streamingBuffer;
KisAbstractCompression *m_compression;
static const QString m_compressionName;
};
#endif /* __KIS_TILE_COMPRESSOR_2_H */
diff --git a/libs/image/tiles3/swap/kis_tile_data_swapper.h b/libs/image/tiles3/swap/kis_tile_data_swapper.h
index 7488d7da22..2e6fca58f6 100644
--- a/libs/image/tiles3/swap/kis_tile_data_swapper.h
+++ b/libs/image/tiles3/swap/kis_tile_data_swapper.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TILE_DATA_SWAPPER_H_
#define KIS_TILE_DATA_SWAPPER_H_
#include <QObject>
#include <QThread>
#include "kritaimage_export.h"
class KisTileDataStore;
class KisTileData;
class KRITAIMAGE_EXPORT KisTileDataSwapper : public QThread
{
Q_OBJECT
public:
KisTileDataSwapper(KisTileDataStore *store);
- virtual ~KisTileDataSwapper();
+ ~KisTileDataSwapper() override;
void kick();
void terminateSwapper();
void checkFreeMemory();
void testingRereadConfig();
private:
void waitForWork();
- void run();
+ void run() override;
void doJob();
template<class strategy> qint64 pass(qint64 needToFreeMetric);
private:
static const qint32 TIMEOUT;
static const qint32 DELAY;
private:
struct Private;
Private * const m_d;
};
#endif /* KIS_TILE_DATA_SWAPPER_H_ */
diff --git a/libs/image/tiles3/tests/tiles_test_utils.h b/libs/image/tiles3/tests/tiles_test_utils.h
index 8af94f93fa..798eaa3b23 100644
--- a/libs/image/tiles3/tests/tiles_test_utils.h
+++ b/libs/image/tiles3/tests/tiles_test_utils.h
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TILES_TEST_UTILS_H
#define TILES_TEST_UTILS_H
#include <KoStore_p.h>
#include <kis_paint_device_writer.h>
#include <kis_debug.h>
class KisFakePaintDeviceWriter : public KisPaintDeviceWriter {
public:
KisFakePaintDeviceWriter(KoStore *store)
: m_store(store)
{
}
- bool write(const QByteArray &data) {
+ bool write(const QByteArray &data) override {
return (m_store->write(data) == data.length());
}
- bool write(const char* data, qint64 length) {
+ bool write(const char* data, qint64 length) override {
return (m_store->write(data, length) == length);
}
KoStore *m_store;
};
class KoStoreFake : public KoStore
{
public:
KoStoreFake() : KoStore(KoStore::Write) {
d_ptr->stream = &m_buffer;
d_ptr->isOpen = true;
m_buffer.open(QIODevice::ReadWrite);
}
- ~KoStoreFake() {
+ ~KoStoreFake() override {
// Oh, no, please do not clean anything! :)
d_ptr->stream = 0;
d_ptr->isOpen = false;
}
void startReading() {
m_buffer.seek(0);
d_ptr->mode = KoStore::Read;
}
- bool openWrite(const QString&) { return true; }
- bool openRead(const QString&) { return true; }
- bool closeRead() { return true; }
- bool closeWrite() { return true; }
- bool enterRelativeDirectory(const QString&) { return true; }
- bool enterAbsoluteDirectory(const QString&) { return true; }
- bool fileExists(const QString&) const { return true; }
+ bool openWrite(const QString&) override { return true; }
+ bool openRead(const QString&) override { return true; }
+ bool closeRead() override { return true; }
+ bool closeWrite() override { return true; }
+ bool enterRelativeDirectory(const QString&) override { return true; }
+ bool enterAbsoluteDirectory(const QString&) override { return true; }
+ bool fileExists(const QString&) const override { return true; }
private:
QBuffer m_buffer;
};
bool memoryIsFilled(quint8 c, quint8 *mem, qint32 size)
{
for(; size > 0; size--)
if(*(mem++) != c) {
dbgKrita << "Expected" << c << "but found" << *(mem-1);
return false;
}
return true;
}
#define TILESIZE 64*64
#endif /* TILES_TEST_UTILS_H */
diff --git a/libs/impex/AnimationCheck.h b/libs/impex/AnimationCheck.h
index 290c264156..f76b2df2f2 100644
--- a/libs/impex/AnimationCheck.h
+++ b/libs/impex/AnimationCheck.h
@@ -1,71 +1,71 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef AnimationCHECK_H
#define AnimationCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <kis_image_animation_interface.h>
#include <KoColorSpace.h>
class AnimationCheck : public KisExportCheckBase
{
public:
AnimationCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning, true)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "This image has <b>animated layers</b>. Animation cannot be saved to this format.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
return image->animationInterface()->hasAnimation();
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class AnimationCheckFactory : public KisExportCheckFactory
{
public:
AnimationCheckFactory() {}
- virtual ~AnimationCheckFactory() {}
+ ~AnimationCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new AnimationCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "AnimationCheck";
}
};
#endif // AnimationCHECK_H
diff --git a/libs/impex/ColorModelCheck.h b/libs/impex/ColorModelCheck.h
index b54bf64191..e1c32040ed 100644
--- a/libs/impex/ColorModelCheck.h
+++ b/libs/impex/ColorModelCheck.h
@@ -1,89 +1,89 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COLORMODELCHECK_H
#define COLORMODELCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <KoColorModelStandardIds.h>
class ColorModelCheck : public KisExportCheckBase
{
public:
ColorModelCheck(const KoID &colorModelID, const KoID &colorDepthID, const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning)
, m_colorModelID(colorModelID)
, m_colorDepthID(colorDepthID)
{
Q_ASSERT(!colorModelID.name().isEmpty());
Q_ASSERT(!colorDepthID.name().isEmpty());
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning",
"XXX The color model <b>%1</b> or channel depth <b>%2</b> cannot be saved to this format. Your image will be converted.",
m_colorModelID.name(),
m_colorDepthID.name());
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
return (image->colorSpace()->colorModelId() == m_colorModelID && image->colorSpace()->colorDepthId() == m_colorDepthID);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
const KoID m_colorModelID;
const KoID m_colorDepthID;
};
class ColorModelCheckFactory : public KisExportCheckFactory
{
public:
ColorModelCheckFactory(const KoID &colorModelID, const KoID &colorDepthId)
: m_colorModelID(colorModelID)
, m_colorDepthID(colorDepthId)
{
}
- virtual ~ColorModelCheckFactory() {}
+ ~ColorModelCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new ColorModelCheck(m_colorModelID, m_colorDepthID, id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "ColorModelCheck/" + m_colorModelID.id() + "/" + m_colorDepthID.id();
}
const KoID m_colorModelID;
const KoID m_colorDepthID;
};
#endif // COLORMODELCHECK_H
diff --git a/libs/impex/ColorModelHomogenousCheck.h b/libs/impex/ColorModelHomogenousCheck.h
index c6bceedcdb..6434dd5ce5 100644
--- a/libs/impex/ColorModelHomogenousCheck.h
+++ b/libs/impex/ColorModelHomogenousCheck.h
@@ -1,166 +1,166 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COLORMODELHOMOGENOUSCHECK_H
#define COLORMODELHOMOGENOUSCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <KoColorModelStandardIds.h>
#include <kis_layer.h>
#include <kis_node_visitor.h>
#include "kis_node.h"
#include "kis_paint_layer.h"
#include "kis_group_layer.h"
#include "kis_adjustment_layer.h"
#include "kis_external_layer_iface.h"
#include "kis_clone_layer.h"
#include "generator/kis_generator_layer.h"
class KisColorModelHomogenousCheckVisitor : public KisNodeVisitor
{
public:
using KisNodeVisitor::visit;
KisColorModelHomogenousCheckVisitor(KoID colorModelID, KoID colorDepthID)
: m_count(0)
, m_colorModelID(colorModelID)
, m_colorDepthID(colorDepthID)
{
}
quint32 count() {
return m_count;
}
- bool visit(KisNode* node) {
+ bool visit(KisNode* node) override {
return check(node);
}
- bool visit(KisPaintLayer *layer) {
+ bool visit(KisPaintLayer *layer) override {
return check(layer);
}
- bool visit(KisGroupLayer *layer) {
+ bool visit(KisGroupLayer *layer) override {
return check(layer);
}
- bool visit(KisAdjustmentLayer *layer) {
+ bool visit(KisAdjustmentLayer *layer) override {
return check(layer);
}
- bool visit(KisExternalLayer *layer) {
+ bool visit(KisExternalLayer *layer) override {
return check(layer);
}
- bool visit(KisCloneLayer *layer) {
+ bool visit(KisCloneLayer *layer) override {
return check(layer);
}
- bool visit(KisGeneratorLayer * layer) {
+ bool visit(KisGeneratorLayer * layer) override {
return check(layer);
}
- virtual bool visit(KisFilterMask *) {return true;}
+ bool visit(KisFilterMask *) override {return true;}
- virtual bool visit(KisTransformMask *) {return true;}
+ bool visit(KisTransformMask *) override {return true;}
- virtual bool visit(KisTransparencyMask *) {return true;}
+ bool visit(KisTransparencyMask *) override {return true;}
- virtual bool visit(KisSelectionMask *) {return true;}
+ bool visit(KisSelectionMask *) override {return true;}
- virtual bool visit(KisColorizeMask *) {return true;}
+ bool visit(KisColorizeMask *) override {return true;}
private:
bool check(KisNode * node)
{
KisLayer *layer = dynamic_cast<KisLayer*>(node);
if (layer) {
const KoColorSpace * cs = layer->colorSpace();
if (cs->colorModelId() != m_colorModelID || cs->colorDepthId() != m_colorDepthID) {
m_count++;
}
}
visitAll(node);
return true;
}
quint32 m_count;
const KoID m_colorModelID;
const KoID m_colorDepthID;
};
class ColorModelHomogenousCheck : public KisExportCheckBase
{
public:
ColorModelHomogenousCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning, true)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "Your image contains layers with a color model that is different from the image. The layers will be converted.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
const KoColorSpace *cs = image->colorSpace();
KisColorModelHomogenousCheckVisitor v(cs->colorModelId(), cs->colorDepthId());
image->rootLayer()->accept(v);
return (v.count() > 0);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class ColorModelHomogenousCheckFactory : public KisExportCheckFactory
{
public:
ColorModelHomogenousCheckFactory()
{
}
- virtual ~ColorModelHomogenousCheckFactory() {}
+ ~ColorModelHomogenousCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new ColorModelHomogenousCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "ColorModelHomogenousCheck";
}
};
#endif // COLORMODELHOMOGENOUSCHECK_H
diff --git a/libs/impex/ColorModelPerLayerCheck.h b/libs/impex/ColorModelPerLayerCheck.h
index 9603b9958d..4fd2de19cb 100644
--- a/libs/impex/ColorModelPerLayerCheck.h
+++ b/libs/impex/ColorModelPerLayerCheck.h
@@ -1,176 +1,176 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ColorModelPerLayerCHECK_H
#define ColorModelPerLayerCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <KoColorModelStandardIds.h>
#include <kis_layer.h>
#include <kis_node_visitor.h>
#include "kis_node.h"
#include "kis_paint_layer.h"
#include "kis_group_layer.h"
#include "kis_adjustment_layer.h"
#include "kis_external_layer_iface.h"
#include "kis_clone_layer.h"
#include "generator/kis_generator_layer.h"
class KisColorModelCheckVisitor : public KisNodeVisitor
{
public:
using KisNodeVisitor::visit;
KisColorModelCheckVisitor (KoID colorModelID, KoID colorDepthID)
: m_count(0)
, m_colorModelID(colorModelID)
, m_colorDepthID(colorDepthID)
{
}
quint32 count() {
return m_count;
}
- bool visit(KisNode* node) {
+ bool visit(KisNode* node) override {
return check(node);
}
- bool visit(KisPaintLayer *layer) {
+ bool visit(KisPaintLayer *layer) override {
return check(layer);
}
- bool visit(KisGroupLayer *layer) {
+ bool visit(KisGroupLayer *layer) override {
return check(layer);
}
- bool visit(KisAdjustmentLayer *layer) {
+ bool visit(KisAdjustmentLayer *layer) override {
return check(layer);
}
- bool visit(KisExternalLayer *layer) {
+ bool visit(KisExternalLayer *layer) override {
return check(layer);
}
- bool visit(KisCloneLayer *layer) {
+ bool visit(KisCloneLayer *layer) override {
return check(layer);
}
- bool visit(KisGeneratorLayer * layer) {
+ bool visit(KisGeneratorLayer * layer) override {
return check(layer);
}
- virtual bool visit(KisFilterMask *) {return true;}
+ bool visit(KisFilterMask *) override {return true;}
- virtual bool visit(KisTransformMask *) {return true;}
+ bool visit(KisTransformMask *) override {return true;}
- virtual bool visit(KisTransparencyMask *) {return true;}
+ bool visit(KisTransparencyMask *) override {return true;}
- virtual bool visit(KisSelectionMask *) {return true;}
+ bool visit(KisSelectionMask *) override {return true;}
- virtual bool visit(KisColorizeMask *) {return true;}
+ bool visit(KisColorizeMask *) override {return true;}
private:
bool check(KisNode * node)
{
KisLayer *layer = dynamic_cast<KisLayer*>(node);
if (layer) {
const KoColorSpace * cs = layer->colorSpace();
if (cs->colorModelId() == m_colorModelID && cs->colorDepthId() == m_colorDepthID) {
m_count++;
}
}
visitAll(node);
return true;
}
quint32 m_count;
const KoID m_colorModelID;
const KoID m_colorDepthID;
};
class ColorModelPerLayerCheck : public KisExportCheckBase
{
public:
ColorModelPerLayerCheck(const KoID &colorModelID, const KoID &colorDepthID, const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning, true)
, m_ColorModelID(colorModelID)
, m_colorDepthID(colorDepthID)
{
Q_ASSERT(!colorModelID.name().isEmpty());
Q_ASSERT(!colorDepthID.name().isEmpty());
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "Your image contains layers with the color model <b>%1</b> and channel depth <b>%2</b> which cannot be saved to this format. The layers will be converted."
, m_ColorModelID.name()
,m_colorDepthID.name());
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
KisColorModelCheckVisitor v(m_ColorModelID, m_colorDepthID);
image->rootLayer()->accept(v);
return (v.count() > 0);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
const KoID m_ColorModelID;
const KoID m_colorDepthID;
};
class ColorModelPerLayerCheckFactory : public KisExportCheckFactory
{
public:
ColorModelPerLayerCheckFactory(const KoID &ColorModelID, const KoID &colorDepthId)
: m_colorModelID(ColorModelID)
, m_colorDepthID(colorDepthId)
{
}
- virtual ~ColorModelPerLayerCheckFactory() {}
+ ~ColorModelPerLayerCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new ColorModelPerLayerCheck(m_colorModelID, m_colorDepthID, id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "ColorModelPerLayerCheck/" + m_colorModelID.id() + "/" + m_colorDepthID.id();
}
const KoID m_colorModelID;
const KoID m_colorDepthID;
};
#endif // ColorModelPerLayerCHECK_H
diff --git a/libs/impex/CompositionsCheck.h b/libs/impex/CompositionsCheck.h
index d5decf8fcf..f37c907516 100644
--- a/libs/impex/CompositionsCheck.h
+++ b/libs/impex/CompositionsCheck.h
@@ -1,71 +1,71 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CompositionsCHECK_H
#define CompositionsCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
class CompositionsCheck : public KisExportCheckBase
{
public:
CompositionsCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "The image contains <b>compositions</b>. The compositions will not be saved.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
return (image->compositions().size() > 0);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class CompositionsCheckFactory : public KisExportCheckFactory
{
public:
CompositionsCheckFactory()
{
}
- virtual ~CompositionsCheckFactory() {}
+ ~CompositionsCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new CompositionsCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "CompositionsCheck";
}
};
#endif // CompositionsCHECK_H
diff --git a/libs/impex/ExifCheck.h b/libs/impex/ExifCheck.h
index dfe2587590..caf6d873ba 100644
--- a/libs/impex/ExifCheck.h
+++ b/libs/impex/ExifCheck.h
@@ -1,79 +1,79 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ExifCHECK_H
#define ExifCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_filter_registry_model.h>
#include <metadata/kis_exif_info_visitor.h>
class ExifCheck : public KisExportCheckBase
{
public:
ExifCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "The image contains <b>Exif</b> metadata. The metadata will not be saved.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
KisExifInfoVisitor eIV;
eIV.visit(image->rootLayer().data());
return eIV.exifInfo();
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class ExifCheckFactory : public KisExportCheckFactory
{
public:
ExifCheckFactory()
{
}
- virtual ~ExifCheckFactory() {}
+ ~ExifCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new ExifCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "ExifCheck";
}
};
#endif // ExifCHECK_H
diff --git a/libs/impex/ImageSizeCheck.h b/libs/impex/ImageSizeCheck.h
index 1452365e91..76d6f6026d 100644
--- a/libs/impex/ImageSizeCheck.h
+++ b/libs/impex/ImageSizeCheck.h
@@ -1,81 +1,81 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHECKIMAGESIZE_H
#define CHECKIMAGESIZE_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include "kritaimpex_export.h"
class KRITAIMPEX_EXPORT ImageSizeCheck : public KisExportCheckBase
{
public:
ImageSizeCheck(int maxWidth, int maxHeight, const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning, true)
, m_maxW(maxWidth)
, m_maxH(maxHeight)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "This image is larger than <b>%1 x %2</b>. Images this size cannot be saved to this format.", m_maxW, m_maxH);
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
return image->width() >= m_maxW && image->height() >= m_maxH;
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
int m_maxW;
int m_maxH;
};
class KRITAIMPEX_EXPORT ImageSizeCheckFactory : public KisExportCheckFactory
{
public:
ImageSizeCheckFactory() {}
- virtual ~ImageSizeCheckFactory() {}
+ ~ImageSizeCheckFactory() override {}
- KisExportCheckBase *create( KisExportCheckBase::Level level, const QString &customWarning = QString())
+ KisExportCheckBase *create( KisExportCheckBase::Level level, const QString &customWarning = QString()) override
{
return new ImageSizeCheck(100000000, 100000000, id(), level, customWarning);
}
KisExportCheckBase *create(int maxWidth, int maxHeight, KisExportCheckBase::Level level, const QString &customWarning = QString())
{
return new ImageSizeCheck(maxWidth, maxHeight, id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "ImageSizeCheck";
}
};
#endif // CHECKIMAGESIZE_H
diff --git a/libs/impex/KisExportCheckRegistry.h b/libs/impex/KisExportCheckRegistry.h
index 418bb0d5a6..7320931fe7 100644
--- a/libs/impex/KisExportCheckRegistry.h
+++ b/libs/impex/KisExportCheckRegistry.h
@@ -1,44 +1,44 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISEXPORTCHECKREGISTRY_H
#define KISEXPORTCHECKREGISTRY_H
#include <QString>
#include <KoGenericRegistry.h>
#include "KisExportCheckBase.h"
#include "kritaimpex_export.h"
class KRITAIMPEX_EXPORT KisExportCheckRegistry : public QObject, public KoGenericRegistry<KisExportCheckFactory*>
{
public:
KisExportCheckRegistry();
- virtual ~KisExportCheckRegistry();
+ ~KisExportCheckRegistry() override;
static KisExportCheckRegistry *instance();
private:
Q_DISABLE_COPY(KisExportCheckRegistry)
};
#endif // KISEXPORTCHECKREGISTRY_H
diff --git a/libs/impex/MultiLayerCheck.h b/libs/impex/MultiLayerCheck.h
index b8e197c6ea..dad4f23bf1 100644
--- a/libs/impex/MultiLayerCheck.h
+++ b/libs/impex/MultiLayerCheck.h
@@ -1,71 +1,71 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MultiLayerCheck_H
#define MultiLayerCheck_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <kis_group_layer.h>
class MultiLayerCheck : public KisExportCheckBase
{
public:
MultiLayerCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "The image has <b>more than one layer</b>. Only the flattened image will be saved.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
return (image->rootLayer()->childCount() > 1);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class MultiLayerCheckFactory : public KisExportCheckFactory
{
public:
MultiLayerCheckFactory() {}
- virtual ~MultiLayerCheckFactory() {}
+ ~MultiLayerCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new MultiLayerCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "MultiLayerCheck";
}
};
#endif // MultiLayerCheck_H
diff --git a/libs/impex/NodeTypeCheck.h b/libs/impex/NodeTypeCheck.h
index 58afde86be..742e3e1689 100644
--- a/libs/impex/NodeTypeCheck.h
+++ b/libs/impex/NodeTypeCheck.h
@@ -1,91 +1,91 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef NodeTypeCheck_H
#define NodeTypeCheck_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <kis_count_visitor.h>
class NodeTypeCheck : public KisExportCheckBase
{
public:
NodeTypeCheck(const QString &nodeType, const QString &description, const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning, true)
, m_nodeType(nodeType)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "The image contains layers of unsupported type <b>%1</b>. Only the rendered result will be saved.", description);
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
QStringList nodetypes = QStringList() << m_nodeType;
KoProperties props;
KisCountVisitor v(nodetypes, props);
image->rootLayer()->accept(v);
// There is always one group layer, the root layer.
if (m_nodeType == "KisGroupLayer") {
return (v.count() > 1);
}
else {
return (v.count() > 0);
}
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
QString m_nodeType;
};
class NodeTypeCheckFactory : public KisExportCheckFactory
{
public:
NodeTypeCheckFactory(const QString &nodeType, const QString &description)
: m_nodeType(nodeType)
, m_description(description)
{}
- virtual ~NodeTypeCheckFactory() {}
+ ~NodeTypeCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new NodeTypeCheck(m_nodeType, m_description, id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "NodeTypeCheck/" + m_nodeType;
}
QString m_nodeType;
QString m_description;
};
#endif // NodeTypeCheck_H
diff --git a/libs/impex/PSDLayerStylesCheck.h b/libs/impex/PSDLayerStylesCheck.h
index 70e96f20f4..9289d219f0 100644
--- a/libs/impex/PSDLayerStylesCheck.h
+++ b/libs/impex/PSDLayerStylesCheck.h
@@ -1,152 +1,152 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PSDLayerStyleCHECK_H
#define PSDLayerStyleCHECK_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <kis_node_visitor.h>
#include "kis_node.h"
#include "kis_paint_layer.h"
#include "kis_group_layer.h"
#include "kis_adjustment_layer.h"
#include "kis_external_layer_iface.h"
#include "kis_clone_layer.h"
#include "generator/kis_generator_layer.h"
class KisLayerStyleVisitor : public KisNodeVisitor
{
public:
using KisNodeVisitor::visit;
KisLayerStyleVisitor()
: m_count(0)
{
}
quint32 count() {
return m_count;
}
- bool visit(KisNode* node) {
+ bool visit(KisNode* node) override {
return check(node);
}
- bool visit(KisPaintLayer *layer) {
+ bool visit(KisPaintLayer *layer) override {
return check(layer);
}
- bool visit(KisGroupLayer *layer) {
+ bool visit(KisGroupLayer *layer) override {
return check(layer);
}
- bool visit(KisAdjustmentLayer *layer) {
+ bool visit(KisAdjustmentLayer *layer) override {
return check(layer);
}
- bool visit(KisExternalLayer *layer) {
+ bool visit(KisExternalLayer *layer) override {
return check(layer);
}
- bool visit(KisCloneLayer *layer) {
+ bool visit(KisCloneLayer *layer) override {
return check(layer);
}
- bool visit(KisGeneratorLayer * layer) {
+ bool visit(KisGeneratorLayer * layer) override {
return check(layer);
}
- virtual bool visit(KisFilterMask *) {return true;}
+ bool visit(KisFilterMask *) override {return true;}
- virtual bool visit(KisTransformMask *) {return true;}
+ bool visit(KisTransformMask *) override {return true;}
- virtual bool visit(KisTransparencyMask *) {return true;}
+ bool visit(KisTransparencyMask *) override {return true;}
- virtual bool visit(KisSelectionMask *) {return true;}
+ bool visit(KisSelectionMask *) override {return true;}
- virtual bool visit(KisColorizeMask *) {return true;}
+ bool visit(KisColorizeMask *) override {return true;}
private:
bool check(KisNode * node)
{
KisLayer *layer = dynamic_cast<KisLayer*>(node);
if (layer) {
if (layer->layerStyle()) {
m_count++;
}
}
visitAll(node);
return true;
}
quint32 m_count;
};
class PSDLayerStyleCheck : public KisExportCheckBase
{
public:
PSDLayerStyleCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning, true)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "The image contains <b>layer styles</b>. The layer styles will not be saved.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
KisLayerStyleVisitor v;
image->rootLayer()->accept(v);
return (v.count() > 0);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class PSDLayerStyleCheckFactory : public KisExportCheckFactory
{
public:
PSDLayerStyleCheckFactory() {}
- virtual ~PSDLayerStyleCheckFactory() {}
+ ~PSDLayerStyleCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new PSDLayerStyleCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "PSDLayerStyleCheck";
}
};
#endif // PSDLayerStyleCHECK_H
diff --git a/libs/impex/sRGBProfileCheck.h b/libs/impex/sRGBProfileCheck.h
index b8a41bd006..312b47df62 100644
--- a/libs/impex/sRGBProfileCheck.h
+++ b/libs/impex/sRGBProfileCheck.h
@@ -1,82 +1,82 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef sRGBProfileCheck_H
#define sRGBProfileCheck_H
#include "KisExportCheckRegistry.h"
#include <KoID.h>
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <KoColorProfile.h>
/**
* Check whether the image is sRGB, so the loss of the profile is not a problem
*/
class sRGBProfileCheck : public KisExportCheckBase
{
public:
sRGBProfileCheck(const QString &id, Level level, const QString &customWarning = QString())
: KisExportCheckBase(id, level, customWarning)
{
if (customWarning.isEmpty()) {
m_warning = i18nc("image conversion warning", "The image is not tagged as <b>non-linear gamma sRGB</b>. The image will be converted to sRGB.");
}
}
- bool checkNeeded(KisImageSP image) const
+ bool checkNeeded(KisImageSP image) const override
{
bool sRGB = image->colorSpace()->profile()->name().contains(QLatin1String("srgb"), Qt::CaseInsensitive);
// XXX: add an isLinear function to KoColorProfile that uses the information already available through lcms
bool linear = image->colorSpace()->profile()->name().contains(QLatin1String("g10"), Qt::CaseInsensitive);
return (!sRGB || linear);
}
- Level check(KisImageSP /*image*/) const
+ Level check(KisImageSP /*image*/) const override
{
return m_level;
}
};
class sRGBProfileCheckFactory : public KisExportCheckFactory
{
public:
sRGBProfileCheckFactory()
{
}
- virtual ~sRGBProfileCheckFactory() {}
+ ~sRGBProfileCheckFactory() override {}
- KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning)
+ KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
{
return new sRGBProfileCheck(id(), level, customWarning);
}
- QString id() const {
+ QString id() const override {
return "sRGBProfileCheck";
}
};
#endif // sRGBProfileCheck_H
diff --git a/libs/koplugin/KoPluginLoader.h b/libs/koplugin/KoPluginLoader.h
index 2331b13057..67f4d8e034 100644
--- a/libs/koplugin/KoPluginLoader.h
+++ b/libs/koplugin/KoPluginLoader.h
@@ -1,129 +1,129 @@
/*
* Copyright (c) 2006-2016 Boudewijn Rempt (boud@valdyas.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_PLUGIN_LOADER_H
#define KO_PLUGIN_LOADER_H
#include <QObject>
#include <QStringList>
#include "kritaplugin_export.h"
/**
* The pluginloader singleton is responsible for loading the plugins
* that it's asked to load. It keeps track of which servicetypes it
* has seen and doesn't reload them. The plugins need to inherit
* a QObject with a default constructor. Inside the default
* constructor you can create whatever object you want and add it to
* whatever registry you prefer. After having been constructed, your plugin
* will be deleted, so do all you need in the constructor. Things like
* adding a factory to a registry make sense there.
* Example header file;
@code
#include <QObject>
class MyPlugin : public QObject {
Q_OBJECT
public:
MyPlugin(QObject *parent, const QVariantList & );
~MyPlugin() {}
};
@endcode
* Example cpp file;
@code
#include "MyPlugin.h"
#include <kpluginfactory.h>
K_PLUGIN_FACTORY_WITH_JSON(MyPluginFactory, "myplugin.json", registerPlugin<MyPlugin>();)
MyPlugin::MyPlugin( QObject *parent, const QVariantList& ) : QObject(parent) {
// do stuff like creating a factory and adding it to the
// registry instance.
}
#include <MyPlugin.moc>
@endcode
*/
class KRITAPLUGIN_EXPORT KoPluginLoader : public QObject
{
Q_OBJECT
public:
/**
* Config object for load()
* It is possible to limit which plugins will be loaded in the KConfig configuration file by
* stating explicitly which plugins are wanted.
*/
struct PluginsConfig {
PluginsConfig() : group(0), whiteList(0), blacklist(0) {}
/**
* The properties are retrieved from the config using the following construct;
* /code
* KConfigGroup configGroup = KSharedConfig::openConfig()->group(config.group);
* /endcode
* For most cases you can pass the string "calligra" into this variable.
*/
const char * group;
/// This contains the variable name for the list of plugins (by library name) the user wants to load
const char * whiteList;
/// This contains the variable name for the list of plugins (by library name) that will not be loaded
const char * blacklist;
/// A registry can state it wants to load a default set of plugins instead of all plugins
/// when the application starts the first time. Append all such plugin (library) names to this list.
QStringList defaults;
};
- ~KoPluginLoader();
+ ~KoPluginLoader() override;
/**
* Return an instance of the KoPluginLoader
* Creates an instance if that has never happened before and returns the singleton instance.
*/
static KoPluginLoader * instance();
/**
* Load all plugins that conform to the versiontype and versionstring,
* for instance:
* KoPluginLoader::instance()->load("Calligra/Flake", "([X-Flake-PluginVersion] == 28)");
* This method allows you to optionally limit the plugins that are loaded by version, but also
* using a user configurable set of config options.
* If you pass a PluginsConfig struct only those plugins are loaded that are specified in the
* application config file. New plugins found since last start will be automatically loaded.
* @param serviceType The string used to identify the plugins.
* @param versionString A string match that allows you to check for a specific version
* @param config when passing a valid config only the wanted plugins are actually loaded
* @param cache: if true, the plugin will only be loaded more than once
* @return a list of services (by library name) that were not know in the config
*/
void load(const QString & serviceType, const QString & versionString = QString(), const PluginsConfig &config = PluginsConfig(), QObject* owner = 0, bool cache = true);
public:
/// DO NOT USE! Use instance() instead
// TODO: turn KoPluginLoader into namespace and do not expose object at all
KoPluginLoader();
private:
KoPluginLoader(const KoPluginLoader&);
KoPluginLoader operator=(const KoPluginLoader&);
private:
class Private;
Private * const d;
};
#endif // KO_PLUGIN_LOADER_H
diff --git a/libs/libkis/Action.h b/libs/libkis/Action.h
index 1f3dcd0a85..16006e097a 100644
--- a/libs/libkis/Action.h
+++ b/libs/libkis/Action.h
@@ -1,148 +1,148 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_ACTION_H
#define LIBKIS_ACTION_H
#include <kis_action.h>
#include "kritalibkis_export.h"
#include "libkis.h"
/**
* Action encapsulates a KisAction. By default, actions are put in the Tools/Scripts menu.
*/
class KRITALIBKIS_EXPORT Action : public QObject
{
Q_OBJECT
public:
/**
* @brief Action Create a new action object
* @param parent the parent if it's in a QObject hierarchy
*/
explicit Action(QObject *parent = 0);
/**
* @brief Action Create a new action object
* @param name the name of the action
* @param action the QAction it wraps
* @param parent the parent if it's in a QObject hierarchy
*/
Action(const QString &name, QAction *action, QObject *parent = 0);
- virtual ~Action();
+ ~Action() override;
bool operator==(const Action &other) const;
bool operator!=(const Action &other) const;
public Q_SLOTS:
/**
* @return the user-visible text of the action.
*/
QString text() const;
/**
* set the user-visible text of the action to @param text.
*/
void settext(QString text);
/**
* @return the internal name of the action.
*/
QString name() const;
/**
* set the name of the action to @param name. This is not the user-visible name, but the internal one
*/
void setName(QString name);
/**
* @return true if the action is checkable, false if it isn't*
*/
bool isCheckable() const;
/**
* Set the action action checkable if @param value is true, unchecked if it's false
*/
void setCheckable(bool value);
/**
* @return true if the action is checked, false if it isn't
*/
bool isChecked() const;
/**
* Set the action checked if @param value is true, unchecked if it's false
*/
void setChecked(bool value);
/**
* Return the action's shortcut as a string
*/
QString shortcut() const;
/**
* set the action's shortcut to the given string.
* @code
* action.setShortcut("CTRL+SHIFT+S")
* @endcode
*/
void setShortcut(QString value);
bool isVisible() const;
/**
* @brief setVisible determines whether the action will be visible in the scripting menu.
* @param value true if the action is to be shown in the menu, false otherwise
*/
void setVisible(bool value);
/**
* @return true if the action is enabled, false if not
*/
bool isEnabled() const;
/**
* Set the action enabled or disabled according to @param value
*/
void setEnabled(bool value);
/**
* Set the tooltip to the given @param tooltip
*/
void setToolTip(QString tooltip);
/**
* Trigger this action
*/
void trigger();
Q_SIGNALS:
/**
* Emitted whenever the action is triggered.
*/
void triggered(bool);
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_ACTION_H
diff --git a/libs/libkis/Canvas.h b/libs/libkis/Canvas.h
index 22e20f57a4..151b66446f 100644
--- a/libs/libkis/Canvas.h
+++ b/libs/libkis/Canvas.h
@@ -1,119 +1,119 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_CANVAS_H
#define LIBKIS_CANVAS_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
class KoCanvasBase;
/**
* Canvas wraps the canvas inside a view on an image/document.
* It is responsible for the view parameters of the document:
* zoom, rotation, mirror, wraparound and instant preview.
*/
class KRITALIBKIS_EXPORT Canvas : public QObject
{
Q_OBJECT
public:
explicit Canvas(KoCanvasBase *canvas, QObject *parent = 0);
- virtual ~Canvas();
+ ~Canvas() override;
bool operator==(const Canvas &other) const;
bool operator!=(const Canvas &other) const;
public Q_SLOTS:
/**
* @return the current zoomlevel. 1.0 is 100%.
*/
qreal zoomLevel() const;
/**
* @brief setZoomLevel set the zoomlevel to the given @param value. 1.0 is 100%.
*/
void setZoomLevel(qreal value);
/**
* @brief resetZoom set the zoomlevel to 100%
*/
void resetZoom();
/**
* @return the rotation of the canvas in degrees.
*/
qreal rotation() const;
/**
* @brief setRotation set the rotation of the canvas to the given @param angle in degrees.
*/
void setRotation(qreal angle);
/**
* @brief resetRotation reset the canvas rotation.
*/
void resetRotation();
/**
* @return return true if the canvas is mirrored, false otherwise.
*/
bool mirror() const;
/**
* @brief setMirror turn the canvas mirroring on or off depending on @param value
*/
void setMirror(bool value);
/**
* @return true if the canvas is in wraparound mode, false if not. Only when OpenGL is enabled,
* is wraparound mode available.
*/
bool wrapAroundMode() const;
/**
* @brief setWrapAroundMode set wraparound mode to @param enable
*/
void setWrapAroundMode(bool enable);
/**
* @return true if the canvas is in Instant Preview mode, false if not. Only when OpenGL is enabled,
* is Instant Preview mode available.
*/
bool levelOfDetailMode() const;
/**
* @brief setLevelOfDetailMode sets Instant Preview to @param enable
*/
void setLevelOfDetailMode(bool enable);
/**
* @return the view that holds this canvas
*/
View *view() const;
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_CANVAS_H
diff --git a/libs/libkis/Channel.h b/libs/libkis/Channel.h
index b5384c4c15..d100cae759 100644
--- a/libs/libkis/Channel.h
+++ b/libs/libkis/Channel.h
@@ -1,103 +1,103 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_CHANNEL_H
#define LIBKIS_CHANNEL_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
#include <KoChannelInfo.h>
#include <kis_node.h>
/**
* A Channel represents a singel channel in a Node. Krita does not
* use channels to store local selections: these are strictly the
* color and alpha channels.
*/
class KRITALIBKIS_EXPORT Channel : public QObject
{
Q_OBJECT
public:
explicit Channel(KisNodeSP node, KoChannelInfo *channel, QObject *parent = 0);
- virtual ~Channel();
+ ~Channel() override;
bool operator==(const Channel &other) const;
bool operator!=(const Channel &other) const;
/**
* @brief visible checks whether this channel is visible in the node
* @return the status of this channel
*/
bool visible() const;
/**
* @brief setvisible set the visibility of the channel to the given value.
*/
void setVisible(bool value);
/**
* @return the name of the channel
*/
QString name() const;
/**
* @returns the position of the first byte of the channel in the pixel
*/
int position() const;
/**
* @return the number of bytes this channel takes
*/
int channelSize() const;
/**
* @return the exact bounds of the channel. This can be smaller than the bounds of the Node this channel is part of.
*/
QRect bounds() const;
/**
* Read the values of the channel into the a byte array for each pixel in the rect from the Node this channel is part of, and returns it.
*
* Note that if Krita is built with OpenEXR and the Node has the 16 bits floating point channel depth type, Krita returns
* 32 bits float for every channel; the libkis scripting API does not support half.
*/
QByteArray pixelData(const QRect &rect) const;
/**
* @brief setPixelData writes the given data to the relevant channel in the Node. This is only possible for Nodes
* that have a paintDevice, so nothing will happen when trying to write to e.g. a group layer.
*
* Note that if Krita is built with OpenEXR and the Node has the 16 bits floating point channel depth type, Krita expects
* to be given a 4 byte, 32 bits float for every channel; the libkis scripting API does not support half.
*
* @param value a byte array with exactly enough bytes.
* @param rect the rectangle to write the bytes into
*/
void setPixelData(QByteArray value, const QRect &rect);
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_CHANNEL_H
diff --git a/libs/libkis/DockWidget.h b/libs/libkis/DockWidget.h
index e038268151..23f05da894 100644
--- a/libs/libkis/DockWidget.h
+++ b/libs/libkis/DockWidget.h
@@ -1,87 +1,87 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_DOCKWIDGET_H
#define LIBKIS_DOCKWIDGET_H
#include <QDockWidget>
#include "kritalibkis_export.h"
#include "libkis.h"
#include <KoCanvasObserverBase.h>
class KoCanvasBase;
/**
* DockWidget is the base class for custom Dockers. Dockers are created by a
* factory class which needs to be registered by calling Application.addDockWidgetFactory:
*
* @code
* class HelloDocker(DockWidget):
* def __init__(self):
* super().__init__()
* label = QLabel("Hello", self)
* self.setWidget(label)
* self.label = label
*
* def canvasChanged(self, canvas):
* self.label.setText("Hellodocker: canvas changed");
*
* Application.addDockWidgetFactory(DockWidgetFactory("hello", DockWidgetFactoryBase.DockRight, HelloDocker))
*
* @endcode
*
* One docker per window will be created, not one docker per canvas or view. When the user
* switches between views/canvases, canvasChanged will be called. You can override that
* method to reset your docker's internal state, if necessary.
*/
class KRITALIBKIS_EXPORT DockWidget : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
Q_DISABLE_COPY(DockWidget)
public:
explicit DockWidget();
- virtual ~DockWidget();
+ ~DockWidget() override;
protected Q_SLOTS: // Krita API
- virtual void setCanvas(KoCanvasBase* canvas);
- virtual void unsetCanvas();
+ void setCanvas(KoCanvasBase* canvas) override;
+ void unsetCanvas() override;
protected Q_SLOTS: // PyKrita API
/**
* @@return the canvas object that this docker is currently associated with
*/
Canvas* canvas() const;
/**
* @brief canvasChanged is called whenever the current canvas is changed
* in the mainwindow this dockwidget instance is shown in.
* @param canvas The new canvas.
*/
virtual void canvasChanged(Canvas *canvas) = 0;
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_DOCKWIDGET_H
diff --git a/libs/libkis/DockWidgetFactoryBase.h b/libs/libkis/DockWidgetFactoryBase.h
index 0eb2920933..578ebcdae1 100644
--- a/libs/libkis/DockWidgetFactoryBase.h
+++ b/libs/libkis/DockWidgetFactoryBase.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2015 Cyrille Berger <cberger@cberger.net>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_DOCKWIDGETFACTORY_H
#define LIBKIS_DOCKWIDGETFACTORY_H
#include <QString>
#include <KoDockFactoryBase.h>
#include "kritalibkis_export.h"
/**
* @brief The DockWidgetFactoryBase class is the base class for plugins that want
* to add a dock widget to every window. You do not need to implement this class
* yourself, but create a DockWidget implementation and then add the DockWidgetFactory
* to the Krita instance like this:
*
* @code
* class HelloDocker(DockWidget):
* def __init__(self):
* super().__init__()
* label = QLabel("Hello", self)
* self.setWidget(label)
* self.label = label
*
* def canvasChanged(self, canvas):
* self.label.setText("Hellodocker: canvas changed");
*
* Application.addDockWidgetFactory(DockWidgetFactory("hello", DockWidgetFactoryBase.DockRight, HelloDocker))
*
* @endcode
*/
class KRITALIBKIS_EXPORT DockWidgetFactoryBase : public KoDockFactoryBase
{
public:
DockWidgetFactoryBase(const QString& _id, DockPosition _dockPosition, bool _isCollapsable = true, bool _defaultCollapsed = false);
- virtual ~DockWidgetFactoryBase();
- virtual QString id() const;
- virtual DockPosition defaultDockPosition() const;
- virtual bool isCollapsable() const;
- virtual bool defaultCollapsed() const;
+ ~DockWidgetFactoryBase() override;
+ QString id() const override;
+ DockPosition defaultDockPosition() const override;
+ bool isCollapsable() const override;
+ bool defaultCollapsed() const override;
private:
QString m_id;
DockPosition m_dockPosition;
bool m_isCollapsable, m_defaultCollapsed;
};
#endif
diff --git a/libs/libkis/Document.h b/libs/libkis/Document.h
index 061bd3a2bf..54d365df8d 100644
--- a/libs/libkis/Document.h
+++ b/libs/libkis/Document.h
@@ -1,478 +1,478 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_DOCUMENT_H
#define LIBKIS_DOCUMENT_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
class KisDocument;
/**
* The Document class encapsulates a Krita Document/Image. A Krita document is an Image with
* a filename. Libkis does not differentiate between a document and an image, like Krita does
* internally.
*/
class KRITALIBKIS_EXPORT Document : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Document)
public:
explicit Document(KisDocument *document, QObject *parent = 0);
- virtual ~Document();
+ ~Document() override;
bool operator==(const Document &other) const;
bool operator!=(const Document &other) const;
public Q_SLOTS:
/**
* Batchmode means that no actions on the document should show dialogs or popups.
* @return true if the document is in batchmode.
*/
bool batchmode() const;
/**
* Set batchmode to @param value. If batchmode is true, then there should be no popups
* or dialogs shown to the user.
*/
void setBatchmode(bool value);
/**
* @brief activeNode retrieve the node that is currently active in the currently active window
* @return the active node. If there is no active window, the first child node is returned.
*/
Node* activeNode() const;
/**
* @brief setActiveNode make the given node active in the currently active view and window
* @param value the node to make active.
*/
void setActiveNode(Node* value);
/**
* @brief toplevelNodes return a list with all top level nodes in the image graph
*/
QList<Node*> topLevelNodes() const;
/**
* @brief nodeByName searches the node tree for a node with the given name and returns it
* @param name the name of the node
* @return the first node with the given name or 0 if no node is found
*/
Node *nodeByName(const QString &name) const;
/**
* colorDepth A string describing the color depth of the image:
* <ul>
* <li>U8: unsigned 8 bits integer, the most common type</li>
* <li>U16: unsigned 16 bits integer</li>
* <li>F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR</li>
* <li>F32: 32 bits floating point</li>
* </ul>
* @return the color depth.
*/
QString colorDepth() const;
/**
* @brief colorModel retrieve the current color model of this document:
* <ul>
* <li>A: Alpha mask</li>
* <li>RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)</li>
* <li>XYZA: XYZ with alpha channel</li>
* <li>LABA: LAB with alpha channel</li>
* <li>CMYKA: CMYK with alpha channel</li>
* <li>GRAYA: Gray with alpha channel</li>
* <li>YCbCrA: YCbCr with alpha channel</li>
* </ul>
* @return the internal color model string.
*/
QString colorModel() const;
/**
* @return the name of the current color profile
*/
QString colorProfile() const;
/**
* @brief setColorProfile set the color profile of the image to the given profile. The profile has to
* be registered with krita and be compatible with the current color model and depth; the image data
* is <i>not</i> converted.
* @param colorProfile
* @return false if the colorProfile name does not correspond to to a registered profile or if assigning
* the profile failed.
*/
bool setColorProfile(const QString &colorProfile);
/**
* @brief setColorSpace convert the nodes and the image to the given colorspace. The conversion is
* done with Perceptual as intent, High Quality and No LCMS Optimizations as flags and no blackpoint
* compensation.
*
* @param colorModel A string describing the color model of the image:
* <ul>
* <li>A: Alpha mask</li>
* <li>RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)</li>
* <li>XYZA: XYZ with alpha channel</li>
* <li>LABA: LAB with alpha channel</li>
* <li>CMYKA: CMYK with alpha channel</li>
* <li>GRAYA: Gray with alpha channel</li>
* <li>YCbCrA: YCbCr with alpha channel</li>
* </ul>
* @param colorDepth A string describing the color depth of the image:
* <ul>
* <li>U8: unsigned 8 bits integer, the most common type</li>
* <li>U16: unsigned 16 bits integer</li>
* <li>F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR</li>
* <li>F32: 32 bits floating point</li>
* </ul>
* @param colorProfile a valid color profile for this color model and color depth combination.
* @return false the combination of these arguments does not correspond to a colorspace.
*/
bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile);
/**
* @brief documentInfo creates and XML document representing document and author information.
* @return a string containing a valid XML document with the right information about the document
* and author. The DTD can be found here:
*
* https://phabricator.kde.org/source/krita/browse/master/krita/dtd/
*
* @code
* <?xml version="1.0" encoding="UTF-8"?>
* <!DOCTYPE document-info PUBLIC '-//KDE//DTD document-info 1.1//EN' 'http://www.calligra.org/DTD/document-info-1.1.dtd'>
* <document-info xmlns="http://www.calligra.org/DTD/document-info">
* <about>
* <title>My Document</title>
* <description></description>
* <subject></subject>
* <abstract><![CDATA[]]></abstract>
* <keyword></keyword>
* <initial-creator>Unknown</initial-creator>
* <editing-cycles>1</editing-cycles>
* <editing-time>35</editing-time>
* <date>2017-02-27T20:15:09</date>
* <creation-date>2017-02-27T20:14:33</creation-date>
* <language></language>
* </about>
* <author>
* <full-name>Boudewijn Rempt</full-name>
* <initial></initial>
* <author-title></author-title>
* <email></email>
* <telephone></telephone>
* <telephone-work></telephone-work>
* <fax></fax>
* <country></country>
* <postal-code></postal-code>
* <city></city>
* <street></street>
* <position></position>
* <company></company>
* </author>
* </document-info>
* @endcode
*
*/
QString documentInfo() const;
/**
* @brief setDocumentInfo set the Document information to the information contained in document
* @param document A string containing a valid XML document that conforms to the document-info DTD
* that can be found here:
*
* https://phabricator.kde.org/source/krita/browse/master/krita/dtd/
*/
void setDocumentInfo(const QString &document);
/**
* @return the full path to the document, if it has been set.
*/
QString fileName() const;
/**
* @brief setFileName set the full path of the document to @param value
*/
void setFileName(QString value);
/**
* @return the height of the image in pixels
*/
int height() const;
/**
* @brief setHeight resize the document to @param value height. This is a canvas resize, not a scale.
*/
void setHeight(int value);
/**
* @return the name of the document. This is the title field in the @see documentInfo
*/
QString name() const;
/**
* @brief setName sets the name of the document to @param value. This is the title field in the @see documentInfo
*/
void setName(QString value);
/**
* @return the resolution in pixels per inch
*/
int resolution() const;
/**
* @brief setResolution set the resolution of the image; this does not scale the image
* @param value the resolution in pixels per inch
*/
void setResolution(int value);
/**
* @brief rootNode the root node is the invisible group layer that contains the entire node
* hierarchy.
* @return the root of the image
*/
Node* rootNode() const;
/**
* @brief selection Create a Selection object around the global selection, if there is one.
* @return the global selection or None if there is no global selection.
*/
Selection* selection() const;
/**
* @brief setSelection set or replace the global selection
* @param value a valid selection object.
*/
void setSelection(Selection* value);
/**
* @return the width of the image in pixels.
*/
int width() const;
/**
* @brief setWidth resize the document to @param value width. This is a canvas resize, not a scale.
*/
void setWidth(int value);
/**
* @return xRes the horizontal resolution of the image in pixels per pt (there are 72 pts to an inch)
*/
double xRes() const;
/**
* @brief setXRes set the horizontal resolution of the image to xRes in pixels per pt. (there are 72 pts to an inch)
*/
void setXRes(double xRes) const;
/**
* @return yRes the vertical resolution of the image in pixels per pt (there are 72 pts to an inch)
*/
double yRes() const;
/**
* @brief setYRes set the vertical resolution of the image to yRes in pixels per pt. (there are 72 pts to an inch)
*/
void setYRes(double yRes) const;
/**
* @brief pixelData reads the given rectangle from the image projection and returns it as a byte
* array. The pixel data starts top-left, and is ordered row-first.
*
* The byte array can be interpreted as follows: 8 bits images have one byte per channel,
* and as many bytes as there are channels. 16 bits integer images have two bytes per channel,
* representing an unsigned short. 16 bits float images have two bytes per channel, representing
* a half, or 16 bits float. 32 bits float images have four bytes per channel, representing a
* float.
*
* You can read outside the image boundaries; those pixels will be transparent black.
*
* The order of channels is:
*
* <ul>
* <li>Integer RGBA: Blue, Green, Red, Alpha
* <li>Float RGBA: Red, Green, Blue, Alpha
* <li>LabA: L, a, b, Alpha
* <li>CMYKA: Cyan, Magenta, Yellow, Key, Alpha
* <li>XYZA: X, Y, Z, A
* <li>YCbCrA: Y, Cb, Cr, Alpha
* </ul>
*
* The byte array is a copy of the original image data. In Python, you can use bytes, bytearray
* and the struct module to interpret the data and construct, for instance, a Pillow Image object.
*
* @param x x position from where to start reading
* @param y y position from where to start reading
* @param w row length to read
* @param h number of rows to read
* @return a QByteArray with the pixel data. The byte array may be empty.
*/
QByteArray pixelData(int x, int y, int w, int h) const;
/**
* @brief close Close the document: remove it from Krita's internal list of documents and
* close all views. If the document is modified, you should save it first. There will be
* no prompt for saving.
* @return true if the document is closed.
*/
bool close();
/**
* @brief crop the image to rectangle described by @param x, @param y,
* @param w and @param h
*/
void crop(int x, int y, int w, int h);
/**
* @brief exportImage export the image, without changing its URL to the given path.
* @param filename the full path to which the image is to be saved
* @param exportConfiguration a configuration object appropriate to the file format
* @return true if the export succeeded, false if it failed.
*/
bool exportImage(const QString &filename, const InfoObject &exportConfiguration);
/**
* @brief flatten all layers in the image
*/
void flatten();
/**
* @brief resizeImage resize the image to the given width and height.
* @param w the new width
* @param h the new height
*/
void resizeImage(int w, int h);
/**
* @brief save the image to its currently set path. The modified flag of the
* document will be reset
* @return true if saving succeeded, false otherwise.
*/
bool save();
/**
* @brief saveAs save the document under the @param filename. The document's
* filename will be reset to @param filename.
* @param filename the new filename (full path) for the document
* @return true if saving succeeded, false otherwise.
*/
bool saveAs(const QString &filename);
/**
* @brief createNode create a new node of the given type. The node is not added
* to the node hierarchy; you need to do that by finding the right parent node,
* getting its list of child nodes and adding the node in the right place, then
* calling Node::SetChildNodes
*
* @param name The name of the node
*
* @param nodeType The type of the node. Valid types are:
* <ul>
* <li>paintlayer
* <li>grouplayer
* <li>filelayer
* <li>filterlayer
* <li>filllayer
* <li>clonelayer
* <li>vectorlayer
* <li>transparencymask
* <li>filtermask
* <li>transformmask
* <li>selectionmask
* </ul>
*
* When relevant, the new Node will have the colorspace of the image by default;
* that can be changed with Node::setColorSpace.
*
* The settings and selections for relevant layer and mask types can also be set
* after the Node has been created.
*
* @return the new Node.
*/
Node* createNode(const QString &name, const QString &nodeType);
/**
* @brief projection creates a QImage from the rendered image or
* a cutout rectangle.
*/
QImage projection(int x = 0, int y = 0, int w = 0, int h = 0) const;
/**
* @brief thumbnail create a thumbnail of the given dimensions.
*
* If the requested size is too big a null QImage is created.
*
* @return a QImage representing the layer contents.
*/
QImage thumbnail(int w, int h) const;
/**
* Why this should be used, When it should be used, How it should be used,
* and warnings about when not.
*/
void lock();
/**
* Why this should be used, When it should be used, How it should be used,
* and warnings about when not.
*/
void unlock();
/**
* Why this should be used, When it should be used, How it should be used,
* and warnings about when not.
*/
void waitForDone();
/**
* Why this should be used, When it should be used, How it should be used,
* and warnings about when not.
*/
bool tryBarrierLock();
/**
* Why this should be used, When it should be used, How it should be used,
* and warnings about when not.
*/
bool isIdle();
/**
* Starts a synchronous recomposition of the projection: everything will
* wait until the image is fully recomputed.
*/
void refreshProjection();
private:
friend class Krita;
friend class Window;
friend class Filter;
QPointer<KisDocument> document() const;
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_DOCUMENT_H
diff --git a/libs/libkis/Extension.h b/libs/libkis/Extension.h
index 1bb43ea4b5..fc9d76c47e 100644
--- a/libs/libkis/Extension.h
+++ b/libs/libkis/Extension.h
@@ -1,78 +1,78 @@
/*
* Copyright (c) 2015 Cyrille Berger <cberger@cberger.net>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_EXTENSION_H
#define LIBKIS_EXTENSION_H
#include "kritalibkis_export.h"
#include <QObject>
/**
* An Extension is the base for classes that extend Krita. An Extension
* is loaded on startup, when the setup() method will be executed.
*
* The extension instance should be added to the Krita Application object
* using Krita.instance().addViewExtension or Application.addViewExtension
* or Scripter.addViewExtension.
*
* Example:
*
* @code
* import sys
* from PyQt5.QtGui import *
* from PyQt5.QtWidgets import *
* from krita import *
* class HelloExtension(Extension):
*
* def __init__(self, parent):
* super().__init__(parent)
*
* def hello(self):
* QMessageBox.information(QWidget(), "Test", "Hello! This is Krita " + Application.version())
*
* def setup(self):
* qDebug("Hello Setup")
* action = Krita.instance().createAction("hello")
* action.triggered.connect(self.hello)
*
* Scripter.addExtension(HelloExtension(Krita.instance()))
*
* @endcode
*/
class KRITALIBKIS_EXPORT Extension : public QObject
{
Q_OBJECT
public:
/**
* Create a new extension. The extension will be
* owned by @param parent.
*/
explicit Extension(QObject *parent = 0);
- virtual ~Extension();
+ ~Extension() override;
/**
* Override this function to setup your Extension. You can use it to add
* Actions to the action collection or integrate in any other way with
* the application.
*/
virtual void setup() = 0;
};
#endif
diff --git a/libs/libkis/Filter.h b/libs/libkis/Filter.h
index 1aa75e41cc..35652c0fee 100644
--- a/libs/libkis/Filter.h
+++ b/libs/libkis/Filter.h
@@ -1,108 +1,108 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_FILTER_H
#define LIBKIS_FILTER_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
/**
* Filter: represents a filter and its configuration. A filter is identified by
* an internal name. The configuration for each filter is defined as an InfoObject:
* a map of name and value pairs.
*
* Currently available filters are:
*
* 'autocontrast', 'blur', 'bottom edge detections', 'brightnesscontrast', 'burn', 'colorbalance', 'colortoalpha', 'colortransfer',
* 'desaturate', 'dodge', 'emboss', 'emboss all directions', 'emboss horizontal and vertical', 'emboss horizontal only',
* 'emboss laplascian', 'emboss vertical only', 'gaussian blur', 'gaussiannoisereducer', 'gradientmap', 'halftone', 'hsvadjustment',
* 'indexcolors', 'invert', 'left edge detections', 'lens blur', 'levels', 'maximize', 'mean removal', 'minimize', 'motion blur',
* 'noise', 'normalize', 'oilpaint', 'perchannel', 'phongbumpmap', 'pixelize', 'posterize', 'raindrops', 'randompick',
* 'right edge detections', 'roundcorners', 'sharpen', 'smalltiles', 'sobel', 'threshold', 'top edge detections', 'unsharp',
* 'wave', 'waveletnoisereducer']
*/
class KRITALIBKIS_EXPORT Filter : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Filter)
public:
/**
* @brief Filter: create an empty filter object. Until a name is set, the filter cannot
* be applied.
*/
explicit Filter();
- virtual ~Filter();
+ ~Filter() override;
bool operator==(const Filter &other) const;
bool operator!=(const Filter &other) const;
public Q_SLOTS:
/**
* @brief name the internal name of this filter.
* @return the name.
*/
QString name() const;
/**
* @brief setName set the filter's name to the given name.
*/
void setName(const QString &name);
/**
* @return the configuration object for the filter
*/
InfoObject* configuration() const;
/**
* @brief setConfiguration set the configuration object for the filter
*/
void setConfiguration(InfoObject* value);
/**
* @brief Apply the filter to the given node.
* @param node the node to apply the filter to
* @params x, y, w, h: describe the rectangle the filter should be apply.
* This is always in image pixel coordinates and not relative to the x, y
* of the node.
* @return true if the filter was applied succesfully, or
* false if the filter could not be applied because the node is locked or
* does not have an editable paint device.
*/
bool apply(Node *node, int x, int y, int w, int h);
/**
* @brief startFilter starts the given filter on the given node.
*
* @param node the node to apply the filter to
* @params x, y, w, h: describe the rectangle the filter should be apply.
* This is always in image pixel coordinates and not relative to the x, y
* of the node.
*/
bool startFilter(Node *node, int x, int y, int w, int h);
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_FILTER_H
diff --git a/libs/libkis/InfoObject.h b/libs/libkis/InfoObject.h
index b06129e3f5..265da90013 100644
--- a/libs/libkis/InfoObject.h
+++ b/libs/libkis/InfoObject.h
@@ -1,83 +1,83 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_INFOOBJECT_H
#define LIBKIS_INFOOBJECT_H
#include <QObject>
#include <kis_properties_configuration.h>
#include "kritalibkis_export.h"
#include "libkis.h"
/**
* InfoObject wrap a properties map. These maps can be used to set the
* configuration for filters.
*/
class KRITALIBKIS_EXPORT InfoObject : public QObject
{
Q_OBJECT
public:
InfoObject(KisPropertiesConfigurationSP configuration);
/**
* Create a new, empty InfoObject.
*/
explicit InfoObject(QObject *parent = 0);
- virtual ~InfoObject();
+ ~InfoObject() override;
bool operator==(const InfoObject &other) const;
bool operator!=(const InfoObject &other) const;
/**
* Return all properties this InfoObject manages.
*/
QMap<QString, QVariant> properties() const;
/**
* Add all properties in the @param propertyMap to this InfoObject
*/
void setProperties(QMap<QString, QVariant> proprertyMap);
public Q_SLOTS:
/**
* set the property identified by @key to @value
*/
void setProperty(const QString &key, QVariant value);
/**
* return the value for the property identified by key, or None if there is no suck key.
*/
QVariant property(const QString &key);
private:
friend class Filter;
friend class Document;
/**
* @brief configuration gives access to the internal configuration object. Must
* be used used internally in libkis
* @return the internal configuration object.
*/
KisPropertiesConfigurationSP configuration() const;
struct Private;
Private *d;
};
#endif // LIBKIS_INFOOBJECT_H
diff --git a/libs/libkis/Krita.h b/libs/libkis/Krita.h
index 42c65d7730..183e3d08ce 100644
--- a/libs/libkis/Krita.h
+++ b/libs/libkis/Krita.h
@@ -1,293 +1,293 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_KRITA_H
#define LIBKIS_KRITA_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
#include "Extension.h"
#include "Document.h"
#include "Window.h"
#include "View.h"
#include "Action.h"
#include "Notifier.h"
class QAction;
/**
* Krita is a singleton class that offers the root access to the Krita object hierarchy.
*
* The Krita.instance() is aliased as two builtins: Scripter and Application.
*/
class KRITALIBKIS_EXPORT Krita : public QObject
{
Q_OBJECT
public:
explicit Krita(QObject *parent = 0);
- virtual ~Krita();
+ ~Krita() override;
public Q_SLOTS:
/**
* @return the currently active document, if there is one.
*/
Document* activeDocument() const;
/**
* @brief setActiveDocument activates the first view that shows the given document
* @param value the document we want to activate
*/
void setActiveDocument(Document* value);
/**
* @brief batchmode determines whether the script is run in batch mode. If batchmode
* is true, scripts should now show messageboxes or dialog boxes.
*
* Note that this separate from Document.setBatchmode(), which determines whether
* export/save option dialogs are shown.
*
* @return true if the script is run in batchmode
*/
bool batchmode() const;
/**
* @brief setBatchmode sets the the batchmode to @param value; if true, scripts should
* not show dialogs or messageboxes.
*/
void setBatchmode(bool value);
/**
* @return return a list of all actions for the currently active mainWindow.
*/
QList<Action*> actions() const;
/**
* @return the action that has been registered under the given name, or 0 if no such action exists.
*/
Action *action(const QString &name) const;
/**
* @return a list of all open Documents
*/
QList<Document*> documents() const;
/**
* @brief Filters are identified by an internal name. This function returns a list
* of all existing registered filters.
* @return a list of all registered filters
*/
QStringList filters() const;
/**
* @brief filter construct a Filter object with a default configuration.
* @param name the name of the filter. Use Krita.instance().filters() to get
* a list of all possible filters.
* @return the filter or None if there is no such filter.
*/
Filter *filter(const QString &name) const;
/**
* @brief profiles creates a list with the names of all color profiles compatible
* with the given color model and color depth.
* @param colorModel A string describing the color model of the image:
* <ul>
* <li>A: Alpha mask</li>
* <li>RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)</li>
* <li>XYZA: XYZ with alpha channel</li>
* <li>LABA: LAB with alpha channel</li>
* <li>CMYKA: CMYK with alpha channel</li>
* <li>GRAYA: Gray with alpha channel</li>
* <li>YCbCrA: YCbCr with alpha channel</li>
* </ul>
* @param colorDepth A string describing the color depth of the image:
* <ul>
* <li>U8: unsigned 8 bits integer, the most common type</li>
* <li>U16: unsigned 16 bits integer</li>
* <li>F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR</li>
* <li>F32: 32 bits floating point</li>
* </ul>
* @return a list with valid names
*/
QStringList profiles(const QString &colorModel, const QString &colorDepth) const;
/**
* @brief addProfile load the given profile into the profile registry.
* @param profilePath the path to the profile.
* @return true if adding the profile succeeded.
*/
bool addProfile(const QString &profilePath);
/**
* @brief notifier the Notifier singleton emits signals when documents are opened and
* closed, the configuration changes, views are opened and closed or windows are opened.
* @return the notifier object
*/
Notifier* notifier() const;
/**
* @brief version Determine the version of Krita
*
* Usage: print(Application.version ())
*
* @return the version string including git sha1 if Krita was built from git
*/
QString version() const;
/**
* @return a list of all views. A Document can be shown in more than one view.
*/
QList<View*> views() const;
/**
* @return the currently active window or None if there is no window
*/
Window *activeWindow() const;
/**
* @return a list of all windows
*/
QList<Window *> windows() const;
/**
* @brief resources returns a list of Resource objects of the given type
* @param type Valid types are:
*
* <ul>
* <li>pattern</li>
* <li>gradient</li>
* <li>brush</li>
* <li>preset</li>
* <li>palette</li>
* <li>workspace</li>
* </ul>
*/
QMap<QString, Resource*> resources(const QString &type) const;
/**
* @brief createDocument creates a new document and image and registers the document with the Krita application.
*
* The document will have one transparent layer.
*
* @param width the width in pixels
* @param height the height in pixels
* @param name the name of the image (not the filename of the document)
* @param colorModel A string describing the color model of the image:
* <ul>
* <li>A: Alpha mask</li>
* <li>RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)</li>
* <li>XYZA: XYZ with alpha channel</li>
* <li>LABA: LAB with alpha channel</li>
* <li>CMYKA: CMYK with alpha channel</li>
* <li>GRAYA: Gray with alpha channel</li>
* <li>YCbCrA: YCbCr with alpha channel</li>
* </ul>
* @param colorDepth A string describing the color depth of the image:
* <ul>
* <li>U8: unsigned 8 bits integer, the most common type</li>
* <li>U16: unsigned 16 bits integer</li>
* <li>F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR</li>
* <li>F32: 32 bits floating point</li>
* </ul>
* @param profile The name of an icc profile that is known to Krita. If an empty string is passed, the default is
* taken.
* @return the created document.
*/
Document *createDocument(int width, int height, const QString &name, const QString &colorModel, const QString &colorDepth, const QString &profile);
/**
* @brief openDocument creates a new Document, registers it with the Krita application and loads the given file.
* @param filename the file to open in the document
* @return the document
*/
Document *openDocument(const QString &filename);
/**
* @brief openWindow create a new main window. The window is not shown by default.
*/
Window *openWindow();
/**
* @brief createAction creates an action with the given text and passes it to Krita. Every newly created
* mainwindow will create an instance of this action.
* @param text the user-visible text
* @return the Action you can connect a slot to.
*/
Action *createAction(const QString &text);
/**
* @brief addExtension add the given plugin to Krita. There will be a single instance of each Extension in the Krita process.
* @param extension the extension to add.
*/
void addExtension(Extension* extension);
/**
* return a list with all registered extension objects.
*/
QList<Extension*> extensions();
/**
* @brief addDockWidgetFactory Add the given docker factory to the application. For scripts
* loaded on startup, this means that every window will have one of the dockers created by the
* factory.
* @param factory The factory object.
*/
void addDockWidgetFactory(DockWidgetFactoryBase* factory );
/**
* @brief writeSetting write the given setting under the given name to the kritarc file in
* the given settings group.
* @param group The group the setting belongs to. If empty, then the setting is written in the
* general section
* @param name The name of the setting
* @param value The value of the setting. Script settings are always written as strings.
*/
void writeSetting(const QString &group, const QString &name, const QString &value);
/**
* @brief readSetting read the given setting value from the kritarc file.
* @param group The group the setting is part of. If empty, then the setting is read from
* the general group.
* @param name The name of the setting
* @param defaultValue The default value of the setting
* @return a string representing the setting.
*/
QString readSetting(const QString &group, const QString &name, const QString &defaultValue);
/**
* @brief instance retrieve the singleton instance of the Application object.
*/
static Krita* instance();
// Internal only: for use with mikro.py
static QObject *fromVariant(const QVariant& v);
private:
struct Private;
Private *const d;
static Krita* s_instance;
};
Q_DECLARE_METATYPE(Notifier*);
#endif // LIBKIS_KRITA_H
diff --git a/libs/libkis/Node.h b/libs/libkis/Node.h
index 9fb39a78cb..f05103cb3c 100644
--- a/libs/libkis/Node.h
+++ b/libs/libkis/Node.h
@@ -1,471 +1,471 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_NODE_H
#define LIBKIS_NODE_H
#include <QObject>
#include <kis_types.h>
#include "kritalibkis_export.h"
#include "libkis.h"
/**
* Node represents a layer or mask in a Krita image's Node hierarchy. Group layers can contain
* other layers and masks; layers can contain masks.
*
*/
class KRITALIBKIS_EXPORT Node : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Node)
public:
explicit Node(KisImageSP image, KisNodeSP node, QObject *parent = 0);
- virtual ~Node();
+ ~Node() override;
bool operator==(const Node &other) const;
bool operator!=(const Node &other) const;
public Q_SLOTS:
/**
* @brief alphaLocked checks whether the node is a paint layer and returns whether it is alpha locked
* @return whether the paint layer is alpha locked, or false if the node is not a paint layer
*/
bool alphaLocked() const;
/**
* @brief setAlphaLocked set the layer to value if the the node is paint layer.
*/
void setAlphaLocked(bool value);
/**
* @return the blending mode of the layer. The values of the blending modes are defined in @see KoCompositeOpRegistry.h
*/
QString blendingMode() const;
/**
* @brief setBlendingMode set the blending mode of the node to the given value
* @param value one of the string values from @see KoCompositeOpRegistry.h
*/
void setBlendingMode(QString value);
/**
* @brief channels creates a list of Channel objects that can be used individually to
* show or hide certain channels, and to retrieve the contents of each channel in a
* node separately.
*
* Only layers have channels, masks do not, and calling channels on a Node that is a mask
* will return an empty list.
*
* @return the list of channels ordered in by position of the channels in pixel position
*/
QList<Channel*> channels() const;
/**
* Return a list of child nodes of the current node. The nodes are ordered from the bottommost up.
* The function is not recursive.
*/
QList<Node*> childNodes() const;
/**
* @brief addChildNode adds the given node in the list of children.
* @param child the node to be added
* @param above the node above which this node will be placed
* @return false if adding the node failed
*/
bool addChildNode(Node *child, Node *above);
/**
* @brief removeChildNode removes the given node from the list of children.
* @param child the node to be removed
*/
bool removeChildNode(Node *child);
/**
* @brief setChildNodes this replaces the existing set of child nodes with the new set.
* @param nodes The list of nodes that will become children, bottom-up -- the first node,
* is the bottom-most node in the stack.
*/
void setChildNodes(QList<Node*> nodes);
/**
* colorDepth A string describing the color depth of the image:
* <ul>
* <li>U8: unsigned 8 bits integer, the most common type</li>
* <li>U16: unsigned 16 bits integer</li>
* <li>F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR</li>
* <li>F32: 32 bits floating point</li>
* </ul>
* @return the color depth.
*/
QString colorDepth() const;
/**
* @brief colorModel retrieve the current color model of this document:
* <ul>
* <li>A: Alpha mask</li>
* <li>RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)</li>
* <li>XYZA: XYZ with alpha channel</li>
* <li>LABA: LAB with alpha channel</li>
* <li>CMYKA: CMYK with alpha channel</li>
* <li>GRAYA: Gray with alpha channel</li>
* <li>YCbCrA: YCbCr with alpha channel</li>
* </ul>
* @return the internal color model string.
*/
QString colorModel() const;
/**
* @return the name of the current color profile
*/
QString colorProfile() const;
/**
* @brief setColorProfile set the color profile of the image to the given profile. The profile has to
* be registered with krita and be compatible with the current color model and depth; the image data
* is <i>not</i> converted.
* @param colorProfile
* @return if assigining the colorprofiel worked
*/
bool setColorProfile(const QString &colorProfile);
/**
* @brief setColorSpace convert the node to the given colorspace
* @param colorModel A string describing the color model of the node:
* <ul>
* <li>A: Alpha mask</li>
* <li>RGBA: RGB with alpha channel (The actual order of channels is most often BGR!)</li>
* <li>XYZA: XYZ with alpha channel</li>
* <li>LABA: LAB with alpha channel</li>
* <li>CMYKA: CMYK with alpha channel</li>
* <li>GRAYA: Gray with alpha channel</li>
* <li>YCbCrA: YCbCr with alpha channel</li>
* </ul>
* @param colorDepth A string describing the color depth of the image:
* <ul>
* <li>U8: unsigned 8 bits integer, the most common type</li>
* <li>U16: unsigned 16 bits integer</li>
* <li>F16: half, 16 bits floating point. Only available if Krita was built with OpenEXR</li>
* <li>F32: 32 bits floating point</li>
* </ul>
* @param colorProfile a valid color profile for this color model and color depth combination.
*/
bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile);
/**
* @brief Krita layers can be animated, i.e., have frames.
* @return return true if the layer has frames. Currently, the scripting framework
* does not give access to the animation features.
*/
bool animated() const;
/**
* @brief enableAnimation make the current layer animated, so it can have frames.
*/
void enableAnimation() const;
/**
* Sets the state of the node to the value of @param collapsed
*/
void setCollapsed(bool collapsed);
/**
* returns the collapsed state of this node
*/
bool collapsed() const;
/**
* Sets a color label index associated to the layer. The actual
* color of the label and the number of available colors is
* defined by Krita GUI configuration.
*/
int colorLabel() const;
/**
* @brief setColorLabel sets a color label index associated to the layer. The actual
* color of the label and the number of available colors is
* defined by Krita GUI configuration.
* @param index an integer corresponding to the set of available color labels.
*/
void setColorLabel(int index);
/**
* @brief inheritAlpha checks whether this node has the inherits alpha flag set
* @return true if the Inherit Alpha is set
*/
bool inheritAlpha() const;
/**
* set the Inherit Alpha flag to the given value
*/
void setInheritAlpha(bool value);
/**
* @brief locked checkes whether the Node is locked. A locked node cannot be changed.
* @return true if the Node is locked, false if it hasn't been locked.
*/
bool locked() const;
/**
* set the Locked flag to the give value
*/
void setLocked(bool value);
/**
* @return the user-visible name of this node.
*/
QString name() const;
/**
* rename the Node to the given name
*/
void setName(QString name);
/**
* return the opacity of the Node. The opacity is a value between 0 and 255.
*/
int opacity() const;
/**
* set the opacity of the Node to the given value. The opacity is a value between 0 and 255.
*/
void setOpacity(int value);
/**
* return the Node that is the parent of the current Node, or 0 if this is the root Node.
*/
Node* parentNode() const;
/**
* @brief type Krita has several types of nodes, split in layers and masks. Group
* layers can contain other layers, any layer can contain masks.
*
* @return The type of the node. Valid types are:
* <ul>
* <li>paintlayer
* <li>grouplayer
* <li>filelayer
* <li>filterlayer
* <li>filllayer
* <li>clonelayer
* <li>vectorlayer
* <li>transparencymask
* <li>filtermask
* <li>transformmask
* <li>selectionmask
* <li>colorizemask
* </ul>
*
* If the Node object isn't wrapping a valid Krita layer or mask object, and
* empty string is returned.
*/
QString type() const;
/**
* Check whether the current Node is visible in the layer stack
*/
bool visible() const;
/**
* Set the visibility of the current node to @param visible
*/
void setVisible(bool visible);
/**
* @brief pixelData reads the given rectangle from the Node's paintable pixels, if those
* exist, and returns it as a byte array. The pixel data starts top-left, and is ordered row-first.
*
* The byte array can be interpreted as follows: 8 bits images have one byte per channel,
* and as many bytes as there are channels. 16 bits integer images have two bytes per channel,
* representing an unsigned short. 16 bits float images have two bytes per channel, representing
* a half, or 16 bits float. 32 bits float images have four bytes per channel, representing a
* float.
*
* You can read outside the node boundaries; those pixels will be transparent black.
*
* The order of channels is:
*
* <ul>
* <li>Integer RGBA: Blue, Green, Red, Alpha
* <li>Float RGBA: Red, Green, Blue, Alpha
* <li>GrayA: Gray, Alpha
* <li>Selection: selectedness
* <li>LabA: L, a, b, Alpha
* <li>CMYKA: Cyan, Magenta, Yellow, Key, Alpha
* <li>XYZA: X, Y, Z, A
* <li>YCbCrA: Y, Cb, Cr, Alpha
* </ul>
*
* The byte array is a copy of the original node data. In Python, you can use bytes, bytearray
* and the struct module to interpret the data and construct, for instance, a Pillow Image object.
*
* If you read the pixeldata of a mask, a filter or generator layer, you get the selection bytes,
* which is one channel with values in the range from 0..255.
*
* If you want to change the pixels of a node you can write the pixels back after manipulation
* with setPixelData(). This will only succeed on nodes with writable pixel data, e.g not on groups
* or file layers.
*
* @param x x position from where to start reading
* @param y y position from where to start reading
* @param w row length to read
* @param h number of rows to read
* @return a QByteArray with the pixel data. The byte array may be empty.
*/
QByteArray pixelData(int x, int y, int w, int h) const;
/**
* @brief projectionPixelData reads the given rectangle from the Node's projection (that is, what the node
* looks like after all sub-Nodes (like layers in a group or masks on a layer) have been applied,
* and returns it as a byte array. The pixel data starts top-left, and is ordered row-first.
*
* The byte array can be interpreted as follows: 8 bits images have one byte per channel,
* and as many bytes as there are channels. 16 bits integer images have two bytes per channel,
* representing an unsigned short. 16 bits float images have two bytes per channel, representing
* a half, or 16 bits float. 32 bits float images have four bytes per channel, representing a
* float.
*
* You can read outside the node boundaries; those pixels will be transparent black.
*
* The order of channels is:
*
* <ul>
* <li>Integer RGBA: Blue, Green, Red, Alpha
* <li>Float RGBA: Red, Green, Blue, Alpha
* <li>GrayA: Gray, Alpha
* <li>Selection: selectedness
* <li>LabA: L, a, b, Alpha
* <li>CMYKA: Cyan, Magenta, Yellow, Key, Alpha
* <li>XYZA: X, Y, Z, A
* <li>YCbCrA: Y, Cb, Cr, Alpha
* </ul>
*
* The byte array is a copy of the original node data. In Python, you can use bytes, bytearray
* and the struct module to interpret the data and construct, for instance, a Pillow Image object.
*
* If you read the projection of a mask, you get the selection bytes, which is one channel with
* values in the range from 0..255.
*
* If you want to change the pixels of a node you can write the pixels back after manipulation
* with setPixelData(). This will only succeed on nodes with writable pixel data, e.g not on groups
* or file layers.
*
* @param x x position from where to start reading
* @param y y position from where to start reading
* @param w row length to read
* @param h number of rows to read
* @return a QByteArray with the pixel data. The byte array may be empty.
*/
QByteArray projectionPixelData(int x, int y, int w, int h) const;
/**
* @brief setPixelData writes the given bytes, of which there must be enough, into the
* Node, if the Node has writable pixel data:
*
* <ul>
* <li>paint layer: the layer's original pixels are overwritten
* <li>filter layer, generator layer, any mask: the embedded selection's pixels are overwritten.
* <b>Note:</b> for these
* </ul>
*
* File layers, Group layers, Clone layers cannot be written to. Calling setPixelData on
* those layer types will silently do nothing.
*
* @param value the byte array representing the pixels. There must be enough bytes available.
* Krita will take the raw pointer from the QByteArray and start reading, not stopping before
* (number of channels * size of channel * w * h) bytes are read.
*
* @param x the x position to start writing from
* @param y the y position to start writing from
* @param w the width of each row
* @param h the number of rows to write
*/
void setPixelData(QByteArray value, int x, int y, int w, int h);
/**
* @brief bounds return the exact bounds of the node's paint device
* @return the bounds, or an empty QRect if the node has no paint device or is empty.
*/
QRect bounds() const;
/**
* move the pixels to the given x, y location in the image coordinate space.
*/
void move(int x, int y);
/**
* @brief position returns the position of the paint device of this node
* @return the top-left position of the node
*/
QPoint position() const;
/**
* @brief remove removes this node from its parent image.
*/
bool remove();
/**
* @brief duplicate returns a full copy of the current node. The node is not inserted in the graphc
* @return a valid Node object or 0 if the node couldn't be duplicated.
*/
Node* duplicate();
/**
* @brief save exports the given node with this filename. The extension of the filename determins the filetype.
* @param filename the filename including extension
* @param xRes the horizontal resolution in pixels per pt (there are 72 pts in an inch)
* @param yRes the horizontal resolution in pixels per pt (there are 72 pts in an inch)
* @return true if saving succeeded, false if it failed.
*/
bool save(const QString &filename, double xRes, double yRes);
/**
* @brief mergeDown merges the given node with the first visible node underneath this node in the layerstack.
* This will drop all per-layer metadata.
* @param node the node to merge down; this node will be removed from the layer stack
*/
Node *mergeDown();
/**
* @brief thumbnail create a thumbnail of the given dimensions. The thumbnail is sized according
* to the layer dimensions, not the image dimensions. If the requested size is too big a null
* QImage is created. If the current node cannot generate a thumbnail, a transparent QImage of the
* requested size is generated.
* @return a QImage representing the layer contents.
*/
QImage thumbnail(int w, int h);
private:
friend class Filter;
friend class Document;
friend class Selection;
/**
* @brief paintDevice gives access to the internal paint device of this Node
* @return the paintdevice or 0 if the node does not have an editable paint device.
*/
KisPaintDeviceSP paintDevice() const;
KisImageSP image() const;
KisNodeSP node() const;
struct Private;
Private *const d;
};
#endif // LIBKIS_NODE_H
diff --git a/libs/libkis/Notifier.h b/libs/libkis/Notifier.h
index dfcf5f61db..6468499b82 100644
--- a/libs/libkis/Notifier.h
+++ b/libs/libkis/Notifier.h
@@ -1,121 +1,121 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_NOTIFIER_H
#define LIBKIS_NOTIFIER_H
#include <QObject>
#include "kritalibkis_export.h"
#include <kis_types.h>
#include "libkis.h"
#include <KisDocument.h>
#include <KisView.h>
#include <KisMainWindow.h>
/**
* The Notifier can be used to be informed of state changes in the Krita application.
*/
class KRITALIBKIS_EXPORT Notifier : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Notifier)
Q_PROPERTY(bool Active READ active WRITE setActive)
public:
explicit Notifier(QObject *parent = 0);
- virtual ~Notifier();
+ ~Notifier() override;
/**
* @return true if the Notifier is active.
*/
bool active() const;
/**
* Enable or disable the Notifier
*/
void setActive(bool value);
Q_SIGNALS:
/**
* @brief applicationClosing is emitted when the application is about to close. This
* happens after any documents and windows are closed.
*/
void applicationClosing();
/**
* @brief imageCreated is emitted whenever a new image is created and registered with
* the application.
*/
void imageCreated(Document *image);
/**
* @brief imageSaved is emitted whenever a document is saved.
* @param filename the filename of the document that has been saved.
*/
void imageSaved(const QString &filename);
/**
* @brief imageClosed is emitted whenever the last view on an image is closed. The image
* does not exist anymore in Krita
* @param filename the filename of the image.
*/
void imageClosed(const QString &filename);
/**
* @brief viewCreated is emitted whenever a new view is created.
* @param view the view
*/
void viewCreated(View *view);
/**
* @brief viewClosed is emitted whenever a view is closed
* @param view the view
*/
void viewClosed(View *view);
/**
* @brief windowCreated is emitted whenever a window is created
* @param window the window
*/
void windowCreated(Window *window);
/**
* @brief configurationChanged is emitted every time Krita's configuration
* has changed.
*/
void configurationChanged();
private Q_SLOTS:
void imageCreated(KisDocument *document);
void viewCreated(KisView *view);
void viewClosed(KisView *view);
void windowCreated(KisMainWindow *window);
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_NOTIFIER_H
diff --git a/libs/libkis/PresetChooser.h b/libs/libkis/PresetChooser.h
index 396a5dad6a..fd9808a290 100644
--- a/libs/libkis/PresetChooser.h
+++ b/libs/libkis/PresetChooser.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2017 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PRESETCHOOSER_H
#define PRESETCHOOSER_H
#include <QObject>
#include <QWidget>
#include <kis_preset_chooser.h>
#include "kritalibkis_export.h"
#include "libkis.h"
class Resource;
/**
* @brief The PresetChooser widget wraps the KisPresetChooser widget.
* The widget provides for selecting brush presets. It has a tagging
* bar and a filter field. It is not automatically synchronized with
* the currently selected preset in the current Windows.
*/
class KRITALIBKIS_EXPORT PresetChooser : public KisPresetChooser
{
Q_OBJECT
public:
PresetChooser(QWidget *parent = 0);
- virtual ~PresetChooser() {}
+ ~PresetChooser() override {}
public Q_SLOTS:
/**
* Make the given preset active.
*/
void setCurrentPreset(Resource *resource);
/**
* @return a Resource wrapper around the currently selected
* preset.
*/
Resource *currentPreset() const;
Q_SIGNALS:
/**
* Emited whenever a user selects the given preset.
*/
void presetSelected(Resource *resource);
/**
* Emited whenever a user clicks on the given preset.
*/
void presetClicked(Resource *resource);
private Q_SLOTS:
void slotResourceSelected(KoResource *resource);
void slotResourceClicked(KoResource *resource);
};
#endif // PRESETCHOOSER_H
diff --git a/libs/libkis/Resource.h b/libs/libkis/Resource.h
index dabdb87788..06d5a165c8 100644
--- a/libs/libkis/Resource.h
+++ b/libs/libkis/Resource.h
@@ -1,120 +1,120 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_RESOURCE_H
#define LIBKIS_RESOURCE_H
#include <QObject>
#include <kis_types.h>
#include "kritalibkis_export.h"
#include "libkis.h"
class KoResource;
/**
* A Resource represents a gradient, pattern, brush tip, brush preset, palette or
* workspace definition.
*
* @code
* allPresets = Application.resources("preset")
* for preset in allPresets:
* print(preset.name())
* @endcode
*
* Resources are identified by their type, name and filename. If you want to change
* the contents of a resource, you should read its data using data(), parse it and
* write the changed contents back.
*/
class KRITALIBKIS_EXPORT Resource : public QObject
{
Q_OBJECT
public:
explicit Resource(KoResource *resource, QObject *parent = 0);
- virtual ~Resource();
+ ~Resource() override;
bool operator==(const Resource &other) const;
bool operator!=(const Resource &other) const;
public Q_SLOTS:
/**
* Return the type of this resource. Valid types are:
* <ul>
* <li>pattern: a raster image representing a pattern
* <li>gradient: a gradient
* <li>brush: a brush tip
* <li>preset: a brush preset
* <li>palette: a color set
* <li>workspace: a workspace definition.
* </ul>
*/
QString type() const;
/**
* The user-visible name of the resource.
*/
QString name() const;
/**
* setName changes the user-visible name of the current resource.
*/
void setName(QString value);
/**
* The filename of the resource, if present. Not all resources
* are loaded from files.
*/
QString filename() const;
/**
* An image that can be used to represent the resource in the
* user interface. For some resources, like patterns, the
* image is identical to the resource, for others it's a mere
* icon.
*/
QImage image() const;
/**
* Change the image for this resource.
*/
void setImage(QImage image);
/**
* Return the resource as a byte array.
*/
QByteArray data() const;
/**
* Change the internal data of the resource to the given byte
* array. If the byte array is not valid, setData returns
* false, otherwwise true.
*/
bool setData(QByteArray data);
private:
friend class PresetChooser;
friend class View;
KoResource *resource() const;
struct Private;
const Private *const d;
};
#endif // LIBKIS_RESOURCE_H
diff --git a/libs/libkis/Selection.h b/libs/libkis/Selection.h
index 35147010da..a65dfe8caa 100644
--- a/libs/libkis/Selection.h
+++ b/libs/libkis/Selection.h
@@ -1,242 +1,242 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_SELECTION_H
#define LIBKIS_SELECTION_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
#include <kis_types.h>
/**
* Selection represents a selection on Krita. A selection is
* not necessarily associated with a particular Node or Image.
*
* @code
* from krita import *
*
* d = Application.activeDocument()
* n = d.activeNode()
* r = n.bounds()
* s = Selection()
* s.select(r.width() / 3, r.height() / 3, r.width() / 3, r.height() / 3, 255)
* s.cut(n)
* @endcode
*/
class KRITALIBKIS_EXPORT Selection : public QObject
{
Q_OBJECT
public:
/**
* For internal use only.
*/
Selection(KisSelectionSP selection, QObject *parent = 0);
/**
* Create a new, empty selection object.
*/
explicit Selection(QObject *parent = 0);
- virtual ~Selection();
+ ~Selection() override;
bool operator==(const Selection &other) const;
bool operator!=(const Selection &other) const;
public Q_SLOTS:
/**
* @return the width of the selection
*/
int width() const;
/**
* @return the height of the selection
*/
int height() const;
/**
* @return the left-hand position of the selection.
*/
int x() const;
/**
* @return the top position of the selection.
*/
int y() const;
/**
* Move the selection's top-left corner to the given coordinates.
*/
void move(int x, int y);
/**
* Make the selection entirely unselected.
*/
void clear();
/**
* Make the selection's width and height smaller by the given value.
* This will not move the selection's top-left position.
*/
void contract(int value);
/**
* @brief copy copies the area defined by the selection from the node to the clipboard.
* @param node the node from where the pixels will be copied.
*/
void copy(Node *node);
/**
* @brief cut erases the area defined by the selection from the node and puts a copy on the clipboard.
* @param node the node from which the selection will be cut.
*/
void cut(Node *node);
/**
* @brief paste pastes the content of the clipboard to the given node, limited by the area of the current
* selection.
* @param destination the node where the pixels will be written
* @param x: the x position at which the clip will be written
* @param y: the y position at which the clip will be written
*/
void paste(Node *destination, int x, int y);
/**
* Erode the selection with a radius of 1 pixel.
*/
void erode();
/**
* Dilate the selection with a radius of 1 pixel.
*/
void dilate();
/**
* Border the selection with the given radius.
*/
void border(int xRadius, int yRadius);
/**
* Feather the selection with the given radius.
*/
void feather(int radius);
/**
* Grow the selection with the given radius.
*/
void grow(int xradius, int yradius);
/**
* Shrink the selection with the given radius.
*/
void shrink(int xRadius, int yRadius, bool edgeLock);
/**
* Smooth the selection.
*/
void smooth();
/**
* Invert the selection.
*/
void invert();
/**
* Resize the selection to the given width and height. The top-left position will not be moved.
*/
void resize(int w, int h);
/**
* Select the given area. The value can be between 0 and 255; 0 is
* totally unselected, 255 is totally selected.
*/
void select(int x, int y, int w, int h, int value);
/**
* Select all pixels in the given node. The value can be between 0 and 255; 0 is
* totally unselected, 255 is totally selected.
*/
void selectAll(Node *node, int value);
/**
* Replace the current selection's selection with the one of the given selection.
*/
void replace(Selection *selection);
/**
* Add the given selection's selected pixels to the current selection.
*/
void add(Selection *selection);
/**
* Subtract the given selection's selected pixels from the current selection.
*/
void subtract(Selection *selection);
/**
* Intersect the given selection with this selection.
*/
void intersect(Selection *selection);
/**
* @brief pixelData reads the given rectangle from the Selection's mask and returns it as a
* byte array. The pixel data starts top-left, and is ordered row-first.
*
* The byte array will contain one byte for every pixel, representing the selectedness. 0
* is totally unselected, 255 is fully selected.
*
* You can read outside the Selection's boundaries; those pixels will be unselected.
*
* The byte array is a copy of the original selection data.
* @param x x position from where to start reading
* @param y y position from where to start reading
* @param w row length to read
* @param h number of rows to read
* @return a QByteArray with the pixel data. The byte array may be empty.
*/
QByteArray pixelData(int x, int y, int w, int h) const;
/**
* @brief setPixelData writes the given bytes, of which there must be enough, into the
* Selection.
*
* @param value the byte array representing the pixels. There must be enough bytes available.
* Krita will take the raw pointer from the QByteArray and start reading, not stopping before
* (w * h) bytes are read.
*
* @param x the x position to start writing from
* @param y the y position to start writing from
* @param w the width of each row
* @param h the number of rows to write
*/
void setPixelData(QByteArray value, int x, int y, int w, int h);
private:
friend class Document;
KisSelectionSP selection() const;
struct Private;
Private *const d;
};
#endif // LIBKIS_SELECTION_H
diff --git a/libs/libkis/View.h b/libs/libkis/View.h
index c5a74fc43d..733fd210fb 100644
--- a/libs/libkis/View.h
+++ b/libs/libkis/View.h
@@ -1,88 +1,88 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_VIEW_H
#define LIBKIS_VIEW_H
#include <QObject>
#include "kritalibkis_export.h"
#include "libkis.h"
class KisView;
/**
* View represents one view on a document. A document can be
* shown in more than one view at a time.
*/
class KRITALIBKIS_EXPORT View : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(View)
public:
explicit View(KisView *view, QObject *parent = 0);
- virtual ~View();
+ ~View() override;
bool operator==(const View &other) const;
bool operator!=(const View &other) const;
public Q_SLOTS:
/**
* @return the window this view is shown in.
*/
Window* window() const;
/**
* @return the document this view is showing.
*/
Document* document() const;
/**
* @return true if the current view is visible, false if not.
*/
bool visible() const;
/**
* Make the current view visible.
*/
void setVisible();
/**
* @return the canvas this view is showing. The canvas controls
* things like zoom and rotation.
*/
Canvas* canvas() const;
/**
* @brief activateResource activates the given resource.
* @param resource: a pattern, gradient or paintop preset
*/
void activateResource(Resource *resource);
private:
friend class Window;
KisView *view();
struct Private;
Private *const d;
};
#endif // LIBKIS_VIEW_H
diff --git a/libs/libkis/Window.h b/libs/libkis/Window.h
index c9a9511a9d..e869d4be41 100644
--- a/libs/libkis/Window.h
+++ b/libs/libkis/Window.h
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LIBKIS_WINDOW_H
#define LIBKIS_WINDOW_H
#include <QObject>
#include <QMainWindow>
#include "kritalibkis_export.h"
#include "libkis.h"
#include <KisMainWindow.h>
/**
* Window represents one Krita mainwindow. A window can have any number
* of views open on any number of documents.
*/
class KRITALIBKIS_EXPORT Window : public QObject
{
Q_OBJECT
public:
explicit Window(KisMainWindow *window, QObject *parent = 0);
- virtual ~Window();
+ ~Window() override;
bool operator==(const Window &other) const;
bool operator!=(const Window &other) const;
public Q_SLOTS:
/**
* Return a handle to the QMainWindow widget. This is useful
* to e.g. parent dialog boxes and message box.
*/
QMainWindow *qwindow() const;
/**
* @return a list of open views in this window
*/
QList<View*> views() const;
/**
* Open a new view on the given document in this window
*/
View *addView(Document *document);
/**
* Make the given view active in this window. If the view
* does not belong to this window, nothing happens.
*/
void showView(View *view);
/**
* @brief activate activates this Window.
*/
void activate();
/**
* @brief close the active window and all its Views. If there
* are no Views left for a given Document, that Document will
* also be closed.
*/
void close();
Q_SIGNALS:
/// Emitted when the window is closed.
void windowClosed();
private:
struct Private;
Private *const d;
};
#endif // LIBKIS_WINDOW_H
diff --git a/libs/odf/KoDocumentInfo.h b/libs/odf/KoDocumentInfo.h
index c047cfc8cd..49d64b4521 100644
--- a/libs/odf/KoDocumentInfo.h
+++ b/libs/odf/KoDocumentInfo.h
@@ -1,213 +1,213 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
Copyright (C) 2004 David Faure <faure@kde.org>
Copyright (C) 2006 Martin Pfeiffer <hubipete@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_DOCUMENT_INFO_H
#define KO_DOCUMENT_INFO_H
#include <QObject>
#include <QMap>
#include <QString>
#include <QStringList>
#include "kritaodf_export.h"
#include <KoXmlReaderForward.h>
class QDomDocument;
class QDomElement;
class KoStore;
class KoXmlWriter;
/**
* @short The class containing all meta information about a document
*
* @author Torben Weis <weis@kde.org>
* @author David Faure <faure@kde.org>
* @author Martin Pfeiffer <hubipete@gmx.net>
* @see KoDocumentInfoDlg
*
* This class contains the meta information for a document. They are
* stored in two QMap and can be accessed through aboutInfo() and authorInfo().
* The about info can be changed with setAboutInfo() and setAuthorInfo()
*/
class KRITAODF_EXPORT KoDocumentInfo : public QObject
{
Q_OBJECT
public:
/**
* The constructor
* @param parent a pointer to the parent object
*/
explicit KoDocumentInfo(QObject *parent = 0);
/** The destructor */
- ~KoDocumentInfo();
+ ~KoDocumentInfo() override;
/**
* Load the KoDocumentInfo from an Calligra-1.3 DomDocument
* @param doc the QDomDocument to load from
* @return true if success
*/
bool load(const KoXmlDocument& doc);
/**
* Save the KoDocumentInfo to an Calligra-1.3 DomDocument
* @return the QDomDocument to which was saved
*/
QDomDocument save(QDomDocument &doc);
/**
* Set information about the author.
* This will override any information retrieved from the author profile
* But it does not change the author profile
* Note: authorInfo() will not return the new value until the document has been
* saved by the user.(autosave doesn't count)
* @param info the kind of information to set
* @param data the data to set for this information
*/
void setAuthorInfo(const QString& info, const QString& data);
/**
* Obtain information about the author
* @param info the kind of information to obtain
* @return a QString with the information
*/
QString authorInfo(const QString& info) const;
/**
* Set information about the document
* @param info the kind of information to set
* @param data the data to set for this information
*/
void setAboutInfo(const QString& info, const QString& data);
/**
* Obtain information about the document
* @param info the kind of information to obtain
* @return a QString with the information
*/
QString aboutInfo(const QString& info) const;
/**
* Obtain the generator of the document, as it was loaded from the document
*/
QString originalGenerator() const;
/**
* Sets the original generator of the document. This does not affect what gets
* saved to a document in the meta:generator field, it only changes what
* originalGenerator() will return.
*/
void setOriginalGenerator(const QString& generator);
/** Resets part of the meta data */
void resetMetaData();
/** Takes care of updating the document info from configuration correctly */
void updateParameters();
private:
/// Bumps the editing cycles count and save date, and then calls updateParameters
void updateParametersAndBumpNumCycles();
/**
* Set information about the author
* This sets what is actually saved to file. The public method setAuthorInfo() can be used to set
* values that overide what is fetched from the author profile. During saveParameters() author
* profile and any overrides is combined resulting in calls to this method.
* @param info the kind of information to set
* @param data the data to set for this information
*/
void setActiveAuthorInfo(const QString& info, const QString& data);
/**
* Load the information about the document from an OASIS file
* @param metaDoc a reference to the information node
* @return true if success
*/
bool loadOasisAboutInfo(const KoXmlNode& metaDoc);
/**
* Save the information about the document to an OASIS file
* @param xmlWriter a reference to the KoXmlWriter to write in
* @return true if success
*/
bool saveOasisAboutInfo(KoXmlWriter &xmlWriter);
/**
* Load the information about the document from a Calligra-1.3 file
* @param e the element to load from
* @return true if success
*/
bool loadAboutInfo(const KoXmlElement& e);
/**
* Save the information about the document to a Calligra-1.3 file
* @param doc the QDomDocument to save in
* @return the QDomElement to which was saved
*/
QDomElement saveAboutInfo(QDomDocument& doc);
/**
* Load the information about the document from an OASIS file
* @param metaDoc a reference to the information node
* @return true if success
*/
bool loadOasisAuthorInfo(const KoXmlNode& metaDoc);
/**
* Load the information about the document from a Calligra-1.3 file
* @param e the element to load from
* @return true if success
*/
bool loadAuthorInfo(const KoXmlElement& e);
/**
* Save the information about the author to a Calligra-1.3 file
* @param doc the QDomDocument to save in
* @return the QDomElement to which was saved
*/
QDomElement saveAuthorInfo(QDomDocument& doc);
/**
* Save the information about the document to an OASIS file
* @param xmlWriter a reference to the KoXmlWriter to write in
* @return true if success
*/
bool saveOasisAuthorInfo(KoXmlWriter &xmlWriter);
/** A QStringList containing all tags for the document information */
QStringList m_aboutTags;
/** A QStringList containing all tags for the author information */
QStringList m_authorTags;
/** The map containing information about the author */
QMap<QString, QString> m_authorInfo;
/** The map containing information about the author set programatically*/
QMap<QString, QString> m_authorInfoOverride;
/** The map containing information about the document */
QMap<QString, QString> m_aboutInfo;
/** The original meta:generator of the document */
QString m_generator;
Q_SIGNALS:
void infoUpdated(const QString &info, const QString &data);
};
#endif
diff --git a/libs/odf/KoOdfBibliographyConfiguration.h b/libs/odf/KoOdfBibliographyConfiguration.h
index e0ed956e9f..a5e92e9c18 100644
--- a/libs/odf/KoOdfBibliographyConfiguration.h
+++ b/libs/odf/KoOdfBibliographyConfiguration.h
@@ -1,116 +1,116 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Smit Patel <smitpatel24@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOODFBIBLIOGRAPHYCONFIGURATION_H
#define KOODFBIBLIOGRAPHYCONFIGURATION_H
#include <QString>
#include <QMetaType>
#include <QObject>
#include "KoXmlReaderForward.h"
#include "kritaodf_export.h"
class KoXmlWriter;
typedef QPair<QString, Qt::SortOrder> SortKeyPair;
/**
* load and save the bibliography-configuration element from the text: namespace.
* • Prefix
* • Suffix
* • Numbered entries
* • Sort by position
* • Sort algorithm
*/
class KRITAODF_EXPORT KoOdfBibliographyConfiguration : public QObject
{
Q_OBJECT
public:
KoOdfBibliographyConfiguration();
- ~KoOdfBibliographyConfiguration();
+ ~KoOdfBibliographyConfiguration() override;
KoOdfBibliographyConfiguration(const KoOdfBibliographyConfiguration &other);
KoOdfBibliographyConfiguration &operator=(const KoOdfBibliographyConfiguration &other);
static const QList<QString> bibTypes;
static const QList<QString> bibDataFields;
/**
* load the bibliography-configuration element
*/
void loadOdf(const KoXmlElement &element);
/**
* save the bibliography-configuration element
*/
void saveOdf(KoXmlWriter * writer) const;
/**
* Sort by position
* If text:sort-by-position attribute is true then bibliography entries or citations will be
* sorted according to their position in document.
*/
bool sortByPosition() const;
void setSortByPosition(bool enable);
/**
* Numberred entries
* If text:numbered-entries attribute is true then bibliography entries or citations will be numbered.
*/
bool numberedEntries() const;
void setNumberedEntries(bool enable);
/**
* Prefix
* The text:prefix attribute specifies prefix of bibliography entry or citation(text:bibliography-mark)
*/
QString prefix() const;
void setPrefix(const QString &prefixValue);
/**
* Suffix
* The text:suffix attribute specifies suffix of bibliography entry or citation(text:bibliography-mark)
*/
QString suffix() const;
void setSuffix(const QString &suffixValue);
/**
* Sort algorithm
* The text:sort-algorithm attribute specifies sorting algorithm for bibliography entry
*/
QString sortAlgorithm() const;
void setSortAlgorithm(const QString &algorithm);
/**
* Sort Keys
* The text:sort-key attribute specifies sort key for bibliography entry
*/
QList<SortKeyPair> sortKeys() const;
void setSortKeys(const QList<SortKeyPair> &sortKeys);
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoOdfBibliographyConfiguration*)
#endif // KOODFBIBLIOGRAPHYCONFIGURATION_H
diff --git a/libs/odf/KoOdfLineNumberingConfiguration.h b/libs/odf/KoOdfLineNumberingConfiguration.h
index 32dc4a3462..cea8c209d4 100644
--- a/libs/odf/KoOdfLineNumberingConfiguration.h
+++ b/libs/odf/KoOdfLineNumberingConfiguration.h
@@ -1,179 +1,179 @@
/* This file is part of the KDE project
Copyright (C) 2010 KO GmbH <boud@kogmbh.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOODFLINENUMBERINGCONFIGURATION_H
#define KOODFLINENUMBERINGCONFIGURATION_H
#include <QMetaType>
#include <QObject>
#include "KoXmlReaderForward.h"
#include "kritaodf_export.h"
class KoXmlWriter;
class KoOdfNumberDefinition;
/**
* Implement section 14.9.1: Line Numbering Configuration.
*
* A document can contain none or one line numbering configuration element
* <text:linenumbering-configuration> within the <office:styles> element. If the
* element is not present, a default line numbering configuration is used. The default line numbering
* may vary on the office application software, but every document saved by an application that
* supports line numbering should contain a line numbering configuration element.
*
* The attributes that may be associated with the <text:linenumbering-configuration>
* element are:
* <ul>
* <li> Line numbering enable
* <li> Number format
* <li> Text style
* <li> Increment
* <li> Position
* <li> Offset
* <li> Count empty lines
* <li> Count line in text boxes
* <li> Restart numbering on every page
* </ul>
* The following element may be included in the <text:linenumbering-separator> element:
* <li> Separator
*/
class KRITAODF_EXPORT KoOdfLineNumberingConfiguration : public QObject
{
Q_OBJECT
public:
KoOdfLineNumberingConfiguration();
- ~KoOdfLineNumberingConfiguration();
+ ~KoOdfLineNumberingConfiguration() override;
KoOdfLineNumberingConfiguration(const KoOdfLineNumberingConfiguration &other);
KoOdfLineNumberingConfiguration &operator=(const KoOdfLineNumberingConfiguration &other);
/**
* load the line numbering configuration element
*/
void loadOdf(const KoXmlElement &element);
/**
* save the line number configuration element
*/
void saveOdf(KoXmlWriter * writer) const;
/**
* The text:number-lines attribute controls whether or not lines are numbered.
*/
bool enabled() const;
void setEnabled(bool enabled);
/**
* See section 12.2 for detailed information on number format attributes. The attributes
* described in section 12.2 can also be associated with the <text:linenumbering-configuration>
* element.
*/
KoOdfNumberDefinition numberFormat() const;
void setNumberFormat(const KoOdfNumberDefinition &numberFormat);
/**
* The text:style-name attribute specifies the text style for all line numbers. The value
* of this attribute is the name of the text style that is applied to all line numbers.
*/
QString textStyle() const;
void setTextStyle(const QString &textStyle);
/**
* The text:increment attribute causes line numbers that are a multiple of the given increment to
* be numbered. For example, if the increment is 5, only lines number 5, 10, 15, and so on are
* numbered.
*/
int increment() const;
void setIncrement(int increment);
/**
* The text:position attribute determines whether the line numbers are printed on the left, right,
* inner, or outer margins.
*/
enum Position {
Left,
Right,
Inner,
Outer
};
Position position() const;
void setPosition(Position position);
/**
* The text:offset attribute determines the distance between the line number and the margin.
*/
int offset() const;
void setOffset(int offset);
/**
* The text:count-empty-lines attribute determines whether or not empty lines are included in
* the line count. If the value of this attribute is true, empty lines are included in the line count.
*/
bool countEmptyLines() const;
void setCountEmptyLines(bool countEmptyLines);
/**
* The text:count-in-text-boxes attribute determines whether or not text in text boxes is
* included in the line count. If the value of this attribute is true, text within text boxes is included in
* the line count.
*/
bool countLinesInTextBoxes() const;
void setCountLinesInTextBoxes(bool countLinesInTextBoxes);
/**
* The text:restart-on-page attribute determines whether or not the line count is reset to 1 at
* the start of every page.
*
* If the value of this attribute is true, the line count is reset to 1 at the beginning of every page,
* resulting in page -specific numbering of lines. The default value of this attribute is false,
* resulting in document-specific numbering of lines.
*/
bool restartNumberingOnEveryPage() const;
void setRestartNumberingOnEveryPage(bool restartNumberingOnEveryPage);
/**
* The <text:linenumbering-separator> element contains the text that is displayed as a
* separator. A separator is text that is displayed instead of a line number for lines where no number
* is displayed.
*
* This element is contained in the line numbering configuration element. If the element is not
* present, no separator is displayed.
*
* The element's text:increment attribute causes the separator to appear on lines that are a
* multiple of the given increment. For example, if the increment is 2, only lines 2, 4, 6, and so on get
* a separator, provided that no number is displayed already.
*/
QString separator() const;
void setSeparator(const QString &separator);
int separatorIncrement() const;
void setSeparatorIncrement(int separatorIncrement);
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoOdfLineNumberingConfiguration*)
#endif // KOODFLINENUMBERINGCONFIGURATION_H
diff --git a/libs/odf/KoOdfNotesConfiguration.h b/libs/odf/KoOdfNotesConfiguration.h
index 29eba0fb36..f19d18ccc7 100644
--- a/libs/odf/KoOdfNotesConfiguration.h
+++ b/libs/odf/KoOdfNotesConfiguration.h
@@ -1,189 +1,189 @@
/* This file is part of the KDE project
Copyright (C) 2010 Boudewijn Rempt
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOODFNOTESCONFIGURATION_H
#define KOODFNOTESCONFIGURATION_H
#include <QMetaType>
#include <QObject>
#include "KoXmlReaderForward.h"
#include "kritaodf_export.h"
class KoXmlWriter;
class KoOdfNumberDefinition;
/**
* load and save the notes-configuration element from the text: namespace.
*
* @see 14.9.2 Notes Configuration Element
* A document in OpenDocument format contains at most one notes configuration element for every
* notes class used in the document. If there is no note configuration element, a default note
* configuration is used.
* The attributes that may be associated with the <text:notes-configuration> element are:
*
* • Note class
* • Citation text style
* • Citation body text style
* • Default footnote paragraph style
* • Master page
* • Start value
* • Number format
* • Numbering scheme
* • Footnote position
*
* The following element may be included in the <text:footnotes-configuration> element:
*
* • Footnote continuation notice (forward and backward)
*/
class KRITAODF_EXPORT KoOdfNotesConfiguration : public QObject
{
Q_OBJECT
public:
/**
* Note class
* The note class attribute determines which note elements this notes configuration applies to.
*/
enum NoteClass {
Footnote,
Endnote
};
KoOdfNotesConfiguration(NoteClass noteClass);
- ~KoOdfNotesConfiguration();
+ ~KoOdfNotesConfiguration() override;
KoOdfNotesConfiguration(const KoOdfNotesConfiguration &other);
KoOdfNotesConfiguration &operator=(const KoOdfNotesConfiguration &other);
/**
* load the notes-configuration element
*/
void loadOdf(const KoXmlElement &element);
/**
* save the notes-configuration element
*/
void saveOdf(KoXmlWriter * writer) const;
NoteClass noteClass() const;
/**
* Citation Text Style
* The text:citation-style attribute specifies the text style to use for the footnote citation
* within the footnote.
*/
QString citationTextStyleName() const;
void *citationTextStyle() const;
void setCitationTextStyle(void *citationTextStyle);
/**
* Citation Body Text Style
* The text:citation-body-style-name attribute specifies the text style to use for the
* footnote citation in the text flow.
*/
QString citationBodyTextStyleName() const;
void *citationBodyTextStyle() const;
void setCitationBodyTextStyle(void *citationBodyTextStyle);
/**
* Default Note Paragraph Style
* The default footnote paragraph style is only used for footnotes that are inserted into an existing
* document. It is not used for footnotes that already exist.
*/
QString defaultNoteParagraphStyleName() const;
void *defaultNoteParagraphStyle() const;
void setDefaultNoteParagraphStyle(void *defaultNoteParagraphStyle);
/**
* Master Page
* To display the footnotes at the end of the document, the pages that contain the footnotes must be
* instances of the master page specified by the text:master-page-name attribute.
*/
QString masterPage() const;
void setMasterPage(const QString &masterPage);
/**
* Start Value
* The start:value attribute specifies the value at which the footnote numbering starts.
*/
int startValue() const;
void setStartValue(int startValue);
/**
* Number Format
* See section 12.2 for information on the number format for footnotes.
*/
KoOdfNumberDefinition numberFormat() const;
void setNumberFormat(const KoOdfNumberDefinition &numberFormat);
/**
* Numbering Scheme
* The text:start-numbering-at attribute specifies if footnote numbers start with a new
* number at the beginning of the document or at the beginning of each chapter or page.
*/
enum NumberingScheme {
BeginAtDocument,
BeginAtChapter,
BeginAtPage
};
NumberingScheme numberingScheme() const;
void setNumberingScheme(NumberingScheme numberingScheme);
/**
* Footnotes Position
* • The text:footnotes-position attribute specifies one of the following positions for footnotes:
* • text: At the page where the footnote citation is located, immediately below the page's text.
* • page: The bottom of the page where the footnote citation is located.
* • section: The end of the section
* • document: The end of the document.
*/
enum FootnotesPosition {
Text,
Page,
Section,
Document
};
FootnotesPosition footnotesPosition() const;
void setFootnotesPosition(FootnotesPosition footnotesPosition);
/**
* Footnote Continuation
* The footnote continuation elements specify:
* • Text displayed at the end of a footnote that is continued on the next page
* • Text displayed before the continued text
*/
QString footnoteContinuationForward() const;
void setFootnoteContinuationForward(const QString &footnoteContinuationForward);
QString footnoteContinuationBackward() const;
void setFootnoteContinuationBackward(const QString &footnoteContinuationBackward);
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoOdfNotesConfiguration*)
#endif // KOODFNOTESCONFIGURATION_H
diff --git a/libs/pigment/CMakeLists.txt b/libs/pigment/CMakeLists.txt
index c44fcb81c4..b1552b6da6 100644
--- a/libs/pigment/CMakeLists.txt
+++ b/libs/pigment/CMakeLists.txt
@@ -1,122 +1,124 @@
project(kritapigment)
# we have to repeat platform specifics from top-level
if (WIN32)
include_directories(${CMAKE_SOURCE_DIR}/winquirks)
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DNOMINMAX)
set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib)
endif ()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/resources
${CMAKE_CURRENT_SOURCE_DIR}/compositeops)
include_directories(SYSTEM
${Boost_INCLUDE_DIRS}
)
set(FILE_OPENEXR_SOURCES)
set(LINK_OPENEXR_LIB)
if(OPENEXR_FOUND)
include_directories(SYSTEM ${OPENEXR_INCLUDE_DIR})
set(LINK_OPENEXR_LIB ${OPENEXR_LIBRARIES})
add_definitions(${OPENEXR_DEFINITIONS})
endif()
set(LINK_VC_LIB)
if(HAVE_VC)
include_directories(SYSTEM ${Vc_INCLUDE_DIR})
set(LINK_VC_LIB ${Vc_LIBRARIES})
ko_compile_for_all_implementations_no_scalar(__per_arch_factory_objs compositeops/KoOptimizedCompositeOpFactoryPerArch.cpp)
message("Following objects are generated from the per-arch lib")
message(${__per_arch_factory_objs})
endif()
add_subdirectory(tests)
add_subdirectory(benchmarks)
set(kritapigment_SRCS
DebugPigment.cpp
KoBasicHistogramProducers.cpp
KoColor.cpp
KoColorDisplayRendererInterface.cpp
KoColorConversionAlphaTransformation.cpp
KoColorConversionCache.cpp
KoColorConversions.cpp
KoColorConversionSystem.cpp
KoColorConversionTransformation.cpp
KoColorProofingConversionTransformation.cpp
KoColorConversionTransformationFactory.cpp
KoColorModelStandardIds.cpp
KoColorProfile.cpp
KoColorSpace.cpp
KoColorSpaceEngine.cpp
KoColorSpaceFactory.cpp
KoColorSpaceMaths.cpp
KoColorSpaceRegistry.cpp
+ KoColorProfileStorage.cpp
KoColorTransformation.cpp
KoColorTransformationFactory.cpp
KoColorTransformationFactoryRegistry.cpp
KoCompositeColorTransformation.cpp
KoCompositeOp.cpp
KoCompositeOpRegistry.cpp
KoCopyColorConversionTransformation.cpp
KoFallBackColorTransformation.cpp
KoHistogramProducer.cpp
KoMultipleColorConversionTransformation.cpp
KoUniqueNumberForIdServer.cpp
colorspaces/KoAlphaColorSpace.cpp
colorspaces/KoLabColorSpace.cpp
colorspaces/KoRgbU16ColorSpace.cpp
colorspaces/KoRgbU8ColorSpace.cpp
colorspaces/KoSimpleColorSpaceEngine.cpp
compositeops/KoOptimizedCompositeOpFactory.cpp
compositeops/KoOptimizedCompositeOpFactoryPerArch_Scalar.cpp
${__per_arch_factory_objs}
colorprofiles/KoDummyColorProfile.cpp
resources/KoAbstractGradient.cpp
resources/KoColorSet.cpp
resources/KoPattern.cpp
resources/KoResource.cpp
resources/KoMD5Generator.cpp
resources/KoHashGeneratorProvider.cpp
resources/KoStopGradient.cpp
resources/KoSegmentGradient.cpp
)
set (EXTRA_LIBRARIES ${LINK_OPENEXR_LIB} ${LINK_VC_LIB})
if(MSVC OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
# avoid "cannot open file 'LIBC.lib'" error
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:LIBC.LIB")
endif()
add_library(kritapigment SHARED ${kritapigment_SRCS})
generate_export_header(kritapigment)
target_include_directories( kritapigment
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/resources>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/compositeops>
)
target_link_libraries( kritapigment
PUBLIC
kritaplugin
kritastore
+ kritaglobal
${EXTRA_LIBRARIES}
KF5::I18n
KF5::ConfigCore
Qt5::Core
Qt5::Gui
Qt5::Xml
${WIN32_PLATFORM_NET_LIBS}
)
set_target_properties(kritapigment PROPERTIES
VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION}
)
install(TARGETS kritapigment ${INSTALL_TARGETS_DEFAULT_ARGS})
diff --git a/libs/pigment/KoBasicHistogramProducers.h b/libs/pigment/KoBasicHistogramProducers.h
index d62675a977..3b9e369ecf 100644
--- a/libs/pigment/KoBasicHistogramProducers.h
+++ b/libs/pigment/KoBasicHistogramProducers.h
@@ -1,262 +1,262 @@
/*
* Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _Ko_BASIC_HISTOGRAM_PRODUCERS_
#define _Ko_BASIC_HISTOGRAM_PRODUCERS_
#include "KoHistogramProducer.h"
#include <QVector>
#include <KoConfig.h>
#include "KoColorSpace.h"
#include "KoID.h"
#include "kritapigment_export.h"
#include "KoColorSpaceRegistry.h"
class KRITAPIGMENT_EXPORT KoBasicHistogramProducer : public KoHistogramProducer
{
public:
explicit KoBasicHistogramProducer(const KoID& id, int channelCount, int nrOfBins);
explicit KoBasicHistogramProducer(const KoID& id, int nrOfBins, const KoColorSpace *colorSpace);
- virtual ~KoBasicHistogramProducer() {}
+ ~KoBasicHistogramProducer() override {}
- virtual void clear();
+ void clear() override;
- virtual void setView(qreal from, qreal size) {
+ void setView(qreal from, qreal size) override {
m_from = from; m_width = size;
}
- virtual const KoID& id() const {
+ const KoID& id() const override {
return m_id;
}
- virtual QList<KoChannelInfo *> channels() {
+ QList<KoChannelInfo *> channels() override {
return m_colorSpace->channels();
}
- virtual qint32 numberOfBins() {
+ qint32 numberOfBins() override {
return m_nrOfBins;
}
- virtual qreal viewFrom() const {
+ qreal viewFrom() const override {
return m_from;
}
- virtual qreal viewWidth() const {
+ qreal viewWidth() const override {
return m_width;
}
- virtual qint32 count() {
+ qint32 count() override {
return m_count;
}
- virtual qint32 getBinAt(int channel, int position) {
+ qint32 getBinAt(int channel, int position) override {
return m_bins.at(externalToInternal(channel)).at(position);
}
- virtual qint32 outOfViewLeft(int channel) {
+ qint32 outOfViewLeft(int channel) override {
return m_outLeft.at(externalToInternal(channel));
}
- virtual qint32 outOfViewRight(int channel) {
+ qint32 outOfViewRight(int channel) override {
return m_outRight.at(externalToInternal(channel));
}
protected:
/**
* The order in which channels() returns is not the same as the internal representation,
* that of the pixel internally. This method converts external usage to internal usage.
* This method uses some basic assumtpions about the layout of the pixel, so _extremely_
* exotic spaces might want to override this (see makeExternalToInternal source for
* those assumptions)
**/
virtual int externalToInternal(int ext) {
if (channels().count() > 0 && m_external.count() == 0) // Set up the translation table
makeExternalToInternal();
return m_external.at(ext);
}
// not virtual since that is useless: we call it from constructor
void makeExternalToInternal();
typedef QVector<quint32> vBins;
QVector<vBins> m_bins;
vBins m_outLeft, m_outRight;
qreal m_from, m_width;
qint32 m_count;
int m_channels, m_nrOfBins;
const KoColorSpace *m_colorSpace;
KoID m_id;
QVector<qint32> m_external;
};
class KRITAPIGMENT_EXPORT KoBasicU8HistogramProducer : public KoBasicHistogramProducer
{
public:
KoBasicU8HistogramProducer(const KoID& id, const KoColorSpace *colorSpace);
- virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace);
- virtual QString positionToString(qreal pos) const;
- virtual qreal maximalZoom() const {
+ void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace) override;
+ QString positionToString(qreal pos) const override;
+ qreal maximalZoom() const override {
return 1.0;
}
};
class KRITAPIGMENT_EXPORT KoBasicU16HistogramProducer : public KoBasicHistogramProducer
{
public:
KoBasicU16HistogramProducer(const KoID& id, const KoColorSpace *colorSpace);
- virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace);
- virtual QString positionToString(qreal pos) const;
- virtual qreal maximalZoom() const;
+ void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace) override;
+ QString positionToString(qreal pos) const override;
+ qreal maximalZoom() const override;
};
class KRITAPIGMENT_EXPORT KoBasicF32HistogramProducer : public KoBasicHistogramProducer
{
public:
KoBasicF32HistogramProducer(const KoID& id, const KoColorSpace *colorSpace);
- virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace);
- virtual QString positionToString(qreal pos) const;
- virtual qreal maximalZoom() const;
+ void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace) override;
+ QString positionToString(qreal pos) const override;
+ qreal maximalZoom() const override;
};
#ifdef HAVE_OPENEXR
class KRITAPIGMENT_EXPORT KoBasicF16HalfHistogramProducer : public KoBasicHistogramProducer
{
public:
KoBasicF16HalfHistogramProducer(const KoID& id, const KoColorSpace *colorSpace);
- virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace);
- virtual QString positionToString(qreal pos) const;
- virtual qreal maximalZoom() const;
+ void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace) override;
+ QString positionToString(qreal pos) const override;
+ qreal maximalZoom() const override;
};
#endif
/**
* Parametrized on a specific KoHistogramProducer. Its generated producers
* will have the same KoID as the factory's. This is acceptable because we can't mix
* Factories with Producers in the code because they are incompatible types, and
* in the GUI we actually only need a producer's name, not a factory's.
*/
template<class T> class KoBasicHistogramProducerFactory : public KoHistogramProducerFactory
{
public:
KoBasicHistogramProducerFactory(const KoID& id, const QString& modelId, const QString& depthId )
: KoHistogramProducerFactory(id), m_modelId(modelId), m_depthId(depthId) {
}
- virtual ~KoBasicHistogramProducerFactory() {}
+ ~KoBasicHistogramProducerFactory() override {}
- virtual KoHistogramProducer *generate() {
+ KoHistogramProducer *generate() override {
KoHistogramProducer *producer = 0;
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->colorSpace(m_modelId, m_depthId, 0);
if (cs) {
producer = new T(KoID(id(), name()), cs);
}
return producer;
}
- virtual bool isCompatibleWith(const KoColorSpace* colorSpace, bool strict = false) const {
+ bool isCompatibleWith(const KoColorSpace* colorSpace, bool strict = false) const override {
if( strict ){
return colorSpace->colorDepthId().id() == m_depthId;
}
return colorSpace->colorModelId().id() == m_modelId || colorSpace->colorDepthId().id() == m_depthId;
}
- virtual float preferrednessLevelWith(const KoColorSpace* colorSpace) const {
+ float preferrednessLevelWith(const KoColorSpace* colorSpace) const override {
return 0.5 * ( (colorSpace->colorModelId().id() == m_modelId) + (colorSpace->colorDepthId().id() == m_depthId) );
}
protected:
QString m_modelId, m_depthId;
};
/**
* This is a Producer (with associated factory) that converts the pixels of the colorspace
* to RGB8 with toQColor, and then does its counting on RGB. This is NOT registered with the
* Registry, because it isCompatibleWith all colorspaces, and should only be used in extreme
* cases (like no other producer being available
**/
class KRITAPIGMENT_EXPORT KoGenericRGBHistogramProducer : public KoBasicHistogramProducer
{
public:
KoGenericRGBHistogramProducer();
- virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace);
- virtual QString positionToString(qreal pos) const;
- virtual qreal maximalZoom() const;
- virtual QList<KoChannelInfo *> channels();
+ void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace) override;
+ QString positionToString(qreal pos) const override;
+ qreal maximalZoom() const override;
+ QList<KoChannelInfo *> channels() override;
protected:
QList<KoChannelInfo *> m_channelsList;
};
/** KoGenericRGBHistogramProducer his special Factory that isCompatibleWith everything. */
class KRITAPIGMENT_EXPORT KoGenericRGBHistogramProducerFactory : public KoHistogramProducerFactory
{
public:
KoGenericRGBHistogramProducerFactory();
- virtual ~KoGenericRGBHistogramProducerFactory() {}
+ ~KoGenericRGBHistogramProducerFactory() override {}
- virtual KoHistogramProducer *generate() {
+ KoHistogramProducer *generate() override {
return new KoGenericRGBHistogramProducer();
}
- virtual bool isCompatibleWith(const KoColorSpace*, bool strict = false) const {
+ bool isCompatibleWith(const KoColorSpace*, bool strict = false) const override {
Q_UNUSED(strict);
return true;
}
- virtual float preferrednessLevelWith(const KoColorSpace*) const {
+ float preferrednessLevelWith(const KoColorSpace*) const override {
return 0.0;
}
};
/**
* This is a Producer (with associated factory) that converts the pixels of the colorspace
* to L*a*b*, and then does its counting.
* It isCompatibleWith all colorspaces
**/
class KRITAPIGMENT_EXPORT KoGenericLabHistogramProducer : public KoBasicHistogramProducer
{
public:
KoGenericLabHistogramProducer();
- virtual ~KoGenericLabHistogramProducer();
- virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace);
- virtual QString positionToString(qreal pos) const;
- virtual qreal maximalZoom() const;
- virtual QList<KoChannelInfo *> channels();
+ ~KoGenericLabHistogramProducer() override;
+ void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace *colorSpace) override;
+ QString positionToString(qreal pos) const override;
+ qreal maximalZoom() const override;
+ QList<KoChannelInfo *> channels() override;
protected:
QList<KoChannelInfo *> m_channelsList;
};
/** KoGenericLabHistogramProducer his special Factory that isCompatibleWith everything. */
class /*KRITAPIGMENT_EXPORT*/ KoGenericLabHistogramProducerFactory : public KoHistogramProducerFactory
{
public:
KoGenericLabHistogramProducerFactory();
- virtual ~KoGenericLabHistogramProducerFactory() {}
+ ~KoGenericLabHistogramProducerFactory() override {}
- virtual KoHistogramProducer *generate() {
+ KoHistogramProducer *generate() override {
return new KoGenericLabHistogramProducer();
}
- virtual bool isCompatibleWith(const KoColorSpace*, bool strict = false) const {
+ bool isCompatibleWith(const KoColorSpace*, bool strict = false) const override {
Q_UNUSED(strict);
return true;
}
- virtual float preferrednessLevelWith(const KoColorSpace*) const {
+ float preferrednessLevelWith(const KoColorSpace*) const override {
return 0.0;
}
};
#endif // _Ko_BASIC_HISTOGRAM_PRODUCERS_
diff --git a/libs/pigment/KoColorConversionAlphaTransformation.h b/libs/pigment/KoColorConversionAlphaTransformation.h
index 4f286fc129..09a5eeded0 100644
--- a/libs/pigment/KoColorConversionAlphaTransformation.h
+++ b/libs/pigment/KoColorConversionAlphaTransformation.h
@@ -1,81 +1,81 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COLOR_CONVERSION_ALPHA_TRANSFORMATION_H_
#define _KO_COLOR_CONVERSION_ALPHA_TRANSFORMATION_H_
#include "KoColorConversionTransformation.h"
#include "KoColorConversionTransformationFactory.h"
#include <KoConfig.h>
#ifdef HAVE_OPENEXR
#include <half.h>
#endif
/**
* Create converter from the alpha color space to any color space
* This class is for use by the KoColorConversionSystemn, no reason
* to use it directly.
*/
template<typename alpha_channel_type>
class KoColorConversionFromAlphaTransformationFactoryImpl : public KoColorConversionTransformationFactory
{
public:
KoColorConversionFromAlphaTransformationFactoryImpl(const QString& _dstModelId, const QString& _dstDepthId, const QString& _dstProfileName);
- virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
+ KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
const KoColorSpace* dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const;
- virtual bool conserveColorInformation() const;
- virtual bool conserveDynamicRange() const;
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override;
+ bool conserveColorInformation() const override;
+ bool conserveDynamicRange() const override;
};
typedef KoColorConversionFromAlphaTransformationFactoryImpl<quint8> KoColorConversionFromAlphaTransformationFactory;
typedef KoColorConversionFromAlphaTransformationFactoryImpl<quint16> KoColorConversionFromAlphaU16TransformationFactory;
#ifdef HAVE_OPENEXR
typedef KoColorConversionFromAlphaTransformationFactoryImpl<half> KoColorConversionFromAlphaF16TransformationFactory;
#endif
typedef KoColorConversionFromAlphaTransformationFactoryImpl<float> KoColorConversionFromAlphaF32TransformationFactory;
/**
* Create converter to the alpha color space to any color space
* This class is for use by the KoColorConversionSystemn, no reason
* to use it directly.
*/
template <typename alpha_channel_type>
class KoColorConversionToAlphaTransformationFactoryImpl : public KoColorConversionTransformationFactory
{
public:
KoColorConversionToAlphaTransformationFactoryImpl(const QString& _dstModelId, const QString& _dstDepthId, const QString& _srcProfileName);
- virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
+ KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
const KoColorSpace* dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const;
- virtual bool conserveColorInformation() const;
- virtual bool conserveDynamicRange() const;
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override;
+ bool conserveColorInformation() const override;
+ bool conserveDynamicRange() const override;
};
typedef KoColorConversionToAlphaTransformationFactoryImpl<quint8> KoColorConversionToAlphaTransformationFactory;
typedef KoColorConversionToAlphaTransformationFactoryImpl<quint16> KoColorConversionToAlphaU16TransformationFactory;
#ifdef HAVE_OPENEXR
typedef KoColorConversionToAlphaTransformationFactoryImpl<half> KoColorConversionToAlphaF16TransformationFactory;
#endif
typedef KoColorConversionToAlphaTransformationFactoryImpl<float> KoColorConversionToAlphaF32TransformationFactory;
#endif
diff --git a/libs/pigment/KoColorConversionSystem.cpp b/libs/pigment/KoColorConversionSystem.cpp
index c55db3a0e7..0344044b11 100644
--- a/libs/pigment/KoColorConversionSystem.cpp
+++ b/libs/pigment/KoColorConversionSystem.cpp
@@ -1,504 +1,505 @@
/*
* Copyright (c) 2007-2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoColorConversionSystem.h"
#include "KoColorConversionSystem_p.h"
#include <QHash>
#include <QString>
#include "KoColorConversionAlphaTransformation.h"
#include "KoColorConversionTransformation.h"
#include "KoColorProfile.h"
#include "KoColorSpace.h"
#include "KoCopyColorConversionTransformation.h"
#include "KoMultipleColorConversionTransformation.h"
-KoColorConversionSystem::KoColorConversionSystem() : d(new Private)
+KoColorConversionSystem::KoColorConversionSystem(RegistryInterface *registryInterface)
+ : d(new Private(registryInterface))
{
}
KoColorConversionSystem::~KoColorConversionSystem()
{
qDeleteAll(d->graph);
qDeleteAll(d->vertexes);
delete d;
}
void KoColorConversionSystem::connectToEngine(Node* _node, Node* _engine)
{
Vertex* v1 = createVertex(_node, _engine);
Vertex* v2 = createVertex(_engine, _node);
v1->conserveColorInformation = !_node->isGray;
v2->conserveColorInformation = !_node->isGray;
v1->conserveDynamicRange = _engine->isHdr;
v2->conserveDynamicRange = _engine->isHdr;
}
KoColorConversionSystem::Node* KoColorConversionSystem::insertEngine(const KoColorSpaceEngine* engine)
{
NodeKey key(engine->id(), engine->id(), engine->id());
Node* n = new Node;
n->modelId = engine->id();
n->depthId = engine->id();
n->profileName = engine->id();
n->referenceDepth = 64; // engine don't have reference depth,
d->graph.insert(key, n);
n->init(engine);
return n;
}
void KoColorConversionSystem::insertColorSpace(const KoColorSpaceFactory* csf)
{
dbgPigment << "Inserting color space " << csf->name() << " (" << csf->id() << ") Model: " << csf->colorModelId() << " Depth: " << csf->colorDepthId() << " into the CCS";
- const QList<const KoColorProfile*> profiles = KoColorSpaceRegistry::instance()->profilesFor(csf);
+ const QList<const KoColorProfile*> profiles = d->registryInterface->profilesFor(csf);
QString modelId = csf->colorModelId().id();
QString depthId = csf->colorDepthId().id();
if (profiles.isEmpty()) { // There is no profile for this CS, create a node without profile name if the color engine isn't icc-based
if (csf->colorSpaceEngine() != "icc") {
Node* n = nodeFor(modelId, depthId, "default");
n->init(csf);
}
else {
dbgPigment << "Cannot add node for " << csf->name() << ", since there are no profiles available";
}
} else {
// Initialise the nodes
Q_FOREACH (const KoColorProfile* profile, profiles) {
Node* n = nodeFor(modelId, depthId, profile->name());
n->init(csf);
if (!csf->colorSpaceEngine().isEmpty()) {
KoColorSpaceEngine* engine = KoColorSpaceEngineRegistry::instance()->get(csf->colorSpaceEngine());
Q_ASSERT(engine);
NodeKey engineKey(engine->id(), engine->id(), engine->id());
Node* engineNode = 0;
QHash<NodeKey, Node*>::ConstIterator it = d->graph.constFind(engineKey);
if (it != d->graph.constEnd()) {
engineNode = it.value();
} else {
engineNode = insertEngine(engine);
}
connectToEngine(n, engineNode);
}
}
}
// Construct a link for "custom" transformation
const QList<KoColorConversionTransformationFactory*> cctfs = csf->colorConversionLinks();
Q_FOREACH (KoColorConversionTransformationFactory* cctf, cctfs) {
Node* srcNode = nodeFor(cctf->srcColorModelId(), cctf->srcColorDepthId(), cctf->srcProfile());
Q_ASSERT(srcNode);
Node* dstNode = nodeFor(cctf->dstColorModelId(), cctf->dstColorDepthId(), cctf->dstProfile());
Q_ASSERT(dstNode);
// Check if the two nodes are already connected
Vertex* v = vertexBetween(srcNode, dstNode);
// If the vertex doesn't already exist, then create it
if (!v) {
v = createVertex(srcNode, dstNode);
}
Q_ASSERT(v); // we should have one now
if (dstNode->modelId == modelId && dstNode->depthId == depthId) {
v->setFactoryFromDst(cctf);
}
if (srcNode->modelId == modelId && srcNode->depthId == depthId) {
v->setFactoryFromSrc(cctf);
}
}
}
void KoColorConversionSystem::insertColorProfile(const KoColorProfile* _profile)
{
dbgPigmentCCS << _profile->name();
- const QList< const KoColorSpaceFactory* >& factories = KoColorSpaceRegistry::instance()->colorSpacesFor(_profile);
+ const QList< const KoColorSpaceFactory* >& factories = d->registryInterface->colorSpacesFor(_profile);
Q_FOREACH (const KoColorSpaceFactory* factory, factories) {
QString modelId = factory->colorModelId().id();
QString depthId = factory->colorDepthId().id();
Node* n = nodeFor(modelId, depthId, _profile->name());
n->init(factory);
if (!factory->colorSpaceEngine().isEmpty()) {
KoColorSpaceEngine* engine = KoColorSpaceEngineRegistry::instance()->get(factory->colorSpaceEngine());
Q_ASSERT(engine);
Node* engineNode = d->graph[ NodeKey(engine->id(), engine->id(), engine->id())];
Q_ASSERT(engineNode);
connectToEngine(n, engineNode);
}
const QList<KoColorConversionTransformationFactory*> cctfs = factory->colorConversionLinks();
Q_FOREACH (KoColorConversionTransformationFactory* cctf, cctfs) {
Node* srcNode = nodeFor(cctf->srcColorModelId(), cctf->srcColorDepthId(), cctf->srcProfile());
Q_ASSERT(srcNode);
Node* dstNode = nodeFor(cctf->dstColorModelId(), cctf->dstColorDepthId(), cctf->dstProfile());
Q_ASSERT(dstNode);
if (srcNode == n || dstNode == n) {
// Check if the two nodes are already connected
Vertex* v = vertexBetween(srcNode, dstNode);
// If the vertex doesn't already exist, then create it
if (!v) {
v = createVertex(srcNode, dstNode);
}
Q_ASSERT(v); // we should have one now
if (dstNode->modelId == modelId && dstNode->depthId == depthId) {
v->setFactoryFromDst(cctf);
}
if (srcNode->modelId == modelId && srcNode->depthId == depthId) {
v->setFactoryFromSrc(cctf);
}
}
}
}
}
const KoColorSpace* KoColorConversionSystem::defaultColorSpaceForNode(const Node* node) const
{
- return KoColorSpaceRegistry::instance()->colorSpace(node->modelId, node->depthId, node->profileName);
+ return d->registryInterface->colorSpace(node->modelId, node->depthId, node->profileName);
}
KoColorConversionSystem::Node* KoColorConversionSystem::createNode(const QString& _modelId, const QString& _depthId, const QString& _profileName)
{
Node* n = new Node;
n->modelId = _modelId;
n->depthId = _depthId;
n->profileName = _profileName;
d->graph.insert(NodeKey(_modelId, _depthId, _profileName), n);
return n;
}
const KoColorConversionSystem::Node* KoColorConversionSystem::nodeFor(const KoColorSpace* _colorSpace) const
{
const KoColorProfile* profile = _colorSpace->profile();
return nodeFor(_colorSpace->colorModelId().id(), _colorSpace->colorDepthId().id(),
profile ? profile->name() : "default");
}
const KoColorConversionSystem::Node* KoColorConversionSystem::nodeFor(const QString& _colorModelId, const QString& _colorDepthId, const QString& _profileName) const
{
dbgPigmentCCS << "Look for node: " << _colorModelId << " " << _colorDepthId << " " << _profileName;
return nodeFor(NodeKey(_colorModelId, _colorDepthId, _profileName));
}
const KoColorConversionSystem::Node* KoColorConversionSystem::nodeFor(const NodeKey& key) const
{
dbgPigmentCCS << "Look for node: " << key.modelId << " " << key.depthId << " " << key.profileName << " " << d->graph.value(key);
return d->graph.value(key);
}
KoColorConversionSystem::Node* KoColorConversionSystem::nodeFor(const QString& _colorModelId, const QString& _colorDepthId, const QString& _profileName)
{
return nodeFor(NodeKey(_colorModelId, _colorDepthId, _profileName));
}
KoColorConversionSystem::Node* KoColorConversionSystem::nodeFor(const KoColorConversionSystem::NodeKey& key)
{
QHash<NodeKey, Node*>::ConstIterator it = d->graph.constFind(key);
if (it != d->graph.constEnd()) {
return it.value();
} else {
return createNode(key.modelId, key.depthId, key.profileName);
}
}
QList<KoColorConversionSystem::Node*> KoColorConversionSystem::nodesFor(const QString& _modelId, const QString& _depthId)
{
QList<Node*> nodes;
Q_FOREACH (Node* node, d->graph) {
if (node->modelId == _modelId && node->depthId == _depthId) {
nodes << node;
}
}
return nodes;
}
KoColorConversionTransformation* KoColorConversionSystem::createColorConverter(const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
if (*srcColorSpace == *dstColorSpace) {
return new KoCopyColorConversionTransformation(srcColorSpace);
}
Q_ASSERT(srcColorSpace);
Q_ASSERT(dstColorSpace);
dbgPigmentCCS << srcColorSpace->id() << (srcColorSpace->profile() ? srcColorSpace->profile()->name() : "default");
dbgPigmentCCS << dstColorSpace->id() << (dstColorSpace->profile() ? dstColorSpace->profile()->name() : "default");
Path path = findBestPath(
nodeFor(srcColorSpace),
nodeFor(dstColorSpace));
Q_ASSERT(path.length() > 0);
KoColorConversionTransformation* transfo = createTransformationFromPath(path, srcColorSpace, dstColorSpace, renderingIntent, conversionFlags);
Q_ASSERT(*transfo->srcColorSpace() == *srcColorSpace);
Q_ASSERT(*transfo->dstColorSpace() == *dstColorSpace);
Q_ASSERT(transfo);
return transfo;
}
void KoColorConversionSystem::createColorConverters(const KoColorSpace* colorSpace, const QList< QPair<KoID, KoID> >& possibilities, KoColorConversionTransformation*& fromCS, KoColorConversionTransformation*& toCS) const
{
// TODO This function currently only select the best conversion only based on the transformation
// from colorSpace to one of the color spaces in the list, but not the other way around
// it might be worth to look also the return path.
const Node* csNode = nodeFor(colorSpace);
PathQualityChecker pQC(csNode->referenceDepth, !csNode->isHdr, !csNode->isGray);
// Look for a color conversion
Path bestPath;
typedef QPair<KoID, KoID> KoID2KoID;
Q_FOREACH (const KoID2KoID & possibility, possibilities) {
- const KoColorSpaceFactory* csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(KoColorSpaceRegistry::instance()->colorSpaceId(possibility.first.id(), possibility.second.id()));
+ const KoColorSpaceFactory* csf = d->registryInterface->colorSpaceFactory(possibility.first.id(), possibility.second.id());
if (csf) {
Path path = findBestPath(csNode, nodeFor(csf->colorModelId().id(), csf->colorDepthId().id(), csf->defaultProfile()));
Q_ASSERT(path.length() > 0);
path.isGood = pQC.isGoodPath(path);
if (bestPath.isEmpty()) {
bestPath = path;
} else if ((!bestPath.isGood && path.isGood) || pQC.lessWorseThan(path, bestPath)) {
bestPath = path;
}
}
}
Q_ASSERT(!bestPath.isEmpty());
const KoColorSpace* endColorSpace = defaultColorSpaceForNode(bestPath.endNode());
fromCS = createTransformationFromPath(bestPath, colorSpace, endColorSpace, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
Path returnPath = findBestPath(bestPath.endNode(), csNode);
Q_ASSERT(!returnPath.isEmpty());
toCS = createTransformationFromPath(returnPath, endColorSpace, colorSpace, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
Q_ASSERT(*toCS->dstColorSpace() == *fromCS->srcColorSpace());
Q_ASSERT(*fromCS->dstColorSpace() == *toCS->srcColorSpace());
}
KoColorConversionTransformation* KoColorConversionSystem::createTransformationFromPath(const Path &path, const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
Q_ASSERT(srcColorSpace->colorModelId().id() == path.startNode()->modelId);
Q_ASSERT(srcColorSpace->colorDepthId().id() == path.startNode()->depthId);
Q_ASSERT(dstColorSpace->colorModelId().id() == path.endNode()->modelId);
Q_ASSERT(dstColorSpace->colorDepthId().id() == path.endNode()->depthId);
KoColorConversionTransformation* transfo;
const QList< Path::node2factory > pathOfNode = path.compressedPath();
if (pathOfNode.size() == 2) { // Direct connection
transfo = pathOfNode[1].second->createColorTransformation(srcColorSpace, dstColorSpace, renderingIntent, conversionFlags);
}
else {
KoMultipleColorConversionTransformation* mccTransfo = new KoMultipleColorConversionTransformation(srcColorSpace, dstColorSpace, renderingIntent, conversionFlags);
transfo = mccTransfo;
// Get the first intermediary color space
dbgPigmentCCS << pathOfNode[ 0 ].first->id() << " to " << pathOfNode[ 1 ].first->id();
const KoColorSpace* intermCS =
defaultColorSpaceForNode(pathOfNode[1].first);
mccTransfo->appendTransfo(pathOfNode[1].second->createColorTransformation(srcColorSpace, intermCS, renderingIntent, conversionFlags));
for (int i = 2; i < pathOfNode.size() - 1; i++) {
dbgPigmentCCS << pathOfNode[ i - 1 ].first->id() << " to " << pathOfNode[ i ].first->id();
const KoColorSpace* intermCS2 = defaultColorSpaceForNode(pathOfNode[i].first);
Q_ASSERT(intermCS2);
mccTransfo->appendTransfo(pathOfNode[i].second->createColorTransformation(intermCS, intermCS2, renderingIntent, conversionFlags));
intermCS = intermCS2;
}
dbgPigmentCCS << pathOfNode[ pathOfNode.size() - 2 ].first->id() << " to " << pathOfNode[ pathOfNode.size() - 1 ].first->id();
mccTransfo->appendTransfo(pathOfNode.last().second->createColorTransformation(intermCS, dstColorSpace, renderingIntent, conversionFlags));
}
return transfo;
}
KoColorConversionSystem::Vertex* KoColorConversionSystem::vertexBetween(KoColorConversionSystem::Node* srcNode, KoColorConversionSystem::Node* dstNode)
{
Q_FOREACH (Vertex* oV, srcNode->outputVertexes) {
if (oV->dstNode == dstNode) {
return oV;
}
}
return 0;
}
KoColorConversionSystem::Vertex* KoColorConversionSystem::createVertex(Node* srcNode, Node* dstNode)
{
Vertex* v = new Vertex(srcNode, dstNode);
srcNode->outputVertexes.append(v);
d->vertexes.append(v);
return v;
}
// -- Graph visualization functions --
QString KoColorConversionSystem::vertexToDot(KoColorConversionSystem::Vertex* v, const QString &options) const
{
return QString(" \"%1\" -> \"%2\" %3\n").arg(v->srcNode->id()).arg(v->dstNode->id()).arg(options);
}
QString KoColorConversionSystem::toDot() const
{
QString dot = "digraph CCS {\n";
Q_FOREACH (Vertex* oV, d->vertexes) {
dot += vertexToDot(oV, "default") ;
}
dot += "}\n";
return dot;
}
bool KoColorConversionSystem::existsPath(const QString& srcModelId, const QString& srcDepthId, const QString& srcProfileName, const QString& dstModelId, const QString& dstDepthId, const QString& dstProfileName) const
{
dbgPigmentCCS << "srcModelId = " << srcModelId << " srcDepthId = " << srcDepthId << " srcProfileName = " << srcProfileName << " dstModelId = " << dstModelId << " dstDepthId = " << dstDepthId << " dstProfileName = " << dstProfileName;
const Node* srcNode = nodeFor(srcModelId, srcDepthId, srcProfileName);
const Node* dstNode = nodeFor(dstModelId, dstDepthId, dstProfileName);
if (srcNode == dstNode) return true;
if (!srcNode) return false;
if (!dstNode) return false;
Path path = findBestPath(srcNode, dstNode);
bool exist = !path.isEmpty();
return exist;
}
bool KoColorConversionSystem::existsGoodPath(const QString& srcModelId, const QString& srcDepthId, const QString& srcProfileName, const QString& dstModelId, const QString& dstDepthId, const QString& dstProfileName) const
{
const Node* srcNode = nodeFor(srcModelId, srcDepthId, srcProfileName);
const Node* dstNode = nodeFor(dstModelId, dstDepthId, dstProfileName);
if (srcNode == dstNode) return true;
if (!srcNode) return false;
if (!dstNode) return false;
Path path = findBestPath(srcNode, dstNode);
bool existAndGood = path.isGood;
return existAndGood;
}
QString KoColorConversionSystem::bestPathToDot(const QString& srcKey, const QString& dstKey) const
{
const Node* srcNode = 0;
const Node* dstNode = 0;
Q_FOREACH (Node* node, d->graph) {
if (node->id() == srcKey) {
srcNode = node;
}
if (node->id() == dstKey) {
dstNode = node;
}
}
Path p = findBestPath(srcNode, dstNode);
Q_ASSERT(!p.isEmpty());
QString dot = "digraph CCS {\n" +
QString(" \"%1\" [color=red]\n").arg(srcNode->id()) +
QString(" \"%1\" [color=red]\n").arg(dstNode->id());
Q_FOREACH (Vertex* oV, d->vertexes) {
QString options;
if (p.vertexes.contains(oV)) {
options = "[color=red]";
}
dot += vertexToDot(oV, options) ;
}
dot += "}\n";
return dot;
}
inline KoColorConversionSystem::Path KoColorConversionSystem::findBestPathImpl2(const KoColorConversionSystem::Node* srcNode, const KoColorConversionSystem::Node* dstNode, bool ignoreHdr, bool ignoreColorCorrectness) const
{
PathQualityChecker pQC(qMin(srcNode->referenceDepth, dstNode->referenceDepth), ignoreHdr, ignoreColorCorrectness);
Node2PathHash node2path; // current best path to reach a given node
QList<Path> possiblePaths; // list of all paths
// Generate the initial list of paths
Q_FOREACH (Vertex* v, srcNode->outputVertexes) {
if (v->dstNode->isInitialized) {
Path p;
p.appendVertex(v);
Node* endNode = v->dstNode;
if (endNode == dstNode) {
Q_ASSERT(pQC.isGoodPath(p)); // <- it's a direct link, it has to be a good path
p.isGood = true;
return p;
} else {
Q_ASSERT(!node2path.contains(endNode)); // That would be a total fuck up if there are two vertexes between two nodes
node2path.insert(endNode, p);
possiblePaths.append(p);
}
}
}
Path currentBestPath;
// Continue while there are any possibilities remaining
while (possiblePaths.size() > 0) {
// Loop through all paths and explore one step further
const QList<Path> currentPaths = possiblePaths;
for (const Path &p : currentPaths) {
const Node* endNode = p.endNode();
for (Vertex* v : endNode->outputVertexes) {
if (v->dstNode->isInitialized && !p.contains(v->dstNode)) {
Path newP = p; // Candidate
newP.appendVertex(v);
Node* newEndNode = v->dstNode;
if (newEndNode == dstNode) {
if (pQC.isGoodPath(newP)) { // Victory
newP.isGood = true;
return newP;
} else if (pQC.lessWorseThan(newP, currentBestPath)) {
Q_ASSERT(newP.startNode()->id() == currentBestPath.startNode()->id());
Q_ASSERT(newP.endNode()->id() == currentBestPath.endNode()->id());
// Can we do better than dumping memory values???
// warnPigment << pQC.lessWorseThan(newP, currentBestPath) << " " << newP << " " << currentBestPath;
currentBestPath = newP;
}
} else {
// This is an incomplete path. Check if there's a better way to get to its endpoint.
Node2PathHash::Iterator it = node2path.find(newEndNode);
if (it != node2path.end()) {
Path &p2 = it.value();
if (pQC.lessWorseThan(newP, p2)) {
p2 = newP;
possiblePaths.append(newP);
}
} else {
node2path.insert(newEndNode, newP);
possiblePaths.append(newP);
}
}
}
}
possiblePaths.removeAll(p); // Remove from list of remaining paths
}
}
if (!currentBestPath.isEmpty()) {
warnPigment << "No good path from " << srcNode->id() << " to " << dstNode->id() << " found : length = " << currentBestPath.length() << " cost = " << currentBestPath.cost << " referenceDepth = " << currentBestPath.referenceDepth << " respectColorCorrectness = " << currentBestPath.respectColorCorrectness << " isGood = " << currentBestPath.isGood ;
return currentBestPath;
}
errorPigment << "No path from " << srcNode->id() << " to " << dstNode->id() << " found not ";
return currentBestPath;
}
inline KoColorConversionSystem::Path KoColorConversionSystem::findBestPathImpl(const KoColorConversionSystem::Node* srcNode, const KoColorConversionSystem::Node* dstNode, bool ignoreHdr) const
{
Q_ASSERT(srcNode);
Q_ASSERT(dstNode);
return findBestPathImpl2(srcNode, dstNode, ignoreHdr, (srcNode->isGray || dstNode->isGray));
}
KoColorConversionSystem::Path KoColorConversionSystem::findBestPath(const KoColorConversionSystem::Node* srcNode, const KoColorConversionSystem::Node* dstNode) const
{
Q_ASSERT(srcNode);
Q_ASSERT(dstNode);
dbgPigmentCCS << "Find best path between " << srcNode->id() << " and " << dstNode->id();
if (srcNode->isHdr && dstNode->isHdr) {
return findBestPathImpl(srcNode, dstNode, false);
} else {
return findBestPathImpl(srcNode, dstNode, true);
}
}
diff --git a/libs/pigment/KoColorConversionSystem.h b/libs/pigment/KoColorConversionSystem.h
index 086d6795b9..49b39b9889 100644
--- a/libs/pigment/KoColorConversionSystem.h
+++ b/libs/pigment/KoColorConversionSystem.h
@@ -1,180 +1,190 @@
/*
* Copyright (c) 2007-2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COLOR_CONVERSION_SYSTEM_H_
#define _KO_COLOR_CONVERSION_SYSTEM_H_
class KoColorProfile;
class KoColorSpace;
class KoColorSpaceFactory;
class KoColorSpaceEngine;
class KoID;
#include "KoColorConversionTransformation.h"
#include <QList>
#include <QPair>
#include "kritapigment_export.h"
/**
* This class hold the logic related to pigment's Color Conversion System. It's
* basically a graph containing all the possible color transformation between
* the color spaces. The most useful functions are createColorConverter to create
* a color conversion between two color spaces, and insertColorSpace which is called
* by KoColorSpaceRegistry each time a new color space is added to the registry.
*
* This class is not part of public API, and can be changed without notice.
*/
class KRITAPIGMENT_EXPORT KoColorConversionSystem
{
+public:
+ struct RegistryInterface {
+ virtual ~RegistryInterface() {}
+
+ virtual const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName) = 0;
+ virtual const KoColorSpaceFactory* colorSpaceFactory(const QString &colorModelId, const QString &colorDepthId) const = 0;
+ virtual QList<const KoColorProfile *> profilesFor(const KoColorSpaceFactory * csf) const = 0;
+ virtual QList<const KoColorSpaceFactory*> colorSpacesFor(const KoColorProfile* profile) const = 0;
+ };
+
public:
struct Node;
struct Vertex;
struct NodeKey;
friend uint qHash(const KoColorConversionSystem::NodeKey &key);
struct Path;
/**
* Construct a Color Conversion System, leave to the KoColorSpaceRegistry to
* create it.
*/
- KoColorConversionSystem();
+ KoColorConversionSystem(RegistryInterface *registryInterface);
~KoColorConversionSystem();
/**
* This function is called by the KoColorSpaceRegistry to add a new color space
* to the graph of transformation.
*/
void insertColorSpace(const KoColorSpaceFactory*);
void insertColorProfile(const KoColorProfile*);
/**
* This function is called by the color space to create a color conversion
* between two color space. This function search in the graph of transformations
* the best possible path between the two color space.
*/
KoColorConversionTransformation* createColorConverter(const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const;
/**
* This function creates two transformations, one from the color space and one to the
* color space. The destination color space is picked from a list of color space, such
* as the conversion between the two color space is of the best quality.
*
* The typical use case of this function is for KoColorTransformationFactory which
* doesn't support all color spaces, so unsupported color space have to find an
* acceptable conversion in order to use that KoColorTransformationFactory.
*
* @param colorSpace the source color space
* @param possibilities a list of color space among which we need to find the best
* conversion
* @param fromCS the conversion from the source color space will be affected to this
* variable
* @param toCS the revert conversion to the source color space will be affected to this
* variable
*/
void createColorConverters(const KoColorSpace* colorSpace, const QList< QPair<KoID, KoID> >& possibilities, KoColorConversionTransformation*& fromCS, KoColorConversionTransformation*& toCS) const;
public:
/**
* This function return a text that can be compiled using dot to display
* the graph of color conversion connection.
*/
QString toDot() const;
/**
* This function return a text that can be compiled using dot to display
* the graph of color conversion connection, with a red link to show the
* path of the best color conversion.
*/
QString bestPathToDot(const QString& srcKey, const QString& dstKey) const;
public:
/**
* @return true if there is a path between two color spaces
*/
bool existsPath(const QString& srcModelId, const QString& srcDepthId, const QString& srcProfileName, const QString& dstModelId, const QString& dstDepthId, const QString& dstProfileName) const;
/**
* @return true if there is a good path between two color spaces
*/
bool existsGoodPath(const QString& srcModelId, const QString& srcDepthId, const QString& srcProfileName, const QString& dstModelId, const QString& dstDepthId, const QString& dstProfileName) const;
private:
QString vertexToDot(Vertex* v, const QString &options) const;
private:
/**
* Insert an engine.
*/
Node* insertEngine(const KoColorSpaceEngine* engine);
KoColorConversionTransformation* createTransformationFromPath(const KoColorConversionSystem::Path& path, const KoColorSpace* srcColorSpace, const KoColorSpace* dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const;
/**
* Query the registry to get the color space associated with this
* node. (default profile)
*/
const KoColorSpace* defaultColorSpaceForNode(const Node* node) const;
/**
* Create a new node
*/
Node* createNode(const QString& _modelId, const QString& _depthId, const QString& _profileName);
/**
* Initialise a node for ICC color spaces
*/
void connectToEngine(Node* _node, Node* _engine);
const Node* nodeFor(const KoColorSpace*) const;
/**
* @return the node corresponding to that key, or create it if needed
*/
Node* nodeFor(const NodeKey& key);
const Node* nodeFor(const NodeKey& key) const;
/**
* @return the list of nodes that correspond to a given model and depth.
*/
QList<Node*> nodesFor(const QString& _modelId, const QString& _depthId);
/**
* @return the node associated with that key, and create it if needed
*/
Node* nodeFor(const QString& colorModelId, const QString& colorDepthId, const QString& _profileName);
const Node* nodeFor(const QString& colorModelId, const QString& colorDepthId, const QString& _profileName) const;
/**
* @return the vertex between two nodes, or null if the vertex doesn't exist
*/
Vertex* vertexBetween(Node* srcNode, Node* dstNode);
/**
* create a vertex between two nodes and return it.
*/
Vertex* createVertex(Node* srcNode, Node* dstNode);
/**
* looks for the best path between two nodes
*/
Path findBestPath(const Node* srcNode, const Node* dstNode) const;
/**
* Delete all the paths of the list given in argument.
*/
void deletePaths(QList<KoColorConversionSystem::Path*> paths) const;
/**
* Don't call that function, but raher findBestPath
* @internal
*/
inline Path findBestPathImpl2(const Node* srcNode, const Node* dstNode, bool ignoreHdr, bool ignoreColorCorrectness) const;
/**
* Don't call that function, but raher findBestPath
* @internal
*/
inline Path findBestPathImpl(const Node* srcNode, const Node* dstNode, bool ignoreHdr) const;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/pigment/KoColorConversionSystem_p.h b/libs/pigment/KoColorConversionSystem_p.h
index e6536bf18a..5d21f930a7 100644
--- a/libs/pigment/KoColorConversionSystem_p.h
+++ b/libs/pigment/KoColorConversionSystem_p.h
@@ -1,324 +1,327 @@
/*
* Copyright (c) 2007-2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORCONVERSIONSYSTEM_P_H
#define KOCOLORCONVERSIONSYSTEM_P_H
#include "DebugPigment.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorModelStandardIds.h"
#include "KoColorConversionTransformationFactory.h"
#include "KoColorSpaceEngine.h"
#include <QList>
struct KoColorConversionSystem::Node {
Node()
: isHdr(false)
, isInitialized(false)
, referenceDepth(0)
, isGray(false)
, crossingCost(1)
, colorSpaceFactory(0)
, isEngine(false)
, engine(0) {}
void init(const KoColorSpaceFactory* _colorSpaceFactory) {
dbgPigment << "Initialise " << modelId << " " << depthId << " " << profileName;
if (isInitialized) {
dbgPigment << "Re-initializing node. Old factory" << colorSpaceFactory << "new factory" << _colorSpaceFactory;
}
isInitialized = true;
if (_colorSpaceFactory) {
isHdr = _colorSpaceFactory->isHdr();
colorSpaceFactory = _colorSpaceFactory;
referenceDepth = _colorSpaceFactory->referenceDepth();
isGray = (_colorSpaceFactory->colorModelId() == GrayAColorModelID
|| _colorSpaceFactory->colorModelId() == GrayColorModelID
|| _colorSpaceFactory->colorModelId() == AlphaColorModelID);
}
}
void init(const KoColorSpaceEngine* _engine) {
Q_ASSERT(!isInitialized);
isEngine = true;
isInitialized = true;
isHdr = true;
engine = _engine;
}
QString id() const {
return modelId + " " + depthId + " " + profileName;
}
QString modelId;
QString depthId;
QString profileName;
bool isHdr;
bool isInitialized;
int referenceDepth;
QList<Vertex*> outputVertexes;
bool isGray;
int crossingCost;
const KoColorSpaceFactory* colorSpaceFactory;
bool isEngine;
const KoColorSpaceEngine* engine;
};
Q_DECLARE_TYPEINFO(KoColorConversionSystem::Node, Q_MOVABLE_TYPE);
struct KoColorConversionSystem::Vertex {
Vertex(Node* _srcNode, Node* _dstNode)
: srcNode(_srcNode)
, dstNode(_dstNode)
, factoryFromSrc(0)
, factoryFromDst(0) {
}
~Vertex() {
if (factoryFromSrc == factoryFromDst) {
delete factoryFromSrc;
} else {
delete factoryFromSrc;
delete factoryFromDst;
}
}
void setFactoryFromSrc(KoColorConversionTransformationFactory* factory) {
factoryFromSrc = factory;
initParameter(factoryFromSrc);
}
void setFactoryFromDst(KoColorConversionTransformationFactory* factory) {
factoryFromDst = factory;
if (!factoryFromSrc) initParameter(factoryFromDst);
}
void initParameter(KoColorConversionTransformationFactory* transfo) {
conserveColorInformation = transfo->conserveColorInformation();
conserveDynamicRange = transfo->conserveDynamicRange();
}
KoColorConversionTransformationFactory* factory() {
if (factoryFromSrc) return factoryFromSrc;
return factoryFromDst;
}
Node* srcNode;
Node* dstNode;
bool conserveColorInformation;
bool conserveDynamicRange;
private:
KoColorConversionTransformationFactory* factoryFromSrc; // Factory provided by the destination node
KoColorConversionTransformationFactory* factoryFromDst; // Factory provided by the destination node
};
struct KoColorConversionSystem::NodeKey {
NodeKey(const QString &_modelId, const QString &_depthId, const QString &_profileName)
: modelId(_modelId)
, depthId(_depthId)
, profileName(_profileName) {}
bool operator==(const KoColorConversionSystem::NodeKey& rhs) const {
return modelId == rhs.modelId && depthId == rhs.depthId && profileName == rhs.profileName;
}
QString modelId;
QString depthId;
QString profileName;
};
Q_DECLARE_TYPEINFO(KoColorConversionSystem::NodeKey, Q_MOVABLE_TYPE);
struct KoColorConversionSystem::Path {
Path()
: respectColorCorrectness(true)
, referenceDepth(0)
, keepDynamicRange(true)
, isGood(false)
, cost(0) {}
Node* startNode() {
return (vertexes.first())->srcNode;
}
bool operator==(const Path &other) const {
return other.vertexes == vertexes;
}
const Node* startNode() const {
return (vertexes.first())->srcNode;
}
Node* endNode() {
return (vertexes.last())->dstNode;
}
const Node* endNode() const {
return (vertexes.last())->dstNode;
}
bool isEmpty() const {
return vertexes.isEmpty();
}
void appendVertex(Vertex* v) {
if (vertexes.empty()) {
referenceDepth = v->srcNode->referenceDepth;
}
vertexes.append(v);
if (!v->conserveColorInformation) respectColorCorrectness = false;
if (!v->conserveDynamicRange) keepDynamicRange = false;
referenceDepth = qMin(referenceDepth, v->dstNode->referenceDepth);
cost += v->dstNode->crossingCost;
}
// Compress path to hide the Engine node and correctly select the factory
typedef QPair<Node*, const KoColorConversionTransformationAbstractFactory* > node2factory;
QList< node2factory > compressedPath() const {
QList< node2factory > nodes;
nodes.push_back(node2factory(vertexes.first()->srcNode , vertexes.first()->factory()));
const KoColorConversionTransformationAbstractFactory* previousFactory = 0;
Q_FOREACH (Vertex* vertex, vertexes) { // Unless the node is the icc node, add it to the path
Node* n = vertex->dstNode;
if (n->isEngine) {
previousFactory = n->engine;
} else {
nodes.push_back(
node2factory(n,
previousFactory ? previousFactory : vertex->factory()));
previousFactory = 0;
}
}
return nodes;
}
int length() const {
return vertexes.size();
}
bool contains(Node* n) const {
Q_FOREACH (Vertex* v, vertexes) {
if (v->srcNode == n || v->dstNode == n) {
return true;
}
}
return false;
}
QList<Vertex*> vertexes;
bool respectColorCorrectness;
int referenceDepth;
bool keepDynamicRange;
bool isGood;
int cost;
};
Q_DECLARE_TYPEINFO(KoColorConversionSystem::Path, Q_MOVABLE_TYPE);
inline QDebug operator<<(QDebug dbg, const KoColorConversionSystem::Path &path)
{
bool havePrintedFirst = false;
Q_FOREACH (const KoColorConversionSystem::Vertex *v, path.vertexes) {
if (!havePrintedFirst) {
dbg.nospace() << v->srcNode->id();
havePrintedFirst = true;
}
dbg.nospace() << "->" << v->dstNode->id();
}
return dbg.space();
}
typedef QHash<KoColorConversionSystem::Node*, KoColorConversionSystem::Path > Node2PathHash;
uint qHash(const KoColorConversionSystem::NodeKey &key)
{
return qHash(key.modelId) + qHash(key.depthId);
}
struct Q_DECL_HIDDEN KoColorConversionSystem::Private {
+ Private(RegistryInterface *_registryInterface) : registryInterface(_registryInterface) {}
+
QHash<NodeKey, Node*> graph;
QList<Vertex*> vertexes;
+ RegistryInterface *registryInterface;
};
#define CHECK_ONE_AND_NOT_THE_OTHER(name) \
if(path1. name && !path2. name) \
{ \
return true; \
} \
if(!path1. name && path2. name) \
{ \
return false; \
}
struct PathQualityChecker {
PathQualityChecker(int _referenceDepth, bool _ignoreHdr, bool _ignoreColorCorrectness)
: referenceDepth(_referenceDepth)
, ignoreHdr(_ignoreHdr)
, ignoreColorCorrectness(_ignoreColorCorrectness)
{}
/// @return true if the path maximize all the criterions (except length)
inline bool isGoodPath(const KoColorConversionSystem::Path & path) const {
return (path.respectColorCorrectness || ignoreColorCorrectness) &&
(path.referenceDepth >= referenceDepth) &&
(path.keepDynamicRange || ignoreHdr);
}
/**
* Compare two paths.
*/
inline bool lessWorseThan(const KoColorConversionSystem::Path &path1, const KoColorConversionSystem::Path &path2) const {
// There is no point in comparing two paths which doesn't start from the same node or doesn't end at the same node
if (!ignoreHdr) {
CHECK_ONE_AND_NOT_THE_OTHER(keepDynamicRange)
}
if (!ignoreColorCorrectness) {
CHECK_ONE_AND_NOT_THE_OTHER(respectColorCorrectness)
}
if (path1.referenceDepth == path2.referenceDepth) {
return path1.cost < path2.cost; // if they have the same cost, well anyway you have to choose one, and there is no point in keeping one and not the other
}
return path1.referenceDepth > path2.referenceDepth;
}
int referenceDepth;
bool ignoreHdr;
bool ignoreColorCorrectness;
};
#undef CHECK_ONE_AND_NOT_THE_OTHER
#endif
diff --git a/libs/pigment/KoColorConversionTransformation.h b/libs/pigment/KoColorConversionTransformation.h
index 94fafabc4c..be32ad08d7 100644
--- a/libs/pigment/KoColorConversionTransformation.h
+++ b/libs/pigment/KoColorConversionTransformation.h
@@ -1,139 +1,139 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COLOR_CONVERSION_TRANSFORMATION_H_
#define _KO_COLOR_CONVERSION_TRANSFORMATION_H_
#include "KoColorTransformation.h"
#include "kritapigment_export.h"
class KoColorSpace;
class KoColorConversionCache;
/**
* This is the base class of all color transform that convert the color of a pixel
*/
class KRITAPIGMENT_EXPORT KoColorConversionTransformation : public KoColorTransformation
{
friend class KoColorConversionCache;
struct Private;
public:
/**
* Possible value for the intent of a color conversion (useful only for ICC
* transformations)
*/
enum Intent {
IntentPerceptual = 0,
IntentRelativeColorimetric = 1,
IntentSaturation = 2,
IntentAbsoluteColorimetric = 3
};
/**
* Flags for the color conversion, see lcms2 documentation for more information
*/
enum ConversionFlag {
Empty = 0x0,
NoOptimization = 0x0100,
GamutCheck = 0x1000, // Out of Gamut alarm
SoftProofing = 0x4000, // Do softproofing
BlackpointCompensation = 0x2000,
NoWhiteOnWhiteFixup = 0x0004, // Don't fix scum dot
HighQuality = 0x0400, // Use more memory to give better accurancy
LowQuality = 0x0800 // Use less memory to minimize resouces
};
Q_DECLARE_FLAGS(ConversionFlags, ConversionFlag)
/**
* We have numerous places where we need to convert color spaces.
*
* In several cases the user asks us about the conversion
* explicitly, e.g. when changing the image type or converting
* pixel data to the monitor profile. Doing this explicitly the
* user can choose what rendering intent and conversion flags to
* use.
*
* But there are also cases when we have to do a conversion
* internally (transparently for the user), for example, when
* merging heterogeneous images, creating thumbnails, converting
* data to/from QImage or while doing some adjustments. We cannot
* ask the user about parameters for every single
* conversion. That's why in all these non-critical cases the
* following default values should be used.
*/
static Intent internalRenderingIntent() { return IntentPerceptual; }
static ConversionFlags internalConversionFlags() { return BlackpointCompensation; }
static Intent adjustmentRenderingIntent() { return IntentPerceptual; }
static ConversionFlags adjustmentConversionFlags() { return ConversionFlags(BlackpointCompensation | NoWhiteOnWhiteFixup); }
public:
KoColorConversionTransformation(const KoColorSpace* srcCs,
const KoColorSpace* dstCs,
Intent renderingIntent,
ConversionFlags conversionFlags);
- ~KoColorConversionTransformation();
+ ~KoColorConversionTransformation() override;
public:
/**
* @return the source color space for this transformation.
*/
const KoColorSpace* srcColorSpace() const;
/**
* @return the destination color space for this transformation.
*/
const KoColorSpace* dstColorSpace() const;
/**
* @return the rendering intent of this transformation (this is only useful
* for ICC transformations)
*/
Intent renderingIntent() const;
/**
* @return the conversion flags
*/
ConversionFlags conversionFlags() const;
/**
* perform the color conversion between two buffers.
* @param nPixels the number of pixels in the buffers.
*/
- virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const = 0;
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override = 0;
/**
* @return false if the transformation is not valid
*/
- virtual bool isValid() const { return true; }
+ bool isValid() const override { return true; }
private:
void setSrcColorSpace(const KoColorSpace*) const;
void setDstColorSpace(const KoColorSpace*) const;
Private * const d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KoColorConversionTransformation::ConversionFlags)
#endif
diff --git a/libs/pigment/KoColorConversionTransformationFactory.h b/libs/pigment/KoColorConversionTransformationFactory.h
index e0a93eef6f..a0059b2648 100644
--- a/libs/pigment/KoColorConversionTransformationFactory.h
+++ b/libs/pigment/KoColorConversionTransformationFactory.h
@@ -1,103 +1,103 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COLOR_CONVERSION_TRANSFORMATION_FACTORY_H_
#define _KO_COLOR_CONVERSION_TRANSFORMATION_FACTORY_H_
class KoColorSpace;
class KoColorConversionTransformation;
#include <QString>
#include <KoColorConversionTransformationAbstractFactory.h>
/**
* Factory to create a color transformation between two colorsapces.
*/
class KRITAPIGMENT_EXPORT KoColorConversionTransformationFactory : public KoColorConversionTransformationAbstractFactory
{
public:
/**
* Create a color conversion tranformation factory, that can create
* KoColorConversionTrasnformation object between a source colorspace
* and a destination colorspace.
*
* @param _srcModelId id for the source color model
* @param _srcDepthId id for the source depth
* @param _dstModelId id for the destination color model
* @param _dstDepthId id for the destination depth
* @param _srcProfile name of the source profile, or empty if any profile
* @param _dstProfile name of the destination profile, or empty if any profile
*/
KoColorConversionTransformationFactory(const QString &_srcModelId, const QString &_srcDepthId, const QString &_srcProfile, const QString &_dstModelId, const QString &_dstDepthId, const QString &_dstProfile);
- virtual ~KoColorConversionTransformationFactory();
+ ~KoColorConversionTransformationFactory() override;
/**
* @return true if this factory creates a color conversion transformation which
* conserve color information (typical color transformation that lose that information
* is anything to grayscale).
*/
virtual bool conserveColorInformation() const = 0;
/**
* @return true if this factory creates a color conversion transformation which
* conserve the dynamic range of the color.
*/
virtual bool conserveDynamicRange() const = 0;
public:
/**
* @return the id of the source color model
*/
QString srcColorModelId() const;
/**
* @return the id of the source color depth
*/
QString srcColorDepthId() const;
/**
* @return the name of the source profile (note that an empty name
* means all profiles can be used)
*/
QString srcProfile() const;
/**
* @return the id of the destination color model
*/
QString dstColorModelId() const;
/**
* @return the id of the destination color depth
*/
QString dstColorDepthId() const;
/**
* @return the name of the destination profile (note that an empty name
* means all profiles can be used)
*/
QString dstProfile() const;
protected:
/**
* @param srcCS source color space
* @return true if the color space given as argument can be used as a source colorspace
*/
bool canBeSource(const KoColorSpace* srcCS) const;
/**
* @param dstCS destination color space
* @return true if the color space given as argument can be used as a destination colorspace
*/
bool canBeDestination(const KoColorSpace* dstCS) const;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/pigment/KoColorDisplayRendererInterface.h b/libs/pigment/KoColorDisplayRendererInterface.h
index fb8f07937c..59de86b5e2 100644
--- a/libs/pigment/KoColorDisplayRendererInterface.h
+++ b/libs/pigment/KoColorDisplayRendererInterface.h
@@ -1,129 +1,129 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __KO_COLOR_DISPLAY_RENDERER_INTERFACE_H
#define __KO_COLOR_DISPLAY_RENDERER_INTERFACE_H
#include <QObject>
#include <QColor>
#include <QSharedPointer>
#include "KoColor.h"
class KoChannelInfo;
class KoColorSpace;
/**
* A special interface class provided by pigment to let widgets render
* a KoColor on screen using custom profiling provided by the user.
*
* If you want to provide your own rendering of the KoColor on screen,
* reimplement this class and provide its instance to a supporting
* widget.
*/
class KRITAPIGMENT_EXPORT KoColorDisplayRendererInterface : public QObject
{
Q_OBJECT
public:
KoColorDisplayRendererInterface();
- virtual ~KoColorDisplayRendererInterface();
+ ~KoColorDisplayRendererInterface() override;
/**
* @brief KoColorSpace::convertToQImage converts a whole row of colors in one go
* @param srcColorSpace the colorspace the pixel data is in
* @param data a pointer to a byte array with colors
* @param width of the resulting image
* @param height of the resulting image
* @return a QImage that can be displayed
*/
virtual QImage convertToQImage(const KoColorSpace *srcColorSpace, const quint8 *data, qint32 width, qint32 height) const = 0;
/**
* Convert the color \p c to a custom QColor that will be
* displayed by the widget on screen. Please note, that the
* reverse conversion may simply not exist.
*/
virtual QColor toQColor(const KoColor &c) const = 0;
/**
* This tries to approximate a rendered QColor into the KoColor
* of the painting color space. Please note, that in most of the
* cases the exact reverse transformation does not exist, so the
* resulting color will be only a rough approximation. Never try
* to do a round trip like that:
*
* // r will never be equal to c!
* r = approximateFromRenderedQColor(toQColor(c));
*/
virtual KoColor approximateFromRenderedQColor(const QColor &c) const = 0;
virtual KoColor fromHsv(int h, int s, int v, int a = 255) const = 0;
virtual void getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a = 0) const = 0;
/**
* \return the minimum value of a floating point channel that can
* be seen on screen
*/
virtual qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const = 0;
/**
* \return the maximum value of a floating point channel that can
* be seen on screen. In normal situation it is 1.0. When
* the user changes exposure the value varies.
*/
virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const = 0;
/**
* @brief getColorSpace
* @return the painting color space, this is useful for determining the transform.
*/
virtual const KoColorSpace* getPaintingColorSpace() const = 0;
Q_SIGNALS:
void displayConfigurationChanged();
private:
Q_DISABLE_COPY(KoColorDisplayRendererInterface)
};
/**
* The default conversion class that just calls KoColor::toQColor()
* conversion implementation which efectively renders the color into
* sRGB color space.
*/
class KRITAPIGMENT_EXPORT KoDumbColorDisplayRenderer : public KoColorDisplayRendererInterface
{
public:
- QImage convertToQImage(const KoColorSpace *srcColorSpace, const quint8 *data, qint32 width, qint32 height) const;
- QColor toQColor(const KoColor &c) const;
- KoColor approximateFromRenderedQColor(const QColor &c) const;
- KoColor fromHsv(int h, int s, int v, int a = 255) const;
- void getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a = 0) const;
+ QImage convertToQImage(const KoColorSpace *srcColorSpace, const quint8 *data, qint32 width, qint32 height) const override;
+ QColor toQColor(const KoColor &c) const override;
+ KoColor approximateFromRenderedQColor(const QColor &c) const override;
+ KoColor fromHsv(int h, int s, int v, int a = 255) const override;
+ void getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a = 0) const override;
- virtual qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const;
- virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const;
+ qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const override;
+ qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const override;
- virtual const KoColorSpace* getPaintingColorSpace() const;
+ const KoColorSpace* getPaintingColorSpace() const override;
static KoColorDisplayRendererInterface* instance();
};
#endif /* __KO_COLOR_DISPLAY_RENDERER_INTERFACE_H */
diff --git a/libs/pigment/KoColorProfileStorage.cpp b/libs/pigment/KoColorProfileStorage.cpp
new file mode 100644
index 0000000000..0f91923e63
--- /dev/null
+++ b/libs/pigment/KoColorProfileStorage.cpp
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "KoColorProfileStorage.h"
+
+#include <QHash>
+#include <QReadWriteLock>
+#include <QString>
+
+#include "KoColorSpaceFactory.h"
+#include "KoColorProfile.h"
+#include "kis_assert.h"
+
+
+struct KoColorProfileStorage::Private {
+ QHash<QString, KoColorProfile * > profileMap;
+ QHash<QByteArray, KoColorProfile * > profileUniqueIdMap;
+ QHash<QString, QString> profileAlias;
+ QReadWriteLock lock;
+
+ void populateUniqueIdMap();
+};
+
+KoColorProfileStorage::KoColorProfileStorage()
+ : d(new Private)
+{
+
+}
+
+KoColorProfileStorage::~KoColorProfileStorage()
+{
+}
+
+void KoColorProfileStorage::addProfile(KoColorProfile *profile)
+{
+ QWriteLocker locker(&d->lock);
+
+ if (profile->valid()) {
+ d->profileMap[profile->name()] = profile;
+ if (!d->profileUniqueIdMap.isEmpty()) {
+ d->profileUniqueIdMap.insert(profile->uniqueId(), profile);
+ }
+ }
+}
+
+void KoColorProfileStorage::addProfile(const KoColorProfile *profile)
+{
+ addProfile(profile->clone());
+}
+
+void KoColorProfileStorage::removeProfile(KoColorProfile *profile)
+{
+ QWriteLocker locker(&d->lock);
+
+ d->profileMap.remove(profile->name());
+ if (!d->profileUniqueIdMap.isEmpty()) {
+ d->profileUniqueIdMap.remove(profile->uniqueId());
+ }
+}
+
+bool KoColorProfileStorage::containsProfile(const KoColorProfile *profile)
+{
+ QReadLocker l(&d->lock);
+ return d->profileMap.contains(profile->name());
+}
+
+void KoColorProfileStorage::addProfileAlias(const QString &name, const QString &to)
+{
+ QWriteLocker l(&d->lock);
+ d->profileAlias[name] = to;
+}
+
+QString KoColorProfileStorage::profileAlias(const QString &name) const
+{
+ QReadLocker l(&d->lock);
+ return d->profileAlias.value(name, name);
+}
+
+const KoColorProfile *KoColorProfileStorage::profileByName(const QString &name) const
+{
+ QReadLocker l(&d->lock);
+ return d->profileMap.value(d->profileAlias.value(name, name), 0);
+}
+
+void KoColorProfileStorage::Private::populateUniqueIdMap()
+{
+ QWriteLocker l(&lock);
+ profileUniqueIdMap.clear();
+
+ for (auto it = profileMap.constBegin();
+ it != profileMap.constEnd();
+ ++it) {
+
+ KoColorProfile *profile = it.value();
+ QByteArray id = profile->uniqueId();
+
+ if (!id.isEmpty()) {
+ profileUniqueIdMap.insert(id, profile);
+ }
+ }
+}
+
+
+const KoColorProfile *KoColorProfileStorage::profileByUniqueId(const QByteArray &id) const
+{
+ QReadLocker l(&d->lock);
+ if (d->profileUniqueIdMap.isEmpty()) {
+ l.unlock();
+ d->populateUniqueIdMap();
+ l.relock();
+ }
+ return d->profileUniqueIdMap.value(id, 0);
+
+}
+
+QList<const KoColorProfile *> KoColorProfileStorage::profilesFor(const KoColorSpaceFactory *csf) const
+{
+ QList<const KoColorProfile *> profiles;
+ if (!csf) return profiles;
+
+ QReadLocker l(&d->lock);
+
+ QHash<QString, KoColorProfile * >::ConstIterator it;
+ for (it = d->profileMap.constBegin(); it != d->profileMap.constEnd(); ++it) {
+ KoColorProfile * profile = it.value();
+ if (csf->profileIsCompatible(profile)) {
+ Q_ASSERT(profile);
+ // if (profile->colorSpaceSignature() == csf->colorSpaceSignature()) {
+ profiles.push_back(profile);
+ }
+ }
+ return profiles;
+}
diff --git a/libs/pigment/KoColorProfileStorage.h b/libs/pigment/KoColorProfileStorage.h
new file mode 100644
index 0000000000..2e1406bfe5
--- /dev/null
+++ b/libs/pigment/KoColorProfileStorage.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KOCOLORPROFILESTORAGE_H
+#define KOCOLORPROFILESTORAGE_H
+
+#include <QScopedPointer>
+
+class QByteArray;
+class QString;
+class KoColorProfile;
+class KoColorSpaceFactory;
+
+/**
+ * @brief The KoColorProfileStorage class is a "composite subclass" of
+ * KoColorSpaceRegistry that ensures that the access to profiles is guarded
+ * by a separate lock and the hierarchy of locks is always followed (which
+ * avoid deadlocks).
+ *
+ * Registry locking hierarchy is basically the following:
+ *
+ * 1) KoColorSpaceRegistry::Private::registrylock
+ * 2) KoColorProfileStorage::Private::lock
+ *
+ * It means that we can take any single lock if we need it separately, but
+ * if we need to take both of them, we should always take them is a specified
+ * order.
+ *
+ * Encapsulation of the profile accesses inside a separate class lets us
+ * follow this rule without even thinking of it. KoColorProfileStorage just
+ * *never* calls any method of the registry, therefore lock order inverion is
+ * not possible,
+ */
+class KoColorProfileStorage
+{
+public:
+ KoColorProfileStorage();
+ ~KoColorProfileStorage();
+
+ /**
+ * Register the profile in the storage
+ * @param profile the new profile to be registered
+ */
+ void addProfile(KoColorProfile* profile);
+ void addProfile(const KoColorProfile* profile); // TODO
+
+ /**
+ * Removes the profile from the storage.
+ * Please note that the caller should delete the profile object himself!
+ *
+ * @param profile the profile to be removed
+ */
+ void removeProfile(KoColorProfile* profile);
+
+ /**
+ * @brief containsProfile shows if a profile is registered in teh storage
+ */
+ bool containsProfile(const KoColorProfile *profile);
+
+ /**
+ * Create an alias to a profile with a different name. Then @ref profileByName
+ * will return the profile @p to when passed @p name as a parameter.
+ */
+ void addProfileAlias(const QString& name, const QString& to);
+
+ /**
+ * @return the profile alias, or name if not aliased
+ */
+ QString profileAlias(const QString& name) const;
+
+ /**
+ * Return a profile by its given name, or 0 if none registered.
+ * @return a profile by its given name, or 0 if none registered.
+ * @param name the product name as set on the profile.
+ * @see addProfile()
+ * @see KoColorProfile::productName()
+ */
+ const KoColorProfile * profileByName(const QString & name) const ;
+
+
+ /**
+ * Returns a profile by its unique id stored/calculated in the header.
+ * The first call to this function might take long, because the map is
+ * created on the first use only (atm used by SVG only)
+ * @param id unique ProfileID of the profile (MD5 sum of its header)
+ * @return the profile or 0 if not found
+ */
+ const KoColorProfile *profileByUniqueId(const QByteArray &id) const;
+
+ /**
+ * Return the list of profiles for a colorspace represented by its factory.
+ * Profiles will not work with any color space, you can query which profiles
+ * that are registered with this registry can be used in combination with the
+ * argument factory.
+ * @param csf is a factory for the requested color space
+ * @return a list of profiles for the factory
+ */
+ QList<const KoColorProfile *> profilesFor(const KoColorSpaceFactory * csf) const;
+
+private:
+ struct Private;
+ const QScopedPointer<Private> d;
+};
+
+#endif // KOCOLORPROFILESTORAGE_H
diff --git a/libs/pigment/KoColorProofingConversionTransformation.h b/libs/pigment/KoColorProofingConversionTransformation.h
index 77915bc212..b49e69e6f8 100644
--- a/libs/pigment/KoColorProofingConversionTransformation.h
+++ b/libs/pigment/KoColorProofingConversionTransformation.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COLOR_PROOFING_CONVERSION_TRANSFORMATION_H_
#define _KO_COLOR_PROOFING_CONVERSION_TRANSFORMATION_H_
#include "KoColorConversionTransformation.h"
#include "kritapigment_export.h"
class KoColorSpace;
class KoColorConversionCache;
/**
* This is the base class of all color transform that convert the color of a pixel
*/
class KRITAPIGMENT_EXPORT KoColorProofingConversionTransformation : public KoColorConversionTransformation
{
public:
KoColorProofingConversionTransformation(const KoColorSpace *srcCs,
const KoColorSpace *dstCs,
const KoColorSpace *proofingSpace,
Intent renderingIntent,
Intent proofingIntent,
ConversionFlags conversionFlags,
quint8 *gamutWarning,
double adaptationState);
- virtual ~KoColorProofingConversionTransformation();
+ ~KoColorProofingConversionTransformation() override;
public:
/**
* @brief proofingSpace
* @return the space that is used to proof the color transform
*/
const KoColorSpace *proofingSpace() const;
private:
Intent m_proofingIntent;
quint8 *m_gamutWarning;
double m_adaptationState;
const KoColorSpace *m_proofingSpace;
};
#endif
diff --git a/libs/pigment/KoColorSpace.cpp b/libs/pigment/KoColorSpace.cpp
index 634bbdb533..bb9cdb8ce6 100644
--- a/libs/pigment/KoColorSpace.cpp
+++ b/libs/pigment/KoColorSpace.cpp
@@ -1,821 +1,819 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoColorSpace.h"
#include "KoColorSpace_p.h"
#include "KoChannelInfo.h"
#include "DebugPigment.h"
#include "KoCompositeOp.h"
#include "KoColorTransformation.h"
#include "KoColorTransformationFactory.h"
#include "KoColorTransformationFactoryRegistry.h"
#include "KoColorConversionCache.h"
#include "KoColorConversionSystem.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorProfile.h"
#include "KoCopyColorConversionTransformation.h"
#include "KoFallBackColorTransformation.h"
#include "KoUniqueNumberForIdServer.h"
#include "KoMixColorsOp.h"
#include "KoConvolutionOp.h"
#include "KoCompositeOpRegistry.h"
#include "KoColorSpaceEngine.h"
#include <QThreadStorage>
#include <QByteArray>
#include <QBitArray>
#include <QPolygonF>
#include <QPointF>
#include <math.h>
KoColorSpace::KoColorSpace()
: d(new Private())
{
}
KoColorSpace::KoColorSpace(const QString &id, const QString &name, KoMixColorsOp* mixColorsOp, KoConvolutionOp* convolutionOp)
: d(new Private())
{
d->id = id;
d->idNumber = KoUniqueNumberForIdServer::instance()->numberForId(d->id);
d->name = name;
d->mixColorsOp = mixColorsOp;
d->convolutionOp = convolutionOp;
d->transfoToRGBA16 = 0;
d->transfoFromRGBA16 = 0;
d->transfoToLABA16 = 0;
d->transfoFromLABA16 = 0;
d->gamutXYY = QPolygonF();
d->TRCXYY = QPolygonF();
d->colorants = QVector <qreal> (0);
d->lumaCoefficients = QVector <qreal> (0);
d->iccEngine = 0;
d->deletability = NotOwnedByRegistry;
}
KoColorSpace::~KoColorSpace()
{
Q_ASSERT(d->deletability != OwnedByRegistryDoNotDelete);
qDeleteAll(d->compositeOps);
Q_FOREACH (KoChannelInfo * channel, d->channels) {
delete channel;
}
if (d->deletability == NotOwnedByRegistry) {
KoColorConversionCache* cache = KoColorSpaceRegistry::instance()->colorConversionCache();
if (cache) {
cache->colorSpaceIsDestroyed(this);
}
}
delete d->mixColorsOp;
delete d->convolutionOp;
delete d->transfoToRGBA16;
delete d->transfoFromRGBA16;
delete d->transfoToLABA16;
delete d->transfoFromLABA16;
delete d;
}
bool KoColorSpace::operator==(const KoColorSpace& rhs) const
{
const KoColorProfile* p1 = rhs.profile();
const KoColorProfile* p2 = profile();
return d->idNumber == rhs.d->idNumber && ((p1 == p2) || (*p1 == *p2));
}
QString KoColorSpace::id() const
{
return d->id;
}
QString KoColorSpace::name() const
{
return d->name;
}
//Color space info stuff.
QPolygonF KoColorSpace::gamutXYY() const
{
if (d->gamutXYY.empty()) {
//now, let's decide on the boundary. This is a bit tricky because icc profiles can be both matrix-shaper and cLUT at once if the maker so pleases.
//first make a list of colors.
qreal max = 1.0;
if ((colorModelId().id()=="CMYKA" || colorModelId().id()=="LABA") && colorDepthId().id()=="F32") {
//boundaries for cmyka/laba have trouble getting the max values for Float, and are pretty awkward in general.
max = this->channels()[0]->getUIMax();
}
int samples = 5;//amount of samples in our color space.
- QString name = KoColorSpaceRegistry::instance()->colorSpaceFactory("XYZAF32")->defaultProfile();
- const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "F32", name);
+ const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "F32");
quint8 *data = new quint8[pixelSize()];
quint8 data2[16]; // xyza f32 is 4 floats, that is 16 bytes per pixel.
//QVector <qreal> sampleCoordinates(pow(colorChannelCount(),samples));
//sampleCoordinates.fill(0.0);
// This is fixed to 5 since the maximum number of channels are 5 for CMYKA
QVector <float> channelValuesF(5);//for getting the coordinates.
for(int x=0;x<samples;x++){
if (colorChannelCount()==1) {//gray
channelValuesF[0]=(max/(samples-1))*(x);
channelValuesF[1]=max;
fromNormalisedChannelsValue(data, channelValuesF);
convertPixelsTo(data, data2, xyzColorSpace, 1, KoColorConversionTransformation::IntentAbsoluteColorimetric, KoColorConversionTransformation::adjustmentConversionFlags());
xyzColorSpace->normalisedChannelsValue(data2, channelValuesF);
qreal x = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
qreal y = channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
d->gamutXYY << QPointF(x,y);
} else {
for(int y=0;y<samples;y++){
for(int z=0;z<samples;z++){
if (colorChannelCount()==4) {
for(int k=0;k<samples;k++){
channelValuesF[0] = (max / (samples - 1)) * (x);
channelValuesF[1] = (max / (samples - 1)) * (y);
channelValuesF[2] = (max / (samples - 1)) * (z);
channelValuesF[3] = (max / (samples - 1)) * (k);
channelValuesF[4] = max;
fromNormalisedChannelsValue(data, channelValuesF);
convertPixelsTo(data, data2, xyzColorSpace, 1, KoColorConversionTransformation::IntentAbsoluteColorimetric, KoColorConversionTransformation::adjustmentConversionFlags());
xyzColorSpace->normalisedChannelsValue(data2, channelValuesF);
qreal x = channelValuesF[0] / (channelValuesF[0] + channelValuesF[1] + channelValuesF[2]);
qreal y = channelValuesF[1] / (channelValuesF[0] + channelValuesF[1] + channelValuesF[2]);
d->gamutXYY<< QPointF(x,y);
}
} else {
channelValuesF[0]=(max/(samples-1))*(x);
channelValuesF[1]=(max/(samples-1))*(y);
channelValuesF[2]=(max/(samples-1))*(z);
channelValuesF[3]=max;
if (colorModelId().id()!="XYZA") { //no need for conversion when using xyz.
fromNormalisedChannelsValue(data, channelValuesF);
convertPixelsTo(data, data2, xyzColorSpace, 1, KoColorConversionTransformation::IntentAbsoluteColorimetric, KoColorConversionTransformation::adjustmentConversionFlags());
xyzColorSpace->normalisedChannelsValue(data2,channelValuesF);
}
qreal x = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
qreal y = channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
d->gamutXYY<< QPointF(x,y);
}
}
}
}
}
delete[] data;
//if we ever implement a boundary-checking thing I'd add it here.
return d->gamutXYY;
} else {
return d->gamutXYY;
}
}
QPolygonF KoColorSpace::estimatedTRCXYY() const
{
if (d->TRCXYY.empty()){
qreal max = 1.0;
if ((colorModelId().id()=="CMYKA" || colorModelId().id()=="LABA") && colorDepthId().id()=="F32") {
//boundaries for cmyka/laba have trouble getting the max values for Float, and are pretty awkward in general.
max = this->channels()[0]->getUIMax();
}
- QString name = KoColorSpaceRegistry::instance()->colorSpaceFactory("XYZAF16")->defaultProfile();
- const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "F16", name);
+ const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "F16");
quint8 *data = new quint8[pixelSize()];
quint8 data2[8]; // xyza is 8 bytes per pixel.
// This is fixed to 5 since the maximum number of channels are 5 for CMYKA
QVector <float> channelValuesF(5);//for getting the coordinates.
for (quint32 i=0; i<colorChannelCount(); i++) {
qreal colorantY=1.0;
if (colorModelId().id()!="CMYKA") {
for (int j=5; j>0; j--){
channelValuesF.fill(0.0);
channelValuesF[i] = ((max/4)*(5-j));
if (colorModelId().id()!="XYZA") { //no need for conversion when using xyz.
fromNormalisedChannelsValue(data, channelValuesF);
convertPixelsTo(data, data2, xyzColorSpace, 1, KoColorConversionTransformation::IntentAbsoluteColorimetric, KoColorConversionTransformation::adjustmentConversionFlags());
xyzColorSpace->normalisedChannelsValue(data2,channelValuesF);
}
if (j==0) {
colorantY = channelValuesF[1];
if (d->colorants.size()<2){
d->colorants.resize(3*colorChannelCount());
d->colorants[i] = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
d->colorants[i+1]= channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
d->colorants[i+2]= channelValuesF[1];
}
}
d->TRCXYY << QPointF(channelValuesF[1]/colorantY, ((1.0/4)*(5-j)));
}
} else {
for (int j=0; j<5; j++){
channelValuesF.fill(0.0);
channelValuesF[i] = ((max/4)*(j));
fromNormalisedChannelsValue(data, channelValuesF);
convertPixelsTo(data, data2, xyzColorSpace, 1, KoColorConversionTransformation::IntentAbsoluteColorimetric, KoColorConversionTransformation::adjustmentConversionFlags());
xyzColorSpace->normalisedChannelsValue(data2,channelValuesF);
if (j==0) {
colorantY = channelValuesF[1];
if (d->colorants.size()<2){
d->colorants.resize(3*colorChannelCount());
d->colorants[i] = channelValuesF[0]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
d->colorants[i+1]= channelValuesF[1]/(channelValuesF[0]+channelValuesF[1]+channelValuesF[2]);
d->colorants[i+2]= channelValuesF[1];
}
}
d->TRCXYY << QPointF(channelValuesF[1]/colorantY, ((1.0/4)*(j)));
}
}
}
delete[] data;
return d->TRCXYY;
} else {
return d->TRCXYY;
}
}
QVector <qreal> KoColorSpace::colorants() const
{
if (d->colorants.size()>1){
return d->colorants;
} else if (profile() && profile()->hasColorants()) {
d->colorants.resize(3*colorChannelCount());
d->colorants = profile()->getColorantsxyY();
return d->colorants;
} else {
estimatedTRCXYY();
return d->colorants;
}
}
QVector <qreal> KoColorSpace::lumaCoefficients() const
{
if (d->lumaCoefficients.size()>1){
return d->lumaCoefficients;
} else {
d->lumaCoefficients.resize(3);
if (colorModelId().id()!="RGBA") {
d->lumaCoefficients.fill(0.33);
} else {
colorants();
if (d->colorants[2]<0 || d->colorants[5]<0 || d->colorants[8]<0) {
d->lumaCoefficients[0]=0.2126;
d->lumaCoefficients[1]=0.7152;
d->lumaCoefficients[2]=0.0722;
} else {
d->lumaCoefficients[0]=d->colorants[2];
d->lumaCoefficients[1]=d->colorants[5];
d->lumaCoefficients[2]=d->colorants[8];
}
}
return d->lumaCoefficients;
}
}
QList<KoChannelInfo *> KoColorSpace::channels() const
{
return d->channels;
}
QBitArray KoColorSpace::channelFlags(bool color, bool alpha) const
{
QBitArray ba(d->channels.size());
if (!color && !alpha) return ba;
for (int i = 0; i < d->channels.size(); ++i) {
KoChannelInfo * channel = d->channels.at(i);
if ((color && channel->channelType() == KoChannelInfo::COLOR) ||
(alpha && channel->channelType() == KoChannelInfo::ALPHA))
ba.setBit(i, true);
}
return ba;
}
void KoColorSpace::addChannel(KoChannelInfo * ci)
{
d->channels.push_back(ci);
}
bool KoColorSpace::hasCompositeOp(const QString& id) const
{
return d->compositeOps.contains(id);
}
QList<KoCompositeOp*> KoColorSpace::compositeOps() const
{
return d->compositeOps.values();
}
KoMixColorsOp* KoColorSpace::mixColorsOp() const
{
return d->mixColorsOp;
}
KoConvolutionOp* KoColorSpace::convolutionOp() const
{
return d->convolutionOp;
}
const KoCompositeOp * KoColorSpace::compositeOp(const QString & id) const
{
const QHash<QString, KoCompositeOp*>::ConstIterator it = d->compositeOps.constFind(id);
if (it != d->compositeOps.constEnd()) {
return it.value();
}
else {
warnPigment << "Asking for non-existent composite operation " << id << ", returning " << COMPOSITE_OVER;
return d->compositeOps.value(COMPOSITE_OVER);
}
}
void KoColorSpace::addCompositeOp(const KoCompositeOp * op)
{
if (op->colorSpace()->id() == id()) {
d->compositeOps.insert(op->id(), const_cast<KoCompositeOp*>(op));
}
}
const KoColorConversionTransformation* KoColorSpace::toLabA16Converter() const
{
if (!d->transfoToLABA16) {
- d->transfoToLABA16 = KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverter(this, KoColorSpaceRegistry::instance()->lab16(), KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
+ d->transfoToLABA16 = KoColorSpaceRegistry::instance()->createColorConverter(this, KoColorSpaceRegistry::instance()->lab16(), KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
}
return d->transfoToLABA16;
}
const KoColorConversionTransformation* KoColorSpace::fromLabA16Converter() const
{
if (!d->transfoFromLABA16) {
- d->transfoFromLABA16 = KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverter(KoColorSpaceRegistry::instance()->lab16(), this, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
+ d->transfoFromLABA16 = KoColorSpaceRegistry::instance()->createColorConverter(KoColorSpaceRegistry::instance()->lab16(), this, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
}
return d->transfoFromLABA16;
}
const KoColorConversionTransformation* KoColorSpace::toRgbA16Converter() const
{
if (!d->transfoToRGBA16) {
- d->transfoToRGBA16 = KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverter(this, KoColorSpaceRegistry::instance()->rgb16(), KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
+ d->transfoToRGBA16 = KoColorSpaceRegistry::instance()->createColorConverter(this, KoColorSpaceRegistry::instance()->rgb16(), KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
}
return d->transfoToRGBA16;
}
const KoColorConversionTransformation* KoColorSpace::fromRgbA16Converter() const
{
if (!d->transfoFromRGBA16) {
- d->transfoFromRGBA16 = KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverter(KoColorSpaceRegistry::instance()->rgb16() , this, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
+ d->transfoFromRGBA16 = KoColorSpaceRegistry::instance()->createColorConverter(KoColorSpaceRegistry::instance()->rgb16() , this, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags()) ;
}
return d->transfoFromRGBA16;
}
void KoColorSpace::toLabA16(const quint8 * src, quint8 * dst, quint32 nPixels) const
{
toLabA16Converter()->transform(src, dst, nPixels);
}
void KoColorSpace::fromLabA16(const quint8 * src, quint8 * dst, quint32 nPixels) const
{
fromLabA16Converter()->transform(src, dst, nPixels);
}
void KoColorSpace::toRgbA16(const quint8 * src, quint8 * dst, quint32 nPixels) const
{
toRgbA16Converter()->transform(src, dst, nPixels);
}
void KoColorSpace::fromRgbA16(const quint8 * src, quint8 * dst, quint32 nPixels) const
{
fromRgbA16Converter()->transform(src, dst, nPixels);
}
KoColorConversionTransformation* KoColorSpace::createColorConverter(const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
if (*this == *dstColorSpace) {
return new KoCopyColorConversionTransformation(this);
} else {
- return KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverter(this, dstColorSpace, renderingIntent, conversionFlags);
+ return KoColorSpaceRegistry::instance()->createColorConverter(this, dstColorSpace, renderingIntent, conversionFlags);
}
}
bool KoColorSpace::convertPixelsTo(const quint8 * src,
quint8 * dst,
const KoColorSpace * dstColorSpace,
quint32 numPixels,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
if (*this == *dstColorSpace) {
if (src != dst) {
memcpy(dst, src, numPixels * sizeof(quint8) * pixelSize());
}
} else {
KoCachedColorConversionTransformation cct = KoColorSpaceRegistry::instance()->colorConversionCache()->cachedConverter(this, dstColorSpace, renderingIntent, conversionFlags);
cct.transformation()->transform(src, dst, numPixels);
}
return true;
}
KoColorConversionTransformation * KoColorSpace::createProofingTransform(const KoColorSpace *dstColorSpace, const KoColorSpace *proofingSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::Intent proofingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags, quint8 *gamutWarning, double adaptationState) const
{
if (!d->iccEngine) {
d->iccEngine = KoColorSpaceEngineRegistry::instance()->get("icc");
}
if (!d->iccEngine) return 0;
return d->iccEngine->createColorProofingTransformation(this, dstColorSpace, proofingSpace, renderingIntent, proofingIntent, conversionFlags, gamutWarning, adaptationState);
}
bool KoColorSpace::proofPixelsTo(const quint8 *src,
quint8 *dst,
quint32 numPixels,
KoColorConversionTransformation *proofingTransform) const
{
proofingTransform->transform(src, dst, numPixels);
//the transform is deleted in the destructor.
return true;
}
void KoColorSpace::bitBlt(const KoColorSpace* srcSpace, const KoCompositeOp::ParameterInfo& params, const KoCompositeOp* op,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
Q_ASSERT_X(*op->colorSpace() == *this, "KoColorSpace::bitBlt", QString("Composite op is for color space %1 (%2) while this is %3 (%4)").arg(op->colorSpace()->id()).arg(op->colorSpace()->profile()->name()).arg(id()).arg(profile()->name()).toLatin1());
if(params.rows <= 0 || params.cols <= 0)
return;
if(!(*this == *srcSpace)) {
if (preferCompositionInSourceColorSpace() &&
srcSpace->hasCompositeOp(op->id())) {
quint32 conversionDstBufferStride = params.cols * srcSpace->pixelSize();
QVector<quint8> * conversionDstCache = threadLocalConversionCache(params.rows * conversionDstBufferStride);
quint8* conversionDstData = conversionDstCache->data();
for(qint32 row=0; row<params.rows; row++) {
convertPixelsTo(params.dstRowStart + row * params.dstRowStride,
conversionDstData + row * conversionDstBufferStride, srcSpace, params.cols,
renderingIntent, conversionFlags);
}
// FIXME: do not calculate the otherOp every time
const KoCompositeOp *otherOp = srcSpace->compositeOp(op->id());
KoCompositeOp::ParameterInfo paramInfo(params);
paramInfo.dstRowStart = conversionDstData;
paramInfo.dstRowStride = conversionDstBufferStride;
otherOp->composite(paramInfo);
for(qint32 row=0; row<params.rows; row++) {
srcSpace->convertPixelsTo(conversionDstData + row * conversionDstBufferStride,
params.dstRowStart + row * params.dstRowStride, this, params.cols,
renderingIntent, conversionFlags);
}
} else {
quint32 conversionBufferStride = params.cols * pixelSize();
QVector<quint8> * conversionCache = threadLocalConversionCache(params.rows * conversionBufferStride);
quint8* conversionData = conversionCache->data();
for(qint32 row=0; row<params.rows; row++) {
srcSpace->convertPixelsTo(params.srcRowStart + row * params.srcRowStride,
conversionData + row * conversionBufferStride, this, params.cols,
renderingIntent, conversionFlags);
}
KoCompositeOp::ParameterInfo paramInfo(params);
paramInfo.srcRowStart = conversionData;
paramInfo.srcRowStride = conversionBufferStride;
op->composite(paramInfo);
}
}
else {
op->composite(params);
}
}
QVector<quint8> * KoColorSpace::threadLocalConversionCache(quint32 size) const
{
QVector<quint8> * ba = 0;
if (!d->conversionCache.hasLocalData()) {
ba = new QVector<quint8>(size, '0');
d->conversionCache.setLocalData(ba);
} else {
ba = d->conversionCache.localData();
if ((quint8)ba->size() < size)
ba->resize(size);
}
return ba;
}
KoColorTransformation* KoColorSpace::createColorTransformation(const QString & id, const QHash<QString, QVariant> & parameters) const
{
KoColorTransformationFactory* factory = KoColorTransformationFactoryRegistry::instance()->get(id);
if (!factory) return 0;
QPair<KoID, KoID> model(colorModelId(), colorDepthId());
QList< QPair<KoID, KoID> > models = factory->supportedModels();
if (models.isEmpty() || models.contains(model)) {
return factory->createTransformation(this, parameters);
} else {
// Find the best solution
// TODO use the color conversion cache
KoColorConversionTransformation* csToFallBack = 0;
KoColorConversionTransformation* fallBackToCs = 0;
- KoColorSpaceRegistry::instance()->colorConversionSystem()->createColorConverters(this, models, csToFallBack, fallBackToCs);
+ KoColorSpaceRegistry::instance()->createColorConverters(this, models, csToFallBack, fallBackToCs);
Q_ASSERT(csToFallBack);
Q_ASSERT(fallBackToCs);
KoColorTransformation* transfo = factory->createTransformation(fallBackToCs->srcColorSpace(), parameters);
return new KoFallBackColorTransformation(csToFallBack, fallBackToCs, transfo);
}
}
void KoColorSpace::increaseLuminosity(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
if (profile()->hasTRC()){
//only linearise and crunch the luma if there's a TRC
profile()->linearizeFloatValue(channelValues);
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
luma = pow(luma, 1/2.2);
luma = qMin(1.0, luma + step);
luma = pow(luma, 2.2);
channelValues = fromHSY(&hue, &sat, &luma);
profile()->delinearizeFloatValue(channelValues);
} else {
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
luma = qMin(1.0, luma + step);
channelValues = fromHSY(&hue, &sat, &luma);
}
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::decreaseLuminosity(quint8 * pixel, qreal step) const {
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
if (profile()->hasTRC()){
//only linearise and crunch the luma if there's a TRC
profile()->linearizeFloatValue(channelValues);
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
luma = pow(luma, 1/2.2);
if (luma-step<0.0) {
luma=0.0;
} else {
luma -= step;
}
luma = pow(luma, 2.2);
channelValues = fromHSY(&hue, &sat, &luma);
profile()->delinearizeFloatValue(channelValues);
} else {
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
if (luma-step<0.0) {
luma=0.0;
} else {
luma -= step;
}
channelValues = fromHSY(&hue, &sat, &luma);
}
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::increaseSaturation(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
sat += step;
sat = qBound(0.0, sat, 1.0);
channelValues = fromHSY(&hue, &sat, &luma);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::decreaseSaturation(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
sat -= step;
sat = qBound(0.0, sat, 1.0);
channelValues = fromHSY(&hue, &sat, &luma);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::increaseHue(quint8 * pixel, qreal step) const{
int channelnumber = channelCount(); //doesn't work for cmyka...
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
if (hue+step>1.0){
hue=(hue+step)- 1.0;
} else {
hue += step;
}
channelValues = fromHSY(&hue, &sat, &luma);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::decreaseHue(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal hue, sat, luma = 0.0;
toHSY(channelValues, &hue, &sat, &luma);
if (hue-step<0.0){
hue=1.0-(step-hue);
} else {
hue -= step;
}
channelValues = fromHSY(&hue, &sat, &luma);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::increaseRed(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal y, u, v = 0.0;
toYUV(channelValues, &y, &u, &v);
u += step;
u = qBound(0.0, u, 1.0);
channelValues = fromYUV(&y, &u, &v);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::increaseGreen(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal y, u, v = 0.0;
toYUV(channelValues, &y, &u, &v);
u -= step;
u = qBound(0.0, u, 1.0);
channelValues = fromYUV(&y, &u, &v);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::increaseBlue(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal y, u, v = 0.0;
toYUV(channelValues, &y, &u, &v);
v += step;
v = qBound(0.0, v, 1.0);
channelValues = fromYUV(&y, &u, &v);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
void KoColorSpace::increaseYellow(quint8 * pixel, qreal step) const{
int channelnumber = channelCount();
QVector <double> channelValues(channelnumber);
QVector <float> channelValuesF(channelnumber);
normalisedChannelsValue(pixel, channelValuesF);
for (int i=0;i<channelnumber;i++){
channelValues[i]=channelValuesF[i];
}
profile()->linearizeFloatValue(channelValues);
qreal y, u, v = 0.0;
toYUV(channelValues, &y, &u, &v);
v -= step;
v = qBound(0.0, v, 1.0);
channelValues = fromYUV(&y, &u, &v);
profile()->delinearizeFloatValue(channelValues);
for (int i=0;i<channelnumber;i++){
channelValuesF[i]=channelValues[i];
}
fromNormalisedChannelsValue(pixel, channelValuesF);
setOpacity(pixel, 1.0, 1);
}
QImage KoColorSpace::convertToQImage(const quint8 *data, qint32 width, qint32 height,
const KoColorProfile *dstProfile,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
QImage img = QImage(width, height, QImage::Format_ARGB32);
const KoColorSpace * dstCS = KoColorSpaceRegistry::instance()->rgb8(dstProfile);
if (data)
this->convertPixelsTo(const_cast<quint8 *>(data), img.bits(), dstCS, width * height, renderingIntent, conversionFlags);
return img;
}
bool KoColorSpace::preferCompositionInSourceColorSpace() const
{
return false;
}
diff --git a/libs/pigment/KoColorSpaceAbstract.h b/libs/pigment/KoColorSpaceAbstract.h
index b8bf1f5452..2047902a98 100644
--- a/libs/pigment/KoColorSpaceAbstract.h
+++ b/libs/pigment/KoColorSpaceAbstract.h
@@ -1,209 +1,209 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORSPACEABSTRACT_H
#define KOCOLORSPACEABSTRACT_H
#include <QBitArray>
#include <klocalizedstring.h>
#include <KoColorSpace.h>
#include <KoColorProfile.h>
#include <KoColorSpaceMaths.h>
#include <KoColorSpaceRegistry.h>
#include "KoFallBackColorTransformation.h"
#include "KoLabDarkenColorTransformation.h"
#include "KoMixColorsOpImpl.h"
#include "KoConvolutionOpImpl.h"
#include "KoInvertColorTransformation.h"
/**
* This in an implementation of KoColorSpace which can be used as a base for colorspaces with as many
* different channels of the same type.
*
* The template parameters must be a class which inherits KoColorSpaceTrait (or a class with the same signature).
*
* SOMETYPE is the type of the channel for instance (quint8, quint32...),
* SOMENBOFCHANNELS is the number of channels including the alpha channel
* SOMEALPHAPOS is the position of the alpha channel in the pixel (can be equal to -1 if no alpha channel).
*/
template<class _CSTrait>
class KoColorSpaceAbstract : public KoColorSpace
{
public:
KoColorSpaceAbstract(const QString &id, const QString &name) :
KoColorSpace(id, name, new KoMixColorsOpImpl< _CSTrait>(), new KoConvolutionOpImpl< _CSTrait>()) {
}
- virtual quint32 colorChannelCount() const {
+ quint32 colorChannelCount() const override {
if (_CSTrait::alpha_pos == -1)
return _CSTrait::channels_nb;
else
return _CSTrait::channels_nb - 1;
}
- virtual quint32 channelCount() const {
+ quint32 channelCount() const override {
return _CSTrait::channels_nb;
}
- virtual quint32 pixelSize() const {
+ quint32 pixelSize() const override {
return _CSTrait::pixelSize;
}
- virtual QString channelValueText(const quint8 *pixel, quint32 channelIndex) const {
+ QString channelValueText(const quint8 *pixel, quint32 channelIndex) const override {
return _CSTrait::channelValueText(pixel, channelIndex);
}
- virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const {
+ QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const override {
return _CSTrait::normalisedChannelValueText(pixel, channelIndex);
}
- virtual void normalisedChannelsValue(const quint8 *pixel, QVector<float> &channels) const {
+ void normalisedChannelsValue(const quint8 *pixel, QVector<float> &channels) const override {
return _CSTrait::normalisedChannelsValue(pixel, channels);
}
- virtual void fromNormalisedChannelsValue(quint8 *pixel, const QVector<float> &values) const {
+ void fromNormalisedChannelsValue(quint8 *pixel, const QVector<float> &values) const override {
return _CSTrait::fromNormalisedChannelsValue(pixel, values);
}
- virtual quint8 scaleToU8(const quint8 * srcPixel, qint32 channelIndex) const {
+ quint8 scaleToU8(const quint8 * srcPixel, qint32 channelIndex) const override {
typename _CSTrait::channels_type c = _CSTrait::nativeArray(srcPixel)[channelIndex];
return KoColorSpaceMaths<typename _CSTrait::channels_type, quint8>::scaleToA(c);
}
- virtual void singleChannelPixel(quint8 *dstPixel, const quint8 *srcPixel, quint32 channelIndex) const {
+ void singleChannelPixel(quint8 *dstPixel, const quint8 *srcPixel, quint32 channelIndex) const override {
_CSTrait::singleChannelPixel(dstPixel, srcPixel, channelIndex);
}
- virtual quint8 opacityU8(const quint8 * U8_pixel) const {
+ quint8 opacityU8(const quint8 * U8_pixel) const override {
return _CSTrait::opacityU8(U8_pixel);
}
- virtual qreal opacityF(const quint8 * U8_pixel) const {
+ qreal opacityF(const quint8 * U8_pixel) const override {
return _CSTrait::opacityF(U8_pixel);
}
- virtual void setOpacity(quint8 * pixels, quint8 alpha, qint32 nPixels) const {
+ void setOpacity(quint8 * pixels, quint8 alpha, qint32 nPixels) const override {
_CSTrait::setOpacity(pixels, alpha, nPixels);
}
- virtual void setOpacity(quint8 * pixels, qreal alpha, qint32 nPixels) const {
+ void setOpacity(quint8 * pixels, qreal alpha, qint32 nPixels) const override {
_CSTrait::setOpacity(pixels, alpha, nPixels);
}
- virtual void multiplyAlpha(quint8 * pixels, quint8 alpha, qint32 nPixels) const {
+ void multiplyAlpha(quint8 * pixels, quint8 alpha, qint32 nPixels) const override {
_CSTrait::multiplyAlpha(pixels, alpha, nPixels);
}
- virtual void applyAlphaU8Mask(quint8 * pixels, const quint8 * alpha, qint32 nPixels) const {
+ void applyAlphaU8Mask(quint8 * pixels, const quint8 * alpha, qint32 nPixels) const override {
_CSTrait::applyAlphaU8Mask(pixels, alpha, nPixels);
}
- virtual void applyInverseAlphaU8Mask(quint8 * pixels, const quint8 * alpha, qint32 nPixels) const {
+ void applyInverseAlphaU8Mask(quint8 * pixels, const quint8 * alpha, qint32 nPixels) const override {
_CSTrait::applyInverseAlphaU8Mask(pixels, alpha, nPixels);
}
- virtual void applyAlphaNormedFloatMask(quint8 * pixels, const float * alpha, qint32 nPixels) const {
+ void applyAlphaNormedFloatMask(quint8 * pixels, const float * alpha, qint32 nPixels) const override {
_CSTrait::applyAlphaNormedFloatMask(pixels, alpha, nPixels);
}
- virtual void applyInverseNormedFloatMask(quint8 * pixels, const float * alpha, qint32 nPixels) const {
+ void applyInverseNormedFloatMask(quint8 * pixels, const float * alpha, qint32 nPixels) const override {
_CSTrait::applyInverseAlphaNormedFloatMask(pixels, alpha, nPixels);
}
- virtual quint8 intensity8(const quint8 * src) const {
+ quint8 intensity8(const quint8 * src) const override {
QColor c;
const_cast<KoColorSpaceAbstract<_CSTrait> *>(this)->toQColor(src, &c);
return static_cast<quint8>(c.red() * 0.30 + c.green() * 0.59 + c.blue() * 0.11);
}
- virtual KoColorTransformation* createInvertTransformation() const {
+ KoColorTransformation* createInvertTransformation() const override {
return new KoInvertColorTransformation(this);
}
- virtual KoColorTransformation *createDarkenAdjustment(qint32 shade, bool compensate, qreal compensation) const {
+ KoColorTransformation *createDarkenAdjustment(qint32 shade, bool compensate, qreal compensation) const override {
return new KoFallBackColorTransformation(this, KoColorSpaceRegistry::instance()->lab16(""), new KoLabDarkenColorTransformation<quint16>(shade, compensate, compensation, KoColorSpaceRegistry::instance()->lab16("")));
}
- virtual bool convertPixelsTo(const quint8 *src,
+ bool convertPixelsTo(const quint8 *src,
quint8 *dst, const KoColorSpace *dstColorSpace,
quint32 numPixels,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override
{
// check whether we have the same profile and color model, but only a different bit
// depth; in that case we don't convert as such, but scale
bool scaleOnly = false;
// Note: getting the id() is really, really expensive, so only do that if
// we are sure there is a difference between the colorspaces
if (!(*this == *dstColorSpace)) {
scaleOnly = dstColorSpace->colorModelId().id() == colorModelId().id() &&
dstColorSpace->colorDepthId().id() != colorDepthId().id() &&
dstColorSpace->profile()->name() == profile()->name();
}
if (scaleOnly && dynamic_cast<const KoColorSpaceAbstract*>(dstColorSpace)) {
typedef typename _CSTrait::channels_type channels_type;
switch(dstColorSpace->channels()[0]->channelValueType())
{
case KoChannelInfo::UINT8:
scalePixels<_CSTrait::pixelSize, 1, channels_type, quint8>(src, dst, numPixels);
return true;
// case KoChannelInfo::INT8:
// scalePixels<_CSTrait::pixelSize, 1, channels_type, qint8>(src, dst, numPixels);
// return true;
case KoChannelInfo::UINT16:
scalePixels<_CSTrait::pixelSize, 2, channels_type, quint16>(src, dst, numPixels);
return true;
case KoChannelInfo::INT16:
scalePixels<_CSTrait::pixelSize, 2, channels_type, qint16>(src, dst, numPixels);
return true;
case KoChannelInfo::UINT32:
scalePixels<_CSTrait::pixelSize, 4, channels_type, quint32>(src, dst, numPixels);
return true;
default:
break;
}
}
return KoColorSpace::convertPixelsTo(src, dst, dstColorSpace, numPixels, renderingIntent, conversionFlags);
}
private:
template<int srcPixelSize, int dstChannelSize, class TSrcChannel, class TDstChannel>
void scalePixels(const quint8* src, quint8* dst, quint32 numPixels) const {
qint32 dstPixelSize = dstChannelSize * _CSTrait::channels_nb;
for(quint32 i=0; i<numPixels; ++i) {
const TSrcChannel* srcPixel = reinterpret_cast<const TSrcChannel*>(src + i * srcPixelSize);
TDstChannel* dstPixel = reinterpret_cast<TDstChannel*>(dst + i * dstPixelSize);
for(quint32 c=0; c<_CSTrait::channels_nb; ++c)
dstPixel[c] = Arithmetic::scale<TDstChannel>(srcPixel[c]);
}
}
};
#endif // KOCOLORSPACEABSTRACT_H
diff --git a/libs/pigment/KoColorSpaceEngine.h b/libs/pigment/KoColorSpaceEngine.h
index 3c67d9c5de..f95ff80ad6 100644
--- a/libs/pigment/KoColorSpaceEngine.h
+++ b/libs/pigment/KoColorSpaceEngine.h
@@ -1,65 +1,65 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COLOR_SPACE_ENGINE_H_
#define _KO_COLOR_SPACE_ENGINE_H_
#include <KoColorConversionTransformationAbstractFactory.h>
#include <KoGenericRegistry.h>
class KoColorProfile;
/**
* A KoColorSpaceEngine is a class use to create color conversion
* transformation between color spaces, for which all profiles can
* output to all profiles.
*
* Typically, when you have an ICC color space and color profile, you
* can convert to any other ICC color space and color profile. While
* creating a KoColorTransformationFactory for each of this transformation
* is possible, the number of links will make the Color Conversion explode
* System. KoColorSpaceEngine provides a virtual node in the Color
* Conversion System that can convert to any other node supported by the
* engine.
*/
class KRITAPIGMENT_EXPORT KoColorSpaceEngine : public KoColorConversionTransformationAbstractFactory
{
public:
KoColorSpaceEngine(const QString& id, const QString& name);
- virtual ~KoColorSpaceEngine();
+ ~KoColorSpaceEngine() override;
const QString& id() const;
const QString& name() const;
virtual const KoColorProfile* addProfile(const QString &filename) = 0;
virtual const KoColorProfile* addProfile(const QByteArray &data) = 0;
virtual void removeProfile(const QString &filename) = 0;
private:
struct Private;
Private* const d;
};
class KRITAPIGMENT_EXPORT KoColorSpaceEngineRegistry : public KoGenericRegistry< KoColorSpaceEngine* >
{
public:
KoColorSpaceEngineRegistry();
- ~KoColorSpaceEngineRegistry();
+ ~KoColorSpaceEngineRegistry() override;
static KoColorSpaceEngineRegistry* instance();
};
#endif
diff --git a/libs/pigment/KoColorSpaceFactory.cpp b/libs/pigment/KoColorSpaceFactory.cpp
index 52632cef92..c71682eacf 100644
--- a/libs/pigment/KoColorSpaceFactory.cpp
+++ b/libs/pigment/KoColorSpaceFactory.cpp
@@ -1,107 +1,107 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoColorSpaceFactory.h"
#include "DebugPigment.h"
#include <QMutexLocker>
#include "KoColorProfile.h"
#include "KoColorSpace.h"
#include "KoColorSpaceRegistry.h"
struct Q_DECL_HIDDEN KoColorSpaceFactory::Private {
QList<KoColorProfile*> colorprofiles;
QList<KoColorSpace*> colorspaces;
QHash<QString, KoColorSpace* > availableColorspaces;
QMutex mutex;
#ifndef NDEBUG
QHash<KoColorSpace*, QString> stackInformation;
#endif
};
KoColorSpaceFactory::KoColorSpaceFactory() : d(new Private)
{
}
KoColorSpaceFactory::~KoColorSpaceFactory()
{
#ifndef NDEBUG
// Check that all color spaces have been released
int count = 0;
count += d->availableColorspaces.size();
for(QHash<KoColorSpace*, QString>::const_iterator it = d->stackInformation.constBegin();
it != d->stackInformation.constEnd(); ++it)
{
errorPigment << "*******************************************";
errorPigment << it.key()->id() << " still in used, and grabed in: ";
errorPigment << it.value();
}
if( count != d->colorspaces.size())
{
errorPigment << (d->colorspaces.size() - count) << " colorspaces are still used";
}
Q_ASSERT(count == d->colorspaces.size());
#endif
Q_FOREACH (KoColorSpace* cs, d->colorspaces) {
delete cs;
}
Q_FOREACH (KoColorProfile* profile, d->colorprofiles) {
KoColorSpaceRegistry::instance()->removeProfile(profile);
delete profile;
}
delete d;
}
-const KoColorProfile* KoColorSpaceFactory::colorProfile(const QByteArray& rawData) const
+const KoColorProfile *KoColorSpaceFactory::colorProfile(const QByteArray &rawData, KoColorSpaceFactory::ProfileRegistrationInterface *registrationInterface) const
{
KoColorProfile* colorProfile = createColorProfile(rawData);
if (colorProfile && colorProfile->valid()) {
- if (const KoColorProfile* existingProfile = KoColorSpaceRegistry::instance()->profileByName(colorProfile->name())) {
+ if (const KoColorProfile* existingProfile = registrationInterface->profileByName(colorProfile->name())) {
delete colorProfile;
return existingProfile;
}
- KoColorSpaceRegistry::instance()->addProfile(colorProfile);
+ registrationInterface->registerNewProfile(colorProfile);
d->colorprofiles.append(colorProfile);
}
return colorProfile;
}
const KoColorSpace *KoColorSpaceFactory::grabColorSpace(const KoColorProfile * profile)
{
QMutexLocker l(&d->mutex);
Q_ASSERT(profile);
auto it = d->availableColorspaces.find(profile->name());
KoColorSpace* cs;
if (it == d->availableColorspaces.end()) {
cs = createColorSpace(profile);
if (cs) {
d->availableColorspaces[profile->name()] = cs;
}
}
else {
cs = it.value();
}
return cs;
}
diff --git a/libs/pigment/KoColorSpaceFactory.h b/libs/pigment/KoColorSpaceFactory.h
index b04a398563..8d4dac91e3 100644
--- a/libs/pigment/KoColorSpaceFactory.h
+++ b/libs/pigment/KoColorSpaceFactory.h
@@ -1,140 +1,147 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORSPACEFACTORY_H
#define KOCOLORSPACEFACTORY_H
#include "KoColorSpaceConstants.h"
#include "KoColorConversionTransformation.h"
#include <KoID.h>
#include "kritapigment_export.h"
class KoColorProfile;
class KoColorConversionTransformationFactory;
/**
* This class is used to create color spaces.
*/
class KRITAPIGMENT_EXPORT KoColorSpaceFactory
{
protected:
KoColorSpaceFactory();
public:
virtual ~KoColorSpaceFactory();
/**
* Return the unchanging name of this color space
*/
virtual QString id() const = 0;
/**
* return the i18n'able description.
*/
virtual QString name() const = 0;
/**
* @return true if the color space should be shown in a User Interface, or false
* other wise.
*/
virtual bool userVisible() const = 0;
/**
* @return a string that identify the color model (for instance "RGB" or "CMYK" ...)
* @see KoColorModelStandardIds.h
*/
virtual KoID colorModelId() const = 0;
/**
* @return a string that identify the bit depth (for instance "U8" or "F16" ...)
* @see KoColorModelStandardIds.h
*/
virtual KoID colorDepthId() const = 0;
/**
* @param profile a pointer to a color profile
* @return true if the color profile can be used by a color space created by
* this factory
*/
virtual bool profileIsCompatible(const KoColorProfile* profile) const = 0;
/**
* @return the name of the color space engine for this color space, or "" if none
*/
virtual QString colorSpaceEngine() const = 0;
/**
* @return true if the color space supports High-Dynamic Range.
*/
virtual bool isHdr() const = 0;
/**
* @return the reference depth, that is for a color space where all channels have the same
* depth, this is the depth of one channel, for a color space with different bit depth for
* each channel, it's usually the highest bit depth. This value is used by the Color
* Conversion System to check if a lost of bit depth during a color conversion is
* acceptable, for instance when converting from RGB32bit to XYZ16bit, it's acceptable to go
* through a conversion to RGB16bit, while it's not the case for RGB32bit to XYZ32bit.
*/
virtual int referenceDepth() const = 0;
/**
* @return the list of color conversion provided by this colorspace, the factories
* constructed by this functions are owned by the caller of the function
*/
virtual QList<KoColorConversionTransformationFactory*> colorConversionLinks() const = 0;
/**
* @return the cost of the usage of the colorspace in the conversion graph. The higher the cost,
* the less probably the color space will be chosen for the conversion.
*/
virtual int crossingCost() const = 0;
/**
* Returns the default icc profile for use with this colorspace. This may be ""
*
* @return the default icc profile name
*/
virtual QString defaultProfile() const = 0;
+ struct ProfileRegistrationInterface
+ {
+ virtual ~ProfileRegistrationInterface() {}
+ virtual const KoColorProfile* profileByName(const QString &profileName) const = 0;
+ virtual void registerNewProfile(KoColorProfile *profile) = 0;
+ };
+
/**
* Create a color profile from a memory array, if possible, otherwise return 0.
* This will replace the existing profile with the name in the KoColorSpaceRegistry
*
* This will call the decendant's createColorProfile()
*/
- const KoColorProfile* colorProfile(const QByteArray& rawData) const;
+ const KoColorProfile* colorProfile(const QByteArray& rawData, ProfileRegistrationInterface *registrationInterface) const;
/**
* Create or reuse the existing colorspace for the given profile.
*
* This will call the decendant's createColorSpace
*/
const KoColorSpace *grabColorSpace(const KoColorProfile *profile);
protected:
/**
* creates a color space using the given profile.
*/
virtual KoColorSpace *createColorSpace(const KoColorProfile *) const = 0;
virtual KoColorProfile* createColorProfile(const QByteArray& rawData) const = 0;
private:
struct Private;
Private* const d;
};
#endif // KOCOLORSPACEFACTORY_H
diff --git a/libs/pigment/KoColorSpaceRegistry.cpp b/libs/pigment/KoColorSpaceRegistry.cpp
index 2ffa87b175..353e4b3de2 100644
--- a/libs/pigment/KoColorSpaceRegistry.cpp
+++ b/libs/pigment/KoColorSpaceRegistry.cpp
@@ -1,753 +1,818 @@
/*
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004,2010 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoColorSpaceRegistry.h"
#include <QHash>
#include <QReadWriteLock>
#include <QStringList>
#include <QDir>
#include <QGlobalStatic>
#include "KoPluginLoader.h"
#include "KoGenericRegistry.h"
#include "DebugPigment.h"
#include "KoBasicHistogramProducers.h"
#include "KoColorSpace.h"
#include "KoColorProfile.h"
#include "KoColorConversionCache.h"
#include "KoColorConversionSystem.h"
#include "colorspaces/KoAlphaColorSpace.h"
#include "colorspaces/KoLabColorSpace.h"
#include "colorspaces/KoRgbU16ColorSpace.h"
#include "colorspaces/KoRgbU8ColorSpace.h"
#include "colorspaces/KoSimpleColorSpaceEngine.h"
#include "KoColorSpace_p.h"
+#include "kis_assert.h"
+#include "KoColorProfileStorage.h"
+#include <KisReadWriteLockPolicy.h>
+
+
Q_GLOBAL_STATIC(KoColorSpaceRegistry, s_instance)
struct Q_DECL_HIDDEN KoColorSpaceRegistry::Private {
+
+ // interface for KoColorSpaceFactory
+ struct ProfileRegistrationInterface;
+ // interface for KoColorConversionSystem
+ struct ConversionSystemInterface;
+
+
+ Private(KoColorSpaceRegistry *_q) : q(_q) {}
+
+ KoColorSpaceRegistry *q;
+
KoGenericRegistry<KoColorSpaceFactory *> colorSpaceFactoryRegistry;
- QList<KoColorSpaceFactory *> localFactories;
- QHash<QString, KoColorProfile * > profileMap;
- QHash<QByteArray, KoColorProfile * > profileUniqueIdMap;
- QHash<QString, QString> profileAlias;
+ KoColorProfileStorage profileStorage;
QHash<QString, const KoColorSpace *> csMap;
+ QScopedPointer<ConversionSystemInterface> conversionSystemInterface;
KoColorConversionSystem *colorConversionSystem;
KoColorConversionCache* colorConversionCache;
const KoColorSpace *rgbU8sRGB;
const KoColorSpace *lab16sLAB;
const KoColorSpace *alphaCs;
const KoColorSpace *alphaU16Cs;
#ifdef HAVE_OPENEXR
const KoColorSpace *alphaF16Cs;
#endif
const KoColorSpace *alphaF32Cs;
QReadWriteLock registrylock;
- void populateUniqueIdMap();
+ /**
+ * The function checks if a colorspace with a certain id and profile name can be found in the cache
+ * NOTE: the function doesn't take any lock but it needs to be called inside a d->registryLock
+ * locked either in read or write.
+ * @param csId The colorspace id
+ * @param profileName The colorspace profile name
+ * @retval KoColorSpace The matching colorspace
+ * @retval 0 Null pointer if not match
+ */
+ const KoColorSpace* getCachedColorSpaceImpl(const QString & csId, const QString & profileName) const;
+
+ QString idsToCacheName(const QString & csId, const QString & profileName) const;
+ QString defaultProfileForCsIdImpl(const QString &csID);
+ const KoColorProfile * profileForCsIdWithFallbackImpl(const QString &csID, const QString &profileName);
+ QString colorSpaceIdImpl(const QString & colorModelId, const QString & colorDepthId) const;
+
+ const KoColorSpace *lazyCreateColorSpaceImpl(const QString &csID, const KoColorProfile *profile);
+
+ /**
+ * Return a colorspace that works with the parameter profile.
+ * @param profileName the name of the KoColorProfile to be combined with the colorspace
+ * @return the wanted colorspace, or 0 when the cs and profile can not be combined.
+ */
+ template<class LockPolicy = NormalLockPolicy>
+ const KoColorSpace * colorSpace1(const QString &colorSpaceId, const QString &pName = QString());
+
+ /**
+ * Return a colorspace that works with the parameter profile.
+ * @param colorSpaceId the ID string of the colorspace that you want to have returned
+ * @param profile the profile be combined with the colorspace
+ * @return the wanted colorspace, or 0 when the cs and profile can not be combined.
+ */
+ const KoColorSpace * colorSpace1(const QString &colorSpaceId, const KoColorProfile *profile);
+};
+
+struct KoColorSpaceRegistry::Private::ConversionSystemInterface : public KoColorConversionSystem::RegistryInterface
+{
+ ConversionSystemInterface(KoColorSpaceRegistry *parentRegistry)
+ : q(parentRegistry)
+ {
+ }
+
+ const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName) {
+ return q->d->colorSpace1<NoLockPolicy>(q->d->colorSpaceIdImpl(colorModelId, colorDepthId), profileName);
+ }
+
+ const KoColorSpaceFactory* colorSpaceFactory(const QString &colorModelId, const QString &colorDepthId) const {
+ return q->d->colorSpaceFactoryRegistry.get(q->d->colorSpaceIdImpl(colorModelId, colorDepthId));
+ }
+
+ QList<const KoColorProfile *> profilesFor(const KoColorSpaceFactory * csf) const {
+ return q->d->profileStorage.profilesFor(csf);
+ }
+
+ QList<const KoColorSpaceFactory*> colorSpacesFor(const KoColorProfile* profile) const {
+ QList<const KoColorSpaceFactory*> csfs;
+ Q_FOREACH (KoColorSpaceFactory* csf, q->d->colorSpaceFactoryRegistry.values()) {
+ if (csf->profileIsCompatible(profile)) {
+ csfs.push_back(csf);
+ }
+ }
+ return csfs;
+ }
+
+private:
+ KoColorSpaceRegistry *q;
};
KoColorSpaceRegistry* KoColorSpaceRegistry::instance()
{
if (!s_instance.exists()) {
s_instance->init();
}
return s_instance;
}
void KoColorSpaceRegistry::init()
{
d->rgbU8sRGB = 0;
d->lab16sLAB = 0;
d->alphaCs = 0;
d->alphaU16Cs = 0;
#ifdef HAVE_OPENEXR
d->alphaF16Cs = 0;
#endif
d->alphaF32Cs = 0;
- d->colorConversionSystem = new KoColorConversionSystem;
+ d->conversionSystemInterface.reset(new Private::ConversionSystemInterface(this));
+ d->colorConversionSystem = new KoColorConversionSystem(d->conversionSystemInterface.data());
d->colorConversionCache = new KoColorConversionCache;
KoColorSpaceEngineRegistry::instance()->add(new KoSimpleColorSpaceEngine());
addProfile(new KoDummyColorProfile);
// Create the built-in colorspaces
- d->localFactories
+ QList<KoColorSpaceFactory *> localFactories;
+ localFactories
<< new KoAlphaColorSpaceFactory()
<< new KoAlphaU16ColorSpaceFactory()
#ifdef HAVE_OPENEXR
<< new KoAlphaF16ColorSpaceFactory()
#endif
<< new KoAlphaF32ColorSpaceFactory()
<< new KoLabColorSpaceFactory()
<< new KoRgbU8ColorSpaceFactory()
<< new KoRgbU16ColorSpaceFactory();
- Q_FOREACH (KoColorSpaceFactory *factory, d->localFactories) {
+ Q_FOREACH (KoColorSpaceFactory *factory, localFactories) {
add(factory);
}
KoPluginLoader::PluginsConfig config;
config.whiteList = "ColorSpacePlugins";
config.blacklist = "ColorSpacePluginsDisabled";
config.group = "calligra";
KoPluginLoader::instance()->load("Calligra/ColorSpace", "[X-Pigment-PluginVersion] == 28", config);
KoPluginLoader::PluginsConfig configExtensions;
configExtensions.whiteList = "ColorSpaceExtensionsPlugins";
configExtensions.blacklist = "ColorSpaceExtensionsPluginsDisabled";
configExtensions.group = "calligra";
KoPluginLoader::instance()->load("Calligra/ColorSpaceExtension", "[X-Pigment-PluginVersion] == 28", configExtensions);
dbgPigment << "Loaded the following colorspaces:";
Q_FOREACH (const KoID& id, listKeys()) {
dbgPigment << "\t" << id.id() << "," << id.name();
}
}
-KoColorSpaceRegistry::KoColorSpaceRegistry() : d(new Private())
+KoColorSpaceRegistry::KoColorSpaceRegistry() : d(new Private(this))
{
d->colorConversionSystem = 0;
d->colorConversionCache = 0;
}
KoColorSpaceRegistry::~KoColorSpaceRegistry()
{
// Just leak on exit... It's faster.
// delete d->colorConversionSystem;
// Q_FOREACH (KoColorProfile* profile, d->profileMap) {
// delete profile;
// }
// d->profileMap.clear();
// Q_FOREACH (const KoColorSpace * cs, d->csMap) {
// cs->d->deletability = OwnedByRegistryRegistryDeletes;
// }
// d->csMap.clear();
// // deleting colorspaces calls a function in the cache
// delete d->colorConversionCache;
// d->colorConversionCache = 0;
// // Delete the colorspace factories
// qDeleteAll(d->localFactories);
delete d;
}
void KoColorSpaceRegistry::add(KoColorSpaceFactory* item)
{
- {
- QWriteLocker l(&d->registrylock);
- d->colorSpaceFactoryRegistry.add(item);
- }
+ QWriteLocker l(&d->registrylock);
+ d->colorSpaceFactoryRegistry.add(item);
d->colorConversionSystem->insertColorSpace(item);
}
void KoColorSpaceRegistry::remove(KoColorSpaceFactory* item)
{
- d->registrylock.lockForRead();
+ QWriteLocker l(&d->registrylock);
+
QList<QString> toremove;
Q_FOREACH (const KoColorSpace * cs, d->csMap) {
if (cs->id() == item->id()) {
- toremove.push_back(idsToCacheName(cs->id(), cs->profile()->name()));
+ toremove.push_back(d->idsToCacheName(cs->id(), cs->profile()->name()));
cs->d->deletability = OwnedByRegistryRegistryDeletes;
}
}
- d->registrylock.unlock();
- d->registrylock.lockForWrite();
+
Q_FOREACH (const QString& id, toremove) {
d->csMap.remove(id);
// TODO: should not it delete the color space when removing it from the map ?
}
d->colorSpaceFactoryRegistry.remove(item->id());
- d->registrylock.unlock();
}
void KoColorSpaceRegistry::addProfileAlias(const QString& name, const QString& to)
{
- QWriteLocker l(&d->registrylock);
- d->profileAlias[name] = to;
+ d->profileStorage.addProfileAlias(name, to);
}
-QString KoColorSpaceRegistry::profileAlias(const QString& _name) const
+QString KoColorSpaceRegistry::profileAlias(const QString& name) const
{
- QReadLocker l(&d->registrylock);
- return d->profileAlias.value(_name, _name);
+ return d->profileStorage.profileAlias(name);
}
-const KoColorProfile * KoColorSpaceRegistry::profileByName(const QString & _name) const
+const KoColorProfile* KoColorSpaceRegistry::profileByName(const QString &name) const
{
- QReadLocker l(&d->registrylock);
- return d->profileMap.value( profileAlias(_name), 0);
-}
-
-void KoColorSpaceRegistry::Private::populateUniqueIdMap()
-{
- QWriteLocker l(&registrylock);
- profileUniqueIdMap.clear();
-
- for (auto it = profileMap.constBegin();
- it != profileMap.constEnd();
- ++it) {
-
- KoColorProfile *profile = it.value();
- QByteArray id = profile->uniqueId();
-
- if (!id.isEmpty()) {
- profileUniqueIdMap.insert(id, profile);
- }
- }
+ return d->profileStorage.profileByName(name);
}
const KoColorProfile * KoColorSpaceRegistry::profileByUniqueId(const QByteArray &id) const
{
- {
- QReadLocker l(&d->registrylock);
- if (d->profileUniqueIdMap.isEmpty()) {
- l.unlock();
- d->populateUniqueIdMap();
- l.relock();
- }
- return d->profileUniqueIdMap.value(id, 0);
- }
+ return d->profileStorage.profileByUniqueId(id);
}
-
-QList<const KoColorProfile *> KoColorSpaceRegistry::profilesFor(const QString &id) const
+QList<const KoColorProfile *> KoColorSpaceRegistry::profilesFor(const QString &csID) const
{
- return profilesFor(d->colorSpaceFactoryRegistry.value(id));
-}
-
-const KoColorSpace * KoColorSpaceRegistry::colorSpace(const KoID &csID, const QString & profileName)
-{
- return colorSpace(csID.id(), profileName);
+ QReadLocker l(&d->registrylock);
+ return d->profileStorage.profilesFor(d->colorSpaceFactoryRegistry.value(csID));
}
const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString & colorModelId, const QString & colorDepthId, const KoColorProfile *profile)
{
- return colorSpace(colorSpaceId(colorModelId, colorDepthId), profile);
+ return d->colorSpace1(colorSpaceId(colorModelId, colorDepthId), profile);
}
const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName)
{
- return colorSpace(colorSpaceId(colorModelId, colorDepthId), profileName);
+ return d->colorSpace1(colorSpaceId(colorModelId, colorDepthId), profileName);
}
-QList<const KoColorProfile *> KoColorSpaceRegistry::profilesFor(const KoColorSpaceFactory * csf) const
+const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString & colorModelId, const QString & colorDepthId)
{
- QReadLocker l(&d->registrylock);
- QList<const KoColorProfile *> profiles;
- if (csf == 0)
- return profiles;
-
- QHash<QString, KoColorProfile * >::Iterator it;
- for (it = d->profileMap.begin(); it != d->profileMap.end(); ++it) {
- KoColorProfile * profile = it.value();
- if (csf->profileIsCompatible(profile)) {
- Q_ASSERT(profile);
- // if (profile->colorSpaceSignature() == csf->colorSpaceSignature()) {
- profiles.push_back(profile);
- }
- }
- return profiles;
+ return d->colorSpace1(colorSpaceId(colorModelId, colorDepthId));
}
-QList<const KoColorSpaceFactory*> KoColorSpaceRegistry::colorSpacesFor(const KoColorProfile* _profile) const
+bool KoColorSpaceRegistry::profileIsCompatible(const KoColorProfile *profile, const QString &colorSpaceId)
{
QReadLocker l(&d->registrylock);
- QList<const KoColorSpaceFactory*> csfs;
- Q_FOREACH (KoColorSpaceFactory* csf, d->colorSpaceFactoryRegistry.values()) {
- if (csf->profileIsCompatible(_profile)) {
- csfs.push_back(csf);
- }
- }
- return csfs;
-}
+ KoColorSpaceFactory *csf = d->colorSpaceFactoryRegistry.value(colorSpaceId);
-QList<const KoColorProfile *> KoColorSpaceRegistry::profilesFor(const KoID& id) const
-{
- return profilesFor(id.id());
+ return csf ? csf->profileIsCompatible(profile) : false;
}
void KoColorSpaceRegistry::addProfileToMap(KoColorProfile *p)
{
- Q_ASSERT(p);
- if (p->valid()) {
- d->profileMap[p->name()] = p;
- if (!d->profileUniqueIdMap.isEmpty()) {
- d->profileUniqueIdMap.insert(p->uniqueId(), p);
- }
- }
+ d->profileStorage.addProfile(p);
}
void KoColorSpaceRegistry::addProfile(KoColorProfile *p)
{
- Q_ASSERT(p);
+ if (!p->valid()) return;
+
+ QWriteLocker locker(&d->registrylock);
if (p->valid()) {
addProfileToMap(p);
d->colorConversionSystem->insertColorProfile(p);
}
}
void KoColorSpaceRegistry::addProfile(const KoColorProfile* profile)
{
addProfile(profile->clone());
}
void KoColorSpaceRegistry::removeProfile(KoColorProfile* profile)
{
- d->profileMap.remove(profile->name());
- if (!d->profileUniqueIdMap.isEmpty()) {
- d->profileUniqueIdMap.remove(profile->uniqueId());
- }
+ d->profileStorage.removeProfile(profile);
+ // FIXME: how about removing it from conversion system?
}
-const KoColorSpace* KoColorSpaceRegistry::getCachedColorSpace(const QString & csID, const QString & profileName) const
+const KoColorSpace* KoColorSpaceRegistry::Private::getCachedColorSpaceImpl(const QString & csID, const QString & profileName) const
{
- auto it = d->csMap.find(idsToCacheName(csID, profileName));
+ auto it = csMap.find(idsToCacheName(csID, profileName));
- if (it != d->csMap.end()) {
- return it.value();
+ if (it != csMap.end()) {
+ return it.value();
}
return 0;
}
-QString KoColorSpaceRegistry::idsToCacheName(const QString & csID, const QString & profileName) const
+QString KoColorSpaceRegistry::Private::idsToCacheName(const QString & csID, const QString & profileName) const
{
return csID + "<comb>" + profileName;
}
-const KoColorSpaceFactory* KoColorSpaceRegistry::colorSpaceFactory(const QString &colorSpaceId) const
+QString KoColorSpaceRegistry::defaultProfileForColorSpace(const QString &colorSpaceId) const
{
QReadLocker l(&d->registrylock);
- return d->colorSpaceFactoryRegistry.get(colorSpaceId);
+ return d->defaultProfileForCsIdImpl(colorSpaceId);
}
-const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString &csID, const QString &pName)
+KoColorConversionTransformation *KoColorSpaceRegistry::createColorConverter(const KoColorSpace *srcColorSpace, const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const
{
- QString profileName = pName;
+ QWriteLocker l(&d->registrylock);
+ return d->colorConversionSystem->createColorConverter(srcColorSpace, dstColorSpace, renderingIntent, conversionFlags);
+}
- if (profileName.isEmpty()) {
- QReadLocker l(&d->registrylock);
- KoColorSpaceFactory *csf = d->colorSpaceFactoryRegistry.value(csID);
+void KoColorSpaceRegistry::createColorConverters(const KoColorSpace *colorSpace, const QList<QPair<KoID, KoID> > &possibilities, KoColorConversionTransformation *&fromCS, KoColorConversionTransformation *&toCS) const
+{
+ QWriteLocker l(&d->registrylock);
+ d->colorConversionSystem->createColorConverters(colorSpace, possibilities, fromCS, toCS);
+}
- if (!csf) {
- dbgPigmentCSRegistry << "Unknown color space type : " << csID;
- return 0;
- }
+QString KoColorSpaceRegistry::Private::defaultProfileForCsIdImpl(const QString &csID)
+{
+ QString defaultProfileName;
- profileName = csf->defaultProfile();
+ KoColorSpaceFactory *csf = colorSpaceFactoryRegistry.value(csID);
+ if (csf) {
+ defaultProfileName = csf->defaultProfile();
+ } else {
+ dbgPigmentCSRegistry << "Unknown color space type : " << csID;
}
- if (profileName.isEmpty()) {
- return 0;
- }
+ return defaultProfileName;
+}
- const KoColorSpace *cs = 0;
- {
- QReadLocker l(&d->registrylock);
- cs = getCachedColorSpace(csID, profileName);
- }
+const KoColorProfile *KoColorSpaceRegistry::Private::profileForCsIdWithFallbackImpl(const QString &csID, const QString &profileName)
+{
+ const KoColorProfile *profile = 0;
- if (!cs) {
- KoColorSpaceFactory *csf = d->colorSpaceFactoryRegistry.value(csID);
+ // last attempt at getting a profile, sometimes the default profile, like adobe cmyk isn't available.
+ profile = profileStorage.profileByName(profileName);
+ if (!profile) {
+ dbgPigmentCSRegistry << "Profile not found :" << profileName;
- if (!csf) {
- dbgPigmentCSRegistry << "Unknown color space type :" << csf;
- return 0;
- }
+ // first try: default
+ profile = profileStorage.profileByName(defaultProfileForCsIdImpl(csID));
- // last attempt at getting a profile, sometimes the default profile, like adobe cmyk isn't available.
- const KoColorProfile *p = profileByName(profileName);
- if (!p) {
- dbgPigmentCSRegistry << "Profile not found :" << profileName;
-
- /**
- * If the requested profile is not available, try fetching the
- * default one
- */
- profileName = csf->defaultProfile();
- p = profileByName(profileName);
-
- /**
- * If there is no luck, try to fetch the first one
- */
- if (!p) {
- QList<const KoColorProfile *> profiles = profilesFor(csID);
- if (!profiles.isEmpty()) {
- p = profiles[0];
- Q_ASSERT(p);
- }
+ if (!profile) {
+ // second try: first profile in the list
+ QList<const KoColorProfile *> profiles = profileStorage.profilesFor(colorSpaceFactoryRegistry.value(csID));
+ if (profiles.isEmpty() || !profiles.first()) {
+ dbgPigmentCSRegistry << "Couldn't fetch a fallback profile:" << profileName;
+ return 0;
}
+
+ profile = profiles.first();
}
+ }
+
+ return profile;
+}
+
+const KoColorSpace *KoColorSpaceRegistry::Private::lazyCreateColorSpaceImpl(const QString &csID, const KoColorProfile *profile)
+{
+ const KoColorSpace *cs = 0;
- // We did our best, but still have no profile: and since csf->grabColorSpace
- // needs the profile to find the colorspace, we have to give up.
- if (!p) {
+ /*
+ * We need to check again here, a thread requesting the same colorspace could've added it
+ * already, in between the read unlock and write lock.
+ * TODO: We also potentially changed profileName content, which means we maybe are going to
+ * create a colorspace that's actually in the space registry cache, but currently this might
+ * not be an issue because the colorspace should be cached also by the factory, so it won't
+ * create a new instance. That being said, having two caches with the same stuff doesn't make
+ * much sense.
+ */
+ cs = getCachedColorSpaceImpl(csID, profile->name());
+ if (!cs) {
+ KoColorSpaceFactory *csf = colorSpaceFactoryRegistry.value(csID);
+ cs = csf->grabColorSpace(profile);
+ if (!cs) {
+ dbgPigmentCSRegistry << "Unable to create color space";
return 0;
}
- profileName = p->name();
-
- QWriteLocker l(&d->registrylock);
- /*
- * We need to check again here, a thread requesting the same colorspace could've added it
- * already, in between the read unlock and write lock.
- * TODO: We also potentially changed profileName content, which means we maybe are going to
- * create a colorspace that's actually in the space registry cache, but currently this might
- * not be an issue because the colorspace should be cached also by the factory, so it won't
- * create a new instance. That being said, having two caches with the same stuff doesn't make
- * much sense.
- */
- cs = getCachedColorSpace(csID, profileName);
- if (!cs) {
- cs = csf->grabColorSpace(p);
- if (!cs) {
- dbgPigmentCSRegistry << "Unable to create color space";
- return 0;
- }
- dbgPigmentCSRegistry << "colorspace count: " << d->csMap.count()
- << ", adding name: " << idsToCacheName(cs->id(), cs->profile()->name())
- << "\n\tcsID" << csID
- << "\n\tprofileName" << profileName
- << "\n\tcs->id()" << cs->id()
- << "\n\tcs->profile()->name()" << cs->profile()->name()
- << "\n\tpName" << pName;
- Q_ASSERT(cs->id() == csID);
- Q_ASSERT(cs->profile()->name() == profileName);
- d->csMap[idsToCacheName(cs->id(), cs->profile()->name())] = cs;
- cs->d->deletability = OwnedByRegistryDoNotDelete;
+ dbgPigmentCSRegistry << "colorspace count: " << csMap.count()
+ << ", adding name: " << idsToCacheName(cs->id(), cs->profile()->name())
+ << "\n\tcsID" << csID
+ << "\n\tcs->id()" << cs->id()
+ << "\n\tcs->profile()->name()" << cs->profile()->name()
+ << "\n\tprofile->name()" << profile->name();
+ Q_ASSERT(cs->id() == csID);
+ Q_ASSERT(cs->profile()->name() == profile->name());
+ csMap[idsToCacheName(cs->id(), cs->profile()->name())] = cs;
+ cs->d->deletability = OwnedByRegistryDoNotDelete;
+ }
+
+ return cs;
+}
+
+template<class LockPolicy>
+const KoColorSpace * KoColorSpaceRegistry::Private::colorSpace1(const QString &csID, const QString &pName)
+{
+ QString profileName = pName;
+
+ const KoColorSpace *cs = 0;
+
+ {
+ typename LockPolicy::ReadLocker l(&registrylock);
+
+ if (profileName.isEmpty()) {
+ profileName = defaultProfileForCsIdImpl(csID);
+ if (profileName.isEmpty()) return 0;
}
+
+ // quick attempt to fetch a cached color space
+ cs = getCachedColorSpaceImpl(csID, profileName);
+ }
+
+ if (!cs) {
+ // slow attemt to create a color space
+ typename LockPolicy::WriteLocker l(&registrylock);
+
+ const KoColorProfile *profile =
+ profileForCsIdWithFallbackImpl(csID, profileName);
+
+ // until kis_asert.h is not available in 3.1, use this combo
+ Q_ASSERT(profile);
+ if (!profile) return 0;
+
+ cs = lazyCreateColorSpaceImpl(csID, profile);
}
else {
- Q_ASSERT(cs->id() == csID);
- Q_ASSERT(cs->profile()->name() == profileName);
+ KIS_SAFE_ASSERT_RECOVER_NOOP(cs->id() == csID);
+ KIS_SAFE_ASSERT_RECOVER_NOOP(cs->profile()->name() == profileName);
}
return cs;
}
-const KoColorSpace * KoColorSpaceRegistry::colorSpace(const QString &csID, const KoColorProfile *profile)
+const KoColorSpace * KoColorSpaceRegistry::Private::colorSpace1(const QString &csID, const KoColorProfile *profile)
{
if (csID.isEmpty()) {
return 0;
+ } else if (!profile) {
+ return colorSpace1(csID);
}
- if (profile) {
- d->registrylock.lockForRead();
- const KoColorSpace *cs = getCachedColorSpace(csID, profile->name());
- d->registrylock.unlock();
- if (!d->profileMap.contains(profile->name())) {
- addProfile(profile);
- }
+ const KoColorSpace *cs = 0;
- if (!cs) {
- // The profile was not stored and thus not the combination either
- d->registrylock.lockForRead();
- KoColorSpaceFactory *csf = d->colorSpaceFactoryRegistry.value(csID);
- d->registrylock.unlock();
- if (!csf) {
- dbgPigmentCSRegistry << "Unknown color space type :" << csf;
- return 0;
- }
- if (!csf->profileIsCompatible(profile ) ) {
- return 0;
- }
+ {
+ QReadLocker l(&registrylock);
+ cs = getCachedColorSpaceImpl(csID, profile->name());
+ }
- QWriteLocker l(&d->registrylock);
- // Check again, anything could've happened between the unlock and the write lock
- cs = getCachedColorSpace(csID, profile->name());
- if (!cs) {
- cs = csf->grabColorSpace(profile);
- if (!cs)
- return 0;
-
- QString name = idsToCacheName(csID, profile->name());
- d->csMap[name] = cs;
- cs->d->deletability = OwnedByRegistryDoNotDelete;
- dbgPigmentCSRegistry << "colorspace count: " << d->csMap.count() << ", adding name: " << name;
- }
+ // the profile should have already been added to the registry by createColorProfile() method
+ KIS_SAFE_ASSERT_RECOVER(profileStorage.containsProfile(profile)) {
+ // warning! locking happens inside addProfile!
+ q->addProfile(profile);
+ }
+
+ if (!cs) {
+ // The profile was not stored and thus not the combination either
+ QWriteLocker l(&registrylock);
+ KoColorSpaceFactory *csf = colorSpaceFactoryRegistry.value(csID);
+
+ if (!csf) {
+ dbgPigmentCSRegistry << "Unknown color space type :" << csf;
+ return 0;
}
- return cs;
- } else {
- return colorSpace(csID);
+ if (!csf->profileIsCompatible(profile)) {
+ dbgPigmentCSRegistry << "Profile is not compatible:" << csf << profile->name();
+ return 0;
+ }
+
+ cs = lazyCreateColorSpaceImpl(csID, profile);
}
+
+ return cs;
}
const KoColorSpace * KoColorSpaceRegistry::alpha8()
{
if (!d->alphaCs) {
- d->alphaCs = colorSpace(KoAlphaColorSpace::colorSpaceId());
+ d->alphaCs = d->colorSpace1(KoAlphaColorSpace::colorSpaceId());
}
Q_ASSERT(d->alphaCs);
return d->alphaCs;
}
const KoColorSpace * KoColorSpaceRegistry::alpha16()
{
if (!d->alphaU16Cs) {
- d->alphaU16Cs = colorSpace(KoAlphaU16ColorSpace::colorSpaceId());
+ d->alphaU16Cs = d->colorSpace1(KoAlphaU16ColorSpace::colorSpaceId());
}
Q_ASSERT(d->alphaU16Cs);
return d->alphaU16Cs;
}
#ifdef HAVE_OPENEXR
const KoColorSpace * KoColorSpaceRegistry::alpha16f()
{
if (!d->alphaF16Cs) {
- d->alphaF16Cs = colorSpace(KoAlphaF16ColorSpace::colorSpaceId());
+ d->alphaF16Cs = d->colorSpace1(KoAlphaF16ColorSpace::colorSpaceId());
}
Q_ASSERT(d->alphaF16Cs);
return d->alphaF16Cs;
}
#endif
const KoColorSpace * KoColorSpaceRegistry::alpha32f()
{
if (!d->alphaF32Cs) {
- d->alphaF32Cs = colorSpace(KoAlphaF32ColorSpace::colorSpaceId());
+ d->alphaF32Cs = d->colorSpace1(KoAlphaF32ColorSpace::colorSpaceId());
}
Q_ASSERT(d->alphaF32Cs);
return d->alphaF32Cs;
}
const KoColorSpace * KoColorSpaceRegistry::rgb8(const QString &profileName)
{
if (profileName.isEmpty()) {
if (!d->rgbU8sRGB) {
- d->rgbU8sRGB = colorSpace(KoRgbU8ColorSpace::colorSpaceId());
+ d->rgbU8sRGB = d->colorSpace1(KoRgbU8ColorSpace::colorSpaceId());
}
Q_ASSERT(d->rgbU8sRGB);
return d->rgbU8sRGB;
}
- return colorSpace(KoRgbU8ColorSpace::colorSpaceId(), profileName);
+ return d->colorSpace1(KoRgbU8ColorSpace::colorSpaceId(), profileName);
}
const KoColorSpace * KoColorSpaceRegistry::rgb8(const KoColorProfile * profile)
{
if (profile == 0) {
if (!d->rgbU8sRGB) {
- d->rgbU8sRGB = colorSpace(KoRgbU8ColorSpace::colorSpaceId());
+ d->rgbU8sRGB = d->colorSpace1(KoRgbU8ColorSpace::colorSpaceId());
}
Q_ASSERT(d->rgbU8sRGB);
return d->rgbU8sRGB;
}
- return colorSpace(KoRgbU8ColorSpace::colorSpaceId(), profile);
+ return d->colorSpace1(KoRgbU8ColorSpace::colorSpaceId(), profile);
}
const KoColorSpace * KoColorSpaceRegistry::rgb16(const QString &profileName)
{
- return colorSpace(KoRgbU16ColorSpace::colorSpaceId(), profileName);
+ return d->colorSpace1(KoRgbU16ColorSpace::colorSpaceId(), profileName);
}
const KoColorSpace * KoColorSpaceRegistry::rgb16(const KoColorProfile * profile)
{
- return colorSpace(KoRgbU16ColorSpace::colorSpaceId(), profile);
+ return d->colorSpace1(KoRgbU16ColorSpace::colorSpaceId(), profile);
}
const KoColorSpace * KoColorSpaceRegistry::lab16(const QString &profileName)
{
if (profileName.isEmpty()) {
if (!d->lab16sLAB) {
- d->lab16sLAB = colorSpace(KoLabColorSpace::colorSpaceId(), profileName);
+ d->lab16sLAB = d->colorSpace1(KoLabColorSpace::colorSpaceId());
}
return d->lab16sLAB;
}
- return colorSpace(KoLabColorSpace::colorSpaceId(), profileName);
+ return d->colorSpace1(KoLabColorSpace::colorSpaceId(), profileName);
}
const KoColorSpace * KoColorSpaceRegistry::lab16(const KoColorProfile * profile)
{
if (profile == 0) {
if (!d->lab16sLAB) {
- d->lab16sLAB = colorSpace(KoLabColorSpace::colorSpaceId(), profile);
+ d->lab16sLAB = d->colorSpace1(KoLabColorSpace::colorSpaceId());
}
Q_ASSERT(d->lab16sLAB);
return d->lab16sLAB;
}
- return colorSpace(KoLabColorSpace::colorSpaceId(), profile);
+ return d->colorSpace1(KoLabColorSpace::colorSpaceId(), profile);
}
QList<KoID> KoColorSpaceRegistry::colorModelsList(ColorSpaceListVisibility option) const
{
QReadLocker l(&d->registrylock);
+
QList<KoID> ids;
QList<KoColorSpaceFactory*> factories = d->colorSpaceFactoryRegistry.values();
Q_FOREACH (KoColorSpaceFactory* factory, factories) {
if (!ids.contains(factory->colorModelId())
&& (option == AllColorSpaces || factory->userVisible())) {
ids << factory->colorModelId();
}
}
return ids;
}
QList<KoID> KoColorSpaceRegistry::colorDepthList(const KoID& colorModelId, ColorSpaceListVisibility option) const
{
return colorDepthList(colorModelId.id(), option);
}
QList<KoID> KoColorSpaceRegistry::colorDepthList(const QString & colorModelId, ColorSpaceListVisibility option) const
{
QReadLocker l(&d->registrylock);
+
QList<KoID> ids;
QList<KoColorSpaceFactory*> factories = d->colorSpaceFactoryRegistry.values();
Q_FOREACH (KoColorSpaceFactory* factory, factories) {
if (!ids.contains(KoID(factory->colorDepthId()))
&& factory->colorModelId().id() == colorModelId
&& (option == AllColorSpaces || factory->userVisible())) {
ids << factory->colorDepthId();
}
}
return ids;
}
-QString KoColorSpaceRegistry::colorSpaceId(const QString & colorModelId, const QString & colorDepthId) const
+QString KoColorSpaceRegistry::Private::colorSpaceIdImpl(const QString & colorModelId, const QString & colorDepthId) const
{
- QReadLocker l(&d->registrylock);
- QList<KoColorSpaceFactory*> factories = d->colorSpaceFactoryRegistry.values();
+ QList<KoColorSpaceFactory*> factories = colorSpaceFactoryRegistry.values();
Q_FOREACH (KoColorSpaceFactory* factory, factories) {
if (factory->colorModelId().id() == colorModelId && factory->colorDepthId().id() == colorDepthId) {
return factory->id();
}
}
return "";
}
+QString KoColorSpaceRegistry::colorSpaceId(const QString & colorModelId, const QString & colorDepthId) const
+{
+ QReadLocker l(&d->registrylock);
+ return d->colorSpaceIdImpl(colorModelId, colorDepthId);
+}
+
QString KoColorSpaceRegistry::colorSpaceId(const KoID& colorModelId, const KoID& colorDepthId) const
{
return colorSpaceId(colorModelId.id(), colorDepthId.id());
}
KoID KoColorSpaceRegistry::colorSpaceColorModelId(const QString & _colorSpaceId) const
{
QReadLocker l(&d->registrylock);
+
KoColorSpaceFactory* factory = d->colorSpaceFactoryRegistry.get(_colorSpaceId);
if (factory) {
return factory->colorModelId();
} else {
return KoID();
}
}
KoID KoColorSpaceRegistry::colorSpaceColorDepthId(const QString & _colorSpaceId) const
{
QReadLocker l(&d->registrylock);
+
KoColorSpaceFactory* factory = d->colorSpaceFactoryRegistry.get(_colorSpaceId);
if (factory) {
return factory->colorDepthId();
} else {
return KoID();
}
}
const KoColorConversionSystem* KoColorSpaceRegistry::colorConversionSystem() const
{
return d->colorConversionSystem;
}
KoColorConversionCache* KoColorSpaceRegistry::colorConversionCache() const
{
return d->colorConversionCache;
}
const KoColorSpace* KoColorSpaceRegistry::permanentColorspace(const KoColorSpace* _colorSpace)
{
if (_colorSpace->d->deletability != NotOwnedByRegistry) {
return _colorSpace;
} else if (*_colorSpace == *d->alphaCs) {
return d->alphaCs;
} else {
- const KoColorSpace* cs = colorSpace(_colorSpace->id(), _colorSpace->profile());
+ const KoColorSpace* cs = d->colorSpace1(_colorSpace->id(), _colorSpace->profile());
Q_ASSERT(cs);
Q_ASSERT(*cs == *_colorSpace);
return cs;
}
}
QList<KoID> KoColorSpaceRegistry::listKeys() const
{
QReadLocker l(&d->registrylock);
QList<KoID> answer;
Q_FOREACH (const QString& key, d->colorSpaceFactoryRegistry.keys()) {
answer.append(KoID(key, d->colorSpaceFactoryRegistry.get(key)->name()));
}
return answer;
}
+struct KoColorSpaceRegistry::Private::ProfileRegistrationInterface : public KoColorSpaceFactory::ProfileRegistrationInterface
+{
+ ProfileRegistrationInterface(KoColorSpaceRegistry::Private *_d) : d(_d) {}
+
+ const KoColorProfile* profileByName(const QString &profileName) const override {
+ return d->profileStorage.profileByName(profileName);
+ }
+
+ void registerNewProfile(KoColorProfile *profile) override {
+ d->profileStorage.addProfile(profile);
+ d->colorConversionSystem->insertColorProfile(profile);
+ }
+
+ KoColorSpaceRegistry::Private *d;
+};
+
const KoColorProfile* KoColorSpaceRegistry::createColorProfile(const QString& colorModelId, const QString& colorDepthId, const QByteArray& rawData)
{
- QReadLocker l(&d->registrylock);
- KoColorSpaceFactory* factory_ = d->colorSpaceFactoryRegistry.get(colorSpaceId(colorModelId, colorDepthId));
- return factory_->colorProfile(rawData);
+ QWriteLocker l(&d->registrylock);
+ KoColorSpaceFactory* factory_ = d->colorSpaceFactoryRegistry.get(d->colorSpaceIdImpl(colorModelId, colorDepthId));
+
+ Private::ProfileRegistrationInterface interface(d);
+ return factory_->colorProfile(rawData, &interface);
}
QList<const KoColorSpace*> KoColorSpaceRegistry::allColorSpaces(ColorSpaceListVisibility visibility, ColorSpaceListProfilesSelection pSelection)
{
QList<const KoColorSpace*> colorSpaces;
+ // TODO: thread-unsafe code: the factories might change right after the lock in released
+ // HINT: used in a unittest only!
+
d->registrylock.lockForRead();
QList<KoColorSpaceFactory*> factories = d->colorSpaceFactoryRegistry.values();
d->registrylock.unlock();
Q_FOREACH (KoColorSpaceFactory* factory, factories) {
// Don't test with ycbcr for now, since we don't have a default profile for it.
if (factory->colorModelId().id().startsWith("Y")) continue;
if (visibility == AllColorSpaces || factory->userVisible()) {
if (pSelection == OnlyDefaultProfile) {
- const KoColorSpace *cs = colorSpace(factory->id());
+ const KoColorSpace *cs = d->colorSpace1(factory->id());
if (cs) {
colorSpaces.append(cs);
}
else {
warnPigment << "Could not create colorspace for id" << factory->id() << "since there is no working default profile";
}
} else {
QList<const KoColorProfile*> profiles = KoColorSpaceRegistry::instance()->profilesFor(factory->id());
Q_FOREACH (const KoColorProfile * profile, profiles) {
- const KoColorSpace *cs = colorSpace(factory->id(), profile);
+ const KoColorSpace *cs = d->colorSpace1(factory->id(), profile);
if (cs) {
colorSpaces.append(cs);
}
else {
warnPigment << "Could not create colorspace for id" << factory->id() << "and profile" << profile->name();
}
}
}
}
}
return colorSpaces;
}
diff --git a/libs/pigment/KoColorSpaceRegistry.h b/libs/pigment/KoColorSpaceRegistry.h
index 1504102427..89abd8c935 100644
--- a/libs/pigment/KoColorSpaceRegistry.h
+++ b/libs/pigment/KoColorSpaceRegistry.h
@@ -1,371 +1,361 @@
/*
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004,2010 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORSPACEREGISTRY_H
#define KOCOLORSPACEREGISTRY_H
#include <QObject>
#include <QList>
#include <QString>
#include "kritapigment_export.h"
#include <KoGenericRegistry.h>
#include <KoColorSpace.h>
#include <KoColorSpaceFactory.h>
class KoColorProfile;
class KoColorConversionSystem;
class KoColorConversionCache;
+class KoColorConversionTransformation;
/**
* The registry for colorspaces and profiles.
* This class contains:
* - a registry of colorspace instantiated with specific profiles.
* - a registry of singleton colorspace factories.
* - a registry of icc profiles
+ *
+ * Locking policy details:
+ *
+ * Basically, we have two levels of locks in the registry:
+ * 1) (outer level) is Private::registrylock, which controls the structures
+ * of the color space registry itself
+ * 2) (inner level) is KoColorProfileStorage::Private::lock controls
+ * the structures related to profiles.
+ *
+ * The locks can be taken individually, but if you are going to take both
+ * of them, you should always follow the order 1) registry; 2) profiles.
+ * Otherwise you'll get a deadlock.
+ *
+ * To avoid recursive deadlocks, all the dependent classes
+ * (KoColorConversionSystem and KoColorSpaceFactory) now do not use the direct
+ * links to the registry. Instead, they use special private interfaces that
+ * skip recursive locking and ensure we take a lock twice.
*/
class KRITAPIGMENT_EXPORT KoColorSpaceRegistry
{
public:
KoColorSpaceRegistry();
enum ColorSpaceListVisibility {
OnlyUserVisible = 1, ///< Only user visible color space
AllColorSpaces = 4 ///< All color space even those not visible to the user
};
enum ColorSpaceListProfilesSelection {
OnlyDefaultProfile = 1, ///< Only add the default profile
AllProfiles = 4 ///< Add all profiles
};
/**
* Return an instance of the KoColorSpaceRegistry
* Creates an instance if that has never happened before and returns the singleton instance.
*/
static KoColorSpaceRegistry * instance();
virtual ~KoColorSpaceRegistry();
public:
/**
* add a color space to the registry
* @param item the color space factory to add
*/
void add(KoColorSpaceFactory* item);
/**
* Remove a color space factory from the registry. Note that it is the
* responsibility of the caller to ensure that the colorspaces are not
* used anymore.
*/
void remove(KoColorSpaceFactory* item);
/**
* Add a profile to the profile map but do not add it to the
* color conversion system yet.
* @param profile the new profile to be registered.
*/
void addProfileToMap(KoColorProfile *p);
/**
* register the profile with the color space registry
* @param profile the new profile to be registered so it can be combined with
* colorspaces.
*/
void addProfile(KoColorProfile* profile);
void addProfile(const KoColorProfile* profile); // TODO why ?
void removeProfile(KoColorProfile* profile);
/**
* Create an alias to a profile with a different name. Then @ref profileByName
* will return the profile @p to when passed @p name as a parameter.
*/
void addProfileAlias(const QString& name, const QString& to);
/**
* @return the profile alias, or name if not aliased
*/
QString profileAlias(const QString& name) const;
/**
* create a profile of the specified type.
*/
const KoColorProfile *createColorProfile(const QString & colorModelId, const QString & colorDepthId, const QByteArray& rawData);
/**
* Return a profile by its given name, or 0 if none registered.
* @return a profile by its given name, or 0 if none registered.
* @param name the product name as set on the profile.
* @see addProfile()
* @see KoColorProfile::productName()
*/
const KoColorProfile * profileByName(const QString & name) const ;
/**
* Returns a profile by its unique id stored/calculated in the header.
* The first call to this function might take long, because the map is
* created on the first use only (atm used by SVG only)
* @param id unique ProfileID of the profile (MD5 sum of its header)
* @return the profile or 0 if not found
*/
const KoColorProfile *profileByUniqueId(const QByteArray &id) const;
- /**
- * Return the list of profiles for the argument colorspacefactory.
- * Profiles will not work with any color space, you can query which profiles
- * that are registered with this registry can be used in combination with the
- * argument factory.
- * @param factory the factory with which all the returned profiles will work.
- * @return a list of profiles for the factory
- */
- QList<const KoColorProfile *> profilesFor(const KoColorSpaceFactory * factory) const;
-
- /**
- * Return the list of profiles for a colorspace with the argument id.
- * Profiles will not work with any color space, you can query which profiles
- * that are registered with this registry can be used in combination with the
- * argument factory.
- * @param id the colorspace-id with which all the returned profiles will work.
- * @return a list of profiles for the factory
- */
- QList<const KoColorProfile *> profilesFor(const KoID& id) const;
-
- /**
- * @return a list of color spaces compatible with this profile
- */
- QList<const KoColorSpaceFactory*> colorSpacesFor(const KoColorProfile* _profile) const;
+ bool profileIsCompatible(const KoColorProfile* profile, const QString &colorSpaceId);
/**
* Return the list of profiles for a colorspace with the argument id.
* Profiles will not work with any color space, you can query which profiles
* that are registered with this registry can be used in combination with the
* argument factory.
* @param colorSpaceId the colorspace-id with which all the returned profiles will work.
* @return a list of profiles for the factory
*/
- QList<const KoColorProfile *> profilesFor(const QString& id) const;
- const KoColorSpaceFactory* colorSpaceFactory(const QString &colorSpaceId) const;
+ QList<const KoColorProfile *> profilesFor(const QString& csID) const;
+ QString defaultProfileForColorSpace(const QString &colorSpaceId) const;
-private:
/**
- * Return a colorspace that works with the parameter profile.
- * @param csID the ID of the colorspace that you want to have returned
- * @param profileName the name of the KoColorProfile to be combined with the colorspace
- * @return the wanted colorspace, or 0 when the cs and profile can not be combined.
+ * This function is called by the color space to create a color conversion
+ * between two color space. This function search in the graph of transformations
+ * the best possible path between the two color space.
*/
- const KoColorSpace * colorSpace(const KoID &csID, const QString & profileName);
+ KoColorConversionTransformation* createColorConverter(const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const;
/**
- * Return a colorspace that works with the parameter profile.
- * @param colorSpaceId the ID string of the colorspace that you want to have returned
- * @param profile the profile be combined with the colorspace
- * @return the wanted colorspace, or 0 when the cs and profile can not be combined.
+ * This function creates two transformations, one from the color space and one to the
+ * color space. The destination color space is picked from a list of color space, such
+ * as the conversion between the two color space is of the best quality.
+ *
+ * The typical use case of this function is for KoColorTransformationFactory which
+ * doesn't support all color spaces, so unsupported color space have to find an
+ * acceptable conversion in order to use that KoColorTransformationFactory.
+ *
+ * @param colorSpace the source color space
+ * @param possibilities a list of color space among which we need to find the best
+ * conversion
+ * @param fromCS the conversion from the source color space will be affected to this
+ * variable
+ * @param toCS the revert conversion to the source color space will be affected to this
+ * variable
*/
- const KoColorSpace * colorSpace(const QString &colorSpaceId, const KoColorProfile *profile);
+ void createColorConverters(const KoColorSpace* colorSpace, const QList< QPair<KoID, KoID> >& possibilities, KoColorConversionTransformation*& fromCS, KoColorConversionTransformation*& toCS) const;
- /**
- * Return a colorspace that works with the parameter profile.
- * @param profileName the name of the KoColorProfile to be combined with the colorspace
- * @return the wanted colorspace, or 0 when the cs and profile can not be combined.
- */
- const KoColorSpace * colorSpace(const QString &colorSpaceId, const QString &profileName = QString());
-public:
/**
* Return a colorspace that works with the parameter profile.
* @param colorSpaceId the ID string of the colorspace that you want to have returned
* @param profile the profile be combined with the colorspace
* @return the wanted colorspace, or 0 when the cs and profile can not be combined.
*/
const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const KoColorProfile *profile);
/**
* Return a colorspace that works with the parameter profile.
* @param profileName the name of the KoColorProfile to be combined with the colorspace
* @return the wanted colorspace, or 0 when the cs and profile can not be combined.
*/
const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName);
+ const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId);
+
/**
* Return the id of the colorspace that have the defined colorModelId with colorDepthId.
* @param colorModelId id of the color model
* @param colorDepthId id of the color depth
* @return the id of the wanted colorspace, or "" if no colorspace correspond to those ids
*/
QString colorSpaceId(const QString & colorModelId, const QString & colorDepthId) const;
/**
* It's a convenient function that behave like the above.
* Return the id of the colorspace that have the defined colorModelId with colorDepthId.
* @param colorModelId id of the color model
* @param colorDepthId id of the color depth
* @return the id of the wanted colorspace, or "" if no colorspace correspond to those ids
*/
QString colorSpaceId(const KoID& colorModelId, const KoID& colorDepthId) const;
/**
* @return a the identifiant of the color model for the given color space id.
*
* This function is a compatibility function used to get the color space from
* all kra files.
*/
KoID colorSpaceColorModelId(const QString & _colorSpaceId) const;
/**
* @return a the identifiant of the color depth for the given color space id.
*
* This function is a compatibility function used to get the color space from
* all kra files.
*/
KoID colorSpaceColorDepthId(const QString & _colorSpaceId) const;
/**
* Convenience methods to get the often used alpha colorspaces
*/
const KoColorSpace *alpha8();
const KoColorSpace *alpha16();
#include <KoConfig.h>
#ifdef HAVE_OPENEXR
const KoColorSpace *alpha16f();
#endif
const KoColorSpace *alpha32f();
/**
* Convenience method to get an RGBA 8bit colorspace. If a profile is not specified,
* an sRGB profile will be used.
* @param profileName the name of an RGB color profile
* @return the wanted colorspace, or 0 if the color space and profile can not be combined.
*/
const KoColorSpace * rgb8(const QString &profileName = QString());
/**
* Convenience method to get an RGBA 8bit colorspace with the given profile.
* @param profile an RGB profile
* @return the wanted colorspace, or 0 if the color space and profile can not be combined.
*/
const KoColorSpace * rgb8(const KoColorProfile * profile);
/**
* Convenience method to get an RGBA 16bit colorspace. If a profile is not specified,
* an sRGB profile will be used.
* @param profileName the name of an RGB color profile
* @return the wanted colorspace, or 0 if the color space and profile can not be combined.
*/
const KoColorSpace * rgb16(const QString &profileName = QString());
/**
* Convenience method to get an RGBA 16bit colorspace with the given profile.
* @param profile an RGB profile
* @return the wanted colorspace, or 0 if the color space and profile can not be combined.
*/
const KoColorSpace * rgb16(const KoColorProfile * profile);
/**
* Convenience method to get an Lab 16bit colorspace. If a profile is not specified,
* an Lab profile with a D50 whitepoint will be used.
* @param profileName the name of an Lab color profile
* @return the wanted colorspace, or 0 if the color space and profile can not be combined.
*/
const KoColorSpace * lab16(const QString &profileName = QString());
/**
* Convenience method to get an Lab 16bit colorspace with the given profile.
* @param profile an Lab profile
* @return the wanted colorspace, or 0 if the color space and profile can not be combined.
*/
const KoColorSpace * lab16(const KoColorProfile * profile);
/**
* @return the list of available color models
*/
QList<KoID> colorModelsList(ColorSpaceListVisibility option) const;
/**
* @return the list of available color models for the given colorModelId
*/
QList<KoID> colorDepthList(const KoID& colorModelId, ColorSpaceListVisibility option) const;
/**
* @return the list of available color models for the given colorModelId
*/
QList<KoID> colorDepthList(const QString & colorModelId, ColorSpaceListVisibility option) const;
- /**
- * @return the color conversion system use by the registry and the color
- * spaces to create color conversion transformation
- */
- const KoColorConversionSystem* colorConversionSystem() const;
-
/**
* @return the cache of color conversion transformation to be use by KoColorSpace
*/
KoColorConversionCache* colorConversionCache() const;
/**
* @return a permanent colorspace owned by the registry, of the same type and profile
* as the one given in argument
*/
const KoColorSpace* permanentColorspace(const KoColorSpace* _colorSpace);
/**
* This function return a list of all the keys in KoID format by using the name() method
* on the objects stored in the registry.
*/
QList<KoID> listKeys() const;
private:
friend class KisCsConversionTest;
friend class KisIteratorTest;
friend class KisPainterTest;
friend class KisCrashFilterTest;
friend class KoColorSpacesBenchmark;
friend class TestKoColorSpaceSanity;
friend class KisActionRecorderTest;
+ friend class TestColorConversionSystem;
+ friend class FriendOfColorSpaceRegistry;
+
/**
* @return a list with an instance of all color space with their default profile.
*/
QList<const KoColorSpace*> allColorSpaces(ColorSpaceListVisibility visibility, ColorSpaceListProfilesSelection pSelection);
-private:
-
/**
- * The function checks if a colorspace with a certain id and profile name can be found in the cache
- * NOTE: the function doesn't take any lock but it needs to be called inside a d->registryLock
- * locked either in read or write.
- * @param csId The colorspace id
- * @param profileName The colorspace profile name
- * @retval KoColorSpace The matching colorspace
- * @retval 0 Null pointer if not match
+ * @return the color conversion system use by the registry and the color
+ * spaces to create color conversion transformation.
+ *
+ * WARNING: conversion system is guared by the registry locks, don't
+ * use it anywhere other than unttests!
*/
- const KoColorSpace* getCachedColorSpace(const QString & csId, const QString & profileName) const;
-
- QString idsToCacheName(const QString & csId, const QString & profileName) const;
+ const KoColorConversionSystem* colorConversionSystem() const;
private:
KoColorSpaceRegistry(const KoColorSpaceRegistry&);
KoColorSpaceRegistry operator=(const KoColorSpaceRegistry&);
void init();
private:
struct Private;
Private * const d;
};
#endif // KOCOLORSPACEREGISTRY_H
diff --git a/libs/pigment/KoColorTransformationFactoryRegistry.h b/libs/pigment/KoColorTransformationFactoryRegistry.h
index e99e1818db..93d0312c81 100644
--- a/libs/pigment/KoColorTransformationFactoryRegistry.h
+++ b/libs/pigment/KoColorTransformationFactoryRegistry.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORTRANSFORMATIONFACTORYREGISTRY_H
#define KOCOLORTRANSFORMATIONFACTORYREGISTRY_H
#include <KoGenericRegistry.h>
#include "kritapigment_export.h"
class KoColorSpace;
class KoColorTransformationFactory;
/**
* This class list the available transformation. The only reason to use directly
* that class is for adding new factory use the static method
* KoColorTransformationFactoryRegistry::add.
*/
class KRITAPIGMENT_EXPORT KoColorTransformationFactoryRegistry : private KoGenericRegistry<KoColorTransformationFactory*>
{
friend class KoColorSpace;
public:
- ~KoColorTransformationFactoryRegistry();
+ ~KoColorTransformationFactoryRegistry() override;
/**
* Add a KoColorTransformationFactory to the registry.
*/
static void addColorTransformationFactory(KoColorTransformationFactory* factory);
static void removeColorTransformationFactory(KoColorTransformationFactory* factory);
private:
static KoColorTransformationFactoryRegistry* instance();
private:
KoColorTransformationFactoryRegistry();
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/pigment/KoCompositeColorTransformation.h b/libs/pigment/KoCompositeColorTransformation.h
index 02ccf0b52a..daf055c96c 100644
--- a/libs/pigment/KoCompositeColorTransformation.h
+++ b/libs/pigment/KoCompositeColorTransformation.h
@@ -1,77 +1,77 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KO_COMPOSITE_COLOR_TRANSFORMATION_H
#define __KO_COMPOSITE_COLOR_TRANSFORMATION_H
#include "KoColorTransformation.h"
#include <QScopedPointer>
/**
* A class for storing a composite color transformation. All the
* trasnformations added with appendTransform() are applied
* sequentually to the process pixels.
*
* \p mode defines how the buffers are used while processing.
*
* When using INPLACE mode all transformations but the first one do
* the conversion in place, that is in \p dst buffer. That is \p dst
* is written at least N - 1 times, where N is the number of embedded
* transformations.
*
* In BUFFERED mode all the transformations are called with distinct
* src and dst buffers, which are created in temporary memory owned by
* KoCompositeColorTransformation. Please note that this mode IS NOT
* IMPLEMENTED YET!
*/
class KRITAPIGMENT_EXPORT KoCompositeColorTransformation : public KoColorTransformation
{
public:
enum Mode {
INPLACE = 0, /// transform pixels in place (in 'dst' buffer)
BUFFERED /// transform using a temporary buffer (not implemented yet)
};
public:
explicit KoCompositeColorTransformation(Mode mode);
- ~KoCompositeColorTransformation();
+ ~KoCompositeColorTransformation() override;
- void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const;
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override;
/**
* Append a transform to a composite. If \p transform is null,
* nothing happens.
*/
void appendTransform(KoColorTransformation *transform);
/**
* Convenience method that checks if the transformations in \p
* transforms are not null and adds existent ones only. If there
* is only one non-null transform, it is returned directly to
* avoid extra virtual calls added by KoCompositeColorTransformation.
*/
static KoColorTransformation* createOptimizedCompositeTransform(const QVector<KoColorTransformation*> transforms);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KO_COMPOSITE_COLOR_TRANSFORMATION_H */
diff --git a/libs/pigment/KoCompositeOpRegistry.cpp b/libs/pigment/KoCompositeOpRegistry.cpp
index 72fcf9772c..d2ac141e2a 100644
--- a/libs/pigment/KoCompositeOpRegistry.cpp
+++ b/libs/pigment/KoCompositeOpRegistry.cpp
@@ -1,214 +1,215 @@
/*
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoCompositeOpRegistry.h"
#include <QGlobalStatic>
#include <QList>
#include <klocalizedstring.h>
#include <KoID.h>
#include "KoCompositeOp.h"
#include "KoColorSpace.h"
Q_GLOBAL_STATIC(KoCompositeOpRegistry, registry)
KoCompositeOpRegistry::KoCompositeOpRegistry()
{
m_categories
<< KoID("arithmetic", i18n("Arithmetic"))
<< KoID("dark" , i18n("Darken"))
<< KoID("light" , i18n("Lighten"))
<< KoID("negative" , i18n("Negative"))
<< KoID("mix" , i18n("Mix"))
<< KoID("misc" , i18n("Misc"))
<< KoID("hsy" , i18n("HSY"))
<< KoID("hsi" , i18n("HSI"))
<< KoID("hsl" , i18n("HSL"))
<< KoID("hsv" , i18n("HSV"));
m_map.insert(m_categories[0], KoID(COMPOSITE_ADD , i18n("Addition")));
m_map.insert(m_categories[0], KoID(COMPOSITE_SUBTRACT , i18n("Subtract")));
m_map.insert(m_categories[0], KoID(COMPOSITE_MULT , i18n("Multiply")));
m_map.insert(m_categories[0], KoID(COMPOSITE_DIVIDE , i18n("Divide")));
m_map.insert(m_categories[0], KoID(COMPOSITE_INVERSE_SUBTRACT, i18n("Inverse Subtract")));
m_map.insert(m_categories[1], KoID(COMPOSITE_BURN , i18n("Burn")));
m_map.insert(m_categories[1], KoID(COMPOSITE_LINEAR_BURN, i18n("Linear Burn")));
m_map.insert(m_categories[1], KoID(COMPOSITE_DARKEN , i18n("Darken")));
m_map.insert(m_categories[1], KoID(COMPOSITE_GAMMA_DARK , i18n("Gamma Dark")));
m_map.insert(m_categories[1], KoID(COMPOSITE_DARKER_COLOR , i18n("Darker Color")));
m_map.insert(m_categories[2], KoID(COMPOSITE_DODGE , i18n("Color Dodge")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LINEAR_DODGE, i18n("Linear Dodge")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LIGHTEN , i18n("Lighten")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LINEAR_LIGHT, i18n("Linear Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_SCREEN , i18n("Screen")));
m_map.insert(m_categories[2], KoID(COMPOSITE_PIN_LIGHT , i18n("Pin Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_VIVID_LIGHT , i18n("Vivid Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_HARD_LIGHT , i18n("Hard Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_SOFT_LIGHT_PHOTOSHOP, i18n("Soft Light (Photoshop)")));
m_map.insert(m_categories[2], KoID(COMPOSITE_SOFT_LIGHT_SVG, i18n("Soft Light (SVG)")));
m_map.insert(m_categories[2], KoID(COMPOSITE_GAMMA_LIGHT , i18n("Gamma Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LIGHTER_COLOR , i18n("Lighter Color")));
m_map.insert(m_categories[3], KoID(COMPOSITE_DIFF , i18n("Difference")));
m_map.insert(m_categories[3], KoID(COMPOSITE_EQUIVALENCE , i18n("Equivalence")));
m_map.insert(m_categories[3], KoID(COMPOSITE_ADDITIVE_SUBTRACTIVE, i18n("Additive Subtractive")));
m_map.insert(m_categories[3], KoID(COMPOSITE_EXCLUSION , i18n("Exclusion")));
m_map.insert(m_categories[3], KoID(COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent")));
m_map.insert(m_categories[4], KoID(COMPOSITE_OVER , i18n("Normal")));
m_map.insert(m_categories[4], KoID(COMPOSITE_BEHIND , i18n("Behind")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GREATER , i18n("Greater")));
m_map.insert(m_categories[4], KoID(COMPOSITE_OVERLAY , i18n("Overlay")));
m_map.insert(m_categories[4], KoID(COMPOSITE_ERASE , i18n("Erase")));
m_map.insert(m_categories[4], KoID(COMPOSITE_ALPHA_DARKEN , i18n("Alpha Darken")));
m_map.insert(m_categories[4], KoID(COMPOSITE_HARD_MIX , i18n("Hard Mix")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GRAIN_MERGE , i18n("Grain Merge")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GRAIN_EXTRACT , i18n("Grain Extract")));
m_map.insert(m_categories[4], KoID(COMPOSITE_PARALLEL , i18n("Parallel")));
m_map.insert(m_categories[4], KoID(COMPOSITE_ALLANON , i18n("Allanon")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GEOMETRIC_MEAN , i18n("Geometric Mean")));
m_map.insert(m_categories[4], KoID(COMPOSITE_DESTINATION_ATOP, i18n("Destination Atop")));
m_map.insert(m_categories[4], KoID(COMPOSITE_DESTINATION_IN , i18n("Destination In")));
+ m_map.insert(m_categories[4], KoID(COMPOSITE_HARD_OVERLAY , i18n("Hard Overlay")));
m_map.insert(m_categories[5], KoID(COMPOSITE_BUMPMAP , i18n("Bumpmap")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COMBINE_NORMAL, i18n("Combine Normal Map")));
m_map.insert(m_categories[5], KoID(COMPOSITE_DISSOLVE , i18n("Dissolve")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY_RED , i18n("Copy Red")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY_GREEN, i18n("Copy Green")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY_BLUE , i18n("Copy Blue")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY , i18n("Copy")));
m_map.insert(m_categories[5], KoID(COMPOSITE_TANGENT_NORMALMAP, i18n("Tangent Normalmap")));
m_map.insert(m_categories[6], KoID(COMPOSITE_COLOR , i18n("Color")));
m_map.insert(m_categories[6], KoID(COMPOSITE_HUE , i18n("Hue")));
m_map.insert(m_categories[6], KoID(COMPOSITE_SATURATION , i18n("Saturation")));
m_map.insert(m_categories[6], KoID(COMPOSITE_LUMINIZE , i18n("Luminosity")));
m_map.insert(m_categories[6], KoID(COMPOSITE_DEC_SATURATION, i18n("Decrease Saturation")));
m_map.insert(m_categories[6], KoID(COMPOSITE_INC_SATURATION, i18n("Increase Saturation")));
m_map.insert(m_categories[6], KoID(COMPOSITE_DEC_LUMINOSITY, i18n("Decrease Luminosity")));
m_map.insert(m_categories[6], KoID(COMPOSITE_INC_LUMINOSITY, i18n("Increase Luminosity")));
m_map.insert(m_categories[7], KoID(COMPOSITE_COLOR_HSI , i18n("Color HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_HUE_HSI , i18n("Hue HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_SATURATION_HSI , i18n("Saturation HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_INTENSITY , i18n("Intensity")));
m_map.insert(m_categories[7], KoID(COMPOSITE_DEC_SATURATION_HSI, i18n("Decrease Saturation HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_INC_SATURATION_HSI, i18n("Increase Saturation HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_DEC_INTENSITY , i18n("Decrease Intensity")));
m_map.insert(m_categories[7], KoID(COMPOSITE_INC_INTENSITY , i18n("Increase Intensity")));
m_map.insert(m_categories[8], KoID(COMPOSITE_COLOR_HSL , i18n("Color HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_HUE_HSL , i18n("Hue HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_SATURATION_HSL , i18n("Saturation HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_LIGHTNESS , i18n("Lightness")));
m_map.insert(m_categories[8], KoID(COMPOSITE_DEC_SATURATION_HSL, i18n("Decrease Saturation HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_INC_SATURATION_HSL, i18n("Increase Saturation HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_DEC_LIGHTNESS , i18n("Decrease Lightness")));
m_map.insert(m_categories[8], KoID(COMPOSITE_INC_LIGHTNESS , i18n("Increase Lightness")));
m_map.insert(m_categories[9], KoID(COMPOSITE_COLOR_HSV , i18n("Color HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_HUE_HSV , i18n("Hue HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_SATURATION_HSV , i18n("Saturation HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_VALUE , i18n("Value")));
m_map.insert(m_categories[9], KoID(COMPOSITE_DEC_SATURATION_HSV, i18n("Decrease Saturation HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_INC_SATURATION_HSV, i18n("Increase Saturation HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_DEC_VALUE , i18n("Decrease Value")));
m_map.insert(m_categories[9], KoID(COMPOSITE_INC_VALUE , i18n("Increase Value")));
}
const KoCompositeOpRegistry& KoCompositeOpRegistry::instance()
{
return *registry;
}
KoID KoCompositeOpRegistry::getDefaultCompositeOp() const
{
return KoID(COMPOSITE_OVER, i18n("Normal"));
}
KoID KoCompositeOpRegistry::getKoID(const QString& compositeOpID) const
{
KoIDMap::const_iterator itr = qFind(m_map.begin(), m_map.end(), KoID(compositeOpID));
return (itr != m_map.end()) ? *itr : KoID();
}
KoCompositeOpRegistry::KoIDMap KoCompositeOpRegistry::getCompositeOps() const
{
return m_map;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCategories() const
{
return m_categories;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCompositeOps(const KoID& category, const KoColorSpace* colorSpace) const
{
qint32 num = m_map.count(category);
KoIDMap::const_iterator beg = m_map.find(category);
KoIDMap::const_iterator end = beg + num;
KoIDList list;
list.reserve(num);
if(colorSpace) {
for(; beg!=end; ++beg){
if(colorSpace->hasCompositeOp(beg->id()))
list.push_back(*beg);
}
}
else {
for(; beg!=end; ++beg)
list.push_back(*beg);
}
return list;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCompositeOps(const KoColorSpace* colorSpace) const
{
KoIDMap::const_iterator beg = m_map.begin();
KoIDMap::const_iterator end = m_map.end();
KoIDList list;
list.reserve(m_map.size());
if(colorSpace) {
for(; beg!=end; ++beg){
if(colorSpace->hasCompositeOp(beg->id()))
list.push_back(*beg);
}
}
else {
for(; beg!=end; ++beg)
list.push_back(*beg);
}
return list;
}
bool KoCompositeOpRegistry::colorSpaceHasCompositeOp(const KoColorSpace* colorSpace, const KoID& compositeOp) const
{
return colorSpace ? colorSpace->hasCompositeOp(compositeOp.id()) : false;
}
diff --git a/libs/pigment/KoCompositeOpRegistry.h b/libs/pigment/KoCompositeOpRegistry.h
index 5461712840..ebc7151463 100644
--- a/libs/pigment/KoCompositeOpRegistry.h
+++ b/libs/pigment/KoCompositeOpRegistry.h
@@ -1,175 +1,176 @@
/*
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOPREGISTRY_H
#define KOCOMPOSITEOPREGISTRY_H
#include <QString>
#include <QList>
#include <QMultiMap>
#include <QBitArray>
#include "kritapigment_export.h"
class KoColorSpace;
#include <KoID.h>
// TODO : convert this data blob into a modern design with an enum class.
// This will reduce the need for runtime string comparisons.
const QString COMPOSITE_OVER = "normal";
const QString COMPOSITE_ERASE = "erase";
const QString COMPOSITE_IN = "in";
const QString COMPOSITE_OUT = "out";
const QString COMPOSITE_ALPHA_DARKEN = "alphadarken";
const QString COMPOSITE_DESTINATION_IN = "destination-in";
const QString COMPOSITE_DESTINATION_ATOP = "destination-atop";
const QString COMPOSITE_XOR = "xor";
const QString COMPOSITE_PLUS = "plus";
const QString COMPOSITE_MINUS = "minus";
const QString COMPOSITE_ADD = "add";
const QString COMPOSITE_SUBTRACT = "subtract";
const QString COMPOSITE_INVERSE_SUBTRACT = "inverse_subtract";
const QString COMPOSITE_DIFF = "diff";
const QString COMPOSITE_MULT = "multiply";
const QString COMPOSITE_DIVIDE = "divide";
const QString COMPOSITE_ARC_TANGENT = "arc_tangent";
const QString COMPOSITE_GEOMETRIC_MEAN = "geometric_mean";
const QString COMPOSITE_ADDITIVE_SUBTRACTIVE = "additive_subtractive";
const QString COMPOSITE_EQUIVALENCE = "equivalence";
const QString COMPOSITE_ALLANON = "allanon";
const QString COMPOSITE_PARALLEL = "parallel";
const QString COMPOSITE_GRAIN_MERGE = "grain_merge";
const QString COMPOSITE_GRAIN_EXTRACT = "grain_extract";
const QString COMPOSITE_EXCLUSION = "exclusion";
const QString COMPOSITE_HARD_MIX = "hard mix";
const QString COMPOSITE_OVERLAY = "overlay";
const QString COMPOSITE_BEHIND = "behind";
-const QString COMPOSITE_GREATER = "greater";
+const QString COMPOSITE_GREATER = "greater";
+const QString COMPOSITE_HARD_OVERLAY = "hard overlay";
const QString COMPOSITE_DARKEN = "darken";
const QString COMPOSITE_BURN = "burn";//this is also known as 'color burn'.
const QString COMPOSITE_LINEAR_BURN = "linear_burn";
const QString COMPOSITE_GAMMA_DARK = "gamma_dark";
const QString COMPOSITE_LIGHTEN = "lighten";
const QString COMPOSITE_DODGE = "dodge";
const QString COMPOSITE_LINEAR_DODGE = "linear_dodge";
const QString COMPOSITE_SCREEN = "screen";
const QString COMPOSITE_HARD_LIGHT = "hard_light";
const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP = "soft_light";
const QString COMPOSITE_SOFT_LIGHT_SVG = "soft_light_svg";
const QString COMPOSITE_GAMMA_LIGHT = "gamma_light";
const QString COMPOSITE_VIVID_LIGHT = "vivid_light";
const QString COMPOSITE_LINEAR_LIGHT = "linear light";
const QString COMPOSITE_PIN_LIGHT = "pin_light";
const QString COMPOSITE_HUE = "hue";
const QString COMPOSITE_COLOR = "color";
const QString COMPOSITE_SATURATION = "saturation";
const QString COMPOSITE_INC_SATURATION = "inc_saturation";
const QString COMPOSITE_DEC_SATURATION = "dec_saturation";
const QString COMPOSITE_LUMINIZE = "luminize";
const QString COMPOSITE_INC_LUMINOSITY = "inc_luminosity";
const QString COMPOSITE_DEC_LUMINOSITY = "dec_luminosity";
const QString COMPOSITE_HUE_HSV = "hue_hsv";
const QString COMPOSITE_COLOR_HSV = "color_hsv";
const QString COMPOSITE_SATURATION_HSV = "saturation_hsv";
const QString COMPOSITE_INC_SATURATION_HSV = "inc_saturation_hsv";
const QString COMPOSITE_DEC_SATURATION_HSV = "dec_saturation_hsv";
const QString COMPOSITE_VALUE = "value";
const QString COMPOSITE_INC_VALUE = "inc_value";
const QString COMPOSITE_DEC_VALUE = "dec_value";
const QString COMPOSITE_HUE_HSL = "hue_hsl";
const QString COMPOSITE_COLOR_HSL = "color_hsl";
const QString COMPOSITE_SATURATION_HSL = "saturation_hsl";
const QString COMPOSITE_INC_SATURATION_HSL = "inc_saturation_hsl";
const QString COMPOSITE_DEC_SATURATION_HSL = "dec_saturation_hsl";
const QString COMPOSITE_LIGHTNESS = "lightness";
const QString COMPOSITE_INC_LIGHTNESS = "inc_lightness";
const QString COMPOSITE_DEC_LIGHTNESS = "dec_lightness";
const QString COMPOSITE_HUE_HSI = "hue_hsi";
const QString COMPOSITE_COLOR_HSI = "color_hsi";
const QString COMPOSITE_SATURATION_HSI = "saturation_hsi";
const QString COMPOSITE_INC_SATURATION_HSI = "inc_saturation_hsi";
const QString COMPOSITE_DEC_SATURATION_HSI = "dec_saturation_hsi";
const QString COMPOSITE_INTENSITY = "intensity";
const QString COMPOSITE_INC_INTENSITY = "inc_intensity";
const QString COMPOSITE_DEC_INTENSITY = "dec_intensity";
const QString COMPOSITE_COPY = "copy";
const QString COMPOSITE_COPY_RED = "copy_red";
const QString COMPOSITE_COPY_GREEN = "copy_green";
const QString COMPOSITE_COPY_BLUE = "copy_blue";
const QString COMPOSITE_TANGENT_NORMALMAP = "tangent_normalmap";
const QString COMPOSITE_COLORIZE = "colorize";
const QString COMPOSITE_BUMPMAP = "bumpmap";
const QString COMPOSITE_COMBINE_NORMAL = "combine_normal";
const QString COMPOSITE_CLEAR = "clear";
const QString COMPOSITE_DISSOLVE = "dissolve";
const QString COMPOSITE_DISPLACE = "displace";
const QString COMPOSITE_NO = "nocomposition";
const QString COMPOSITE_PASS_THROUGH = "pass through"; // XXX: not implemented anywhere yet
const QString COMPOSITE_DARKER_COLOR = "darker color";
const QString COMPOSITE_LIGHTER_COLOR = "lighter color";
const QString COMPOSITE_UNDEF = "undefined";
class KRITAPIGMENT_EXPORT KoCompositeOpRegistry
{
typedef QMultiMap<KoID,KoID> KoIDMap;
typedef QList<KoID> KoIDList;
public:
KoCompositeOpRegistry();
static const KoCompositeOpRegistry& instance();
KoID getDefaultCompositeOp() const;
KoID getKoID(const QString& compositeOpID) const;
KoIDMap getCompositeOps() const;
KoIDList getCategories() const;
KoIDList getCompositeOps(const KoColorSpace* colorSpace) const;
KoIDList getCompositeOps(const KoID& category, const KoColorSpace* colorSpace=0) const;
bool colorSpaceHasCompositeOp(const KoColorSpace* colorSpace, const KoID& compositeOp) const;
template<class TKoIdIterator>
KoIDList filterCompositeOps(TKoIdIterator begin, TKoIdIterator end, const KoColorSpace* colorSpace, bool removeInvaliOps=true) const {
KoIDList list;
for(; begin!=end; ++begin){
if( colorSpaceHasCompositeOp(colorSpace, *begin) == removeInvaliOps)
list.push_back(*begin);
}
return list;
}
private:
KoIDList m_categories;
KoIDMap m_map;
};
#endif // KOCOMPOSITEOPREGISTRY_H
diff --git a/libs/pigment/KoConvolutionOpImpl.h b/libs/pigment/KoConvolutionOpImpl.h
index 7223cb5f9a..130c4ea8df 100644
--- a/libs/pigment/KoConvolutionOpImpl.h
+++ b/libs/pigment/KoConvolutionOpImpl.h
@@ -1,153 +1,153 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_CONVOLUTION_OP_IMPL_H
#define KO_CONVOLUTION_OP_IMPL_H
#include "DebugPigment.h"
#include "KoColorSpaceMaths.h"
#include "KoConvolutionOp.h"
#include "KoColorSpaceTraits.h"
template<class _CSTrait>
class KoConvolutionOpImpl : public KoConvolutionOp
{
typedef typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype compositetype;
typedef typename _CSTrait::channels_type channels_type;
public:
KoConvolutionOpImpl() { }
- virtual ~KoConvolutionOpImpl() { }
+ ~KoConvolutionOpImpl() override { }
/**
* Calculates a weighted average of the pixels, mentioned in @colors
* using weight values from @kernelValues
*
* Note:
* It behaves in a quite unclear way, when at least one pixel is
* fully transparent. There are three cases:
* Case A) None of the pixels is fully transparent.
* * Every color channel AND alpha channel of @dst stores a sum
* of the corresponding channels from @colors, divided by @factor
* and incremented by @offset
* Case B) At least one pixel of @colors is transparent and @factor
* stores a weight of the kernel (sum of it's items).
* * Every color channel of @dst stores a sum of the corresponding
* channels from non-transparent pixels, divided by a weight
* of non-transparent pixels and incremented by @offset.
* * Alpha channel of @dst stores a sum of the corresponding
* channels from non-transparent pixels, divided by a weight
* of all the pixels (equals to @factor) and incremented
* by @offset.
* Case C) At least one pixel of @colors is transparent and @factor
* is set to an arbitrary value.
* * Every color channel of @dst stores a sum of the corresponding
* channels from non-transparent pixels, divided by a "scaled
* down factor" and incremented by @offset. "Scaled
* down factor" is calculated in the following way:
*
* [weight of non-transparent pixels]
* scaledDownFactor = @factor * ----------------------------------
* [weight of all the pixels]
*
* * Alpha channel of @dst stores a sum of the corresponding
* channels from non-transparent pixels, divided by unscaled
* @factor and incremented by @offset.
*/
- virtual void convolveColors(const quint8* const* colors, const qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nPixels, const QBitArray & channelFlags) const {
+ void convolveColors(const quint8* const* colors, const qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nPixels, const QBitArray & channelFlags) const override {
// Create and initialize to 0 the array of totals
qreal totals[_CSTrait::channels_nb];
qreal totalWeight = 0;
qreal totalWeightTransparent = 0;
memset(totals, 0, sizeof(qreal) * _CSTrait::channels_nb);
for (; nPixels--; colors++, kernelValues++) {
qreal weight = *kernelValues;
const channels_type* color = _CSTrait::nativeArray(*colors);
if (weight != 0) {
if (_CSTrait::opacityU8(*colors) == 0) {
totalWeightTransparent += weight;
} else {
for (uint i = 0; i < _CSTrait::channels_nb; i++) {
totals[i] += color[i] * weight;
}
}
totalWeight += weight;
}
}
typename _CSTrait::channels_type* dstColor = _CSTrait::nativeArray(dst);
bool allChannels = channelFlags.isEmpty();
Q_ASSERT(allChannels || channelFlags.size() == (int)_CSTrait::channels_nb);
if (totalWeightTransparent == 0) {
// Case A)
for (uint i = 0; i < _CSTrait::channels_nb; i++) {
if (allChannels || channelFlags.testBit(i)) {
compositetype v = totals[i] / factor + offset;
dstColor[ i ] = CLAMP(v, KoColorSpaceMathsTraits<channels_type>::min,
KoColorSpaceMathsTraits<channels_type>::max);
}
}
} else if (totalWeightTransparent != totalWeight) {
if (totalWeight == factor) {
// Case B)
qint64 a = (totalWeight - totalWeightTransparent);
for (uint i = 0; i < _CSTrait::channels_nb; i++) {
if (allChannels || channelFlags.testBit(i)) {
if (i == (uint)_CSTrait::alpha_pos) {
compositetype v = totals[i] / totalWeight + offset;
dstColor[ i ] = CLAMP(v, KoColorSpaceMathsTraits<channels_type>::min,
KoColorSpaceMathsTraits<channels_type>::max);
} else {
compositetype v = totals[i] / a + offset;
dstColor[ i ] = CLAMP(v, KoColorSpaceMathsTraits<channels_type>::min,
KoColorSpaceMathsTraits<channels_type>::max);
}
}
}
} else {
// Case C)
qreal a = qreal(totalWeight) / (factor * (totalWeight - totalWeightTransparent)); // use qreal as it easily saturate
for (uint i = 0; i < _CSTrait::channels_nb; i++) {
if (allChannels || channelFlags.testBit(i)) {
if (i == (uint)_CSTrait::alpha_pos) {
compositetype v = totals[i] / factor + offset;
dstColor[ i ] = CLAMP(v, KoColorSpaceMathsTraits<channels_type>::min,
KoColorSpaceMathsTraits<channels_type>::max);
} else {
compositetype v = (compositetype)(totals[i] * a + offset);
dstColor[ i ] = CLAMP(v, KoColorSpaceMathsTraits<channels_type>::min,
KoColorSpaceMathsTraits<channels_type>::max);
}
}
}
}
}
}
};
#endif
diff --git a/libs/pigment/KoCopyColorConversionTransformation.h b/libs/pigment/KoCopyColorConversionTransformation.h
index d4322d148c..8693c8af59 100644
--- a/libs/pigment/KoCopyColorConversionTransformation.h
+++ b/libs/pigment/KoCopyColorConversionTransformation.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_COPY_COLOR_CONVERSION_TRANSFORMATION_H_
#define _KO_COPY_COLOR_CONVERSION_TRANSFORMATION_H_
#include "KoColorConversionTransformation.h"
#include "KoColorConversionTransformationFactory.h"
class KoCopyColorConversionTransformation : public KoColorConversionTransformation
{
public:
explicit KoCopyColorConversionTransformation(const KoColorSpace *cs);
- virtual void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const;
+ void transform(const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const override;
};
class KoCopyColorConversionTransformationFactory : public KoColorConversionTransformationFactory
{
public:
KoCopyColorConversionTransformationFactory(const QString& _colorModelId, const QString& _depthId, const QString& _profileName);
- virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
+ KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
const KoColorSpace* dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const;
- virtual bool conserveColorInformation() const;
- virtual bool conserveDynamicRange() const;
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override;
+ bool conserveColorInformation() const override;
+ bool conserveDynamicRange() const override;
};
#endif
diff --git a/libs/pigment/KoFallBackColorTransformation.h b/libs/pigment/KoFallBackColorTransformation.h
index 2569f8dbb0..1457d85bb0 100644
--- a/libs/pigment/KoFallBackColorTransformation.h
+++ b/libs/pigment/KoFallBackColorTransformation.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_FALL_BACK_COLOR_TRANSFORMATION_H_
#define _KO_FALL_BACK_COLOR_TRANSFORMATION_H_
#include "KoColorTransformation.h"
#include "kritapigment_export.h"
class KoColorSpace;
class KoColorConversionTransformation;
/**
* Use this color transformation to encapsulate another KoColorTransformation
* and perform a color conversion before and after using that KoColorTransformation.
*/
class KRITAPIGMENT_EXPORT KoFallBackColorTransformation : public KoColorTransformation
{
public:
/**
* Create a fall back color transformation using the given two color
* spaces. This constructor will initialize his own color conversion
* objects.
*
* The created object takes owner ship of the transormation and will
* take charge of deleting it.
*
* @param cs color space of the source and destination pixels
* @param fallBackCS color space use natively by the color transformation
* @param transfo the color transformation (working in the fallback color space)
*/
KoFallBackColorTransformation(const KoColorSpace* _cs, const KoColorSpace* _fallBackCS, KoColorTransformation* _transfo);
/**
* Creates a fall back color transformation using the two transformations
* given as parameters. The created object take ownership of the
* conversion and the color transformations and will be in charge of
* deleting them.
*
* @param csToFallBack transformation from the color space to the fallback
* @param fallBackToCs transformation from the fallback to the color space
* @param transfo the color transformation (working in the fallback color space)
*/
KoFallBackColorTransformation(KoColorConversionTransformation* _csToFallBack, KoColorConversionTransformation* _fallBackToCs, KoColorTransformation* _transfo);
- virtual ~KoFallBackColorTransformation();
- virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const;
- virtual QList<QString> parameters() const;
- virtual int parameterId(const QString& name) const;
- virtual void setParameter(int id, const QVariant& parameter);
+ ~KoFallBackColorTransformation() override;
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override;
+ QList<QString> parameters() const override;
+ int parameterId(const QString& name) const override;
+ void setParameter(int id, const QVariant& parameter) override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/pigment/KoHistogramProducer.h b/libs/pigment/KoHistogramProducer.h
index fc9956dcf3..946d8b43c5 100644
--- a/libs/pigment/KoHistogramProducer.h
+++ b/libs/pigment/KoHistogramProducer.h
@@ -1,143 +1,143 @@
/*
* Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KO_HISTOGRAM_PRODUCER_
#define _KO_HISTOGRAM_PRODUCER_
#include <QtGlobal>
#include "kritapigment_export.h"
#include <KoGenericRegistry.h>
#include <KoID.h>
class QString;
class KoChannelInfo;
class KoColorSpace;
/**
* This class is an interface used in the generation of a histogram. It is a container of
* data, all mathematically interesting things will calculated by an histogram.
*
* The default view will be the entire range each color can be in. And don't let the
* numberOfBins return anything else then 256 unless you have a very good reason for it.
*
* About the views: a view is a zoom combined with a start level: the entire
* range of a channel is 0.0 - 1.0: this is the position. Combined with a zoom, we can
* calculate what part of a channel will fall in a bin. This gives us an interface to
* that the views that is not dependent of the actual colorspace of the histogram.
* The 'size' value is the size, again from 0.0 to 1.0 of the displayed range.
*
* For comfort of the GUI, and because it is logical, channels are accessed in the order
* in which they are found in the channels() method. This is potentially different from
* the order in which they are internally ordered!
**/
class KRITAPIGMENT_EXPORT KoHistogramProducer
{
public:
KoHistogramProducer() : m_skipTransparent(true), m_skipUnselected(true) {}
virtual ~KoHistogramProducer() {}
// Methods to change the bins
/** Clears the data in this producer, but keeps its other settings */
virtual void clear() = 0;
/**
* Adds the values from the specified array of pixels to the bins -- does not
* reset anything.
*
* @param pixels A pointer an array of pixeldata in the given colorspace
* @param selectionMask a pointer to an array of bytes, where 0 is unselected and 1-255 is degree of selectedness. The array
* must be just as long as the array of pixels.
* @param nPixels The number of pixels
* @param colorSpace the colorspace that can decode the pixel data.
*/
virtual void addRegionToBin(const quint8 * pixels, const quint8 * selectionMask, quint32 nPixels, const KoColorSpace* colorSpace) = 0;
// Methods to set what exactly is being added to the bins
virtual void setView(qreal from, qreal width) = 0;
virtual void setSkipTransparent(bool set) {
m_skipTransparent = set;
}
virtual void setSkipUnselected(bool set) {
m_skipUnselected = set;
}
// Methods with general information about this specific producer
virtual const KoID& id() const = 0;
virtual QList<KoChannelInfo *> channels() = 0;
virtual qint32 numberOfBins() = 0;
virtual QString positionToString(qreal pos) const = 0;
virtual qreal viewFrom() const = 0;
virtual qreal viewWidth() const = 0;
virtual qreal maximalZoom() const = 0;
// Methods to get information on the data we have seen
virtual qint32 count() = 0;
virtual qint32 getBinAt(qint32 channel, qint32 position) = 0;
virtual qint32 outOfViewLeft(qint32 channel) = 0;
virtual qint32 outOfViewRight(qint32 channel) = 0;
protected:
bool m_skipTransparent;
bool m_skipUnselected;
};
class KRITAPIGMENT_EXPORT KoHistogramProducerFactory
{
public:
explicit KoHistogramProducerFactory(const KoID &id) : m_id(id) {}
virtual ~KoHistogramProducerFactory() {}
/// Factory method, generates a new KoHistogramProducer
virtual KoHistogramProducer *generate() = 0;
/// Returns if a colorspace can be used with this producer
virtual bool isCompatibleWith(const KoColorSpace* colorSpace, bool strict = false) const = 0;
/// Returns a float in the [0.0, 1.0] range, 0.0 means this is a very generic method
virtual float preferrednessLevelWith(const KoColorSpace* colorSpace) const = 0;
virtual QString id() const {
return m_id.id();
}
virtual QString name() const {
return m_id.name();
}
protected:
KoID m_id;
};
class KRITAPIGMENT_EXPORT KoHistogramProducerFactoryRegistry
: public KoGenericRegistry<KoHistogramProducerFactory*>
{
public:
KoHistogramProducerFactoryRegistry();
- virtual ~KoHistogramProducerFactoryRegistry();
+ ~KoHistogramProducerFactoryRegistry() override;
static KoHistogramProducerFactoryRegistry* instance();
/// returns a list, sorted by preferrence: higher preferance comes first
QList<QString> keysCompatibleWith(const KoColorSpace* colorSpace, bool isStrict=false) const;
private:
KoHistogramProducerFactoryRegistry(const KoHistogramProducerFactoryRegistry&);
KoHistogramProducerFactoryRegistry operator=(const KoHistogramProducerFactoryRegistry&);
};
#endif // _KO_HISTOGRAM_PRODUCER
diff --git a/libs/pigment/KoInvertColorTransformation.h b/libs/pigment/KoInvertColorTransformation.h
index a8da4d2681..dec0fa83f0 100644
--- a/libs/pigment/KoInvertColorTransformation.h
+++ b/libs/pigment/KoInvertColorTransformation.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_INVERT_COLOR_TRANSFORMATION_H
#define KO_INVERT_COLOR_TRANSFORMATION_H
#include "KoColorTransformation.h"
class KoInvertColorTransformation : public KoColorTransformation
{
public:
KoInvertColorTransformation(const KoColorSpace* cs) : m_colorSpace(cs), m_psize(cs->pixelSize()) {
}
- virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const {
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override {
quint16 m_rgba[4];
while (nPixels--) {
m_colorSpace->toRgbA16(src, reinterpret_cast<quint8 *>(m_rgba), 1);
m_rgba[0] = KoColorSpaceMathsTraits<quint16>::max - m_rgba[0];
m_rgba[1] = KoColorSpaceMathsTraits<quint16>::max - m_rgba[1];
m_rgba[2] = KoColorSpaceMathsTraits<quint16>::max - m_rgba[2];
m_colorSpace->fromRgbA16(reinterpret_cast<quint8 *>(m_rgba), dst, 1);
src += m_psize;
dst += m_psize;
}
}
private:
const KoColorSpace* m_colorSpace;
quint32 m_psize;
};
#endif
diff --git a/libs/pigment/KoLabDarkenColorTransformation.h b/libs/pigment/KoLabDarkenColorTransformation.h
index a7e4b98f69..82dbed0f3e 100644
--- a/libs/pigment/KoLabDarkenColorTransformation.h
+++ b/libs/pigment/KoLabDarkenColorTransformation.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005-2006 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2004,2006-2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_LAB_DARKEN_COLOR_TRANSFORMATION_H_
#define _KO_LAB_DARKEN_COLOR_TRANSFORMATION_H_
#if !defined _MSC_VER
#pragma GCC diagnostic ignored "-Wcast-align"
#endif
#include "KoColorTransformation.h"
template<typename _lab_channels_type_>
struct KoLabDarkenColorTransformation : public KoColorTransformation {
KoLabDarkenColorTransformation(qint32 shade, bool compensate, qreal compensation, const KoColorSpace *colorspace) : m_colorSpace(colorspace), m_shade(shade), m_compensate(compensate), m_compensation(compensation) {
}
- virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const {
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override {
*((quint32 *)dst)=*((const quint32 *)src);
QColor c;
for (unsigned int i = 0; i < nPixels*m_colorSpace->pixelSize(); i+=m_colorSpace->pixelSize()) {
if (m_compensate) {
m_colorSpace->toQColor(src+i,&c);
c.setRed((c.red()*m_shade)/(m_compensation*255));
c.setGreen((c.green()*m_shade)/(m_compensation*255));
c.setBlue((c.blue()*m_shade)/(m_compensation*255));
m_colorSpace->fromQColor(c,dst+i);
} else {
m_colorSpace->toQColor(src+i,&c);
c.setRed((c.red()*m_shade)/255);
c.setGreen((c.green()*m_shade)/255);
c.setBlue((c.blue()*m_shade)/255);
m_colorSpace->fromQColor(c,dst+i);
}
}
}
const KoColorSpace* m_colorSpace;
const KoColorConversionTransformation* m_defaultToLab;
const KoColorConversionTransformation* m_defaultFromLab;
qint32 m_shade;
bool m_compensate;
qreal m_compensation;
};
#endif
diff --git a/libs/pigment/KoMixColorsOpImpl.h b/libs/pigment/KoMixColorsOpImpl.h
index 1dddc9de33..c9c9627bd6 100644
--- a/libs/pigment/KoMixColorsOpImpl.h
+++ b/libs/pigment/KoMixColorsOpImpl.h
@@ -1,205 +1,205 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOMIXCOLORSOPIMPL_H
#define KOMIXCOLORSOPIMPL_H
#include "KoMixColorsOp.h"
template<class _CSTrait>
class KoMixColorsOpImpl : public KoMixColorsOp
{
public:
KoMixColorsOpImpl() {
}
- virtual ~KoMixColorsOpImpl() { }
- virtual void mixColors(const quint8 * const* colors, const qint16 *weights, quint32 nColors, quint8 *dst) const override {
+ ~KoMixColorsOpImpl() override { }
+ void mixColors(const quint8 * const* colors, const qint16 *weights, quint32 nColors, quint8 *dst) const override {
mixColorsImpl(ArrayOfPointers(colors), WeightsWrapper(weights), nColors, dst);
}
- virtual void mixColors(const quint8 *colors, const qint16 *weights, quint32 nColors, quint8 *dst) const override {
+ void mixColors(const quint8 *colors, const qint16 *weights, quint32 nColors, quint8 *dst) const override {
mixColorsImpl(PointerToArray(colors, _CSTrait::pixelSize), WeightsWrapper(weights), nColors, dst);
}
- virtual void mixColors(const quint8 * const* colors, quint32 nColors, quint8 *dst) const override {
+ void mixColors(const quint8 * const* colors, quint32 nColors, quint8 *dst) const override {
mixColorsImpl(ArrayOfPointers(colors), NoWeightsSurrogate(nColors), nColors, dst);
}
- virtual void mixColors(const quint8 *colors, quint32 nColors, quint8 *dst) const override {
+ void mixColors(const quint8 *colors, quint32 nColors, quint8 *dst) const override {
mixColorsImpl(PointerToArray(colors, _CSTrait::pixelSize), NoWeightsSurrogate(nColors), nColors, dst);
}
private:
struct ArrayOfPointers {
ArrayOfPointers(const quint8 * const* colors)
: m_colors(colors)
{
}
const quint8* getPixel() const {
return *m_colors;
}
void nextPixel() {
m_colors++;
}
private:
const quint8 * const * m_colors;
};
struct PointerToArray {
PointerToArray(const quint8 *colors, int pixelSize)
: m_colors(colors),
m_pixelSize(pixelSize)
{
}
const quint8* getPixel() const {
return m_colors;
}
void nextPixel() {
m_colors += m_pixelSize;
}
private:
const quint8 *m_colors;
const int m_pixelSize;
};
struct WeightsWrapper
{
typedef typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype compositetype;
WeightsWrapper(const qint16 *weights)
: m_weights(weights)
{
}
inline void nextPixel() {
m_weights++;
}
inline void premultiplyAlphaWithWeight(compositetype &alpha) const {
alpha *= *m_weights;
}
inline int normalizeFactor() const {
return 255;
}
private:
const qint16 *m_weights;
};
struct NoWeightsSurrogate
{
typedef typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype compositetype;
NoWeightsSurrogate(int numPixels)
: m_numPixles(numPixels)
{
}
inline void nextPixel() {
}
inline void premultiplyAlphaWithWeight(compositetype &) const {
}
inline int normalizeFactor() const {
return m_numPixles;
}
private:
const int m_numPixles;
};
template<class AbstractSource, class WeightsWrapper>
void mixColorsImpl(AbstractSource source, WeightsWrapper weightsWrapper, quint32 nColors, quint8 *dst) const {
// Create and initialize to 0 the array of totals
typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype totals[_CSTrait::channels_nb];
typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype totalAlpha = 0;
memset(totals, 0, sizeof(totals));
// Compute the total for each channel by summing each colors multiplied by the weightlabcache
while (nColors--) {
const typename _CSTrait::channels_type* color = _CSTrait::nativeArray(source.getPixel());
typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype alphaTimesWeight;
if (_CSTrait::alpha_pos != -1) {
alphaTimesWeight = color[_CSTrait::alpha_pos];
} else {
alphaTimesWeight = KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::unitValue;
}
weightsWrapper.premultiplyAlphaWithWeight(alphaTimesWeight);
for (int i = 0; i < (int)_CSTrait::channels_nb; i++) {
if (i != _CSTrait::alpha_pos) {
totals[i] += color[i] * alphaTimesWeight;
}
}
totalAlpha += alphaTimesWeight;
source.nextPixel();
weightsWrapper.nextPixel();
}
// set totalAlpha to the minimum between its value and the unit value of the channels
const int sumOfWeights = weightsWrapper.normalizeFactor();
if (totalAlpha > KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::unitValue * sumOfWeights) {
totalAlpha = KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::unitValue * sumOfWeights;
}
typename _CSTrait::channels_type* dstColor = _CSTrait::nativeArray(dst);
if (totalAlpha > 0) {
for (int i = 0; i < (int)_CSTrait::channels_nb; i++) {
if (i != _CSTrait::alpha_pos) {
typename KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::compositetype v = totals[i] / totalAlpha;
if (v > KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::max) {
v = KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::max;
}
if (v < KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::min) {
v = KoColorSpaceMathsTraits<typename _CSTrait::channels_type>::min;
}
dstColor[ i ] = v;
}
}
if (_CSTrait::alpha_pos != -1) {
dstColor[ _CSTrait::alpha_pos ] = totalAlpha / sumOfWeights;
}
} else {
memset(dst, 0, sizeof(typename _CSTrait::channels_type) * _CSTrait::channels_nb);
}
}
};
#endif
diff --git a/libs/pigment/KoMultipleColorConversionTransformation.h b/libs/pigment/KoMultipleColorConversionTransformation.h
index 3388a16823..faf825422c 100644
--- a/libs/pigment/KoMultipleColorConversionTransformation.h
+++ b/libs/pigment/KoMultipleColorConversionTransformation.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_MULTIPLE_COLOR_CONVERSION_TRANSFORMATION_H_
#define _KO_MULTIPLE_COLOR_CONVERSION_TRANSFORMATION_H_
#include <KoColorConversionTransformation.h>
#include "kritapigment_export.h"
/**
* This color conversion transformation allows to create a chain of color conversion between two color
* spaces.
* For instance, imagine we have three color spaces : CSA , CSB and CSC , we only know a transformation
* from CSA to CSB and from CSB to CSC , and we want to convert from CSA to CSC. Then we can create
* a KoMultipleColorConversionTransformation, and add to it with
* KoMultipleColorConversionTransformation::appendTransfo a transformation from CSA to CSB and a
* transformation from CSB to CSC.
*/
class KRITAPIGMENT_EXPORT KoMultipleColorConversionTransformation : public KoColorConversionTransformation
{
public:
/**
* Create a color transformation from srcCs to dstCs.
* @param srcCs the first color space in the chain
* @param dstCs the last color space in the chain
*/
KoMultipleColorConversionTransformation(const KoColorSpace* srcCs, const KoColorSpace* dstCs, KoColorConversionTransformation::Intent, KoColorConversionTransformation::ConversionFlags conversionFlags);
- ~KoMultipleColorConversionTransformation();
+ ~KoMultipleColorConversionTransformation() override;
/**
* Add a transformation to the chain.
* @param transfo this transformation is then deleted when the
* KoMultipleColorConversionTransformation is deleted.
*/
void appendTransfo(KoColorConversionTransformation* transfo);
- virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const;
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/pigment/colorprofiles/KoDummyColorProfile.h b/libs/pigment/colorprofiles/KoDummyColorProfile.h
index 76e44ea696..798ae3c2c3 100644
--- a/libs/pigment/colorprofiles/KoDummyColorProfile.h
+++ b/libs/pigment/colorprofiles/KoDummyColorProfile.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_DUMMY_COLOR_PROFILE_H_
#define _KO_DUMMY_COLOR_PROFILE_H_
#include "KoColorProfile.h"
class KoDummyColorProfile : public KoColorProfile
{
public:
KoDummyColorProfile();
- virtual ~KoDummyColorProfile();
- virtual KoColorProfile* clone() const;
- virtual bool valid() const;
- virtual float version() const;
- virtual bool isSuitableForOutput() const;
- virtual bool isSuitableForPrinting() const;
- virtual bool isSuitableForDisplay() const;
- virtual bool supportsPerceptual() const;
- virtual bool supportsSaturation() const;
- virtual bool supportsAbsolute() const;
- virtual bool supportsRelative() const;
- virtual bool hasColorants() const;
- virtual bool hasTRC() const;
- virtual QVector <double> getColorantsXYZ() const;
- virtual QVector <double> getColorantsxyY() const;
- virtual QVector <double> getWhitePointXYZ() const;
- virtual QVector <double> getWhitePointxyY() const;
- virtual QVector <double> getEstimatedTRC() const;
- virtual void linearizeFloatValue(QVector <double> & Value) const;
- virtual void delinearizeFloatValue(QVector <double> & Value) const;
- virtual void linearizeFloatValueFast(QVector <double> & Value) const;
- virtual void delinearizeFloatValueFast(QVector <double> & Value) const;
- virtual bool operator==(const KoColorProfile&) const;
- virtual QByteArray uniqueId() const;
+ ~KoDummyColorProfile() override;
+ KoColorProfile* clone() const override;
+ bool valid() const override;
+ float version() const override;
+ bool isSuitableForOutput() const override;
+ bool isSuitableForPrinting() const override;
+ bool isSuitableForDisplay() const override;
+ bool supportsPerceptual() const override;
+ bool supportsSaturation() const override;
+ bool supportsAbsolute() const override;
+ bool supportsRelative() const override;
+ bool hasColorants() const override;
+ bool hasTRC() const override;
+ QVector <double> getColorantsXYZ() const override;
+ QVector <double> getColorantsxyY() const override;
+ QVector <double> getWhitePointXYZ() const override;
+ QVector <double> getWhitePointxyY() const override;
+ QVector <double> getEstimatedTRC() const override;
+ void linearizeFloatValue(QVector <double> & Value) const override;
+ void delinearizeFloatValue(QVector <double> & Value) const override;
+ void linearizeFloatValueFast(QVector <double> & Value) const override;
+ void delinearizeFloatValueFast(QVector <double> & Value) const override;
+ bool operator==(const KoColorProfile&) const override;
+ QByteArray uniqueId() const override;
};
#endif
diff --git a/libs/pigment/colorspaces/KoAlphaColorSpace.h b/libs/pigment/colorspaces/KoAlphaColorSpace.h
index dda981a70b..0f62a85b47 100644
--- a/libs/pigment/colorspaces/KoAlphaColorSpace.h
+++ b/libs/pigment/colorspaces/KoAlphaColorSpace.h
@@ -1,243 +1,243 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOALPHACOLORSPACE_H
#define KOALPHACOLORSPACE_H
#include <QColor>
#include "DebugPigment.h"
#include "kritapigment_export.h"
#include "KoColorSpaceAbstract.h"
#include "KoColorSpaceTraits.h"
#include "KoColorModelStandardIds.h"
#include "KoColorModelStandardIdsUtils.h"
#include "KoSimpleColorSpaceFactory.h"
#include <KoConfig.h>
#ifdef HAVE_OPENEXR
#include <half.h>
#endif
template <typename _T, typename _Tdst>
class KoColorSpaceMaths;
typedef KoColorSpaceTrait<quint8, 1, 0> AlphaU8Traits;
typedef KoColorSpaceTrait<quint16, 1, 0> AlphaU16Traits;
typedef KoColorSpaceTrait<float, 1, 0> AlphaF32Traits;
template <typename channel_type> KoID alphaIdFromChannelType();
template <> inline KoID alphaIdFromChannelType<quint8>() { return KoID("ALPHA", i18n("Alpha (8-bit integer)")); }
template <> inline KoID alphaIdFromChannelType<quint16>() { return KoID("ALPHAU16", i18n("Alpha (16-bit integer)")); }
template <> inline KoID alphaIdFromChannelType<float>() { return KoID("ALPHAF32", i18n("Alpha (32-bit floating point)")); }
#ifdef HAVE_OPENEXR
typedef KoColorSpaceTrait<half, 1, 0> AlphaF16Traits;
template <> inline KoID alphaIdFromChannelType<half>() { return KoID("ALPHAF16", i18n("Alpha (16-bit floating point)")); }
#endif
class QBitArray;
/**
* The alpha mask is a special color strategy that treats all pixels as
* alpha value with a color common to the mask. The default color is white.
*/
template <class _CSTrait>
class KRITAPIGMENT_EXPORT KoAlphaColorSpaceImpl : public KoColorSpaceAbstract<_CSTrait>
{
typedef typename _CSTrait::channels_type channels_type;
typedef KoColorSpaceMaths<channels_type> _Maths;
typedef KoColorSpaceMaths<channels_type, quint8> _MathsToU8;
typedef KoColorSpaceMaths<quint8, channels_type> _MathsFromU8;
public:
KoAlphaColorSpaceImpl();
- virtual ~KoAlphaColorSpaceImpl();
+ ~KoAlphaColorSpaceImpl() override;
static QString colorSpaceId() {
return alphaIdFromChannelType<channels_type>().id();
}
- virtual KoID colorModelId() const {
+ KoID colorModelId() const override {
return AlphaColorModelID;
}
- virtual KoID colorDepthId() const {
+ KoID colorDepthId() const override {
return colorDepthIdForChannelType<channels_type>();
}
virtual KoColorSpace* clone() const;
- virtual bool willDegrade(ColorSpaceIndependence independence) const {
+ bool willDegrade(ColorSpaceIndependence independence) const override {
Q_UNUSED(independence);
return false;
}
- virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const {
+ bool profileIsCompatible(const KoColorProfile* /*profile*/) const override {
return false;
}
- virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const;
+ void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const override;
- virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const;
+ void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const override;
- virtual quint8 difference(const quint8 *src1, const quint8 *src2) const;
- virtual quint8 differenceA(const quint8 *src1, const quint8 *src2) const;
+ quint8 difference(const quint8 *src1, const quint8 *src2) const override;
+ quint8 differenceA(const quint8 *src1, const quint8 *src2) const override;
- virtual quint32 colorChannelCount() const {
+ quint32 colorChannelCount() const override {
return 0;
}
- virtual QString channelValueText(const quint8 *pixel, quint32 channelIndex) const;
+ QString channelValueText(const quint8 *pixel, quint32 channelIndex) const override;
- virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const;
+ QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const override;
virtual void convolveColors(quint8** colors, qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nColors, const QBitArray & channelFlags) const;
virtual quint32 colorSpaceType() const {
return 0;
}
- virtual bool hasHighDynamicRange() const {
+ bool hasHighDynamicRange() const override {
return false;
}
- virtual const KoColorProfile* profile() const {
+ const KoColorProfile* profile() const override {
return m_profile;
}
- virtual QImage convertToQImage(const quint8 *data, qint32 width, qint32 height,
+ QImage convertToQImage(const quint8 *data, qint32 width, qint32 height,
const KoColorProfile * dstProfile,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const;
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override;
- virtual void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const;
- virtual void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const;
+ void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const override;
+ void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const override;
- virtual void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const;
- virtual void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const;
+ void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const override;
+ void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const override;
- virtual KoColorTransformation* createBrightnessContrastAdjustment(const quint16* transferValues) const {
+ KoColorTransformation* createBrightnessContrastAdjustment(const quint16* transferValues) const override {
Q_UNUSED(transferValues);
warnPigment << i18n("Undefined operation in the alpha color space");
return 0;
}
- virtual KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const {
+ KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
return 0;
}
- virtual KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const {
+ KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
return 0;
}
virtual void invertColor(quint8*, qint32) const {
warnPigment << i18n("Undefined operation in the alpha color space");
}
- virtual void colorToXML(const quint8* , QDomDocument& , QDomElement&) const {
+ void colorToXML(const quint8* , QDomDocument& , QDomElement&) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
}
- virtual void colorFromXML(quint8* , const QDomElement&) const {
+ void colorFromXML(quint8* , const QDomElement&) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
}
- virtual void toHSY(const QVector<double> &, qreal *, qreal *, qreal *) const {
+ void toHSY(const QVector<double> &, qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
}
- virtual QVector <double> fromHSY(qreal *, qreal *, qreal *) const {
+ QVector <double> fromHSY(qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
QVector <double> channelValues (1);
channelValues.fill(0.0);
return channelValues;
}
- virtual void toYUV(const QVector<double> &, qreal *, qreal *, qreal *) const {
+ void toYUV(const QVector<double> &, qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
}
- virtual QVector <double> fromYUV(qreal *, qreal *, qreal *) const {
+ QVector <double> fromYUV(qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the alpha color space");
QVector <double> channelValues (1);
channelValues.fill(0.0);
return channelValues;
}
protected:
- virtual bool preferCompositionInSourceColorSpace() const;
+ bool preferCompositionInSourceColorSpace() const override;
private:
KoColorProfile* m_profile;
QList<KoCompositeOp*> m_compositeOps;
};
typedef KoAlphaColorSpaceImpl<AlphaU8Traits> KoAlphaColorSpace;
typedef KoAlphaColorSpaceImpl<AlphaU16Traits> KoAlphaU16ColorSpace;
#ifdef HAVE_OPENEXR
typedef KoAlphaColorSpaceImpl<AlphaF16Traits> KoAlphaF16ColorSpace;
#endif
typedef KoAlphaColorSpaceImpl<AlphaF32Traits> KoAlphaF32ColorSpace;
template <class _CSTrait>
class KoAlphaColorSpaceFactoryImpl : public KoSimpleColorSpaceFactory
{
typedef typename _CSTrait::channels_type channels_type;
public:
KoAlphaColorSpaceFactoryImpl()
: KoSimpleColorSpaceFactory(alphaIdFromChannelType<channels_type>().id(),
alphaIdFromChannelType<channels_type>().name(),
- true,
+ false,
AlphaColorModelID,
colorDepthIdForChannelType<channels_type>(),
qMin(16, int(sizeof(channels_type) * 8)), // DIRTY HACK ALERT: see a comment below!
100000)
{
/**
* Note about a hack with reference bit depth: right now all the color
* conversions to/from Alpha colorspace are done via LabAU16 16-bit color space,
* therefore, the conversions are lossy! Better conversions are yet to be implemented,
* but for now we just define this color space as having 16-bit reference depth
* (the problem arises with AlphaF32 only of course, which is hardly used anywhere).
*/
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *) const {
+ KoColorSpace *createColorSpace(const KoColorProfile *) const override {
return new KoAlphaColorSpaceImpl<_CSTrait>();
}
- virtual QList<KoColorConversionTransformationFactory*> colorConversionLinks() const;
+ QList<KoColorConversionTransformationFactory*> colorConversionLinks() const override;
};
typedef KoAlphaColorSpaceFactoryImpl<AlphaU8Traits> KoAlphaColorSpaceFactory;
typedef KoAlphaColorSpaceFactoryImpl<AlphaU16Traits> KoAlphaU16ColorSpaceFactory;
#ifdef HAVE_OPENEXR
typedef KoAlphaColorSpaceFactoryImpl<AlphaF16Traits> KoAlphaF16ColorSpaceFactory;
#endif
typedef KoAlphaColorSpaceFactoryImpl<AlphaF32Traits> KoAlphaF32ColorSpaceFactory;
#endif
diff --git a/libs/pigment/colorspaces/KoLabColorSpace.h b/libs/pigment/colorspaces/KoLabColorSpace.h
index 6135102992..1168204143 100644
--- a/libs/pigment/colorspaces/KoLabColorSpace.h
+++ b/libs/pigment/colorspaces/KoLabColorSpace.h
@@ -1,87 +1,87 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOLABCOLORSPACE_H
#define KOLABCOLORSPACE_H
#include <QColor>
#include "KoSimpleColorSpace.h"
#include "KoSimpleColorSpaceFactory.h"
#include "KoColorModelStandardIds.h"
struct KoLabU16Traits;
/**
* Basic and simple implementation of the LAB colorspace
*/
class KoLabColorSpace : public KoSimpleColorSpace<KoLabU16Traits>
{
public:
KoLabColorSpace();
- virtual ~KoLabColorSpace();
+ ~KoLabColorSpace() override;
static QString colorSpaceId();
virtual KoColorSpace* clone() const;
- virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const;
+ void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const override;
- virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const;
+ void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
private:
static const quint32 CHANNEL_L = 0;
static const quint32 CHANNEL_A = 1;
static const quint32 CHANNEL_B = 2;
static const quint32 CHANNEL_ALPHA = 3;
static const quint32 MAX_CHANNEL_L = 0xff00;
static const quint32 MAX_CHANNEL_AB = 0xffff;
static const quint32 CHANNEL_AB_ZERO_OFFSET = 0x8000;
};
class KoLabColorSpaceFactory : public KoSimpleColorSpaceFactory
{
public:
KoLabColorSpaceFactory()
: KoSimpleColorSpaceFactory("LABA",
i18n("L*a*b* (16-bit integer/channel, unmanaged)"),
true,
LABAColorModelID,
Integer16BitsColorDepthID) {
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *) const {
+ KoColorSpace *createColorSpace(const KoColorProfile *) const override {
return new KoLabColorSpace();
}
};
#endif
diff --git a/libs/pigment/colorspaces/KoRgbU16ColorSpace.h b/libs/pigment/colorspaces/KoRgbU16ColorSpace.h
index 4585cc04b2..0302870e8b 100644
--- a/libs/pigment/colorspaces/KoRgbU16ColorSpace.h
+++ b/libs/pigment/colorspaces/KoRgbU16ColorSpace.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KORGBU16COLORSPACE_H
#define KORGBU16COLORSPACE_H
#include <QColor>
#include "KoSimpleColorSpace.h"
#include "KoSimpleColorSpaceFactory.h"
#include "KoColorModelStandardIds.h"
struct KoBgrU16Traits;
/**
* The alpha mask is a special color strategy that treats all pixels as
* alpha value with a color common to the mask. The default color is white.
*/
class KoRgbU16ColorSpace : public KoSimpleColorSpace<KoBgrU16Traits>
{
public:
KoRgbU16ColorSpace();
- virtual ~KoRgbU16ColorSpace();
+ ~KoRgbU16ColorSpace() override;
static QString colorSpaceId();
virtual KoColorSpace* clone() const;
- virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const;
+ void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const override;
- virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const;
+ void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
};
class KoRgbU16ColorSpaceFactory : public KoSimpleColorSpaceFactory
{
public:
KoRgbU16ColorSpaceFactory()
: KoSimpleColorSpaceFactory(KoRgbU16ColorSpace::colorSpaceId(),
i18n("RGB (16-bit integer/channel, unmanaged)"),
true,
RGBAColorModelID,
Integer16BitsColorDepthID) {
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *) const {
+ KoColorSpace *createColorSpace(const KoColorProfile *) const override {
return new KoRgbU16ColorSpace();
}
};
#endif
diff --git a/libs/pigment/colorspaces/KoRgbU8ColorSpace.h b/libs/pigment/colorspaces/KoRgbU8ColorSpace.h
index e1f4abefb0..6e402c34b8 100644
--- a/libs/pigment/colorspaces/KoRgbU8ColorSpace.h
+++ b/libs/pigment/colorspaces/KoRgbU8ColorSpace.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KORGBU8COLORSPACE_H
#define KORGBU8COLORSPACE_H
#include <QColor>
#include "KoSimpleColorSpace.h"
#include "KoSimpleColorSpaceFactory.h"
#include "KoColorModelStandardIds.h"
struct KoBgrU8Traits;
/**
* The alpha mask is a special color strategy that treats all pixels as
* alpha value with a color common to the mask. The default color is white.
*/
class KoRgbU8ColorSpace : public KoSimpleColorSpace<KoBgrU8Traits>
{
public:
KoRgbU8ColorSpace();
- virtual ~KoRgbU8ColorSpace();
+ ~KoRgbU8ColorSpace() override;
static QString colorSpaceId();
virtual KoColorSpace* clone() const;
- virtual void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const;
+ void fromQColor(const QColor& color, quint8 *dst, const KoColorProfile * profile = 0) const override;
- virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const;
+ void toQColor(const quint8 *src, QColor *c, const KoColorProfile * profile = 0) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
};
class KoRgbU8ColorSpaceFactory : public KoSimpleColorSpaceFactory
{
public:
KoRgbU8ColorSpaceFactory()
: KoSimpleColorSpaceFactory("RGBA",
i18n("RGB (8-bit integer/channel, unmanaged)"),
true,
RGBAColorModelID,
Integer8BitsColorDepthID) {
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *) const {
+ KoColorSpace *createColorSpace(const KoColorProfile *) const override {
return new KoRgbU8ColorSpace();
}
};
#endif
diff --git a/libs/pigment/colorspaces/KoSimpleColorSpace.h b/libs/pigment/colorspaces/KoSimpleColorSpace.h
index 08c914df4e..abdb2d8067 100644
--- a/libs/pigment/colorspaces/KoSimpleColorSpace.h
+++ b/libs/pigment/colorspaces/KoSimpleColorSpace.h
@@ -1,229 +1,229 @@
/*
* Copyright (c) 2004-2009 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOSIMPLECOLORSPACE_H
#define KOSIMPLECOLORSPACE_H
#include <QColor>
#include "DebugPigment.h"
#include "KoColorSpaceAbstract.h"
#include "KoSimpleColorSpaceFactory.h"
#include "KoColorModelStandardIds.h"
#include "colorprofiles/KoDummyColorProfile.h"
template<class _CSTraits>
class KoSimpleColorSpace : public KoColorSpaceAbstract<_CSTraits>
{
public:
KoSimpleColorSpace(const QString& id,
const QString& name,
const KoID& colorModelId,
const KoID& colorDepthId)
: KoColorSpaceAbstract<_CSTraits>(id, name)
, m_name(name)
, m_colorModelId(colorModelId)
, m_colorDepthId(colorDepthId)
, m_profile(new KoDummyColorProfile) {
}
- virtual ~KoSimpleColorSpace() {
+ ~KoSimpleColorSpace() override {
delete m_profile;
}
- virtual KoID colorModelId() const {
+ KoID colorModelId() const override {
return m_colorModelId;
}
- virtual KoID colorDepthId() const {
+ KoID colorDepthId() const override {
return m_colorDepthId;
}
- virtual bool willDegrade(ColorSpaceIndependence independence) const {
+ bool willDegrade(ColorSpaceIndependence independence) const override {
Q_UNUSED(independence);
return false;
}
- virtual bool profileIsCompatible(const KoColorProfile* /*profile*/) const {
+ bool profileIsCompatible(const KoColorProfile* /*profile*/) const override {
return true;
}
- virtual quint8 difference(const quint8 *src1, const quint8 *src2) const {
+ quint8 difference(const quint8 *src1, const quint8 *src2) const override {
Q_UNUSED(src1);
Q_UNUSED(src2);
warnPigment << i18n("Undefined operation in the %1 space", m_name);
return 0;
}
- virtual quint8 differenceA(const quint8 *src1, const quint8 *src2) const {
+ quint8 differenceA(const quint8 *src1, const quint8 *src2) const override {
Q_UNUSED(src1);
Q_UNUSED(src2);
warnPigment << i18n("Undefined operation in the %1 space", m_name);
return 0;
}
virtual quint32 colorSpaceType() const {
return 0;
}
- virtual bool hasHighDynamicRange() const {
+ bool hasHighDynamicRange() const override {
return false;
}
- virtual const KoColorProfile* profile() const {
+ const KoColorProfile* profile() const override {
return m_profile;
}
- virtual KoColorTransformation* createBrightnessContrastAdjustment(const quint16*) const {
+ KoColorTransformation* createBrightnessContrastAdjustment(const quint16*) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
return 0;
}
virtual KoColorTransformation* createDesaturateAdjustment() const {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
return 0;
}
- virtual KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const {
+ KoColorTransformation* createPerChannelAdjustment(const quint16* const*) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
return 0;
}
- virtual KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const {
+ KoColorTransformation *createDarkenAdjustment(qint32 , bool , qreal) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
return 0;
}
virtual void invertColor(quint8*, qint32) const {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
}
- virtual void colorToXML(const quint8* , QDomDocument& , QDomElement&) const {
+ void colorToXML(const quint8* , QDomDocument& , QDomElement&) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
}
- virtual void colorFromXML(quint8* , const QDomElement&) const {
+ void colorFromXML(quint8* , const QDomElement&) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
}
- virtual void toHSY(const QVector<double> &, qreal *, qreal *, qreal *) const {
+ void toHSY(const QVector<double> &, qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
}
- virtual QVector <double> fromHSY(qreal *, qreal *, qreal *) const {
+ QVector <double> fromHSY(qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
QVector <double> channelValues (2);
channelValues.fill(0.0);
return channelValues;
}
- virtual void toYUV(const QVector<double> &, qreal *, qreal *, qreal *) const {
+ void toYUV(const QVector<double> &, qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
}
- virtual QVector <double> fromYUV(qreal *, qreal *, qreal *) const {
+ QVector <double> fromYUV(qreal *, qreal *, qreal *) const override {
warnPigment << i18n("Undefined operation in the %1 color space", m_name);
QVector <double> channelValues (2);
channelValues.fill(0.0);
return channelValues;
}
- virtual void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const {
+ void toLabA16(const quint8* src, quint8* dst, quint32 nPixels) const override {
if (colorDepthId() == Integer16BitsColorDepthID && colorModelId() == LABAColorModelID) {
memcpy(dst, src, nPixels * 2);
} else {
const KoColorSpace* dstCs = KoColorSpaceRegistry::instance()->lab16();
convertPixelsTo(src, dst, dstCs, nPixels,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
}
}
- virtual void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const {
+ void fromLabA16(const quint8* src, quint8* dst, quint32 nPixels) const override {
if (colorDepthId() == Integer16BitsColorDepthID && colorModelId() == LABAColorModelID) {
memcpy(dst, src, nPixels * 2);
} else {
const KoColorSpace* srcCs = KoColorSpaceRegistry::instance()->lab16();
srcCs->convertPixelsTo(src, dst, this, nPixels,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
}
}
- virtual void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const {
+ void toRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const override {
if (colorDepthId() == Integer16BitsColorDepthID && colorModelId() == RGBAColorModelID) {
memcpy(dst, src, nPixels * 2);
} else {
const KoColorSpace* dstCs = KoColorSpaceRegistry::instance()->rgb16();
convertPixelsTo(src, dst, dstCs, nPixels,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
}
}
- virtual void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const {
+ void fromRgbA16(const quint8* src, quint8* dst, quint32 nPixels) const override {
if (colorDepthId() == Integer16BitsColorDepthID && colorModelId() == RGBAColorModelID) {
memcpy(dst, src, nPixels * 2);
} else {
const KoColorSpace* srcCs = KoColorSpaceRegistry::instance()->rgb16();
srcCs->convertPixelsTo(src, dst, this, nPixels,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
}
}
- virtual bool convertPixelsTo(const quint8 *src,
+ bool convertPixelsTo(const quint8 *src,
quint8 *dst, const KoColorSpace * dstColorSpace,
quint32 numPixels,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override
{
Q_UNUSED(renderingIntent);
Q_UNUSED(conversionFlags);
QColor c;
quint32 srcPixelsize = this->pixelSize();
quint32 dstPixelsize = dstColorSpace->pixelSize();
while (numPixels > 0) {
this->toQColor(src, &c);
dstColorSpace->fromQColor(c, dst);
src += srcPixelsize;
dst += dstPixelsize;
--numPixels;
}
return true;
}
virtual QString colorSpaceEngine() const {
return "simple";
}
private:
QString m_name;
KoID m_colorModelId;
KoID m_colorDepthId;
KoColorProfile* m_profile;
};
#endif // KOSIMPLECOLORSPACE_H
diff --git a/libs/pigment/colorspaces/KoSimpleColorSpaceEngine.h b/libs/pigment/colorspaces/KoSimpleColorSpaceEngine.h
index 08bf8e7f1a..d4d098679f 100644
--- a/libs/pigment/colorspaces/KoSimpleColorSpaceEngine.h
+++ b/libs/pigment/colorspaces/KoSimpleColorSpaceEngine.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_SIMPLE_COLOR_SPACE_ENGINE_H_
#define _KO_SIMPLE_COLOR_SPACE_ENGINE_H_
#include <KoColorSpaceEngine.h>
class KoSimpleColorSpaceEngine : public KoColorSpaceEngine
{
public:
KoSimpleColorSpaceEngine();
- virtual ~KoSimpleColorSpaceEngine();
- virtual KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
+ ~KoSimpleColorSpaceEngine() override;
+ KoColorConversionTransformation* createColorTransformation(const KoColorSpace* srcColorSpace,
const KoColorSpace* dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const;
- virtual const KoColorProfile* addProfile(const QString &profile ) { Q_UNUSED(profile); return 0; }
- virtual const KoColorProfile* addProfile(const QByteArray &data) { Q_UNUSED(data); return 0; }
- virtual void removeProfile(const QString &profile ) { Q_UNUSED(profile); }
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override;
+ const KoColorProfile* addProfile(const QString &profile ) override { Q_UNUSED(profile); return 0; }
+ const KoColorProfile* addProfile(const QByteArray &data) override { Q_UNUSED(data); return 0; }
+ void removeProfile(const QString &profile ) override { Q_UNUSED(profile); }
};
#endif
diff --git a/libs/pigment/colorspaces/KoSimpleColorSpaceFactory.h b/libs/pigment/colorspaces/KoSimpleColorSpaceFactory.h
index 988434afc1..2737cd62bf 100644
--- a/libs/pigment/colorspaces/KoSimpleColorSpaceFactory.h
+++ b/libs/pigment/colorspaces/KoSimpleColorSpaceFactory.h
@@ -1,129 +1,129 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005-2006 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2004,2006-2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSIMPLECOLORSPACEFACTORY_H_
#define KOSIMPLECOLORSPACEFACTORY_H_
#include "KoColorConversionTransformationFactory.h"
#include <colorprofiles/KoDummyColorProfile.h>
#include <KoColorModelStandardIds.h>
class KoSimpleColorSpaceFactory : public KoColorSpaceFactory
{
public:
KoSimpleColorSpaceFactory(const QString& id,
const QString& name,
bool userVisible,
const KoID& colorModelId,
const KoID& colorDepthId,
int referenceDepth = -1,
int crossingCost = 1)
: m_id(id)
, m_name(name)
, m_userVisible(userVisible)
, m_colorModelId(colorModelId)
, m_colorDepthId(colorDepthId)
, m_referenceDepth(referenceDepth)
, m_crossingCost(crossingCost)
{
if (m_referenceDepth >= 0) {
// noop, already initialized!
} else if (colorDepthId == Integer8BitsColorDepthID) {
m_referenceDepth = 1 * 8;
} else if (colorDepthId == Integer16BitsColorDepthID) {
m_referenceDepth = 2 * 8;
} else if (colorDepthId == Float16BitsColorDepthID) {
m_referenceDepth = 2 * 8;
} else if (colorDepthId == Float32BitsColorDepthID) {
m_referenceDepth = 4 * 8;
} else if (colorDepthId == Float64BitsColorDepthID) {
m_referenceDepth = 8 * 8;
}
}
- virtual QString id() const {
+ QString id() const override {
return m_id;
}
- virtual QString name() const {
+ QString name() const override {
return m_name;
}
- virtual bool userVisible() const {
+ bool userVisible() const override {
return m_userVisible;
}
- virtual KoID colorModelId() const {
+ KoID colorModelId() const override {
return m_colorModelId;
}
- virtual KoID colorDepthId() const {
+ KoID colorDepthId() const override {
return m_colorDepthId;
}
- virtual bool profileIsCompatible(const KoColorProfile* profile) const {
+ bool profileIsCompatible(const KoColorProfile* profile) const override {
return dynamic_cast<const KoDummyColorProfile*>(profile);
}
- virtual QString colorSpaceEngine() const {
+ QString colorSpaceEngine() const override {
return "simple";
}
- virtual bool isHdr() const {
+ bool isHdr() const override {
return false;
}
- virtual int referenceDepth() const {
+ int referenceDepth() const override {
return m_referenceDepth;
}
- virtual int crossingCost() const override {
+ int crossingCost() const override {
return m_crossingCost;
}
- virtual QList<KoColorConversionTransformationFactory*> colorConversionLinks() const {
+ QList<KoColorConversionTransformationFactory*> colorConversionLinks() const override {
return QList<KoColorConversionTransformationFactory*>();
}
- virtual QString defaultProfile() const {
+ QString defaultProfile() const override {
return QString("default");
}
protected:
- virtual KoColorProfile* createColorProfile(const QByteArray& /*rawData*/) const {
+ KoColorProfile* createColorProfile(const QByteArray& /*rawData*/) const override {
return 0;
}
private:
QString m_id;
QString m_name;
bool m_userVisible;
KoID m_colorModelId;
KoID m_colorDepthId;
int m_referenceDepth;
int m_crossingCost;
};
#endif
diff --git a/libs/pigment/compositeops/KoCompositeOpAlphaBase.h b/libs/pigment/compositeops/KoCompositeOpAlphaBase.h
index f7e664b056..f3c43a4eee 100644
--- a/libs/pigment/compositeops/KoCompositeOpAlphaBase.h
+++ b/libs/pigment/compositeops/KoCompositeOpAlphaBase.h
@@ -1,185 +1,185 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOCOMPOSITEOPALPHABASE_H_
#define _KOCOMPOSITEOPALPHABASE_H_
#include <QBitArray>
#include <KoColorSpaceMaths.h>
#include <KoCompositeOp.h>
#include <KoColorSpaceConstants.h>
#define NATIVE_MIN_VALUE KoColorSpaceMathsTraits<channels_type>::min
#define NATIVE_MAX_VALUE KoColorSpaceMathsTraits<channels_type>::max
#define NATIVE_OPACITY_OPAQUE KoColorSpaceMathsTraits<channels_type>::unitValue
#define NATIVE_OPACITY_TRANSPARENT KoColorSpaceMathsTraits<channels_type>::zeroValue
#define NATIVE_ZERO_VALUE KoColorSpaceMathsTraits<channels_type>::zeroValue
/**
* A template base class for all composite op that compose color
* channels values for colorspaces that have an alpha channel.
*
* @param _compositeOp this class should define a function with the
* following signature: inline static void composeColorChannels
*/
template<class _CSTraits, class _compositeOp, bool _alphaLocked>
class KoCompositeOpAlphaBase : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
public:
KoCompositeOpAlphaBase(const KoColorSpace * cs, const QString& id, const QString& description, const QString& category)
: KoCompositeOp(cs, id, description, category) {
}
public:
using KoCompositeOp::composite;
template<bool alphaLocked, bool allChannelFlags>
void composite(quint8 *dstRowStart,
qint32 dststride,
const quint8 *srcRowStart,
qint32 srcstride,
const quint8 *maskRowStart,
qint32 maskstride,
qint32 rows,
qint32 cols,
quint8 U8_opacity,
const QBitArray & channelFlags) const {
qint32 srcInc = (srcstride == 0) ? 0 : _CSTraits::channels_nb;
channels_type opacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(U8_opacity);
while (rows > 0) {
const channels_type *srcN = reinterpret_cast<const channels_type *>(srcRowStart);
channels_type *dstN = reinterpret_cast<channels_type *>(dstRowStart);
const quint8 *mask = maskRowStart;
qint32 columns = cols;
while (columns > 0) {
channels_type srcAlpha = _CSTraits::alpha_pos == -1 ? NATIVE_OPACITY_OPAQUE : _compositeOp::selectAlpha(srcN[_CSTraits::alpha_pos], dstN[_CSTraits::alpha_pos]);
// apply the alphamask
if (mask != 0) {
srcAlpha = KoColorSpaceMaths<quint8, channels_type>::multiply(*mask, srcAlpha, opacity);
mask++;
} else if (opacity != NATIVE_OPACITY_OPAQUE) {
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, opacity);
}
if (srcAlpha != NATIVE_OPACITY_TRANSPARENT) {
channels_type dstAlpha = _CSTraits::alpha_pos == -1 ? NATIVE_OPACITY_OPAQUE : dstN[_CSTraits::alpha_pos];
channels_type srcBlend;
if (dstAlpha == NATIVE_OPACITY_OPAQUE) {
srcBlend = srcAlpha;
} else if (dstAlpha == NATIVE_OPACITY_TRANSPARENT) {
if (!allChannelFlags) {
for (int i = 0; i < (int)_CSTraits::channels_nb; i++) {
if (i != _CSTraits::alpha_pos) {
dstN[i] = NATIVE_ZERO_VALUE;
}
}
}
if (!alphaLocked && !_alphaLocked) {
dstN[_CSTraits::alpha_pos] = srcAlpha;
}
srcBlend = NATIVE_OPACITY_OPAQUE;
} else {
channels_type newAlpha = dstAlpha + KoColorSpaceMaths<channels_type>::multiply(NATIVE_OPACITY_OPAQUE - dstAlpha, srcAlpha);
if (!alphaLocked && !_alphaLocked) { // No need to check for _CSTraits::alpha_pos == -1 since it is contained in alphaLocked
dstN[_CSTraits::alpha_pos] = newAlpha;
}
// newAlpha cannot be zero, because srcAlpha!=zero and dstAlpha!=unit here
srcBlend = KoColorSpaceMaths<channels_type>::divide(srcAlpha, newAlpha);
}
_compositeOp::composeColorChannels(srcBlend, srcN, dstN, allChannelFlags, channelFlags);
}
columns--;
srcN += srcInc;
dstN += _CSTraits::channels_nb;
}
rows--;
srcRowStart += srcstride;
dstRowStart += dststride;
if (maskRowStart) {
maskRowStart += maskstride;
}
}
}
template<bool alphaLocked>
void composite(quint8 *dstRowStart,
qint32 dststride,
const quint8 *srcRowStart,
qint32 srcstride,
const quint8 *maskRowStart,
qint32 maskstride,
qint32 rows,
qint32 cols,
quint8 U8_opacity,
const QBitArray & channelFlags) const
{
bool allChannelFlags = channelFlags.isEmpty();
if(allChannelFlags)
{
composite<alphaLocked, true>(dstRowStart, dststride, srcRowStart, srcstride, maskRowStart, maskstride, rows, cols, U8_opacity, channelFlags);
} else {
composite<alphaLocked, false>(dstRowStart, dststride, srcRowStart, srcstride, maskRowStart, maskstride, rows, cols, U8_opacity, channelFlags);
}
}
- virtual void composite(quint8 *dstRowStart,
+ void composite(quint8 *dstRowStart,
qint32 dststride,
const quint8 *srcRowStart,
qint32 srcstride,
const quint8 *maskRowStart,
qint32 maskstride,
qint32 rows,
qint32 cols,
quint8 U8_opacity,
- const QBitArray& channelFlags = QBitArray()) const
+ const QBitArray& channelFlags = QBitArray()) const override
{
bool alphaLocked = false;
if (!channelFlags.isEmpty()) {
if (_CSTraits::alpha_pos == -1 || !channelFlags.testBit(_CSTraits::alpha_pos)) {
alphaLocked = true;
}
}
if(alphaLocked)
{
composite<true>(dstRowStart, dststride, srcRowStart, srcstride, maskRowStart, maskstride, rows, cols, U8_opacity, channelFlags);
} else {
composite<false>(dstRowStart, dststride, srcRowStart, srcstride, maskRowStart, maskstride, rows, cols, U8_opacity, channelFlags);
}
}
};
#endif
diff --git a/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h b/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
index ce7279206f..894781692b 100644
--- a/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
+++ b/libs/pigment/compositeops/KoCompositeOpAlphaDarken.h
@@ -1,125 +1,125 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOPALPHADARKEN_H_
#define KOCOMPOSITEOPALPHADARKEN_H_
#include "KoCompositeOpFunctions.h"
#include "KoCompositeOpBase.h"
#include <KoCompositeOpRegistry.h>
/**
* A template version of the alphadarken composite operation to use in colorspaces
*/
template<class Traits>
class KoCompositeOpAlphaDarken: public KoCompositeOp
{
typedef typename Traits::channels_type channels_type;
static const qint32 channels_nb = Traits::channels_nb;
static const qint32 alpha_pos = Traits::alpha_pos;
public:
KoCompositeOpAlphaDarken(const KoColorSpace* cs):
KoCompositeOp(cs, COMPOSITE_ALPHA_DARKEN, i18n("Alpha darken"), KoCompositeOp::categoryMix()) { }
using KoCompositeOp::composite;
- virtual void composite(const KoCompositeOp::ParameterInfo& params) const
+ void composite(const KoCompositeOp::ParameterInfo& params) const override
{
if(params.maskRowStart != 0)
genericComposite<true>(params);
else
genericComposite<false>(params);
}
template<bool useMask>
void genericComposite(const KoCompositeOp::ParameterInfo& params) const
{
using namespace Arithmetic;
qint32 srcInc = (params.srcRowStride == 0) ? 0 : channels_nb;
channels_type flow = scale<channels_type>(params.flow);
channels_type opacity = mul(flow, scale<channels_type>(params.opacity));
quint8* dstRowStart = params.dstRowStart;
const quint8* srcRowStart = params.srcRowStart;
const quint8* maskRowStart = params.maskRowStart;
for(quint32 r=params.rows; r>0; --r) {
const channels_type* src = reinterpret_cast<const channels_type*>(srcRowStart);
channels_type* dst = reinterpret_cast<channels_type*>(dstRowStart);
const quint8* mask = maskRowStart;
for(qint32 c=params.cols; c>0; --c) {
channels_type srcAlpha = (alpha_pos == -1) ? unitValue<channels_type>() : src[alpha_pos];
channels_type dstAlpha = (alpha_pos == -1) ? unitValue<channels_type>() : dst[alpha_pos];
channels_type mskAlpha = useMask ? mul(scale<channels_type>(*mask), srcAlpha) : srcAlpha;
srcAlpha = mul(mskAlpha, opacity);
if(dstAlpha != zeroValue<channels_type>()) {
for(qint32 i=0; i <channels_nb; i++) {
if(i != alpha_pos)
dst[i] = lerp(dst[i], src[i], srcAlpha);
}
}
else {
for(qint32 i=0; i <channels_nb; i++) {
if(i != alpha_pos)
dst[i] = src[i];
}
}
if(alpha_pos != -1) {
channels_type fullFlowAlpha;
channels_type averageOpacity = mul(flow, scale<channels_type>(*params.lastOpacity));
if (averageOpacity > opacity) {
channels_type reverseBlend = KoColorSpaceMaths<channels_type>::divide(dstAlpha, averageOpacity);
fullFlowAlpha = averageOpacity > dstAlpha ? lerp(srcAlpha, averageOpacity, reverseBlend) : dstAlpha;
} else {
fullFlowAlpha = opacity > dstAlpha ? lerp(dstAlpha, opacity, mskAlpha) : dstAlpha;
}
if (params.flow == 1.0) {
dstAlpha = fullFlowAlpha;
} else {
channels_type zeroFlowAlpha = unionShapeOpacity(srcAlpha, dstAlpha);
dstAlpha = lerp(zeroFlowAlpha, fullFlowAlpha, flow);
}
dst[alpha_pos] = dstAlpha;
}
src += srcInc;
dst += channels_nb;
if(useMask)
++mask;
}
srcRowStart += params.srcRowStride;
dstRowStart += params.dstRowStride;
maskRowStart += params.maskRowStride;
}
}
};
#endif // KOCOMPOSITEOPALPHADARKEN_H_
diff --git a/libs/pigment/compositeops/KoCompositeOpBase.h b/libs/pigment/compositeops/KoCompositeOpBase.h
index fece216532..a6378483a7 100644
--- a/libs/pigment/compositeops/KoCompositeOpBase.h
+++ b/libs/pigment/compositeops/KoCompositeOpBase.h
@@ -1,134 +1,134 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOP_BASE_H_
#define KOCOMPOSITEOP_BASE_H_
#include <KoCompositeOp.h>
#include "KoCompositeOpFunctions.h"
/**
* A template base class that can be used for most composite modes/ops
*
* @param _compositeOp this template parameter is a class that must be
* derived fom KoCompositeOpBase and must define the static member function
* template<bool alphaLocked, bool allChannelFlags>
* inline static channels_type composeColorChannels(
* const channels_type* src,
* channels_type srcAlpha,
* channels_type* dst,
* channels_type dstAlpha,
* channels_type maskAlpha,
* channels_type opacity,
* const QBitArray& channelFlags
* )
*
* where channels_type is _CSTraits::channels_type
*/
template<class _CSTraits, class _compositeOp>
class KoCompositeOpBase : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
static const qint32 channels_nb = _CSTraits::channels_nb;
static const qint32 alpha_pos = _CSTraits::alpha_pos;
static const qint32 pixel_size = _CSTraits::pixelSize;
public:
KoCompositeOpBase(const KoColorSpace* cs, const QString& id, const QString& description, const QString& category)
: KoCompositeOp(cs, id, description, category) { }
using KoCompositeOp::composite;
- virtual void composite(const KoCompositeOp::ParameterInfo& params) const {
+ void composite(const KoCompositeOp::ParameterInfo& params) const override {
const QBitArray& flags = params.channelFlags.isEmpty() ? QBitArray(channels_nb,true) : params.channelFlags;
bool allChannelFlags = params.channelFlags.isEmpty() || params.channelFlags == QBitArray(channels_nb,true);
bool alphaLocked = (alpha_pos != -1) && !flags.testBit(alpha_pos);
bool useMask = params.maskRowStart != 0;
if(useMask) {
if(alphaLocked) {
if(allChannelFlags) { genericComposite<true,true,true> (params, flags); }
else { genericComposite<true,true,false>(params, flags); }
}
else {
if(allChannelFlags) { genericComposite<true,false,true> (params, flags); }
else { genericComposite<true,false,false>(params, flags); }
}
}
else {
if(alphaLocked) {
if(allChannelFlags) { genericComposite<false,true,true> (params, flags); }
else { genericComposite<false,true,false>(params, flags); }
}
else {
if(allChannelFlags) { genericComposite<false,false,true> (params, flags); }
else { genericComposite<false,false,false>(params, flags); }
}
}
}
private:
template<bool useMask, bool alphaLocked, bool allChannelFlags>
void genericComposite(const KoCompositeOp::ParameterInfo& params, const QBitArray& channelFlags) const {
using namespace Arithmetic;
qint32 srcInc = (params.srcRowStride == 0) ? 0 : channels_nb;
channels_type opacity = scale<channels_type>(params.opacity);
quint8* dstRowStart = params.dstRowStart;
const quint8* srcRowStart = params.srcRowStart;
const quint8* maskRowStart = params.maskRowStart;
for(qint32 r=0; r<params.rows; ++r) {
const channels_type* src = reinterpret_cast<const channels_type*>(srcRowStart);
channels_type* dst = reinterpret_cast<channels_type*>(dstRowStart);
const quint8* mask = maskRowStart;
for(qint32 c=0; c<params.cols; ++c) {
channels_type srcAlpha = (alpha_pos == -1) ? unitValue<channels_type>() : src[alpha_pos];
channels_type dstAlpha = (alpha_pos == -1) ? unitValue<channels_type>() : dst[alpha_pos];
channels_type mskAlpha = useMask ? scale<channels_type>(*mask) : unitValue<channels_type>();
if (!allChannelFlags && dstAlpha == zeroValue<channels_type>()) {
memset(dst, 0, pixel_size);
}
channels_type newDstAlpha = _compositeOp::template composeColorChannels<alphaLocked,allChannelFlags>(
src, srcAlpha, dst, dstAlpha, mskAlpha, opacity, channelFlags
);
if(alpha_pos != -1)
dst[alpha_pos] = alphaLocked ? dstAlpha : newDstAlpha;
src += srcInc;
dst += channels_nb;
if(useMask)
++mask;
}
srcRowStart += params.srcRowStride;
dstRowStart += params.dstRowStride;
maskRowStart += params.maskRowStride;
}
}
};
#endif // KOCOMPOSITEOP_BASE_H_
diff --git a/libs/pigment/compositeops/KoCompositeOpDissolve.h b/libs/pigment/compositeops/KoCompositeOpDissolve.h
index d7a8f76778..550276b221 100644
--- a/libs/pigment/compositeops/KoCompositeOpDissolve.h
+++ b/libs/pigment/compositeops/KoCompositeOpDissolve.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOCOMPOSITEOP_DISSOLVE_H_
#define _KOCOMPOSITEOP_DISSOLVE_H_
#include <KoCompositeOp.h>
#include <KoColorSpaceMaths.h>
template<class Traits>
class KoCompositeOpDissolve: public KoCompositeOp
{
typedef typename Traits::channels_type channels_type;
static const qint32 channels_nb = Traits::channels_nb;
static const qint32 alpha_pos = Traits::alpha_pos;
inline static quint8 getRandomValue(quint32 i)
{
static const quint8 randomValues[256] =
{
0x50, 0xAD, 0x7D, 0xA9, 0x10, 0x75, 0xCA, 0x57, 0xE2, 0x06, 0x77, 0x39, 0xD9, 0xFA, 0x5C, 0x24,
0xEB, 0x1A, 0x6F, 0x15, 0xE7, 0x8B, 0x11, 0x71, 0xF0, 0xB9, 0x44, 0x8A, 0x27, 0x5E, 0xA1, 0x6A,
0x47, 0x94, 0x03, 0xD5, 0xB7, 0x56, 0xEF, 0x45, 0xED, 0xBE, 0xE8, 0xB2, 0x4C, 0x0D, 0x65, 0x9E,
0x55, 0xD7, 0x30, 0x0F, 0x52, 0xA6, 0x4D, 0x86, 0xAF, 0x66, 0x33, 0x6B, 0x3E, 0x89, 0xBD, 0xFB,
0x00, 0xC4, 0x36, 0xFC, 0x8D, 0x4E, 0x19, 0x3F, 0x91, 0xC1, 0x40, 0x14, 0x67, 0x80, 0x17, 0x3A,
0xF2, 0xB4, 0xD1, 0xFF, 0x35, 0xA7, 0xF7, 0x1C, 0x84, 0x2A, 0xBF, 0x46, 0xC6, 0x2B, 0x98, 0x41,
0xF4, 0xB8, 0xA0, 0x78, 0x5A, 0xBC, 0x3B, 0x62, 0xB6, 0x7A, 0x2E, 0x07, 0x8F, 0x4A, 0xAB, 0x2F,
0x79, 0x54, 0x81, 0x69, 0x18, 0x4F, 0xA5, 0x21, 0xD3, 0x26, 0x7C, 0x9F, 0xCF, 0xB0, 0x34, 0xCC,
0x8C, 0xAA, 0xDB, 0x32, 0xE5, 0x1F, 0x7B, 0x37, 0x64, 0x0A, 0xF9, 0x63, 0xF5, 0x38, 0x13, 0xA2,
0x12, 0xF6, 0xC9, 0x5D, 0xDF, 0xC7, 0x97, 0xC0, 0x51, 0xE1, 0x9A, 0x58, 0x76, 0xC3, 0x83, 0xC2,
0x04, 0x22, 0x60, 0x9D, 0xF1, 0x5F, 0xEC, 0x6D, 0x4B, 0xE0, 0x6C, 0xD8, 0xAC, 0x25, 0xA8, 0x1E,
0x96, 0x7E, 0x49, 0x61, 0xCD, 0x0E, 0xE3, 0xC5, 0x7F, 0x5B, 0x05, 0x6E, 0xBA, 0x0C, 0x8E, 0xF8,
0x82, 0xDA, 0x72, 0x01, 0x23, 0x9B, 0xD2, 0x99, 0xE9, 0xC8, 0xB1, 0x28, 0xD4, 0xAE, 0x48, 0xFD,
0x95, 0x2C, 0xE4, 0x93, 0x09, 0x3D, 0x70, 0x85, 0x43, 0x20, 0xBB, 0xDE, 0x90, 0xB3, 0x3C, 0xDD,
0xA3, 0x73, 0x9C, 0x16, 0xDC, 0x42, 0xEA, 0x74, 0x92, 0xE6, 0xCB, 0x53, 0x08, 0xEE, 0x59, 0x02,
0xF3, 0x29, 0xFE, 0xA4, 0x1B, 0xD6, 0x87, 0xB5, 0xCE, 0x1D, 0x68, 0x88, 0x31, 0x0B, 0x2D, 0xD0
};
return randomValues[i];
}
public:
KoCompositeOpDissolve(const KoColorSpace* cs, const QString& category)
: KoCompositeOp(cs, COMPOSITE_DISSOLVE, i18n("Dissolve"), category) { }
using KoCompositeOp::composite;
- virtual void composite(quint8* dstRowStart , qint32 dstRowStride ,
+ void composite(quint8* dstRowStart , qint32 dstRowStride ,
const quint8* srcRowStart , qint32 srcRowStride ,
const quint8* maskRowStart, qint32 maskRowStride,
- qint32 rows, qint32 cols, quint8 U8_opacity, const QBitArray& channelFlags) const {
+ qint32 rows, qint32 cols, quint8 U8_opacity, const QBitArray& channelFlags) const override {
const QBitArray& flags = channelFlags.isEmpty() ? QBitArray(channels_nb,true) : channelFlags;
bool alphaLocked = (alpha_pos != -1) && !flags.testBit(alpha_pos);
using namespace Arithmetic;
// quint32 ctr = quint32(reinterpret_cast<quint64>(dstRowStart) % 256);
qint32 srcInc = (srcRowStride == 0) ? 0 : channels_nb;
bool useMask = maskRowStart != 0;
channels_type unitValue = KoColorSpaceMathsTraits<channels_type>::unitValue;
channels_type opacity = KoColorSpaceMaths<quint8,channels_type>::scaleToA(U8_opacity);
for(; rows>0; --rows) {
const channels_type* src = reinterpret_cast<const channels_type*>(srcRowStart);
channels_type* dst = reinterpret_cast<channels_type*>(dstRowStart);
const quint8* mask = maskRowStart;
for(qint32 c=cols; c>0; --c) {
channels_type srcAlpha = (alpha_pos == -1) ? unitValue : src[alpha_pos];
channels_type dstAlpha = (alpha_pos == -1) ? unitValue : dst[alpha_pos];
channels_type blend = useMask ? mul(opacity, scale<channels_type>(*mask), srcAlpha) : mul(opacity, srcAlpha);
// if(getRandomValue(ctr) <= scale<quint8>(blend) && blend != KoColorSpaceMathsTraits<channels_type>::zeroValue) {
if((qrand() % 256) <= scale<quint8>(blend) && blend != KoColorSpaceMathsTraits<channels_type>::zeroValue) {
for(qint32 i=0; i <channels_nb; i++) {
if(i != alpha_pos && flags.testBit(i))
dst[i] = src[i];
}
if(alpha_pos != -1)
dst[alpha_pos] = alphaLocked ? dstAlpha : unitValue;
}
src += srcInc;
dst += channels_nb;
// ctr = (ctr + 1) % 256;
++mask;
}
srcRowStart += srcRowStride;
dstRowStart += dstRowStride;
maskRowStart += maskRowStride;
}
}
};
#endif // _KOCOMPOSITEOP_DISSOLVE_H_
diff --git a/libs/pigment/compositeops/KoCompositeOpErase.h b/libs/pigment/compositeops/KoCompositeOpErase.h
index d6968c6a76..6b499d9b71 100644
--- a/libs/pigment/compositeops/KoCompositeOpErase.h
+++ b/libs/pigment/compositeops/KoCompositeOpErase.h
@@ -1,95 +1,95 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOPERASE_H_
#define KOCOMPOSITEOPERASE_H_
#include "KoColorSpaceMaths.h"
#include "KoCompositeOp.h"
#define NATIVE_OPACITY_OPAQUE KoColorSpaceMathsTraits<channels_type>::unitValue
#define NATIVE_OPACITY_TRANSPARENT KoColorSpaceMathsTraits<channels_type>::zeroValue
/**
* A template version of the erase composite operation to use in colorspaces<
*/
template<class _CSTraits>
class KoCompositeOpErase : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
public:
KoCompositeOpErase(const KoColorSpace * cs)
: KoCompositeOp(cs, COMPOSITE_ERASE, i18n("Erase"), KoCompositeOp::categoryMix()) {
}
public:
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart,
qint32 dststride,
const quint8 *srcRowStart,
qint32 srcstride,
const quint8 *maskRowStart,
qint32 maskstride,
qint32 rows,
qint32 cols,
quint8 U8_opacity,
- const QBitArray & channelFlags) const {
+ const QBitArray & channelFlags) const override {
// XXX: How to use channelflags here? It would be cool to
// erase all green from an image, for example.
qint32 srcInc = (srcstride == 0) ? 0 : _CSTraits::channels_nb;
channels_type opacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(U8_opacity);
Q_UNUSED(channelFlags);
while (rows-- > 0) {
const channels_type *s = reinterpret_cast<const channels_type *>(srcRowStart);
channels_type *d = reinterpret_cast<channels_type *>(dstRowStart);
const quint8 *mask = maskRowStart;
for (qint32 i = cols; i > 0; i--, s += srcInc, d += _CSTraits::channels_nb) {
channels_type srcAlpha = s[_CSTraits::alpha_pos];
// apply the alphamask
if (mask != 0) {
quint8 U8_mask = *mask;
if (U8_mask != OPACITY_TRANSPARENT_U8) {
srcAlpha = KoColorSpaceMaths<channels_type>::
multiply(srcAlpha, KoColorSpaceMaths<quint8, channels_type>::scaleToA(U8_mask));
} else {
srcAlpha = 0;
}
++mask;
}
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, opacity);
srcAlpha = NATIVE_OPACITY_OPAQUE - srcAlpha;
d[_CSTraits::alpha_pos] = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, d[_CSTraits::alpha_pos]);
}
dstRowStart += dststride;
srcRowStart += srcstride;
if (maskRowStart) {
maskRowStart += maskstride;
}
}
}
};
#endif
diff --git a/libs/pigment/compositeops/KoCompositeOpFunctions.h b/libs/pigment/compositeops/KoCompositeOpFunctions.h
index 437c204329..502c63b788 100644
--- a/libs/pigment/compositeops/KoCompositeOpFunctions.h
+++ b/libs/pigment/compositeops/KoCompositeOpFunctions.h
@@ -1,431 +1,444 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOP_FUNCTIONS_H_
#define KOCOMPOSITEOP_FUNCTIONS_H_
#include <KoColorSpaceMaths.h>
template<class HSXType, class TReal>
inline void cfReorientedNormalMapCombine(TReal srcR, TReal srcG, TReal srcB, TReal& dstR, TReal& dstG, TReal& dstB)
{
// see http://blog.selfshadow.com/publications/blending-in-detail/ by Barre-Brisebois and Hill
TReal tx = 2*srcR-1;
TReal ty = 2*srcG-1;
TReal tz = 2*srcB;
TReal ux = -2*dstR+1;
TReal uy = -2*dstG+1;
TReal uz = 2*dstB-1;
TReal k = (tx*ux+ty*uy+tz*uz)/tz; // dot(t,u)/t.z
TReal rx = tx*k-ux;
TReal ry = ty*k-uy;
TReal rz = tz*k-uz;
k = 1/sqrt(rx*rx+ry*ry+rz*rz); // normalize result
rx *= k;
ry *= k;
rz *= k;
dstR = rx*0.5+0.5;
dstG = ry*0.5+0.5;
dstB = rz*0.5+0.5;
}
template<class HSXType, class TReal>
inline void cfColor(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal lum = getLightness<HSXType>(dr, dg, db);
dr = sr;
dg = sg;
db = sb;
setLightness<HSXType>(dr, dg, db, lum);
}
template<class HSXType, class TReal>
inline void cfLightness(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
setLightness<HSXType>(dr, dg, db, getLightness<HSXType>(sr, sg, sb));
}
template<class HSXType, class TReal>
inline void cfIncreaseLightness(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
addLightness<HSXType>(dr, dg, db, getLightness<HSXType>(sr, sg, sb));
}
template<class HSXType, class TReal>
inline void cfDecreaseLightness(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
addLightness<HSXType>(dr, dg, db, getLightness<HSXType>(sr, sg, sb) - TReal(1.0));
}
template<class HSXType, class TReal>
inline void cfSaturation(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal sat = getSaturation<HSXType>(sr, sg, sb);
TReal light = getLightness<HSXType>(dr, dg, db);
setSaturation<HSXType>(dr, dg, db, sat);
setLightness<HSXType>(dr, dg, db, light);
}
template<class HSXType, class TReal>
inline void cfIncreaseSaturation(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
using namespace Arithmetic;
TReal sat = lerp(getSaturation<HSXType>(dr,dg,db), unitValue<TReal>(), getSaturation<HSXType>(sr,sg,sb));
TReal light = getLightness<HSXType>(dr, dg, db);
setSaturation<HSXType>(dr, dg, db, sat);
setLightness<HSXType>(dr, dg, db, light);
}
template<class HSXType, class TReal>
inline void cfDecreaseSaturation(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
using namespace Arithmetic;
TReal sat = lerp(zeroValue<TReal>(), getSaturation<HSXType>(dr,dg,db), getSaturation<HSXType>(sr,sg,sb));
TReal light = getLightness<HSXType>(dr, dg, db);
setSaturation<HSXType>(dr, dg, db, sat);
setLightness<HSXType>(dr, dg, db, light);
}
template<class HSXType, class TReal>
inline void cfHue(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal sat = getSaturation<HSXType>(dr, dg, db);
TReal lum = getLightness<HSXType>(dr, dg, db);
dr = sr;
dg = sg;
db = sb;
setSaturation<HSXType>(dr, dg, db, sat);
setLightness<HSXType>(dr, dg, db, lum);
}
template<class HSXType, class TReal>
inline void cfTangentNormalmap(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
using namespace Arithmetic;
TReal half=halfValue<TReal>();
dr = sr+(dr-half);
dg = sg+(dg-half);
db = sb+(db-unitValue<TReal>());
}
template<class HSXType, class TReal>
inline void cfDarkerColor(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal lum = getLightness<HSXType>(dr, dg, db);
TReal lum2 = getLightness<HSXType>(sr, sg, sb);
if (lum<lum2) {
sr = dr;
sg = dg;
sb = db;
}
else {
dr = sr;
dg = sg;
db = sb;
}
}
template<class HSXType, class TReal>
inline void cfLighterColor(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal lum = getLightness<HSXType>(dr, dg, db);
TReal lum2 = getLightness<HSXType>(sr, sg, sb);
if (lum>lum2) {
sr = dr;
sg = dg;
sb = db;
}
else {
dr = sr;
dg = sg;
db = sb;
}
}
template<class T>
inline T cfColorBurn(T src, T dst) {
using namespace Arithmetic;
if(dst == unitValue<T>())
return unitValue<T>();
T invDst = inv(dst);
if(src < invDst)
return zeroValue<T>();
return inv(clamp<T>(div(invDst, src)));
}
template<class T>
inline T cfLinearBurn(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
return clamp<T>(composite_type(src) + dst - unitValue<T>());
}
template<class T>
inline T cfColorDodge(T src, T dst) {
using namespace Arithmetic;
if(dst == zeroValue<T>())
return zeroValue<T>();
T invSrc = inv(src);
if(invSrc < dst)
return unitValue<T>();
return Arithmetic::clamp<T>(div(dst, invSrc));
}
template<class T>
inline T cfAddition(T src, T dst) {
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
return Arithmetic::clamp<T>(composite_type(src) + dst);
}
template<class T>
inline T cfSubtract(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
return clamp<T>(composite_type(dst) - src);
}
template<class T>
inline T cfInverseSubtract(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
return clamp<T>(composite_type(dst) - inv(src));
}
template<class T>
inline T cfExclusion(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
composite_type x = mul(src, dst);
return clamp<T>(composite_type(dst) + src - (x + x));
}
template<class T>
inline T cfDivide(T src, T dst) {
using namespace Arithmetic;
//typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
if(src == zeroValue<T>())
return (dst == zeroValue<T>()) ? zeroValue<T>() : unitValue<T>();
return clamp<T>(div(dst, src));
}
template<class T>
inline T cfHardLight(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
composite_type src2 = composite_type(src) + src;
if(src > halfValue<T>()) {
// screen(src*2.0 - 1.0, dst)
src2 -= unitValue<T>();
return T((src2+dst) - (src2*dst / unitValue<T>()));
}
// multiply(src*2.0, dst)
return clamp<T>(src2*dst / unitValue<T>());
}
template<class T>
inline T cfSoftLightSvg(T src, T dst) {
using namespace Arithmetic;
qreal fsrc = scale<qreal>(src);
qreal fdst = scale<qreal>(dst);
if(fsrc > 0.5f) {
qreal D = (fdst > 0.25f) ? sqrt(fdst) : ((16.0f*fdst - 12.0)*fdst + 4.0f)*fdst;
return scale<T>(fdst + (2.0f*fsrc - 1.0f) * (D - fdst));
}
return scale<T>(fdst - (1.0f - 2.0f * fsrc) * fdst * (1.0f - fdst));
}
template<class T>
inline T cfSoftLight(T src, T dst) {
using namespace Arithmetic;
qreal fsrc = scale<qreal>(src);
qreal fdst = scale<qreal>(dst);
if(fsrc > 0.5f) {
return scale<T>(fdst + (2.0f * fsrc - 1.0f) * (sqrt(fdst) - fdst));
}
return scale<T>(fdst - (1.0f - 2.0f*fsrc) * fdst * (1.0f - fdst));
}
template<class T>
inline T cfVividLight(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
if(src < halfValue<T>()) {
if(src == zeroValue<T>())
return (dst == unitValue<T>()) ? unitValue<T>() : zeroValue<T>();
// min(1,max(0,1-(1-dst) / (2*src)))
composite_type src2 = composite_type(src) + src;
composite_type dsti = inv(dst);
return clamp<T>(unitValue<T>() - (dsti * unitValue<T>() / src2));
}
if(src == unitValue<T>())
return (dst == zeroValue<T>()) ? zeroValue<T>() : unitValue<T>();
// min(1,max(0, dst / (2*(1-src)))
composite_type srci2 = inv(src);
srci2 += srci2;
return clamp<T>(composite_type(dst) * unitValue<T>() / srci2);
}
template<class T>
inline T cfPinLight(T src, T dst) {
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
// TODO: verify that the formula is correct (the first max would be useless here)
// max(0, max(2*src-1, min(dst, 2*src)))
composite_type src2 = composite_type(src) + src;
composite_type a = qMin<composite_type>(dst, src2);
composite_type b = qMax<composite_type>(src2-Arithmetic::unitValue<T>(), a);
return T(b);
}
template<class T>
inline T cfArcTangent(T src, T dst) {
using namespace Arithmetic;
if(dst == zeroValue<T>())
return (src == zeroValue<T>()) ? zeroValue<T>() : unitValue<T>();
return scale<T>(2.0 * atan(scale<qreal>(src) / scale<qreal>(dst)) / Arithmetic::pi);
}
template<class T>
inline T cfAllanon(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
// (dst + src) / 2 [or (dst + src) * 0.5]
return T((composite_type(src) + dst) * halfValue<T>() / unitValue<T>());
}
template<class T>
inline T cfLinearLight(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
// min(1,max(0,(dst + 2*src)-1))
return clamp<T>((composite_type(src) + src + dst) - unitValue<T>());
}
template<class T>
inline T cfParallel(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
// min(max(2 / (1/dst + 1/src), 0), 1)
composite_type unit = unitValue<T>();
composite_type s = (src != zeroValue<T>()) ? div<T>(unit, src) : unit;
composite_type d = (dst != zeroValue<T>()) ? div<T>(unit, dst) : unit;
return clamp<T>((unit+unit) * unit / (d+s));
}
template<class T>
inline T cfEquivalence(T src, T dst) {
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
// 1 - abs(dst - src)
composite_type x = composite_type(dst) - src;
return (x < Arithmetic::zeroValue<T>()) ? T(-x) : T(x);
}
template<class T>
inline T cfGrainMerge(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
return clamp<T>(composite_type(dst) + src - halfValue<T>());
}
template<class T>
inline T cfGrainExtract(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
return clamp<T>(composite_type(dst) - src + halfValue<T>());
}
template<class T>
inline T cfHardMix(T src, T dst) {
return (dst > Arithmetic::halfValue<T>()) ? cfColorDodge(src,dst) : cfColorBurn(src,dst);
}
template<class T>
inline T cfAdditiveSubtractive(T src, T dst) {
using namespace Arithmetic;
// min(1,max(0,abs(sqr(CB)-sqr(CT))))
qreal x = sqrt(scale<qreal>(dst)) - sqrt(scale<qreal>(src));
return scale<T>((x < 0.0) ? -x : x);
}
template<class T>
inline T cfGammaDark(T src, T dst) {
using namespace Arithmetic;
if(src == zeroValue<T>())
return zeroValue<T>();
// power(dst, 1/src)
return scale<T>(pow(scale<qreal>(dst), 1.0/scale<qreal>(src)));
}
template<class T>
inline T cfGammaLight(T src, T dst) {
using namespace Arithmetic;
return scale<T>(pow(scale<qreal>(dst), scale<qreal>(src)));
}
template<class T>
inline T cfGeometricMean(T src, T dst) {
using namespace Arithmetic;
return scale<T>(sqrt(scale<qreal>(dst) * scale<qreal>(src)));
}
template<class T>
inline T cfOver(T src, T dst) { Q_UNUSED(dst); return src; }
template<class T>
inline T cfOverlay(T src, T dst) { return cfHardLight(dst, src); }
template<class T>
inline T cfMultiply(T src, T dst) { return Arithmetic::mul(src, dst); }
+template<class T>
+inline T cfHardOverlay(T src, T dst) {
+ using namespace Arithmetic;
+
+ qreal fsrc = scale<qreal>(src);
+ qreal fdst = scale<qreal>(dst);
+
+ if(fsrc > 0.5f) {
+ return scale<T>(cfDivide(inv(2.0 * fsrc - 1.0f), fdst));
+ }
+ return scale<T>(mul(2.0 * fsrc, fdst));
+}
+
template<class T>
inline T cfDifference(T src, T dst) { return qMax(src,dst) - qMin(src,dst); }
template<class T>
inline T cfScreen(T src, T dst) { return Arithmetic::unionShapeOpacity(src, dst); }
template<class T>
inline T cfDarkenOnly(T src, T dst) { return qMin(src, dst); }
template<class T>
inline T cfLightenOnly(T src, T dst) { return qMax(src, dst); }
#endif // KOCOMPOSITEOP_FUNCTIONS_H_
diff --git a/libs/pigment/compositeops/KoCompositeOps.h b/libs/pigment/compositeops/KoCompositeOps.h
index fb0f4ea771..fa4df10705 100644
--- a/libs/pigment/compositeops/KoCompositeOps.h
+++ b/libs/pigment/compositeops/KoCompositeOps.h
@@ -1,247 +1,248 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOCOMPOSITEOPS_H_
#define _KOCOMPOSITEOPS_H_
#include <boost/type_traits.hpp>
#include <KoColorSpace.h>
#include <KoColorSpaceTraits.h>
#include <KoColorSpaceMaths.h>
#include "compositeops/KoCompositeOpGeneric.h"
#include "compositeops/KoCompositeOpOver.h"
#include "compositeops/KoCompositeOpCopyChannel.h"
#include "compositeops/KoCompositeOpAlphaDarken.h"
#include "compositeops/KoCompositeOpErase.h"
#include "compositeops/KoCompositeOpCopy2.h"
#include "compositeops/KoCompositeOpDissolve.h"
#include "compositeops/KoCompositeOpBehind.h"
#include "compositeops/KoCompositeOpDestinationIn.h"
#include "compositeops/KoCompositeOpDestinationAtop.h"
#include "compositeops/KoCompositeOpGreater.h"
#include "KoOptimizedCompositeOpFactory.h"
namespace _Private {
template<class Traits, bool flag>
struct AddGeneralOps
{
static void add(KoColorSpace* cs) { Q_UNUSED(cs); }
};
template<class Traits>
struct OptimizedOpsSelector
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return new KoCompositeOpAlphaDarken<Traits>(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return new KoCompositeOpOver<Traits>(cs);
}
};
template<>
struct OptimizedOpsSelector<KoBgrU8Traits>
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createAlphaDarkenOp32(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createOverOp32(cs);
}
};
template<>
struct OptimizedOpsSelector<KoLabU8Traits>
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createAlphaDarkenOp32(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createOverOp32(cs);
}
};
template<>
struct OptimizedOpsSelector<KoRgbF32Traits>
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return new KoCompositeOpAlphaDarken<KoRgbF32Traits>(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createOverOp128(cs);
}
};
template<class Traits>
struct AddGeneralOps<Traits, true>
{
typedef typename Traits::channels_type Arg;
typedef Arg (*CompositeFunc)(Arg, Arg);
static const qint32 alpha_pos = Traits::alpha_pos;
template<CompositeFunc func>
static void add(KoColorSpace* cs, const QString& id, const QString& description, const QString& category) {
cs->addCompositeOp(new KoCompositeOpGenericSC<Traits, func>(cs, id, description, category));
}
static void add(KoColorSpace* cs) {
cs->addCompositeOp(OptimizedOpsSelector<Traits>::createOverOp(cs));
cs->addCompositeOp(OptimizedOpsSelector<Traits>::createAlphaDarkenOp(cs));
cs->addCompositeOp(new KoCompositeOpCopy2<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpErase<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpBehind<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpDestinationIn<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpDestinationAtop<Traits>(cs));
cs->addCompositeOp(new KoCompositeOpGreater<Traits>(cs));
add<&cfOverlay<Arg> >(cs, COMPOSITE_OVERLAY , i18n("Overlay") , KoCompositeOp::categoryMix());
add<&cfGrainMerge<Arg> >(cs, COMPOSITE_GRAIN_MERGE , i18n("Grain Merge") , KoCompositeOp::categoryMix());
add<&cfGrainExtract<Arg> >(cs, COMPOSITE_GRAIN_EXTRACT , i18n("Grain Extract") , KoCompositeOp::categoryMix());
add<&cfHardMix<Arg> >(cs, COMPOSITE_HARD_MIX , i18n("Hard Mix") , KoCompositeOp::categoryMix());
add<&cfGeometricMean<Arg> >(cs, COMPOSITE_GEOMETRIC_MEAN, i18n("Geometric Mean"), KoCompositeOp::categoryMix());
add<&cfParallel<Arg> >(cs, COMPOSITE_PARALLEL , i18n("Parallel") , KoCompositeOp::categoryMix());
add<&cfAllanon<Arg> >(cs, COMPOSITE_ALLANON , i18n("Allanon") , KoCompositeOp::categoryMix());
+ add<&cfHardOverlay<Arg> >(cs, COMPOSITE_HARD_OVERLAY , i18n("Hard Overlay") , KoCompositeOp::categoryMix());
add<&cfScreen<Arg> >(cs, COMPOSITE_SCREEN , i18n("Screen") , KoCompositeOp::categoryLight());
add<&cfColorDodge<Arg> >(cs, COMPOSITE_DODGE , i18n("Color Dodge") , KoCompositeOp::categoryLight());
add<&cfAddition<Arg> >(cs, COMPOSITE_LINEAR_DODGE, i18n("Linear Dodge"), KoCompositeOp::categoryLight());
add<&cfLightenOnly<Arg> >(cs, COMPOSITE_LIGHTEN , i18n("Lighten") , KoCompositeOp::categoryLight());
add<&cfHardLight<Arg> >(cs, COMPOSITE_HARD_LIGHT , i18n("Hard Light") , KoCompositeOp::categoryLight());
add<&cfSoftLightSvg<Arg> >(cs, COMPOSITE_SOFT_LIGHT_SVG, i18n("Soft Light (SVG)") , KoCompositeOp::categoryLight());
add<&cfSoftLight<Arg> >(cs, COMPOSITE_SOFT_LIGHT_PHOTOSHOP, i18n("Soft Light (Photoshop)") , KoCompositeOp::categoryLight());
add<&cfGammaLight<Arg> >(cs, COMPOSITE_GAMMA_LIGHT , i18n("Gamma Light") , KoCompositeOp::categoryLight());
add<&cfVividLight<Arg> >(cs, COMPOSITE_VIVID_LIGHT , i18n("Vivid Light") , KoCompositeOp::categoryLight());
add<&cfPinLight<Arg> >(cs, COMPOSITE_PIN_LIGHT , i18n("Pin Light") , KoCompositeOp::categoryLight());
add<&cfLinearLight<Arg> >(cs, COMPOSITE_LINEAR_LIGHT, i18n("Linear Light"), KoCompositeOp::categoryLight());
add<&cfColorBurn<Arg> >(cs, COMPOSITE_BURN , i18n("Color Burn") , KoCompositeOp::categoryDark());
add<&cfLinearBurn<Arg> >(cs, COMPOSITE_LINEAR_BURN , i18n("Linear Burn"), KoCompositeOp::categoryDark());
add<&cfDarkenOnly<Arg> >(cs, COMPOSITE_DARKEN , i18n("Darken") , KoCompositeOp::categoryDark());
add<&cfGammaDark<Arg> >(cs, COMPOSITE_GAMMA_DARK , i18n("Gamma Dark") , KoCompositeOp::categoryDark());
add<&cfAddition<Arg> >(cs, COMPOSITE_ADD , i18n("Addition") , KoCompositeOp::categoryArithmetic());
add<&cfSubtract<Arg> >(cs, COMPOSITE_SUBTRACT , i18n("Subtract") , KoCompositeOp::categoryArithmetic());
add<&cfInverseSubtract<Arg> >(cs, COMPOSITE_INVERSE_SUBTRACT, i18n("Inversed-Subtract"), KoCompositeOp::categoryArithmetic());
add<&cfMultiply<Arg> >(cs, COMPOSITE_MULT , i18n("Multiply") , KoCompositeOp::categoryArithmetic());
add<&cfDivide<Arg> >(cs, COMPOSITE_DIVIDE , i18n("Divide") , KoCompositeOp::categoryArithmetic());
add<&cfArcTangent<Arg> >(cs, COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent") , KoCompositeOp::categoryNegative());
add<&cfDifference<Arg> >(cs, COMPOSITE_DIFF , i18n("Difference") , KoCompositeOp::categoryNegative());
add<&cfExclusion<Arg> >(cs, COMPOSITE_EXCLUSION , i18n("Exclusion") , KoCompositeOp::categoryNegative());
add<&cfEquivalence<Arg> >(cs, COMPOSITE_EQUIVALENCE , i18n("Equivalence") , KoCompositeOp::categoryNegative());
add<&cfAdditiveSubtractive<Arg> >(cs, COMPOSITE_ADDITIVE_SUBTRACTIVE , i18n("Additive-Subtractive") , KoCompositeOp::categoryNegative());
cs->addCompositeOp(new KoCompositeOpDissolve<Traits>(cs, KoCompositeOp::categoryMisc()));
}
};
template<class Traits, bool flag>
struct AddRGBOps
{
static void add(KoColorSpace* cs) { Q_UNUSED(cs); }
};
template<class Traits>
struct AddRGBOps<Traits, true>
{
typedef float Arg;
static const qint32 red_pos = Traits::red_pos;
static const qint32 green_pos = Traits::green_pos;
static const qint32 blue_pos = Traits::blue_pos;
template<void compositeFunc(Arg, Arg, Arg, Arg&, Arg&, Arg&)>
static void add(KoColorSpace* cs, const QString& id, const QString& description, const QString& category) {
cs->addCompositeOp(new KoCompositeOpGenericHSL<Traits, compositeFunc>(cs, id, description, category));
}
static void add(KoColorSpace* cs) {
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,red_pos >(cs, COMPOSITE_COPY_RED , i18n("Copy Red") , KoCompositeOp::categoryMisc()));
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,green_pos>(cs, COMPOSITE_COPY_GREEN, i18n("Copy Green"), KoCompositeOp::categoryMisc()));
cs->addCompositeOp(new KoCompositeOpCopyChannel<Traits,blue_pos >(cs, COMPOSITE_COPY_BLUE , i18n("Copy Blue") , KoCompositeOp::categoryMisc()));
add<&cfTangentNormalmap <HSYType,Arg> >(cs, COMPOSITE_TANGENT_NORMALMAP , i18n("Tangent Normalmap") , KoCompositeOp::categoryMisc());
add<&cfReorientedNormalMapCombine <HSYType, Arg> >(cs, COMPOSITE_COMBINE_NORMAL, i18n("Combine Normal Maps"), KoCompositeOp::categoryMisc());
add<&cfColor <HSYType,Arg> >(cs, COMPOSITE_COLOR , i18n("Color") , KoCompositeOp::categoryHSY());
add<&cfHue <HSYType,Arg> >(cs, COMPOSITE_HUE , i18n("Hue") , KoCompositeOp::categoryHSY());
add<&cfSaturation <HSYType,Arg> >(cs, COMPOSITE_SATURATION , i18n("Saturation") , KoCompositeOp::categoryHSY());
add<&cfIncreaseSaturation<HSYType,Arg> >(cs, COMPOSITE_INC_SATURATION, i18n("Increase Saturation"), KoCompositeOp::categoryHSY());
add<&cfDecreaseSaturation<HSYType,Arg> >(cs, COMPOSITE_DEC_SATURATION, i18n("Decrease Saturation"), KoCompositeOp::categoryHSY());
add<&cfLightness <HSYType,Arg> >(cs, COMPOSITE_LUMINIZE , i18n("Luminosity") , KoCompositeOp::categoryHSY());
add<&cfIncreaseLightness <HSYType,Arg> >(cs, COMPOSITE_INC_LUMINOSITY, i18n("Increase Luminosity"), KoCompositeOp::categoryHSY());
add<&cfDecreaseLightness <HSYType,Arg> >(cs, COMPOSITE_DEC_LUMINOSITY, i18n("Decrease Luminosity"), KoCompositeOp::categoryHSY());
add<&cfDarkerColor <HSYType,Arg> >(cs, COMPOSITE_DARKER_COLOR, i18n("Darker Color"), KoCompositeOp::categoryDark());//darker color as PSD does it//
add<&cfLighterColor <HSYType,Arg> >(cs, COMPOSITE_LIGHTER_COLOR, i18n("Lighter Color"), KoCompositeOp::categoryLight());//lighter color as PSD does it//
add<&cfColor <HSIType,Arg> >(cs, COMPOSITE_COLOR_HSI , i18n("Color HSI") , KoCompositeOp::categoryHSI());
add<&cfHue <HSIType,Arg> >(cs, COMPOSITE_HUE_HSI , i18n("Hue HSI") , KoCompositeOp::categoryHSI());
add<&cfSaturation <HSIType,Arg> >(cs, COMPOSITE_SATURATION_HSI , i18n("Saturation HSI") , KoCompositeOp::categoryHSI());
add<&cfIncreaseSaturation<HSIType,Arg> >(cs, COMPOSITE_INC_SATURATION_HSI, i18n("Increase Saturation HSI"), KoCompositeOp::categoryHSI());
add<&cfDecreaseSaturation<HSIType,Arg> >(cs, COMPOSITE_DEC_SATURATION_HSI, i18n("Decrease Saturation HSI"), KoCompositeOp::categoryHSI());
add<&cfLightness <HSIType,Arg> >(cs, COMPOSITE_INTENSITY , i18n("Intensity") , KoCompositeOp::categoryHSI());
add<&cfIncreaseLightness <HSIType,Arg> >(cs, COMPOSITE_INC_INTENSITY , i18n("Increase Intensity") , KoCompositeOp::categoryHSI());
add<&cfDecreaseLightness <HSIType,Arg> >(cs, COMPOSITE_DEC_INTENSITY , i18n("Decrease Intensity") , KoCompositeOp::categoryHSI());
add<&cfColor <HSLType,Arg> >(cs, COMPOSITE_COLOR_HSL , i18n("Color HSL") , KoCompositeOp::categoryHSL());
add<&cfHue <HSLType,Arg> >(cs, COMPOSITE_HUE_HSL , i18n("Hue HSL") , KoCompositeOp::categoryHSL());
add<&cfSaturation <HSLType,Arg> >(cs, COMPOSITE_SATURATION_HSL , i18n("Saturation HSL") , KoCompositeOp::categoryHSL());
add<&cfIncreaseSaturation<HSLType,Arg> >(cs, COMPOSITE_INC_SATURATION_HSL, i18n("Increase Saturation HSL"), KoCompositeOp::categoryHSL());
add<&cfDecreaseSaturation<HSLType,Arg> >(cs, COMPOSITE_DEC_SATURATION_HSL, i18n("Decrease Saturation HSL"), KoCompositeOp::categoryHSL());
add<&cfLightness <HSLType,Arg> >(cs, COMPOSITE_LIGHTNESS , i18n("Lightness") , KoCompositeOp::categoryHSL());
add<&cfIncreaseLightness <HSLType,Arg> >(cs, COMPOSITE_INC_LIGHTNESS , i18n("Increase Lightness") , KoCompositeOp::categoryHSL());
add<&cfDecreaseLightness <HSLType,Arg> >(cs, COMPOSITE_DEC_LIGHTNESS , i18n("Decrease Lightness") , KoCompositeOp::categoryHSL());
add<&cfColor <HSVType,Arg> >(cs, COMPOSITE_COLOR_HSV , i18n("Color HSV") , KoCompositeOp::categoryHSV());
add<&cfHue <HSVType,Arg> >(cs, COMPOSITE_HUE_HSV , i18n("Hue HSV") , KoCompositeOp::categoryHSV());
add<&cfSaturation <HSVType,Arg> >(cs, COMPOSITE_SATURATION_HSV , i18n("Saturation HSV") , KoCompositeOp::categoryHSV());
add<&cfIncreaseSaturation<HSVType,Arg> >(cs, COMPOSITE_INC_SATURATION_HSV, i18n("Increase Saturation HSV"), KoCompositeOp::categoryHSV());
add<&cfDecreaseSaturation<HSVType,Arg> >(cs, COMPOSITE_DEC_SATURATION_HSV, i18n("Decrease Saturation HSV"), KoCompositeOp::categoryHSV());
add<&cfLightness <HSVType,Arg> >(cs, COMPOSITE_VALUE , i18n("Value") , KoCompositeOp::categoryHSV());
add<&cfIncreaseLightness <HSVType,Arg> >(cs, COMPOSITE_INC_VALUE , i18n("Increase Value") , KoCompositeOp::categoryHSV());
add<&cfDecreaseLightness <HSVType,Arg> >(cs, COMPOSITE_DEC_VALUE , i18n("Decrease Value") , KoCompositeOp::categoryHSV());
}
};
}
/**
* This function add to the colorspace all the composite ops defined by
* the pigment library.
*/
template<class _Traits_>
void addStandardCompositeOps(KoColorSpace* cs)
{
typedef typename _Traits_::channels_type channels_type;
static const bool useGeneralOps = true;
static const bool useRGBOps = (boost::is_base_of<KoBgrTraits<channels_type>, _Traits_>::value
|| boost::is_base_of<KoRgbTraits<channels_type>, _Traits_>::value);
_Private::AddGeneralOps<_Traits_, useGeneralOps>::add(cs);
_Private::AddRGBOps <_Traits_, useRGBOps >::add(cs);
}
#endif
diff --git a/libs/pigment/resources/KoAbstractGradient.h b/libs/pigment/resources/KoAbstractGradient.h
index b63e75ccc5..435ce2b64d 100644
--- a/libs/pigment/resources/KoAbstractGradient.h
+++ b/libs/pigment/resources/KoAbstractGradient.h
@@ -1,93 +1,93 @@
/*
Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KOABSTRACTGRADIENT_H
#define KOABSTRACTGRADIENT_H
#include <QGradient>
#include <QMetaType>
#include "KoColorSpace.h"
#include <resources/KoResource.h>
#include <kritapigment_export.h>
class KoAbstractGradient;
typedef QSharedPointer<KoAbstractGradient> KoAbstractGradientSP;
class KoColor;
/**
* KoAbstractGradient is the base class of all gradient resources
*/
class KRITAPIGMENT_EXPORT KoAbstractGradient : public KoResource
{
public:
explicit KoAbstractGradient(const QString &filename);
- virtual ~KoAbstractGradient();
+ ~KoAbstractGradient() override;
virtual KoAbstractGradient* clone() const = 0;
- virtual bool load() {
+ bool load() override {
return false;
}
- virtual bool loadFromDevice(QIODevice *) {
+ bool loadFromDevice(QIODevice *) override {
return false;
}
- virtual bool save() {
+ bool save() override {
return false;
}
- virtual bool saveToDevice(QIODevice*) const {
+ bool saveToDevice(QIODevice*) const override {
return false;
}
/**
* Creates a QGradient from the gradient.
* The resulting QGradient might differ from original gradient
*/
virtual QGradient* toQGradient() const {
return new QGradient();
}
/// gets the color at position 0 <= t <= 1
virtual void colorAt(KoColor&, qreal t) const;
void setColorSpace(KoColorSpace* colorSpace);
const KoColorSpace * colorSpace() const;
void setSpread(QGradient::Spread spreadMethod);
QGradient::Spread spread() const;
void setType(QGradient::Type repeatType);
QGradient::Type type() const;
void updatePreview();
QImage generatePreview(int width, int height) const;
KoAbstractGradient(const KoAbstractGradient &rhs);
private:
struct Private;
Private* const d;
};
Q_DECLARE_METATYPE(KoAbstractGradient*)
#endif // KOABSTRACTGRADIENT_H
diff --git a/libs/pigment/resources/KoColorSet.h b/libs/pigment/resources/KoColorSet.h
index 6e7527b4cb..55be9efd84 100644
--- a/libs/pigment/resources/KoColorSet.h
+++ b/libs/pigment/resources/KoColorSet.h
@@ -1,217 +1,217 @@
/* This file is part of the KDE project
Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
Copyright (c) 2016 L. E. Segovia <leo.segovia@siggraph.org>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KOCOLORSET
#define KOCOLORSET
#include <QObject>
#include <QColor>
#include <QVector>
#include <QScopedPointer>
#include <resources/KoResource.h>
#include "KoColor.h"
struct KoColorSetEntry {
KoColorSetEntry() {}
KoColorSetEntry(const KoColor &_color, const QString &_name)
: color(_color), name(_name) {}
KoColor color;
QString name;
QString id;
bool spotColor {false};
bool operator==(const KoColorSetEntry& rhs) const {
return color == rhs.color && name == rhs.name;
}
};
/**
* Open Gimp, Photoshop or RIFF palette files. This is a straight port
* from the Gimp.
*/
class KRITAPIGMENT_EXPORT KoColorSet : public QObject, public KoResource
{
Q_OBJECT
public:
enum PaletteType {
UNKNOWN = 0,
GPL, // GIMP
RIFF_PAL, // RIFF
ACT, // Photoshop binary
PSP_PAL, // PaintShop Pro
ACO, // Photoshop Swatches
XML, // XML palette (Scribus)
KPL, // KoColor-based XML palette
SBZ // SwatchBooker
};
/**
* Load a color set from a file. This can be a Gimp
* palette, a RIFF palette, a Photoshop palette,
* a Scribus palette or a SwatchBooker palette.
*/
explicit KoColorSet(const QString &filename);
/// Create an empty color set
KoColorSet();
/// Explicit copy constructor (KoResource copy constructor is private)
KoColorSet(const KoColorSet& rhs);
- virtual ~KoColorSet();
+ ~KoColorSet() override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
void setColumnCount(int columns);
int columnCount();
/**
* @brief comment
* @return the comment.
*/
QString comment();
public:
/**
* @brief add Add a color to the palette.
* @param groupName color to add the group to. If empty, it will be added to the unsorted.
*/
void add(const KoColorSetEntry &, QString groupName = QString());
/**
* @brief insertBefore insert color before index into group.
* @param index
* @param groupName name of the group that the color goes into.
* @return new index of index after the prepending.
*/
quint32 insertBefore(const KoColorSetEntry &, qint32 index, const QString &groupName = QString());
void removeAt(quint32 index, QString groupName = QString());
/**
* @brief getColorGlobal
* A function for getting a color based on a global index. Useful for itterating through all color entries.
* @param globalIndex the global index over the whole palette.
* @return the entry.
*/
KoColorSetEntry getColorGlobal(quint32 globalIndex);
/**
* @brief getColorGroup
* A function for getting the color from a specific group.
* @param groupName the name of the group, will give unosrted when not defined.
* @param index the index within the group.
* @return the entry
*/
KoColorSetEntry getColorGroup(quint32 index, QString groupName = QString());
QString findGroupByGlobalIndex(quint32 globalIndex, quint32 *index);
QString findGroupByColorName(const QString &name, quint32 *index);
QString findGroupByID(const QString &id,quint32 *index);
/**
* @brief getGroupNames
* @return returns a list of group names, excluding the unsorted group.
*/
QStringList getGroupNames();
/**
* @brief nColorsGroup
* @param groupName string name of the group, when not specified, returns unsorted colors.
* @return the amount of colors in this group.
*/
quint32 nColorsGroup(QString groupName = QString());
/**
* @brief nColors
* @return total colors in palette.
*/
quint32 nColors();
/**
* @brief addGroup
* Adds a new group.
* @param groupName the name of the new group. When not specified, this will fail.
* @return whether thegroup was made.
*/
bool addGroup(const QString &groupName);
/**
* @brief removeGroup
* Remove a group from the KoColorSet
* @param groupName the name of the group you want to remove.
* @param keepColors Whether you wish to keep the colorsetentries. These will be added to the unsorted.
* @return whether it could find the group to remove.
*/
bool removeGroup(const QString &groupName, bool keepColors = true);
void clear();
/**
* @brief getIndexClosestColor
* function that matches the color to all colors in the colorset, and returns the index
* of the closest match.
* @param color the color you wish to compare.
* @param useGivenColorSpace whether to use the color space of the color given
* when the two colors' colorspaces don't match. Else it'll use the entry's colorspace.
* @return returns the int of the closest match.
*/
quint32 getIndexClosestColor(KoColor color, bool useGivenColorSpace = true);
/**
* @brief closestColorName
* convenience function to get the name of the closest match.
* @param color
* @param useGivenColorSpace
* @return
*/
QString closestColorName(KoColor color, bool useGivenColorSpace = true);
private:
bool init();
bool saveGpl(QIODevice *dev) const;
bool loadGpl();
bool loadAct();
bool loadRiff();
bool loadPsp();
bool loadAco();
bool loadXml();
bool loadSbz();
bool saveKpl(QIODevice *dev) const;
bool loadKpl();
struct Private;
const QScopedPointer<Private> d;
};
#endif // KOCOLORSET
diff --git a/libs/pigment/resources/KoMD5Generator.h b/libs/pigment/resources/KoMD5Generator.h
index 292be6756f..26304d5314 100644
--- a/libs/pigment/resources/KoMD5Generator.h
+++ b/libs/pigment/resources/KoMD5Generator.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2015 Stefano Bonicatti <smjert@gmail.com>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOMD5GENERATOR_H
#define KOMD5GENERATOR_H
#include "KoHashGenerator.h"
#include <kritapigment_export.h>
class KRITAPIGMENT_EXPORT KoMD5Generator : public KoHashGenerator
{
public:
KoMD5Generator();
- virtual ~KoMD5Generator();
- virtual QByteArray generateHash(const QString &filename);
- virtual QByteArray generateHash(const QByteArray &array);
+ ~KoMD5Generator() override;
+ QByteArray generateHash(const QString &filename) override;
+ QByteArray generateHash(const QByteArray &array) override;
};
#endif
diff --git a/libs/pigment/resources/KoPattern.h b/libs/pigment/resources/KoPattern.h
index c35bc3de34..cd89cbaa17 100644
--- a/libs/pigment/resources/KoPattern.h
+++ b/libs/pigment/resources/KoPattern.h
@@ -1,80 +1,80 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KOPATTERN_H
#define KOPATTERN_H
#include <resources/KoResource.h>
#include <kritapigment_export.h>
#include <QMetaType>
/// Write API docs here
class KRITAPIGMENT_EXPORT KoPattern : public KoResource
{
public:
/**
* Creates a new KoPattern object using @p filename. No file is opened
* in the constructor, you have to call load.
*
* @param filename the file name to save and load from.
*/
explicit KoPattern(const QString &filename);
KoPattern(const QImage &image, const QString &name, const QString &folderName);
- virtual ~KoPattern();
+ ~KoPattern() override;
public:
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
bool loadPatFromDevice(QIODevice *dev);
bool savePatToDevice(QIODevice* dev) const;
qint32 width() const;
qint32 height() const;
- QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
KoPattern& operator=(const KoPattern& pattern);
KoPattern* clone() const;
/**
* @brief pattern the actual pattern image
* @return a valid QImage. There are no guarantees to the image format.
*/
QImage pattern() const;
private:
bool init(QByteArray& data);
void setPatternImage(const QImage& image);
private:
QImage m_pattern;
mutable QByteArray m_md5;
};
Q_DECLARE_METATYPE(KoPattern*)
#endif // KOPATTERN_H
diff --git a/libs/pigment/resources/KoSegmentGradient.h b/libs/pigment/resources/KoSegmentGradient.h
index 8d54ecb1c0..25c5f34525 100644
--- a/libs/pigment/resources/KoSegmentGradient.h
+++ b/libs/pigment/resources/KoSegmentGradient.h
@@ -1,418 +1,418 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
2004 Boudewijn Rempt <boud@valdyas.org>
2004 Adrian Page <adrian@pagenet.plus.com>
2004, 2007 Sven Langkamp <sven.langkamp@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KOSEGMENTGRADIENT_H
#define KOSEGMENTGRADIENT_H
#include <QList>
#include <QColor>
#include <resources/KoResource.h>
#include <resources/KoAbstractGradient.h>
#include "KoColor.h"
#include <kritapigment_export.h>
enum {
INTERP_LINEAR = 0,
INTERP_CURVED,
INTERP_SINE,
INTERP_SPHERE_INCREASING,
INTERP_SPHERE_DECREASING
};
enum {
COLOR_INTERP_RGB,
COLOR_INTERP_HSV_CCW,
COLOR_INTERP_HSV_CW
};
/// Write API docs here
class KRITAPIGMENT_EXPORT KoGradientSegment
{
public:
KoGradientSegment(int interpolationType, int colorInterpolationType, qreal startOffset, qreal middleOffset, qreal endOffset, const KoColor& startColor, const KoColor& endColor);
// startOffset <= t <= endOffset
void colorAt(KoColor&, qreal t) const;
const KoColor& startColor() const;
const KoColor& endColor() const;
void setStartColor(const KoColor& color) {
m_startColor = color;
}
void setEndColor(const KoColor& color) {
m_endColor = color;
}
qreal startOffset() const;
qreal middleOffset() const;
qreal endOffset() const;
void setStartOffset(qreal t);
void setMiddleOffset(qreal t);
void setEndOffset(qreal t);
qreal length() {
return m_length;
}
int interpolation() const;
int colorInterpolation() const;
void setInterpolation(int interpolationType);
void setColorInterpolation(int colorInterpolationType);
bool isValid() const;
protected:
class ColorInterpolationStrategy
{
public:
ColorInterpolationStrategy() {}
virtual ~ColorInterpolationStrategy() {}
virtual void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const = 0;
virtual int type() const = 0;
};
class RGBColorInterpolationStrategy : public ColorInterpolationStrategy
{
public:
static RGBColorInterpolationStrategy *instance();
- virtual void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const;
- virtual int type() const {
+ void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const override;
+ int type() const override {
return COLOR_INTERP_RGB;
}
private:
RGBColorInterpolationStrategy();
static RGBColorInterpolationStrategy *m_instance;
const KoColorSpace * const m_colorSpace;
};
class HSVCWColorInterpolationStrategy : public ColorInterpolationStrategy
{
public:
static HSVCWColorInterpolationStrategy *instance();
- virtual void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const;
- virtual int type() const {
+ void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const override;
+ int type() const override {
return COLOR_INTERP_HSV_CW;
}
private:
HSVCWColorInterpolationStrategy();
static HSVCWColorInterpolationStrategy *m_instance;
const KoColorSpace * const m_colorSpace;
};
class HSVCCWColorInterpolationStrategy : public ColorInterpolationStrategy
{
public:
static HSVCCWColorInterpolationStrategy *instance();
- virtual void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const;
- virtual int type() const {
+ void colorAt(KoColor& dst, qreal t, const KoColor& start, const KoColor& end) const override;
+ int type() const override {
return COLOR_INTERP_HSV_CCW;
}
private:
HSVCCWColorInterpolationStrategy();
static HSVCCWColorInterpolationStrategy *m_instance;
const KoColorSpace * const m_colorSpace;
};
class InterpolationStrategy
{
public:
InterpolationStrategy() {}
virtual ~InterpolationStrategy() {}
virtual qreal valueAt(qreal t, qreal middle) const = 0;
virtual int type() const = 0;
};
class LinearInterpolationStrategy : public InterpolationStrategy
{
public:
static LinearInterpolationStrategy *instance();
- virtual qreal valueAt(qreal t, qreal middle) const;
- virtual int type() const {
+ qreal valueAt(qreal t, qreal middle) const override;
+ int type() const override {
return INTERP_LINEAR;
}
// This does the actual calculation and is made
// static as an optimization for the other
// strategies that need this for their own calculation.
static qreal calcValueAt(qreal t, qreal middle);
private:
LinearInterpolationStrategy() {}
static LinearInterpolationStrategy *m_instance;
};
class CurvedInterpolationStrategy : public InterpolationStrategy
{
public:
static CurvedInterpolationStrategy *instance();
- virtual qreal valueAt(qreal t, qreal middle) const;
- virtual int type() const {
+ qreal valueAt(qreal t, qreal middle) const override;
+ int type() const override {
return INTERP_CURVED;
}
private:
CurvedInterpolationStrategy();
static CurvedInterpolationStrategy *m_instance;
qreal m_logHalf;
};
class SphereIncreasingInterpolationStrategy : public InterpolationStrategy
{
public:
static SphereIncreasingInterpolationStrategy *instance();
- virtual qreal valueAt(qreal t, qreal middle) const;
- virtual int type() const {
+ qreal valueAt(qreal t, qreal middle) const override;
+ int type() const override {
return INTERP_SPHERE_INCREASING;
}
private:
SphereIncreasingInterpolationStrategy() {}
static SphereIncreasingInterpolationStrategy *m_instance;
};
class SphereDecreasingInterpolationStrategy : public InterpolationStrategy
{
public:
static SphereDecreasingInterpolationStrategy *instance();
- virtual qreal valueAt(qreal t, qreal middle) const;
- virtual int type() const {
+ qreal valueAt(qreal t, qreal middle) const override;
+ int type() const override {
return INTERP_SPHERE_DECREASING;
}
private:
SphereDecreasingInterpolationStrategy() {}
static SphereDecreasingInterpolationStrategy *m_instance;
};
class SineInterpolationStrategy : public InterpolationStrategy
{
public:
static SineInterpolationStrategy *instance();
- virtual qreal valueAt(qreal t, qreal middle) const;
- virtual int type() const {
+ qreal valueAt(qreal t, qreal middle) const override;
+ int type() const override {
return INTERP_SINE;
}
private:
SineInterpolationStrategy() {}
static SineInterpolationStrategy *m_instance;
};
private:
InterpolationStrategy *m_interpolator;
ColorInterpolationStrategy *m_colorInterpolator;
qreal m_startOffset;
qreal m_middleOffset;
qreal m_endOffset;
qreal m_length;
qreal m_middleT;
KoColor m_startColor;
KoColor m_endColor;
};
/**
* KoSegmentGradient stores a segment based gradients like Gimp gradients
*/
class KRITAPIGMENT_EXPORT KoSegmentGradient : public KoAbstractGradient
{
public:
explicit KoSegmentGradient(const QString &file = QString());
- virtual ~KoSegmentGradient();
+ ~KoSegmentGradient() override;
- KoAbstractGradient* clone() const;
+ KoAbstractGradient* clone() const override;
/// reimplemented
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
/// not implemented
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
/// reimplemented
- void colorAt(KoColor& dst, qreal t) const;
+ void colorAt(KoColor& dst, qreal t) const override;
/**
* Returns the segment at a given position
* @param t position inside the gradient, with 0 <= t <= 1
* @return the segment the position, 0 if no segment is found
*/
KoGradientSegment *segmentAt(qreal t) const;
/// reimplemented
- virtual QGradient* toQGradient() const;
+ QGradient* toQGradient() const override;
/// reimplemented
- QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
/**
* a gradient colour picker can consist of one or more segments.
* A segment has two end points - each colour in the gradient
* colour picker represents a segment end point.
* @param interpolation
* @param colorInterpolation
* @param startOffset
* @param endOffset
* @param middleOffset
* @param left
* @param right
* @return void
*/
void createSegment(int interpolation, int colorInterpolation, double startOffset, double endOffset, double middleOffset, const QColor & left, const QColor & right);
/**
* gets a list of end points of the segments in the gradient
* colour picker. If two colours, one segment then two end
* points, and if three colours, then two segments with four
* endpoints.
* @return a list of double values
*/
const QList<double> getHandlePositions() const;
/**
* gets a list of middle points of the segments in the gradient
* colour picker.
* @return a list of double values
*/
const QList<double> getMiddleHandlePositions() const;
/**
* Moves the StartOffset of the specified segment to the
* specified value and corrects the endoffset of the previous
* segment. If the segment is the first Segment the startoffset
* will be set to 0.0 . The offset will maximally be moved till
* the middle of the current or the previous segment. This is
* useful if someone clicks to move the handler for a segment,
* to set the half the segment to the right and half the segment
* to the left of the handler.
* @param segment the segment for which to move the relative
* offset within the gradient colour picker.
* @param t the new startoff position for the segment
* @return void
*/
void moveSegmentStartOffset(KoGradientSegment* segment, double t);
/**
* Moves the endoffset of the specified segment to the specified
* value and corrects the startoffset of the following segment.
* If the segment is the last segment the endoffset will be set
* to 1.0 . The offset will maximally be moved till the middle
* of the current or the following segment. This is useful if
* someone moves the segment handler in the gradient colour
* picker, and needs the segment to move with it. Sets the end
* position of the segment to the correct new position.
* @param segment the segment for which to move the relative
* end position within the gradient colour picker.
* @param t the new end position for the segment
* @return void
*/
void moveSegmentEndOffset(KoGradientSegment* segment, double t);
/**
* moves the Middle of the specified segment to the specified
* value. The offset will maximally be moved till the endoffset
* or startoffset of the segment. This sets the middle of the
* segment to the same position as the handler of the gradient
* colour picker.
* @param segment the segment for which to move the relative
* middle position within the gradient colour picker.
* @param t the new middle position for the segment
* @return void
*/
void moveSegmentMiddleOffset(KoGradientSegment* segment, double t);
/**
* splits the specified segment into two equal parts
* @param segment the segment to split
* @return void
*/
void splitSegment(KoGradientSegment* segment);
/**
* duplicate the specified segment
* @param segment the segment to duplicate
* @return void
*/
void duplicateSegment(KoGradientSegment* segment);
/**
* create a segment horizontally reversed to the specified one.
* @param segment the segment to reverse
* @return void
*/
void mirrorSegment(KoGradientSegment* segment);
/**
* removes the specific segment from the gradient colour picker.
* @param segment the segment to remove
* @return the segment which will be at the place of the old
* segment. 0 if the segment is not in the gradient or it is
* not possible to remove the segment.
*/
KoGradientSegment* removeSegment(KoGradientSegment* segment);
/**
* checks if it's possible to remove a segment (at least two
* segments in the gradient)
* @return true if it's possible to remove an segment
*/
bool removeSegmentPossible() const;
const QList<KoGradientSegment *>& segments() const;
protected:
KoSegmentGradient(const KoSegmentGradient &rhs);
inline void pushSegment(KoGradientSegment* segment) {
m_segments.push_back(segment);
}
QList<KoGradientSegment *> m_segments;
private:
bool init();
};
#endif // KOSEGMENTGRADIENT_H
diff --git a/libs/pigment/resources/KoStopGradient.h b/libs/pigment/resources/KoStopGradient.h
index de4aa419cf..029ffb349e 100644
--- a/libs/pigment/resources/KoStopGradient.h
+++ b/libs/pigment/resources/KoStopGradient.h
@@ -1,82 +1,82 @@
/*
Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KOSTOPGRADIENT_H
#define KOSTOPGRADIENT_H
#include <QPair>
#include <QGradient>
#include "KoColor.h"
#include <resources/KoAbstractGradient.h>
#include <resources/KoResource.h>
#include <kritapigment_export.h>
typedef QPair<qreal, KoColor> KoGradientStop;
/**
* Resource for colorstop based gradients like Karbon gradients and SVG gradients
*/
class KRITAPIGMENT_EXPORT KoStopGradient : public KoAbstractGradient
{
public:
explicit KoStopGradient(const QString &filename = QString());
- virtual ~KoStopGradient();
+ ~KoStopGradient() override;
- KoAbstractGradient* clone() const;
+ KoAbstractGradient* clone() const override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
/// reimplemented
- virtual QGradient* toQGradient() const;
+ QGradient* toQGradient() const override;
/// reimplemented
- void colorAt(KoColor&, qreal t) const;
+ void colorAt(KoColor&, qreal t) const override;
/// Creates KoStopGradient from a QGradient
static KoStopGradient * fromQGradient(const QGradient * gradient);
/// Sets the gradient stops
void setStops(QList<KoGradientStop> stops);
QList<KoGradientStop> stops() const;
/// reimplemented
- QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
protected:
QList<KoGradientStop> m_stops;
QPointF m_start;
QPointF m_stop;
QPointF m_focalPoint;
private:
void loadKarbonGradient(QIODevice *file);
void parseKarbonGradient(const QDomElement& element);
void loadSvgGradient(QIODevice *file);
void parseSvgGradient(const QDomElement& element);
void parseSvgColor(QColor &color, const QString &s);
};
#endif // KOSTOPGRADIENT_H
diff --git a/libs/pigment/tests/CCSGraph.cpp b/libs/pigment/tests/CCSGraph.cpp
index 81019a111e..a1f57ca2f2 100644
--- a/libs/pigment/tests/CCSGraph.cpp
+++ b/libs/pigment/tests/CCSGraph.cpp
@@ -1,109 +1,119 @@
/*
* Copyright (c) 2007-2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <QFile>
#include <QProcess>
#include <QTemporaryFile>
#include <QCoreApplication>
#include <DebugPigment.h>
#include "KoColorSpaceRegistry.h"
#include "KoColorConversionSystem.h"
#include <iostream>
#include <QCommandLineParser>
#include <QCommandLineOption>
+struct FriendOfColorSpaceRegistry {
+static QString toDot() {
+ return KoColorSpaceRegistry::instance()->colorConversionSystem()->toDot();
+}
+
+static QString bestPathToDot(const QString &srcKey, const QString &dstKey) {
+ return KoColorSpaceRegistry::instance()->colorConversionSystem()->bestPathToDot(srcKey, dstKey);
+}
+};
+
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
QCommandLineParser parser;
parser.addVersionOption();
parser.addHelpOption();
// Initialize the list of options
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("graphs"), i18n("return the list of available graphs")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("graph"), i18n("specify the type of graph (see --graphs to get the full list, the default is full)"), QLatin1String("type"), QLatin1String("full")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("key"), i18n("specify the key of the source color space"), QLatin1String("key"), QString()));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("key"), i18n("specify the key of the destination color space"), QLatin1String("key"), QString()));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("output"), i18n("specify the output (can be ps or dot, the default is ps)"), QLatin1String("type"), QLatin1String("ps")));
parser.addPositionalArgument(QLatin1String("outputfile"), i18n("name of the output file"));
parser.process(app); // PORTING SCRIPT: move this to after any parser.addOption
if (parser.isSet("graphs")) {
// Don't change those lines to use dbgPigment derivatives, they need to be outputed
// to stdout not stderr.
std::cout << "full : show all the connection on the graph" << std::endl;
std::cout << "bestpath : show the best path for a given transformation" << std::endl;
exit(EXIT_SUCCESS);
}
QString graphType = parser.value("graph");
QString outputType = parser.value("output");
if (parser.positionalArguments().count() != 1) {
errorPigment << "No output file name specified";
parser.showHelp();
exit(EXIT_FAILURE);
}
QString outputFileName = parser.positionalArguments()[0];
// Generate the graph
QString dot;
if (graphType == "full") {
- dot = KoColorSpaceRegistry::instance()->colorConversionSystem()->toDot();
+ dot = FriendOfColorSpaceRegistry::toDot();
} else if (graphType == "bestpath") {
QString srcKey = parser.value("src-key");
QString dstKey = parser.value("dst-key");
if (srcKey.isEmpty() || dstKey.isEmpty()) {
errorPigment << "src-key and dst-key must be specified for the graph bestpath";
exit(EXIT_FAILURE);
} else {
- dot = KoColorSpaceRegistry::instance()->colorConversionSystem()->bestPathToDot(srcKey, dstKey);
+ dot = FriendOfColorSpaceRegistry::bestPathToDot(srcKey, dstKey);
}
} else {
errorPigment << "Unknow graph type : " << graphType.toLatin1();
exit(EXIT_FAILURE);
}
if (outputType == "dot") {
QFile file(outputFileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
exit(EXIT_FAILURE);
QTextStream out(&file);
out << dot;
} else if (outputType == "ps" || outputType == "svg") {
QTemporaryFile file;
if (!file.open()) {
exit(EXIT_FAILURE);
}
QTextStream out(&file);
out << dot;
QString cmd = QString("dot -T%1 %2 -o %3").arg(outputType).arg(file.fileName()).arg(outputFileName);
file.close();
if (QProcess::execute(cmd) != 0) {
errorPigment << "An error has occurred when executing : '" << cmd << "' the most likely cause is that 'dot' command is missing, and that you should install graphviz (from http://www.graphiz.org)";
}
} else {
errorPigment << "Unknow output type : " << outputType;
exit(EXIT_FAILURE);
}
}
diff --git a/libs/psd/asl/kis_asl_callback_object_catcher.h b/libs/psd/asl/kis_asl_callback_object_catcher.h
index 460abfdd1a..0e9a6f2839 100644
--- a/libs/psd/asl/kis_asl_callback_object_catcher.h
+++ b/libs/psd/asl/kis_asl_callback_object_catcher.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ASL_CALLBACK_OBJECT_CATCHER_H
#define __KIS_ASL_CALLBACK_OBJECT_CATCHER_H
#include "kis_asl_object_catcher.h"
#include <boost/function.hpp>
#include <QScopedPointer>
#include <resources/KoAbstractGradient.h>
#include "kritapsd_export.h"
class KoPattern;
typedef boost::function<void (double)> ASLCallbackDouble;
typedef boost::function<void (int)> ASLCallbackInteger;
typedef boost::function<void (const QString &)> ASLCallbackString;
typedef boost::function<void (bool)> ASLCallbackBoolean;
typedef boost::function<void (const QColor &)> ASLCallbackColor;
typedef boost::function<void (const QPointF &)> ASLCallbackPoint;
typedef boost::function<void (const QString &, const QVector<QPointF> &)> ASLCallbackCurve;
typedef boost::function<void (const KoPattern *)> ASLCallbackPattern;
typedef boost::function<void (const QString &, const QString &)> ASLCallbackPatternRef;
typedef boost::function<void (KoAbstractGradientSP)> ASLCallbackGradient;
typedef boost::function<void ()> ASLCallbackNewStyle;
class KRITAPSD_EXPORT KisAslCallbackObjectCatcher : public KisAslObjectCatcher
{
public:
KisAslCallbackObjectCatcher();
- ~KisAslCallbackObjectCatcher();
+ ~KisAslCallbackObjectCatcher() override;
- void addDouble(const QString &path, double value);
- void addInteger(const QString &path, int value);
- void addEnum(const QString &path, const QString &typeId, const QString &value);
- void addUnitFloat(const QString &path, const QString &unit, double value);
- void addText(const QString &path, const QString &value);
- void addBoolean(const QString &path, bool value);
- void addColor(const QString &path, const QColor &value);
- void addPoint(const QString &path, const QPointF &value);
- void addCurve(const QString &path, const QString &name, const QVector<QPointF> &points);
- void addPattern(const QString &path, const KoPattern *pattern);
- void addPatternRef(const QString &path, const QString &patternUuid, const QString &patternName);
- void addGradient(const QString &path, KoAbstractGradientSP gradient);
- void newStyleStarted();
+ void addDouble(const QString &path, double value) override;
+ void addInteger(const QString &path, int value) override;
+ void addEnum(const QString &path, const QString &typeId, const QString &value) override;
+ void addUnitFloat(const QString &path, const QString &unit, double value) override;
+ void addText(const QString &path, const QString &value) override;
+ void addBoolean(const QString &path, bool value) override;
+ void addColor(const QString &path, const QColor &value) override;
+ void addPoint(const QString &path, const QPointF &value) override;
+ void addCurve(const QString &path, const QString &name, const QVector<QPointF> &points) override;
+ void addPattern(const QString &path, const KoPattern *pattern) override;
+ void addPatternRef(const QString &path, const QString &patternUuid, const QString &patternName) override;
+ void addGradient(const QString &path, KoAbstractGradientSP gradient) override;
+ void newStyleStarted() override;
void subscribeDouble(const QString &path, ASLCallbackDouble callback);
void subscribeInteger(const QString &path, ASLCallbackInteger callback);
void subscribeEnum(const QString &path, const QString &typeId, ASLCallbackString callback);
void subscribeUnitFloat(const QString &path, const QString &unit, ASLCallbackDouble callback);
void subscribeText(const QString &path, ASLCallbackString callback);
void subscribeBoolean(const QString &path, ASLCallbackBoolean callback);
void subscribeColor(const QString &path, ASLCallbackColor callback);
void subscribePoint(const QString &path, ASLCallbackPoint callback);
void subscribeCurve(const QString &path, ASLCallbackCurve callback);
void subscribePattern(const QString &path, ASLCallbackPattern callback);
void subscribePatternRef(const QString &path, ASLCallbackPatternRef callback);
void subscribeGradient(const QString &path, ASLCallbackGradient callback);
void subscribeNewStyleStarted(ASLCallbackNewStyle callback);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_ASL_CALLBACK_OBJECT_CATCHER_H */
diff --git a/libs/psd/psd.h b/libs/psd/psd.h
index b9d0adad8e..3777585203 100644
--- a/libs/psd/psd.h
+++ b/libs/psd/psd.h
@@ -1,1168 +1,1168 @@
/*
* Copyright (c) 2010 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*
* Constants and defines taken from gimp and psdparse
*/
#ifndef PSD_H
#define PSD_H
#include <QPair>
#include <QString>
#include <QColor>
#include <QVector>
#include <KoColorModelStandardIds.h>
#include <KoCompositeOpRegistry.h>
#include <resources/KoAbstractGradient.h>
#include "kritapsd_export.h"
class KoPattern;
const int MAX_CHANNELS = 56;
typedef qint32 Fixed; /* Represents a fixed point implied decimal */
/**
* Image color/depth modes
*/
enum psd_color_mode {
Bitmap = 0,
Grayscale=1,
Indexed=2,
RGB=3,
CMYK=4,
MultiChannel=7,
DuoTone=8,
Lab=9,
Gray16,
RGB48,
Lab48,
CMYK64,
DeepMultichannel,
Duotone16,
COLORMODE_UNKNOWN = 9000
};
/**
* Color samplers, apparently distict from PSDColormode
*/
namespace psd_color_sampler {
enum PSDColorSamplers {
RGB,
HSB,
CMYK,
PANTONE, // LAB
FOCOLTONE, // CMYK
TRUMATCH, // CMYK
TOYO, // LAB
LAB,
GRAYSCALE,
HKS, // CMYK
DIC, // LAB
TOTAL_INK,
MONITOR_RGB,
DUOTONE,
OPACITY,
ANPA = 3000 // LAB
};
}
// EFFECTS
enum psd_gradient_style {
psd_gradient_style_linear, // 'Lnr '
psd_gradient_style_radial, // 'Rdl '
psd_gradient_style_angle, // 'Angl'
psd_gradient_style_reflected, // 'Rflc'
psd_gradient_style_diamond // 'Dmnd'
};
enum psd_color_stop_type {
psd_color_stop_type_foreground_color, // 'FrgC'
psd_color_stop_type_background_Color, // 'BckC'
psd_color_stop_type_user_stop // 'UsrS'
};
enum psd_technique_type {
psd_technique_softer,
psd_technique_precise,
psd_technique_slope_limit,
};
enum psd_stroke_position {
psd_stroke_outside,
psd_stroke_inside,
psd_stroke_center
};
enum psd_fill_type {
psd_fill_solid_color,
psd_fill_gradient,
psd_fill_pattern,
};
enum psd_glow_source {
psd_glow_center,
psd_glow_edge,
};
enum psd_bevel_style {
psd_bevel_outer_bevel,
psd_bevel_inner_bevel,
psd_bevel_emboss,
psd_bevel_pillow_emboss,
psd_bevel_stroke_emboss,
};
enum psd_direction {
psd_direction_up,
psd_direction_down
};
enum psd_section_type {
psd_other = 0,
psd_open_folder,
psd_closed_folder,
psd_bounding_divider
};
// GRADIENT MAP
// Each color stop
struct psd_gradient_color_stop
{
qint32 location; // Location of color stop
qint32 midpoint; // Midpoint of color stop
QColor actual_color;
psd_color_stop_type color_stop_type;
};
// Each transparency stop
struct psd_gradient_transparency_stop
{
qint32 location; // Location of transparency stop
qint32 midpoint; // Midpoint of transparency stop
qint8 opacity; // Opacity of transparency stop
};
// Gradient settings (Photoshop 6.0)
struct psd_layer_gradient_map
{
bool reverse; // Is gradient reverse
bool dithered; // Is gradient dithered
qint32 name_length;
quint16 *name; // Name of the gradient: Unicode string, padded
qint8 number_color_stops; // Number of color stops to follow
psd_gradient_color_stop * color_stop;
qint8 number_transparency_stops;// Number of transparency stops to follow
psd_gradient_transparency_stop * transparency_stop;
qint8 expansion_count; // Expansion count ( = 2 for Photoshop 6.0)
qint8 interpolation; // Interpolation if length above is non-zero
qint8 length; // Length (= 32 for Photoshop 6.0)
qint8 mode; // Mode for this gradient
qint32 random_number_seed; // Random number seed
qint8 showing_transparency_flag;// Flag for showing transparency
qint8 using_vector_color_flag;// Flag for using vector color
qint32 roughness_factor; // Roughness factor
QColor min_color;
QColor max_color;
QColor lookup_table[256];
};
struct psd_gradient_color {
qint32 smoothness;
qint32 name_length;
quint16 * name; // Name of the gradient: Unicode string, padded
qint8 number_color_stops; // Number of color stops to follow
psd_gradient_color_stop * color_stop;
qint8 number_transparency_stops;// Number of transparency stops to follow
psd_gradient_transparency_stop *transparency_stop;
};
struct psd_pattern {
psd_color_mode color_mode; // The image mode of the file.
quint8 height; // Point: vertical, 2 bytes and horizontal, 2 bytes
quint8 width;
QString name;
QString uuid;
qint32 version;
quint8 top; // Rectangle: top, left, bottom, right
quint8 left;
quint8 bottom;
quint8 right;
qint32 max_channel; // Max channels
qint32 channel_number;
QVector<QRgb> color_table;
};
struct psd_layer_effects_context {
psd_layer_effects_context()
: keep_original(false)
{
}
bool keep_original;
};
#define PSD_LOOKUP_TABLE_SIZE 256
// dsdw, isdw: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_22203
class KRITAPSD_EXPORT psd_layer_effects_shadow_base {
public:
psd_layer_effects_shadow_base()
: m_invertsSelection(false)
, m_edgeHidden(true)
, m_effectEnabled(false)
, m_blendMode(COMPOSITE_MULT)
, m_color(Qt::black)
, m_nativeColor(Qt::black)
, m_opacity(75)
, m_angle(120)
, m_useGlobalLight(true)
, m_distance(21)
, m_spread(0)
, m_size(21)
, m_antiAliased(0)
, m_noise(0)
, m_knocksOut(false)
, m_fillType(psd_fill_solid_color)
, m_technique(psd_technique_softer)
, m_range(100)
, m_jitter(0)
, m_gradient(0)
{
for(int i = 0; i < PSD_LOOKUP_TABLE_SIZE; ++i) {
m_contourLookupTable[i] = i;
}
}
virtual ~psd_layer_effects_shadow_base() {
}
QPoint calculateOffset(const psd_layer_effects_context *context) const;
void setEffectEnabled(bool value) {
m_effectEnabled = value;
}
bool effectEnabled() const {
return m_effectEnabled;
}
QString blendMode() const {
return m_blendMode;
}
QColor color() const {
return m_color;
}
QColor nativeColor() const {
return m_nativeColor;
}
qint32 opacity() const {
return m_opacity;
}
qint32 angle() const {
return m_angle;
}
bool useGlobalLight() const {
return m_useGlobalLight;
}
qint32 distance() const {
return m_distance;
}
qint32 spread() const {
return m_spread;
}
qint32 size() const {
return m_size;
}
const quint8* contourLookupTable() const {
return m_contourLookupTable;
}
bool antiAliased() const {
return m_antiAliased;
}
qint32 noise() const {
return m_noise;
}
bool knocksOut() const {
return m_knocksOut;
}
bool invertsSelection() const {
return m_invertsSelection;
}
bool edgeHidden() const {
return m_edgeHidden;
}
psd_fill_type fillType() const {
return m_fillType;
}
psd_technique_type technique() const {
return m_technique;
}
qint32 range() const {
return m_range;
}
qint32 jitter() const {
return m_jitter;
}
KoAbstractGradientSP gradient() const {
return m_gradient;
}
public:
void setBlendMode(QString value) {
m_blendMode = value;
}
void setColor(QColor value) {
m_color = value;
}
void setNativeColor(QColor value) {
m_nativeColor = value;
}
void setOpacity(qint32 value) {
m_opacity = value;
}
void setAngle(qint32 value) {
m_angle = value;
}
void setUseGlobalLight(bool value) {
m_useGlobalLight = value;
}
void setDistance(qint32 value) {
m_distance = value;
}
void setSpread(qint32 value) {
m_spread = value;
}
void setSize(qint32 value) {
m_size = value;
}
void setContourLookupTable(const quint8* value) {
memcpy(m_contourLookupTable, value, PSD_LOOKUP_TABLE_SIZE * sizeof(quint8));
}
void setAntiAliased(bool value) {
m_antiAliased = value;
}
void setNoise(qint32 value) {
m_noise = value;
}
void setKnocksOut(bool value) {
m_knocksOut = value;
}
void setInvertsSelection(bool value) {
m_invertsSelection = value;
}
void setEdgeHidden(bool value) {
m_edgeHidden = value;
}
void setFillType(psd_fill_type value) {
m_fillType = value;
}
void setTechnique(psd_technique_type value) {
m_technique = value;
}
void setRange(qint32 value) {
m_range = value;
}
void setJitter(qint32 value) {
m_jitter = value;
}
void setGradient(KoAbstractGradientSP value) {
m_gradient = value;
}
virtual void scaleLinearSizes(qreal scale) {
m_distance *= scale;
m_size *= scale;
}
private:
// internal
bool m_invertsSelection;
bool m_edgeHidden;
private:
bool m_effectEnabled; // Effect enabled
QString m_blendMode; // already in Krita format!
QColor m_color;
QColor m_nativeColor;
qint32 m_opacity; // Opacity as a percent (0...100)
qint32 m_angle; // Angle in degrees
bool m_useGlobalLight; // Use this angle in all of the layer effects
qint32 m_distance; // Distance in pixels
qint32 m_spread; // Intensity as a percent
qint32 m_size; // Blur value in pixels
quint8 m_contourLookupTable[PSD_LOOKUP_TABLE_SIZE];
bool m_antiAliased;
qint32 m_noise;
bool m_knocksOut;
// for Outer/Inner Glow
psd_fill_type m_fillType;
psd_technique_type m_technique;
qint32 m_range;
qint32 m_jitter;
KoAbstractGradientSP m_gradient;
};
class KRITAPSD_EXPORT psd_layer_effects_shadow_common : public psd_layer_effects_shadow_base
{
public:
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setBlendMode;
// using psd_layer_effects_shadow_base::setColor;
// using psd_layer_effects_shadow_base::setOpacity;
// using psd_layer_effects_shadow_base::setAngle;
// using psd_layer_effects_shadow_base::setUseGlobalLight;
// using psd_layer_effects_shadow_base::setDistance;
// using psd_layer_effects_shadow_base::setSpread;
// using psd_layer_effects_shadow_base::setSize;
// using psd_layer_effects_shadow_base::setContourLookupTable;
// using psd_layer_effects_shadow_base::setAntiAliased;
// using psd_layer_effects_shadow_base::setNoise;
};
class KRITAPSD_EXPORT psd_layer_effects_drop_shadow : public psd_layer_effects_shadow_common
{
public:
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
//using psd_layer_effects_shadow_base::setKnocksOut;
};
// isdw: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_22203
class KRITAPSD_EXPORT psd_layer_effects_inner_shadow : public psd_layer_effects_shadow_common
{
public:
psd_layer_effects_inner_shadow() {
setKnocksOut(true);
setInvertsSelection(true);
setEdgeHidden(false);
}
};
class KRITAPSD_EXPORT psd_layer_effects_glow_common : public psd_layer_effects_shadow_base
{
public:
psd_layer_effects_glow_common() {
setKnocksOut(true);
setDistance(0);
setBlendMode(COMPOSITE_LINEAR_DODGE);
setColor(Qt::white);
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setBlendMode;
// using psd_layer_effects_shadow_base::setColor;
// using psd_layer_effects_shadow_base::setOpacity;
// using psd_layer_effects_shadow_base::setSpread;
// using psd_layer_effects_shadow_base::setSize;
// using psd_layer_effects_shadow_base::setContourLookupTable;
// using psd_layer_effects_shadow_base::setAntiAliased;
// using psd_layer_effects_shadow_base::setNoise;
// using psd_layer_effects_shadow_base::setFillType;
// using psd_layer_effects_shadow_base::setTechnique;
// using psd_layer_effects_shadow_base::setRange;
// using psd_layer_effects_shadow_base::setJitter;
// using psd_layer_effects_shadow_base::setGradient;
};
// oglw: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_25738
class KRITAPSD_EXPORT psd_layer_effects_outer_glow : public psd_layer_effects_glow_common
{
};
// iglw: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_27692
class KRITAPSD_EXPORT psd_layer_effects_inner_glow : public psd_layer_effects_glow_common
{
public:
psd_layer_effects_inner_glow()
: m_source(psd_glow_edge) {
setInvertsSelection(true);
setEdgeHidden(false);
}
psd_glow_source source() const {
return m_source;
}
void setSource(psd_glow_source value) {
m_source = value;
}
private:
psd_glow_source m_source;
};
struct psd_layer_effects_satin : public psd_layer_effects_shadow_base
{
psd_layer_effects_satin() {
setInvert(false);
setUseGlobalLight(false);
setDistance(8);
setSize(7);
setSpread(0);
setKnocksOut(true);
setEdgeHidden(false);
setBlendMode(COMPOSITE_LINEAR_BURN);
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setBlendMode;
// using psd_layer_effects_shadow_base::setColor;
// using psd_layer_effects_shadow_base::setOpacity;
// // NOTE: no global light setting explicitly!
// using psd_layer_effects_shadow_base::setAngle;
// using psd_layer_effects_shadow_base::setDistance;
// using psd_layer_effects_shadow_base::setSize;
// using psd_layer_effects_shadow_base::setContourLookupTable;
// using psd_layer_effects_shadow_base::setAntiAliased;
bool invert() const {
return m_invert;
}
void setInvert(bool value) {
m_invert = value;
}
private:
bool m_invert;
};
struct psd_pattern_info {
qint32 name_length;
quint16 * name;
quint8 identifier[256];
};
// bevl: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_31889
struct psd_layer_effects_bevel_emboss : public psd_layer_effects_shadow_base
{
psd_layer_effects_bevel_emboss()
: m_style(psd_bevel_inner_bevel),
m_technique(psd_technique_softer),
m_depth(100),
m_direction(psd_direction_up),
m_soften(0),
m_altitude(30),
m_glossAntiAliased(false),
m_highlightBlendMode(COMPOSITE_SCREEN),
m_highlightColor(Qt::white),
m_highlightOpacity(75),
m_shadowBlendMode(COMPOSITE_MULT),
m_shadowColor(Qt::black),
m_shadowOpacity(75),
m_contourEnabled(false),
m_contourRange(100),
m_textureEnabled(false),
m_texturePattern(0),
m_textureScale(100),
m_textureDepth(100),
m_textureInvert(false),
m_textureAlignWithLayer(true),
m_textureHorizontalPhase(0),
m_textureVerticalPhase(0)
{
for(int i = 0; i < PSD_LOOKUP_TABLE_SIZE; ++i) {
m_glossContourLookupTable[i] = i;
}
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setSize;
// using psd_layer_effects_shadow_base::setAngle;
// using psd_layer_effects_shadow_base::setUseGlobalLight;
// using psd_layer_effects_shadow_base::setContourLookupTable;
// using psd_layer_effects_shadow_base::setAntiAliased;
psd_bevel_style style() const {
return m_style;
}
void setStyle(psd_bevel_style value) {
m_style = value;
}
psd_technique_type technique() const {
return m_technique;
}
void setTechnique(psd_technique_type value) {
m_technique = value;
}
int depth() const {
return m_depth;
}
void setDepth(int value) {
m_depth = value;
}
psd_direction direction() const {
return m_direction;
}
void setDirection(psd_direction value) {
m_direction = value;
}
int soften() const {
return m_soften;
}
void setSoften(int value) {
m_soften = value;
}
int altitude() const {
return m_altitude;
}
void setAltitude(int value) {
m_altitude = value;
}
const quint8* glossContourLookupTable() const {
return m_glossContourLookupTable;
}
void setGlossContourLookupTable(const quint8 *value) {
memcpy(m_glossContourLookupTable, value, PSD_LOOKUP_TABLE_SIZE * sizeof(quint8));
}
bool glossAntiAliased() const {
return m_glossAntiAliased;
}
void setGlossAntiAliased(bool value) {
m_glossAntiAliased = value;
}
QString highlightBlendMode() const {
return m_highlightBlendMode;
}
void setHighlightBlendMode(QString value) {
m_highlightBlendMode = value;
}
QColor highlightColor() const {
return m_highlightColor;
}
void setHighlightColor(QColor value) {
m_highlightColor = value;
}
qint32 highlightOpacity() const {
return m_highlightOpacity;
}
void setHighlightOpacity(qint32 value) {
m_highlightOpacity = value;
}
QString shadowBlendMode() const {
return m_shadowBlendMode;
}
void setShadowBlendMode(QString value) {
m_shadowBlendMode = value;
}
QColor shadowColor() const {
return m_shadowColor;
}
void setShadowColor(QColor value) {
m_shadowColor = value;
}
qint32 shadowOpacity() const {
return m_shadowOpacity;
}
void setShadowOpacity(qint32 value) {
m_shadowOpacity = value;
}
bool contourEnabled() const {
return m_contourEnabled;
}
void setContourEnabled(bool value) {
m_contourEnabled = value;
}
int contourRange() const {
return m_contourRange;
}
void setContourRange(int value) {
m_contourRange = value;
}
bool textureEnabled() const {
return m_textureEnabled;
}
void setTextureEnabled(bool value) {
m_textureEnabled = value;
}
KoPattern* texturePattern() const {
return m_texturePattern;
}
void setTexturePattern(KoPattern *value) {
m_texturePattern = value;
}
int textureScale() const {
return m_textureScale;
}
void setTextureScale(int value) {
m_textureScale = value;
}
int textureDepth() const {
return m_textureDepth;
}
void setTextureDepth(int value) {
m_textureDepth = value;
}
bool textureInvert() const {
return m_textureInvert;
}
void setTextureInvert(bool value) {
m_textureInvert = value;
}
bool textureAlignWithLayer() const {
return m_textureAlignWithLayer;
}
void setTextureAlignWithLayer(bool value) {
m_textureAlignWithLayer = value;
}
void setTexturePhase(const QPointF &phase) {
m_textureHorizontalPhase = phase.x();
m_textureVerticalPhase = phase.y();
}
QPointF texturePhase() const {
return QPointF(m_textureHorizontalPhase, m_textureVerticalPhase);
}
int textureHorizontalPhase() const {
return m_textureHorizontalPhase;
}
void setTextureHorizontalPhase(int value) {
m_textureHorizontalPhase = value;
}
int textureVerticalPhase() const {
return m_textureVerticalPhase;
}
void setTextureVerticalPhase(int value) {
m_textureVerticalPhase = value;
}
- virtual void scaleLinearSizes(qreal scale) {
+ void scaleLinearSizes(qreal scale) override {
psd_layer_effects_shadow_base::scaleLinearSizes(scale);
m_soften *= scale;
m_textureScale *= scale;
}
private:
psd_bevel_style m_style;
psd_technique_type m_technique;
int m_depth;
psd_direction m_direction; // Up or down
int m_soften; // Blur value in pixels.
int m_altitude;
quint8 m_glossContourLookupTable[256];
bool m_glossAntiAliased;
QString m_highlightBlendMode; // already in Krita format
QColor m_highlightColor;
qint32 m_highlightOpacity; // Hightlight opacity as a percent
QString m_shadowBlendMode; // already in Krita format
QColor m_shadowColor;
qint32 m_shadowOpacity; // Shadow opacity as a percent
bool m_contourEnabled;
int m_contourRange;
bool m_textureEnabled;
KoPattern *m_texturePattern;
int m_textureScale;
int m_textureDepth;
bool m_textureInvert;
bool m_textureAlignWithLayer;
int m_textureHorizontalPhase; // 0..100%
int m_textureVerticalPhase; // 0..100%
};
struct psd_layer_effects_overlay_base : public psd_layer_effects_shadow_base
{
psd_layer_effects_overlay_base()
: m_scale(100),
m_alignWithLayer(true),
m_reverse(false),
m_style(psd_gradient_style_linear),
m_gradientXOffset(0),
m_gradientYOffset(0),
m_pattern(0),
m_horizontalPhase(0),
m_verticalPhase(0)
{
setUseGlobalLight(false);
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setBlendMode;
// using psd_layer_effects_shadow_base::setOpacity;
int scale() const {
return m_scale;
}
bool alignWithLayer() const {
return m_alignWithLayer;
}
bool reverse() const {
return m_reverse;
}
psd_gradient_style style() const {
return m_style;
}
int gradientXOffset() const {
return m_gradientXOffset;
}
int gradientYOffset() const {
return m_gradientYOffset;
}
KoPattern* pattern() const {
return m_pattern;
}
int horizontalPhase() const {
return m_horizontalPhase;
}
int verticalPhase() const {
return m_verticalPhase;
}
// refactor that
public:
void setScale(int value) {
m_scale = value;
}
void setAlignWithLayer(bool value) {
m_alignWithLayer = value;
}
void setReverse(bool value) {
m_reverse = value;
}
void setStyle(psd_gradient_style value) {
m_style = value;
}
void setGradientOffset(const QPointF &pt) {
m_gradientXOffset = qRound(pt.x());
m_gradientYOffset = qRound(pt.y());
}
QPointF gradientOffset() const {
return QPointF(m_gradientXOffset, m_gradientYOffset);
}
void setPattern(KoPattern *value) {
m_pattern = value;
}
void setPatternPhase(const QPointF &phase) {
m_horizontalPhase = phase.x();
m_verticalPhase = phase.y();
}
QPointF patternPhase() const {
return QPointF(m_horizontalPhase, m_verticalPhase);
}
- virtual void scaleLinearSizes(qreal scale) {
+ void scaleLinearSizes(qreal scale) override {
psd_layer_effects_shadow_base::scaleLinearSizes(scale);
m_scale *= scale;
}
private:
// Gradient+Pattern
int m_scale;
bool m_alignWithLayer;
// Gradient
bool m_reverse;
psd_gradient_style m_style;
int m_gradientXOffset; // 0..100%
int m_gradientYOffset; // 0..100%
// Pattern
KoPattern *m_pattern;
int m_horizontalPhase; // 0..100%
int m_verticalPhase; // 0..100%
protected:
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// must be called in the derived classes' c-tor
// using psd_layer_effects_shadow_base::setFillType;
};
// sofi: http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_70055
struct psd_layer_effects_color_overlay : public psd_layer_effects_overlay_base
{
psd_layer_effects_color_overlay() {
setFillType(psd_fill_solid_color);
setColor(Qt::white);
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setColor;
};
struct psd_layer_effects_gradient_overlay : public psd_layer_effects_overlay_base
{
psd_layer_effects_gradient_overlay()
{
setFillType(psd_fill_gradient);
setAngle(90);
setReverse(false);
setScale(100);
setAlignWithLayer(true);
setStyle(psd_gradient_style_linear);
}
public:
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setGradient;
// using psd_layer_effects_shadow_base::setAngle;
// using psd_layer_effects_overlay_base::setReverse;
// using psd_layer_effects_overlay_base::setScale;
// using psd_layer_effects_overlay_base::setAlignWithLayer;
// using psd_layer_effects_overlay_base::setStyle;
// using psd_layer_effects_overlay_base::setGradientOffset;
// using psd_layer_effects_overlay_base::gradientOffset;
};
struct psd_layer_effects_pattern_overlay : public psd_layer_effects_overlay_base
{
psd_layer_effects_pattern_overlay()
{
setFillType(psd_fill_pattern);
setScale(100);
setAlignWithLayer(true);
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_overlay_base::setScale;
// using psd_layer_effects_overlay_base::setAlignWithLayer;
// using psd_layer_effects_overlay_base::setPattern;
// using psd_layer_effects_overlay_base::setPatternPhase;
// using psd_layer_effects_overlay_base::patternPhase;
private:
// These are unused
/*int m_scale;
bool m_alignWithLayer;
KoPattern *m_pattern;
int m_horizontalPhase;
int m_verticalPhase;*/
};
struct psd_layer_effects_stroke : public psd_layer_effects_overlay_base
{
psd_layer_effects_stroke()
: m_position(psd_stroke_outside)
{
setFillType(psd_fill_solid_color);
setColor(Qt::black);
setAngle(90);
setReverse(false);
setScale(100);
setAlignWithLayer(true);
setStyle(psd_gradient_style_linear);
setScale(100);
setAlignWithLayer(true);
}
/// FIXME: 'using' is not supported by MSVC, so please refactor in
/// some other way to ensure that the setters are not used
/// in the classes we don't want
// using psd_layer_effects_shadow_base::setFillType;
// using psd_layer_effects_shadow_base::setSize;
// using psd_layer_effects_shadow_base::setColor;
// using psd_layer_effects_shadow_base::setGradient;
// using psd_layer_effects_shadow_base::setAngle;
// using psd_layer_effects_overlay_base::setReverse;
// using psd_layer_effects_overlay_base::setScale;
// using psd_layer_effects_overlay_base::setAlignWithLayer;
// using psd_layer_effects_overlay_base::setStyle;
// using psd_layer_effects_overlay_base::setGradientOffset;
// using psd_layer_effects_overlay_base::gradientOffset;
// using psd_layer_effects_overlay_base::setPattern;
// using psd_layer_effects_overlay_base::setPatternPhase;
// using psd_layer_effects_overlay_base::patternPhase;
psd_stroke_position position() const {
return m_position;
}
void setPosition(psd_stroke_position value) {
m_position = value;
}
private:
psd_stroke_position m_position;
};
/**
* Convert PsdColorMode to pigment colormodelid and colordepthid.
* @see KoColorModelStandardIds
*
* @return a QPair containing ColorModelId and ColorDepthID
*/
QPair<QString, QString> KRITAPSD_EXPORT psd_colormode_to_colormodelid(psd_color_mode colormode, quint16 channelDepth);
/**
* Convert the Photoshop blend mode strings to Pigment compositeop id's
*/
QString KRITAPSD_EXPORT psd_blendmode_to_composite_op(const QString& blendmode);
QString KRITAPSD_EXPORT composite_op_to_psd_blendmode(const QString& compositeOp);
#endif // PSD_H
diff --git a/libs/store/KoDirectoryStore.h b/libs/store/KoDirectoryStore.h
index b8e89b3263..74b45f5427 100644
--- a/libs/store/KoDirectoryStore.h
+++ b/libs/store/KoDirectoryStore.h
@@ -1,63 +1,63 @@
/* This file is part of the KDE project
Copyright (C) 2002 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef koDirectoryStore_h
#define koDirectoryStore_h
#include "KoStore.h"
class QFile;
class KoDirectoryStore : public KoStore
{
public:
KoDirectoryStore(const QString& path, Mode _mode, bool writeMimetype);
- ~KoDirectoryStore();
+ ~KoDirectoryStore() override;
protected:
void init();
- virtual bool openWrite(const QString &name) {
+ bool openWrite(const QString &name) override {
return openReadOrWrite(name, QIODevice::WriteOnly);
}
- virtual bool openRead(const QString &name) {
+ bool openRead(const QString &name) override {
return openReadOrWrite(name, QIODevice::ReadOnly);
}
- virtual bool closeRead() {
+ bool closeRead() override {
return true;
}
- virtual bool closeWrite() {
+ bool closeWrite() override {
return true;
}
- virtual bool enterRelativeDirectory(const QString &dirName);
- virtual bool enterAbsoluteDirectory(const QString &path);
- virtual bool fileExists(const QString &absPath) const;
+ bool enterRelativeDirectory(const QString &dirName) override;
+ bool enterAbsoluteDirectory(const QString &path) override;
+ bool fileExists(const QString &absPath) const override;
bool openReadOrWrite(const QString &name, QIODevice::OpenModeFlag ioMode);
private:
// Path to base directory (== the ctor argument)
QString m_basePath;
// Path to current directory
QString m_currentPath;
// Current File
QFile* m_file;
Q_DECLARE_PRIVATE(KoStore)
};
#endif
diff --git a/libs/store/KoStoreDevice.h b/libs/store/KoStoreDevice.h
index e220afd200..e4379588da 100644
--- a/libs/store/KoStoreDevice.h
+++ b/libs/store/KoStoreDevice.h
@@ -1,85 +1,85 @@
/* This file is part of the KDE project
Copyright (C) 2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef koStoreDevice_h
#define koStoreDevice_h
#include "KoStore.h"
/**
* This class implements a QIODevice around KoStore, so that
* it can be used to create a QDomDocument from it, to be written or read
* using QDataStream or to be written using QTextStream
*/
class KoStoreDevice : public QIODevice
{
public:
/// Note: KoStore::open() should be called before calling this.
explicit KoStoreDevice(KoStore * store) : m_store(store) {
// calligra-1.x behavior compat: a KoStoreDevice is automatically open
setOpenMode(m_store->mode() == KoStore::Read ? QIODevice::ReadOnly : QIODevice::WriteOnly);
}
- ~KoStoreDevice() {}
+ ~KoStoreDevice() override {}
- virtual bool isSequential() const {
+ bool isSequential() const override {
return true;
}
- virtual bool open(OpenMode m) {
+ bool open(OpenMode m) override {
setOpenMode(m);
if (m & QIODevice::ReadOnly)
return (m_store->mode() == KoStore::Read);
if (m & QIODevice::WriteOnly)
return (m_store->mode() == KoStore::Write);
return false;
}
- virtual void close() {}
+ void close() override {}
- qint64 size() const {
+ qint64 size() const override {
if (m_store->mode() == KoStore::Read)
return m_store->size();
else
return 0xffffffff;
}
// See QIODevice
- virtual qint64 pos() const {
+ qint64 pos() const override {
return m_store->pos();
}
- virtual bool seek(qint64 pos) {
+ bool seek(qint64 pos) override {
return m_store->seek(pos);
}
- virtual bool atEnd() const {
+ bool atEnd() const override {
return m_store->atEnd();
}
protected:
KoStore *m_store;
- virtual qint64 readData(char *data, qint64 maxlen) {
+ qint64 readData(char *data, qint64 maxlen) override {
return m_store->read(data, maxlen);
}
- virtual qint64 writeData(const char *data, qint64 len) {
+ qint64 writeData(const char *data, qint64 len) override {
return m_store->write(data, len);
}
};
#endif
diff --git a/libs/store/KoXmlReader.h b/libs/store/KoXmlReader.h
index 0443dd8349..1a39f6762e 100644
--- a/libs/store/KoXmlReader.h
+++ b/libs/store/KoXmlReader.h
@@ -1,451 +1,451 @@
/* This file is part of the KDE project
Copyright (C) 2005-2006 Ariya Hidayat <ariya@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KO_XMLREADER_H
#define KO_XMLREADER_H
// KOXML_USE_QDOM is defined there
#include "KoXmlReaderForward.h"
#include "kritastore_export.h"
#include <QPair>
#include <QString>
class QIODevice;
#ifndef KOXML_USE_QDOM
class QXmlStreamReader;
class KoXmlNodeData;
class KoXmlDocumentData;
class QDomDocument;
class QStringList;
/**
* The office-text-content-prelude type.
*/
enum KoXmlNamedItemType {
KoXmlTextContentPrelude ///< office-text-content-prelude
//KoXmlTextContentMain, ///< office-text-content-main
//KoXmlTextContentEpilogue ///< office-text-content-epilogue
};
/**
* KoXmlNode represents a node in a DOM tree.
*
* KoXmlNode is a base class for KoXmlElement, KoXmlText.
* Often, these subclasses are used for getting the data instead of KoXmlNode.
* However, as base class, KoXmlNode is very helpful when for example iterating
* all child nodes within one parent node.
*
* KoXmlNode implements an explicit sharing, a node shares its data with
* other copies (if exist).
*
* XXX: DO NOT ADD CONVENIENCE API HERE BECAUSE THIS CLASS MUST REMAIN COMPATIBLE WITH QDOMNODE!
*
* @author Ariya Hidayat <ariya@kde.org>
*/
class KRITASTORE_EXPORT KoXmlNode
{
public:
enum NodeType {
NullNode = 0,
ElementNode,
TextNode,
CDATASectionNode,
ProcessingInstructionNode,
DocumentNode,
DocumentTypeNode
};
KoXmlNode();
KoXmlNode(const KoXmlNode& node);
KoXmlNode& operator=(const KoXmlNode& node);
bool operator== (const KoXmlNode&) const;
bool operator!= (const KoXmlNode&) const;
virtual ~KoXmlNode();
virtual KoXmlNode::NodeType nodeType() const;
virtual bool isNull() const;
virtual bool isElement() const;
virtual bool isText() const;
virtual bool isCDATASection() const;
virtual bool isDocument() const;
virtual bool isDocumentType() const;
virtual void clear();
KoXmlElement toElement() const;
KoXmlText toText() const;
KoXmlCDATASection toCDATASection() const;
KoXmlDocument toDocument() const;
virtual QString nodeName() const;
virtual QString namespaceURI() const;
virtual QString prefix() const;
virtual QString localName() const;
KoXmlDocument ownerDocument() const;
KoXmlNode parentNode() const;
bool hasChildNodes() const;
KoXmlNode firstChild() const;
KoXmlNode lastChild() const;
KoXmlNode nextSibling() const;
KoXmlNode previousSibling() const;
KoXmlElement firstChildElement() const;
// equivalent to node.childNodes().count() if node is a QDomNode instance
int childNodesCount() const;
// workaround to get and iterate over all attributes
QStringList attributeNames() const;
QList< QPair<QString, QString> > attributeFullNames() const;
KoXmlNode namedItem(const QString& name) const;
KoXmlNode namedItemNS(const QString& nsURI, const QString& name) const;
KoXmlNode namedItemNS(const QString& nsURI, const QString& name, KoXmlNamedItemType type) const;
/**
* Loads all child nodes (if any) of this node. Normally you do not need
* to call this function as the child nodes will be automatically
* loaded when necessary.
*/
void load(int depth = 1);
/**
* Releases all child nodes of this node.
*/
void unload();
// compatibility
/**
* @internal do not call directly
* Use KoXml::asQDomDocument(), KoXml::asQDomElement() or KoXml::asQDomNode() instead
*/
void asQDomNode(QDomDocument& ownerDoc) const;
protected:
KoXmlNodeData* d;
explicit KoXmlNode(KoXmlNodeData*);
};
/**
* KoXmlElement represents a tag element in a DOM tree.
*
* KoXmlElement holds information about an XML tag, along with its attributes.
*
* @author Ariya Hidayat <ariya@kde.org>
*/
class KRITASTORE_EXPORT KoXmlElement: public KoXmlNode
{
public:
KoXmlElement();
KoXmlElement(const KoXmlElement& element);
KoXmlElement& operator=(const KoXmlElement& element);
- virtual ~KoXmlElement();
+ ~KoXmlElement() override;
bool operator== (const KoXmlElement&) const;
bool operator!= (const KoXmlElement&) const;
QString tagName() const;
QString text() const;
QString attribute(const QString& name) const;
QString attribute(const QString& name, const QString& defaultValue) const;
QString attributeNS(const QString& namespaceURI, const QString& localName,
const QString& defaultValue = QString()) const;
bool hasAttribute(const QString& name) const;
bool hasAttributeNS(const QString& namespaceURI, const QString& localName) const;
private:
friend class KoXmlNode;
friend class KoXmlDocument;
explicit KoXmlElement(KoXmlNodeData*);
};
/**
* KoXmlText represents a text in a DOM tree.
* @author Ariya Hidayat <ariya@kde.org>
*/
class KRITASTORE_EXPORT KoXmlText: public KoXmlNode
{
public:
KoXmlText();
KoXmlText(const KoXmlText& text);
KoXmlText& operator=(const KoXmlText& text);
- virtual ~KoXmlText();
+ ~KoXmlText() override;
QString data() const;
- virtual bool isText() const;
+ bool isText() const override;
private:
friend class KoXmlNode;
friend class KoXmlCDATASection;
friend class KoXmlDocument;
explicit KoXmlText(KoXmlNodeData*);
};
/**
* KoXmlCDATASection represents a CDATA section in a DOM tree.
* @author Ariya Hidayat <ariya@kde.org>
*/
class KRITASTORE_EXPORT KoXmlCDATASection: public KoXmlText
{
public:
KoXmlCDATASection();
KoXmlCDATASection(const KoXmlCDATASection& cdata);
KoXmlCDATASection& operator=(const KoXmlCDATASection& cdata);
- virtual ~KoXmlCDATASection();
+ ~KoXmlCDATASection() override;
- virtual bool isCDATASection() const;
+ bool isCDATASection() const override;
private:
friend class KoXmlNode;
friend class KoXmlDocument;
explicit KoXmlCDATASection(KoXmlNodeData*);
};
/**
* KoXmlDocumentType represents the DTD of the document. At the moment,
* it can used only to get the document type, i.e. no support for
* entities etc.
*
* @author Ariya Hidayat <ariya@kde.org>
*/
class KRITASTORE_EXPORT KoXmlDocumentType: public KoXmlNode
{
public:
KoXmlDocumentType();
KoXmlDocumentType(const KoXmlDocumentType&);
KoXmlDocumentType& operator=(const KoXmlDocumentType&);
- virtual ~KoXmlDocumentType();
+ ~KoXmlDocumentType() override;
QString name() const;
private:
friend class KoXmlNode;
friend class KoXmlDocument;
friend class KoXmlDocumentData;
explicit KoXmlDocumentType(KoXmlNodeData*);
};
/**
* KoXmlDocument represents an XML document, structured in a DOM tree.
*
* KoXmlDocument is designed to be memory efficient. Unlike QDomDocument from
* Qt's XML module, KoXmlDocument does not store all nodes in the DOM tree.
* Some nodes will be loaded and parsed on-demand only.
*
* KoXmlDocument is read-only, you can not modify its content.
*
* @author Ariya Hidayat <ariya@kde.org>
*/
class KRITASTORE_EXPORT KoXmlDocument: public KoXmlNode
{
public:
explicit KoXmlDocument(bool stripSpaces = false);
KoXmlDocument(const KoXmlDocument& node);
KoXmlDocument& operator=(const KoXmlDocument& node);
bool operator==(const KoXmlDocument&) const;
bool operator!=(const KoXmlDocument&) const;
- virtual ~KoXmlDocument();
+ ~KoXmlDocument() override;
KoXmlElement documentElement() const;
KoXmlDocumentType doctype() const;
- virtual QString nodeName() const;
- virtual void clear();
+ QString nodeName() const override;
+ void clear() override;
bool setContent(QIODevice* device, bool namespaceProcessing,
QString* errorMsg = 0, int* errorLine = 0, int* errorColumn = 0);
bool setContent(QIODevice* device,
QString* errorMsg = 0, int* errorLine = 0, int* errorColumn = 0);
bool setContent(QXmlStreamReader *reader,
QString* errorMsg = 0, int* errorLine = 0, int* errorColumn = 0);
bool setContent(const QByteArray& text, bool namespaceProcessing,
QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);
bool setContent(const QString& text, bool namespaceProcessing,
QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);
// no namespace processing
bool setContent(const QString& text,
QString *errorMsg = 0, int *errorLine = 0, int *errorColumn = 0);
/**
* Change the way an XMLDocument will be read: <a> <b/> <a/>
* if stripSpaces = true then a will only have one child
* if stripSpaces = false then a will have 3 children.
*/
void setWhitespaceStripping(bool stripSpaces);
private:
friend class KoXmlNode;
explicit KoXmlDocument(KoXmlDocumentData*);
};
#endif // KOXML_USE_QDOM
/**
* This namespace contains a few convenience functions to simplify code using QDom
* (when loading OASIS documents, in particular).
*
* To find the child element with a given name, use KoXml::namedItemNS.
*
* To find all child elements with a given name, use
* QDomElement e;
* forEachElement( e, parent )
* {
* if ( e.localName() == "..." && e.namespaceURI() == KoXmlNS::... )
* {
* ...
* }
* }
* Note that this means you don't ever need to use QDomNode nor toElement anymore!
* Also note that localName is the part without the prefix, this is the whole point
* of namespace-aware methods.
*
* To find the attribute with a given name, use QDomElement::attributeNS.
*
* Do not use getElementsByTagNameNS, it's recursive (which is never needed in Calligra).
* Do not use tagName() or nodeName() or prefix(), since the prefix isn't fixed.
*
* @author David Faure <faure@kde.org>
*/
namespace KoXml
{
/**
* A namespace-aware version of QDomNode::namedItem(),
* which also takes care of casting to a QDomElement.
*
* Use this when a domelement is known to have only *one* child element
* with a given tagname.
*
* Note: do *NOT* use getElementsByTagNameNS, it's recursive!
*/
KRITASTORE_EXPORT KoXmlElement namedItemNS(const KoXmlNode& node,
const QString& nsURI, const QString& localName);
/**
* A namespace-aware version of QDomNode::namedItem().
* which also takes care of casting to a QDomElement.
*
* Use this when you like to return the first or an invalid
* KoXmlElement with a known type.
*
* This is an optimized version of the namedItemNS above to
* give fast access to certain sections of the document using
* the office-text-content-prelude condition as @a KoXmlNamedItemType .
*/
KRITASTORE_EXPORT KoXmlElement namedItemNS(const KoXmlNode& node,
const QString& nsURI, const QString& localName,
KoXmlNamedItemType type);
/**
* Explicitly load child nodes of specified node, up to given depth.
* This function has no effect if QDom is used.
*/
KRITASTORE_EXPORT void load(KoXmlNode& node, int depth = 1);
/**
* Unload child nodes of specified node.
* This function has no effect if QDom is used.
*/
KRITASTORE_EXPORT void unload(KoXmlNode& node);
/**
* Get the number of child nodes of specified node.
*/
KRITASTORE_EXPORT int childNodesCount(const KoXmlNode& node);
/**
* Return the name of all attributes of specified node.
*/
KRITASTORE_EXPORT QStringList attributeNames(const KoXmlNode& node);
/**
* Convert KoXmlNode classes to the corresponding QDom classes, which has
* @p ownerDoc as the owner document (QDomDocument instance).
* The converted @p node (and its children) are added to ownerDoc.
*
* NOTE:
* - If ownerDoc is not empty, this may fail, @see QDomDocument
* - @p node must not be a KoXmlDocument, use asQDomDocument()
*
* @see asQDomDocument, asQDomElement
*/
KRITASTORE_EXPORT void asQDomNode(QDomDocument& ownerDoc, const KoXmlNode& node);
/**
* Convert KoXmlNode classes to the corresponding QDom classes, which has
* @p ownerDoc as the owner document (QDomDocument instance).
* The converted @p element (and its children) is added to ownerDoc.
*
* NOTE: If ownerDoc is not empty, this may fail, @see QDomDocument
*
*/
KRITASTORE_EXPORT void asQDomElement(QDomDocument& ownerDoc, const KoXmlElement& element);
/**
* Converts the whole @p document into a QDomDocument
* If KOXML_USE_QDOM is defined, just returns @p document
*/
KRITASTORE_EXPORT QDomDocument asQDomDocument(const KoXmlDocument& document);
/*
* Load an XML document from specified device to a document. You can of
* course use it with QFile (which inherits QIODevice).
* This is much more memory efficient than standard QDomDocument::setContent
* because the data from the device is buffered, unlike
* QDomDocument::setContent which just loads everything in memory.
*
* Note: it is assumed that the XML uses UTF-8 encoding.
*/
KRITASTORE_EXPORT bool setDocument(KoXmlDocument& doc, QIODevice* device,
bool namespaceProcessing, QString* errorMsg = 0,
int* errorLine = 0, int* errorColumn = 0);
}
/**
* \def forEachElement( elem, parent )
* \brief Loop through all child elements of \parent.
* This convenience macro is used to implement the forEachElement loop.
* The \elem parameter is a name of a QDomElement variable and the \parent
* is the name of the parent element. For example:
*
* QDomElement e;
* forEachElement( e, parent )
* {
* qDebug() << e.localName() << " element found.";
* ...
* }
*/
#define forEachElement( elem, parent ) \
for ( KoXmlNode _node = parent.firstChild(); !_node.isNull(); _node = _node.nextSibling() ) \
if ( ( elem = _node.toElement() ).isNull() ) {} else
#endif // KO_XMLREADER_H
diff --git a/libs/store/KoZipStore.cpp b/libs/store/KoZipStore.cpp
index 68b867af34..0d31da3c4d 100644
--- a/libs/store/KoZipStore.cpp
+++ b/libs/store/KoZipStore.cpp
@@ -1,273 +1,273 @@
/* This file is part of the KDE project
Copyright (C) 2000-2002 David Faure <faure@kde.org>
Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoZipStore.h"
#include "KoStore_p.h"
#include <QBuffer>
#include <QByteArray>
#include <QTemporaryFile>
#include <kzip.h>
#include <StoreDebug.h>
#include <QUrl>
class SaveZip : public KZip {
public:
SaveZip(const QString &filename) : KZip(filename) {}
SaveZip(QIODevice *dev) : KZip(dev) {}
- virtual ~SaveZip() {}
+ ~SaveZip() override {}
void resetDevice() {
closeArchive();
setDevice(0);
}
};
KoZipStore::KoZipStore(const QString & _filename, Mode mode, const QByteArray & appIdentification,
bool writeMimetype)
: KoStore(mode, writeMimetype)
{
// qDebug() << "KoZipStore Constructor filename =" << _filename
// << " mode = " << int(mode)
// << " mimetype = " << appIdentification;
Q_D(KoStore);
d->localFileName = _filename;
m_pZip = new SaveZip(_filename);
init(appIdentification); // open the zip file and init some vars
}
KoZipStore::KoZipStore(QIODevice *dev, Mode mode, const QByteArray & appIdentification,
bool writeMimetype)
: KoStore(mode, writeMimetype)
{
// qDebug() << "KoZipStore Constructor device =" << dev
// << " mode = " << int(mode)
// << " mimetype = " << appIdentification;
m_pZip = new SaveZip(dev);
init(appIdentification);
}
KoZipStore::KoZipStore(QWidget* window, const QUrl &_url, const QString & _filename, Mode mode,
const QByteArray & appIdentification, bool writeMimetype)
: KoStore(mode, writeMimetype)
{
debugStore << "KoZipStore Constructor url" << _url.url(QUrl::PreferLocalFile)
<< " filename = " << _filename
<< " mode = " << int(mode)
<< " mimetype = " << appIdentification;
Q_D(KoStore);
d->url = _url;
d->window = window;
if (mode == KoStore::Read) {
d->localFileName = _filename;
} else {
QTemporaryFile f("kozip");
f.open();
d->localFileName = f.fileName();
f.close();
}
m_pZip = new SaveZip(d->localFileName);
init(appIdentification); // open the zip file and init some vars
}
KoZipStore::~KoZipStore()
{
Q_D(KoStore);
bool sf = false;
if (m_pZip && m_pZip->device()) {
sf = true;
}
// qDebug() << "KoZipStore::~KoZipStore" << d->localFileName << m_pZip << m_pZip->device() << "savefile" << sf;
if (m_pZip->device() && m_pZip->device()->inherits("QSaveFile")) {
m_pZip->resetDevice(); // otherwise, kzip's destructor will call close(), which aborts on a qsavefile
}
else {
if (!d->finalized) {
finalize(); // ### no error checking when the app forgot to call finalize itself
}
}
delete m_pZip;
// When writing, we write to a temp file that then gets copied over the original filename
if (d->mode == Write && (!d->localFileName.isEmpty() && !d->url.isEmpty())) {
QFile f(d->localFileName);
if (f.copy(d->url.toLocalFile())) {
f.remove();
}
}
}
void KoZipStore::init(const QByteArray& appIdentification)
{
Q_D(KoStore);
m_currentDir = 0;
d->good = m_pZip->open(d->mode == Write ? QIODevice::WriteOnly : QIODevice::ReadOnly);
if (!d->good)
return;
if (d->mode == Write) {
//debugStore <<"KoZipStore::init writing mimetype" << appIdentification;
m_pZip->setCompression(KZip::NoCompression);
m_pZip->setExtraField(KZip::NoExtraField);
// Write identification
if (d->writeMimetype) {
(void)m_pZip->writeFile(QLatin1String("mimetype"), appIdentification);
}
m_pZip->setCompression(KZip::DeflateCompression);
// We don't need the extra field in Krita - so we leave it as "no extra field".
} else {
d->good = m_pZip->directory() != 0;
}
}
void KoZipStore::setCompressionEnabled(bool e)
{
if (e) {
m_pZip->setCompression(KZip::DeflateCompression);
} else {
m_pZip->setCompression(KZip::NoCompression);
}
}
bool KoZipStore::doFinalize()
{
if (m_pZip && m_pZip->device() && !m_pZip->device()->inherits("QSaveFile")) {
return m_pZip->close();
}
else {
return true;
}
}
bool KoZipStore::openWrite(const QString& name)
{
Q_D(KoStore);
d->stream = 0; // Don't use!
return m_pZip->prepareWriting(name, "", "" /*m_pZip->rootDir()->user(), m_pZip->rootDir()->group()*/, 0);
}
bool KoZipStore::openRead(const QString& name)
{
Q_D(KoStore);
const KArchiveEntry * entry = m_pZip->directory()->entry(name);
if (entry == 0) {
return false;
}
if (entry->isDirectory()) {
warnStore << name << " is a directory !";
return false;
}
// Must cast to KZipFileEntry, not only KArchiveFile, because device() isn't virtual!
const KZipFileEntry * f = static_cast<const KZipFileEntry *>(entry);
delete d->stream;
d->stream = f->createDevice();
d->size = f->size();
return true;
}
qint64 KoZipStore::write(const char* _data, qint64 _len)
{
Q_D(KoStore);
if (_len == 0) return 0;
//debugStore <<"KoZipStore::write" << _len;
if (!d->isOpen) {
errorStore << "KoStore: You must open before writing" << endl;
return 0;
}
if (d->mode != Write) {
errorStore << "KoStore: Can not write to store that is opened for reading" << endl;
return 0;
}
d->size += _len;
if (m_pZip->writeData(_data, _len)) // writeData returns a bool!
return _len;
return 0;
}
QStringList KoZipStore::directoryList() const
{
QStringList retval;
const KArchiveDirectory *directory = m_pZip->directory();
Q_FOREACH (const QString &name, directory->entries()) {
const KArchiveEntry* fileArchiveEntry = m_pZip->directory()->entry(name);
if (fileArchiveEntry->isDirectory()) {
retval << name;
}
}
return retval;
}
bool KoZipStore::closeWrite()
{
Q_D(KoStore);
debugStore << "Wrote file" << d->fileName << " into ZIP archive. size" << d->size;
return m_pZip->finishWriting(d->size);
}
bool KoZipStore::enterRelativeDirectory(const QString& dirName)
{
Q_D(KoStore);
if (d->mode == Read) {
if (!m_currentDir) {
m_currentDir = m_pZip->directory(); // initialize
Q_ASSERT(d->currentPath.isEmpty());
}
const KArchiveEntry *entry = m_currentDir->entry(dirName);
if (entry && entry->isDirectory()) {
m_currentDir = dynamic_cast<const KArchiveDirectory*>(entry);
return m_currentDir != 0;
}
return false;
} else // Write, no checking here
return true;
}
bool KoZipStore::enterAbsoluteDirectory(const QString& path)
{
if (path.isEmpty()) {
m_currentDir = 0;
return true;
}
m_currentDir = dynamic_cast<const KArchiveDirectory*>(m_pZip->directory()->entry(path));
Q_ASSERT(m_currentDir);
return m_currentDir != 0;
}
bool KoZipStore::fileExists(const QString& absPath) const
{
const KArchiveEntry *entry = m_pZip->directory()->entry(absPath);
return entry && entry->isFile();
}
diff --git a/libs/store/KoZipStore.h b/libs/store/KoZipStore.h
index b45964d139..b1a4c0409f 100644
--- a/libs/store/KoZipStore.h
+++ b/libs/store/KoZipStore.h
@@ -1,73 +1,73 @@
/* This file is part of the KDE project
Copyright (C) 2002 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef koZipStore_h
#define koZipStore_h
#include "KoStore.h"
class SaveZip;
class KArchiveDirectory;
class QUrl;
class KoZipStore : public KoStore
{
public:
KoZipStore(const QString & _filename, Mode _mode, const QByteArray & appIdentification,
bool writeMimetype = true);
KoZipStore(QIODevice *dev, Mode mode, const QByteArray & appIdentification,
bool writeMimetype = true);
/**
* QUrl-constructor
* @todo saving not completely implemented (fixed temporary file)
*/
KoZipStore(QWidget* window, const QUrl &_url, const QString & _filename, Mode _mode,
const QByteArray & appIdentification, bool writeMimetype = true);
- ~KoZipStore();
+ ~KoZipStore() override;
- virtual void setCompressionEnabled(bool e);
- virtual qint64 write(const char* _data, qint64 _len);
+ void setCompressionEnabled(bool e) override;
+ qint64 write(const char* _data, qint64 _len) override;
- virtual QStringList directoryList() const;
+ QStringList directoryList() const override;
protected:
void init(const QByteArray& appIdentification);
- virtual bool doFinalize();
- virtual bool openWrite(const QString& name);
- virtual bool openRead(const QString& name);
- virtual bool closeWrite();
- virtual bool closeRead() {
+ bool doFinalize() override;
+ bool openWrite(const QString& name) override;
+ bool openRead(const QString& name) override;
+ bool closeWrite() override;
+ bool closeRead() override {
return true;
}
- virtual bool enterRelativeDirectory(const QString& dirName);
- virtual bool enterAbsoluteDirectory(const QString& path);
- virtual bool fileExists(const QString& absPath) const;
+ bool enterRelativeDirectory(const QString& dirName) override;
+ bool enterAbsoluteDirectory(const QString& path) override;
+ bool fileExists(const QString& absPath) const override;
private:
// The archive
SaveZip * m_pZip;
// In "Read" mode this pointer is pointing to the current directory in the archive to speed up the verification process
const KArchiveDirectory* m_currentDir;
Q_DECLARE_PRIVATE(KoStore)
};
#endif
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index c71f9bee6f..1634bfdde4 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -1,552 +1,553 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/qtlockedfile
${EXIV2_INCLUDE_DIR}
)
include_directories(SYSTEM
${EIGEN3_INCLUDE_DIR}
${OCIO_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
add_subdirectory( tests )
if (APPLE)
find_library(FOUNDATION_LIBRARY Foundation)
endif ()
set(kritaui_LIB_SRCS
canvas/kis_canvas_widget_base.cpp
canvas/kis_canvas2.cpp
canvas/kis_canvas_updates_compressor.cpp
canvas/kis_canvas_controller.cpp
canvas/kis_paintop_transformation_connector.cpp
canvas/kis_display_color_converter.cpp
canvas/kis_display_filter.cpp
canvas/kis_exposure_gamma_correction_interface.cpp
canvas/kis_tool_proxy.cpp
canvas/kis_canvas_decoration.cc
canvas/kis_coordinates_converter.cpp
canvas/kis_grid_manager.cpp
canvas/kis_grid_decoration.cpp
canvas/kis_grid_config.cpp
canvas/kis_prescaled_projection.cpp
canvas/kis_qpainter_canvas.cpp
canvas/kis_projection_backend.cpp
canvas/kis_update_info.cpp
canvas/kis_image_patch.cpp
canvas/kis_image_pyramid.cpp
canvas/kis_infinity_manager.cpp
canvas/kis_change_guides_command.cpp
canvas/kis_guides_decoration.cpp
canvas/kis_guides_manager.cpp
canvas/kis_guides_config.cpp
canvas/kis_snap_config.cpp
canvas/kis_snap_line_strategy.cpp
canvas/KisSnapPointStrategy.cpp
dialogs/kis_about_application.cpp
dialogs/kis_dlg_adj_layer_props.cc
dialogs/kis_dlg_adjustment_layer.cc
dialogs/kis_dlg_filter.cpp
dialogs/kis_dlg_generator_layer.cpp
dialogs/kis_dlg_file_layer.cpp
dialogs/kis_dlg_filter.cpp
dialogs/kis_dlg_stroke_selection_properties.cpp
dialogs/kis_dlg_image_properties.cc
dialogs/kis_dlg_layer_properties.cc
dialogs/kis_dlg_preferences.cc
dialogs/slider_and_spin_box_sync.cpp
dialogs/kis_dlg_blacklist_cleanup.cpp
dialogs/kis_dlg_layer_style.cpp
dialogs/kis_dlg_png_import.cpp
dialogs/kis_dlg_import_image_sequence.cpp
dialogs/kis_delayed_save_dialog.cpp
dialogs/kis_dlg_internal_color_selector.cpp
flake/kis_node_dummies_graph.cpp
flake/kis_dummies_facade_base.cpp
flake/kis_dummies_facade.cpp
flake/kis_node_shapes_graph.cpp
flake/kis_node_shape.cpp
flake/kis_shape_controller.cpp
flake/kis_shape_layer.cc
flake/kis_shape_layer_canvas.cpp
flake/kis_shape_selection.cpp
flake/kis_shape_selection_canvas.cpp
flake/kis_shape_selection_model.cpp
flake/kis_take_all_shapes_command.cpp
brushhud/kis_uniform_paintop_property_widget.cpp
brushhud/kis_brush_hud.cpp
brushhud/kis_round_hud_button.cpp
brushhud/kis_dlg_brush_hud_config.cpp
brushhud/kis_brush_hud_properties_list.cpp
brushhud/kis_brush_hud_properties_config.cpp
kis_aspect_ratio_locker.cpp
kis_autogradient.cc
kis_bookmarked_configurations_editor.cc
kis_bookmarked_configurations_model.cc
kis_bookmarked_filter_configurations_model.cc
kis_base_option.cpp
kis_canvas_resource_provider.cpp
kis_derived_resources.cpp
kis_categories_mapper.cpp
kis_categorized_list_model.cpp
kis_categorized_item_delegate.cpp
kis_clipboard.cc
kis_config.cc
kis_config_notifier.cpp
kis_control_frame.cpp
kis_composite_ops_model.cc
kis_paint_ops_model.cpp
kis_cursor.cc
kis_cursor_cache.cpp
kis_custom_pattern.cc
kis_file_layer.cpp
kis_safe_document_loader.cpp
kis_splash_screen.cpp
kis_filter_manager.cc
kis_filters_model.cc
kis_histogram_view.cc
KisImageBarrierLockerWithFeedback.cpp
kis_image_manager.cc
kis_image_view_converter.cpp
kis_import_catcher.cc
kis_layer_manager.cc
kis_mask_manager.cc
kis_mimedata.cpp
kis_node_commands_adapter.cpp
kis_node_manager.cpp
kis_node_juggler_compressed.cpp
kis_node_selection_adapter.cpp
kis_node_insertion_adapter.cpp
kis_node_model.cpp
kis_node_filter_proxy_model.cpp
kis_model_index_converter_base.cpp
kis_model_index_converter.cpp
kis_model_index_converter_show_all.cpp
kis_painting_assistant.cc
kis_painting_assistants_decoration.cpp
kis_painting_assistants_manager.cpp
kis_paintop_box.cc
kis_paintop_option.cpp
kis_paintop_options_model.cpp
kis_paintop_settings_widget.cpp
kis_popup_palette.cpp
kis_png_converter.cpp
kis_preference_set_registry.cpp
kis_script_manager.cpp
kis_resource_server_provider.cpp
KisSelectedShapesProxy.cpp
kis_selection_decoration.cc
kis_selection_manager.cc
kis_statusbar.cc
kis_zoom_manager.cc
kis_favorite_resource_manager.cpp
kis_workspace_resource.cpp
kis_action.cpp
kis_action_manager.cpp
kis_view_plugin.cpp
kis_canvas_controls_manager.cpp
kis_tooltip_manager.cpp
kis_multinode_property.cpp
kis_stopgradient_editor.cpp
kisexiv2/kis_exif_io.cpp
kisexiv2/kis_exiv2.cpp
kisexiv2/kis_iptc_io.cpp
kisexiv2/kis_xmp_io.cpp
opengl/kis_opengl.cpp
opengl/kis_opengl_canvas2.cpp
opengl/kis_opengl_canvas_debugger.cpp
opengl/kis_opengl_image_textures.cpp
opengl/kis_texture_tile.cpp
opengl/kis_opengl_shader_loader.cpp
kis_fps_decoration.cpp
recorder/kis_node_query_path_editor.cc
recorder/kis_recorded_action_creator.cc
recorder/kis_recorded_action_creator_factory.cc
recorder/kis_recorded_action_creator_factory_registry.cc
recorder/kis_recorded_action_editor_factory.cc
recorder/kis_recorded_action_editor_factory_registry.cc
recorder/kis_recorded_filter_action_editor.cc
recorder/kis_recorded_filter_action_creator.cpp
recorder/kis_recorded_paint_action_editor.cc
tool/kis_selection_tool_helper.cpp
tool/kis_selection_tool_config_widget_helper.cpp
tool/kis_rectangle_constraint_widget.cpp
tool/kis_shape_tool_helper.cpp
tool/kis_tool.cc
tool/kis_delegated_tool_policies.cpp
tool/kis_tool_freehand.cc
tool/kis_speed_smoother.cpp
tool/kis_painting_information_builder.cpp
tool/kis_stabilized_events_sampler.cpp
tool/kis_tool_freehand_helper.cpp
tool/kis_tool_multihand_helper.cpp
tool/kis_figure_painting_tool_helper.cpp
tool/kis_recording_adapter.cpp
tool/kis_tool_paint.cc
tool/kis_tool_shape.cc
tool/kis_tool_ellipse_base.cpp
tool/kis_tool_rectangle_base.cpp
tool/kis_tool_polyline_base.cpp
tool/kis_tool_utils.cpp
tool/kis_resources_snapshot.cpp
tool/kis_smoothing_options.cpp
tool/KisStabilizerDelayedPaintHelper.cpp
tool/strokes/freehand_stroke.cpp
tool/strokes/kis_painter_based_stroke_strategy.cpp
tool/strokes/kis_filter_stroke_strategy.cpp
tool/strokes/kis_color_picker_stroke_strategy.cpp
widgets/kis_cmb_composite.cc
widgets/kis_cmb_contour.cpp
widgets/kis_cmb_gradient.cpp
widgets/kis_paintop_list_widget.cpp
widgets/kis_cmb_idlist.cc
widgets/kis_color_space_selector.cc
widgets/kis_advanced_color_space_selector.cc
widgets/kis_cie_tongue_widget.cpp
widgets/kis_tone_curve_widget.cpp
widgets/kis_curve_widget.cpp
widgets/kis_custom_image_widget.cc
widgets/kis_image_from_clipboard_widget.cpp
widgets/kis_double_widget.cc
widgets/kis_filter_selector_widget.cc
widgets/kis_gradient_chooser.cc
widgets/kis_gradient_slider_widget.cc
widgets/kis_gradient_slider.cpp
widgets/kis_iconwidget.cc
widgets/kis_mask_widgets.cpp
widgets/kis_meta_data_merge_strategy_chooser_widget.cc
widgets/kis_multi_bool_filter_widget.cc
widgets/kis_multi_double_filter_widget.cc
widgets/kis_multi_integer_filter_widget.cc
widgets/kis_multipliers_double_slider_spinbox.cpp
widgets/kis_paintop_presets_popup.cpp
widgets/kis_tool_options_popup.cpp
widgets/kis_paintop_presets_chooser_popup.cpp
widgets/kis_pattern_chooser.cc
widgets/kis_popup_button.cc
widgets/kis_preset_chooser.cpp
widgets/kis_progress_widget.cpp
widgets/kis_selection_options.cc
widgets/kis_scratch_pad.cpp
widgets/kis_scratch_pad_event_filter.cpp
widgets/kis_preset_selector_strip.cpp
widgets/kis_slider_spin_box.cpp
widgets/kis_size_group.cpp
widgets/kis_size_group_p.cpp
widgets/kis_wdg_generator.cpp
widgets/kis_workspace_chooser.cpp
widgets/squeezedcombobox.cpp
widgets/kis_categorized_list_view.cpp
widgets/kis_widget_chooser.cpp
widgets/kis_tool_button.cpp
widgets/kis_floating_message.cpp
widgets/kis_lod_availability_widget.cpp
widgets/kis_color_label_selector_widget.cpp
widgets/kis_color_filter_combo.cpp
widgets/kis_elided_label.cpp
widgets/kis_stopgradient_slider_widget.cpp
widgets/kis_spinbox_color_selector.cpp
widgets/kis_screen_color_picker.cpp
widgets/KoDualColorButton.cpp
widgets/kis_color_input.cpp
widgets/kis_color_button.cpp
widgets/KisVisualColorSelector.cpp
widgets/KisVisualColorSelectorShape.cpp
widgets/KisVisualEllipticalSelectorShape.cpp
widgets/KisVisualRectangleSelectorShape.cpp
widgets/KisVisualTriangleSelectorShape.cpp
widgets/KoStrokeConfigWidget.cpp
widgets/KoFillConfigWidget.cpp
widgets/KoShapeFillWrapper.cpp
utils/kis_document_aware_spin_box_unit_manager.cpp
input/kis_input_manager.cpp
input/kis_input_manager_p.cpp
input/kis_extended_modifiers_mapper.cpp
input/kis_abstract_input_action.cpp
input/kis_tool_invocation_action.cpp
input/kis_pan_action.cpp
input/kis_alternate_invocation_action.cpp
input/kis_rotate_canvas_action.cpp
input/kis_zoom_action.cpp
input/kis_change_frame_action.cpp
input/kis_gamma_exposure_action.cpp
input/kis_show_palette_action.cpp
input/kis_change_primary_setting_action.cpp
input/kis_abstract_shortcut.cpp
input/kis_single_action_shortcut.cpp
input/kis_stroke_shortcut.cpp
input/kis_shortcut_matcher.cpp
input/kis_select_layer_action.cpp
operations/kis_operation.cpp
operations/kis_operation_configuration.cpp
operations/kis_operation_registry.cpp
operations/kis_operation_ui_factory.cpp
operations/kis_operation_ui_widget.cpp
operations/kis_filter_selection_operation.cpp
actions/kis_selection_action_factories.cpp
actions/KisPasteActionFactory.cpp
input/kis_touch_shortcut.cpp
kis_document_undo_store.cpp
kis_transaction_based_command.cpp
kis_gui_context_command.cpp
kis_gui_context_command_p.cpp
input/kis_tablet_debugger.cpp
input/kis_input_profile_manager.cpp
input/kis_input_profile.cpp
input/kis_shortcut_configuration.cpp
input/config/kis_input_configuration_page.cpp
input/config/kis_edit_profiles_dialog.cpp
input/config/kis_input_profile_model.cpp
input/config/kis_input_configuration_page_item.cpp
input/config/kis_action_shortcuts_model.cpp
input/config/kis_input_type_delegate.cpp
input/config/kis_input_mode_delegate.cpp
input/config/kis_input_button.cpp
input/config/kis_input_editor_delegate.cpp
input/config/kis_mouse_input_editor.cpp
input/config/kis_wheel_input_editor.cpp
input/config/kis_key_input_editor.cpp
processing/fill_processing_visitor.cpp
kis_asl_layer_style_serializer.cpp
kis_psd_layer_style_resource.cpp
canvas/kis_mirror_axis.cpp
kis_abstract_perspective_grid.cpp
KisApplication.cpp
KisAutoSaveRecoveryDialog.cpp
KisDetailsPane.cpp
KisDocument.cpp
KisNodeDelegate.cpp
kis_node_view_visibility_delegate.cpp
KisNodeToolTip.cpp
KisNodeView.cpp
kis_node_view_color_scheme.cpp
KisImportExportFilter.cpp
KisFilterEntry.cpp
KisImportExportManager.cpp
kis_async_action_feedback.cpp
KisMainWindow.cpp
KisOpenPane.cpp
KisPart.cpp
KisPrintJob.cpp
KisTemplate.cpp
KisTemplateCreateDia.cpp
KisTemplateGroup.cpp
KisTemplates.cpp
KisTemplatesPane.cpp
KisTemplateTree.cpp
KisUndoStackAction.cpp
KisView.cpp
thememanager.cpp
kis_mainwindow_observer.cpp
KisViewManager.cpp
kis_mirror_manager.cpp
qtlockedfile/qtlockedfile.cpp
qtsingleapplication/qtlocalpeer.cpp
qtsingleapplication/qtsingleapplication.cpp
KisResourceBundle.cpp
KisResourceBundleManifest.cpp
kis_md5_generator.cpp
KisApplicationArguments.cpp
KisNetworkAccessManager.cpp
KisMultiFeedRSSModel.cpp
KisRemoteFileFetcher.cpp
KisPaletteModel.cpp
kis_palette_delegate.cpp
kis_palette_view.cpp
KisColorsetChooser.cpp
KisSaveGroupVisitor.cpp
)
if(WIN32)
if (NOT Qt5Gui_PRIVATE_INCLUDE_DIRS)
message(FATAL_ERROR "Qt5Gui Private header are missing!")
endif()
set(kritaui_LIB_SRCS
${kritaui_LIB_SRCS}
input/kis_tablet_event.cpp
input/wintab/kis_tablet_support_win.cpp
input/wintab/kis_screen_size_choice_dialog.cpp
qtlockedfile/qtlockedfile_win.cpp
)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
endif()
set(kritaui_LIB_SRCS
${kritaui_LIB_SRCS}
kis_animation_frame_cache.cpp
kis_animation_cache_populator.cpp
KisAnimationCacheRegenerator.cpp
dialogs/KisAnimationCacheUpdateProgressDialog.cpp
canvas/kis_animation_player.cpp
kis_animation_exporter.cpp
kis_animation_importer.cpp
KisSyncedAudioPlayback.cpp
)
if(UNIX)
set(kritaui_LIB_SRCS
${kritaui_LIB_SRCS}
input/kis_tablet_event.cpp
input/wintab/kis_tablet_support.cpp
qtlockedfile/qtlockedfile_unix.cpp
)
if(NOT APPLE)
set(kritaui_LIB_SRCS
${kritaui_LIB_SRCS}
input/wintab/kis_tablet_support_x11.cpp
input/wintab/qxcbconnection_xi2.cpp
input/wintab/qxcbconnection.cpp
input/wintab/kis_xi2_event_filter.cpp
)
endif()
endif()
ki18n_wrap_ui(kritaui_LIB_SRCS
widgets/KoFillConfigWidget.ui
+ widgets/KoStrokeConfigWidget.ui
forms/wdgdlgpngimport.ui
forms/wdgfullscreensettings.ui
forms/wdgautogradient.ui
forms/wdggeneralsettings.ui
forms/wdgperformancesettings.ui
forms/wdggenerators.ui
forms/wdgbookmarkedconfigurationseditor.ui
forms/wdgapplyprofile.ui
forms/wdgcustompattern.ui
forms/wdglayerproperties.ui
forms/wdgcolorsettings.ui
forms/wdgtabletsettings.ui
forms/wdgcolorspaceselector.ui
forms/wdgcolorspaceselectoradvanced.ui
forms/wdgdisplaysettings.ui
forms/kis_previewwidgetbase.ui
forms/kis_matrix_widget.ui
forms/wdgselectionoptions.ui
forms/wdggeometryoptions.ui
forms/wdgnewimage.ui
forms/wdgimageproperties.ui
forms/wdgmaskfromselection.ui
forms/wdgmasksource.ui
forms/wdgfilterdialog.ui
forms/wdgmetadatamergestrategychooser.ui
forms/wdgpaintoppresets.ui
forms/wdgpaintopsettings.ui
forms/wdgdlggeneratorlayer.ui
forms/wdgdlgfilelayer.ui
forms/wdgfilterselector.ui
forms/wdgfilternodecreation.ui
forms/wdgpaintactioneditor.ui
forms/wdgmultipliersdoublesliderspinbox.ui
forms/wdgnodequerypatheditor.ui
forms/wdgpresetselectorstrip.ui
forms/wdgdlgblacklistcleanup.ui
forms/wdgrectangleconstraints.ui
forms/wdgimportimagesequence.ui
forms/wdgstrokeselectionproperties.ui
forms/KisDetailsPaneBase.ui
forms/KisOpenPaneBase.ui
forms/wdgstopgradienteditor.ui
brushhud/kis_dlg_brush_hud_config.ui
forms/wdgdlginternalcolorselector.ui
dialogs/kis_delayed_save_dialog.ui
input/config/kis_input_configuration_page.ui
input/config/kis_edit_profiles_dialog.ui
input/config/kis_input_configuration_page_item.ui
input/config/kis_mouse_input_editor.ui
input/config/kis_wheel_input_editor.ui
input/config/kis_key_input_editor.ui
layerstyles/wdgBevelAndEmboss.ui
layerstyles/wdgblendingoptions.ui
layerstyles/WdgColorOverlay.ui
layerstyles/wdgContour.ui
layerstyles/wdgdropshadow.ui
layerstyles/WdgGradientOverlay.ui
layerstyles/wdgInnerGlow.ui
layerstyles/wdglayerstyles.ui
layerstyles/WdgPatternOverlay.ui
layerstyles/WdgSatin.ui
layerstyles/WdgStroke.ui
layerstyles/wdgstylesselector.ui
layerstyles/wdgTexture.ui
wdgsplash.ui
input/wintab/kis_screen_size_choice_dialog.ui
)
QT5_WRAP_CPP(kritaui_HEADERS_MOC KisNodePropertyAction_p.h)
add_library(kritaui SHARED ${kritaui_HEADERS_MOC} ${kritaui_LIB_SRCS} )
generate_export_header(kritaui BASE_NAME kritaui)
target_link_libraries(kritaui KF5::CoreAddons KF5::Completion KF5::I18n KF5::ItemViews Qt5::Network
kritaimpex kritacolor kritaimage kritalibbrush kritawidgets kritawidgetutils ${PNG_LIBRARIES} ${EXIV2_LIBRARIES}
)
if (HAVE_QT_MULTIMEDIA)
target_link_libraries(kritaui Qt5::Multimedia)
endif()
if (HAVE_KIO)
target_link_libraries(kritaui KF5::KIOCore)
endif()
if (NOT WIN32 AND NOT APPLE)
target_link_libraries(kritaui ${X11_X11_LIB}
${X11_Xinput_LIB}
${XCB_LIBRARIES})
endif()
if(APPLE)
target_link_libraries(kritaui ${FOUNDATION_LIBRARY})
endif ()
target_link_libraries(kritaui ${OPENEXR_LIBRARIES})
# Add VSync disable workaround
if(NOT WIN32 AND NOT APPLE)
target_link_libraries(kritaui ${CMAKE_DL_LIBS} Qt5::X11Extras)
endif()
if(X11_FOUND)
target_link_libraries(kritaui Qt5::X11Extras ${X11_LIBRARIES})
endif()
target_include_directories(kritaui
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/canvas>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/flake>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ora>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tool>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/utils>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/widgets>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/input/wintab>
)
set_target_properties(kritaui
PROPERTIES VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION}
)
install(TARGETS kritaui ${INSTALL_TARGETS_DEFAULT_ARGS})
if (APPLE)
install(FILES osx.stylesheet DESTINATION ${DATA_INSTALL_DIR}/krita)
endif ()
diff --git a/libs/ui/KisAnimationCacheRegenerator.h b/libs/ui/KisAnimationCacheRegenerator.h
index 5b7fd7bc3c..a17f123fe9 100644
--- a/libs/ui/KisAnimationCacheRegenerator.h
+++ b/libs/ui/KisAnimationCacheRegenerator.h
@@ -1,66 +1,66 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISANIMATIONCACHEREGENERATOR_H
#define KISANIMATIONCACHEREGENERATOR_H
#include <QObject>
#include <QScopedPointer>
#include "kritaui_export.h"
#include "kis_types.h"
class KisTimeRange;
class KRITAUI_EXPORT KisAnimationCacheRegenerator : public QObject
{
Q_OBJECT
public:
explicit KisAnimationCacheRegenerator(QObject *parent = 0);
- ~KisAnimationCacheRegenerator();
+ ~KisAnimationCacheRegenerator() override;
static int calcFirstDirtyFrame(KisAnimationFrameCacheSP cache,
const KisTimeRange &playbackRange,
const KisTimeRange &skipRange);
static int calcNumberOfDirtyFrame(KisAnimationFrameCacheSP cache,
const KisTimeRange &playbackRange);
public Q_SLOTS:
void startFrameRegeneration(int frame, KisAnimationFrameCacheSP cache);
void cancelCurrentFrameRegeneration();
Q_SIGNALS:
void sigFrameCancelled();
void sigFrameFinished();
void sigInternalStartFrameConversion();
private Q_SLOTS:
void slotFrameRegenerationCancelled();
void slotFrameRegenerationFinished(int frame);
void slotFrameStartConversion();
void slotFrameConverted();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KISANIMATIONCACHEREGENERATOR_H
diff --git a/libs/ui/KisApplication.h b/libs/ui/KisApplication.h
index 2ee65c1657..bd90c387f3 100644
--- a/libs/ui/KisApplication.h
+++ b/libs/ui/KisApplication.h
@@ -1,124 +1,124 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_APPLICATION_H
#define KIS_APPLICATION_H
#include <QPointer>
#include <qtsingleapplication/qtsingleapplication.h>
#include "kritaui_export.h"
#include <KisAutoSaveRecoveryDialog.h>
class KisMainWindow;
class KisApplicationPrivate;
class QWidget;
class KisApplicationArguments;
class KisAutoSaveRecoveryDialog;
#include <KisImportExportManager.h>
/**
* @brief Base class for the %Krita app
*
* This class handles arguments given on the command line and
* shows a generic about dialog for the Krita app.
*
* In addition it adds the standard directories where Krita
* can find its images etc.
*
* If the last mainwindow becomes closed, KisApplication automatically
* calls QApplication::quit.
*/
class KRITAUI_EXPORT KisApplication : public QtSingleApplication
{
Q_OBJECT
public:
/**
* Creates an application object, adds some standard directories and
* initializes kimgio.
*/
explicit KisApplication(const QString &key, int &argc, char **argv);
/**
* Destructor.
*/
- virtual ~KisApplication();
+ ~KisApplication() override;
/**
* Call this to start the application.
*
* Parses command line arguments and creates the initial main windowss and docs
* from them (or an empty doc if no cmd-line argument is specified ).
*
* You must call this method directly before calling QApplication::exec.
*
* It is valid behaviour not to call this method at all. In this case you
* have to process your command line parameters by yourself.
*/
virtual bool start(const KisApplicationArguments &args);
/**
* Checks if user is holding ctrl+alt+shift keys and asks if the settings file should be cleared.
*
* Typically called during startup before reading the config.
*/
void askClearConfig();
/**
* Tell KisApplication to show this splashscreen when you call start();
* when start returns, the splashscreen is hidden. Use KSplashScreen
* to have the splash show correctly on Xinerama displays.
*/
void setSplashScreen(QWidget *splash);
void setSplashScreenLoadingText(QString);
void hideSplashScreen();
/// Overridden to handle exceptions from event handlers.
- bool notify(QObject *receiver, QEvent *event);
+ bool notify(QObject *receiver, QEvent *event) override;
void addResourceTypes();
void loadResources();
void loadPlugins();
void initializeGlobals(const KisApplicationArguments &args);
public Q_SLOTS:
void remoteArguments(QByteArray message, QObject*socket);
void fileOpenRequested(const QString & url);
private:
/// @return the number of autosavefiles opened
void checkAutosaveFiles();
bool createNewDocFromTemplate(const QString &fileName, KisMainWindow *m_mainWindow);
void clearConfig();
private:
KisApplicationPrivate * const d;
class ResetStarting;
friend class ResetStarting;
KisAutoSaveRecoveryDialog *m_autosaveDialog;
QStringList m_autosaveFiles;
QPointer<KisMainWindow> m_mainWindow; // The first mainwindow we create on startup
bool m_batchRun;
};
#endif
diff --git a/libs/ui/KisAutoSaveRecoveryDialog.h b/libs/ui/KisAutoSaveRecoveryDialog.h
index 9b7903f90e..7a2d5eb813 100644
--- a/libs/ui/KisAutoSaveRecoveryDialog.h
+++ b/libs/ui/KisAutoSaveRecoveryDialog.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
Copyright (C) 2012 Boudewijn Rempt <boud@valdyas.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KISAUTOSAVERECOVERYDIALOG_H
#define KISAUTOSAVERECOVERYDIALOG_H
#include <KoDialog.h>
#include <QStringList>
#include <QModelIndex>
class QListView;
Q_DECLARE_METATYPE(QModelIndex)
class KisAutoSaveRecoveryDialog : public KoDialog
{
Q_OBJECT
public:
explicit KisAutoSaveRecoveryDialog(const QStringList &filenames, QWidget *parent = 0);
- ~KisAutoSaveRecoveryDialog();
+ ~KisAutoSaveRecoveryDialog() override;
QStringList recoverableFiles();
public Q_SLOTS:
void toggleFileItem(bool toggle);
void slotDeleteAll();
private:
QListView *m_listView;
class FileItemModel;
FileItemModel *m_model;
};
#endif // KOAUTOSAVERECOVERYDIALOG_H
diff --git a/libs/ui/KisColorsetChooser.h b/libs/ui/KisColorsetChooser.h
index dca0cf3642..284f64a788 100644
--- a/libs/ui/KisColorsetChooser.h
+++ b/libs/ui/KisColorsetChooser.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORSET_CHOOSER_H
#define KIS_COLORSET_CHOOSER_H
#include <QWidget>
class QSpinBox;
class KoColorSet;
class QLineEdit;
class KoResourceItemChooser;
class KoResource;
#include "kritaui_export.h"
class KRITAUI_EXPORT KisColorsetChooser : public QWidget
{
Q_OBJECT
public:
KisColorsetChooser(QWidget* parent = 0);
- virtual ~KisColorsetChooser();
+ ~KisColorsetChooser() override;
Q_SIGNALS:
void paletteSelected(KoColorSet* colorSet);
private Q_SLOTS:
void resourceSelected(KoResource* resource);
void slotSave();
private:
KoResourceItemChooser * m_itemChooser;
QLineEdit* m_nameEdit;
QSpinBox* m_columnEdit;
};
#endif // COLORSET_CHOOSER_H
diff --git a/libs/ui/KisDetailsPane.h b/libs/ui/KisDetailsPane.h
index a19c082dea..5dfc2e42c2 100644
--- a/libs/ui/KisDetailsPane.h
+++ b/libs/ui/KisDetailsPane.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
Copyright (C) 2005-2006 Peter Simonsson <psn@linux.se>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KISDETAILSPANE_H
#define KISDETAILSPANE_H
#include "ui_KisDetailsPaneBase.h"
class QEvent;
class QUrl;
class QStandardItemModel;
struct KisDetailsPanePrivate;
class KisDetailsPane : public QWidget, public Ui_KisDetailsPaneBase
{
Q_OBJECT
public:
KisDetailsPane(QWidget* parent, const QString& header);
- virtual ~KisDetailsPane();
+ ~KisDetailsPane() override;
- virtual bool eventFilter(QObject* watched, QEvent* e);
+ bool eventFilter(QObject* watched, QEvent* e) override;
/// @return the model used in the document list
QStandardItemModel* model() const;
Q_SIGNALS:
/// Emitted when a file is requested to be opened
void openUrl(const QUrl&);
/// This is used to keep all splitters in different details panes synced
void splitterResized(KisDetailsPane* sender, const QList<int>& sizes);
public Q_SLOTS:
/// This is used to keep all splitters in different details panes synced
void resizeSplitter(KisDetailsPane* sender, const QList<int>& sizes);
protected Q_SLOTS:
/// This is called when the selection in the listview changed
virtual void selectionChanged(const QModelIndex& index) = 0;
virtual void openFile();
virtual void openFile(const QModelIndex& index) = 0;
void changePalette();
protected:
enum Extents {
IconExtent = 64,
PreviewExtent = 128
};
private:
KisDetailsPanePrivate * const d;
};
#endif //KODETAILSPANE_H
diff --git a/libs/ui/KisDocument.cpp b/libs/ui/KisDocument.cpp
index 4b2f0e6439..22abf325f4 100644
--- a/libs/ui/KisDocument.cpp
+++ b/libs/ui/KisDocument.cpp
@@ -1,1758 +1,1764 @@
/* This file is part of the Krita project
*
* Copyright (C) 2014 Boudewijn Rempt <boud@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KisMainWindow.h" // XXX: remove
#include <QMessageBox> // XXX: remove
#include <KisMimeDatabase.h>
#include <KoCanvasBase.h>
#include <KoColor.h>
#include <KoColorProfile.h>
#include <KoColorSpaceEngine.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoDocumentInfoDlg.h>
#include <KoDocumentInfo.h>
#include <KoDpi.h>
#include <KoUnit.h>
#include <KoFileDialog.h>
#include <KoID.h>
#include <KoOdfReadStore.h>
#include <KoProgressProxy.h>
#include <KoProgressUpdater.h>
#include <KoSelection.h>
#include <KoShape.h>
#include <KoShapeController.h>
#include <KoStore.h>
#include <KoUpdater.h>
#include <KoXmlWriter.h>
#include <KoXmlReader.h>
#include <KoStoreDevice.h>
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <kdesktopfile.h>
#include <kconfiggroup.h>
#include <QTemporaryFile>
#include <kbackup.h>
#include <QTextBrowser>
#include <QApplication>
#include <QBuffer>
#include <QDesktopServices>
#include <QDir>
#include <QDomDocument>
#include <QDomElement>
#include <QFileInfo>
#include <QImage>
#include <QList>
#include <QPainter>
#include <QRect>
#include <QScopedPointer>
#include <QSize>
#include <QStringList>
#include <QtGlobal>
#include <QTimer>
#include <QWidget>
// Krita Image
#include <kis_config.h>
#include <flake/kis_shape_layer.h>
#include <kis_debug.h>
#include <kis_group_layer.h>
#include <kis_image.h>
#include <kis_layer.h>
#include <kis_name_server.h>
#include <kis_paint_layer.h>
#include <kis_painter.h>
#include <kis_selection.h>
#include <kis_fill_painter.h>
#include <kis_document_undo_store.h>
#include <kis_painting_assistants_decoration.h>
#include <kis_idle_watcher.h>
#include <kis_signal_auto_connection.h>
#include <kis_debug.h>
#include <kis_canvas_widget_base.h>
// Local
#include "KisViewManager.h"
#include "kis_clipboard.h"
#include "widgets/kis_custom_image_widget.h"
#include "canvas/kis_canvas2.h"
#include "flake/kis_shape_controller.h"
#include "kis_statusbar.h"
#include "widgets/kis_progress_widget.h"
#include "kis_canvas_resource_provider.h"
#include "kis_resource_server_provider.h"
#include "kis_node_manager.h"
#include "KisPart.h"
#include "KisApplication.h"
#include "KisDocument.h"
#include "KisImportExportManager.h"
#include "KisPart.h"
#include "KisView.h"
#include "kis_grid_config.h"
#include "kis_guides_config.h"
#include "kis_image_barrier_lock_adapter.h"
#include <mutex>
// Define the protocol used here for embedded documents' URL
// This used to "store" but QUrl didn't like it,
// so let's simply make it "tar" !
#define STORE_PROTOCOL "tar"
// The internal path is a hack to make QUrl happy and for document children
#define INTERNAL_PROTOCOL "intern"
#define INTERNAL_PREFIX "intern:/"
// Warning, keep it sync in koStore.cc
#include <unistd.h>
using namespace std;
/**********************************************************
*
* KisDocument
*
**********************************************************/
namespace {
class DocumentProgressProxy : public KoProgressProxy {
public:
KisMainWindow *m_mainWindow;
DocumentProgressProxy(KisMainWindow *mainWindow)
: m_mainWindow(mainWindow)
{
}
~DocumentProgressProxy() override {
// signal that the job is done
setValue(-1);
}
int maximum() const override {
return 100;
}
void setValue(int value) override {
if (m_mainWindow) {
m_mainWindow->slotProgress(value);
}
}
void setRange(int /*minimum*/, int /*maximum*/) override {
}
void setFormat(const QString &/*format*/) override {
}
};
}
//static
QString KisDocument::newObjectName()
{
static int s_docIFNumber = 0;
QString name; name.setNum(s_docIFNumber++); name.prepend("document_");
return name;
}
class UndoStack : public KUndo2Stack
{
public:
UndoStack(KisDocument *doc)
: m_doc(doc)
{
}
void setIndex(int idx) override {
KisImageWSP image = this->image();
image->requestStrokeCancellation();
if(image->tryBarrierLock()) {
KUndo2Stack::setIndex(idx);
image->unlock();
}
}
void notifySetIndexChangedOneCommand() override {
KisImageWSP image = this->image();
image->unlock();
/**
* Some very weird commands may emit blocking signals to
* the GUI (e.g. KisGuiContextCommand). Here is the best thing
* we can do to avoid the deadlock
*/
while(!image->tryBarrierLock()) {
QApplication::processEvents();
}
}
void undo() override {
KisImageWSP image = this->image();
image->requestUndoDuringStroke();
if (image->tryUndoUnfinishedLod0Stroke() == UNDO_OK) {
return;
}
if(image->tryBarrierLock()) {
KUndo2Stack::undo();
image->unlock();
}
}
void redo() override {
KisImageWSP image = this->image();
if(image->tryBarrierLock()) {
KUndo2Stack::redo();
image->unlock();
}
}
private:
KisImageWSP image() {
KisImageWSP currentImage = m_doc->image();
Q_ASSERT(currentImage);
return currentImage;
}
private:
KisDocument *m_doc;
};
class Q_DECL_HIDDEN KisDocument::Private
{
public:
Private() :
docInfo(0),
progressUpdater(0),
progressProxy(0),
importExportManager(0),
isImporting(false),
isExporting(false),
password(QString()),
modifiedAfterAutosave(false),
isAutosaving(false),
backupFile(true),
doNotSaveExtDoc(false),
undoStack(0),
m_saveOk(false),
m_waitForSave(false),
m_duringSaveAs(false),
m_bAutoDetectedMime(false),
modified(false),
readwrite(true),
disregardAutosaveFailure(false),
nserver(0),
macroNestDepth(0),
imageIdleWatcher(2000 /*ms*/),
suppressProgress(false),
fileProgressProxy(0),
savingLock(&savingMutex)
{
if (QLocale().measurementSystem() == QLocale::ImperialSystem) {
unit = KoUnit::Inch;
} else {
unit = KoUnit::Centimeter;
}
}
~Private() {
// Don't delete m_d->shapeController because it's in a QObject hierarchy.
delete nserver;
}
KoDocumentInfo *docInfo;
KoProgressUpdater *progressUpdater;
KoProgressProxy *progressProxy;
KoUnit unit;
KisImportExportManager *importExportManager; // The filter-manager to use when loading/saving [for the options]
QByteArray mimeType; // The actual mimetype of the document
QByteArray outputMimeType; // The mimetype to use when saving
bool isImporting;
bool isExporting; // File --> Import/Export vs File --> Open/Save
QString password; // The password used to encrypt an encrypted document
QTimer autoSaveTimer;
QString lastErrorMessage; // see openFile()
QString lastWarningMessage;
int autoSaveDelay {300}; // in seconds, 0 to disable.
bool modifiedAfterAutosave;
bool isAutosaving;
bool backupFile;
bool doNotSaveExtDoc; // makes it possible to save only internally stored child documents
KUndo2Stack *undoStack;
KisGuidesConfig guidesConfig;
QUrl m_originalURL; // for saveAs
QString m_originalFilePath; // for saveAs
bool m_saveOk;
bool m_waitForSave;
bool m_duringSaveAs;
bool m_bAutoDetectedMime; // whether the mimetype in the arguments was detected by the part itself
QUrl m_url; // local url - the one displayed to the user.
QString m_file; // Local file - the only one the part implementation should deal with.
QEventLoop m_eventLoop;
QMutex savingMutex;
bool modified;
bool readwrite;
QDateTime firstMod;
QDateTime lastMod;
bool disregardAutosaveFailure;
KisNameServer *nserver;
qint32 macroNestDepth;
KisImageSP image;
KisImageSP savingImage;
KisNodeSP preActivatedNode;
KisShapeController* shapeController;
KoShapeController* koShapeController;
KisIdleWatcher imageIdleWatcher;
QScopedPointer<KisSignalAutoConnection> imageIdleConnection;
bool suppressProgress;
KoProgressProxy* fileProgressProxy;
QList<KisPaintingAssistantSP> assistants;
KisGridConfig gridConfig;
StdLockableWrapper<QMutex> savingLock;
void setImageAndInitIdleWatcher(KisImageSP _image) {
image = _image;
imageIdleWatcher.setTrackedImage(image);
if (image) {
imageIdleConnection.reset(
new KisSignalAutoConnection(
&imageIdleWatcher, SIGNAL(startedIdleMode()),
image.data(), SLOT(explicitRegenerateLevelOfDetail())));
}
}
class SafeSavingLocker;
};
class KisDocument::Private::SafeSavingLocker {
public:
SafeSavingLocker(KisDocument::Private *_d, KisDocument *document)
: d(_d)
, m_document(document)
, m_locked(false)
, m_imageLock(d->image, true)
{
const int realAutoSaveInterval = KisConfig().autoSaveInterval();
const int emergencyAutoSaveInterval = 10; // sec
/**
* Initial try to lock both objects. Locking the image guards
* us from any image composition threads running in the
* background, while savingMutex guards us from entering the
* saving code twice by autosave and main threads.
*
* Since we are trying to lock multiple objects, so we should
* do it in a safe manner.
*/
m_locked = std::try_lock(m_imageLock, d->savingLock) < 0;
if (!m_locked) {
if (d->isAutosaving) {
d->disregardAutosaveFailure = true;
if (realAutoSaveInterval) {
m_document->setAutoSaveDelay(emergencyAutoSaveInterval);
}
} else {
d->image->requestStrokeEnd();
QApplication::processEvents();
// one more try...
m_locked = std::try_lock(m_imageLock, d->savingLock) < 0;
}
}
if (m_locked) {
d->disregardAutosaveFailure = false;
}
}
~SafeSavingLocker() {
if (m_locked) {
m_imageLock.unlock();
d->savingLock.unlock();
const int realAutoSaveInterval = KisConfig().autoSaveInterval();
m_document->setAutoSaveDelay(realAutoSaveInterval);
}
}
bool successfullyLocked() const {
return m_locked;
}
private:
KisDocument::Private *d;
KisDocument *m_document;
bool m_locked;
KisImageBarrierLockAdapter m_imageLock;
};
KisDocument::KisDocument()
: d(new Private())
{
d->undoStack = new UndoStack(this);
d->undoStack->setParent(this);
d->importExportManager = new KisImportExportManager(this);
d->importExportManager->setProgresUpdater(d->progressUpdater);
connect(&d->autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
KisConfig cfg;
setAutoSaveDelay(cfg.autoSaveInterval());
setObjectName(newObjectName());
d->docInfo = new KoDocumentInfo(this);
d->firstMod = QDateTime::currentDateTime();
d->lastMod = QDateTime::currentDateTime();
// preload the krita resources
KisResourceServerProvider::instance();
d->nserver = new KisNameServer(1);
d->shapeController = new KisShapeController(this, d->nserver);
d->koShapeController = new KoShapeController(0, d->shapeController);
undoStack()->setUndoLimit(KisConfig().undoStackLimit());
connect(d->undoStack, SIGNAL(indexChanged(int)), this, SLOT(slotUndoStackIndexChanged(int)));
setBackupFile(KisConfig().backupFile());
}
KisDocument::~KisDocument()
{
/**
* Push a timebomb, which will try to release the memory after
* the document has been deleted
*/
KisPaintDevice::createMemoryReleaseObject()->deleteLater();
d->autoSaveTimer.disconnect(this);
d->autoSaveTimer.stop();
delete d->importExportManager;
// Despite being QObject they needs to be deleted before the image
delete d->shapeController;
delete d->koShapeController;
if (d->image) {
d->image->notifyAboutToBeDeleted();
/**
* WARNING: We should wait for all the internal image jobs to
* finish before entering KisImage's destructor. The problem is,
* while execution of KisImage::~KisImage, all the weak shared
* pointers pointing to the image enter an inconsistent
* state(!). The shared counter is already zero and destruction
* has started, but the weak reference doesn't know about it,
* because KisShared::~KisShared hasn't been executed yet. So all
* the threads running in background and having weak pointers will
* enter the KisImage's destructor as well.
*/
d->image->requestStrokeCancellation();
d->image->waitForDone();
// clear undo commands that can still point to the image
d->undoStack->clear();
d->image->waitForDone();
KisImageWSP sanityCheckPointer = d->image;
Q_UNUSED(sanityCheckPointer);
// The following line trigger the deletion of the image
d->image.clear();
// check if the image has actually been deleted
KIS_SAFE_ASSERT_RECOVER_NOOP(!sanityCheckPointer.isValid());
}
delete d;
}
bool KisDocument::reload()
{
// XXX: reimplement!
return false;
}
bool KisDocument::exportDocument(const QUrl &_url, KisPropertiesConfigurationSP exportConfiguration)
{
//qDebug() << "exportDocument" << _url.toDisplayString() << "is autosaving" << d->isAutosaving;
bool ret;
d->isExporting = true;
//
// Preserve a lot of state here because we need to restore it in order to
// be able to fake a File --> Export. Can't do this in saveFile() because,
// for a start, KParts has already set url and m_file and because we need
// to restore the modified flag etc. and don't want to put a load on anyone
// reimplementing saveFile() (Note: importDocument() and exportDocument()
// will remain non-virtual).
//
QUrl oldURL = url();
QString oldFile = localFilePath();
//qDebug() << "\toldUrl" << oldURL << "oldFile" << oldFile << "export url" << _url;
bool wasModified = isModified();
// save...
ret = saveAs(_url, exportConfiguration);
//
// This is sooooo hacky :(
// Hopefully we will restore enough state.
//
dbgUI << "Restoring KisDocument state to before export";
// always restore url & m_file regardless of failure or success
//qDebug() << "\tafter saveAs: url" << url() << "local file path" << localFilePath();
setUrl(oldURL);
setLocalFilePath(oldFile);
//qDebug() << "\tafter restoring: url" << url() << "local file path" << localFilePath();
// on successful export we need to restore modified etc. too
// on failed export, mimetype/modified hasn't changed anyway
if (ret) {
setModified(wasModified);
}
d->isExporting = false;
return ret;
}
bool KisDocument::saveAs(const QUrl &url, KisPropertiesConfigurationSP exportConfiguration)
{
//qDebug() << "saveAs" << url;
if (!url.isValid() || !url.isLocalFile()) {
errKrita << "saveAs: Malformed URL " << url.url() << endl;
return false;
}
d->m_duringSaveAs = true;
d->m_originalURL = d->m_url;
d->m_originalFilePath = d->m_file;
d->m_url = url; // Store where to upload in saveToURL
d->m_file = d->m_url.toLocalFile();
bool result = save(exportConfiguration); // Save local file and upload local file
if (!result) {
d->m_url = d->m_originalURL;
d->m_file = d->m_originalFilePath;
d->m_duringSaveAs = false;
d->m_originalURL = QUrl();
d->m_originalFilePath.clear();
}
return result;
}
bool KisDocument::save(KisPropertiesConfigurationSP exportConfiguration)
{
//qDebug() << "save" << d->m_file << d->m_url << url() << localFilePath();
d->m_saveOk = false;
if (d->m_file.isEmpty()) { // document was created empty
d->m_file = d->m_url.toLocalFile();
}
updateEditingTime(true);
setFileProgressProxy();
setUrl(url());
bool ok = saveFile(localFilePath(), exportConfiguration);
clearFileProgressProxy();
if (ok) {
setModified( false );
emit completed();
d->m_saveOk = true;
d->m_duringSaveAs = false;
d->m_originalURL = QUrl();
d->m_originalFilePath.clear();
return true; // Nothing to do
}
else {
emit canceled(QString());
}
return false;
}
QByteArray KisDocument::serializeToNativeByteArray()
{
QByteArray byteArray;
QBuffer buffer(&byteArray);
QScopedPointer<KisImportExportFilter> filter(KisImportExportManager::filterForMimeType(nativeFormatMimeType(), KisImportExportManager::Export));
filter->setBatchMode(true);
filter->setMimeType(nativeFormatMimeType());
if (!prepareLocksForSaving()) {
return byteArray;
}
if (filter->convert(this, &buffer) != KisImportExportFilter::OK) {
qWarning() << "serializeToByteArray():: Could not export to our native format";
}
unlockAfterSaving();
return byteArray;
}
+bool KisDocument::isInSaving() const
+{
+ std::unique_lock<StdLockableWrapper<QMutex>> l(d->savingLock, std::try_to_lock);
+ return !l.owns_lock();
+}
+
bool KisDocument::saveFile(const QString &filePath, KisPropertiesConfigurationSP exportConfiguration)
{
if (!prepareLocksForSaving()) {
return false;
}
// Unset the error message
setErrorMessage("");
// Save it to be able to restore it after a failed save
const bool wasModified = isModified();
bool ret = false;
bool suppressErrorDialog = fileBatchMode();
KisImportExportFilter::ConversionStatus status = KisImportExportFilter::OK;
//qDebug() << "saveFile" << localFilePath() << QFileInfo(localFilePath()).exists() << !QFileInfo(localFilePath()).isWritable();
if (QFileInfo(localFilePath()).exists() && !QFileInfo(localFilePath()).isWritable()) {
setErrorMessage(i18n("%1 cannot be written to. Please save under a different name.", localFilePath()));
}
else {
// The output format is set by KisMainWindow, and by openFile
QByteArray outputMimeType = d->outputMimeType;
if (outputMimeType.isEmpty()) {
outputMimeType = d->outputMimeType = nativeFormatMimeType();
}
//qDebug() << "saveFile. Is Autosaving?" << isAutosaving() << "url" << filePath << d->outputMimeType;
if (d->backupFile) {
Q_ASSERT(url().isLocalFile());
KBackup::backupFile(url().toLocalFile());
}
qApp->processEvents();
setFileProgressUpdater(i18n("Saving Document"));
//qDebug() << "saving to tempory file" << tempororaryFileName;
status = d->importExportManager->exportDocument(localFilePath(), filePath, outputMimeType, !d->isExporting , exportConfiguration);
ret = (status == KisImportExportFilter::OK);
suppressErrorDialog = (fileBatchMode() || isAutosaving() || status == KisImportExportFilter::UserCancelled || status == KisImportExportFilter::BadConversionGraph);
//qDebug() << "Export status was" << status;
if (ret) {
if (!d->isAutosaving && !d->suppressProgress) {
QPointer<KoUpdater> updater = d->progressUpdater->startSubtask(1, "clear undo stack");
updater->setProgress(0);
d->undoStack->setClean();
updater->setProgress(100);
} else {
d->undoStack->setClean();
}
if (errorMessage().isEmpty()) {
if (!isAutosaving()) {
removeAutoSaveFiles();
}
}
else {
ret = false;
qWarning() << "Error while saving:" << errorMessage();
}
// Restart the autosave timer
// (we don't want to autosave again 2 seconds after a real save)
if (!isAutosaving()) {
setAutoSaveDelay(d->autoSaveDelay);
}
d->mimeType = outputMimeType;
}
}
if (!ret) {
if (!suppressErrorDialog) {
if (errorMessage().isEmpty()) {
setErrorMessage(KisImportExportFilter::conversionStatusString(status));
}
if (errorMessage().isEmpty()) {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not save\n%1", filePath));
} else {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not save %1\nReason: %2", filePath, errorMessage()));
}
}
// couldn't save file so this new URL is invalid
// FIXME: we should restore the current document's true URL instead of
// setting it to nothing otherwise anything that depends on the URL
// being correct will not work (i.e. the document will be called
// "Untitled" which may not be true)
//
// Update: now the URL is restored in KisMainWindow but really, this
// should still be fixed in KisDocument/KParts (ditto for file).
// We still resetURL() here since we may or may not have been called
// by KisMainWindow - Clarence
resetURL();
// As we did not save, restore the "was modified" status
setModified(wasModified);
}
emit sigSavingFinished();
clearFileProgressUpdater();
unlockAfterSaving();
return ret;
}
QByteArray KisDocument::mimeType() const
{
return d->mimeType;
}
void KisDocument::setMimeType(const QByteArray & mimeType)
{
d->mimeType = mimeType;
}
void KisDocument::setOutputMimeType(const QByteArray & mimeType)
{
d->outputMimeType = mimeType;
}
QByteArray KisDocument::outputMimeType() const
{
return d->outputMimeType;
}
bool KisDocument::fileBatchMode() const
{
return d->importExportManager->batchMode();
}
void KisDocument::setFileBatchMode(const bool batchMode)
{
d->importExportManager->setBatchMode(batchMode);
}
bool KisDocument::isImporting() const
{
return d->isImporting;
}
bool KisDocument::isExporting() const
{
return d->isExporting;
}
void KisDocument::slotAutoSave()
{
//qDebug() << "slotAutoSave. Modified:" << d->modified << "modifiedAfterAutosave" << d->modified << "url" << url() << localFilePath();
if (!d->isAutosaving && d->modified && d->modifiedAfterAutosave) {
connect(this, SIGNAL(sigProgress(int)), KisPart::instance()->currentMainwindow(), SLOT(slotProgress(int)));
emit statusBarMessage(i18n("Autosaving..."));
d->isAutosaving = true;
QString autoSaveFileName = generateAutoSaveFileName(localFilePath());
QByteArray mimetype = d->outputMimeType;
d->outputMimeType = nativeFormatMimeType();
bool ret = exportDocument(QUrl::fromLocalFile(autoSaveFileName));
d->outputMimeType = mimetype;
if (ret) {
d->modifiedAfterAutosave = false;
d->autoSaveTimer.stop(); // until the next change
}
d->isAutosaving = false;
emit clearStatusBarMessage();
disconnect(this, SIGNAL(sigProgress(int)), KisPart::instance()->currentMainwindow(), SLOT(slotProgress(int)));
if (!ret && !d->disregardAutosaveFailure) {
emit statusBarMessage(i18n("Error during autosave! Partition full?"));
}
}
}
void KisDocument::setReadWrite(bool readwrite)
{
d->readwrite = readwrite;
setAutoSaveDelay(d->autoSaveDelay);
Q_FOREACH (KisMainWindow *mainWindow, KisPart::instance()->mainWindows()) {
mainWindow->setReadWrite(readwrite);
}
}
void KisDocument::setAutoSaveDelay(int delay)
{
//qDebug() << "setting autosave delay from" << d->autoSaveDelay << "to" << delay;
d->autoSaveDelay = delay;
if (isReadWrite() && d->autoSaveDelay > 0) {
d->autoSaveTimer.start(d->autoSaveDelay * 1000);
}
else {
d->autoSaveTimer.stop();
}
}
KoDocumentInfo *KisDocument::documentInfo() const
{
return d->docInfo;
}
bool KisDocument::isModified() const
{
return d->modified;
}
QPixmap KisDocument::generatePreview(const QSize& size)
{
KisImageSP image = d->image;
if (d->savingImage) image = d->savingImage;
if (image) {
QRect bounds = image->bounds();
QSize newSize = bounds.size();
newSize.scale(size, Qt::KeepAspectRatio);
QPixmap px = QPixmap::fromImage(image->convertToQImage(newSize, 0));
if (px.size() == QSize(0,0)) {
px = QPixmap(newSize);
QPainter gc(&px);
QBrush checkBrush = QBrush(KisCanvasWidgetBase::createCheckersImage(newSize.width() / 5));
gc.fillRect(px.rect(), checkBrush);
gc.end();
}
return px;
}
return QPixmap(size);
}
QString KisDocument::generateAutoSaveFileName(const QString & path) const
{
QString retval;
// Using the extension allows to avoid relying on the mime magic when opening
const QString extension (".kra");
if (path.isEmpty()) {
// Never saved?
#ifdef Q_OS_WIN
// On Windows, use the temp location (https://bugs.kde.org/show_bug.cgi?id=314921)
retval = QString("%1%2.%3-%4-%5-autosave%6").arg(QDir::tempPath()).arg(QDir::separator()).arg("krita").arg(qApp->applicationPid()).arg(objectName()).arg(extension);
#else
// On Linux, use a temp file in $HOME then. Mark it with the pid so two instances don't overwrite each other's autosave file
retval = QString("%1%2.%3-%4-%5-autosave%6").arg(QDir::homePath()).arg(QDir::separator()).arg("krita").arg(qApp->applicationPid()).arg(objectName()).arg(extension);
#endif
} else {
QFileInfo fi(path);
QString dir = fi.absolutePath();
QString filename = fi.fileName();
retval = QString("%1%2.%3-autosave%4").arg(dir).arg(QDir::separator()).arg(filename).arg(extension);
}
//qDebug() << "generateAutoSaveFileName() for path" << path << ":" << retval;
return retval;
}
bool KisDocument::importDocument(const QUrl &_url)
{
bool ret;
dbgUI << "url=" << _url.url();
d->isImporting = true;
// open...
ret = openUrl(_url);
// reset url & m_file (kindly? set by KisParts::openUrl()) to simulate a
// File --> Import
if (ret) {
dbgUI << "success, resetting url";
resetURL();
setTitleModified();
}
d->isImporting = false;
return ret;
}
bool KisDocument::openUrl(const QUrl &_url, KisDocument::OpenUrlFlags flags)
{
if (!_url.isLocalFile()) {
return false;
}
dbgUI << "url=" << _url.url();
d->lastErrorMessage.clear();
// Reimplemented, to add a check for autosave files and to improve error reporting
if (!_url.isValid()) {
d->lastErrorMessage = i18n("Malformed URL\n%1", _url.url()); // ## used anywhere ?
return false;
}
QUrl url(_url);
bool autosaveOpened = false;
if (url.isLocalFile() && !fileBatchMode()) {
QString file = url.toLocalFile();
QString asf = generateAutoSaveFileName(file);
if (QFile::exists(asf)) {
KisApplication *kisApp = static_cast<KisApplication*>(qApp);
kisApp->hideSplashScreen();
//dbgUI <<"asf=" << asf;
// ## TODO compare timestamps ?
int res = QMessageBox::warning(0,
i18nc("@title:window", "Krita"),
i18n("An autosaved file exists for this document.\nDo you want to open the autosaved file instead?"),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes);
switch (res) {
case QMessageBox::Yes :
url.setPath(asf);
autosaveOpened = true;
break;
case QMessageBox::No :
QFile::remove(asf);
break;
default: // Cancel
return false;
}
}
}
bool ret = openUrlInternal(url);
if (autosaveOpened) {
resetURL(); // Force save to act like 'Save As'
setReadWrite(true); // enable save button
setModified(true);
}
else {
if( !(flags & OPEN_URL_FLAG_DO_NOT_ADD_TO_RECENT_FILES) ) {
KisPart::instance()->addRecentURLToAllMainWindows(_url);
}
if (ret) {
// Detect readonly local-files; remote files are assumed to be writable
QFileInfo fi(url.toLocalFile());
setReadWrite(fi.isWritable());
}
}
return ret;
}
class DlgLoadMessages : public KoDialog {
public:
DlgLoadMessages(const QString &title, const QString &message, const QStringList &warnings) {
setWindowTitle(title);
setWindowIcon(KisIconUtils::loadIcon("dialog-warning"));
QWidget *page = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout(page);
QHBoxLayout *hlayout = new QHBoxLayout();
QLabel *labelWarning= new QLabel();
labelWarning->setPixmap(KisIconUtils::loadIcon("dialog-warning").pixmap(32, 32));
hlayout->addWidget(labelWarning);
hlayout->addWidget(new QLabel(message));
layout->addLayout(hlayout);
QTextBrowser *browser = new QTextBrowser();
QString warning = "<html><body><p><b>";
if (warnings.size() == 1) {
warning += "</b> Reason:</p>";
}
else {
warning += "</b> Reasons:</p>";
}
warning += "<p/><ul>";
Q_FOREACH(const QString &w, warnings) {
warning += "\n<li>" + w + "</li>";
}
warning += "</ul>";
browser->setHtml(warning);
browser->setMinimumHeight(200);
browser->setMinimumWidth(400);
layout->addWidget(browser);
setMainWidget(page);
setButtons(KoDialog::Ok);
resize(minimumSize());
}
};
bool KisDocument::openFile()
{
//dbgUI <<"for" << localFilePath();
if (!QFile::exists(localFilePath())) {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("File %1 does not exist.", localFilePath()));
return false;
}
QString filename = localFilePath();
QString typeName = mimeType();
if (typeName.isEmpty()) {
typeName = KisMimeDatabase::mimeTypeForFile(filename);
}
//qDebug() << "mimetypes 4:" << typeName;
// Allow to open backup files, don't keep the mimetype application/x-trash.
if (typeName == "application/x-trash") {
QString path = filename;
while (path.length() > 0) {
path.chop(1);
typeName = KisMimeDatabase::mimeTypeForFile(path);
//qDebug() << "\t" << path << typeName;
if (!typeName.isEmpty()) {
break;
}
}
//qDebug() << "chopped" << filename << "to" << path << "Was trash, is" << typeName;
}
dbgUI << localFilePath() << "type:" << typeName;
setFileProgressUpdater(i18n("Opening Document"));
KisImportExportFilter::ConversionStatus status;
status = d->importExportManager->importDocument(localFilePath(), typeName);
if (status != KisImportExportFilter::OK) {
QString msg = KisImportExportFilter::conversionStatusString(status);
if (!msg.isEmpty()) {
DlgLoadMessages dlg(i18nc("@title:window", "Krita"),
i18n("Could not open %2.\nReason: %1.", msg, prettyPathOrUrl()),
errorMessage().split("\n") + warningMessage().split("\n"));
dlg.exec();
}
clearFileProgressUpdater();
return false;
}
else if (!warningMessage().isEmpty()) {
DlgLoadMessages dlg(i18nc("@title:window", "Krita"),
i18n("There were problems opening %1.", prettyPathOrUrl()),
warningMessage().split("\n"));
dlg.exec();
setUrl(QUrl());
}
setMimeTypeAfterLoading(typeName);
emit sigLoadingFinished();
if (!d->suppressProgress && d->progressUpdater) {
QPointer<KoUpdater> updater = d->progressUpdater->startSubtask(1, "clear undo stack");
updater->setProgress(0);
undoStack()->clear();
updater->setProgress(100);
clearFileProgressUpdater();
} else {
undoStack()->clear();
}
return true;
}
KoProgressUpdater *KisDocument::progressUpdater() const
{
return d->progressUpdater;
}
void KisDocument::setProgressProxy(KoProgressProxy *progressProxy)
{
d->progressProxy = progressProxy;
}
KoProgressProxy* KisDocument::progressProxy() const
{
if (!d->progressProxy) {
KisMainWindow *mainWindow = 0;
if (KisPart::instance()->mainwindowCount() > 0) {
mainWindow = KisPart::instance()->mainWindows()[0];
}
d->progressProxy = new DocumentProgressProxy(mainWindow);
}
return d->progressProxy;
}
// shared between openFile and koMainWindow's "create new empty document" code
void KisDocument::setMimeTypeAfterLoading(const QString& mimeType)
{
d->mimeType = mimeType.toLatin1();
d->outputMimeType = d->mimeType;
}
bool KisDocument::loadNativeFormat(const QString & file_)
{
return openUrl(QUrl::fromLocalFile(file_));
}
void KisDocument::setModified()
{
d->modified = true;
}
void KisDocument::setModified(bool mod)
{
if (mod) {
updateEditingTime(false);
}
if (d->isAutosaving) // ignore setModified calls due to autosaving
return;
if ( !d->readwrite && d->modified ) {
errKrita << "Can't set a read-only document to 'modified' !" << endl;
return;
}
//dbgUI<<" url:" << url.path();
//dbgUI<<" mod="<<mod<<" MParts mod="<<KisParts::ReadWritePart::isModified()<<" isModified="<<isModified();
if (mod && !d->modifiedAfterAutosave) {
// First change since last autosave -> start the autosave timer
setAutoSaveDelay(d->autoSaveDelay);
}
d->modifiedAfterAutosave = mod;
if (mod == isModified())
return;
d->modified = mod;
if (mod) {
documentInfo()->updateParameters();
}
// This influences the title
setTitleModified();
emit modified(mod);
}
void KisDocument::updateEditingTime(bool forceStoreElapsed)
{
QDateTime now = QDateTime::currentDateTime();
int firstModDelta = d->firstMod.secsTo(now);
int lastModDelta = d->lastMod.secsTo(now);
if (lastModDelta > 30) {
d->docInfo->setAboutInfo("editing-time", QString::number(d->docInfo->aboutInfo("editing-time").toInt() + d->firstMod.secsTo(d->lastMod)));
d->firstMod = now;
} else if (firstModDelta > 60 || forceStoreElapsed) {
d->docInfo->setAboutInfo("editing-time", QString::number(d->docInfo->aboutInfo("editing-time").toInt() + firstModDelta));
d->firstMod = now;
}
d->lastMod = now;
}
QString KisDocument::prettyPathOrUrl() const
{
QString _url(url().toDisplayString());
#ifdef Q_OS_WIN
if (url().isLocalFile()) {
_url = QDir::toNativeSeparators(_url);
}
#endif
return _url;
}
// Get caption from document info (title(), in about page)
QString KisDocument::caption() const
{
QString c;
if (documentInfo()) {
c = documentInfo()->aboutInfo("title");
}
const QString _url(url().fileName());
if (!c.isEmpty() && !_url.isEmpty()) {
c = QString("%1 - %2").arg(c).arg(_url);
}
else if (c.isEmpty()) {
c = _url; // Fall back to document URL
}
return c;
}
void KisDocument::setTitleModified()
{
emit titleModified(caption(), isModified());
}
QDomDocument KisDocument::createDomDocument(const QString& tagName, const QString& version) const
{
return createDomDocument("krita", tagName, version);
}
//static
QDomDocument KisDocument::createDomDocument(const QString& appName, const QString& tagName, const QString& version)
{
QDomImplementation impl;
QString url = QString("http://www.calligra.org/DTD/%1-%2.dtd").arg(appName).arg(version);
QDomDocumentType dtype = impl.createDocumentType(tagName,
QString("-//KDE//DTD %1 %2//EN").arg(appName).arg(version),
url);
// The namespace URN doesn't need to include the version number.
QString namespaceURN = QString("http://www.calligra.org/DTD/%1").arg(appName);
QDomDocument doc = impl.createDocument(namespaceURN, tagName, dtype);
doc.insertBefore(doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""), doc.documentElement());
return doc;
}
bool KisDocument::isNativeFormat(const QByteArray& mimetype) const
{
if (mimetype == nativeFormatMimeType())
return true;
return extraNativeMimeTypes().contains(mimetype);
}
void KisDocument::setErrorMessage(const QString& errMsg)
{
d->lastErrorMessage = errMsg;
}
QString KisDocument::errorMessage() const
{
return d->lastErrorMessage;
}
void KisDocument::setWarningMessage(const QString& warningMsg)
{
d->lastWarningMessage = warningMsg;
}
QString KisDocument::warningMessage() const
{
return d->lastWarningMessage;
}
void KisDocument::removeAutoSaveFiles()
{
//qDebug() << "removeAutoSaveFiles";
// Eliminate any auto-save file
QString asf = generateAutoSaveFileName(localFilePath()); // the one in the current dir
//qDebug() << "\tfilename:" << asf << "exists:" << QFile::exists(asf);
if (QFile::exists(asf)) {
//qDebug() << "\tremoving autosavefile" << asf;
QFile::remove(asf);
}
asf = generateAutoSaveFileName(QString()); // and the one in $HOME
//qDebug() << "Autsavefile in $home" << asf;
if (QFile::exists(asf)) {
//qDebug() << "\tremoving autsavefile 2" << asf;
QFile::remove(asf);
}
}
void KisDocument::setBackupFile(bool saveBackup)
{
d->backupFile = saveBackup;
}
KoUnit KisDocument::unit() const
{
return d->unit;
}
void KisDocument::setUnit(const KoUnit &unit)
{
if (d->unit != unit) {
d->unit = unit;
emit unitChanged(unit);
}
}
KUndo2Stack *KisDocument::undoStack()
{
return d->undoStack;
}
KisImportExportManager *KisDocument::importExportManager() const
{
return d->importExportManager;
}
void KisDocument::addCommand(KUndo2Command *command)
{
if (command)
d->undoStack->push(command);
}
void KisDocument::beginMacro(const KUndo2MagicString & text)
{
d->undoStack->beginMacro(text);
}
void KisDocument::endMacro()
{
d->undoStack->endMacro();
}
void KisDocument::slotUndoStackIndexChanged(int idx)
{
// even if the document was already modified, call setModified to re-start autosave timer
setModified(idx != d->undoStack->cleanIndex());
}
void KisDocument::clearUndoHistory()
{
d->undoStack->clear();
}
KisGridConfig KisDocument::gridConfig() const
{
return d->gridConfig;
}
void KisDocument::setGridConfig(const KisGridConfig &config)
{
d->gridConfig = config;
}
const KisGuidesConfig& KisDocument::guidesConfig() const
{
return d->guidesConfig;
}
void KisDocument::setGuidesConfig(const KisGuidesConfig &data)
{
if (d->guidesConfig == data) return;
d->guidesConfig = data;
emit sigGuidesConfigChanged(d->guidesConfig);
}
void KisDocument::resetURL() {
setUrl(QUrl());
setLocalFilePath(QString());
}
KoDocumentInfoDlg *KisDocument::createDocumentInfoDialog(QWidget *parent, KoDocumentInfo *docInfo) const
{
return new KoDocumentInfoDlg(parent, docInfo);
}
bool KisDocument::isReadWrite() const
{
return d->readwrite;
}
QUrl KisDocument::url() const
{
return d->m_url;
}
bool KisDocument::closeUrl(bool promptToSave)
{
if (promptToSave) {
if ( isReadWrite() && isModified()) {
Q_FOREACH (KisView *view, KisPart::instance()->views()) {
if (view && view->document() == this) {
if (!view->queryClose()) {
return false;
}
}
}
}
}
// Not modified => ok and delete temp file.
d->mimeType = QByteArray();
// It always succeeds for a read-only part,
// but the return value exists for reimplementations
// (e.g. pressing cancel for a modified read-write part)
return true;
}
void KisDocument::setUrl(const QUrl &url)
{
d->m_url = url;
}
QString KisDocument::localFilePath() const
{
return d->m_file;
}
void KisDocument::setLocalFilePath( const QString &localFilePath )
{
d->m_file = localFilePath;
}
bool KisDocument::openUrlInternal(const QUrl &url)
{
if ( !url.isValid() )
return false;
if (d->m_bAutoDetectedMime) {
d->mimeType = QByteArray();
d->m_bAutoDetectedMime = false;
}
QByteArray mimetype = d->mimeType;
if ( !closeUrl() )
return false;
d->mimeType = mimetype;
setUrl(url);
d->m_file.clear();
if (d->m_url.isLocalFile()) {
d->m_file = d->m_url.toLocalFile();
bool ret;
// set the mimetype only if it was not already set (for example, by the host application)
if (d->mimeType.isEmpty()) {
// get the mimetype of the file
// using findByUrl() to avoid another string -> url conversion
QString mime = KisMimeDatabase::mimeTypeForFile(d->m_url.toLocalFile());
d->mimeType = mime.toLocal8Bit();
d->m_bAutoDetectedMime = true;
}
setFileProgressProxy();
setUrl(d->m_url);
ret = openFile();
clearFileProgressProxy();
if (ret) {
emit completed();
} else {
emit canceled(QString());
}
return ret;
}
return false;
}
bool KisDocument::newImage(const QString& name,
qint32 width, qint32 height,
const KoColorSpace* cs,
const KoColor &bgColor, bool backgroundAsLayer,
int numberOfLayers,
const QString &description, const double imageResolution)
{
Q_ASSERT(cs);
KisConfig cfg;
KisImageSP image;
KisPaintLayerSP layer;
if (!cs) return false;
QApplication::setOverrideCursor(Qt::BusyCursor);
image = new KisImage(createUndoStore(), width, height, cs, name);
Q_CHECK_PTR(image);
connect(image, SIGNAL(sigImageModified()), this, SLOT(setImageModified()), Qt::UniqueConnection);
image->setResolution(imageResolution, imageResolution);
image->assignImageProfile(cs->profile());
documentInfo()->setAboutInfo("title", name);
if (name != i18n("Unnamed") && !name.isEmpty()) {
setUrl(QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation) + '/' + name + ".kra"));
}
documentInfo()->setAboutInfo("abstract", description);
layer = new KisPaintLayer(image.data(), image->nextLayerName(), OPACITY_OPAQUE_U8, cs);
Q_CHECK_PTR(layer);
if (backgroundAsLayer) {
image->setDefaultProjectionColor(KoColor(cs));
if (bgColor.opacityU8() == OPACITY_OPAQUE_U8) {
layer->paintDevice()->setDefaultPixel(bgColor);
} else {
// Hack: with a semi-transparent background color, the projection isn't composited right if we just set the default pixel
KisFillPainter painter;
painter.begin(layer->paintDevice());
painter.fillRect(0, 0, width, height, bgColor, bgColor.opacityU8());
}
} else {
image->setDefaultProjectionColor(bgColor);
}
layer->setDirty(QRect(0, 0, width, height));
image->addNode(layer.data(), image->rootLayer().data());
setCurrentImage(image);
for(int i = 1; i < numberOfLayers; ++i) {
KisPaintLayerSP layer = new KisPaintLayer(image, image->nextLayerName(), OPACITY_OPAQUE_U8, cs);
image->addNode(layer, image->root(), i);
layer->setDirty(QRect(0, 0, width, height));
}
cfg.defImageWidth(width);
cfg.defImageHeight(height);
cfg.defImageResolution(imageResolution);
cfg.defColorModel(image->colorSpace()->colorModelId().id());
cfg.setDefaultColorDepth(image->colorSpace()->colorDepthId().id());
cfg.defColorProfile(image->colorSpace()->profile()->name());
QApplication::restoreOverrideCursor();
return true;
}
KoShapeBasedDocumentBase *KisDocument::shapeController() const
{
return d->shapeController;
}
KoShapeLayer* KisDocument::shapeForNode(KisNodeSP layer) const
{
return d->shapeController->shapeForNode(layer);
}
vKisNodeSP KisDocument::activeNodes() const
{
vKisNodeSP nodes;
Q_FOREACH (KisView *v, KisPart::instance()->views()) {
if (v->document() == this && v->viewManager()) {
KisNodeSP activeNode = v->viewManager()->activeNode();
if (activeNode && !nodes.contains(activeNode)) {
if (activeNode->inherits("KisMask")) {
activeNode = activeNode->parent();
}
nodes.append(activeNode);
}
}
}
return nodes;
}
QList<KisPaintingAssistantSP> KisDocument::assistants() const
{
return d->assistants;
}
void KisDocument::setAssistants(const QList<KisPaintingAssistantSP> value)
{
d->assistants = value;
}
void KisDocument::setPreActivatedNode(KisNodeSP activatedNode)
{
d->preActivatedNode = activatedNode;
}
KisNodeSP KisDocument::preActivatedNode() const
{
return d->preActivatedNode;
}
void KisDocument::setFileProgressUpdater(const QString &text)
{
d->suppressProgress = d->importExportManager->batchMode();
if (!d->suppressProgress) {
d->progressUpdater = new KoProgressUpdater(d->progressProxy, KoProgressUpdater::Unthreaded);
d->progressUpdater->start(100, text);
d->importExportManager->setProgresUpdater(d->progressUpdater);
if (KisPart::instance()->currentMainwindow()) {
connect(this, SIGNAL(sigProgress(int)), KisPart::instance()->currentMainwindow(), SLOT(slotProgress(int)));
connect(KisPart::instance()->currentMainwindow(), SIGNAL(sigProgressCanceled()), this, SIGNAL(sigProgressCanceled()));
}
}
}
void KisDocument::clearFileProgressUpdater()
{
if (!d->suppressProgress && d->progressUpdater) {
if (KisPart::instance()->currentMainwindow()) {
disconnect(KisPart::instance()->currentMainwindow(), SIGNAL(sigProgressCanceled()), this, SIGNAL(sigProgressCanceled()));
disconnect(this, SIGNAL(sigProgress(int)), KisPart::instance()->currentMainwindow(), SLOT(slotProgress(int)));
}
delete d->progressUpdater;
d->importExportManager->setProgresUpdater(0);
d->progressUpdater = 0;
}
}
void KisDocument::setFileProgressProxy()
{
if (!d->progressProxy && !d->importExportManager->batchMode()) {
d->fileProgressProxy = progressProxy();
} else {
d->fileProgressProxy = 0;
}
}
void KisDocument::clearFileProgressProxy()
{
if (d->fileProgressProxy) {
setProgressProxy(0);
delete d->fileProgressProxy;
d->fileProgressProxy = 0;
}
}
KisImageWSP KisDocument::image() const
{
return d->image;
}
KisImageSP KisDocument::savingImage() const
{
return d->savingImage;
}
void KisDocument::setCurrentImage(KisImageSP image)
{
if (d->image) {
// Disconnect existing sig/slot connections
d->image->disconnect(this);
d->shapeController->setImage(0);
d->image = 0;
}
if (!image) return;
d->setImageAndInitIdleWatcher(image);
d->shapeController->setImage(image);
setModified(false);
connect(d->image, SIGNAL(sigImageModified()), this, SLOT(setImageModified()), Qt::UniqueConnection);
d->image->initialRefreshGraph();
}
void KisDocument::setImageModified()
{
setModified(true);
}
KisUndoStore* KisDocument::createUndoStore()
{
return new KisDocumentUndoStore(this);
}
bool KisDocument::isAutosaving() const
{
return d->isAutosaving;
}
bool KisDocument::prepareLocksForSaving()
{
KisImageSP copiedImage;
// XXX: Restore this when
// a) cloning works correctly and
// b) doesn't take ages because it needs to refresh its entire graph and finally,
// c) we do use the saving image to save in the background.
{
Private::SafeSavingLocker locker(d, this);
if (locker.successfullyLocked()) {
copiedImage = d->image; //->clone(true);
}
else if (!isAutosaving()) {
// even though it is a recovery operation, we should ensure we do not enter saving twice!
std::unique_lock<StdLockableWrapper<QMutex>> l(d->savingLock, std::try_to_lock);
if (l.owns_lock()) {
d->lastErrorMessage = i18n("The image was still busy while saving. Your saved image might be incomplete.");
d->image->lock();
copiedImage = d->image; //->clone(true);
//copiedImage->initialRefreshGraph();
d->image->unlock();
}
}
}
bool result = false;
// ensure we do not enter saving twice
if (copiedImage && d->savingMutex.tryLock()) {
d->savingImage = copiedImage;
result = true;
} else {
qWarning() << "Could not lock the document for saving!";
d->lastErrorMessage = i18n("Could not lock the image for saving.");
}
return result;
}
void KisDocument::unlockAfterSaving()
{
d->savingImage = 0;
d->savingMutex.unlock();
}
diff --git a/libs/ui/KisDocument.h b/libs/ui/KisDocument.h
index d831511d94..9bcab7504c 100644
--- a/libs/ui/KisDocument.h
+++ b/libs/ui/KisDocument.h
@@ -1,627 +1,634 @@
/* This file is part of the Krita project
*
* Copyright (C) 2014 Boudewijn Rempt <boud@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISDOCUMENT_H
#define KISDOCUMENT_H
#include <QDateTime>
#include <QTransform>
#include <QList>
#include <klocalizedstring.h>
#include <KoPageLayout.h>
#include <KoDocumentBase.h>
#include <kundo2stack.h>
#include <kis_properties_configuration.h>
#include <kis_types.h>
#include <kis_painting_assistant.h>
#include <kis_debug.h>
#include "kritaui_export.h"
class QString;
class KUndo2Command;
class KoUnit;
class KoColor;
class KoColorSpace;
class KoShapeBasedDocumentBase;
class KoShapeLayer;
class KoStore;
class KoOdfReadStore;
class KoDocumentInfo;
class KoProgressUpdater;
class KoProgressProxy;
class KoDocumentInfoDlg;
class KisImportExportManager;
class KisUndoStore;
class KisPaintingAssistant;
class KisPart;
class KisGridConfig;
class KisGuidesConfig;
class QDomDocument;
class KisPart;
#define KIS_MIME_TYPE "application/x-krita"
/**
* The %Calligra document class
*
* This class provides some functionality each %Calligra document should have.
*
* @short The %Calligra document class
*/
class KRITAUI_EXPORT KisDocument : public QObject, public KoDocumentBase
{
Q_OBJECT
protected:
explicit KisDocument();
public:
enum OpenUrlFlags {
OPEN_URL_FLAG_NONE = 1 << 0,
OPEN_URL_FLAG_DO_NOT_ADD_TO_RECENT_FILES = 1 << 1,
};
/**
* Destructor.
*
* The destructor does not delete any attached KisView objects and it does not
* delete the attached widget as returned by widget().
*/
- virtual ~KisDocument();
+ ~KisDocument() override;
/**
* @brief reload Reloads the document from the original url
* @return the result of loading the document
*/
bool reload();
/**
* @brief openUrl Open an URL
* @param url The URL to open
* @param flags Control specific behavior
* @return success status
*/
bool openUrl(const QUrl &url, OpenUrlFlags flags = OPEN_URL_FLAG_NONE);
/**
* Opens the document given by @p url, without storing the URL
* in the KisDocument.
* Call this instead of openUrl() to implement KisMainWindow's
* File --> Import feature.
*
* @note This will call openUrl(). To differentiate this from an ordinary
* Open operation (in any reimplementation of openUrl() or openFile())
* call isImporting().
*/
bool importDocument(const QUrl &url);
/**
* Saves the document as @p url without changing the state of the
* KisDocument (URL, modified flag etc.). Call this instead of
* KisParts::ReadWritePart::saveAs() to implement KisMainWindow's
* File --> Export feature.
*
* @note This will call KisDocument::saveAs(). To differentiate this
* from an ordinary Save operation (in any reimplementation of
* saveFile()) call isExporting().
*/
bool exportDocument(const QUrl &url, KisPropertiesConfigurationSP exportConfiguration = 0);
/**
* @brief Sets whether the document can be edited or is read only.
*
* This recursively applied to all child documents and
* KisView::updateReadWrite is called for every attached
* view.
*/
void setReadWrite(bool readwrite = true);
/**
* To be preferred when a document exists. It is fast when calling
* it multiple times since it caches the result that readNativeFormatMimeType()
* delivers.
* This comes from the X-KDE-NativeMimeType key in the .desktop file.
*/
static QByteArray nativeFormatMimeType() { return KIS_MIME_TYPE; }
/// Checks whether a given mimetype can be handled natively.
bool isNativeFormat(const QByteArray& mimetype) const;
/// Returns a list of the mimetypes considered "native", i.e. which can
/// be saved by KisDocument without a filter, in *addition* to the main one
static QStringList extraNativeMimeTypes() { return QStringList() << KIS_MIME_TYPE; }
/**
* Returns the actual mimetype of the document
*/
- QByteArray mimeType() const;
+ QByteArray mimeType() const override;
/**
* @brief Sets the mime type for the document.
*
* When choosing "save as" this is also the mime type
* selected by default.
*/
- void setMimeType(const QByteArray & mimeType);
+ void setMimeType(const QByteArray & mimeType) override;
/**
* @brief Set the format in which the document should be saved.
*
* This is called on loading, and in "save as", so you shouldn't
* have to call it.
*
* @param mimeType the mime type (format) to use.
*/
- void setOutputMimeType(const QByteArray & mimeType);
- QByteArray outputMimeType() const;
+ void setOutputMimeType(const QByteArray & mimeType) override;
+ QByteArray outputMimeType() const override;
/**
* @return true if file operations should inhibit the option dialog
*/
bool fileBatchMode() const;
/**
* @param batchMode if true, do not show the option dialog for file operations.
*/
void setFileBatchMode(const bool batchMode);
/**
* Sets the error message to be shown to the user (use i18n()!)
* when loading or saving fails.
* If you asked the user about something and they chose "Cancel",
*/
void setErrorMessage(const QString& errMsg);
/**
* Return the last error message. Usually KisDocument takes care of
* showing it; this method is mostly provided for non-interactive use.
*/
QString errorMessage() const;
/**
* Sets the warning message to be shown to the user (use i18n()!)
* when loading or saving fails.
*/
void setWarningMessage(const QString& warningMsg);
/**
* Return the last warning message set by loading or saving. Warnings
* mean that the document could not be completely loaded, but the errors
* were not absolutely fatal.
*/
QString warningMessage() const;
/**
* @brief Generates a preview picture of the document
* @note The preview is used in the File Dialog and also to create the Thumbnail
*/
QPixmap generatePreview(const QSize& size);
/**
* Tells the document that its title has been modified, either because
* the modified status changes (this is done by setModified() ) or
* because the URL or the document-info's title changed.
*/
void setTitleModified();
/**
* @brief Sets the document to empty.
*
* Used after loading a template
* (which is not empty, but not the user's input).
*
* @see isEmpty()
*/
void setEmpty(bool empty = true);
/**
* Return a correctly created QDomDocument for this KisDocument,
* including processing instruction, complete DOCTYPE tag (with systemId and publicId), and root element.
* @param tagName the name of the tag for the root element
* @param version the DTD version (usually the application's version).
*/
QDomDocument createDomDocument(const QString& tagName, const QString& version) const;
/**
* Return a correctly created QDomDocument for an old (1.3-style) %Calligra document,
* including processing instruction, complete DOCTYPE tag (with systemId and publicId), and root element.
* This static method can be used e.g. by filters.
* @param appName the app's instance name, e.g. words, kspread, kpresenter etc.
* @param tagName the name of the tag for the root element, e.g. DOC for words/kpresenter.
* @param version the DTD version (usually the application's version).
*/
static QDomDocument createDomDocument(const QString& appName, const QString& tagName, const QString& version);
/**
* Loads a document in the native format from a given URL.
* Reimplement if your native format isn't XML.
*
* @param file the file to load - usually KReadOnlyPart::m_file or the result of a filter
*/
bool loadNativeFormat(const QString & file);
/**
* Activate/deactivate/configure the autosave feature.
* @param delay in seconds, 0 to disable
*/
void setAutoSaveDelay(int delay);
/**
* @return the information concerning this document.
* @see KoDocumentInfo
*/
KoDocumentInfo *documentInfo() const;
/**
* @return the object to report progress to.
*
* This is only not zero if loading or saving is in progress.
*
* One can add more KoUpdaters to it to make the progress reporting more
* accurate. If no active progress reporter is present, 0 is returned.
**/
KoProgressUpdater *progressUpdater() const;
/**
* Set a custom progress proxy to use to report loading
* progress to.
*/
void setProgressProxy(KoProgressProxy *progressProxy);
KoProgressProxy* progressProxy() const;
/**
* Performs a cleanup of unneeded backup files
*/
void removeAutoSaveFiles();
/**
* @brief setBackupFile enable/disable saving a backup of the file on saving
* @param saveBackup if true, Krita will save a backup of the file
*/
void setBackupFile(bool saveBackup);
/**
* Returns true if this document or any of its internal child documents are modified.
*/
- bool isModified() const;
+ bool isModified() const override;
/**
* @return caption of the document
*
* Caption is of the form "[title] - [url]",
* built out of the document info (title) and pretty-printed
* document URL.
* If the title is not present, only the URL it returned.
*/
QString caption() const;
/**
* Sets the document URL to empty URL
* KParts doesn't allow this, but %Calligra apps have e.g. templates
* After using loadNativeFormat on a template, one wants
* to set the url to QUrl()
*/
void resetURL();
/**
* @internal (public for KisMainWindow)
*/
void setMimeTypeAfterLoading(const QString& mimeType);
/**
* Returns the unit used to display all measures/distances.
*/
KoUnit unit() const;
/**
* Sets the unit used to display all measures/distances.
*/
void setUnit(const KoUnit &unit);
KisGridConfig gridConfig() const;
void setGridConfig(const KisGridConfig &config);
/// returns the guides data for this document.
const KisGuidesConfig& guidesConfig() const;
void setGuidesConfig(const KisGuidesConfig &data);
void clearUndoHistory();
/**
* Sets the modified flag on the document. This means that it has
* to be saved or not before deleting it.
*/
void setModified(bool _mod);
void updateEditingTime(bool forceStoreElapsed);
/**
* Returns the global undo stack
*/
KUndo2Stack *undoStack();
/**
* @brief importExportManager gives access to the internal import/export manager
* @return the document's import/export manager
*/
KisImportExportManager *importExportManager() const;
/**
* @brief serializeToNativeByteArray daves the document into a .kra file wtitten
* to a memory-based byte-array
* @return a byte array containing the .kra file
*/
QByteArray serializeToNativeByteArray();
+
+ /**
+ * @brief isInSaving shown if the document has any (background) saving process or not
+ * @return true if there is some saving in action
+ */
+ bool isInSaving() const;
+
public Q_SLOTS:
/**
* Adds a command to the undo stack and executes it by calling the redo() function.
* @param command command to add to the undo stack
*/
void addCommand(KUndo2Command *command);
/**
* Begins recording of a macro command. At the end endMacro needs to be called.
* @param text command description
*/
void beginMacro(const KUndo2MagicString &text);
/**
* Ends the recording of a macro command.
*/
void endMacro();
Q_SIGNALS:
/**
* This signal is emitted when the unit is changed by setUnit().
* It is common to connect views to it, in order to change the displayed units
* (e.g. in the rulers)
*/
void unitChanged(const KoUnit &unit);
/**
* Progress info while loading or saving. The value is in percents (i.e. a number between 0 and 100)
* Your KisDocument-derived class should emit the signal now and then during load/save.
* KisMainWindow will take care of displaying a progress bar automatically.
*/
void sigProgress(int value);
/**
* Progress cancel button pressed
* This is emitted by KisDocument
*/
void sigProgressCanceled();
/**
* Emitted e.g. at the beginning of a save operation
* This is emitted by KisDocument and used by KisView to display a statusbar message
*/
void statusBarMessage(const QString& text);
/**
* Emitted e.g. at the end of a save operation
* This is emitted by KisDocument and used by KisView to clear the statusbar message
*/
void clearStatusBarMessage();
/**
* Emitted when the document is modified
*/
void modified(bool);
void titleModified(const QString &caption, bool isModified);
void sigLoadingFinished();
void sigSavingFinished();
void sigGuidesConfigChanged(const KisGuidesConfig &config);
private:
friend class KisPart;
friend class SafeSavingLocker;
/**
* Generate a name for the document.
*/
QString newObjectName();
QString generateAutoSaveFileName(const QString & path) const;
/**
* Loads a document
*
* Applies a filter if necessary, and calls loadNativeFormat in any case
* You should not have to reimplement, except for very special cases.
*
* NOTE: this method also creates a new KisView instance!
*
* This method is called from the KReadOnlyPart::openUrl method.
*/
bool openFile();
/**
* Saves a document
*
* Applies a filter if necessary, and calls exportDocument in any case
* You should not have to reimplement, except for very special cases.
*/
bool saveFile(const QString &filePath, KisPropertiesConfigurationSP exportConfiguration = 0);
/** @internal */
void setModified();
/**
* Returns whether or not the current openUrl() or openFile() call is
* actually an import operation (like File --> Import).
* This is for informational purposes only.
*/
bool isImporting() const;
/**
* Returns whether or not the current saveFile() call is actually an export
* operation (like File --> Export).
* If this function returns true during saveFile() and you are changing
* some sort of state, you _must_ restore it before the end of saveFile();
* otherwise, File --> Export will not work properly.
*/
bool isExporting() const;
public:
- bool isAutosaving() const;
+ bool isAutosaving() const override;
public:
- QString localFilePath() const;
+ QString localFilePath() const override;
void setLocalFilePath( const QString &localFilePath );
KoDocumentInfoDlg* createDocumentInfoDialog(QWidget *parent, KoDocumentInfo *docInfo) const;
bool isReadWrite() const;
- QUrl url() const;
- void setUrl(const QUrl &url);
+ QUrl url() const override;
+ void setUrl(const QUrl &url) override;
bool closeUrl(bool promptToSave = true);
bool saveAs(const QUrl &url, KisPropertiesConfigurationSP exportConfigration = 0);
/**
* Create a new image that has this document as a parent and
* replace the current image with this image.
*/
bool newImage(const QString& name, qint32 width, qint32 height, const KoColorSpace * cs, const KoColor &bgColor, bool backgroundAsLayer,
int numberOfLayers, const QString &imageDescription, const double imageResolution);
KisImageWSP image() const;
/**
* @brief savingImage provides a detached, shallow copy of the original image that must be used when saving.
* Any strokes in progress will not be applied to this image, so the result might be missing some data. On
* the other hand, it won't block.
*
* @return a shallow copy of the original image, or 0 is saving is not in progress
*/
KisImageSP savingImage() const;
/**
* Adds progressproxy for file operations
*/
void setFileProgressProxy();
/**
* Clears progressproxy for file operations
*/
void clearFileProgressProxy();
/**
* Adds progressupdater for file operations
*/
void setFileProgressUpdater(const QString &text);
/**
* Clears progressupdater for file operations
*/
void clearFileProgressUpdater();
/**
* Set the current image to the specified image and turn undo on.
*/
void setCurrentImage(KisImageSP image);
KisUndoStore* createUndoStore();
/**
* The shape controller matches internal krita image layers with
* the flake shape hierarchy.
*/
KoShapeBasedDocumentBase * shapeController() const;
KoShapeLayer* shapeForNode(KisNodeSP layer) const;
/**
* @return a list of all layers that are active in all current views
*/
vKisNodeSP activeNodes() const;
/**
* set the list of nodes that were marked as currently active
*/
void setPreActivatedNode(KisNodeSP activatedNode);
/**
* @return the node that was set as active during loading
*/
KisNodeSP preActivatedNode() const;
QList<KisPaintingAssistantSP> assistants() const;
void setAssistants(const QList<KisPaintingAssistantSP> value);
bool save(KisPropertiesConfigurationSP exportConfiguration = 0);
Q_SIGNALS:
void completed();
void canceled(const QString &);
private Q_SLOTS:
void setImageModified();
void slotAutoSave();
/// Called by the undo stack when undo or redo is called
void slotUndoStackIndexChanged(int idx);
private:
bool prepareLocksForSaving();
void unlockAfterSaving();
QString prettyPathOrUrl() const;
bool openUrlInternal(const QUrl &url);
class Private;
Private *const d;
};
Q_DECLARE_METATYPE(KisDocument*)
#endif
diff --git a/libs/ui/KisImportExportFilter.h b/libs/ui/KisImportExportFilter.h
index 3725eebbf4..8cd2dac4fa 100644
--- a/libs/ui/KisImportExportFilter.h
+++ b/libs/ui/KisImportExportFilter.h
@@ -1,183 +1,183 @@
/* This file is part of the Calligra libraries
Copyright (C) 2001 Werner Trobin <trobin@kde.org>
2002 Werner Trobin <trobin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMPORT_EXPORT_FILTER_H
#define KIS_IMPORT_EXPORT_FILTER_H
#include <QObject>
#include <QIODevice>
#include <QMap>
#include <QPointer>
#include <QString>
#include <QPair>
#include <QList>
#include <KoID.h>
#include <QSharedPointer>
#include <kis_properties_configuration.h>
#include <kis_types.h>
#include <KisExportCheckBase.h>
class KoUpdater;
class KisDocument;
class KisConfigWidget;
#include "kritaui_export.h"
/**
* @brief The base class for import and export filters.
*
* Derive your filter class from this base class and implement
* the @ref convert() method. Don't forget to specify the Q_OBJECT
* macro in your class even if you don't use signals or slots.
* This is needed as filters are created on the fly.
*
* @note Take care: The m_chain pointer is invalid while the constructor
* runs due to the implementation -- @em don't use it in the constructor.
* After the constructor, when running the @ref convert() method it's
* guaranteed to be valid, so no need to check against 0.
*
* @note If the code is compiled in debug mode, setting CALLIGRA_DEBUG_FILTERS
* environment variable to any value disables deletion of temporary files while
* importing/exporting. This is useful for testing purposes.
*
* @author Werner Trobin <trobin@kde.org>
* @todo the class has no constructor and therefore cannot initialize its private class
*/
class KRITAUI_EXPORT KisImportExportFilter : public QObject
{
Q_OBJECT
public:
static const QString ImageContainsTransparencyTag;
static const QString ColorModelIDTag;
static const QString ColorDepthIDTag;
static const QString sRGBTag;
public:
/**
* This enum is used to signal the return state of your filter.
* Return OK in @ref convert() in case everything worked as expected.
* Feel free to add some more error conditions @em before the last item
* if it's needed.
*/
enum ConversionStatus { OK,
UsageError,
CreationError,
FileNotFound,
StorageCreationError,
BadMimeType,
BadConversionGraph,
WrongFormat,
NotImplemented,
ParsingError,
InternalError,
UserCancelled,
InvalidFormat,
FilterCreationError,
ProgressCancelled,
UnsupportedVersion,
JustInCaseSomeBrokenCompilerUsesLessThanAByte = 255
};
- virtual ~KisImportExportFilter();
+ ~KisImportExportFilter() override;
void setBatchMode(bool batchmode);
void setFilename(const QString &filename);
void setRealFilename(const QString &filename);
void setMimeType(const QString &mime);
void setUpdater(QPointer<KoUpdater> updater);
/**
* The filter chain calls this method to perform the actual conversion.
* The passed mimetypes should be a pair of those you specified in your
* .desktop file.
* You @em have to implement this method to make the filter work.
*
* @return The error status, see the @ref #ConversionStatus enum.
* KisImportExportFilter::OK means that everything is alright.
*/
virtual ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) = 0;
/**
* Get the text version of the status value
*/
static QString conversionStatusString(ConversionStatus status);
/**
* @brief defaultConfiguration defines the default settings for the given import export filter
* @param from The mimetype of the source file/document
* @param to The mimetype of the destination file/document
* @return a serializable KisPropertiesConfiguration object
*/
virtual KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
/**
* @brief lastSavedConfiguration return the last saved configuration for this filter
* @param from The mimetype of the source file/document
* @param to The mimetype of the destination file/document
* @return a serializable KisPropertiesConfiguration object
*/
virtual KisPropertiesConfigurationSP lastSavedConfiguration(const QByteArray &from = "", const QByteArray &to = "") const;
/**
* @brief createConfigurationWidget creates a widget that can be used to define the settings for a given import/export filter
* @param parent the ownder of the widget; the caller is responsible for deleting
* @param from The mimetype of the source file/document
* @param to The mimetype of the destination file/document
*
* @return the widget
*/
virtual KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
/**
* @brief generate and return the list of capabilities of this export filter. The list
* @return returns the list of capabilities of this export filter
*/
virtual QMap<QString, KisExportCheckBase*> exportChecks();
/// Override and return false for the filters that use a library that cannot handle file handles, only file names.
virtual bool supportsIO() const { return true; }
protected:
/**
* This is the constructor your filter has to call, obviously.
*/
KisImportExportFilter(QObject *parent = 0);
QString filename() const;
QString realFilename() const;
bool batchMode() const;
QByteArray mimeType() const;
void setProgress(int value);
virtual void initializeCapabilities();
void addCapability(KisExportCheckBase *capability);
void addSupportedColorModels(QList<QPair<KoID, KoID> > supportedColorModels, const QString &name, KisExportCheckBase::Level level = KisExportCheckBase::PARTIALLY);
private:
KisImportExportFilter(const KisImportExportFilter& rhs);
KisImportExportFilter& operator=(const KisImportExportFilter& rhs);
class Private;
Private *const d;
};
#endif
diff --git a/libs/ui/KisImportExportManager.h b/libs/ui/KisImportExportManager.h
index 7cdceea544..592050f946 100644
--- a/libs/ui/KisImportExportManager.h
+++ b/libs/ui/KisImportExportManager.h
@@ -1,155 +1,155 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMPORT_EXPORT_MANAGER_H
#define KIS_IMPORT_EXPORT_MANAGER_H
#include <QObject>
#include <QMap>
#include <QByteArray>
#include <QUrl>
#include "KisImportExportFilter.h"
#include "kritaui_export.h"
class KisDocument;
class KoProgressUpdater;
/**
* @brief The class managing all the filters.
*
* This class manages all filters for a %Calligra application. Normally
* you will not have to use it, since KisMainWindow takes care of loading
* and saving documents.
*
* @ref KisFilter
*
* @author Kalle Dalheimer <kalle@kde.org>
* @author Torben Weis <weis@kde.org>
* @author Werner Trobin <trobin@kde.org>
*/
class KRITAUI_EXPORT KisImportExportManager : public QObject
{
Q_OBJECT
public:
/**
* This enum is used to distinguish the import/export cases
*/
enum Direction { Import = 1, Export = 2 };
/**
* Create a filter manager for a document
*/
explicit KisImportExportManager(KisDocument *document);
public:
- virtual ~KisImportExportManager();
+ ~KisImportExportManager() override;
/**
* Imports the specified document and returns the resultant filename
* (most likely some file in /tmp).
* @p path can be either a URL or a filename.
* @p documentMimeType gives importDocument a hint about what type
* the document may be. It can be left empty.
*
* @return status signals the success/error of the conversion.
* If the QString which is returned isEmpty() and the status is OK,
* then we imported the file directly into the document.
*/
KisImportExportFilter::ConversionStatus importDocument(const QString &location, const QString &mimeType);
/**
* @brief Exports the given file/document to the specified URL/mimetype.
*
* If @p mimeType is empty, then the closest matching Calligra part is searched
* and when the method returns @p mimeType contains this mimetype.
* Oh, well, export is a C++ keyword ;)
*/
KisImportExportFilter::ConversionStatus exportDocument(const QString &location, const QString& realLocation, QByteArray &mimeType, bool showWarnings = true, KisPropertiesConfigurationSP exportConfiguration = 0);
///@name Static API
//@{
/**
* Suitable for passing to KoFileDialog::setMimeTypeFilters. The default mime
* gets set by the "users" of this method, as we do not have enough
* information here.
* Optionally, @p extraNativeMimeTypes are added after the native mimetype.
*/
static QStringList mimeFilter(Direction direction);
/**
* @brief filterForMimeType loads the relevant import/export plugin and returns it. The caller
* is responsible for deleting it!
* @param mimetype the mimetype we want to import/export. If there's more than one plugin, the one
* with the highest weight as defined in the json description will be taken
* @param direction import or export
* @return a pointer to the filter plugin or 0 if none could be found
*/
static KisImportExportFilter *filterForMimeType(const QString &mimetype, Direction direction);
/**
* Set the filter manager is batch mode (no dialog shown)
* instead of the interactive mode (dialog shown)
*/
void setBatchMode(const bool batch);
/**
* Get if the filter manager is batch mode (true)
* or in interactive mode (true)
*/
bool batchMode(void) const;
void setProgresUpdater(KoProgressUpdater *updater);
static QString askForAudioFileName(const QString &defaultDir, QWidget *parent);
private Q_SLOTS:
private:
KisImportExportFilter::ConversionStatus convert(Direction direction, const QString &location, const QString& realLocation, const QString &mimeType, bool showWarnings, KisPropertiesConfigurationSP exportConfiguration);
void fillStaticExportConfigurationProperties(KisPropertiesConfigurationSP exportConfiguration);
bool askUserAboutExportConfiguration(QSharedPointer<KisImportExportFilter> filter, KisPropertiesConfigurationSP exportConfiguration, const QByteArray &from, const QByteArray &to, bool batchMode, const bool showWarnings, bool *alsoAsKra);
KisImportExportFilter::ConversionStatus doImport(const QString &location, QSharedPointer<KisImportExportFilter> filter);
KisImportExportFilter::ConversionStatus doExport(const QString &location, QSharedPointer<KisImportExportFilter> filter, KisPropertiesConfigurationSP exportConfiguration, bool alsoAsKra);
KisImportExportFilter::ConversionStatus doExportImpl(const QString &location, QSharedPointer<KisImportExportFilter> filter, KisPropertiesConfigurationSP exportConfiguration);
// Private API
KisImportExportManager(const KisImportExportManager& rhs);
KisImportExportManager &operator=(const KisImportExportManager& rhs);
KisDocument *m_document;
/// A static cache for the availability checks of filters
static QStringList m_importMimeTypes;
static QStringList m_exportMimeTypes;
class Private;
Private * const d;
};
#endif // __KO_FILTER_MANAGER_H__
diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cpp
index 37cba1e57e..e33a5943d7 100644
--- a/libs/ui/KisMainWindow.cpp
+++ b/libs/ui/KisMainWindow.cpp
@@ -1,2415 +1,2408 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000-2006 David Faure <faure@kde.org>
Copyright (C) 2007, 2009 Thomas zander <zander@kde.org>
Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KisMainWindow.h"
#include <KoConfig.h>
// qt includes
#include <QApplication>
#include <QByteArray>
#include <QCloseEvent>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QDockWidget>
#include <QIcon>
#include <QLabel>
#include <QLayout>
#include <QMdiArea>
#include <QMdiSubWindow>
#include <QMutex>
#include <QMutexLocker>
#include <QPointer>
#include <QPrintDialog>
#include <QPrinter>
#include <QPrintPreviewDialog>
#include <QProgressBar>
#include <QToolButton>
#include <QSignalMapper>
#include <QTabBar>
#include <QMoveEvent>
#include <QUrl>
#include <QMessageBox>
#include <QTemporaryFile>
#include <QStatusBar>
#include <QMenu>
#include <QMenuBar>
#include <KisMimeDatabase.h>
#include <QMimeData>
#include <kactioncollection.h>
#include <QAction>
#include <kactionmenu.h>
#include <kis_debug.h>
#include <kedittoolbar.h>
#include <khelpmenu.h>
#include <klocalizedstring.h>
#include <kaboutdata.h>
#ifdef HAVE_KIO
#include <krecentdocument.h>
#endif
#include <krecentfilesaction.h>
#include <KoResourcePaths.h>
#include <ktoggleaction.h>
#include <ktoolbar.h>
#include <kmainwindow.h>
#include <kxmlguiwindow.h>
#include <kxmlguifactory.h>
#include <kxmlguiclient.h>
#include <kguiitem.h>
#include <kwindowconfig.h>
#include "KoDockFactoryBase.h"
#include "KoDockWidgetTitleBar.h"
#include "KoDocumentInfoDlg.h"
#include "KoDocumentInfo.h"
#include "KoFileDialog.h"
#include <kis_icon.h>
#include <KoPageLayoutDialog.h>
#include <KoPageLayoutWidget.h>
#include <KoToolManager.h>
#include <KoZoomController.h>
#include "KoToolDocker.h"
#include <KoToolBoxFactory.h>
#include <KoDockRegistry.h>
#include <KoPluginLoader.h>
#include <KoColorSpaceEngine.h>
#include <KisMimeDatabase.h>
#include <brushengine/kis_paintop_settings.h>
#include "dialogs/kis_about_application.h"
#include "dialogs/kis_delayed_save_dialog.h"
#include "dialogs/kis_dlg_preferences.h"
#include "kis_action.h"
#include "kis_action_manager.h"
#include "KisApplication.h"
#include "kis_canvas2.h"
#include "kis_canvas_controller.h"
#include "kis_canvas_resource_provider.h"
#include "kis_clipboard.h"
#include "kis_config.h"
#include "kis_config_notifier.h"
#include "kis_custom_image_widget.h"
#include <KisDocument.h>
#include "KisDocument.h"
#include "KisDocument.h"
#include "kis_group_layer.h"
#include "kis_icon_utils.h"
#include "kis_image_from_clipboard_widget.h"
#include "kis_image.h"
#include <KisImportExportFilter.h>
#include "KisImportExportManager.h"
#include "kis_mainwindow_observer.h"
#include "kis_node.h"
#include "KisOpenPane.h"
#include "kis_paintop_box.h"
#include "KisPart.h"
#include "KisPrintJob.h"
#include "kis_resource_server_provider.h"
#include "kis_signal_compressor_with_param.h"
#include "KisView.h"
#include "KisViewManager.h"
#include "thememanager.h"
#include "kis_animation_importer.h"
#include "dialogs/kis_dlg_import_image_sequence.h"
#include "kis_animation_exporter.h"
#include <mutex>
#ifdef Q_OS_WIN
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
class ToolDockerFactory : public KoDockFactoryBase
{
public:
ToolDockerFactory() : KoDockFactoryBase() { }
QString id() const override {
return "sharedtooldocker";
}
QDockWidget* createDockWidget() override {
KoToolDocker* dockWidget = new KoToolDocker();
dockWidget->setTabEnabled(false);
return dockWidget;
}
DockPosition defaultDockPosition() const override {
return DockRight;
}
};
class Q_DECL_HIDDEN KisMainWindow::Private
{
public:
Private(KisMainWindow *parent)
: q(parent)
, dockWidgetMenu(new KActionMenu(i18nc("@action:inmenu", "&Dockers"), parent))
, windowMenu(new KActionMenu(i18nc("@action:inmenu", "&Window"), parent))
, documentMenu(new KActionMenu(i18nc("@action:inmenu", "New &View"), parent))
, mdiArea(new QMdiArea(parent))
, windowMapper(new QSignalMapper(parent))
, documentMapper(new QSignalMapper(parent))
{
}
~Private() {
qDeleteAll(toolbarList);
}
KisMainWindow *q {0};
KisViewManager *viewManager {0};
QPointer<KisView> activeView;
QPointer<QProgressBar> progress;
QPointer<QToolButton> progressCancel;
QMutex progressMutex;
QList<QAction *> toolbarList;
bool firstTime {true};
bool windowSizeDirty {false};
bool readOnly {false};
bool isImporting {false};
bool isExporting {false};
bool noCleanup {false};
KisAction *showDocumentInfo {0};
KisAction *saveAction {0};
KisAction *saveActionAs {0};
// KisAction *printAction;
// KisAction *printActionPreview;
// KisAction *exportPdf {0};
KisAction *importAnimation {0};
KisAction *closeAll {0};
// KisAction *reloadFile;
KisAction *importFile {0};
KisAction *exportFile {0};
KisAction *undo {0};
KisAction *redo {0};
KisAction *newWindow {0};
KisAction *close {0};
KisAction *mdiCascade {0};
KisAction *mdiTile {0};
KisAction *mdiNextWindow {0};
KisAction *mdiPreviousWindow {0};
KisAction *toggleDockers {0};
KisAction *toggleDockerTitleBars {0};
KisAction *expandingSpacers[2];
KActionMenu *dockWidgetMenu;
KActionMenu *windowMenu;
KActionMenu *documentMenu;
KHelpMenu *helpMenu {0};
KRecentFilesAction *recentFiles {0};
QUrl lastExportUrl;
QMap<QString, QDockWidget *> dockWidgetsMap;
QMap<QDockWidget *, bool> dockWidgetVisibilityMap;
QByteArray dockerStateBeforeHiding;
KoToolDocker *toolOptionsDocker {0};
QCloseEvent *deferredClosingEvent {0};
Digikam::ThemeManager *themeManager {0};
QMdiArea *mdiArea;
QMdiSubWindow *activeSubWindow {0};
QSignalMapper *windowMapper;
QSignalMapper *documentMapper;
QByteArray lastExportedFormat;
QScopedPointer<KisSignalCompressorWithParam<int> > tabSwitchCompressor;
QMutex savingEntryMutex;
KisActionManager * actionManager() {
return viewManager->actionManager();
}
QTabBar* findTabBarHACK() {
QObjectList objects = mdiArea->children();
Q_FOREACH (QObject *object, objects) {
QTabBar *bar = qobject_cast<QTabBar*>(object);
if (bar) {
return bar;
}
}
return 0;
}
};
KisMainWindow::KisMainWindow()
: KXmlGuiWindow()
, d(new Private(this))
{
KisConfig cfg;
d->viewManager = new KisViewManager(this, actionCollection());
KConfigGroup group( KSharedConfig::openConfig(), "theme");
d->themeManager = new Digikam::ThemeManager(group.readEntry("Theme", "Krita dark"), this);
setAcceptDrops(true);
setStandardToolBarMenuEnabled(true);
setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
setDockNestingEnabled(true);
qApp->setStartDragDistance(25); // 25 px is a distance that works well for Tablet and Mouse events
#ifdef Q_OS_OSX
setUnifiedTitleAndToolBarOnMac(true);
#endif
connect(this, SIGNAL(restoringDone()), this, SLOT(forceDockTabFonts()));
connect(this, SIGNAL(themeChanged()), d->viewManager, SLOT(updateIcons()));
connect(KisPart::instance(), SIGNAL(documentClosed(QString)), SLOT(updateWindowMenu()));
connect(KisPart::instance(), SIGNAL(documentOpened(QString)), SLOT(updateWindowMenu()));
connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), this, SLOT(configChanged()));
actionCollection()->addAssociatedWidget(this);
KoPluginLoader::instance()->load("Krita/ViewPlugin", "Type == 'Service' and ([X-Krita-Version] == 28)", KoPluginLoader::PluginsConfig(), d->viewManager);
KoToolBoxFactory toolBoxFactory;
QDockWidget *toolbox = createDockWidget(&toolBoxFactory);
toolbox->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
if (cfg.toolOptionsInDocker()) {
ToolDockerFactory toolDockerFactory;
d->toolOptionsDocker = qobject_cast<KoToolDocker*>(createDockWidget(&toolDockerFactory));
d->toolOptionsDocker->toggleViewAction()->setEnabled(true);
}
QMap<QString, QAction*> dockwidgetActions;
dockwidgetActions[toolbox->toggleViewAction()->text()] = toolbox->toggleViewAction();
Q_FOREACH (const QString & docker, KoDockRegistry::instance()->keys()) {
KoDockFactoryBase *factory = KoDockRegistry::instance()->value(docker);
QDockWidget *dw = createDockWidget(factory);
dockwidgetActions[dw->toggleViewAction()->text()] = dw->toggleViewAction();
}
if (d->toolOptionsDocker) {
dockwidgetActions[d->toolOptionsDocker->toggleViewAction()->text()] = d->toolOptionsDocker->toggleViewAction();
}
connect(KoToolManager::instance(), SIGNAL(toolOptionWidgetsChanged(KoCanvasController*, QList<QPointer<QWidget> >)), this, SLOT(newOptionWidgets(KoCanvasController*, QList<QPointer<QWidget> >)));
Q_FOREACH (QString title, dockwidgetActions.keys()) {
d->dockWidgetMenu->addAction(dockwidgetActions[title]);
}
Q_FOREACH (QDockWidget *wdg, dockWidgets()) {
if ((wdg->features() & QDockWidget::DockWidgetClosable) == 0) {
wdg->setVisible(true);
}
}
Q_FOREACH (KoCanvasObserverBase* observer, canvasObservers()) {
observer->setObservedCanvas(0);
KisMainwindowObserver* mainwindowObserver = dynamic_cast<KisMainwindowObserver*>(observer);
if (mainwindowObserver) {
mainwindowObserver->setMainWindow(d->viewManager);
}
}
d->mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->mdiArea->setTabPosition(QTabWidget::North);
d->mdiArea->setTabsClosable(true);
setCentralWidget(d->mdiArea);
connect(d->mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(subWindowActivated()));
connect(d->windowMapper, SIGNAL(mapped(QWidget*)), this, SLOT(setActiveSubWindow(QWidget*)));
connect(d->documentMapper, SIGNAL(mapped(QObject*)), this, SLOT(newView(QObject*)));
createActions();
setAutoSaveSettings("krita", false);
subWindowActivated();
updateWindowMenu();
if (isHelpMenuEnabled() && !d->helpMenu) {
// workaround for KHelpMenu (or rather KAboutData::applicationData()) internally
// not using the Q*Application metadata ATM, which results e.g. in the bugreport wizard
// not having the app version preset
// fixed hopefully in KF5 5.22.0, patch pending
QGuiApplication *app = qApp;
KAboutData aboutData(app->applicationName(), app->applicationDisplayName(), app->applicationVersion());
aboutData.setOrganizationDomain(app->organizationDomain().toUtf8());
d->helpMenu = new KHelpMenu(this, aboutData, false);
// workaround-less version:
// d->helpMenu = new KHelpMenu(this, QString()/*unused*/, false);
// The difference between using KActionCollection->addAction() is that
// these actions do not get tied to the MainWindow. What does this all do?
KActionCollection *actions = d->viewManager->actionCollection();
QAction *helpContentsAction = d->helpMenu->action(KHelpMenu::menuHelpContents);
QAction *whatsThisAction = d->helpMenu->action(KHelpMenu::menuWhatsThis);
QAction *reportBugAction = d->helpMenu->action(KHelpMenu::menuReportBug);
QAction *switchLanguageAction = d->helpMenu->action(KHelpMenu::menuSwitchLanguage);
QAction *aboutAppAction = d->helpMenu->action(KHelpMenu::menuAboutApp);
QAction *aboutKdeAction = d->helpMenu->action(KHelpMenu::menuAboutKDE);
if (helpContentsAction) {
actions->addAction(helpContentsAction->objectName(), helpContentsAction);
}
if (whatsThisAction) {
actions->addAction(whatsThisAction->objectName(), whatsThisAction);
}
if (reportBugAction) {
actions->addAction(reportBugAction->objectName(), reportBugAction);
}
if (switchLanguageAction) {
actions->addAction(switchLanguageAction->objectName(), switchLanguageAction);
}
if (aboutAppAction) {
actions->addAction(aboutAppAction->objectName(), aboutAppAction);
}
if (aboutKdeAction) {
actions->addAction(aboutKdeAction->objectName(), aboutKdeAction);
}
connect(d->helpMenu, SIGNAL(showAboutApplication()), SLOT(showAboutApplication()));
}
// KDE' libs 4''s help contents action is broken outside kde, for some reason... We can handle it just as easily ourselves
QAction *helpAction = actionCollection()->action("help_contents");
helpAction->disconnect();
connect(helpAction, SIGNAL(triggered()), this, SLOT(showManual()));
#if 0
//check for colliding shortcuts
QSet<QKeySequence> existingShortcuts;
Q_FOREACH (QAction* action, actionCollection()->actions()) {
if(action->shortcut() == QKeySequence(0)) {
continue;
}
dbgKrita << "shortcut " << action->text() << " " << action->shortcut();
Q_ASSERT(!existingShortcuts.contains(action->shortcut()));
existingShortcuts.insert(action->shortcut());
}
#endif
configChanged();
// If we have customized the toolbars, load that first
setLocalXMLFile(KoResourcePaths::locateLocal("data", "krita.xmlgui"));
setXMLFile(":/kxmlgui5/krita.xmlgui");
guiFactory()->addClient(this);
// Create and plug toolbar list for Settings menu
QList<QAction *> toolbarList;
Q_FOREACH (QWidget* it, guiFactory()->containers("ToolBar")) {
KToolBar * toolBar = ::qobject_cast<KToolBar *>(it);
if (toolBar) {
if (toolBar->objectName() == "BrushesAndStuff") {
toolBar->setEnabled(false);
}
KToggleAction* act = new KToggleAction(i18n("Show %1 Toolbar", toolBar->windowTitle()), this);
actionCollection()->addAction(toolBar->objectName().toUtf8(), act);
act->setCheckedState(KGuiItem(i18n("Hide %1 Toolbar", toolBar->windowTitle())));
connect(act, SIGNAL(toggled(bool)), this, SLOT(slotToolbarToggled(bool)));
act->setChecked(!toolBar->isHidden());
toolbarList.append(act);
} else
warnUI << "Toolbar list contains a " << it->metaObject()->className() << " which is not a toolbar!";
}
plugActionList("toolbarlist", toolbarList);
setToolbarList(toolbarList);
applyToolBarLayout();
d->viewManager->updateGUI();
d->viewManager->updateIcons();
#ifdef Q_OS_WIN
auto w = qApp->activeWindow();
if (w) QWindowsWindowFunctions::setHasBorderInFullScreen(w->windowHandle(), true);
#endif
QTimer::singleShot(1000, this, SLOT(checkSanity()));
{
using namespace std::placeholders; // For _1 placeholder
std::function<void (int)> callback(
std::bind(&KisMainWindow::switchTab, this, _1));
d->tabSwitchCompressor.reset(
new KisSignalCompressorWithParam<int>(500, callback, KisSignalCompressor::FIRST_INACTIVE));
}
}
void KisMainWindow::setNoCleanup(bool noCleanup)
{
d->noCleanup = noCleanup;
}
KisMainWindow::~KisMainWindow()
{
// Q_FOREACH (QAction *ac, actionCollection()->actions()) {
// QAction *action = qobject_cast<QAction*>(ac);
// if (action) {
// dbgKrita << "<Action"
// << "name=" << action->objectName()
// << "icon=" << action->icon().name()
// << "text=" << action->text().replace("&", "&amp;")
// << "whatsThis=" << action->whatsThis()
// << "toolTip=" << action->toolTip().replace("<html>", "").replace("</html>", "")
// << "iconText=" << action->iconText().replace("&", "&amp;")
// << "shortcut=" << action->shortcut(QAction::ActiveShortcut).toString()
// << "defaultShortcut=" << action->shortcut(QAction::DefaultShortcut).toString()
// << "isCheckable=" << QString((action->isChecked() ? "true" : "false"))
// << "statusTip=" << action->statusTip()
// << "/>" ;
// }
// else {
// dbgKrita << "Got a QAction:" << ac->objectName();
// }
// }
// The doc and view might still exist (this is the case when closing the window)
KisPart::instance()->removeMainWindow(this);
if (d->noCleanup)
return;
delete d->viewManager;
delete d;
}
void KisMainWindow::addView(KisView *view)
{
if (d->activeView == view) return;
if (d->activeView) {
d->activeView->disconnect(this);
}
showView(view);
updateCaption();
emit restoringDone();
if (d->activeView) {
connect(d->activeView, SIGNAL(titleModified(QString,bool)), SLOT(slotDocumentTitleModified(QString,bool)));
}
}
void KisMainWindow::showView(KisView *imageView)
{
if (imageView && activeView() != imageView) {
// XXX: find a better way to initialize this!
imageView->setViewManager(d->viewManager);
imageView->canvasBase()->setFavoriteResourceManager(d->viewManager->paintOpBox()->favoriteResourcesManager());
imageView->slotLoadingFinished();
QMdiSubWindow *subwin = d->mdiArea->addSubWindow(imageView);
subwin->setAttribute(Qt::WA_DeleteOnClose, true);
connect(subwin, SIGNAL(destroyed()), SLOT(updateWindowMenu()));
KisConfig cfg;
subwin->setOption(QMdiSubWindow::RubberBandMove, cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
subwin->setOption(QMdiSubWindow::RubberBandResize, cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
subwin->setWindowIcon(qApp->windowIcon());
/**
* Hack alert!
*
* Here we explicitly request KoToolManager to emit all the tool
* activation signals, to reinitialize the tool options docker.
*
* That is needed due to a design flaw we have in the
* initialization procedure. The tool in the KoToolManager is
* initialized in KisView::setViewManager() calls, which
* happens early enough. During this call the tool manager
* requests KoCanvasControllerWidget to emit the signal to
* update the widgets in the tool docker. *But* at that moment
* of time the view is not yet connected to the main window,
* because it happens in KisViewManager::setCurrentView a bit
* later. This fact makes the widgets updating signals be lost
* and never reach the tool docker.
*
* So here we just explicitly call the tool activation stub.
*/
KoToolManager::instance()->initializeCurrentToolForCanvas();
if (d->mdiArea->subWindowList().size() == 1) {
imageView->showMaximized();
}
else {
imageView->show();
}
// No, no, no: do not try to call this _before_ the show() has
// been called on the view; only when that has happened is the
// opengl context active, and very bad things happen if we tell
// the dockers to update themselves with a view if the opengl
// context is not active.
setActiveView(imageView);
updateWindowMenu();
updateCaption();
}
}
void KisMainWindow::slotPreferences()
{
if (KisDlgPreferences::editPreferences()) {
KisConfigNotifier::instance()->notifyConfigChanged();
// XXX: should this be changed for the views in other windows as well?
Q_FOREACH (QPointer<KisView> koview, KisPart::instance()->views()) {
KisViewManager *view = qobject_cast<KisViewManager*>(koview);
if (view) {
// Update the settings for all nodes -- they don't query
// KisConfig directly because they need the settings during
// compositing, and they don't connect to the config notifier
// because nodes are not QObjects (because only one base class
// can be a QObject).
KisNode* node = dynamic_cast<KisNode*>(view->image()->rootLayer().data());
node->updateSettings();
}
}
d->viewManager->showHideScrollbars();
}
}
void KisMainWindow::slotThemeChanged()
{
// save theme changes instantly
KConfigGroup group( KSharedConfig::openConfig(), "theme");
group.writeEntry("Theme", d->themeManager->currentThemeName());
// reload action icons!
Q_FOREACH (QAction *action, actionCollection()->actions()) {
KisIconUtils::updateIcon(action);
}
emit themeChanged();
}
void KisMainWindow::updateReloadFileAction(KisDocument *doc)
{
Q_UNUSED(doc);
// d->reloadFile->setEnabled(doc && !doc->url().isEmpty());
}
void KisMainWindow::setReadWrite(bool readwrite)
{
d->saveAction->setEnabled(readwrite);
d->importFile->setEnabled(readwrite);
d->readOnly = !readwrite;
updateCaption();
}
void KisMainWindow::addRecentURL(const QUrl &url)
{
dbgUI << "KisMainWindow::addRecentURL url=" << url.toDisplayString();
// Add entry to recent documents list
// (call coming from KisDocument because it must work with cmd line, template dlg, file/open, etc.)
if (!url.isEmpty()) {
bool ok = true;
if (url.isLocalFile()) {
QString path = url.adjusted(QUrl::StripTrailingSlash).toLocalFile();
const QStringList tmpDirs = KoResourcePaths::resourceDirs("tmp");
for (QStringList::ConstIterator it = tmpDirs.begin() ; ok && it != tmpDirs.end() ; ++it)
if (path.contains(*it))
ok = false; // it's in the tmp resource
#ifdef HAVE_KIO
if (ok) {
KRecentDocument::add(QUrl::fromLocalFile(path));
}
#endif
}
#ifdef HAVE_KIO
else {
KRecentDocument::add(url.adjusted(QUrl::StripTrailingSlash));
}
#endif
if (ok) {
d->recentFiles->addUrl(url);
}
saveRecentFiles();
}
}
void KisMainWindow::saveRecentFiles()
{
// Save list of recent files
KSharedConfigPtr config = KSharedConfig::openConfig();
d->recentFiles->saveEntries(config->group("RecentFiles"));
config->sync();
// Tell all windows to reload their list, after saving
// Doesn't work multi-process, but it's a start
Q_FOREACH (KMainWindow* window, KMainWindow::memberList())
static_cast<KisMainWindow *>(window)->reloadRecentFileList();
}
void KisMainWindow::reloadRecentFileList()
{
d->recentFiles->loadEntries( KSharedConfig::openConfig()->group("RecentFiles"));
}
void KisMainWindow::updateCaption()
{
if (!d->mdiArea->activeSubWindow()) {
updateCaption(QString(), false);
}
else if (d->activeView && d->activeView->document()){
QString caption( d->activeView->document()->caption() );
if (d->readOnly) {
caption += ' ' + i18n("(write protected)");
}
d->activeView->setWindowTitle(caption);
updateCaption(caption, d->activeView->document()->isModified());
if (!d->activeView->document()->url().fileName().isEmpty())
d->saveAction->setToolTip(i18n("Save as %1", d->activeView->document()->url().fileName()));
else
d->saveAction->setToolTip(i18n("Save"));
}
}
void KisMainWindow::updateCaption(const QString & caption, bool mod)
{
dbgUI << "KisMainWindow::updateCaption(" << caption << "," << mod << ")";
#ifdef KRITA_ALPHA
setCaption(QString("ALPHA %1: %2").arg(KRITA_ALPHA).arg(caption), mod);
return;
#endif
#ifdef KRITA_BETA
setCaption(QString("BETA %1: %2").arg(KRITA_BETA).arg(caption), mod);
return;
#endif
#ifdef KRITA_RC
setCaption(QString("RELEASE CANDIDATE %1: %2").arg(KRITA_RC).arg(caption), mod);
return;
#endif
setCaption(caption, mod);
}
KisView *KisMainWindow::activeView() const
{
if (d->activeView) {
return d->activeView;
}
return 0;
}
bool KisMainWindow::openDocument(const QUrl &url)
{
if (!QFile(url.toLocalFile()).exists()) {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("The file %1 does not exist.", url.url()));
d->recentFiles->removeUrl(url); //remove the file from the recent-opened-file-list
saveRecentFiles();
return false;
}
return openDocumentInternal(url);
}
bool KisMainWindow::openDocumentInternal(const QUrl &url, KisDocument *newdoc)
{
if (!url.isLocalFile()) {
qDebug() << "KisMainWindow::openDocumentInternal. Not a local file:" << url;
return false;
}
if (!newdoc) {
newdoc = KisPart::instance()->createDocument();
}
d->firstTime = true;
connect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int)));
connect(newdoc, SIGNAL(completed()), this, SLOT(slotLoadCompleted()));
connect(newdoc, SIGNAL(canceled(const QString &)), this, SLOT(slotLoadCanceled(const QString &)));
bool openRet = (!d->isImporting) ? newdoc->openUrl(url) : newdoc->importDocument(url);
if (!openRet) {
delete newdoc;
return false;
}
KisPart::instance()->addDocument(newdoc);
updateReloadFileAction(newdoc);
if (!QFileInfo(url.toLocalFile()).isWritable()) {
setReadWrite(false);
}
return true;
}
void KisMainWindow::addViewAndNotifyLoadingCompleted(KisDocument *document)
{
KisView *view = KisPart::instance()->createView(document, resourceManager(), actionCollection(), this);
addView(view);
emit guiLoadingFinished();
}
QStringList KisMainWindow::showOpenFileDialog()
{
KoFileDialog dialog(this, KoFileDialog::ImportFiles, "OpenDocument");
dialog.setDefaultDir(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setCaption(d->isImporting ? i18n("Import Images") : i18n("Open Images"));
return dialog.filenames();
}
// Separate from openDocument to handle async loading (remote URLs)
void KisMainWindow::slotLoadCompleted()
{
KisDocument *newdoc = qobject_cast<KisDocument*>(sender());
if (newdoc && newdoc->image()) {
addViewAndNotifyLoadingCompleted(newdoc);
disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int)));
disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotLoadCompleted()));
disconnect(newdoc, SIGNAL(canceled(const QString &)), this, SLOT(slotLoadCanceled(const QString &)));
emit loadCompleted();
}
}
void KisMainWindow::slotLoadCanceled(const QString & errMsg)
{
dbgUI << "KisMainWindow::slotLoadCanceled";
if (!errMsg.isEmpty()) // empty when canceled by user
QMessageBox::critical(this, i18nc("@title:window", "Krita"), errMsg);
// ... can't delete the document, it's the one who emitted the signal...
KisDocument* doc = qobject_cast<KisDocument*>(sender());
Q_ASSERT(doc);
disconnect(doc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int)));
disconnect(doc, SIGNAL(completed()), this, SLOT(slotLoadCompleted()));
disconnect(doc, SIGNAL(canceled(const QString &)), this, SLOT(slotLoadCanceled(const QString &)));
}
void KisMainWindow::slotSaveCanceled(const QString &errMsg)
{
dbgUI << "KisMainWindow::slotSaveCanceled";
if (!errMsg.isEmpty()) // empty when canceled by user
QMessageBox::critical(this, i18nc("@title:window", "Krita"), errMsg);
slotSaveCompleted();
}
void KisMainWindow::slotSaveCompleted()
{
dbgUI << "KisMainWindow::slotSaveCompleted";
KisDocument* doc = qobject_cast<KisDocument*>(sender());
Q_ASSERT(doc);
disconnect(doc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int)));
disconnect(doc, SIGNAL(completed()), this, SLOT(slotSaveCompleted()));
disconnect(doc, SIGNAL(canceled(const QString &)), this, SLOT(slotSaveCanceled(const QString &)));
if (d->deferredClosingEvent) {
KXmlGuiWindow::closeEvent(d->deferredClosingEvent);
}
}
bool KisMainWindow::hackIsSaving() const
{
StdLockableWrapper<QMutex> wrapper(&d->savingEntryMutex);
std::unique_lock<StdLockableWrapper<QMutex>> l(wrapper, std::try_to_lock);
return !l.owns_lock();
}
bool KisMainWindow::saveDocument(KisDocument *document, bool saveas)
{
if (!document) {
return true;
}
/**
* Make sure that we cannot enter this method twice!
*
* The lower level functions may call processEvents() so
* double-entry is quite possible to achieve. Here we try to lock
* the mutex, and if it is failed, just cancel saving.
*/
StdLockableWrapper<QMutex> wrapper(&d->savingEntryMutex);
std::unique_lock<StdLockableWrapper<QMutex>> l(wrapper, std::try_to_lock);
if (!l.owns_lock()) return false;
// no busy wait for saving because it is dangerous!
KisDelayedSaveDialog dlg(document->image(), KisDelayedSaveDialog::SaveDialog, 0, this);
dlg.blockIfImageIsBusy();
if (dlg.result() == KisDelayedSaveDialog::Rejected) {
return false;
} else if (dlg.result() == KisDelayedSaveDialog::Ignored) {
QMessageBox::critical(0,
i18nc("@title:window", "Krita"),
i18n("You are saving a file while the image is "
"still rendering. The saved file may be "
"incomplete or corrupted.\n\n"
"Please select a location where the original "
"file will not be overridden!"));
saveas = true;
}
bool reset_url;
if (document->url().isEmpty()) {
reset_url = true;
saveas = true;
} else {
reset_url = false;
}
connect(document, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int)));
connect(document, SIGNAL(completed()), this, SLOT(slotSaveCompleted()));
connect(document, SIGNAL(canceled(const QString &)), this, SLOT(slotSaveCanceled(const QString &)));
QUrl oldURL = document->url();
QString oldFile = document->localFilePath();
QByteArray _native_format = document->nativeFormatMimeType();
QByteArray oldOutputFormat = document->outputMimeType();
QUrl suggestedURL = document->url();
QStringList mimeFilter;
mimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
if (!mimeFilter.contains(oldOutputFormat) && !d->isExporting) {
dbgUI << "KisMainWindow::saveDocument no export filter for" << oldOutputFormat;
// --- don't setOutputMimeType in case the user cancels the Save As
// dialog and then tries to just plain Save ---
// suggest a different filename extension (yes, we fortunately don't all live in a world of magic :))
QString suggestedFilename = suggestedURL.fileName();
if (!suggestedFilename.isEmpty()) { // ".kra" looks strange for a name
int c = suggestedFilename.lastIndexOf('.');
const QString ext = KisMimeDatabase::suffixesForMimeType(_native_format).first();
if (!ext.isEmpty()) {
if (c < 0)
suggestedFilename = suggestedFilename + "." + ext;
else
suggestedFilename = suggestedFilename.left(c) + "." + ext;
} else { // current filename extension wrong anyway
if (c > 0) {
// this assumes that a . signifies an extension, not just a .
suggestedFilename = suggestedFilename.left(c);
}
}
suggestedURL = suggestedURL.adjusted(QUrl::RemoveFilename);
suggestedURL.setPath(suggestedURL.path() + suggestedFilename);
}
// force the user to choose outputMimeType
saveas = true;
}
bool ret = false;
if (document->url().isEmpty() || saveas) {
// if you're just File/Save As'ing to change filter options you
// don't want to be reminded about overwriting files etc.
bool justChangingFilterOptions = false;
KoFileDialog dialog(this, KoFileDialog::SaveFile, "SaveAs");
dialog.setCaption(i18n("untitled"));
if (d->isExporting && !d->lastExportUrl.isEmpty()) {
dialog.setDefaultDir(d->lastExportUrl.toLocalFile());
}
else {
dialog.setDefaultDir(suggestedURL.toLocalFile());
}
// Default to all supported file types if user is exporting, otherwise use Krita default
dialog.setMimeTypeFilters(mimeFilter, QString(_native_format));
QUrl newURL = QUrl::fromUserInput(dialog.filename());
if (newURL.isLocalFile()) {
QString fn = newURL.toLocalFile();
if (QFileInfo(fn).completeSuffix().isEmpty()) {
fn.append(KisMimeDatabase::suffixesForMimeType(_native_format).first());
newURL = QUrl::fromLocalFile(fn);
}
}
if (document->documentInfo()->aboutInfo("title") == i18n("Unnamed")) {
QString fn = newURL.toLocalFile();
QFileInfo info(fn);
document->documentInfo()->setAboutInfo("title", info.baseName());
}
QByteArray outputFormat = _native_format;
QString outputFormatString = KisMimeDatabase::mimeTypeForFile(newURL.toLocalFile());
outputFormat = outputFormatString.toLatin1();
if (!d->isExporting) {
justChangingFilterOptions = (newURL == document->url()) && (outputFormat == document->mimeType());
}
else {
justChangingFilterOptions = (newURL == d->lastExportUrl) && (outputFormat == d->lastExportedFormat);
}
bool bOk = true;
if (newURL.isEmpty()) {
bOk = false;
}
if (bOk) {
bool wantToSave = true;
// don't change this line unless you know what you're doing :)
if (!justChangingFilterOptions) {
if (!document->isNativeFormat(outputFormat))
wantToSave = true;
}
if (wantToSave) {
//
// Note:
// If the user is stupid enough to Export to the current URL,
// we do _not_ change this operation into a Save As. Reasons
// follow:
//
// 1. A check like "d->isExporting && oldURL == newURL"
// doesn't _always_ work on case-insensitive filesystems
// and inconsistent behaviour is bad.
// 2. It is probably not a good idea to change document->mimeType
// and friends because the next time the user File/Save's,
// (not Save As) they won't be expecting that they are
// using their File/Export settings
//
// As a bad side-effect of this, the modified flag will not
// be updated and it is possible that what is currently on
// their screen is not what is stored on disk (through loss
// of formatting). But if you are dumb enough to change
// mimetype but not the filename, then arguably, _you_ are
// the "bug" :)
//
// - Clarence
//
document->setOutputMimeType(outputFormat);
if (!d->isExporting) { // Save As
ret = document->saveAs(newURL);
if (ret) {
dbgUI << "Successful Save As!";
addRecentURL(newURL);
setReadWrite(true);
} else {
dbgUI << "Failed Save As!";
document->setUrl(oldURL);
document->setLocalFilePath(oldFile);
document->setOutputMimeType(oldOutputFormat);
}
} else { // Export
ret = document->exportDocument(newURL);
if (ret) {
// a few file dialog convenience things
d->lastExportUrl = newURL;
d->lastExportedFormat = outputFormat;
}
// always restore output format
document->setOutputMimeType(oldOutputFormat);
}
} // if (wantToSave) {
else
ret = false;
} // if (bOk) {
else
ret = false;
} else { // saving
// be sure document has the correct outputMimeType!
if (d->isExporting || document->isModified()) {
ret = document->save();
}
if (!ret) {
dbgUI << "Failed Save!";
document->setUrl(oldURL);
document->setLocalFilePath(oldFile);
}
}
if (!ret && reset_url)
document->resetURL(); //clean the suggested filename as the save dialog was rejected
updateReloadFileAction(document);
updateCaption();
return ret;
}
void KisMainWindow::undo()
{
if (activeView()) {
activeView()->undoAction()->trigger();
d->undo->setText(activeView()->undoAction()->text());
}
}
void KisMainWindow::redo()
{
if (activeView()) {
activeView()->redoAction()->trigger();
d->redo->setText(activeView()->redoAction()->text());
}
}
void KisMainWindow::closeEvent(QCloseEvent *e)
{
d->mdiArea->closeAllSubWindows();
QAction *action= d->viewManager->actionCollection()->action("view_show_canvas_only");
if ((action) && (action->isChecked())) {
action->setChecked(false);
}
KConfigGroup cfg( KSharedConfig::openConfig(), "MainWindow");
cfg.writeEntry("ko_geometry", saveGeometry().toBase64());
cfg.writeEntry("ko_windowstate", saveState().toBase64());
{
KConfigGroup group( KSharedConfig::openConfig(), "theme");
group.writeEntry("Theme", d->themeManager->currentThemeName());
}
QList<QMdiSubWindow*> childrenList = d->mdiArea->subWindowList();
if (childrenList.isEmpty()) {
d->deferredClosingEvent = e;
if (!d->dockerStateBeforeHiding.isEmpty()) {
restoreState(d->dockerStateBeforeHiding);
}
statusBar()->setVisible(true);
menuBar()->setVisible(true);
saveWindowSettings();
if (d->noCleanup)
return;
- Q_FOREACH (QMdiSubWindow *subwin, d->mdiArea->subWindowList()) {
- KisView *view = dynamic_cast<KisView*>(subwin);
- if (view) {
- KisPart::instance()->removeView(view);
- }
- }
-
if (!d->dockWidgetVisibilityMap.isEmpty()) { // re-enable dockers for persistency
Q_FOREACH (QDockWidget* dockWidget, d->dockWidgetsMap)
dockWidget->setVisible(d->dockWidgetVisibilityMap.value(dockWidget));
}
} else {
e->setAccepted(false);
}
}
void KisMainWindow::saveWindowSettings()
{
KSharedConfigPtr config = KSharedConfig::openConfig();
if (d->windowSizeDirty ) {
dbgUI << "KisMainWindow::saveWindowSettings";
KConfigGroup group = config->group("MainWindow");
KWindowConfig::saveWindowSize(windowHandle(), group);
config->sync();
d->windowSizeDirty = false;
}
if (!d->activeView || d->activeView->document()) {
// Save toolbar position into the config file of the app, under the doc's component name
KConfigGroup group = KSharedConfig::openConfig()->group("krita");
saveMainWindowSettings(group);
// Save collapsable state of dock widgets
for (QMap<QString, QDockWidget*>::const_iterator i = d->dockWidgetsMap.constBegin();
i != d->dockWidgetsMap.constEnd(); ++i) {
if (i.value()->widget()) {
KConfigGroup dockGroup = group.group(QString("DockWidget ") + i.key());
dockGroup.writeEntry("Collapsed", i.value()->widget()->isHidden());
dockGroup.writeEntry("Locked", i.value()->property("Locked").toBool());
dockGroup.writeEntry("DockArea", (int) dockWidgetArea(i.value()));
dockGroup.writeEntry("xPosition", (int) i.value()->widget()->x());
dockGroup.writeEntry("yPosition", (int) i.value()->widget()->y());
dockGroup.writeEntry("width", (int) i.value()->widget()->width());
dockGroup.writeEntry("height", (int) i.value()->widget()->height());
}
}
}
KSharedConfig::openConfig()->sync();
resetAutoSaveSettings(); // Don't let KMainWindow override the good stuff we wrote down
}
void KisMainWindow::resizeEvent(QResizeEvent * e)
{
d->windowSizeDirty = true;
KXmlGuiWindow::resizeEvent(e);
}
void KisMainWindow::setActiveView(KisView* view)
{
d->activeView = view;
updateCaption();
actionCollection()->action("edit_undo")->setText(activeView()->undoAction()->text());
actionCollection()->action("edit_redo")->setText(activeView()->redoAction()->text());
d->viewManager->setCurrentView(view);
}
void KisMainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasUrls() ||
event->mimeData()->hasFormat("application/x-krita-node") ||
event->mimeData()->hasFormat("application/x-qt-image")) {
event->accept();
}
}
void KisMainWindow::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
Q_FOREACH (const QUrl &url, event->mimeData()->urls()) {
openDocument(url);
}
}
}
void KisMainWindow::dragMoveEvent(QDragMoveEvent * event)
{
QTabBar *tabBar = d->findTabBarHACK();
if (!tabBar && d->mdiArea->viewMode() == QMdiArea::TabbedView) {
qWarning() << "WARNING!!! Cannot find QTabBar in the main window! Looks like Qt has changed behavior. Drag & Drop between multiple tabs might not work properly (tabs will not switch automatically)!";
}
if (tabBar && tabBar->isVisible()) {
QPoint pos = tabBar->mapFromGlobal(mapToGlobal(event->pos()));
if (tabBar->rect().contains(pos)) {
const int tabIndex = tabBar->tabAt(pos);
if (tabIndex >= 0 && tabBar->currentIndex() != tabIndex) {
d->tabSwitchCompressor->start(tabIndex);
}
} else if (d->tabSwitchCompressor->isActive()) {
d->tabSwitchCompressor->stop();
}
}
}
void KisMainWindow::dragLeaveEvent(QDragLeaveEvent * /*event*/)
{
if (d->tabSwitchCompressor->isActive()) {
d->tabSwitchCompressor->stop();
}
}
void KisMainWindow::switchTab(int index)
{
QTabBar *tabBar = d->findTabBarHACK();
if (!tabBar) return;
tabBar->setCurrentIndex(index);
}
void KisMainWindow::slotFileNew()
{
const QStringList mimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Import);
KisOpenPane *startupWidget = new KisOpenPane(this, mimeFilter, QStringLiteral("templates/"));
startupWidget->setWindowModality(Qt::WindowModal);
KisConfig cfg;
int w = cfg.defImageWidth();
int h = cfg.defImageHeight();
const double resolution = cfg.defImageResolution();
const QString colorModel = cfg.defColorModel();
const QString colorDepth = cfg.defaultColorDepth();
const QString colorProfile = cfg.defColorProfile();
CustomDocumentWidgetItem item;
item.widget = new KisCustomImageWidget(startupWidget,
w,
h,
resolution,
colorModel,
colorDepth,
colorProfile,
i18n("Unnamed"));
item.icon = "document-new";
startupWidget->addCustomDocumentWidget(item.widget, item.title, item.icon);
QSize sz = KisClipboard::instance()->clipSize();
if (sz.isValid() && sz.width() != 0 && sz.height() != 0) {
w = sz.width();
h = sz.height();
}
item.widget = new KisImageFromClipboard(startupWidget,
w,
h,
resolution,
colorModel,
colorDepth,
colorProfile,
i18n("Unnamed"));
item.title = i18n("Create from Clipboard");
item.icon = "tab-new";
startupWidget->addCustomDocumentWidget(item.widget, item.title, item.icon);
// calls deleteLater
connect(startupWidget, SIGNAL(documentSelected(KisDocument*)), KisPart::instance(), SLOT(startCustomDocument(KisDocument*)));
// calls deleteLater
connect(startupWidget, SIGNAL(openTemplate(const QUrl&)), KisPart::instance(), SLOT(openTemplate(const QUrl&)));
startupWidget->exec();
// Cancel calls deleteLater...
}
void KisMainWindow::slotFileOpen()
{
QStringList urls = showOpenFileDialog();
if (urls.isEmpty())
return;
Q_FOREACH (const QString& url, urls) {
if (!url.isEmpty()) {
bool res = openDocument(QUrl::fromLocalFile(url));
if (!res) {
warnKrita << "Loading" << url << "failed";
}
}
}
}
void KisMainWindow::slotFileOpenRecent(const QUrl &url)
{
(void) openDocument(QUrl::fromLocalFile(url.toLocalFile()));
}
void KisMainWindow::slotFileSave()
{
if (saveDocument(d->activeView->document())) {
emit documentSaved();
}
}
void KisMainWindow::slotFileSaveAs()
{
if (saveDocument(d->activeView->document(), true)) {
emit documentSaved();
}
}
KoCanvasResourceManager *KisMainWindow::resourceManager() const
{
return d->viewManager->resourceProvider()->resourceManager();
}
int KisMainWindow::viewCount() const
{
return d->mdiArea->subWindowList().size();
}
bool KisMainWindow::restoreWorkspace(const QByteArray &state)
{
QByteArray oldState = saveState();
const bool showTitlebars = KisConfig().showDockerTitleBars();
// needed because otherwise the layout isn't correctly restored in some situations
Q_FOREACH (QDockWidget *dock, dockWidgets()) {
dock->hide();
dock->titleBarWidget()->setVisible(showTitlebars);
}
bool success = KXmlGuiWindow::restoreState(state);
if (!success) {
KXmlGuiWindow::restoreState(oldState);
Q_FOREACH (QDockWidget *dock, dockWidgets()) {
if (dock->titleBarWidget()) {
dock->titleBarWidget()->setVisible(showTitlebars || dock->isFloating());
}
}
return false;
}
Q_FOREACH (QDockWidget *dock, dockWidgets()) {
if (dock->titleBarWidget()) {
const bool isCollapsed = (dock->widget() && dock->widget()->isHidden()) || !dock->widget();
dock->titleBarWidget()->setVisible(showTitlebars || (dock->isFloating() && isCollapsed));
}
}
return success;
}
KisViewManager *KisMainWindow::viewManager() const
{
return d->viewManager;
}
void KisMainWindow::slotDocumentInfo()
{
if (!d->activeView->document())
return;
KoDocumentInfo *docInfo = d->activeView->document()->documentInfo();
if (!docInfo)
return;
KoDocumentInfoDlg *dlg = d->activeView->document()->createDocumentInfoDialog(this, docInfo);
if (dlg->exec()) {
if (dlg->isDocumentSaved()) {
d->activeView->document()->setModified(false);
} else {
d->activeView->document()->setModified(true);
}
d->activeView->document()->setTitleModified();
}
delete dlg;
}
bool KisMainWindow::slotFileCloseAll()
{
Q_FOREACH (QMdiSubWindow *subwin, d->mdiArea->subWindowList()) {
if (subwin) {
if(!subwin->close())
return false;
}
}
updateCaption();
return true;
}
void KisMainWindow::slotFileQuit()
{
if(!slotFileCloseAll())
return;
close();
Q_FOREACH (QPointer<KisMainWindow> mainWin, KisPart::instance()->mainWindows()) {
if (mainWin != this) {
if(!mainWin->slotFileCloseAll())
return;
mainWin->close();
}
}
}
void KisMainWindow::slotFilePrint()
{
if (!activeView())
return;
KisPrintJob *printJob = activeView()->createPrintJob();
if (printJob == 0)
return;
applyDefaultSettings(printJob->printer());
QPrintDialog *printDialog = activeView()->createPrintDialog( printJob, this );
if (printDialog && printDialog->exec() == QDialog::Accepted) {
printJob->printer().setPageMargins(0.0, 0.0, 0.0, 0.0, QPrinter::Point);
printJob->printer().setPaperSize(QSizeF(activeView()->image()->width() / (72.0 * activeView()->image()->xRes()),
activeView()->image()->height()/ (72.0 * activeView()->image()->yRes())),
QPrinter::Inch);
printJob->startPrinting(KisPrintJob::DeleteWhenDone);
}
else {
delete printJob;
}
delete printDialog;
}
void KisMainWindow::slotFilePrintPreview()
{
if (!activeView())
return;
KisPrintJob *printJob = activeView()->createPrintJob();
if (printJob == 0)
return;
/* Sets the startPrinting() slot to be blocking.
The Qt print-preview dialog requires the printing to be completely blocking
and only return when the full document has been printed.
By default the KisPrintingDialog is non-blocking and
multithreading, setting blocking to true will allow it to be used in the preview dialog */
printJob->setProperty("blocking", true);
QPrintPreviewDialog *preview = new QPrintPreviewDialog(&printJob->printer(), this);
printJob->setParent(preview); // will take care of deleting the job
connect(preview, SIGNAL(paintRequested(QPrinter*)), printJob, SLOT(startPrinting()));
preview->exec();
delete preview;
}
KisPrintJob* KisMainWindow::exportToPdf(QString pdfFileName)
{
if (!activeView())
return 0;
if (!activeView()->document())
return 0;
KoPageLayout pageLayout;
pageLayout.width = 0;
pageLayout.height = 0;
pageLayout.topMargin = 0;
pageLayout.bottomMargin = 0;
pageLayout.leftMargin = 0;
pageLayout.rightMargin = 0;
if (pdfFileName.isEmpty()) {
KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
QString defaultDir = group.readEntry("SavePdfDialog");
if (defaultDir.isEmpty())
defaultDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
QUrl startUrl = QUrl::fromLocalFile(defaultDir);
KisDocument* pDoc = d->activeView->document();
/** if document has a file name, take file name and replace extension with .pdf */
if (pDoc && pDoc->url().isValid()) {
startUrl = pDoc->url();
QString fileName = startUrl.toLocalFile();
fileName = fileName.replace( QRegExp( "\\.\\w{2,5}$", Qt::CaseInsensitive ), ".pdf" );
startUrl = startUrl.adjusted(QUrl::RemoveFilename);
startUrl.setPath(startUrl.path() + fileName );
}
QPointer<KoPageLayoutDialog> layoutDlg(new KoPageLayoutDialog(this, pageLayout));
layoutDlg->setWindowModality(Qt::WindowModal);
if (layoutDlg->exec() != QDialog::Accepted || !layoutDlg) {
delete layoutDlg;
return 0;
}
pageLayout = layoutDlg->pageLayout();
delete layoutDlg;
KoFileDialog dialog(this, KoFileDialog::SaveFile, "OpenDocument");
dialog.setCaption(i18n("Export as PDF"));
dialog.setDefaultDir(startUrl.toLocalFile());
dialog.setMimeTypeFilters(QStringList() << "application/pdf");
QUrl url = QUrl::fromUserInput(dialog.filename());
pdfFileName = url.toLocalFile();
if (pdfFileName.isEmpty())
return 0;
}
KisPrintJob *printJob = activeView()->createPrintJob();
if (printJob == 0)
return 0;
if (isHidden()) {
printJob->setProperty("noprogressdialog", true);
}
applyDefaultSettings(printJob->printer());
// TODO for remote files we have to first save locally and then upload.
printJob->printer().setOutputFileName(pdfFileName);
printJob->printer().setDocName(pdfFileName);
printJob->printer().setColorMode(QPrinter::Color);
if (pageLayout.format == KoPageFormat::CustomSize) {
printJob->printer().setPaperSize(QSizeF(pageLayout.width, pageLayout.height), QPrinter::Millimeter);
} else {
printJob->printer().setPaperSize(KoPageFormat::printerPageSize(pageLayout.format));
}
printJob->printer().setPageMargins(pageLayout.leftMargin, pageLayout.topMargin, pageLayout.rightMargin, pageLayout.bottomMargin, QPrinter::Millimeter);
switch (pageLayout.orientation) {
case KoPageFormat::Portrait:
printJob->printer().setOrientation(QPrinter::Portrait);
break;
case KoPageFormat::Landscape:
printJob->printer().setOrientation(QPrinter::Landscape);
break;
}
//before printing check if the printer can handle printing
if (!printJob->canPrint()) {
QMessageBox::critical(this, i18nc("@title:window", "Krita"), i18n("Cannot export to the specified file"));
}
printJob->startPrinting(KisPrintJob::DeleteWhenDone);
return printJob;
}
void KisMainWindow::importAnimation()
{
if (!activeView()) return;
KisDocument *document = activeView()->document();
if (!document) return;
KisDlgImportImageSequence dlg(this, document);
if (dlg.exec() == QDialog::Accepted) {
QStringList files = dlg.files();
int firstFrame = dlg.firstFrame();
int step = dlg.step();
document->setFileProgressProxy();
document->setFileProgressUpdater(i18n("Import frames"));
KisAnimationImporter importer(document);
KisImportExportFilter::ConversionStatus status = importer.import(files, firstFrame, step);
document->clearFileProgressUpdater();
document->clearFileProgressProxy();
if (status != KisImportExportFilter::OK && status != KisImportExportFilter::InternalError) {
QString msg = KisImportExportFilter::conversionStatusString(status);
if (!msg.isEmpty())
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not finish import animation:\n%1", msg));
}
activeView()->canvasBase()->refetchDataFromImage();
}
}
void KisMainWindow::slotConfigureToolbars()
{
KConfigGroup group = KSharedConfig::openConfig()->group("krita");
saveMainWindowSettings(group);
KEditToolBar edit(factory(), this);
connect(&edit, SIGNAL(newToolBarConfig()), this, SLOT(slotNewToolbarConfig()));
(void) edit.exec();
applyToolBarLayout();
}
void KisMainWindow::slotNewToolbarConfig()
{
applyMainWindowSettings(KSharedConfig::openConfig()->group("krita"));
KXMLGUIFactory *factory = guiFactory();
Q_UNUSED(factory);
// Check if there's an active view
if (!d->activeView)
return;
plugActionList("toolbarlist", d->toolbarList);
applyToolBarLayout();
}
void KisMainWindow::slotToolbarToggled(bool toggle)
{
//dbgUI <<"KisMainWindow::slotToolbarToggled" << sender()->name() <<" toggle=" << true;
// The action (sender) and the toolbar have the same name
KToolBar * bar = toolBar(sender()->objectName());
if (bar) {
if (toggle) {
bar->show();
}
else {
bar->hide();
}
if (d->activeView && d->activeView->document()) {
KConfigGroup group = KSharedConfig::openConfig()->group("krita");
saveMainWindowSettings(group);
}
} else
warnUI << "slotToolbarToggled : Toolbar " << sender()->objectName() << " not found!";
}
void KisMainWindow::viewFullscreen(bool fullScreen)
{
KisConfig cfg;
cfg.setFullscreenMode(fullScreen);
if (fullScreen) {
setWindowState(windowState() | Qt::WindowFullScreen); // set
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen); // reset
}
}
void KisMainWindow::slotProgress(int value)
{
qApp->processEvents();
StdLockableWrapper<QMutex> wrapper(&d->progressMutex);
std::unique_lock<StdLockableWrapper<QMutex>> l(wrapper, std::try_to_lock);
if (!l.owns_lock()) return;
dbgUI << "KisMainWindow::slotProgress" << value;
if (value <= -1 || value >= 100) {
if (d->progress) {
statusBar()->removeWidget(d->progress);
delete d->progress;
d->progress = 0;
disconnect(d->progressCancel, SIGNAL(clicked()), this, SLOT(slotProgressCanceled()));
statusBar()->removeWidget(d->progressCancel);
delete d->progressCancel;
d->progressCancel = 0;
}
d->firstTime = true;
return;
}
if (d->firstTime || !d->progress) {
// The statusbar might not even be created yet.
// So check for that first, and create it if necessary
QStatusBar *bar = findChild<QStatusBar *>();
if (!bar) {
statusBar()->show();
QApplication::sendPostedEvents(this, QEvent::ChildAdded);
}
if (d->progress) {
statusBar()->removeWidget(d->progress);
delete d->progress;
d->progress = 0;
disconnect(d->progressCancel, SIGNAL(clicked()), this, SLOT(slotProgressCanceled()));
statusBar()->removeWidget(d->progressCancel);
delete d->progressCancel;
d->progress = 0;
}
d->progressCancel = new QToolButton(statusBar());
d->progressCancel->setMaximumHeight(statusBar()->fontMetrics().height());
d->progressCancel->setIcon(KisIconUtils::loadIcon("process-stop"));
statusBar()->addPermanentWidget(d->progressCancel);
d->progress = new QProgressBar(statusBar());
d->progress->setMaximumHeight(statusBar()->fontMetrics().height());
d->progress->setRange(0, 100);
statusBar()->addPermanentWidget(d->progress);
connect(d->progressCancel, SIGNAL(clicked()), this, SLOT(slotProgressCanceled()));
d->progress->show();
d->progressCancel->show();
d->firstTime = false;
}
if (!d->progress.isNull()) {
d->progress->setValue(value);
}
qApp->processEvents();
}
void KisMainWindow::slotProgressCanceled()
{
emit sigProgressCanceled();
}
void KisMainWindow::setMaxRecentItems(uint _number)
{
d->recentFiles->setMaxItems(_number);
}
void KisMainWindow::slotReloadFile()
{
KisDocument* document = d->activeView->document();
if (!document || document->url().isEmpty())
return;
if (document->isModified()) {
bool ok = QMessageBox::question(this,
i18nc("@title:window", "Krita"),
i18n("You will lose all changes made since your last save\n"
"Do you want to continue?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes;
if (!ok)
return;
}
QUrl url = document->url();
saveWindowSettings();
if (!document->reload()) {
QMessageBox::critical(this, i18nc("@title:window", "Krita"), i18n("Error: Could not reload this document"));
}
return;
}
void KisMainWindow::slotImportFile()
{
dbgUI << "slotImportFile()";
d->isImporting = true;
slotFileOpen();
d->isImporting = false;
}
void KisMainWindow::slotExportFile()
{
dbgUI << "slotExportFile()";
d->isExporting = true;
slotFileSaveAs();
d->isExporting = false;
}
QDockWidget* KisMainWindow::createDockWidget(KoDockFactoryBase* factory)
{
QDockWidget* dockWidget = 0;
if (!d->dockWidgetsMap.contains(factory->id())) {
dockWidget = factory->createDockWidget();
// It is quite possible that a dock factory cannot create the dock; don't
// do anything in that case.
if (!dockWidget) {
warnKrita << "Could not create docker for" << factory->id();
return 0;
}
KoDockWidgetTitleBar *titleBar = dynamic_cast<KoDockWidgetTitleBar*>(dockWidget->titleBarWidget());
// Check if the dock widget is supposed to be collapsable
if (!dockWidget->titleBarWidget()) {
titleBar = new KoDockWidgetTitleBar(dockWidget);
dockWidget->setTitleBarWidget(titleBar);
titleBar->setCollapsable(factory->isCollapsable());
}
titleBar->setFont(KoDockRegistry::dockFont());
dockWidget->setObjectName(factory->id());
dockWidget->setParent(this);
if (dockWidget->widget() && dockWidget->widget()->layout())
dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1);
Qt::DockWidgetArea side = Qt::RightDockWidgetArea;
bool visible = true;
switch (factory->defaultDockPosition()) {
case KoDockFactoryBase::DockTornOff:
dockWidget->setFloating(true); // position nicely?
break;
case KoDockFactoryBase::DockTop:
side = Qt::TopDockWidgetArea; break;
case KoDockFactoryBase::DockLeft:
side = Qt::LeftDockWidgetArea; break;
case KoDockFactoryBase::DockBottom:
side = Qt::BottomDockWidgetArea; break;
case KoDockFactoryBase::DockRight:
side = Qt::RightDockWidgetArea; break;
case KoDockFactoryBase::DockMinimized:
default:
side = Qt::RightDockWidgetArea;
visible = false;
}
KConfigGroup group = KSharedConfig::openConfig()->group("krita").group("DockWidget " + factory->id());
side = static_cast<Qt::DockWidgetArea>(group.readEntry("DockArea", static_cast<int>(side)));
if (side == Qt::NoDockWidgetArea) side = Qt::RightDockWidgetArea;
addDockWidget(side, dockWidget);
if (!visible) {
dockWidget->hide();
}
bool collapsed = factory->defaultCollapsed();
bool locked = false;
group = KSharedConfig::openConfig()->group("krita").group("DockWidget " + factory->id());
collapsed = group.readEntry("Collapsed", collapsed);
locked = group.readEntry("Locked", locked);
//dbgKrita << "docker" << factory->id() << dockWidget << "collapsed" << collapsed << "locked" << locked << "titlebar" << titleBar;
if (titleBar && collapsed)
titleBar->setCollapsed(true);
if (titleBar && locked)
titleBar->setLocked(true);
d->dockWidgetsMap.insert(factory->id(), dockWidget);
}
else {
dockWidget = d->dockWidgetsMap[factory->id()];
}
#ifdef Q_OS_OSX
dockWidget->setAttribute(Qt::WA_MacSmallSize, true);
#endif
dockWidget->setFont(KoDockRegistry::dockFont());
connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts()));
return dockWidget;
}
void KisMainWindow::forceDockTabFonts()
{
Q_FOREACH (QObject *child, children()) {
if (child->inherits("QTabBar")) {
((QTabBar *)child)->setFont(KoDockRegistry::dockFont());
}
}
}
QList<QDockWidget*> KisMainWindow::dockWidgets() const
{
return d->dockWidgetsMap.values();
}
QDockWidget* KisMainWindow::dockWidget(const QString &id)
{
if (!d->dockWidgetsMap.contains(id)) return 0;
return d->dockWidgetsMap[id];
}
QList<KoCanvasObserverBase*> KisMainWindow::canvasObservers() const
{
QList<KoCanvasObserverBase*> observers;
Q_FOREACH (QDockWidget *docker, dockWidgets()) {
KoCanvasObserverBase *observer = dynamic_cast<KoCanvasObserverBase*>(docker);
if (observer) {
observers << observer;
}
else {
warnKrita << docker << "is not a canvas observer";
}
}
return observers;
}
void KisMainWindow::toggleDockersVisibility(bool visible)
{
if (!visible) {
d->dockerStateBeforeHiding = saveState();
Q_FOREACH (QObject* widget, children()) {
if (widget->inherits("QDockWidget")) {
QDockWidget* dw = static_cast<QDockWidget*>(widget);
if (dw->isVisible()) {
dw->hide();
}
}
}
}
else {
restoreState(d->dockerStateBeforeHiding);
}
}
void KisMainWindow::setToolbarList(QList<QAction *> toolbarList)
{
qDeleteAll(d->toolbarList);
d->toolbarList = toolbarList;
}
void KisMainWindow::slotDocumentTitleModified(const QString &caption, bool mod)
{
updateCaption();
updateCaption(caption, mod);
updateReloadFileAction(d->activeView ? d->activeView->document() : 0);
}
void KisMainWindow::subWindowActivated()
{
bool enabled = (activeKisView() != 0);
d->mdiCascade->setEnabled(enabled);
d->mdiNextWindow->setEnabled(enabled);
d->mdiPreviousWindow->setEnabled(enabled);
d->mdiTile->setEnabled(enabled);
d->close->setEnabled(enabled);
d->closeAll->setEnabled(enabled);
setActiveSubWindow(d->mdiArea->activeSubWindow());
Q_FOREACH (QToolBar *tb, toolBars()) {
if (tb->objectName() == "BrushesAndStuff") {
tb->setEnabled(enabled);
}
}
updateCaption();
d->actionManager()->updateGUI();
}
void KisMainWindow::updateWindowMenu()
{
QMenu *menu = d->windowMenu->menu();
menu->clear();
menu->addAction(d->newWindow);
menu->addAction(d->documentMenu);
QMenu *docMenu = d->documentMenu->menu();
docMenu->clear();
Q_FOREACH (QPointer<KisDocument> doc, KisPart::instance()->documents()) {
if (doc) {
QString title = doc->url().toDisplayString();
if (title.isEmpty() && doc->image()) {
title = doc->image()->objectName();
}
QAction *action = docMenu->addAction(title);
action->setIcon(qApp->windowIcon());
connect(action, SIGNAL(triggered()), d->documentMapper, SLOT(map()));
d->documentMapper->setMapping(action, doc);
}
}
menu->addSeparator();
menu->addAction(d->close);
menu->addAction(d->closeAll);
if (d->mdiArea->viewMode() == QMdiArea::SubWindowView) {
menu->addSeparator();
menu->addAction(d->mdiTile);
menu->addAction(d->mdiCascade);
}
menu->addSeparator();
menu->addAction(d->mdiNextWindow);
menu->addAction(d->mdiPreviousWindow);
menu->addSeparator();
QList<QMdiSubWindow *> windows = d->mdiArea->subWindowList();
for (int i = 0; i < windows.size(); ++i) {
QPointer<KisView>child = qobject_cast<KisView*>(windows.at(i)->widget());
if (child && child->document()) {
QString text;
if (i < 9) {
text = i18n("&%1 %2", i + 1, child->document()->url().toDisplayString());
}
else {
text = i18n("%1 %2", i + 1, child->document()->url().toDisplayString());
}
QAction *action = menu->addAction(text);
action->setIcon(qApp->windowIcon());
action->setCheckable(true);
action->setChecked(child == activeKisView());
connect(action, SIGNAL(triggered()), d->windowMapper, SLOT(map()));
d->windowMapper->setMapping(action, windows.at(i));
}
}
updateCaption();
}
void KisMainWindow::setActiveSubWindow(QWidget *window)
{
if (!window) return;
QMdiSubWindow *subwin = qobject_cast<QMdiSubWindow *>(window);
//dbgKrita << "setActiveSubWindow();" << subwin << d->activeSubWindow;
if (subwin && subwin != d->activeSubWindow) {
KisView *view = qobject_cast<KisView *>(subwin->widget());
//dbgKrita << "\t" << view << activeView();
if (view && view != activeView()) {
d->mdiArea->setActiveSubWindow(subwin);
setActiveView(view);
}
d->activeSubWindow = subwin;
}
updateWindowMenu();
d->actionManager()->updateGUI();
}
void KisMainWindow::configChanged()
{
KisConfig cfg;
QMdiArea::ViewMode viewMode = (QMdiArea::ViewMode)cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView);
d->mdiArea->setViewMode(viewMode);
Q_FOREACH (QMdiSubWindow *subwin, d->mdiArea->subWindowList()) {
subwin->setOption(QMdiSubWindow::RubberBandMove, cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
subwin->setOption(QMdiSubWindow::RubberBandResize, cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
}
KConfigGroup group( KSharedConfig::openConfig(), "theme");
d->themeManager->setCurrentTheme(group.readEntry("Theme", "Krita dark"));
d->actionManager()->updateGUI();
QBrush brush(cfg.getMDIBackgroundColor());
d->mdiArea->setBackground(brush);
QString backgroundImage = cfg.getMDIBackgroundImage();
if (backgroundImage != "") {
QImage image(backgroundImage);
QBrush brush(image);
d->mdiArea->setBackground(brush);
}
d->mdiArea->update();
}
void KisMainWindow::newView(QObject *document)
{
KisDocument *doc = qobject_cast<KisDocument*>(document);
addViewAndNotifyLoadingCompleted(doc);
d->actionManager()->updateGUI();
}
void KisMainWindow::newWindow()
{
KisPart::instance()->createMainWindow()->show();
}
void KisMainWindow::closeCurrentWindow()
{
d->mdiArea->currentSubWindow()->close();
d->actionManager()->updateGUI();
}
void KisMainWindow::checkSanity()
{
// print error if the lcms engine is not available
if (!KoColorSpaceEngineRegistry::instance()->contains("icc")) {
// need to wait 1 event since exiting here would not work.
m_errorMessage = i18n("The Krita LittleCMS color management plugin is not installed. Krita will quit now.");
m_dieOnError = true;
QTimer::singleShot(0, this, SLOT(showErrorAndDie()));
return;
}
KisPaintOpPresetResourceServer * rserver = KisResourceServerProvider::instance()->paintOpPresetServer();
if (rserver->resources().isEmpty()) {
m_errorMessage = i18n("Krita cannot find any brush presets! Krita will quit now.");
m_dieOnError = true;
QTimer::singleShot(0, this, SLOT(showErrorAndDie()));
return;
}
}
void KisMainWindow::showErrorAndDie()
{
QMessageBox::critical(0, i18nc("@title:window", "Installation error"), m_errorMessage);
if (m_dieOnError) {
exit(10);
}
}
void KisMainWindow::showAboutApplication()
{
KisAboutApplication dlg(this);
dlg.exec();
}
QPointer<KisView>KisMainWindow::activeKisView()
{
if (!d->mdiArea) return 0;
QMdiSubWindow *activeSubWindow = d->mdiArea->activeSubWindow();
//dbgKrita << "activeKisView" << activeSubWindow;
if (!activeSubWindow) return 0;
return qobject_cast<KisView*>(activeSubWindow->widget());
}
void KisMainWindow::newOptionWidgets(KoCanvasController *controller, const QList<QPointer<QWidget> > &optionWidgetList)
{
KIS_ASSERT_RECOVER_NOOP(controller == KoToolManager::instance()->activeCanvasController());
bool isOurOwnView = false;
Q_FOREACH (QPointer<KisView> view, KisPart::instance()->views()) {
if (view && view->canvasController() == controller) {
isOurOwnView = view->mainWindow() == this;
}
}
if (!isOurOwnView) return;
Q_FOREACH (QWidget *w, optionWidgetList) {
#ifdef Q_OS_OSX
w->setAttribute(Qt::WA_MacSmallSize, true);
#endif
w->setFont(KoDockRegistry::dockFont());
}
if (d->toolOptionsDocker) {
d->toolOptionsDocker->setOptionWidgets(optionWidgetList);
}
else {
d->viewManager->paintOpBox()->newOptionWidgets(optionWidgetList);
}
}
void KisMainWindow::applyDefaultSettings(QPrinter &printer) {
if (!d->activeView) return;
QString title = d->activeView->document()->documentInfo()->aboutInfo("title");
if (title.isEmpty()) {
title = d->activeView->document()->url().fileName();
// strip off the native extension (I don't want foobar.kwd.ps when printing into a file)
QString extension = KisMimeDatabase::suffixesForMimeType(d->activeView->document()->outputMimeType()).first();
if (title.endsWith(extension)) {
title.chop(extension.length());
}
}
if (title.isEmpty()) {
// #139905
title = i18n("%1 unsaved document (%2)", qApp->applicationDisplayName(),
QLocale().toString(QDate::currentDate(), QLocale::ShortFormat));
}
printer.setDocName(title);
}
void KisMainWindow::createActions()
{
KisActionManager *actionManager = d->actionManager();
KisConfig cfg;
actionManager->createStandardAction(KStandardAction::New, this, SLOT(slotFileNew()));
actionManager->createStandardAction(KStandardAction::Open, this, SLOT(slotFileOpen()));
actionManager->createStandardAction(KStandardAction::Quit, this, SLOT(slotFileQuit()));
actionManager->createStandardAction(KStandardAction::ConfigureToolbars, this, SLOT(slotConfigureToolbars()));
actionManager->createStandardAction(KStandardAction::FullScreen, this, SLOT(viewFullscreen(bool)));
d->recentFiles = KStandardAction::openRecent(this, SLOT(slotFileOpenRecent(QUrl)), actionCollection());
connect(d->recentFiles, SIGNAL(recentListCleared()), this, SLOT(saveRecentFiles()));
KSharedConfigPtr configPtr = KSharedConfig::openConfig();
d->recentFiles->loadEntries(configPtr->group("RecentFiles"));
d->saveAction = actionManager->createStandardAction(KStandardAction::Save, this, SLOT(slotFileSave()));
d->saveAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
d->saveActionAs = actionManager->createStandardAction(KStandardAction::SaveAs, this, SLOT(slotFileSaveAs()));
d->saveActionAs->setActivationFlags(KisAction::ACTIVE_IMAGE);
// d->printAction = actionManager->createStandardAction(KStandardAction::Print, this, SLOT(slotFilePrint()));
// d->printAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
// d->printActionPreview = actionManager->createStandardAction(KStandardAction::PrintPreview, this, SLOT(slotFilePrintPreview()));
// d->printActionPreview->setActivationFlags(KisAction::ACTIVE_IMAGE);
d->undo = actionManager->createStandardAction(KStandardAction::Undo, this, SLOT(undo()));
d->undo ->setActivationFlags(KisAction::ACTIVE_IMAGE);
d->redo = actionManager->createStandardAction(KStandardAction::Redo, this, SLOT(redo()));
d->redo->setActivationFlags(KisAction::ACTIVE_IMAGE);
// d->exportPdf = actionManager->createAction("file_export_pdf");
// connect(d->exportPdf, SIGNAL(triggered()), this, SLOT(exportToPdf()));
d->importAnimation = actionManager->createAction("file_import_animation");
connect(d->importAnimation, SIGNAL(triggered()), this, SLOT(importAnimation()));
d->closeAll = actionManager->createAction("file_close_all");
connect(d->closeAll, SIGNAL(triggered()), this, SLOT(slotFileCloseAll()));
// d->reloadFile = actionManager->createAction("file_reload_file");
// d->reloadFile->setActivationFlags(KisAction::CURRENT_IMAGE_MODIFIED);
// connect(d->reloadFile, SIGNAL(triggered(bool)), this, SLOT(slotReloadFile()));
d->importFile = actionManager->createAction("file_import_file");
connect(d->importFile, SIGNAL(triggered(bool)), this, SLOT(slotImportFile()));
d->exportFile = actionManager->createAction("file_export_file");
connect(d->exportFile, SIGNAL(triggered(bool)), this, SLOT(slotExportFile()));
/* The following entry opens the document information dialog. Since the action is named so it
intends to show data this entry should not have a trailing ellipses (...). */
d->showDocumentInfo = actionManager->createAction("file_documentinfo");
connect(d->showDocumentInfo, SIGNAL(triggered(bool)), this, SLOT(slotDocumentInfo()));
d->themeManager->setThemeMenuAction(new KActionMenu(i18nc("@action:inmenu", "&Themes"), this));
d->themeManager->registerThemeActions(actionCollection());
connect(d->themeManager, SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged()));
d->toggleDockers = actionManager->createAction("view_toggledockers");
cfg.showDockers(true);
d->toggleDockers->setChecked(true);
connect(d->toggleDockers, SIGNAL(toggled(bool)), SLOT(toggleDockersVisibility(bool)));
d->toggleDockerTitleBars = actionManager->createAction("view_toggledockertitlebars");
d->toggleDockerTitleBars->setChecked(cfg.showDockerTitleBars());
connect(d->toggleDockerTitleBars, SIGNAL(toggled(bool)), SLOT(showDockerTitleBars(bool)));
actionCollection()->addAction("settings_dockers_menu", d->dockWidgetMenu);
actionCollection()->addAction("window", d->windowMenu);
d->mdiCascade = actionManager->createAction("windows_cascade");
connect(d->mdiCascade, SIGNAL(triggered()), d->mdiArea, SLOT(cascadeSubWindows()));
d->mdiTile = actionManager->createAction("windows_tile");
connect(d->mdiTile, SIGNAL(triggered()), d->mdiArea, SLOT(tileSubWindows()));
d->mdiNextWindow = actionManager->createAction("windows_next");
connect(d->mdiNextWindow, SIGNAL(triggered()), d->mdiArea, SLOT(activateNextSubWindow()));
d->mdiPreviousWindow = actionManager->createAction("windows_previous");
connect(d->mdiPreviousWindow, SIGNAL(triggered()), d->mdiArea, SLOT(activatePreviousSubWindow()));
d->newWindow = actionManager->createAction("view_newwindow");
connect(d->newWindow, SIGNAL(triggered(bool)), this, SLOT(newWindow()));
d->close = actionManager->createAction("file_close");
connect(d->close, SIGNAL(triggered()), SLOT(closeCurrentWindow()));
actionManager->createStandardAction(KStandardAction::Preferences, this, SLOT(slotPreferences()));
for (int i = 0; i < 2; i++) {
d->expandingSpacers[i] = new KisAction(i18n("Expanding Spacer"));
d->expandingSpacers[i]->setDefaultWidget(new QWidget(this));
d->expandingSpacers[i]->defaultWidget()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
actionManager->addAction(QString("expanding_spacer_%1").arg(i), d->expandingSpacers[i]);
}
}
void KisMainWindow::applyToolBarLayout()
{
const bool isPlastiqueStyle = style()->objectName() == "plastique";
Q_FOREACH (KToolBar *toolBar, toolBars()) {
toolBar->layout()->setSpacing(4);
if (isPlastiqueStyle) {
toolBar->setContentsMargins(0, 0, 0, 2);
}
//Hide text for buttons with an icon in the toolbar
Q_FOREACH (QAction *ac, toolBar->actions()){
if (ac->icon().pixmap(QSize(1,1)).isNull() == false){
ac->setPriority(QAction::LowPriority);
}else {
ac->setIcon(QIcon());
}
}
}
}
void KisMainWindow::initializeGeometry()
{
// if the user didn's specify the geometry on the command line (does anyone do that still?),
// we first figure out some good default size and restore the x,y position. See bug 285804Z.
KConfigGroup cfg( KSharedConfig::openConfig(), "MainWindow");
QByteArray geom = QByteArray::fromBase64(cfg.readEntry("ko_geometry", QByteArray()));
if (!restoreGeometry(geom)) {
const int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->availableGeometry(scnum);
// if the desktop is virtual then use virtual screen size
if (QApplication::desktop()->isVirtualDesktop()) {
desk = QApplication::desktop()->availableGeometry(QApplication::desktop()->screen(scnum));
}
quint32 x = desk.x();
quint32 y = desk.y();
quint32 w = 0;
quint32 h = 0;
// Default size -- maximize on small screens, something useful on big screens
const int deskWidth = desk.width();
if (deskWidth > 1024) {
// a nice width, and slightly less than total available
// height to componensate for the window decs
w = (deskWidth / 3) * 2;
h = (desk.height() / 3) * 2;
}
else {
w = desk.width();
h = desk.height();
}
x += (desk.width() - w) / 2;
y += (desk.height() - h) / 2;
move(x,y);
setGeometry(geometry().x(), geometry().y(), w, h);
}
restoreWorkspace(QByteArray::fromBase64(cfg.readEntry("ko_windowstate", QByteArray())));
}
void KisMainWindow::showManual()
{
QDesktopServices::openUrl(QUrl("https://docs.krita.org"));
}
void KisMainWindow::showDockerTitleBars(bool show)
{
Q_FOREACH (QDockWidget *dock, dockWidgets()) {
if (dock->titleBarWidget()) {
const bool isCollapsed = (dock->widget() && dock->widget()->isHidden()) || !dock->widget();
dock->titleBarWidget()->setVisible(show || (dock->isFloating() && isCollapsed));
}
}
KisConfig cfg;
cfg.setShowDockerTitleBars(show);
}
void KisMainWindow::moveEvent(QMoveEvent *e)
{
if (qApp->desktop()->screenNumber(this) != qApp->desktop()->screenNumber(e->oldPos())) {
KisConfigNotifier::instance()->notifyConfigChanged();
}
}
#include <moc_KisMainWindow.cpp>
diff --git a/libs/ui/KisMainWindow.h b/libs/ui/KisMainWindow.h
index e1ef965785..1e0ac2bbf4 100644
--- a/libs/ui/KisMainWindow.h
+++ b/libs/ui/KisMainWindow.h
@@ -1,459 +1,459 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000-2004 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MAIN_WINDOW_H
#define KIS_MAIN_WINDOW_H
#include "kritaui_export.h"
#include <QPointer>
#include <QPrinter>
#include <xmlgui/kxmlguiwindow.h>
#include <QUrl>
#include <KoCanvasObserverBase.h>
#include <KoCanvasSupervisor.h>
#include "KisView.h"
class QCloseEvent;
class QMoveEvent;
struct KoPageLayout;
class KoCanvasResourceManager;
class KisDocument;
class KisPrintJob;
class KoDockFactoryBase;
class QDockWidget;
class KisView;
class KisViewManager;
class KoCanvasController;
/**
* @brief Main window for Krita
*
* This class is used to represent a main window within a Krita session. Each
* main window contains a menubar and some toolbars, and potentially several
* views of several canvases.
*
*/
class KRITAUI_EXPORT KisMainWindow : public KXmlGuiWindow, public KoCanvasSupervisor
{
Q_OBJECT
public:
/**
* Constructor.
*
* Initializes a Calligra main window (with its basic GUI etc.).
*/
explicit KisMainWindow();
/**
* Destructor.
*/
- virtual ~KisMainWindow();
+ ~KisMainWindow() override;
/**
* Update caption from document info - call when document info
* (title in the about page) changes.
*/
void updateCaption();
// If noCleanup is set, KisMainWindow will not delete the root document
// or part manager on destruction.
void setNoCleanup(bool noCleanup);
/**
* @brief showView shows the given view. Override this if you want to show
* the view in a different way than by making it the central widget, for instance
* as an QMdiSubWindow
*/
virtual void showView(KisView *view);
/**
* @returns the currently active view
*/
KisView *activeView() const;
/**
* Sets the maximum number of recent documents entries.
*/
void setMaxRecentItems(uint _number);
/**
* The document opened a URL -> store into recent documents list.
*/
void addRecentURL(const QUrl &url);
/**
* Load the desired document and show it.
* @param url the URL to open
*
* @return TRUE on success.
*/
bool openDocument(const QUrl &url);
void setReadWrite(bool readwrite);
/// Return the list of dock widgets belonging to this main window.
QList<QDockWidget*> dockWidgets() const;
QDockWidget* dockWidget(const QString &id);
- QList<KoCanvasObserverBase*> canvasObservers() const;
+ QList<KoCanvasObserverBase*> canvasObservers() const override;
KoCanvasResourceManager *resourceManager() const;
int viewCount() const;
/**
* A wrapper around restoreState
* @param state the saved state
* @return TRUE on success
*/
bool restoreWorkspace(const QByteArray &state);
KisViewManager *viewManager() const;
void addViewAndNotifyLoadingCompleted(KisDocument *document);
QStringList showOpenFileDialog();
/**
* Shows if the main window is saving anything right now. If the
* user presses Ctrl+W too fast, then the document can be close
* before the saving is completed. I'm not sure if it is fixable
* in any way without avoiding using porcessEvents()
* everywhere (DK)
*
* Don't use it unless you have no option.
*/
bool hackIsSaving() const;
Q_SIGNALS:
/**
* This signal is emitted if the document has been saved successfully.
*/
void documentSaved();
/// This signal is emitted when this windows has finished loading of a
/// document. The document may be opened in another window in the end.
/// In this case, the signal means there is no link between the window
/// and the document anymore.
void loadCompleted();
/// This signal is emitted right after the docker states have been succefully restored from config
void restoringDone();
/// This signal is emitted when the color theme changes
void themeChanged();
/// This signal is emitted when the shortcut key configuration has changed
void keyBindingsChanged();
void guiLoadingFinished();
/// This signal is emitted when the user clicked on the progressbar cancel
void sigProgressCanceled();
public Q_SLOTS:
/**
* Slot for opening a new document.
*
* If the current document is empty, the new document replaces it.
* If not, a new mainwindow will be opened for showing the document.
*/
void slotFileNew();
/**
* Slot for opening a saved file.
*
* If the current document is empty, the opened document replaces it.
* If not a new mainwindow will be opened for showing the opened file.
*/
void slotFileOpen();
/**
* Slot for opening a file among the recently opened files.
*
* If the current document is empty, the opened document replaces it.
* If not a new mainwindow will be opened for showing the opened file.
*/
void slotFileOpenRecent(const QUrl &);
/**
* @brief slotPreferences open the preferences dialog
*/
void slotPreferences();
/**
* Saves the current document with the current name.
*/
void slotFileSave();
// XXX: disabled
KisPrintJob* exportToPdf(QString pdfFileName = QString());
void slotProgress(int value);
/**
* Saves the document, asking for a filename if necessary.
*
* @param saveas if set to TRUE the user is always prompted for a filename
* @param silent if set to TRUE rootDocument()->setTitleModified will not be called.
*
* @return TRUE on success, false on error or cancel
* (don't display anything in this case, the error dialog box is also implemented here
* but restore the original URL in slotFileSaveAs)
*/
bool saveDocument(KisDocument *document, bool saveas = false);
/**
* Update the option widgets to the argument ones, removing the currently set widgets.
*/
void newOptionWidgets(KoCanvasController *controller, const QList<QPointer<QWidget> > & optionWidgetList);
private Q_SLOTS:
/**
* Save the list of recent files.
*/
void saveRecentFiles();
void slotLoadCompleted();
void slotLoadCanceled(const QString &);
void slotSaveCompleted();
void slotSaveCanceled(const QString &);
void forceDockTabFonts();
void slotProgressCanceled();
/**
* @internal
*/
void slotDocumentTitleModified(const QString &caption, bool mod);
/**
* Prints the actual document.
*/
void slotFilePrint();
/**
* Saves the current document with a new name.
*/
void slotFileSaveAs();
void slotFilePrintPreview();
void importAnimation();
/**
* Show a dialog with author and document information.
*/
void slotDocumentInfo();
/**
* Closes all open documents.
*/
bool slotFileCloseAll();
/**
* @brief showAboutApplication show the about box
*/
virtual void showAboutApplication();
/**
* Closes the mainwindow.
*/
void slotFileQuit();
/**
* Configure toolbars.
*/
void slotConfigureToolbars();
/**
* Post toolbar config.
* (Plug action lists back in, etc.)
*/
void slotNewToolbarConfig();
/**
* Shows or hides a toolbar
*/
void slotToolbarToggled(bool toggle);
/**
* Toggle full screen on/off.
*/
void viewFullscreen(bool fullScreen);
/**
* Toggle docker titlebars on/off.
*/
void showDockerTitleBars(bool show);
/**
* Reload file
*/
void slotReloadFile();
/**
* File --> Import
*
* This will call slotFileOpen().
*/
void slotImportFile();
/**
* File --> Export
*
* This will call slotFileSaveAs().
*/
void slotExportFile();
/**
* Hide the dockers
*/
void toggleDockersVisibility(bool visible);
/**
* Handle theme changes from theme manager
*/
void slotThemeChanged();
void undo();
void redo();
void updateWindowMenu();
void setActiveSubWindow(QWidget *window);
void configChanged();
void newView(QObject *document);
void newWindow();
void closeCurrentWindow();
void checkSanity();
/// Quits Krita with error message from m_errorMessage.
void showErrorAndDie();
protected:
- void closeEvent(QCloseEvent * e);
- void resizeEvent(QResizeEvent * e);
+ void closeEvent(QCloseEvent * e) override;
+ void resizeEvent(QResizeEvent * e) override;
// QWidget overrides
- virtual void dragEnterEvent(QDragEnterEvent * event);
- virtual void dropEvent(QDropEvent * event);
- virtual void dragMoveEvent(QDragMoveEvent * event);
- virtual void dragLeaveEvent(QDragLeaveEvent * event);
+ void dragEnterEvent(QDragEnterEvent * event) override;
+ void dropEvent(QDropEvent * event) override;
+ void dragMoveEvent(QDragMoveEvent * event) override;
+ void dragLeaveEvent(QDragLeaveEvent * event) override;
void setToolbarList(QList<QAction*> toolbarList);
public Q_SLOTS:
/**
* Add a the given view to the list of views of this mainwindow.
* This is a private implementation. For public usage please use
* newView() and addViewAndNotifyLoadingCompleted().
*/
void addView(KisView *view);
/// Set the active view, this will update the undo/redo actions
void setActiveView(KisView *view);
void subWindowActivated();
private:
friend class KisApplication;
/**
* Returns the dockwidget specified by the @p factory. If the dock widget doesn't exist yet it's created.
* Add a "view_palette_action_menu" action to your view menu if you want to use closable dock widgets.
* @param factory the factory used to create the dock widget if needed
* @return the dock widget specified by @p factory (may be 0)
*/
QDockWidget* createDockWidget(KoDockFactoryBase* factory);
bool openDocumentInternal(const QUrl &url, KisDocument *newdoc = 0);
/**
* Reloads the recent documents list.
*/
void reloadRecentFileList();
/**
* Updates the window caption based on the document info and path.
*/
void updateCaption(const QString & caption, bool mod);
void updateReloadFileAction(KisDocument *doc);
void saveWindowSettings();
QPointer<KisView>activeKisView();
void applyDefaultSettings(QPrinter &printer);
void createActions();
void applyToolBarLayout();
protected:
- void moveEvent(QMoveEvent *e);
+ void moveEvent(QMoveEvent *e) override;
private Q_SLOTS:
void initializeGeometry();
void showManual();
void switchTab(int index);
private:
/**
* Struct used in the list created by createCustomDocumentWidgets()
*/
struct CustomDocumentWidgetItem {
/// Pointer to the custom document widget
QWidget *widget;
/// title used in the sidebar. If left empty it will be displayed as "Custom Document"
QString title;
/// icon used in the sidebar. If left empty it will use the unknown icon
QString icon;
};
class Private;
Private * const d;
QString m_errorMessage;
bool m_dieOnError;
};
#endif
diff --git a/libs/ui/KisMultiFeedRSSModel.h b/libs/ui/KisMultiFeedRSSModel.h
index e2626b7dba..d85db72e1b 100644
--- a/libs/ui/KisMultiFeedRSSModel.h
+++ b/libs/ui/KisMultiFeedRSSModel.h
@@ -1,105 +1,105 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef MULTIFEEDRSSMODEL_H
#define MULTIFEEDRSSMODEL_H
#include <QAbstractListModel>
#include <QStringList>
#include <QDateTime>
#include <kritaui_export.h>
class QThread;
class QNetworkReply;
class QNetworkAccessManager;
struct RssItem {
QString source;
QString title;
QString link;
QString description;
QString blogName;
QString blogIcon;
QDateTime pubDate;
};
typedef QList<RssItem> RssItemList;
class KisNetworkAccessManager;
enum RssRoles { TitleRole = Qt::UserRole + 1, DescriptionRole, LinkRole,
PubDateRole, BlogNameRole, BlogIconRole
};
class KRITAUI_EXPORT MultiFeedRssModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int articleCount READ articleCount WRITE setArticleCount NOTIFY articleCountChanged)
public:
explicit MultiFeedRssModel(QObject *parent = 0);
- ~MultiFeedRssModel();
+ ~MultiFeedRssModel() override;
void addFeed(const QString& feed);
void removeFeed(const QString& feed);
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int articleCount() const {
return m_articleCount;
}
public Q_SLOTS:
void setArticleCount(int arg) {
if (m_articleCount != arg) {
m_articleCount = arg;
emit articleCountChanged(arg);
}
}
Q_SIGNALS:
void articleCountChanged(int arg);
private Q_SLOTS:
void appendFeedData(QNetworkReply *reply);
private:
QStringList m_sites;
RssItemList m_aggregatedFeed;
QNetworkAccessManager *m_networkAccessManager;
QThread *m_namThread;
int m_articleCount;
};
#endif // MULTIFEEDRSSMODEL_H
diff --git a/libs/ui/KisNetworkAccessManager.h b/libs/ui/KisNetworkAccessManager.h
index e8b28065df..dfb87411f9 100644
--- a/libs/ui/KisNetworkAccessManager.h
+++ b/libs/ui/KisNetworkAccessManager.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <QNetworkAccessManager>
class QUrl;
#include <kritaui_export.h>
/**
* @brief Network Access Manager for use with Krita.
*/
class KRITAUI_EXPORT KisNetworkAccessManager : public QNetworkAccessManager
{
Q_OBJECT
public:
KisNetworkAccessManager(QObject *parent = 0);
public Q_SLOTS:
void getUrl(const QUrl &url);
protected:
- virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData);
+ QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) override;
};
diff --git a/libs/ui/KisNodeDelegate.h b/libs/ui/KisNodeDelegate.h
index 5c7deb5f65..c72a40410a 100644
--- a/libs/ui/KisNodeDelegate.h
+++ b/libs/ui/KisNodeDelegate.h
@@ -1,85 +1,85 @@
/*
Copyright (c) 2006 Gábor Lehel <illissius@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DOCUMENT_SECTION_DELEGATE_H
#define KIS_DOCUMENT_SECTION_DELEGATE_H
#include <QAbstractItemDelegate>
class KisNodeView;
class KisNodeModel;
/**
* See KisNodeModel and KisNodeView.
*
* A delegate provides the gui machinery, using Qt's model/view terminology.
* This class is owned by KisNodeView to do the work of generating the
* graphical representation of each item.
*/
class KisNodeDelegate: public QAbstractItemDelegate
{
Q_OBJECT
public:
explicit KisNodeDelegate(KisNodeView *view, QObject *parent = 0);
- virtual ~KisNodeDelegate();
+ ~KisNodeDelegate() override;
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
- virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
- virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index) const;
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index) const override;
protected:
- virtual bool eventFilter(QObject *object, QEvent *event);
+ bool eventFilter(QObject *object, QEvent *event) override;
private:
typedef KisNodeModel Model;
typedef KisNodeView View;
class Private;
Private* const d;
static QStyleOptionViewItem getOptions(const QStyleOptionViewItem &option, const QModelIndex &index);
QRect progressBarRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawProgressBar(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawBranch(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawColorLabel(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawFrame(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawThumbnail(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QRect iconsRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
QRect textRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawText(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawIcons(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QRect visibilityClickRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
QRect decorationClickRect(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawVisibilityIconHijack(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawDecoration(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawExpandButton(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const;
private Q_SLOTS:
void slotOnCloseEditor();
};
#endif
diff --git a/libs/ui/KisNodeToolTip.h b/libs/ui/KisNodeToolTip.h
index f65312b4ec..a6061ed1f5 100644
--- a/libs/ui/KisNodeToolTip.h
+++ b/libs/ui/KisNodeToolTip.h
@@ -1,46 +1,46 @@
/*
Copyright (c) 2006 Gábor Lehel <illissius@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DOCUMENT_SECTION_TOOLTIP_H
#define KIS_DOCUMENT_SECTION_TOOLTIP_H
#include "KoItemToolTip.h"
class KisNodeModel;
/**
* A default tooltip for a KisNodeView that shows a thumbnail
* image and the list of properties associated with a node.
*/
class KisNodeToolTip: public KoItemToolTip
{
Q_OBJECT
public:
KisNodeToolTip();
- virtual ~KisNodeToolTip();
+ ~KisNodeToolTip() override;
protected:
- virtual QTextDocument *createDocument(const QModelIndex &index);
+ QTextDocument *createDocument(const QModelIndex &index) override;
private:
typedef KisNodeModel Model;
};
#endif
diff --git a/libs/ui/KisNodeView.h b/libs/ui/KisNodeView.h
index 9f02afb729..5af6eafac3 100644
--- a/libs/ui/KisNodeView.h
+++ b/libs/ui/KisNodeView.h
@@ -1,182 +1,182 @@
/*
Copyright (c) 2006 Gábor Lehel <illissius@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DOCUMENT_SECTION_VIEW_H
#define KIS_DOCUMENT_SECTION_VIEW_H
#include <QTreeView>
#include "kritaui_export.h"
class QStyleOptionViewItem;
class KisNodeModel;
/**
* A widget displaying the Krita nodes (layers, masks, local selections, etc.)
*
* The widget can show the document sections as big thumbnails,
* in a listview with two rows of informative text and icons,
* or as single rows of text and property icons.
*
* This class is designed as a Qt model-view widget.
*
* The Qt documentation explains the design and terminology for these classes:
* http://doc.qt.io/qt-5/model-view-programming.html
*
* This widget should work correctly in your Qt designer .ui file.
*/
class KRITAUI_EXPORT KisNodeView: public QTreeView
{
Q_OBJECT
Q_SIGNALS:
/**
* Emitted whenever the user clicks with the secondary mouse
* button on an item. It is up to the application to design the
* contents of the context menu and show it.
*/
void contextMenuRequested(const QPoint &globalPos, const QModelIndex &index);
void selectionChanged(const QModelIndexList &);
public:
/**
* Create a new KisNodeView.
*/
explicit KisNodeView(QWidget *parent = 0);
- virtual ~KisNodeView();
+ ~KisNodeView() override;
/// how items should be displayed
enum DisplayMode {
/// large fit-to-width thumbnails, with only titles or page numbers
ThumbnailMode,
/// smaller thumbnails, with titles and property icons in two rows
DetailedMode,
/// no thumbnails, with titles and property icons in a single row
MinimalMode
};
- virtual void resizeEvent(QResizeEvent * event);
- virtual void paintEvent (QPaintEvent *event);
- virtual void drawBranches(QPainter *painter, const QRect &rect,
- const QModelIndex &index) const;
+ void resizeEvent(QResizeEvent * event) override;
+ void paintEvent (QPaintEvent *event) override;
+ void drawBranches(QPainter *painter, const QRect &rect,
+ const QModelIndex &index) const override;
- virtual void dropEvent(QDropEvent *ev);
+ void dropEvent(QDropEvent *ev) override;
- virtual void dragEnterEvent(QDragEnterEvent *e);
+ void dragEnterEvent(QDragEnterEvent *e) override;
- virtual void dragMoveEvent(QDragMoveEvent *ev);
+ void dragMoveEvent(QDragMoveEvent *ev) override;
- virtual void dragLeaveEvent(QDragLeaveEvent *e);
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
/**
* Set the display mode of the view to one of the options.
*
* @param mode The KisNodeView::DisplayMode mode
*/
void setDisplayMode(DisplayMode mode);
/**
* @return the currently active display mode
*/
DisplayMode displayMode() const;
/**
* Add toggle actions for all the properties associated with the
* current document section associated with the model index to the
* specified menu.
*
* For instance, if a document section can be locked and visible,
* the menu will be expanded with locked and visilbe toggle
* actions.
*
* For instance
@code
KisNodeView * nodeView;
QModelIndex index = getCurrentNode();
QMenu menu;
if (index.isValid()) {
sectionView->addPropertyActions(&menu, index);
} else {
menu.addAction(...); // Something to create a new document section, for example.
}
@endcode
*
* @param menu A pointer to the menu that will be expanded with
* the toglge actions
* @param index The model index associated with the document
* section that may or may not provide a number of toggle actions.
*/
void addPropertyActions(QMenu *menu, const QModelIndex &index);
void updateNode(const QModelIndex &index);
QRect originalVisualRect(const QModelIndex &index) const;
protected:
QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index,
- const QEvent *event) const;
+ const QEvent *event) const override;
- virtual QRect visualRect(const QModelIndex &index) const;
- virtual QModelIndex indexAt(const QPoint &point) const;
- virtual bool viewportEvent(QEvent *event);
- virtual void contextMenuEvent(QContextMenuEvent *event);
+ QRect visualRect(const QModelIndex &index) const override;
+ QModelIndex indexAt(const QPoint &point) const override;
+ bool viewportEvent(QEvent *event) override;
+ void contextMenuEvent(QContextMenuEvent *event) override;
virtual void showContextMenu(const QPoint &globalPos, const QModelIndex &index);
- virtual void startDrag (Qt::DropActions supportedActions);
+ void startDrag (Qt::DropActions supportedActions) override;
QPixmap createDragPixmap() const;
/**
* Calculates the index of the nearest item to the cursor position
*/
int cursorPageIndex() const;
protected Q_SLOTS:
- virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous);
- virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
- virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override;
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
private Q_SLOTS:
void slotActionToggled(bool on, const QPersistentModelIndex &index, int property);
private:
/**
* Permit to know if a slide is dragging
*
* @return boolean
*/
bool isDragging() const;
/**
* Setter for the dragging flag
*
* @param flag boolean
*/
void setDraggingFlag(bool flag = true);
bool m_draggingFlag;
QStyleOptionViewItem optionForIndex(const QModelIndex &index) const;
typedef KisNodeModel Model;
class PropertyAction;
class Private;
Private* const d;
};
#endif
diff --git a/libs/ui/KisOpenPane.h b/libs/ui/KisOpenPane.h
index 34b4973ce8..79c8d82aba 100644
--- a/libs/ui/KisOpenPane.h
+++ b/libs/ui/KisOpenPane.h
@@ -1,108 +1,108 @@
/* This file is part of the KDE project
Copyright (C) 2005 Peter Simonsson <psn@linux.se>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISOPENPANE_H
#define KISOPENPANE_H
#include <QDialog>
#include <QWidget>
#include <QPixmap>
#include <QList>
class KisDetailsPane;
class KisDocument;
class KisOpenPanePrivate;
class KisTemplatesPane;
class QPixmap;
class QString;
class QStringList;
class QTreeWidgetItem;
class QUrl;
/// \internal
class KisOpenPane : public QDialog
{
Q_OBJECT
public:
/**
* Constructor
* @param parent the parent widget
* @param templateType the template-type (group) that should be selected on creation.
*/
KisOpenPane(QWidget *parent, const QStringList& mimeFilter, const QString& templatesResourcePath = QString());
- virtual ~KisOpenPane();
+ ~KisOpenPane() override;
QTreeWidgetItem* addPane(const QString &title, const QString &iconName, QWidget *widget, int sortWeight);
QTreeWidgetItem* addPane(const QString& title, const QPixmap& icon, QWidget* widget, int sortWeight);
/**
* If the application has a way to create a document not based on a template, but on user
* provided settings, the widget showing these gets set here.
* @see KisDocument::createCustomDocumentWidget()
* @param widget the widget.
* @param title the title shown in the sidebar
* @param icon the icon shown in the sidebar
*/
void addCustomDocumentWidget(QWidget *widget, const QString& title = QString(), const QString& icon = QString());
Q_SIGNALS:
/// this signal is emitted (as defined by KisDocument) the moment the document is 'ready'
void documentSelected(KisDocument*);
protected Q_SLOTS:
void updateSelectedWidget();
void itemClicked(QTreeWidgetItem* item);
/// Saves the splitter sizes for KisDetailsPaneBase based panes
void saveSplitterSizes(KisDetailsPane* sender, const QList<int>& sizes);
private Q_SLOTS:
/// when clicked "Open Existing Document" button
void openFileDialog();
Q_SIGNALS:
void openExistingFile(const QUrl&);
void openTemplate(const QUrl&);
/// Emitted when the always use template has changed
void alwaysUseChanged(KisTemplatesPane* sender, const QString& alwaysUse);
/// Emitted when one of the detail panes have changed it's splitter
void splitterResized(KisDetailsPane* sender, const QList<int>& sizes);
void cancelButton();
protected:
/**
* Populate the list with all templates the user can choose.
* @param templatesResourcePath the template-type (group) that should be selected on creation.
*/
void initTemplates(const QString& templatesResourcePath);
// QWidget overrides
- virtual void dragEnterEvent(QDragEnterEvent * event);
- virtual void dropEvent(QDropEvent * event);
+ void dragEnterEvent(QDragEnterEvent * event) override;
+ void dropEvent(QDropEvent * event) override;
private:
QStringList m_mimeFilter;
KisOpenPanePrivate * const d;
};
#endif //KOOPENPANE_H
diff --git a/libs/ui/KisPaletteModel.h b/libs/ui/KisPaletteModel.h
index de073121e6..fb1e50cbe2 100644
--- a/libs/ui/KisPaletteModel.h
+++ b/libs/ui/KisPaletteModel.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PALETTEMODEL_H
#define KIS_PALETTEMODEL_H
#include <QPointer>
#include <QModelIndex>
#include <KoColorDisplayRendererInterface.h>
#include <kis_types.h>
#include "kritaui_export.h"
class KoColorSet;
class KRITAUI_EXPORT KisPaletteModel : public QAbstractTableModel
{
Q_OBJECT
public:
KisPaletteModel(QObject* parent = 0);
- virtual ~KisPaletteModel();
+ ~KisPaletteModel() override;
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
- virtual Qt::ItemFlags flags(const QModelIndex& index) const;
- virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
+ QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
void setColorSet(KoColorSet* colorSet);
KoColorSet* colorSet() const;
/**
* Installs a display renderer object for a palette that will
* convert the KoColor to the displayable QColor. Default is the
* dumb renderer.
*/
void setDisplayRenderer(KoColorDisplayRendererInterface *displayRenderer);
QModelIndex indexFromId(int i) const;
int idFromIndex(const QModelIndex &index) const;
private Q_SLOTS:
void slotDisplayConfigurationChanged();
private:
KoColorSet* m_colorSet;
QPointer<KoColorDisplayRendererInterface> m_displayRenderer;
};
#endif
diff --git a/libs/ui/KisPart.cpp b/libs/ui/KisPart.cpp
index ab28ebc413..5ea6bb6866 100644
--- a/libs/ui/KisPart.cpp
+++ b/libs/ui/KisPart.cpp
@@ -1,503 +1,491 @@
/* This file is part of the KDE project
* Copyright (C) 1998-1999 Torben Weis <weis@kde.org>
* Copyright (C) 2000-2005 David Faure <faure@kde.org>
* Copyright (C) 2007-2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2010-2012 Boudewijn Rempt <boud@kogmbh.com>
* Copyright (C) 2011 Inge Wallin <ingwa@kogmbh.com>
* Copyright (C) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KisPart.h"
#include "KoProgressProxy.h"
#include <KoCanvasController.h>
#include <KoCanvasControllerWidget.h>
#include <KoColorSpaceEngine.h>
#include <KoCanvasBase.h>
#include <KoToolManager.h>
#include <KoShapeBasedDocumentBase.h>
#include <KoResourceServerProvider.h>
#include <kis_icon.h>
#include "KisApplication.h"
#include "KisDocument.h"
#include "KisView.h"
#include "KisViewManager.h"
#include "KisImportExportManager.h"
#include <kis_debug.h>
#include <KoResourcePaths.h>
#include <KoDialog.h>
#include <kdesktopfile.h>
#include <QMessageBox>
#include <klocalizedstring.h>
#include <kactioncollection.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <QKeySequence>
#include <QDialog>
#include <QApplication>
#include <QDomDocument>
#include <QDomElement>
#include <QGlobalStatic>
#include <KisMimeDatabase.h>
#include "KisView.h"
#include "KisDocument.h"
#include "kis_config.h"
#include "kis_shape_controller.h"
#include "kis_resource_server_provider.h"
#include "kis_animation_cache_populator.h"
#include "kis_idle_watcher.h"
#include "kis_image.h"
#include "KisImportExportManager.h"
#include "KisDocument.h"
#include "KoToolManager.h"
#include "KisViewManager.h"
#include "kis_script_manager.h"
#include "KisOpenPane.h"
#include "kis_color_manager.h"
#include "kis_debug.h"
#include "kis_action.h"
#include "kis_action_registry.h"
Q_GLOBAL_STATIC(KisPart, s_instance)
class Q_DECL_HIDDEN KisPart::Private
{
public:
Private(KisPart *_part)
: part(_part)
, idleWatcher(2500)
, animationCachePopulator(_part)
{
}
~Private()
{
}
KisPart *part;
QList<QPointer<KisView> > views;
QList<QPointer<KisMainWindow> > mainWindows;
QList<QPointer<KisDocument> > documents;
QList<KisAction*> scriptActions;
KActionCollection *actionCollection{0};
KisIdleWatcher idleWatcher;
KisAnimationCachePopulator animationCachePopulator;
};
KisPart* KisPart::instance()
{
return s_instance;
}
KisPart::KisPart()
: d(new Private(this))
{
// Preload all the resources in the background
Q_UNUSED(KoResourceServerProvider::instance());
Q_UNUSED(KisResourceServerProvider::instance());
Q_UNUSED(KisColorManager::instance());
connect(this, SIGNAL(documentOpened(QString)),
this, SLOT(updateIdleWatcherConnections()));
connect(this, SIGNAL(documentClosed(QString)),
this, SLOT(updateIdleWatcherConnections()));
connect(KisActionRegistry::instance(), SIGNAL(shortcutsUpdated()),
this, SLOT(updateShortcuts()));
connect(&d->idleWatcher, SIGNAL(startedIdleMode()),
&d->animationCachePopulator, SLOT(slotRequestRegeneration()));
d->animationCachePopulator.slotRequestRegeneration();
}
KisPart::~KisPart()
{
while (!d->documents.isEmpty()) {
delete d->documents.takeFirst();
}
while (!d->views.isEmpty()) {
delete d->views.takeFirst();
}
while (!d->mainWindows.isEmpty()) {
delete d->mainWindows.takeFirst();
}
delete d;
}
void KisPart::updateIdleWatcherConnections()
{
QVector<KisImageSP> images;
Q_FOREACH (QPointer<KisDocument> document, documents()) {
if (document->image()) {
images << document->image();
}
}
d->idleWatcher.setTrackedImages(images);
}
void KisPart::addDocument(KisDocument *document)
{
//dbgUI << "Adding document to part list" << document;
Q_ASSERT(document);
if (!d->documents.contains(document)) {
d->documents.append(document);
emit documentOpened('/'+objectName());
emit sigDocumentAdded(document);
connect(document, SIGNAL(sigSavingFinished()), SLOT(slotDocumentSaved()));
}
}
QList<QPointer<KisDocument> > KisPart::documents() const
{
return d->documents;
}
KisDocument *KisPart::createDocument() const
{
KisDocument *doc = new KisDocument();
return doc;
}
int KisPart::documentCount() const
{
return d->documents.size();
}
void KisPart::removeDocument(KisDocument *document)
{
d->documents.removeAll(document);
emit documentClosed('/'+objectName());
emit sigDocumentRemoved(document->url().toLocalFile());
document->deleteLater();
}
KisMainWindow *KisPart::createMainWindow()
{
KisMainWindow *mw = new KisMainWindow();
Q_FOREACH(QAction *action, d->scriptActions) {
mw->viewManager()->scriptManager()->addAction(action);
}
dbgUI <<"mainWindow" << (void*)mw << "added to view" << this;
d->mainWindows.append(mw);
emit sigWindowAdded(mw);
return mw;
}
KisView *KisPart::createView(KisDocument *document,
KoCanvasResourceManager *resourceManager,
KActionCollection *actionCollection,
QWidget *parent)
{
// If creating the canvas fails, record this and disable OpenGL next time
KisConfig cfg;
KConfigGroup grp( KSharedConfig::openConfig(), "crashprevention");
if (grp.readEntry("CreatingCanvas", false)) {
cfg.setUseOpenGL(false);
}
if (cfg.canvasState() == "OPENGL_FAILED") {
cfg.setUseOpenGL(false);
}
grp.writeEntry("CreatingCanvas", true);
grp.sync();
QApplication::setOverrideCursor(Qt::WaitCursor);
KisView *view = new KisView(document, resourceManager, actionCollection, parent);
QApplication::restoreOverrideCursor();
// Record successful canvas creation
grp.writeEntry("CreatingCanvas", false);
grp.sync();
addView(view);
return view;
}
void KisPart::addView(KisView *view)
{
if (!view)
return;
if (!d->views.contains(view)) {
d->views.append(view);
}
- connect(view, SIGNAL(destroyed()), this, SLOT(viewDestroyed()));
-
emit sigViewAdded(view);
}
void KisPart::removeView(KisView *view)
{
if (!view) return;
/**
* HACK ALERT: we check here explicitly if the document (or main
* window), is saving the stuff. If we close the
* document *before* the saving is completed, a crash
* will happen.
*/
- if (view->mainWindow()->hackIsSaving()) {
- return;
- }
+ KIS_ASSERT_RECOVER_RETURN(!view->mainWindow()->hackIsSaving());
emit sigViewRemoved(view);
QPointer<KisDocument> doc = view->document();
d->views.removeAll(view);
if (doc) {
bool found = false;
Q_FOREACH (QPointer<KisView> view, d->views) {
if (view && view->document() == doc) {
found = true;
break;
}
}
if (!found) {
removeDocument(doc);
}
}
}
QList<QPointer<KisView> > KisPart::views() const
{
return d->views;
}
int KisPart::viewCount(KisDocument *doc) const
{
if (!doc) {
return d->views.count();
}
else {
int count = 0;
Q_FOREACH (QPointer<KisView> view, d->views) {
if (view && view->isVisible() && view->document() == doc) {
count++;
}
}
return count;
}
}
void KisPart::slotDocumentSaved()
{
KisDocument *doc = qobject_cast<KisDocument*>(sender());
emit sigDocumentSaved(doc->url().toLocalFile());
}
void KisPart::removeMainWindow(KisMainWindow *mainWindow)
{
dbgUI <<"mainWindow" << (void*)mainWindow <<"removed from doc" << this;
if (mainWindow) {
d->mainWindows.removeAll(mainWindow);
}
}
const QList<QPointer<KisMainWindow> > &KisPart::mainWindows() const
{
return d->mainWindows;
}
int KisPart::mainwindowCount() const
{
return d->mainWindows.count();
}
KisMainWindow *KisPart::currentMainwindow() const
{
QWidget *widget = qApp->activeWindow();
KisMainWindow *mainWindow = qobject_cast<KisMainWindow*>(widget);
while (!mainWindow && widget) {
widget = widget->parentWidget();
mainWindow = qobject_cast<KisMainWindow*>(widget);
}
if (!mainWindow && mainWindows().size() > 0) {
mainWindow = mainWindows().first();
}
return mainWindow;
}
void KisPart::addScriptAction(KisAction *action)
{
d->scriptActions << action;
}
KisIdleWatcher* KisPart::idleWatcher() const
{
return &d->idleWatcher;
}
KisAnimationCachePopulator* KisPart::cachePopulator() const
{
return &d->animationCachePopulator;
}
void KisPart::openExistingFile(const QUrl &url)
{
Q_ASSERT(url.isLocalFile());
qApp->setOverrideCursor(Qt::BusyCursor);
KisDocument *document = createDocument();
if (!document->openUrl(url)) {
delete document;
return;
}
if (!document->image()) {
delete document;
return;
}
document->setModified(false);
addDocument(document);
KisMainWindow *mw = currentMainwindow();
mw->addViewAndNotifyLoadingCompleted(document);
qApp->restoreOverrideCursor();
}
void KisPart::updateShortcuts()
{
// Update any non-UI actionCollections. That includes:
// - Shortcuts called inside of tools
// - Perhaps other things?
KoToolManager::instance()->updateToolShortcuts();
// Now update the UI actions.
Q_FOREACH (KisMainWindow *mainWindow, d->mainWindows) {
KActionCollection *ac = mainWindow->actionCollection();
ac->updateShortcuts();
// Loop through mainWindow->actionCollections() to modify tooltips
// so that they list shortcuts at the end in parentheses
Q_FOREACH ( QAction* action, ac->actions())
{
// Remove any existing suffixes from the tooltips.
// Note this regexp starts with a space, e.g. " (Ctrl-a)"
QString strippedTooltip = action->toolTip().remove(QRegExp("\\s\\(.*\\)"));
// Now update the tooltips with the new shortcut info.
if(action->shortcut() == QKeySequence(0))
action->setToolTip(strippedTooltip);
else
action->setToolTip( strippedTooltip + " (" + action->shortcut().toString() + ")");
}
}
}
void KisPart::openTemplate(const QUrl &url)
{
qApp->setOverrideCursor(Qt::BusyCursor);
KisDocument *document = createDocument();
bool ok = document->loadNativeFormat(url.toLocalFile());
document->setModified(false);
document->undoStack()->clear();
if (ok) {
QString mimeType = KisMimeDatabase::mimeTypeForFile(url.toLocalFile());
// in case this is a open document template remove the -template from the end
mimeType.remove( QRegExp( "-template$" ) );
document->setMimeTypeAfterLoading(mimeType);
document->resetURL();
}
else {
if (document->errorMessage().isEmpty()) {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not create document from template\n%1", document->localFilePath()));
}
else {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not create document from template\n%1\nReason: %2", document->localFilePath(), document->errorMessage()));
}
delete document;
return;
}
addDocument(document);
KisMainWindow *mw = currentMainwindow();
mw->addViewAndNotifyLoadingCompleted(document);
KisOpenPane *pane = qobject_cast<KisOpenPane*>(sender());
if (pane) {
pane->hide();
pane->deleteLater();
}
qApp->restoreOverrideCursor();
}
-void KisPart::viewDestroyed()
-{
- KisView *view = qobject_cast<KisView*>(sender());
- if (view) {
- removeView(view);
- }
-}
-
void KisPart::addRecentURLToAllMainWindows(QUrl url)
{
// Add to recent actions list in our mainWindows
Q_FOREACH (KisMainWindow *mainWindow, d->mainWindows) {
mainWindow->addRecentURL(url);
}
}
void KisPart::startCustomDocument(KisDocument* doc)
{
addDocument(doc);
KisMainWindow *mw = currentMainwindow();
KisOpenPane *pane = qobject_cast<KisOpenPane*>(sender());
if (pane) {
pane->hide();
pane->deleteLater();
}
mw->addViewAndNotifyLoadingCompleted(doc);
}
KisInputManager* KisPart::currentInputManager()
{
KisMainWindow *mw = currentMainwindow();
KisViewManager *manager = mw ? mw->viewManager() : 0;
return manager ? manager->inputManager() : 0;
}
diff --git a/libs/ui/KisPart.h b/libs/ui/KisPart.h
index 2f40c5bc1d..f26d9258bc 100644
--- a/libs/ui/KisPart.h
+++ b/libs/ui/KisPart.h
@@ -1,261 +1,259 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000-2005 David Faure <faure@kde.org>
Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2010 Boudewijn Rempt <boud@kogmbh.com>
Copyright (C) 2015 Michael Abrahams <miabraha@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PART_H
#define KIS_PART_H
#include <QList>
#include <QPointer>
#include <QUrl>
#include "kritaui_export.h"
#include <KoConfig.h>
#include <KisMainWindow.h>
namespace KIO {
}
class KisAction;
class KisDocument;
class KisView;
class KisDocument;
class KisIdleWatcher;
class KisAnimationCachePopulator;
/**
* KisPart is the Great Deku Tree of Krita.
*
* It is a singleton class which provides the main entry point to the application.
* Krita supports multiple documents, multiple main windows, and multiple
* components. KisPart manages these resources and provides them to the rest of
* Krita. It manages lists of Actions and shortcuts as well.
*
* The terminology comes from KParts, which is a system allowing one KDE app
* to be run from inside another, like pressing F4 inside dophin to run konsole.
*
* Needless to say, KisPart hasn't got much to do with KParts anymore.
*/
class KRITAUI_EXPORT KisPart : public QObject
{
Q_OBJECT
public:
static KisPart *instance();
/**
* Constructor.
*
* @param parent may be another KisDocument, or anything else.
* Usually passed by KPluginFactory::create.
*/
explicit KisPart();
/**
* Destructor.
*
* The destructor does not delete any attached KisView objects and it does not
* delete the attached widget as returned by widget().
*/
- ~KisPart();
+ ~KisPart() override;
// ----------------- Document management -----------------
/**
* create an empty document. The document is not automatically registered with the part.
*/
KisDocument *createDocument() const;
/**
* Add the specified document to the list of documents this KisPart manages.
*/
void addDocument(KisDocument *document);
/**
* @return a list of all documents this part manages
*/
QList<QPointer<KisDocument> > documents() const;
/**
* @return number of documents this part manages.
*/
int documentCount() const;
void removeDocument(KisDocument *document);
// ----------------- MainWindow management -----------------
/**
* Create a new main window.
*/
KisMainWindow *createMainWindow();
/**
* Removes a main window from the list of managed windows.
*
* This is called by the MainWindow after it finishes its shutdown routine.
*/
void removeMainWindow(KisMainWindow *mainWindow);
/**
* @return the list of main windows.
*/
const QList<QPointer<KisMainWindow> >& mainWindows() const;
/**
* @return the number of shells for the main window
*/
int mainwindowCount() const;
void addRecentURLToAllMainWindows(QUrl url);
/**
* @return the currently active main window.
*/
KisMainWindow *currentMainwindow() const;
/**
* Add a given action to the list of dynamically defined actions. On creating
* a mainwindow, all these actions will be added to the script manager.
*/
void addScriptAction(KisAction *);
/**
* Load actions for currently active main window into KisActionRegistry.
*/
void loadActions();
/**
* @return the application-wide KisIdleWatcher.
*/
KisIdleWatcher *idleWatcher() const;
/**
* @return the application-wide AnimationCachePopulator.
*/
KisAnimationCachePopulator *cachePopulator() const;
public Q_SLOTS:
/**
* This slot loads an existing file.
* @param url the file to load
*/
void openExistingFile(const QUrl &url);
/**
* This slot loads a template and deletes the sender.
* @param url the template to load
*/
void openTemplate(const QUrl &url);
/**
* @brief startCustomDocument adds the given document to the document list and deletes the sender()
* @param doc
*/
void startCustomDocument(KisDocument *doc);
private Q_SLOTS:
- void viewDestroyed();
-
void updateIdleWatcherConnections();
void updateShortcuts();
Q_SIGNALS:
/**
* emitted when a new document is opened. (for the idle watcher)
*/
void documentOpened(const QString &ref);
/**
* emitted when an old document is closed. (for the idle watcher)
*/
void documentClosed(const QString &ref);
// These signals are for libkis or sketch
void sigViewAdded(KisView *view);
void sigViewRemoved(KisView *view);
void sigDocumentAdded(KisDocument *document);
void sigDocumentSaved(const QString &url);
void sigDocumentRemoved(const QString &filename);
void sigWindowAdded(KisMainWindow *window);
public:
KisInputManager *currentInputManager();
//------------------ View management ------------------
/**
* Create a new view for the document. The view is added to the list of
* views, and if the document wasn't known yet, it's registered as well.
*/
KisView *createView(KisDocument *document,
KoCanvasResourceManager *resourceManager,
KActionCollection *actionCollection,
QWidget *parent);
/**
* Adds a view to the document. If the part doesn't know yet about
* the document, it is registered.
*
* This calls KisView::updateReadWrite to tell the new view
* whether the document is readonly or not.
*/
void addView(KisView *view);
/**
* Removes a view of the document.
*/
void removeView(KisView *view);
/**
* @return a list of views this document is displayed in
*/
QList<QPointer<KisView> > views() const;
/**
* @return number of views this document is displayed in
*/
int viewCount(KisDocument *doc) const;
private Q_SLOTS:
void slotDocumentSaved();
private:
Q_DISABLE_COPY(KisPart)
class Private;
Private *const d;
};
#endif
diff --git a/libs/ui/KisPrintJob.h b/libs/ui/KisPrintJob.h
index 585910c71d..d0ab757f04 100644
--- a/libs/ui/KisPrintJob.h
+++ b/libs/ui/KisPrintJob.h
@@ -1,95 +1,95 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISPRINTJOB_H
#define KISPRINTJOB_H
#include <QObject>
#include <QList>
#include <QAbstractPrintDialog>
#include <QPrinter>
#include "kritaui_export.h"
#include <kis_types.h>
/**
* A print job is an interface that the KisView uses to create an application-specific
* class that can take care of printing.
* The printjob should be able to print again after a print job has been completed,
* using the same QPrinter to allow the user to alter settings on the QPrinter and
* call print again.
* The printjob can thus see startPrinting() called more than once, and the implementation
* of that signal should honor the removePolicy passed to it.
*/
class KRITAUI_EXPORT KisPrintJob : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
* @param parent the parent qobject that is passed for memory management purposes.
*/
explicit KisPrintJob(KisImageWSP image);
- virtual ~KisPrintJob();
+ ~KisPrintJob() override;
/// A policy to allow the printjob to delete itself after its done printing.
enum RemovePolicy {
DeleteWhenDone, ///< Delete the job when its done with printing.
DoNotDelete ///< Keep the job around so it can be started again.
};
/// Returns the printer that is used for this print job so others can alter the details of the print-job.
QPrinter &printer() { return m_printer; }
int documentFirstPage() const {
return 1;
}
int documentLastPage() const {
return 1;
}
int documentCurrentPage() const {
return 1;
}
QAbstractPrintDialog::PrintDialogOptions printDialogOptions() const;
/**
*@brief Check if the painter can print to the printer
*@returns true if the print job can print to the given printer
*/
bool canPrint();
public Q_SLOTS:
/**
* This is called every time the job should be executed.
* When called the document should be printed a new painter using the printer
* of this printJob in order to honor the settings the user made on the printer.
* canPrint() should be called before startPrinting to check if the painter can print
* to the printer
* @param removePolicy a policy that should be honored so the caller can make sure
* this job doesn't leak memory after being used.
*/
void startPrinting(RemovePolicy removePolicy = DoNotDelete);
private:
KisImageWSP m_image;
QPrinter m_printer;
};
#endif
diff --git a/libs/ui/KisRemoteFileFetcher.h b/libs/ui/KisRemoteFileFetcher.h
index 8b18ca03c2..1839b56765 100644
--- a/libs/ui/KisRemoteFileFetcher.h
+++ b/libs/ui/KisRemoteFileFetcher.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISREMOTEFILEFETCHER_H
#define KISREMOTEFILEFETCHER_H
#include <QObject>
#include <QUrl>
#include <QNetworkReply>
#include <QAuthenticator>
#include <QNetworkAccessManager>
#include <QNetworkProxy>
#include <QList>
#include <QSslError>
#include <QEventLoop>
#include <QIODevice>
/**
* @brief The KisRemoteFileFetcher class can fetch a remote file and blocks until the file is downloaded
*/
class KisRemoteFileFetcher : public QObject
{
Q_OBJECT
public:
explicit KisRemoteFileFetcher(QObject *parent = 0);
- virtual ~KisRemoteFileFetcher();
+ ~KisRemoteFileFetcher() override;
bool fetchFile(const QUrl &remote, QIODevice *io);
private Q_SLOTS:
void downloadProgress(qint64 received,qint64 total);
void error(QNetworkReply::NetworkError error);
private:
QEventLoop m_loop;
QNetworkRequest *m_request;
QNetworkReply *m_reply;
};
#endif // KISREMOTEFILEFETCHER_H
diff --git a/libs/ui/KisResourceBundle.h b/libs/ui/KisResourceBundle.h
index a52128f772..a0a2dd7443 100644
--- a/libs/ui/KisResourceBundle.h
+++ b/libs/ui/KisResourceBundle.h
@@ -1,159 +1,159 @@
/*
* Copyright (c) 2014 Victor Lafon metabolic.ewilan@hotmail.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEBUNDLE_H
#define KORESOURCEBUNDLE_H
#include <QSet>
#include <QList>
#include <KoXmlWriter.h>
#include <resources/KoResource.h>
#include "KisResourceBundleManifest.h"
#include "kritaui_export.h"
class KoStore;
/**
* @brief The ResourceBundle class
* @details Describe the resource bundles as KoResources
*/
class KRITAUI_EXPORT KisResourceBundle : public KoResource
{
public:
/**
* @brief ResourceBundle : Ctor * @param bundlePath the path of the bundle
*/
KisResourceBundle(QString const& fileName);
/**
* @brief ~ResourceBundle : Dtor
*/
- virtual ~KisResourceBundle();
+ ~KisResourceBundle() override;
/**
* @brief defaultFileExtension
* @return the default file extension which should be when saving the resource
*/
- QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
/**
* @brief load : Load this resource.
* @return true if succeed, false otherwise.
*/
- bool load();
- virtual bool loadFromDevice(QIODevice *dev);
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
/**
* @brief save : Save this resource.
* @return true if succeed, false otherwise.
*/
- bool save();
+ bool save() override;
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool saveToDevice(QIODevice* dev) const override;
/**
* @brief install : Install the contents of the resource bundle.
*/
bool install();
/**
* @brief uninstall : Uninstall the resource bundle.
*/
bool uninstall();
/**
* @brief addMeta : Add a Metadata to the resource
* @param type type of the metadata
* @param value value of the metadata
*/
void addMeta(const QString &type, const QString &value);
const QString getMeta(const QString &type, const QString &defaultValue = QString()) const;
/**
* @brief addFile : Add a file to the bundle
* @param fileType type of the resource file
* @param filePath path of the resource file
*/
void addResource(QString fileType, QString filePath, QStringList fileTagList, const QByteArray md5sum);
QList<QString> getTagsList();
/**
* @brief isInstalled
* @return true if the bundle is installed, false otherwise.
*/
bool isInstalled();
/**
* @brief setInstalled
* This allows you to set installed or uninstalled upon loading. This is used with blacklists.
*/
void setInstalled(bool install);
void setThumbnail(QString);
/**
* @brief saveMetadata: saves bundle metadata
* @param store bundle where to save the metadata
*/
void saveMetadata(QScopedPointer<KoStore> &store);
/**
* @brief saveManifest: saves bundle manifest
* @param store bundle where to save the manifest
*/
void saveManifest(QScopedPointer<KoStore> &store);
/**
* @brief recreateBundle
* It recreates the bundle by copying the old bundle information to a new store
* and recalculating the md5 of each resource.
* @param oldStore the old store to be recreated.
*/
void recreateBundle(QScopedPointer<KoStore> &oldStore);
QStringList resourceTypes() const;
QList<KoResource*> resources(const QString &resType = QString::null) const;
int resourceCount() const;
private:
void writeMeta(const char *metaTag, const QString &metaKey, KoXmlWriter *writer);
void writeUserDefinedMeta(const QString &metaKey, KoXmlWriter *writer);
private:
QImage m_thumbnail;
KisResourceBundleManifest m_manifest;
QMap<QString, QString> m_metadata;
QSet<QString> m_bundletags;
bool m_installed;
QList<QByteArray> m_gradientsMd5Installed;
QList<QByteArray> m_patternsMd5Installed;
QList<QByteArray> m_brushesMd5Installed;
QList<QByteArray> m_palettesMd5Installed;
QList<QByteArray> m_workspacesMd5Installed;
QList<QByteArray> m_presetsMd5Installed;
QString m_bundleVersion;
};
#endif // KORESOURCEBUNDLE_H
diff --git a/libs/ui/KisResourceBundleManifest.cpp b/libs/ui/KisResourceBundleManifest.cpp
index e4f94ca788..83761657d8 100644
--- a/libs/ui/KisResourceBundleManifest.cpp
+++ b/libs/ui/KisResourceBundleManifest.cpp
@@ -1,233 +1,232 @@
/* This file is part of the KDE project
Copyright (C) 2014, Victor Lafon <metabolic.ewilan@hotmail.fr>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "KisResourceBundleManifest.h"
#include <QList>
#include <QString>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNode>
#include <QDomNodeList>
-#include <QForeachContainer>
#include <KoXmlNS.h>
#include <KoXmlReader.h>
#include <KoXmlWriter.h>
#include <resources/KoPattern.h>
#include <resources/KoAbstractGradient.h>
#include "kis_brush_server.h"
#include "kis_resource_server_provider.h"
#include <brushengine/kis_paintop_preset.h>
#include "kis_workspace_resource.h"
QString resourceTypeToManifestType(const QString &type) {
if (type.startsWith("ko_")) {
return type.mid(3);
}
else if (type.startsWith("kis_")) {
return type.mid(4);
}
else {
return type;
}
}
QString manifestTypeToResourceType(const QString &type) {
if (type == "patterns" || type == "gradients" || type == "palettes") {
return "ko_" + type;
}
else {
return "kis_" + type;
}
}
KisResourceBundleManifest::KisResourceBundleManifest()
{
}
KisResourceBundleManifest::~KisResourceBundleManifest()
{
}
bool KisResourceBundleManifest::load(QIODevice *device)
{
m_resources.clear();
if (!device->isOpen()) {
if (!device->open(QIODevice::ReadOnly)) {
return false;
}
}
KoXmlDocument manifestDocument;
QString errorMessage;
int errorLine;
int errorColumn;
if (!manifestDocument.setContent(device, true, &errorMessage, &errorLine, &errorColumn)) {
return false;
}
if (!errorMessage.isEmpty()) {
warnKrita << "Error parsing manifest" << errorMessage << "line" << errorLine << "column" << errorColumn;
return false;
}
// First find the manifest:manifest node.
KoXmlNode n = manifestDocument.firstChild();
for (; !n.isNull(); n = n.nextSibling()) {
if (!n.isElement()) {
continue;
}
if (n.toElement().localName() == "manifest" && n.toElement().namespaceURI() == KoXmlNS::manifest) {
break;
}
}
if (n.isNull()) {
// "Could not find manifest:manifest";
return false;
}
// Now loop through the children of the manifest:manifest and
// store all the manifest:file-entry elements.
const KoXmlElement manifestElement = n.toElement();
for (n = manifestElement.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
KoXmlElement el = n.toElement();
if (!(el.localName() == "file-entry" && el.namespaceURI() == KoXmlNS::manifest))
continue;
QString fullPath = el.attributeNS(KoXmlNS::manifest, "full-path", QString());
QString mediaType = el.attributeNS(KoXmlNS::manifest, "media-type", QString());
QString md5sum = el.attributeNS(KoXmlNS::manifest, "md5sum", QString());
QString version = el.attributeNS(KoXmlNS::manifest, "version", QString());
QStringList tagList;
KoXmlNode tagNode = n.firstChildElement().firstChildElement();
while (!tagNode.isNull()) {
if (tagNode.firstChild().isText()) {
tagList.append(tagNode.firstChild().toText().data());
}
tagNode = tagNode.nextSibling();
}
// Only if fullPath is valid, should we store this entry.
// If not, we don't bother to find out exactly what is wrong, we just skip it.
if (!fullPath.isNull() && !mediaType.isEmpty() && !md5sum.isEmpty()) {
addResource(mediaType, fullPath, tagList, QByteArray::fromHex(md5sum.toLatin1()));
}
}
return true;
}
bool KisResourceBundleManifest::save(QIODevice *device)
{
if (!device->isOpen()) {
if (!device->open(QIODevice::WriteOnly)) {
return false;
}
}
KoXmlWriter manifestWriter(device);
manifestWriter.startDocument("manifest:manifest");
manifestWriter.startElement("manifest:manifest");
manifestWriter.addAttribute("xmlns:manifest", KoXmlNS::manifest);
manifestWriter.addAttribute("manifest:version", "1.2");
manifestWriter.addManifestEntry("/", "application/x-krita-resourcebundle");
Q_FOREACH (QString resourceType, m_resources.uniqueKeys()) {
Q_FOREACH (const ResourceReference &resource, m_resources[resourceType].values()) {
manifestWriter.startElement("manifest:file-entry");
manifestWriter.addAttribute("manifest:media-type", resourceTypeToManifestType(resourceType));
manifestWriter.addAttribute("manifest:full-path", resourceTypeToManifestType(resourceType) + "/" + QFileInfo(resource.resourcePath).fileName());
manifestWriter.addAttribute("manifest:md5sum", QString(resource.md5sum.toHex()));
if (!resource.tagList.isEmpty()) {
manifestWriter.startElement("manifest:tags");
Q_FOREACH (const QString tag, resource.tagList) {
manifestWriter.startElement("manifest:tag");
manifestWriter.addTextNode(tag);
manifestWriter.endElement();
}
manifestWriter.endElement();
}
manifestWriter.endElement();
}
}
manifestWriter.endElement();
manifestWriter.endDocument();
return true;
}
void KisResourceBundleManifest::addResource(const QString &fileTypeName, const QString &fileName, const QStringList &fileTagList, const QByteArray &md5)
{
ResourceReference ref(fileName, fileTagList, fileTypeName, md5);
if (!m_resources.contains(fileTypeName)) {
m_resources[fileTypeName] = QMap<QString, ResourceReference>();
}
m_resources[fileTypeName].insert(fileName, ref);
}
QStringList KisResourceBundleManifest::types() const
{
return m_resources.keys();
}
QStringList KisResourceBundleManifest::tags() const
{
QSet<QString> tags;
Q_FOREACH (const QString &type, m_resources.keys()) {
Q_FOREACH (const ResourceReference &ref, m_resources[type].values()) {
tags += ref.tagList.toSet();
}
}
return QStringList::fromSet(tags);
}
QList<KisResourceBundleManifest::ResourceReference> KisResourceBundleManifest::files(const QString &type) const
{
// If no type is specified we return all the resources
if(type.isEmpty()) {
QList<ResourceReference> resources;
QList<QMap<QString, ResourceReference> >::iterator i;
QList<QMap<QString, ResourceReference> > values = m_resources.values();
for(i = values.begin(); i != values.end(); ++i) {
resources.append(i->values());
}
return resources;
}
else if (!m_resources.contains(type)) {
return QList<KisResourceBundleManifest::ResourceReference>();
}
return m_resources[type].values();
}
void KisResourceBundleManifest::removeFile(QString fileName)
{
QList<QString> tags;
Q_FOREACH (const QString &type, m_resources.keys()) {
if (m_resources[type].contains(fileName)) {
m_resources[type].remove(fileName);
}
}
}
diff --git a/libs/ui/KisSaveGroupVisitor.h b/libs/ui/KisSaveGroupVisitor.h
index 43262e53d4..f500b2381d 100644
--- a/libs/ui/KisSaveGroupVisitor.h
+++ b/libs/ui/KisSaveGroupVisitor.h
@@ -1,103 +1,103 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSAVEGROUPVISITOR_H
#define KISSAVEGROUPVISITOR_H
#include "kritaui_export.h"
#include <QUrl>
#include <QString>
#include <kis_types.h>
#include <kis_node_visitor.h>
#include <kis_layer.h>
#include <kis_group_layer.h>
#include <kis_node.h>
#include <kis_image.h>
/**
* @brief The KisSaveGroupVisitor class saves the groups in
* a Krita image to separate images.
*/
class KRITAUI_EXPORT KisSaveGroupVisitor : public KisNodeVisitor
{
public:
/**
* Create a KisSaveGroupVisitor
*
* @param image: the image to save
* @param saveInvisible: also save invisibible layers
* @param saveTopLevelOnly: if true, only save the toplevel layers, otherwise
* descend into groups and save the bottom-most groups (groups that do
* not contain another group.
* @param url the base location where the images will be saved
* @param baseName the basename of the images
* @param extension the file format extension
* @param mimeFilter the export image type
*/
KisSaveGroupVisitor(KisImageWSP image,
bool saveInvisible,
bool saveTopLevelOnly,
const QString &path,
const QString &baseName,
const QString &extension,
const QString &mimeFilter);
- virtual ~KisSaveGroupVisitor();
+ ~KisSaveGroupVisitor() override;
public:
- bool visit(KisNode* );
+ bool visit(KisNode* ) override;
- bool visit(KisPaintLayer *);
+ bool visit(KisPaintLayer *) override;
- bool visit(KisAdjustmentLayer *);
+ bool visit(KisAdjustmentLayer *) override;
- bool visit(KisExternalLayer *);
+ bool visit(KisExternalLayer *) override;
- bool visit(KisCloneLayer *);
+ bool visit(KisCloneLayer *) override;
- bool visit(KisFilterMask *);
+ bool visit(KisFilterMask *) override;
- bool visit(KisTransformMask *);
+ bool visit(KisTransformMask *) override;
- bool visit(KisTransparencyMask *);
+ bool visit(KisTransparencyMask *) override;
- bool visit(KisGeneratorLayer * );
+ bool visit(KisGeneratorLayer * ) override;
- bool visit(KisSelectionMask* );
+ bool visit(KisSelectionMask* ) override;
- bool visit(KisColorizeMask* );
+ bool visit(KisColorizeMask* ) override;
- bool visit(KisGroupLayer *layer);
+ bool visit(KisGroupLayer *layer) override;
private:
KisImageWSP m_image;
bool m_saveInvisible;
bool m_saveTopLevelOnly;
QString m_path;
QString m_baseName;
QString m_extension;
QString m_mimeFilter;
};
#endif // KISSAVEGROUPVISITOR_H
diff --git a/libs/ui/KisSelectedShapesProxy.h b/libs/ui/KisSelectedShapesProxy.h
index 79b957073b..4296dff5f4 100644
--- a/libs/ui/KisSelectedShapesProxy.h
+++ b/libs/ui/KisSelectedShapesProxy.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSELECTEDSHAPESPROXY_H
#define KISSELECTEDSHAPESPROXY_H
#include <QObject>
#include <QScopedPointer>
#include <KoSelectedShapesProxy.h>
class KoShapeManager;
class KisSelectedShapesProxy : public KoSelectedShapesProxy
{
Q_OBJECT
public:
KisSelectedShapesProxy(KoShapeManager *globalShapeManager);
- ~KisSelectedShapesProxy();
+ ~KisSelectedShapesProxy() override;
void setShapeManager(KoShapeManager *manager);
- KoSelection *selection();
+ KoSelection *selection() override;
Q_SIGNALS:
void selectionChanged();
void selectionContentChanged();
void currentLayerChanged(const KoShapeLayer *layer);
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif // KISSELECTEDSHAPESPROXY_H
diff --git a/libs/ui/KisSyncedAudioPlayback.h b/libs/ui/KisSyncedAudioPlayback.h
index 2286a934f0..ab33a3a7d7 100644
--- a/libs/ui/KisSyncedAudioPlayback.h
+++ b/libs/ui/KisSyncedAudioPlayback.h
@@ -1,37 +1,37 @@
#ifndef KISSYNCEDAUDIOPLAYBACK_H
#define KISSYNCEDAUDIOPLAYBACK_H
#include <QScopedPointer>
#include <QObject>
class KisSyncedAudioPlayback : public QObject
{
Q_OBJECT
public:
KisSyncedAudioPlayback(const QString &fileName);
- virtual ~KisSyncedAudioPlayback();
+ ~KisSyncedAudioPlayback() override;
void setSoundOffsetTolerance(qint64 value);
void syncWithVideo(qint64 position);
bool isPlaying() const;
void setVolume(qreal value);
public Q_SLOTS:
void setSpeed(qreal value);
void play(qint64 startPosition);
void stop();
Q_SIGNALS:
void error(const QString &filename, const QString &message);
private Q_SLOTS:
void slotOnError();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KISSYNCEDAUDIOPLAYBACK_H
diff --git a/libs/ui/KisTemplateCreateDia.h b/libs/ui/KisTemplateCreateDia.h
index 1e8256feac..14bb84fa0f 100644
--- a/libs/ui/KisTemplateCreateDia.h
+++ b/libs/ui/KisTemplateCreateDia.h
@@ -1,71 +1,71 @@
/*
This file is part of the KDE project
Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
2000 Werner Trobin <trobin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TEMPLATE_CREATE_DIA_H
#define KIS_TEMPLATE_CREATE_DIA_H
#include <KoDialog.h>
#include "kritaui_export.h"
class QString;
class QPixmap;
class KisDocument;
class KisTemplateCreateDiaPrivate;
/****************************************************************************
*
* Class: koTemplateCreateDia
*
****************************************************************************/
class KRITAUI_EXPORT KisTemplateCreateDia : public KoDialog
{
Q_OBJECT
private:
KisTemplateCreateDia(const QString &templatesResourcePath,
const QString &filePath, const QPixmap &thumbnail, QWidget *parent=0 );
- ~KisTemplateCreateDia();
+ ~KisTemplateCreateDia() override;
public:
static void createTemplate(const QString &templatesResourcePath, const char *suffix,
KisDocument *document, QWidget *parent = 0);
private Q_SLOTS:
void slotOk();
void slotDefault();
void slotCustom();
void slotSelect();
void slotNameChanged(const QString &name);
void slotAddGroup();
void slotRemove();
void slotSelectionChanged();
private:
void updatePixmap();
void fillGroupTree();
private:
KisTemplateCreateDiaPrivate * const d;
};
#endif
diff --git a/libs/ui/KisTemplatesPane.h b/libs/ui/KisTemplatesPane.h
index 48d86201d4..28779dd7c0 100644
--- a/libs/ui/KisTemplatesPane.h
+++ b/libs/ui/KisTemplatesPane.h
@@ -1,71 +1,71 @@
/* This file is part of the KDE project
Copyright (C) 2005-2006 Peter Simonsson <psn@linux.se>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TEMPLATES_PANE_H
#define KIS_TEMPLATES_PANE_H
#include "KisDetailsPane.h"
class KisTemplate;
class KisTemplateGroup;
class KisTemplatesPanePrivate;
/**
* This widget is the right-side part of the template opening widget.
* The parent widget is initial widget in the document space of each Calligra component.
* This widget shows a list of templates and can show their details or open it.
*/
class KisTemplatesPane : public KisDetailsPane
{
Q_OBJECT
public:
/**
* Constructor.
* @param parent the parent widget
* @param header string used as header text in the listview
* @param group the group of templates this widget will show.
* @param defaultTemplate pointer to the default template. Used to select a
* template when none has been selected before.
*/
KisTemplatesPane(QWidget* parent, const QString& header,
KisTemplateGroup* group, KisTemplate* defaultTemplate);
- ~KisTemplatesPane();
+ ~KisTemplatesPane() override;
/// Returns true if a template in this group was the last one selected
bool isSelected();
Q_SIGNALS:
/// Emitted when the always use checkbox is selected
void alwaysUseChanged(KisTemplatesPane* sender, const QString& alwaysUse);
protected Q_SLOTS:
- void selectionChanged(const QModelIndex& index);
+ void selectionChanged(const QModelIndex& index) override;
- void openFile();
- void openFile(const QModelIndex& index);
+ void openFile() override;
+ void openFile(const QModelIndex& index) override;
void alwaysUseClicked();
void changeAlwaysUseTemplate(KisTemplatesPane* sender, const QString& alwaysUse);
private:
KisTemplatesPanePrivate * const d;
};
#endif
diff --git a/libs/ui/KisView.cpp b/libs/ui/KisView.cpp
index ed4b7d8e71..2db67e1548 100644
--- a/libs/ui/KisView.cpp
+++ b/libs/ui/KisView.cpp
@@ -1,960 +1,967 @@
/*
* Copyright (C) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KisView.h"
#include "KisView_p.h"
#include <KoDockFactoryBase.h>
#include <KoDockRegistry.h>
#include <KoDocumentInfo.h>
#include "KoDocumentInfo.h"
#include "KoPageLayout.h"
#include <KoToolManager.h>
#include <kis_icon.h>
#include <kactioncollection.h>
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <kselectaction.h>
#include <kconfiggroup.h>
#include <kactioncollection.h>
#include <QMenu>
#include <QMessageBox>
#include <QUrl>
#include <QTemporaryFile>
#include <QApplication>
#include <QDesktopWidget>
#include <QDockWidget>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QImage>
#include <QList>
#include <QPrintDialog>
#include <QToolBar>
#include <QUrl>
#include <QStatusBar>
#include <QMoveEvent>
#include <QTemporaryFile>
#include <kis_image.h>
#include <kis_node.h>
#include <kis_group_layer.h>
#include <kis_layer.h>
#include <kis_mask.h>
#include <kis_selection.h>
#include "kis_canvas2.h"
#include "kis_canvas_controller.h"
#include "kis_canvas_resource_provider.h"
#include "kis_config.h"
#include "KisDocument.h"
#include "kis_image_manager.h"
#include "KisMainWindow.h"
#include "kis_mimedata.h"
#include "kis_mirror_axis.h"
#include "kis_node_commands_adapter.h"
#include "kis_node_manager.h"
#include "KisPart.h"
#include "KisPrintJob.h"
#include "kis_shape_controller.h"
#include "kis_tool_freehand.h"
#include "KisUndoStackAction.h"
#include "KisViewManager.h"
#include "kis_zoom_manager.h"
#include "kis_composite_progress_proxy.h"
#include "kis_statusbar.h"
#include "kis_painting_assistants_decoration.h"
#include "kis_progress_widget.h"
#include "kis_signal_compressor.h"
#include "kis_filter_manager.h"
#include "kis_file_layer.h"
#include "krita_utils.h"
#include "input/kis_input_manager.h"
#include "KisRemoteFileFetcher.h"
//static
QString KisView::newObjectName()
{
static int s_viewIFNumber = 0;
QString name; name.setNum(s_viewIFNumber++); name.prepend("view_");
return name;
}
bool KisView::s_firstView = true;
class Q_DECL_HIDDEN KisView::Private
{
public:
Private(KisView *_q,
KisDocument *document,
KoCanvasResourceManager *resourceManager,
KActionCollection *actionCollection)
: actionCollection(actionCollection)
, viewConverter()
, canvasController(_q, actionCollection)
, canvas(&viewConverter, resourceManager, _q, document->shapeController())
, zoomManager(_q, &this->viewConverter, &this->canvasController)
, paintingAssistantsDecoration(new KisPaintingAssistantsDecoration(_q))
, floatingMessageCompressor(100, KisSignalCompressor::POSTPONE)
{
}
KisUndoStackAction *undo = 0;
KisUndoStackAction *redo = 0;
bool inOperation; //in the middle of an operation (no screen refreshing)?
QPointer<KisDocument> document; // our KisDocument
QWidget *tempActiveWidget = 0;
/**
* Signals the document has been deleted. Can't use document==0 since this
* only happens in ~QObject, and views get deleted by ~KisDocument.
* XXX: either provide a better justification to do things this way, or
* rework the mechanism.
*/
bool documentDeleted = false;
KActionCollection* actionCollection;
KisCoordinatesConverter viewConverter;
KisCanvasController canvasController;
KisCanvas2 canvas;
KisZoomManager zoomManager;
KisViewManager *viewManager = 0;
KisNodeSP currentNode;
KisPaintingAssistantsDecorationSP paintingAssistantsDecoration;
bool isCurrent = false;
bool showFloatingMessage = false;
QPointer<KisFloatingMessage> savedFloatingMessage;
KisSignalCompressor floatingMessageCompressor;
bool softProofing = false;
bool gamutCheck = false;
// Hmm sorry for polluting the private class with such a big inner class.
// At the beginning it was a little struct :)
class StatusBarItem
{
public:
StatusBarItem(QWidget * widget, int stretch, bool permanent)
: m_widget(widget),
m_stretch(stretch),
m_permanent(permanent),
m_connected(false),
m_hidden(false) {}
bool operator==(const StatusBarItem& rhs) {
return m_widget == rhs.m_widget;
}
bool operator!=(const StatusBarItem& rhs) {
return m_widget != rhs.m_widget;
}
QWidget * widget() const {
return m_widget;
}
void ensureItemShown(QStatusBar * sb) {
Q_ASSERT(m_widget);
if (!m_connected) {
if (m_permanent)
sb->addPermanentWidget(m_widget, m_stretch);
else
sb->addWidget(m_widget, m_stretch);
if(!m_hidden)
m_widget->show();
m_connected = true;
}
}
void ensureItemHidden(QStatusBar * sb) {
if (m_connected) {
m_hidden = m_widget->isHidden();
sb->removeWidget(m_widget);
m_widget->hide();
m_connected = false;
}
}
private:
QWidget * m_widget = 0;
int m_stretch;
bool m_permanent;
bool m_connected = false;
bool m_hidden = false;
};
};
KisView::KisView(KisDocument *document, KoCanvasResourceManager *resourceManager, KActionCollection *actionCollection, QWidget *parent)
: QWidget(parent)
, d(new Private(this, document, resourceManager, actionCollection))
{
Q_ASSERT(document);
connect(document, SIGNAL(titleModified(QString,bool)), this, SIGNAL(titleModified(QString,bool)));
setObjectName(newObjectName());
d->document = document;
setFocusPolicy(Qt::StrongFocus);
d->undo = new KisUndoStackAction(d->document->undoStack(), KisUndoStackAction::UNDO);
d->redo = new KisUndoStackAction(d->document->undoStack(), KisUndoStackAction::RED0);
QStatusBar * sb = statusBar();
if (sb) { // No statusbar in e.g. konqueror
connect(d->document, SIGNAL(statusBarMessage(const QString&)),
this, SLOT(slotActionStatusText(const QString&)));
connect(d->document, SIGNAL(clearStatusBarMessage()),
this, SLOT(slotClearStatusText()));
}
d->canvas.setup();
KisConfig cfg;
d->canvasController.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
d->canvasController.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
d->canvasController.setDrawShadow(false);
d->canvasController.setCanvasMode(KoCanvasController::Infinite);
d->canvasController.setVastScrolling(cfg.vastScrolling());
d->canvasController.setCanvas(&d->canvas);
d->zoomManager.setup(d->actionCollection);
connect(&d->canvasController, SIGNAL(documentSizeChanged()), &d->zoomManager, SLOT(slotScrollAreaSizeChanged()));
setAcceptDrops(true);
connect(d->document, SIGNAL(sigLoadingFinished()), this, SLOT(slotLoadingFinished()));
connect(d->document, SIGNAL(sigSavingFinished()), this, SLOT(slotSavingFinished()));
d->canvas.addDecoration(d->paintingAssistantsDecoration);
d->paintingAssistantsDecoration->setVisible(true);
d->showFloatingMessage = cfg.showCanvasMessages();
}
KisView::~KisView()
{
if (d->viewManager) {
KoProgressProxy *proxy = d->viewManager->statusBar()->progress()->progressProxy();
KIS_ASSERT_RECOVER_NOOP(proxy);
image()->compositeProgressProxy()->removeProxy(proxy);
if (d->viewManager->filterManager()->isStrokeRunning()) {
d->viewManager->filterManager()->cancel();
}
}
KoToolManager::instance()->removeCanvasController(&d->canvasController);
KisPart::instance()->removeView(this);
delete d;
}
void KisView::notifyCurrentStateChanged(bool isCurrent)
{
d->isCurrent = isCurrent;
if (!d->isCurrent && d->savedFloatingMessage) {
d->savedFloatingMessage->removeMessage();
}
KisInputManager *inputManager = globalInputManager();
if (d->isCurrent) {
inputManager->attachPriorityEventFilter(&d->canvasController);
} else {
inputManager->detachPriorityEventFilter(&d->canvasController);
}
}
void KisView::setShowFloatingMessage(bool show)
{
d->showFloatingMessage = show;
}
void KisView::showFloatingMessageImpl(const QString &message, const QIcon& icon, int timeout, KisFloatingMessage::Priority priority, int alignment)
{
if (!d->viewManager) return;
if(d->isCurrent && d->showFloatingMessage && d->viewManager->qtMainWindow()) {
if (d->savedFloatingMessage) {
d->savedFloatingMessage->tryOverrideMessage(message, icon, timeout, priority, alignment);
} else {
d->savedFloatingMessage = new KisFloatingMessage(message, this->canvasBase()->canvasWidget(), false, timeout, priority, alignment);
d->savedFloatingMessage->setShowOverParent(true);
d->savedFloatingMessage->setIcon(icon);
connect(&d->floatingMessageCompressor, SIGNAL(timeout()), d->savedFloatingMessage, SLOT(showMessage()));
d->floatingMessageCompressor.start();
}
}
}
bool KisView::canvasIsMirrored() const
{
return d->canvas.xAxisMirrored() || d->canvas.yAxisMirrored();
}
void KisView::setViewManager(KisViewManager *view)
{
d->viewManager = view;
KoToolManager::instance()->addController(&d->canvasController);
KoToolManager::instance()->registerToolActions(d->actionCollection, &d->canvasController);
dynamic_cast<KisShapeController*>(d->document->shapeController())->setInitialShapeForCanvas(&d->canvas);
if (resourceProvider()) {
resourceProvider()->slotImageSizeChanged();
}
if (d->viewManager && d->viewManager->nodeManager()) {
d->viewManager->nodeManager()->nodesUpdated();
}
connect(image(), SIGNAL(sigSizeChanged(const QPointF&, const QPointF&)), this, SLOT(slotImageSizeChanged(const QPointF&, const QPointF&)));
connect(image(), SIGNAL(sigResolutionChanged(double,double)), this, SLOT(slotImageResolutionChanged()));
// executed in a context of an image thread
connect(image(), SIGNAL(sigNodeAddedAsync(KisNodeSP)),
SLOT(slotImageNodeAdded(KisNodeSP)),
Qt::DirectConnection);
// executed in a context of the gui thread
connect(this, SIGNAL(sigContinueAddNode(KisNodeSP)),
SLOT(slotContinueAddNode(KisNodeSP)),
Qt::AutoConnection);
// executed in a context of an image thread
connect(image(), SIGNAL(sigRemoveNodeAsync(KisNodeSP)),
SLOT(slotImageNodeRemoved(KisNodeSP)),
Qt::DirectConnection);
// executed in a context of the gui thread
connect(this, SIGNAL(sigContinueRemoveNode(KisNodeSP)),
SLOT(slotContinueRemoveNode(KisNodeSP)),
Qt::AutoConnection);
/*
* WARNING: Currently we access the global progress bar in two ways:
* connecting to composite progress proxy (strokes) and creating
* progress updaters. The latter way should be deprecated in favour
* of displaying the status of the global strokes queue
*/
image()->compositeProgressProxy()->addProxy(d->viewManager->statusBar()->progress()->progressProxy());
connect(d->viewManager->statusBar()->progress(), SIGNAL(sigCancellationRequested()), image(), SLOT(requestStrokeCancellation()));
d->viewManager->updateGUI();
KoToolManager::instance()->switchToolRequested("KritaShape/KisToolBrush");
}
KisViewManager* KisView::viewManager() const
{
return d->viewManager;
}
void KisView::slotImageNodeAdded(KisNodeSP node)
{
emit sigContinueAddNode(node);
}
void KisView::slotContinueAddNode(KisNodeSP newActiveNode)
{
/**
* When deleting the last layer, root node got selected. We should
* fix it when the first layer is added back.
*
* Here we basically reimplement what Qt's view/model do. But
* since they are not connected, we should do it manually.
*/
if (!d->isCurrent &&
(!d->currentNode || !d->currentNode->parent())) {
d->currentNode = newActiveNode;
}
}
void KisView::slotImageNodeRemoved(KisNodeSP node)
{
emit sigContinueRemoveNode(KritaUtils::nearestNodeAfterRemoval(node));
}
void KisView::slotContinueRemoveNode(KisNodeSP newActiveNode)
{
if (!d->isCurrent) {
d->currentNode = newActiveNode;
}
}
QAction *KisView::undoAction() const
{
return d->undo;
}
QAction *KisView::redoAction() const
{
return d->redo;
}
KoZoomController *KisView::zoomController() const
{
return d->zoomManager.zoomController();
}
KisZoomManager *KisView::zoomManager() const
{
return &d->zoomManager;
}
KisCanvasController *KisView::canvasController() const
{
return &d->canvasController;
}
KisCanvasResourceProvider *KisView::resourceProvider() const
{
if (d->viewManager) {
return d->viewManager->resourceProvider();
}
return 0;
}
KisInputManager* KisView::globalInputManager() const
{
return d->viewManager ? d->viewManager->inputManager() : 0;
}
KisCanvas2 *KisView::canvasBase() const
{
return &d->canvas;
}
KisImageWSP KisView::image() const
{
if (d->document) {
return d->document->image();
}
return 0;
}
KisCoordinatesConverter *KisView::viewConverter() const
{
return &d->viewConverter;
}
void KisView::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasImage()
|| event->mimeData()->hasUrls()
|| event->mimeData()->hasFormat("application/x-krita-node")) {
event->accept();
// activate view if it should accept the drop
this->setFocus();
} else {
event->ignore();
}
}
void KisView::dropEvent(QDropEvent *event)
{
KisImageWSP kisimage = image();
Q_ASSERT(kisimage);
QPoint cursorPos = canvasBase()->coordinatesConverter()->widgetToImage(event->pos()).toPoint();
QRect imageBounds = kisimage->bounds();
QPoint pasteCenter;
bool forceRecenter;
if (event->keyboardModifiers() & Qt::ShiftModifier &&
imageBounds.contains(cursorPos)) {
pasteCenter = cursorPos;
forceRecenter = true;
} else {
pasteCenter = imageBounds.center();
forceRecenter = false;
}
if (event->mimeData()->hasFormat("application/x-krita-node") ||
event->mimeData()->hasImage())
{
KisShapeController *kritaShapeController =
dynamic_cast<KisShapeController*>(d->document->shapeController());
QList<KisNodeSP> nodes =
KisMimeData::loadNodes(event->mimeData(), imageBounds,
pasteCenter, forceRecenter,
kisimage, kritaShapeController);
Q_FOREACH (KisNodeSP node, nodes) {
if (node) {
KisNodeCommandsAdapter adapter(viewManager());
if (!viewManager()->nodeManager()->activeLayer()) {
adapter.addNode(node, kisimage->rootLayer() , 0);
} else {
adapter.addNode(node,
viewManager()->nodeManager()->activeLayer()->parent(),
viewManager()->nodeManager()->activeLayer());
}
}
}
}
else if (event->mimeData()->hasUrls()) {
QList<QUrl> urls = event->mimeData()->urls();
if (urls.length() > 0) {
QMenu popup;
popup.setObjectName("drop_popup");
QAction *insertAsNewLayer = new QAction(i18n("Insert as New Layer"), &popup);
QAction *insertManyLayers = new QAction(i18n("Insert Many Layers"), &popup);
QAction *insertAsNewFileLayer = new QAction(i18n("Insert as New File Layer"), &popup);
QAction *insertManyFileLayers = new QAction(i18n("Insert Many File Layers"), &popup);
QAction *openInNewDocument = new QAction(i18n("Open in New Document"), &popup);
QAction *openManyDocuments = new QAction(i18n("Open Many Documents"), &popup);
QAction *cancel = new QAction(i18n("Cancel"), &popup);
popup.addAction(insertAsNewLayer);
popup.addAction(insertAsNewFileLayer);
popup.addAction(openInNewDocument);
popup.addAction(insertManyLayers);
popup.addAction(insertManyFileLayers);
popup.addAction(openManyDocuments);
insertAsNewLayer->setEnabled(image() && urls.count() == 1);
insertAsNewFileLayer->setEnabled(image() && urls.count() == 1);
openInNewDocument->setEnabled(urls.count() == 1);
insertManyLayers->setEnabled(image() && urls.count() > 1);
insertManyFileLayers->setEnabled(image() && urls.count() > 1);
openManyDocuments->setEnabled(urls.count() > 1);
popup.addSeparator();
popup.addAction(cancel);
QAction *action = popup.exec(QCursor::pos());
if (action != 0 && action != cancel) {
QTemporaryFile *tmp = 0;
for (QUrl url : urls) {
if (!url.isLocalFile()) {
// download the file and substitute the url
KisRemoteFileFetcher fetcher;
tmp = new QTemporaryFile();
tmp->setAutoRemove(true);
if (!fetcher.fetchFile(url, tmp)) {
qDebug() << "Fetching" << url << "failed";
continue;
}
url = url.fromLocalFile(tmp->fileName());
}
if (url.isLocalFile()) {
if (action == insertAsNewLayer || action == insertManyLayers) {
d->viewManager->imageManager()->importImage(url);
activateWindow();
}
else if (action == insertAsNewFileLayer || action == insertManyFileLayers) {
KisNodeCommandsAdapter adapter(viewManager());
KisFileLayer *fileLayer = new KisFileLayer(image(), "", url.toLocalFile(),
KisFileLayer::None, image()->nextLayerName(), OPACITY_OPAQUE_U8);
adapter.addNode(fileLayer, viewManager()->activeNode()->parent(), viewManager()->activeNode());
}
else {
Q_ASSERT(action == openInNewDocument || action == openManyDocuments);
if (mainWindow()) {
mainWindow()->openDocument(url);
}
}
}
delete tmp;
tmp = 0;
}
}
}
}
}
KisDocument *KisView::document() const
{
return d->document;
}
void KisView::setDocument(KisDocument *document)
{
d->document->disconnect(this);
d->document = document;
QStatusBar *sb = statusBar();
if (sb) { // No statusbar in e.g. konqueror
connect(d->document, SIGNAL(statusBarMessage(const QString&)),
this, SLOT(slotActionStatusText(const QString&)));
connect(d->document, SIGNAL(clearStatusBarMessage()),
this, SLOT(slotClearStatusText()));
}
}
void KisView::setDocumentDeleted()
{
d->documentDeleted = true;
}
QPrintDialog *KisView::createPrintDialog(KisPrintJob *printJob, QWidget *parent)
{
Q_UNUSED(parent);
QPrintDialog *printDialog = new QPrintDialog(&printJob->printer(), this);
printDialog->setMinMax(printJob->printer().fromPage(), printJob->printer().toPage());
printDialog->setEnabledOptions(printJob->printDialogOptions());
return printDialog;
}
KisMainWindow * KisView::mainWindow() const
{
return dynamic_cast<KisMainWindow *>(window());
}
QStatusBar * KisView::statusBar() const
{
KisMainWindow *mw = mainWindow();
return mw ? mw->statusBar() : 0;
}
void KisView::slotActionStatusText(const QString &text)
{
QStatusBar *sb = statusBar();
if (sb)
sb->showMessage(text);
}
void KisView::slotClearStatusText()
{
QStatusBar *sb = statusBar();
if (sb)
sb->clearMessage();
}
QList<QAction*> KisView::createChangeUnitActions(bool addPixelUnit)
{
UnitActionGroup* unitActions = new UnitActionGroup(d->document, addPixelUnit, this);
return unitActions->actions();
}
void KisView::closeEvent(QCloseEvent *event)
{
// Check whether we're the last view
int viewCount = KisPart::instance()->viewCount(document());
if (viewCount > 1) {
// there are others still, so don't bother the user
event->accept();
return;
}
if (queryClose()) {
d->viewManager->removeStatusBarItem(zoomManager()->zoomActionWidget());
event->accept();
return;
}
event->ignore();
}
bool KisView::queryClose()
{
if (!document())
return true;
+ if (document()->isInSaving()) {
+ viewManager()->showFloatingMessage(
+ i18n("Cannot close the document while saving is in progress"),
+ KisIconUtils::loadIcon("object-locked"), 1500 /* ms */);
+ return false;
+ }
+
if (document()->isModified()) {
QString name;
if (document()->documentInfo()) {
name = document()->documentInfo()->aboutInfo("title");
}
if (name.isEmpty())
name = document()->url().fileName();
if (name.isEmpty())
name = i18n("Untitled");
int res = QMessageBox::warning(this,
i18nc("@title:window", "Krita"),
i18n("<p>The document <b>'%1'</b> has been modified.</p><p>Do you want to save it?</p>", name),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::Yes);
switch (res) {
case QMessageBox::Yes : {
bool isNative = (document()->outputMimeType() == document()->nativeFormatMimeType());
if (!viewManager()->mainWindow()->saveDocument(document(), !isNative))
return false;
break;
}
case QMessageBox::No : {
KisImageSP image = document()->image();
image->requestStrokeCancellation();
viewManager()->blockUntilOperationsFinishedForced(image);
document()->removeAutoSaveFiles();
document()->setModified(false); // Now when queryClose() is called by closeEvent it won't do anything.
break;
}
default : // case QMessageBox::Cancel :
return false;
}
}
return true;
}
void KisView::resetImageSizeAndScroll(bool changeCentering,
const QPointF &oldImageStillPoint,
const QPointF &newImageStillPoint)
{
const KisCoordinatesConverter *converter = d->canvas.coordinatesConverter();
QPointF oldPreferredCenter = d->canvasController.preferredCenter();
/**
* Calculating the still point in old coordinates depending on the
* parameters given
*/
QPointF oldStillPoint;
if (changeCentering) {
oldStillPoint =
converter->imageToWidget(oldImageStillPoint) +
converter->documentOffset();
} else {
QSize oldDocumentSize = d->canvasController.documentSize();
oldStillPoint = QPointF(0.5 * oldDocumentSize.width(), 0.5 * oldDocumentSize.height());
}
/**
* Updating the document size
*/
QSizeF size(image()->width() / image()->xRes(), image()->height() / image()->yRes());
KoZoomController *zc = d->zoomManager.zoomController();
zc->setZoom(KoZoomMode::ZOOM_CONSTANT, zc->zoomAction()->effectiveZoom());
zc->setPageSize(size);
zc->setDocumentSize(size, true);
/**
* Calculating the still point in new coordinates depending on the
* parameters given
*/
QPointF newStillPoint;
if (changeCentering) {
newStillPoint =
converter->imageToWidget(newImageStillPoint) +
converter->documentOffset();
} else {
QSize newDocumentSize = d->canvasController.documentSize();
newStillPoint = QPointF(0.5 * newDocumentSize.width(), 0.5 * newDocumentSize.height());
}
d->canvasController.setPreferredCenter(oldPreferredCenter - oldStillPoint + newStillPoint);
}
void KisView::setCurrentNode(KisNodeSP node)
{
d->currentNode = node;
d->canvas.slotTrySwitchShapeManager();
}
KisNodeSP KisView::currentNode() const
{
return d->currentNode;
}
KisLayerSP KisView::currentLayer() const
{
KisNodeSP node;
KisMaskSP mask = currentMask();
if (mask) {
node = mask->parent();
}
else {
node = d->currentNode;
}
return qobject_cast<KisLayer*>(node.data());
}
KisMaskSP KisView::currentMask() const
{
return dynamic_cast<KisMask*>(d->currentNode.data());
}
KisSelectionSP KisView::selection()
{
KisLayerSP layer = currentLayer();
if (layer)
return layer->selection(); // falls through to the global
// selection, or 0 in the end
if (image()) {
return image()->globalSelection();
}
return 0;
}
void KisView::slotSoftProofing(bool softProofing)
{
d->softProofing = softProofing;
QString message;
if (canvasBase()->image()->colorSpace()->colorDepthId().id().contains("F"))
{
message = i18n("Soft Proofing doesn't work in floating point.");
viewManager()->showFloatingMessage(message,QIcon());
return;
}
if (softProofing){
message = i18n("Soft Proofing turned on.");
} else {
message = i18n("Soft Proofing turned off.");
}
viewManager()->showFloatingMessage(message,QIcon());
canvasBase()->slotSoftProofing(softProofing);
}
void KisView::slotGamutCheck(bool gamutCheck)
{
d->gamutCheck = gamutCheck;
QString message;
if (canvasBase()->image()->colorSpace()->colorDepthId().id().contains("F"))
{
message = i18n("Gamut Warnings don't work in floating point.");
viewManager()->showFloatingMessage(message,QIcon());
return;
}
if (gamutCheck){
message = i18n("Gamut Warnings turned on.");
if (!d->softProofing){
message += "\n "+i18n("But Soft Proofing is still off.");
}
} else {
message = i18n("Gamut Warnings turned off.");
}
viewManager()->showFloatingMessage(message,QIcon());
canvasBase()->slotGamutCheck(gamutCheck);
}
bool KisView::softProofing()
{
return d->softProofing;
}
bool KisView::gamutCheck()
{
return d->gamutCheck;
}
void KisView::slotLoadingFinished()
{
if (!document()) return;
/**
* Cold-start of image size/resolution signals
*/
slotImageResolutionChanged();
if (image()->locked()) {
// If this is the first view on the image, the image will have been locked
// so unlock it.
image()->blockSignals(false);
image()->unlock();
}
canvasBase()->initializeImage();
/**
* Dirty hack alert
*/
d->zoomManager.zoomController()->setAspectMode(true);
if (viewConverter()) {
viewConverter()->setZoomMode(KoZoomMode::ZOOM_PAGE);
}
connect(image(), SIGNAL(sigColorSpaceChanged(const KoColorSpace*)), this, SIGNAL(sigColorSpaceChanged(const KoColorSpace*)));
connect(image(), SIGNAL(sigProfileChanged(const KoColorProfile*)), this, SIGNAL(sigProfileChanged(const KoColorProfile*)));
connect(image(), SIGNAL(sigSizeChanged(QPointF,QPointF)), this, SIGNAL(sigSizeChanged(QPointF,QPointF)));
KisNodeSP activeNode = document()->preActivatedNode();
document()->setPreActivatedNode(0); // to make sure that we don't keep a reference to a layer the user can later delete.
if (!activeNode) {
activeNode = image()->rootLayer()->lastChild();
}
while (activeNode && !activeNode->inherits("KisLayer")) {
activeNode = activeNode->prevSibling();
}
setCurrentNode(activeNode);
zoomManager()->updateImageBoundsSnapping();
}
void KisView::slotSavingFinished()
{
if (d->viewManager && d->viewManager->mainWindow()) {
d->viewManager->mainWindow()->updateCaption();
}
}
KisPrintJob * KisView::createPrintJob()
{
return new KisPrintJob(image());
}
void KisView::slotImageResolutionChanged()
{
resetImageSizeAndScroll(false);
zoomManager()->updateImageBoundsSnapping();
zoomManager()->updateGUI();
// update KoUnit value for the document
if (resourceProvider()) {
resourceProvider()->resourceManager()->
setResource(KoCanvasResourceManager::Unit, d->canvas.unit());
}
}
void KisView::slotImageSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint)
{
resetImageSizeAndScroll(true, oldStillPoint, newStillPoint);
zoomManager()->updateImageBoundsSnapping();
zoomManager()->updateGUI();
}
diff --git a/libs/ui/KisView.h b/libs/ui/KisView.h
index 0584cea397..eb2c6b9b7e 100644
--- a/libs/ui/KisView.h
+++ b/libs/ui/KisView.h
@@ -1,281 +1,281 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2007 Thomas Zander <zander@kde.org>
Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_VIEW_H
#define KIS_VIEW_H
#include <QWidget>
#include <KoColorSpace.h>
#include <KoColorProfile.h>
#include <kis_types.h>
#include "kritaui_export.h"
#include "widgets/kis_floating_message.h"
class KisDocument;
class KisMainWindow;
class KisPrintJob;
class KisCanvasController;
class KisZoomManager;
class KisCanvas2;
class KisViewManager;
class KisDocument;
class KisCanvasResourceProvider;
class KisCoordinatesConverter;
class KisInputManager;
class KoZoomController;
class KoZoomController;
struct KoPageLayout;
class KoCanvasResourceManager;
// KDE classes
class QAction;
class KActionCollection;
// Qt classes
class QDragEnterEvent;
class QDropEvent;
class QPrintDialog;
class QCloseEvent;
class QStatusBar;
/**
* This class is used to display a @ref KisDocument.
*
* Multiple views can be attached to one document at a time.
*/
class KRITAUI_EXPORT KisView : public QWidget
{
Q_OBJECT
public:
/**
* Creates a new view for the document.
*/
KisView(KisDocument *document, KoCanvasResourceManager *resourceManager, KActionCollection *actionCollection, QWidget *parent = 0);
- ~KisView();
+ ~KisView() override;
QAction *undoAction() const;
QAction *redoAction() const;
// Temporary while teasing apart view and mainwindow
void setViewManager(KisViewManager *view);
KisViewManager *viewManager() const;
public:
/**
* Retrieves the document object of this view.
*/
KisDocument *document() const;
/**
* Reset the view to show the given document.
*/
void setDocument(KisDocument *document);
/**
* Tells this view that its document has got deleted (called internally)
*/
void setDocumentDeleted();
/**
* In order to print the document represented by this view a new print job should
* be constructed that is capable of doing the printing.
* The default implementation returns 0, which silently cancels printing.
*/
KisPrintJob * createPrintJob();
/**
* Create a QPrintDialog based on the @p printJob
*/
QPrintDialog *createPrintDialog(KisPrintJob *printJob, QWidget *parent);
/**
* @return the KisMainWindow in which this view is currently.
*/
KisMainWindow *mainWindow() const;
/**
* @return the statusbar of the KisMainWindow in which this view is currently.
*/
QStatusBar *statusBar() const;
/**
* This adds a widget to the statusbar for this view.
* If you use this method instead of using statusBar() directly,
* KisView will take care of removing the items when the view GUI is deactivated
* and readding them when it is reactivated.
* The parameters are the same as QStatusBar::addWidget().
*/
void addStatusBarItem(QWidget * widget, int stretch = 0, bool permanent = false);
/**
* Remove a widget from the statusbar for this view.
*/
void removeStatusBarItem(QWidget * widget);
/**
* Return the zoomController for this view.
*/
KoZoomController *zoomController() const;
/// create a list of actions that when activated will change the unit on the document.
QList<QAction*> createChangeUnitActions(bool addPixelUnit = false);
public:
/**
* The zoommanager handles everything action-related to zooming
*/
KisZoomManager *zoomManager() const;
/**
* The CanvasController decorates the canvas with scrollbars
* and knows where to start painting on the canvas widget, i.e.,
* the document offset.
*/
KisCanvasController *canvasController() const;
KisCanvasResourceProvider *resourceProvider() const;
/**
* Filters events and sends them to canvas actions. Shared
* among all the views/canvases
*
* NOTE: May be null while initialization!
*/
KisInputManager* globalInputManager() const;
/**
* @return the canvas object
*/
KisCanvas2 *canvasBase() const;
/// @return the image this view is displaying
KisImageWSP image() const;
KisCoordinatesConverter *viewConverter() const;
void resetImageSizeAndScroll(bool changeCentering,
const QPointF &oldImageStillPoint = QPointF(),
const QPointF &newImageStillPoint = QPointF());
void setCurrentNode(KisNodeSP node);
KisNodeSP currentNode() const;
KisLayerSP currentLayer() const;
KisMaskSP currentMask() const;
/**
* @brief softProofing
* @return whether or not we're softproofing in this view.
*/
bool softProofing();
/**
* @brief gamutCheck
* @return whether or not we're using gamut warnings in this view.
*/
bool gamutCheck();
/// Convenience method to get at the active selection (the
/// selection of the current layer, or, if that does not exist,
/// the global selection.
KisSelectionSP selection();
void notifyCurrentStateChanged(bool isCurrent);
void setShowFloatingMessage(bool show);
void showFloatingMessageImpl(const QString &message, const QIcon& icon, int timeout, KisFloatingMessage::Priority priority, int alignment);
bool canvasIsMirrored() const;
public Q_SLOTS:
/**
* Display a message in the status bar (calls QStatusBar::message())
* @todo rename to something more generic
*/
void slotActionStatusText(const QString &text);
/**
* End of the message in the status bar (calls QStatusBar::clear())
* @todo rename to something more generic
*/
void slotClearStatusText();
/**
* @brief slotSoftProofing set whether or not we're softproofing in this view.
* Will be setting the same in the canvas belonging to the view.
*/
void slotSoftProofing(bool softProofing);
/**
* @brief slotGamutCheck set whether or not we're gamutchecking in this view.
* Will be setting the same in the vans belonging to the view.
*/
void slotGamutCheck(bool gamutCheck);
bool queryClose();
private Q_SLOTS:
void slotImageNodeAdded(KisNodeSP node);
void slotContinueAddNode(KisNodeSP newActiveNode);
void slotImageNodeRemoved(KisNodeSP node);
void slotContinueRemoveNode(KisNodeSP newActiveNode);
Q_SIGNALS:
// From KisImage
void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint);
void sigProfileChanged(const KoColorProfile * profile);
void sigColorSpaceChanged(const KoColorSpace* cs);
void titleModified(QString,bool);
void sigContinueAddNode(KisNodeSP newActiveNode);
void sigContinueRemoveNode(KisNodeSP newActiveNode);
protected:
// QWidget overrides
- void dragEnterEvent(QDragEnterEvent * event);
- void dropEvent(QDropEvent * event);
- void closeEvent(QCloseEvent *event);
+ void dragEnterEvent(QDragEnterEvent * event) override;
+ void dropEvent(QDropEvent * event) override;
+ void closeEvent(QCloseEvent *event) override;
/**
* Generate a name for this view.
*/
QString newObjectName();
public Q_SLOTS:
void slotLoadingFinished();
void slotSavingFinished();
void slotImageResolutionChanged();
void slotImageSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint);
private:
class Private;
Private * const d;
static bool s_firstView;
};
#endif
diff --git a/libs/ui/KisViewManager.cpp b/libs/ui/KisViewManager.cpp
index cb1436844e..8f127d3abd 100644
--- a/libs/ui/KisViewManager.cpp
+++ b/libs/ui/KisViewManager.cpp
@@ -1,1307 +1,1302 @@
/*
* This file is part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 1999 Matthias Elter <me@kde.org>
* 1999 Michael Koch <koch@kde.org>
* 1999 Carsten Pfeiffer <pfeiffer@kde.org>
* 2002 Patrick Julien <freak@codepimps.org>
* 2003-2011 Boudewijn Rempt <boud@valdyas.org>
* 2004 Clarence Dang <dang@kde.org>
* 2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include "KisViewManager.h"
#include <QPrinter>
#include <QAction>
#include <QApplication>
#include <QBuffer>
#include <QByteArray>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QGridLayout>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QObject>
#include <QPoint>
#include <QPrintDialog>
#include <QRect>
#include <QScrollBar>
#include <QStatusBar>
#include <QToolBar>
#include <QUrl>
#include <QWidget>
#include <kactioncollection.h>
#include <klocalizedstring.h>
#include <KoResourcePaths.h>
#include <kselectaction.h>
#include <KoCanvasController.h>
#include <KoCompositeOp.h>
#include <KoDockRegistry.h>
#include <KoDockWidgetTitleBar.h>
#include <KoProperties.h>
#include <KoResourceItemChooserSync.h>
#include <KoSelection.h>
#include <KoStore.h>
#include <KoToolManager.h>
#include <KoToolRegistry.h>
#include <KoViewConverter.h>
#include <KoZoomHandler.h>
#include <KoPluginLoader.h>
#include <KoDocumentInfo.h>
#include <KoGlobal.h>
#include <KoColorSpaceRegistry.h>
#include "input/kis_input_manager.h"
#include "canvas/kis_canvas2.h"
#include "canvas/kis_canvas_controller.h"
#include "canvas/kis_grid_manager.h"
#include "dialogs/kis_dlg_blacklist_cleanup.h"
#include "input/kis_input_profile_manager.h"
#include "kis_action_manager.h"
#include "kis_action.h"
#include "kis_canvas_controls_manager.h"
#include "kis_canvas_resource_provider.h"
#include "kis_composite_progress_proxy.h"
#include "kis_config.h"
#include "kis_config_notifier.h"
#include "kis_control_frame.h"
#include "kis_coordinates_converter.h"
#include "KisDocument.h"
#include "kis_favorite_resource_manager.h"
#include "kis_filter_manager.h"
#include "kis_group_layer.h"
#include <kis_image.h>
#include "kis_image_manager.h"
#include <kis_layer.h>
#include "kis_mainwindow_observer.h"
#include "kis_mask_manager.h"
#include "kis_mimedata.h"
#include "kis_mirror_manager.h"
#include "kis_node_commands_adapter.h"
#include "kis_node.h"
#include "kis_node_manager.h"
#include "kis_painting_assistants_manager.h"
#include <kis_paint_layer.h>
#include "kis_paintop_box.h"
#include <brushengine/kis_paintop_preset.h>
#include "KisPart.h"
#include "KisPrintJob.h"
#include "kis_progress_widget.h"
#include "kis_resource_server_provider.h"
#include "kis_selection.h"
#include "kis_selection_manager.h"
#include "kis_shape_controller.h"
#include "kis_shape_layer.h"
#include <kis_signal_compressor.h>
#include "kis_statusbar.h"
#include <KisTemplateCreateDia.h>
#include <kis_tool_freehand.h>
#include "kis_tooltip_manager.h"
#include <kis_undo_adapter.h>
#include "KisView.h"
#include "kis_zoom_manager.h"
#include "widgets/kis_floating_message.h"
#include "kis_signal_auto_connection.h"
#include "kis_script_manager.h"
#include "kis_icon_utils.h"
#include "kis_guides_manager.h"
#include "kis_derived_resources.h"
#include "dialogs/kis_delayed_save_dialog.h"
class BlockingUserInputEventFilter : public QObject
{
bool eventFilter(QObject *watched, QEvent *event) override
{
Q_UNUSED(watched);
if(dynamic_cast<QWheelEvent*>(event)
|| dynamic_cast<QKeyEvent*>(event)
|| dynamic_cast<QMouseEvent*>(event)) {
return true;
}
else {
return false;
}
}
};
class KisViewManager::KisViewManagerPrivate
{
public:
KisViewManagerPrivate(KisViewManager *_q, KActionCollection *_actionCollection, QWidget *_q_parent)
: filterManager(_q)
, createTemplate(0)
, saveIncremental(0)
, saveIncrementalBackup(0)
, openResourcesDirectory(0)
, rotateCanvasRight(0)
, rotateCanvasLeft(0)
, resetCanvasRotation(0)
, wrapAroundAction(0)
, levelOfDetailAction(0)
, showRulersAction(0)
, rulersTrackMouseAction(0)
, zoomTo100pct(0)
, zoomIn(0)
, zoomOut(0)
, selectionManager(_q)
, statusBar(_q)
, controlFrame(_q, _q_parent)
, nodeManager(_q)
, imageManager(_q)
, gridManager(_q)
, canvasControlsManager(_q)
, paintingAssistantsManager(_q)
, actionManager(_q, _actionCollection)
, mainWindow(0)
, showFloatingMessage(true)
, currentImageView(0)
, canvasResourceProvider(_q)
, canvasResourceManager()
, guiUpdateCompressor(30, KisSignalCompressor::POSTPONE, _q)
, actionCollection(_actionCollection)
, mirrorManager(_q)
, inputManager(_q)
, scriptManager(_q)
, actionAuthor(0)
{
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisCompositeOpResourceConverter));
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisEffectiveCompositeOpResourceConverter));
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisOpacityResourceConverter));
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisFlowResourceConverter));
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisSizeResourceConverter));
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisLodAvailabilityResourceConverter));
canvasResourceManager.addDerivedResourceConverter(toQShared(new KisEraserModeResourceConverter));
canvasResourceManager.addResourceUpdateMediator(toQShared(new KisPresetUpdateMediator));
}
public:
KisFilterManager filterManager;
KisAction *createTemplate;
KisAction *createCopy;
KisAction *saveIncremental;
KisAction *saveIncrementalBackup;
KisAction *openResourcesDirectory;
KisAction *rotateCanvasRight;
KisAction *rotateCanvasLeft;
KisAction *resetCanvasRotation;
KisAction *wrapAroundAction;
KisAction *levelOfDetailAction;
KisAction *showRulersAction;
KisAction *rulersTrackMouseAction;
KisAction *zoomTo100pct;
KisAction *zoomIn;
KisAction *zoomOut;
KisAction *softProof;
KisAction *gamutCheck;
KisSelectionManager selectionManager;
KisGuidesManager guidesManager;
KisStatusBar statusBar;
KisControlFrame controlFrame;
KisNodeManager nodeManager;
KisImageManager imageManager;
KisGridManager gridManager;
KisCanvasControlsManager canvasControlsManager;
KisPaintingAssistantsManager paintingAssistantsManager;
BlockingUserInputEventFilter blockingEventFilter;
KisActionManager actionManager;
QMainWindow* mainWindow;
QPointer<KisFloatingMessage> savedFloatingMessage;
bool showFloatingMessage;
QPointer<KisView> currentImageView;
KisCanvasResourceProvider canvasResourceProvider;
KoCanvasResourceManager canvasResourceManager;
KisSignalCompressor guiUpdateCompressor;
KActionCollection *actionCollection;
KisMirrorManager mirrorManager;
KisInputManager inputManager;
KisSignalAutoConnectionsStore viewConnections;
KisScriptManager scriptManager;
KSelectAction *actionAuthor; // Select action for author profile.
QByteArray canvasState;
bool blockUntilOperationsFinishedImpl(KisImageSP image, bool force);
};
KisViewManager::KisViewManager(QWidget *parent, KActionCollection *_actionCollection)
: d(new KisViewManagerPrivate(this, _actionCollection, parent))
{
d->actionCollection = _actionCollection;
d->mainWindow = dynamic_cast<QMainWindow*>(parent);
d->canvasResourceProvider.setResourceManager(&d->canvasResourceManager);
connect(&d->guiUpdateCompressor, SIGNAL(timeout()), this, SLOT(guiUpdateTimeout()));
createActions();
setupManagers();
// These initialization functions must wait until KisViewManager ctor is complete.
d->statusBar.setup();
d->controlFrame.setup(parent);
//Check to draw scrollbars after "Canvas only mode" toggle is created.
this->showHideScrollbars();
QScopedPointer<KoDummyCanvasController> dummy(new KoDummyCanvasController(actionCollection()));
KoToolManager::instance()->registerToolActions(actionCollection(), dummy.data());
QTimer::singleShot(0, this, SLOT(initializeStatusBarVisibility()));
connect(KoToolManager::instance(), SIGNAL(inputDeviceChanged(KoInputDevice)),
d->controlFrame.paintopBox(), SLOT(slotInputDeviceChanged(KoInputDevice)));
connect(KoToolManager::instance(), SIGNAL(changedTool(KoCanvasController*,int)),
d->controlFrame.paintopBox(), SLOT(slotToolChanged(KoCanvasController*,int)));
connect(&d->nodeManager, SIGNAL(sigNodeActivated(KisNodeSP)),
resourceProvider(), SLOT(slotNodeActivated(KisNodeSP)));
connect(resourceProvider()->resourceManager(), SIGNAL(canvasResourceChanged(int,QVariant)),
d->controlFrame.paintopBox(), SLOT(slotCanvasResourceChanged(int,QVariant)));
connect(KisPart::instance(), SIGNAL(sigViewAdded(KisView*)), SLOT(slotViewAdded(KisView*)));
connect(KisPart::instance(), SIGNAL(sigViewRemoved(KisView*)), SLOT(slotViewRemoved(KisView*)));
connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotUpdateAuthorProfileActions()));
KisInputProfileManager::instance()->loadProfiles();
KisConfig cfg;
d->showFloatingMessage = cfg.showCanvasMessages();
}
KisViewManager::~KisViewManager()
{
KisConfig cfg;
if (resourceProvider() && resourceProvider()->currentPreset()) {
cfg.writeEntry("LastPreset", resourceProvider()->currentPreset()->name());
cfg.writeKoColor("LastForeGroundColor",resourceProvider()->fgColor());
cfg.writeKoColor("LastBackGroundColor",resourceProvider()->bgColor());
}
cfg.writeEntry("baseLength", KoResourceItemChooserSync::instance()->baseLength());
delete d;
}
KActionCollection *KisViewManager::actionCollection() const
{
return d->actionCollection;
}
void KisViewManager::slotViewAdded(KisView *view)
{
d->inputManager.addTrackedCanvas(view->canvasBase());
if (viewCount() == 0) {
d->statusBar.showAllStatusBarItems();
}
}
void KisViewManager::slotViewRemoved(KisView *view)
{
d->inputManager.removeTrackedCanvas(view->canvasBase());
if (viewCount() == 0) {
d->statusBar.hideAllStatusBarItems();
}
}
void KisViewManager::setCurrentView(KisView *view)
{
bool first = true;
if (d->currentImageView) {
d->currentImageView->notifyCurrentStateChanged(false);
d->currentImageView->canvasBase()->setCursor(QCursor(Qt::ArrowCursor));
first = false;
KisDocument* doc = d->currentImageView->document();
if (doc) {
doc->disconnect(this);
}
d->currentImageView->canvasController()->proxyObject->disconnect(&d->statusBar);
d->viewConnections.clear();
}
d->softProof->setChecked(view->softProofing());
d->gamutCheck->setChecked(view->gamutCheck());
QPointer<KisView>imageView = qobject_cast<KisView*>(view);
if (imageView) {
// Wait for the async image to have loaded
KisDocument* doc = view->document();
// connect(canvasController()->proxyObject, SIGNAL(documentMousePositionChanged(QPointF)), d->statusBar, SLOT(documentMousePositionChanged(QPointF)));
d->currentImageView = imageView;
// Restore the last used brush preset, color and background color.
if (first) {
KisConfig cfg;
KisPaintOpPresetResourceServer * rserver = KisResourceServerProvider::instance()->paintOpPresetServer();
QString lastPreset = cfg.readEntry("LastPreset", QString("Basic_tip_default"));
KisPaintOpPresetSP preset = rserver->resourceByName(lastPreset);
if (!preset) {
preset = rserver->resourceByName("Basic_tip_default");
}
if (!preset) {
preset = rserver->resources().first();
}
if (preset) {
paintOpBox()->restoreResource(preset.data());
}
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor foreground(Qt::black, cs);
d->canvasResourceProvider.setFGColor(cfg.readKoColor("LastForeGroundColor",foreground));
KoColor background(Qt::white, cs);
d->canvasResourceProvider.setBGColor(cfg.readKoColor("LastBackGroundColor",background));
}
KisCanvasController *canvasController = dynamic_cast<KisCanvasController*>(d->currentImageView->canvasController());
d->viewConnections.addUniqueConnection(&d->nodeManager, SIGNAL(sigNodeActivated(KisNodeSP)), doc->image(), SLOT(requestStrokeEndActiveNode()));
d->viewConnections.addUniqueConnection(d->rotateCanvasRight, SIGNAL(triggered()), canvasController, SLOT(rotateCanvasRight15()));
d->viewConnections.addUniqueConnection(d->rotateCanvasLeft, SIGNAL(triggered()),canvasController, SLOT(rotateCanvasLeft15()));
d->viewConnections.addUniqueConnection(d->resetCanvasRotation, SIGNAL(triggered()),canvasController, SLOT(resetCanvasRotation()));
d->viewConnections.addUniqueConnection(d->wrapAroundAction, SIGNAL(toggled(bool)), canvasController, SLOT(slotToggleWrapAroundMode(bool)));
d->wrapAroundAction->setChecked(canvasController->wrapAroundMode());
d->viewConnections.addUniqueConnection(d->levelOfDetailAction, SIGNAL(toggled(bool)), canvasController, SLOT(slotToggleLevelOfDetailMode(bool)));
d->levelOfDetailAction->setChecked(canvasController->levelOfDetailMode());
d->viewConnections.addUniqueConnection(d->currentImageView->image(), SIGNAL(sigColorSpaceChanged(const KoColorSpace*)), d->controlFrame.paintopBox(), SLOT(slotColorSpaceChanged(const KoColorSpace*)));
d->viewConnections.addUniqueConnection(d->showRulersAction, SIGNAL(toggled(bool)), imageView->zoomManager(), SLOT(setShowRulers(bool)));
d->viewConnections.addUniqueConnection(d->rulersTrackMouseAction, SIGNAL(toggled(bool)), imageView->zoomManager(), SLOT(setRulersTrackMouse(bool)));
d->viewConnections.addUniqueConnection(d->zoomTo100pct, SIGNAL(triggered()), imageView->zoomManager(), SLOT(zoomTo100()));
d->viewConnections.addUniqueConnection(d->zoomIn, SIGNAL(triggered()), imageView->zoomController()->zoomAction(), SLOT(zoomIn()));
d->viewConnections.addUniqueConnection(d->zoomOut, SIGNAL(triggered()), imageView->zoomController()->zoomAction(), SLOT(zoomOut()));
d->viewConnections.addUniqueConnection(d->softProof, SIGNAL(toggled(bool)), view, SLOT(slotSoftProofing(bool)) );
d->viewConnections.addUniqueConnection(d->gamutCheck, SIGNAL(toggled(bool)), view, SLOT(slotGamutCheck(bool)) );
imageView->zoomManager()->setShowRulers(d->showRulersAction->isChecked());
imageView->zoomManager()->setRulersTrackMouse(d->rulersTrackMouseAction->isChecked());
showHideScrollbars();
}
d->filterManager.setView(imageView);
d->selectionManager.setView(imageView);
d->guidesManager.setView(imageView);
d->nodeManager.setView(imageView);
d->imageManager.setView(imageView);
d->canvasControlsManager.setView(imageView);
d->actionManager.setView(imageView);
d->gridManager.setView(imageView);
d->statusBar.setView(imageView);
d->paintingAssistantsManager.setView(imageView);
d->mirrorManager.setView(imageView);
if (d->currentImageView) {
d->currentImageView->notifyCurrentStateChanged(true);
d->currentImageView->canvasController()->activate();
d->currentImageView->canvasController()->setFocus();
}
d->actionManager.updateGUI();
d->viewConnections.addUniqueConnection(
image(), SIGNAL(sigSizeChanged(const QPointF&, const QPointF&)),
resourceProvider(), SLOT(slotImageSizeChanged()));
d->viewConnections.addUniqueConnection(
image(), SIGNAL(sigResolutionChanged(double,double)),
resourceProvider(), SLOT(slotOnScreenResolutionChanged()));
d->viewConnections.addUniqueConnection(
image(), SIGNAL(sigNodeChanged(KisNodeSP)),
this, SLOT(updateGUI()));
d->viewConnections.addUniqueConnection(
view->zoomManager()->zoomController(),
SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)),
resourceProvider(), SLOT(slotOnScreenResolutionChanged()));
resourceProvider()->slotImageSizeChanged();
resourceProvider()->slotOnScreenResolutionChanged();
Q_EMIT viewChanged();
}
KoZoomController *KisViewManager::zoomController() const
{
if (d->currentImageView) {
return d->currentImageView->zoomController();
}
return 0;
}
KisImageWSP KisViewManager::image() const
{
if (document()) {
return document()->image();
}
return 0;
}
KisCanvasResourceProvider * KisViewManager::resourceProvider()
{
return &d->canvasResourceProvider;
}
KisCanvas2 * KisViewManager::canvasBase() const
{
if (d && d->currentImageView) {
return d->currentImageView->canvasBase();
}
return 0;
}
QWidget* KisViewManager::canvas() const
{
if (d && d->currentImageView && d->currentImageView->canvasBase()->canvasWidget()) {
return d->currentImageView->canvasBase()->canvasWidget();
}
return 0;
}
KisStatusBar * KisViewManager::statusBar() const
{
return &d->statusBar;
}
void KisViewManager::addStatusBarItem(QWidget *widget, int stretch, bool permanent)
{
d->statusBar.addStatusBarItem(widget, stretch, permanent);
}
void KisViewManager::removeStatusBarItem(QWidget *widget)
{
d->statusBar.removeStatusBarItem(widget);
}
KisPaintopBox* KisViewManager::paintOpBox() const
{
return d->controlFrame.paintopBox();
}
KoProgressUpdater* KisViewManager::createProgressUpdater(KoProgressUpdater::Mode mode)
{
return new KisProgressUpdater(d->statusBar.progress(), document()->progressProxy(), mode);
}
KisSelectionManager * KisViewManager::selectionManager()
{
return &d->selectionManager;
}
KisNodeSP KisViewManager::activeNode()
{
return d->nodeManager.activeNode();
}
KisLayerSP KisViewManager::activeLayer()
{
return d->nodeManager.activeLayer();
}
KisPaintDeviceSP KisViewManager::activeDevice()
{
return d->nodeManager.activePaintDevice();
}
KisZoomManager * KisViewManager::zoomManager()
{
if (d->currentImageView) {
return d->currentImageView->zoomManager();
}
return 0;
}
KisFilterManager * KisViewManager::filterManager()
{
return &d->filterManager;
}
KisImageManager * KisViewManager::imageManager()
{
return &d->imageManager;
}
KisInputManager* KisViewManager::inputManager() const
{
return &d->inputManager;
}
KisSelectionSP KisViewManager::selection()
{
if (d->currentImageView) {
return d->currentImageView->selection();
}
return 0;
}
bool KisViewManager::selectionEditable()
{
KisLayerSP layer = activeLayer();
if (layer) {
KoProperties properties;
QList<KisNodeSP> masks = layer->childNodes(QStringList("KisSelectionMask"), properties);
if (masks.size() == 1) {
return masks[0]->isEditable();
}
}
// global selection is always editable
return true;
}
KisUndoAdapter * KisViewManager::undoAdapter()
{
if (!document()) return 0;
KisImageWSP image = document()->image();
Q_ASSERT(image);
return image->undoAdapter();
}
void KisViewManager::createActions()
{
KisConfig cfg;
d->saveIncremental = actionManager()->createAction("save_incremental_version");
connect(d->saveIncremental, SIGNAL(triggered()), this, SLOT(slotSaveIncremental()));
d->saveIncrementalBackup = actionManager()->createAction("save_incremental_backup");
connect(d->saveIncrementalBackup, SIGNAL(triggered()), this, SLOT(slotSaveIncrementalBackup()));
connect(mainWindow(), SIGNAL(documentSaved()), this, SLOT(slotDocumentSaved()));
d->saveIncremental->setEnabled(false);
d->saveIncrementalBackup->setEnabled(false);
KisAction *tabletDebugger = actionManager()->createAction("tablet_debugger");
connect(tabletDebugger, SIGNAL(triggered()), this, SLOT(toggleTabletLogger()));
d->createTemplate = actionManager()->createAction("create_template");
connect(d->createTemplate, SIGNAL(triggered()), this, SLOT(slotCreateTemplate()));
d->createCopy = actionManager()->createAction("create_copy");
connect(d->createCopy, SIGNAL(triggered()), this, SLOT(slotCreateCopy()));
d->openResourcesDirectory = actionManager()->createAction("open_resources_directory");
connect(d->openResourcesDirectory, SIGNAL(triggered()), SLOT(openResourcesDirectory()));
d->rotateCanvasRight = actionManager()->createAction("rotate_canvas_right");
d->rotateCanvasLeft = actionManager()->createAction("rotate_canvas_left");
d->resetCanvasRotation = actionManager()->createAction("reset_canvas_rotation");
d->wrapAroundAction = actionManager()->createAction("wrap_around_mode");
d->levelOfDetailAction = actionManager()->createAction("level_of_detail_mode");
d->softProof = actionManager()->createAction("softProof");
d->gamutCheck = actionManager()->createAction("gamutCheck");
KisAction *tAction = actionManager()->createAction("showStatusBar");
tAction->setChecked(cfg.showStatusBar());
connect(tAction, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool)));
tAction = actionManager()->createAction("view_show_canvas_only");
tAction->setChecked(false);
connect(tAction, SIGNAL(toggled(bool)), this, SLOT(switchCanvasOnly(bool)));
//Workaround, by default has the same shortcut as mirrorCanvas
KisAction *a = dynamic_cast<KisAction*>(actionCollection()->action("format_italic"));
if (a) {
a->setDefaultShortcut(QKeySequence());
}
a = actionManager()->createAction("edit_blacklist_cleanup");
connect(a, SIGNAL(triggered()), this, SLOT(slotBlacklistCleanup()));
d->showRulersAction = actionManager()->createAction("view_ruler");
d->showRulersAction->setChecked(cfg.showRulers());
connect(d->showRulersAction, SIGNAL(toggled(bool)), SLOT(slotSaveShowRulersState(bool)));
d->rulersTrackMouseAction = actionManager()->createAction("rulers_track_mouse");
d->rulersTrackMouseAction->setChecked(cfg.rulersTrackMouse());
connect(d->rulersTrackMouseAction, SIGNAL(toggled(bool)), SLOT(slotSaveRulersTrackMouseState(bool)));
d->zoomTo100pct = actionManager()->createAction("zoom_to_100pct");
d->zoomIn = actionManager()->createStandardAction(KStandardAction::ZoomIn, 0, "");
d->zoomOut = actionManager()->createStandardAction(KStandardAction::ZoomOut, 0, "");
d->actionAuthor = new KSelectAction(KisIconUtils::loadIcon("im-user"), i18n("Active Author Profile"), this);
connect(d->actionAuthor, SIGNAL(triggered(const QString &)), this, SLOT(changeAuthorProfile(const QString &)));
actionCollection()->addAction("settings_active_author", d->actionAuthor);
slotUpdateAuthorProfileActions();
}
void KisViewManager::setupManagers()
{
// Create the managers for filters, selections, layers etc.
// XXX: When the currentlayer changes, call updateGUI on all
// managers
d->filterManager.setup(actionCollection(), actionManager());
d->selectionManager.setup(actionManager());
d->guidesManager.setup(actionManager());
d->nodeManager.setup(actionCollection(), actionManager());
d->imageManager.setup(actionManager());
d->gridManager.setup(actionManager());
d->paintingAssistantsManager.setup(actionManager());
d->canvasControlsManager.setup(actionManager());
d->mirrorManager.setup(actionCollection());
d->scriptManager.setup(actionCollection(), actionManager());
}
void KisViewManager::updateGUI()
{
d->guiUpdateCompressor.start();
}
void KisViewManager::slotBlacklistCleanup()
{
KisDlgBlacklistCleanup dialog;
dialog.exec();
}
KisNodeManager * KisViewManager::nodeManager() const
{
return &d->nodeManager;
}
KisActionManager* KisViewManager::actionManager() const
{
return &d->actionManager;
}
KisGridManager * KisViewManager::gridManager() const
{
return &d->gridManager;
}
KisGuidesManager * KisViewManager::guidesManager() const
{
return &d->guidesManager;
}
-KisPaintingAssistantsManager* KisViewManager::paintingAssistantsManager() const
-{
- return &d->paintingAssistantsManager;
-}
-
KisDocument *KisViewManager::document() const
{
if (d->currentImageView && d->currentImageView->document()) {
return d->currentImageView->document();
}
return 0;
}
KisScriptManager *KisViewManager::scriptManager() const
{
return &d->scriptManager;
}
int KisViewManager::viewCount() const
{
KisMainWindow *mw = qobject_cast<KisMainWindow*>(d->mainWindow);
if (mw) {
return mw->viewCount();
}
return 0;
}
bool KisViewManager::KisViewManagerPrivate::blockUntilOperationsFinishedImpl(KisImageSP image, bool force)
{
const int busyWaitDelay = 1000;
KisDelayedSaveDialog dialog(image, !force ? KisDelayedSaveDialog::GeneralDialog : KisDelayedSaveDialog::ForcedDialog, busyWaitDelay, mainWindow);
dialog.blockIfImageIsBusy();
return dialog.result() == QDialog::Accepted;
}
bool KisViewManager::blockUntilOperationsFinished(KisImageSP image)
{
return d->blockUntilOperationsFinishedImpl(image, false);
}
void KisViewManager::blockUntilOperationsFinishedForced(KisImageSP image)
{
d->blockUntilOperationsFinishedImpl(image, true);
}
void KisViewManager::slotCreateTemplate()
{
if (!document()) return;
KisTemplateCreateDia::createTemplate( QStringLiteral("templates/"), ".kra", document(), mainWindow());
}
void KisViewManager::slotCreateCopy()
{
if (!document()) return;
KisDocument *doc = KisPart::instance()->createDocument();
QString name = document()->documentInfo()->aboutInfo("name");
if (name.isEmpty()) {
name = document()->url().toLocalFile();
}
name = i18n("%1 (Copy)", name);
doc->documentInfo()->setAboutInfo("title", name);
KisImageWSP image = document()->image();
KisImageSP newImage = new KisImage(doc->createUndoStore(), image->width(), image->height(), image->colorSpace(), name);
newImage->setRootLayer(dynamic_cast<KisGroupLayer*>(image->rootLayer()->clone().data()));
doc->setCurrentImage(newImage);
KisPart::instance()->addDocument(doc);
KisMainWindow *mw = qobject_cast<KisMainWindow*>(d->mainWindow);
mw->addViewAndNotifyLoadingCompleted(doc);
}
QMainWindow* KisViewManager::qtMainWindow() const
{
if (d->mainWindow)
return d->mainWindow;
//Fallback for when we have not yet set the main window.
QMainWindow* w = qobject_cast<QMainWindow*>(qApp->activeWindow());
if(w)
return w;
return mainWindow();
}
void KisViewManager::setQtMainWindow(QMainWindow* newMainWindow)
{
d->mainWindow = newMainWindow;
}
void KisViewManager::slotDocumentSaved()
{
d->saveIncremental->setEnabled(true);
d->saveIncrementalBackup->setEnabled(true);
}
void KisViewManager::slotSaveIncremental()
{
if (!document()) return;
bool foundVersion;
bool fileAlreadyExists;
bool isBackup;
QString version = "000";
QString newVersion;
QString letter;
QString fileName = document()->localFilePath();
// Find current version filenames
// v v Regexp to find incremental versions in the filename, taking our backup scheme into account as well
// Considering our incremental version and backup scheme, format is filename_001~001.ext
QRegExp regex("_\\d{1,4}[.]|_\\d{1,4}[a-z][.]|_\\d{1,4}[~]|_\\d{1,4}[a-z][~]");
regex.indexIn(fileName); // Perform the search
QStringList matches = regex.capturedTexts();
foundVersion = matches.at(0).isEmpty() ? false : true;
// Ensure compatibility with Save Incremental Backup
// If this regex is not kept separate, the entire algorithm needs modification;
// It's simpler to just add this.
QRegExp regexAux("_\\d{1,4}[~]|_\\d{1,4}[a-z][~]");
regexAux.indexIn(fileName); // Perform the search
QStringList matchesAux = regexAux.capturedTexts();
isBackup = matchesAux.at(0).isEmpty() ? false : true;
// If the filename has a version, prepare it for incrementation
if (foundVersion) {
version = matches.at(matches.count() - 1); // Look at the last index, we don't care about other matches
if (version.contains(QRegExp("[a-z]"))) {
version.chop(1); // Trim "."
letter = version.right(1); // Save letter
version.chop(1); // Trim letter
} else {
version.chop(1); // Trim "."
}
version.remove(0, 1); // Trim "_"
} else {
// ...else, simply add a version to it so the next loop works
QRegExp regex2("[.][a-z]{2,4}$"); // Heuristic to find file extension
regex2.indexIn(fileName);
QStringList matches2 = regex2.capturedTexts();
QString extensionPlusVersion = matches2.at(0);
extensionPlusVersion.prepend(version);
extensionPlusVersion.prepend("_");
fileName.replace(regex2, extensionPlusVersion);
}
// Prepare the base for new version filename
int intVersion = version.toInt(0);
++intVersion;
QString baseNewVersion = QString::number(intVersion);
while (baseNewVersion.length() < version.length()) {
baseNewVersion.prepend("0");
}
// Check if the file exists under the new name and search until options are exhausted (test appending a to z)
do {
newVersion = baseNewVersion;
newVersion.prepend("_");
if (!letter.isNull()) newVersion.append(letter);
if (isBackup) {
newVersion.append("~");
} else {
newVersion.append(".");
}
fileName.replace(regex, newVersion);
fileAlreadyExists = QFile(fileName).exists();
if (fileAlreadyExists) {
if (!letter.isNull()) {
char letterCh = letter.at(0).toLatin1();
++letterCh;
letter = QString(QChar(letterCh));
} else {
letter = 'a';
}
}
} while (fileAlreadyExists && letter != "{"); // x, y, z, {...
if (letter == "{") {
QMessageBox::critical(mainWindow(), i18nc("@title:window", "Couldn't save incremental version"), i18n("Alternative names exhausted, try manually saving with a higher number"));
return;
}
document()->setFileBatchMode(true);
document()->saveAs(QUrl::fromUserInput(fileName));
document()->setFileBatchMode(false);
if (mainWindow()) {
mainWindow()->updateCaption();
}
}
void KisViewManager::slotSaveIncrementalBackup()
{
if (!document()) return;
bool workingOnBackup;
bool fileAlreadyExists;
QString version = "000";
QString newVersion;
QString letter;
QString fileName = document()->localFilePath();
// First, discover if working on a backup file, or a normal file
QRegExp regex("~\\d{1,4}[.]|~\\d{1,4}[a-z][.]");
regex.indexIn(fileName); // Perform the search
QStringList matches = regex.capturedTexts();
workingOnBackup = matches.at(0).isEmpty() ? false : true;
if (workingOnBackup) {
// Try to save incremental version (of backup), use letter for alt versions
version = matches.at(matches.count() - 1); // Look at the last index, we don't care about other matches
if (version.contains(QRegExp("[a-z]"))) {
version.chop(1); // Trim "."
letter = version.right(1); // Save letter
version.chop(1); // Trim letter
} else {
version.chop(1); // Trim "."
}
version.remove(0, 1); // Trim "~"
// Prepare the base for new version filename
int intVersion = version.toInt(0);
++intVersion;
QString baseNewVersion = QString::number(intVersion);
QString backupFileName = document()->localFilePath();
while (baseNewVersion.length() < version.length()) {
baseNewVersion.prepend("0");
}
// Check if the file exists under the new name and search until options are exhausted (test appending a to z)
do {
newVersion = baseNewVersion;
newVersion.prepend("~");
if (!letter.isNull()) newVersion.append(letter);
newVersion.append(".");
backupFileName.replace(regex, newVersion);
fileAlreadyExists = QFile(backupFileName).exists();
if (fileAlreadyExists) {
if (!letter.isNull()) {
char letterCh = letter.at(0).toLatin1();
++letterCh;
letter = QString(QChar(letterCh));
} else {
letter = 'a';
}
}
} while (fileAlreadyExists && letter != "{"); // x, y, z, {...
if (letter == "{") {
QMessageBox::critical(mainWindow(), i18nc("@title:window", "Couldn't save incremental backup"), i18n("Alternative names exhausted, try manually saving with a higher number"));
return;
}
QFile::copy(fileName, backupFileName);
document()->saveAs(QUrl::fromUserInput(fileName));
if (mainWindow()) mainWindow()->updateCaption();
}
else { // if NOT working on a backup...
// Navigate directory searching for latest backup version, ignore letters
const quint8 HARDCODED_DIGIT_COUNT = 3;
QString baseNewVersion = "000";
QString backupFileName = document()->localFilePath();
QRegExp regex2("[.][a-z]{2,4}$"); // Heuristic to find file extension
regex2.indexIn(backupFileName);
QStringList matches2 = regex2.capturedTexts();
QString extensionPlusVersion = matches2.at(0);
extensionPlusVersion.prepend(baseNewVersion);
extensionPlusVersion.prepend("~");
backupFileName.replace(regex2, extensionPlusVersion);
// Save version with 1 number higher than the highest version found ignoring letters
do {
newVersion = baseNewVersion;
newVersion.prepend("~");
newVersion.append(".");
backupFileName.replace(regex, newVersion);
fileAlreadyExists = QFile(backupFileName).exists();
if (fileAlreadyExists) {
// Prepare the base for new version filename, increment by 1
int intVersion = baseNewVersion.toInt(0);
++intVersion;
baseNewVersion = QString::number(intVersion);
while (baseNewVersion.length() < HARDCODED_DIGIT_COUNT) {
baseNewVersion.prepend("0");
}
}
} while (fileAlreadyExists);
// Save both as backup and on current file for interapplication workflow
document()->setFileBatchMode(true);
QFile::copy(fileName, backupFileName);
document()->saveAs(QUrl::fromUserInput(fileName));
document()->setFileBatchMode(false);
if (mainWindow()) mainWindow()->updateCaption();
}
}
void KisViewManager::disableControls()
{
// prevents possible crashes, if somebody changes the paintop during dragging by using the mousewheel
// this is for Bug 250944
// the solution blocks all wheel, mouse and key event, while dragging with the freehand tool
// see KisToolFreehand::initPaint() and endPaint()
d->controlFrame.paintopBox()->installEventFilter(&d->blockingEventFilter);
Q_FOREACH (QObject* child, d->controlFrame.paintopBox()->children()) {
child->installEventFilter(&d->blockingEventFilter);
}
}
void KisViewManager::enableControls()
{
d->controlFrame.paintopBox()->removeEventFilter(&d->blockingEventFilter);
Q_FOREACH (QObject* child, d->controlFrame.paintopBox()->children()) {
child->removeEventFilter(&d->blockingEventFilter);
}
}
void KisViewManager::showStatusBar(bool toggled)
{
KisMainWindow *mw = mainWindow();
if(mw && mw->statusBar()) {
mw->statusBar()->setVisible(toggled);
KisConfig cfg;
cfg.setShowStatusBar(toggled);
}
}
void KisViewManager::switchCanvasOnly(bool toggled)
{
KisConfig cfg;
KisMainWindow* main = mainWindow();
if(!main) {
dbgUI << "Unable to switch to canvas-only mode, main window not found";
return;
}
if (toggled) {
d->canvasState = qtMainWindow()->saveState();
}
if (cfg.hideStatusbarFullscreen()) {
if (main->statusBar()) {
if (!toggled) {
if (main->statusBar()->dynamicPropertyNames().contains("wasvisible")) {
if (main->statusBar()->property("wasvisible").toBool()) {
main->statusBar()->setVisible(true);
}
}
}
else {
main->statusBar()->setProperty("wasvisible", main->statusBar()->isVisible());
main->statusBar()->setVisible(false);
}
}
}
if (cfg.hideDockersFullscreen()) {
KisAction* action = qobject_cast<KisAction*>(main->actionCollection()->action("view_toggledockers"));
if (action) {
action->setCheckable(true);
if (toggled) {
if (action->isChecked()) {
cfg.setShowDockers(action->isChecked());
action->setChecked(false);
} else {
cfg.setShowDockers(false);
}
} else {
action->setChecked(cfg.showDockers());
}
}
}
if (cfg.hideTitlebarFullscreen() && !cfg.fullscreenMode()) {
if(toggled) {
main->setWindowState( main->windowState() | Qt::WindowFullScreen);
} else {
main->setWindowState( main->windowState() & ~Qt::WindowFullScreen);
}
}
if (cfg.hideMenuFullscreen()) {
if (!toggled) {
if (main->menuBar()->dynamicPropertyNames().contains("wasvisible")) {
if (main->menuBar()->property("wasvisible").toBool()) {
main->menuBar()->setVisible(true);
}
}
}
else {
main->menuBar()->setProperty("wasvisible", main->menuBar()->isVisible());
main->menuBar()->setVisible(false);
}
}
if (cfg.hideToolbarFullscreen()) {
QList<QToolBar*> toolBars = main->findChildren<QToolBar*>();
Q_FOREACH (QToolBar* toolbar, toolBars) {
if (!toggled) {
if (toolbar->dynamicPropertyNames().contains("wasvisible")) {
if (toolbar->property("wasvisible").toBool()) {
toolbar->setVisible(true);
}
}
}
else {
toolbar->setProperty("wasvisible", toolbar->isVisible());
toolbar->setVisible(false);
}
}
}
showHideScrollbars();
if (toggled) {
// show a fading heads-up display about the shortcut to go back
showFloatingMessage(i18n("Going into Canvas-Only mode.\nPress %1 to go back.",
actionCollection()->action("view_show_canvas_only")->shortcut().toString()), QIcon());
}
else {
main->restoreState(d->canvasState);
}
}
void KisViewManager::toggleTabletLogger()
{
d->inputManager.toggleTabletLogger();
}
void KisViewManager::openResourcesDirectory()
{
QString dir = KoResourcePaths::locateLocal("data", "");
QDesktopServices::openUrl(QUrl::fromLocalFile(dir));
}
void KisViewManager::updateIcons()
{
if (mainWindow()) {
QList<QDockWidget*> dockers = mainWindow()->dockWidgets();
Q_FOREACH (QDockWidget* dock, dockers) {
dbgKrita << "name " << dock->objectName();
KoDockWidgetTitleBar* titlebar = dynamic_cast<KoDockWidgetTitleBar*>(dock->titleBarWidget());
if (titlebar) {
titlebar->updateIcons();
}
QObjectList objects;
objects.append(dock);
while (!objects.isEmpty()) {
QObject* object = objects.takeFirst();
objects.append(object->children());
KisIconUtils::updateIconCommon(object);
}
}
}
}
void KisViewManager::initializeStatusBarVisibility()
{
KisConfig cfg;
d->mainWindow->statusBar()->setVisible(cfg.showStatusBar());
}
void KisViewManager::guiUpdateTimeout()
{
d->nodeManager.updateGUI();
d->selectionManager.updateGUI();
d->filterManager.updateGUI();
if (zoomManager()) {
zoomManager()->updateGUI();
}
d->gridManager.updateGUI();
d->actionManager.updateGUI();
}
void KisViewManager::showFloatingMessage(const QString &message, const QIcon& icon, int timeout, KisFloatingMessage::Priority priority, int alignment)
{
if (!d->currentImageView) return;
d->currentImageView->showFloatingMessageImpl(message, icon, timeout, priority, alignment);
emit floatingMessageRequested(message, icon.name());
}
KisMainWindow *KisViewManager::mainWindow() const
{
return qobject_cast<KisMainWindow*>(d->mainWindow);
}
void KisViewManager::showHideScrollbars()
{
if (!d->currentImageView) return;
if (!d->currentImageView->canvasController()) return;
KisConfig cfg;
bool toggled = actionCollection()->action("view_show_canvas_only")->isChecked();
if ( (toggled && cfg.hideScrollbarsFullscreen()) || (!toggled && cfg.hideScrollbars()) ) {
d->currentImageView->canvasController()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
d->currentImageView->canvasController()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
} else {
d->currentImageView->canvasController()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
d->currentImageView->canvasController()->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
}
void KisViewManager::slotSaveShowRulersState(bool value)
{
KisConfig cfg;
cfg.setShowRulers(value);
}
void KisViewManager::slotSaveRulersTrackMouseState(bool value)
{
KisConfig cfg;
cfg.setRulersTrackMouse(value);
}
void KisViewManager::setShowFloatingMessage(bool show)
{
d->showFloatingMessage = show;
}
void KisViewManager::changeAuthorProfile(const QString &profileName)
{
KConfigGroup appAuthorGroup(KoGlobal::calligraConfig(), "Author");
if (profileName.isEmpty()) {
appAuthorGroup.writeEntry("active-profile", "");
} else if (profileName == i18nc("choice for author profile", "Anonymous")) {
appAuthorGroup.writeEntry("active-profile", "anonymous");
} else {
appAuthorGroup.writeEntry("active-profile", profileName);
}
appAuthorGroup.sync();
Q_FOREACH (KisDocument *doc, KisPart::instance()->documents()) {
doc->documentInfo()->updateParameters();
}
}
void KisViewManager::slotUpdateAuthorProfileActions()
{
Q_ASSERT(d->actionAuthor);
if (!d->actionAuthor) {
return;
}
d->actionAuthor->clear();
d->actionAuthor->addAction(i18n("Default Author Profile"));
d->actionAuthor->addAction(i18nc("choice for author profile", "Anonymous"));
KConfigGroup authorGroup(KoGlobal::calligraConfig(), "Author");
QStringList profiles = authorGroup.readEntry("profile-names", QStringList());
Q_FOREACH (const QString &profile , profiles) {
d->actionAuthor->addAction(profile);
}
KConfigGroup appAuthorGroup(KoGlobal::calligraConfig(), "Author");
QString profileName = appAuthorGroup.readEntry("active-profile", "");
if (profileName == "anonymous") {
d->actionAuthor->setCurrentItem(1);
} else if (profiles.contains(profileName)) {
d->actionAuthor->setCurrentAction(profileName);
} else {
d->actionAuthor->setCurrentItem(0);
}
}
diff --git a/libs/ui/KisViewManager.h b/libs/ui/KisViewManager.h
index 9441fff223..3ddc7a98c9 100644
--- a/libs/ui/KisViewManager.h
+++ b/libs/ui/KisViewManager.h
@@ -1,272 +1,271 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GUI_CLIENT_H
#define KIS_GUI_CLIENT_H
#include <QDockWidget>
#include <QQueue>
#include <QPointer>
#include <KisMainWindow.h>
#include <KoProgressUpdater.h>
#include <KoToolManager.h>
#include <kritaui_export.h>
#include <kis_types.h>
#include "kis_floating_message.h"
class QPoint;
class KisView;
class KisCanvas2;
class KisCanvasResourceProvider;
class KisDocument;
class KisFilterManager;
class KisGridManager;
class KisGuidesManager;
class KisImageManager;
class KisNodeManager;
class KisPaintingAssistantsManager;
class KisPaintopBox;
class KisSelectionManager;
class KisStatusBar;
class KisUndoAdapter;
class KisZoomManager;
class KisPaintopBox;
class KisActionManager;
class KisScriptManager;
class KisInputManager;
/**
* Krita view class
*
* Following the broad model-view-controller idea this class shows you one view on the document.
* There can be multiple views of the same document each in with independent settings for viewMode and zoom etc.
*/
class KRITAUI_EXPORT KisViewManager : public QObject
{
Q_OBJECT
public:
/**
* Construct a new view on the krita document.
* @param document the document we show.
* @param parent a parent widget we show ourselves in.
*/
KisViewManager(QWidget *parent, KActionCollection *actionCollection);
- virtual ~KisViewManager();
+ ~KisViewManager() override;
/**
* Retrieves the entire action collection.
*/
virtual KActionCollection* actionCollection() const;
public: // Krita specific interfaces
void setCurrentView(KisView *view);
/// Return the image this view is displaying
KisImageWSP image() const;
KoZoomController *zoomController() const;
/// The resource provider contains all per-view settings, such as
/// current color, current paint op etc.
KisCanvasResourceProvider * resourceProvider();
/// Return the canvasbase class
KisCanvas2 * canvasBase() const;
/// Return the actual widget that is displaying the current image
QWidget* canvas() const;
/// Return the wrapper class around the statusbar
KisStatusBar * statusBar() const;
/**
* This adds a widget to the statusbar for this view.
* If you use this method instead of using statusBar() directly,
* KisView will take care of removing the items when the view GUI is deactivated
* and readding them when it is reactivated.
* The parameters are the same as QStatusBar::addWidget().
*/
void addStatusBarItem(QWidget * widget, int stretch = 0, bool permanent = false);
/**
* Remove a widget from the statusbar for this view.
*/
void removeStatusBarItem(QWidget * widget);
KisPaintopBox* paintOpBox() const;
/// create a new progress updater
KoProgressUpdater *createProgressUpdater(KoProgressUpdater::Mode mode = KoProgressUpdater::Threaded);
/// The selection manager handles everything action related to
/// selections.
KisSelectionManager *selectionManager();
/// The node manager handles everything about nodes
KisNodeManager *nodeManager() const;
KisActionManager *actionManager() const;
/**
* Convenience method to get at the active node, which may be
* a layer or a mask or a selection
*/
KisNodeSP activeNode();
/// Convenience method to get at the active layer
KisLayerSP activeLayer();
/// Convenience method to get at the active paint device
KisPaintDeviceSP activeDevice();
/// The filtermanager handles everything action-related to filters
KisFilterManager *filterManager();
/// The image manager handles everything action-related to the
/// current image
KisImageManager *imageManager();
/// Filters events and sends them to canvas actions
KisInputManager *inputManager() const;
/// Convenience method to get at the active selection (the
/// selection of the current layer, or, if that does not exist,
/// the global selection.
KisSelectionSP selection();
/// Checks if the current global or local selection is editable
bool selectionEditable();
/// The undo adapter is used to add commands to the undo stack
KisUndoAdapter *undoAdapter();
KisDocument *document() const;
-
+
KisScriptManager *scriptManager() const;
int viewCount() const;
/**
* @brief blockUntilOperationsFinished blocks the GUI of the application until execution
* of actions on \p image is finished
* @param image the image which we should wait for
* @return true if the image has finished execution of the actions, false if
* the user cancelled operation
*/
bool blockUntilOperationsFinished(KisImageSP image);
/**
* @brief blockUntilOperationsFinished blocks the GUI of the application until execution
* of actions on \p image is finished. Does *not* provide a "Cancel" button. So the
* user is forced to wait.
* @param image the image which we should wait for
*/
void blockUntilOperationsFinishedForced(KisImageSP image);
public:
KisGridManager * gridManager() const;
KisGuidesManager * guidesManager() const;
- KisPaintingAssistantsManager* paintingAssistantsManager() const;
/// disable and enable toolbar controls. used for disabling them during painting.
void enableControls();
void disableControls();
/// shows a floating message in the top right corner of the canvas
void showFloatingMessage(const QString &message, const QIcon& icon, int timeout = 4500,
KisFloatingMessage::Priority priority = KisFloatingMessage::Medium,
int alignment = Qt::AlignCenter | Qt::TextWordWrap);
/// @return the KoMaindow this view is in, or 0
KisMainWindow *mainWindow() const;
/// The QMainWindow associated with this view. This is most likely going to be shell(), but
/// when running as Gemini or Sketch, this will be set to the applications' own QMainWindow.
/// This can be checked by qobject_casting to KisMainWindow to check the difference.
QMainWindow* qtMainWindow() const;
/// The mainWindow function will return the shell() value, unless this function is called
/// with a non-null value. To make it return shell() again, simply pass null to this function.
void setQtMainWindow(QMainWindow* newMainWindow);
public Q_SLOTS:
void switchCanvasOnly(bool toggled);
void setShowFloatingMessage(bool show);
void showHideScrollbars();
/// Visit all managers to update gui elements, e.g. enable / disable actions.
/// This is heavy-duty call, so it uses a compressor.
void updateGUI();
/// Update the style of all the icons
void updateIcons();
void slotViewAdded(KisView *view);
void slotViewRemoved(KisView *view);
Q_SIGNALS:
void floatingMessageRequested(const QString &message, const QString &iconName);
/**
* @brief viewChanged
* sent out when the view has changed.
*/
void viewChanged();
private Q_SLOTS:
void slotBlacklistCleanup();
void slotCreateTemplate();
void slotCreateCopy();
void slotDocumentSaved();
void slotSaveIncremental();
void slotSaveIncrementalBackup();
void showStatusBar(bool toggled);
void toggleTabletLogger();
void openResourcesDirectory();
void initializeStatusBarVisibility();
void guiUpdateTimeout();
void changeAuthorProfile(const QString &profileName);
void slotUpdateAuthorProfileActions();
void slotSaveShowRulersState(bool value);
void slotSaveRulersTrackMouseState(bool value);
private:
void createActions();
void setupManagers();
/// The zoommanager handles everything action-related to zooming
KisZoomManager * zoomManager();
private:
class KisViewManagerPrivate;
KisViewManagerPrivate * const d;
};
#endif
diff --git a/libs/ui/actions/KisPasteActionFactory.h b/libs/ui/actions/KisPasteActionFactory.h
index 3b158ff510..bb58608071 100644
--- a/libs/ui/actions/KisPasteActionFactory.h
+++ b/libs/ui/actions/KisPasteActionFactory.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISPASTEACTIONFACTORY_H
#define KISPASTEACTIONFACTORY_H
#include "operations/kis_operation.h"
#include "operations/kis_operation_configuration.h"
struct KRITAUI_EXPORT KisPasteActionFactory : public KisOperation {
KisPasteActionFactory() : KisOperation("paste-ui-action") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) {
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override {
run(config.getBool("paste-at-cursor-position", false), view);
}
void run(bool pasteAtCursorPosition, KisViewManager *view);
};
#endif // KISPASTEACTIONFACTORY_H
diff --git a/libs/ui/actions/kis_selection_action_factories.h b/libs/ui/actions/kis_selection_action_factories.h
index 8f2c830054..adfe7dcbac 100644
--- a/libs/ui/actions/kis_selection_action_factories.h
+++ b/libs/ui/actions/kis_selection_action_factories.h
@@ -1,129 +1,129 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SELECTION_ACTION_FACTORIES_H
#define __KIS_SELECTION_ACTION_FACTORIES_H
#include "operations/kis_operation.h"
#include "operations/kis_operation_configuration.h"
#include "operations/kis_filter_selection_operation.h"
#include "dialogs/kis_dlg_stroke_selection_properties.h"
class KRITAUI_EXPORT KisNoParameterActionFactory : public KisOperation
{
public:
KisNoParameterActionFactory(const QString &id) : KisOperation(id) {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) {
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override {
Q_UNUSED(config);
run(view);
}
virtual void run(KisViewManager *view) = 0;
};
struct KRITAUI_EXPORT KisSelectAllActionFactory : public KisNoParameterActionFactory {
KisSelectAllActionFactory() : KisNoParameterActionFactory("select-all-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisDeselectActionFactory : public KisNoParameterActionFactory {
KisDeselectActionFactory() : KisNoParameterActionFactory("deselect-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisReselectActionFactory : public KisNoParameterActionFactory {
KisReselectActionFactory() : KisNoParameterActionFactory("reselect-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisFillActionFactory : public KisOperation
{
KisFillActionFactory() : KisOperation("fill-ui-action") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) {
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override {
run(config.getString("fill-source", "fg"), view);
}
/**
* \p fillColor may be one of three variants:
* - "fg" --- foreground color
* - "bg" --- background color
* - "pattern" --- current pattern
*/
void run(const QString &fillSource, KisViewManager *view);
};
struct KRITAUI_EXPORT KisClearActionFactory : public KisNoParameterActionFactory {
KisClearActionFactory() : KisNoParameterActionFactory("clear-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisImageResizeToSelectionActionFactory : public KisNoParameterActionFactory {
KisImageResizeToSelectionActionFactory() : KisNoParameterActionFactory("resize-to-selection-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisCutCopyActionFactory : public KisOperation {
KisCutCopyActionFactory() : KisOperation("cut-copy-ui-action") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) {
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override {
run(config.getBool("will-cut", false), config.getBool("use-sharp-clip", false), view);
}
void run(bool willCut, bool makeSharpClip, KisViewManager *view);
};
struct KRITAUI_EXPORT KisCopyMergedActionFactory : public KisNoParameterActionFactory {
KisCopyMergedActionFactory() : KisNoParameterActionFactory("copy-merged-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisPasteNewActionFactory : public KisNoParameterActionFactory {
KisPasteNewActionFactory() : KisNoParameterActionFactory("paste-new-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KisInvertSelectionOperation : public KisFilterSelectionOperation {
KisInvertSelectionOperation() : KisFilterSelectionOperation("invertselection") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config);
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override;
};
struct KRITAUI_EXPORT KisSelectionToVectorActionFactory : public KisNoParameterActionFactory {
KisSelectionToVectorActionFactory() : KisNoParameterActionFactory("paste-new-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisShapesToVectorSelectionActionFactory : public KisNoParameterActionFactory {
KisShapesToVectorSelectionActionFactory() : KisNoParameterActionFactory("paste-new-ui-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisSelectionToShapeActionFactory : public KisNoParameterActionFactory {
KisSelectionToShapeActionFactory() : KisNoParameterActionFactory("selection-to-shape-action") {}
- void run(KisViewManager *view);
+ void run(KisViewManager *view) override;
};
struct KRITAUI_EXPORT KisStrokeSelectionActionFactory : public KisOperation {
KisStrokeSelectionActionFactory() : KisOperation("selection-to-shape-action") {}
void run(KisViewManager *view, StrokeSelectionOptions params);
};
struct KRITAUI_EXPORT KisStrokeBrushSelectionActionFactory : public KisOperation {
KisStrokeBrushSelectionActionFactory() : KisOperation("selection-to-shape-action") {}
void run(KisViewManager *view, StrokeSelectionOptions params);
};
#endif /* __KIS_SELECTION_ACTION_FACTORIES_H */
diff --git a/libs/ui/brushhud/kis_brush_hud.h b/libs/ui/brushhud/kis_brush_hud.h
index 6ed7c6aea0..091f1dcb3a 100644
--- a/libs/ui/brushhud/kis_brush_hud.h
+++ b/libs/ui/brushhud/kis_brush_hud.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_BRUSH_HUD_H
#define __KIS_BRUSH_HUD_H
#include <QScopedPointer>
#include <QWidget>
class KisCanvasResourceProvider;
class KisBrushHud : public QWidget
{
Q_OBJECT
public:
KisBrushHud(KisCanvasResourceProvider *provider, QWidget *parent);
- ~KisBrushHud();
+ ~KisBrushHud() override;
void updateProperties();
- QSize sizeHint() const;
+ QSize sizeHint() const override;
protected:
- void paintEvent(QPaintEvent *event);
- bool event(QEvent *event);
- void showEvent(QShowEvent *event);
- void hideEvent(QHideEvent *event);
+ void paintEvent(QPaintEvent *event) override;
+ bool event(QEvent *event) override;
+ void showEvent(QShowEvent *event) override;
+ void hideEvent(QHideEvent *event) override;
private Q_SLOTS:
void slotCanvasResourceChanged(int key, const QVariant &resource);
void slotReloadProperties();
void slotConfigBrushHud();
private:
void clearProperties() const;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_BRUSH_HUD_H */
diff --git a/libs/ui/brushhud/kis_brush_hud_properties_list.h b/libs/ui/brushhud/kis_brush_hud_properties_list.h
index 56bf82714f..c5d789e5e2 100644
--- a/libs/ui/brushhud/kis_brush_hud_properties_list.h
+++ b/libs/ui/brushhud/kis_brush_hud_properties_list.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_BRUSH_HUD_PROPERTIES_LIST_H
#define __KIS_BRUSH_HUD_PROPERTIES_LIST_H
#include <QScopedPointer>
#include <QListWidget>
#include "kis_uniform_paintop_property.h"
class KisBrushHudPropertiesList : public QListWidget
{
public:
KisBrushHudPropertiesList(QWidget *parent);
- ~KisBrushHudPropertiesList();
+ ~KisBrushHudPropertiesList() override;
void addProperties(const QList<KisUniformPaintOpPropertySP> &properties);
QList<QString> selectedPropertiesIds() const;
- Qt::DropActions supportedDropActions() const;
+ Qt::DropActions supportedDropActions() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_BRUSH_HUD_PROPERTIES_LIST_H */
diff --git a/libs/ui/brushhud/kis_dlg_brush_hud_config.h b/libs/ui/brushhud/kis_dlg_brush_hud_config.h
index 717c176810..f7ba672933 100644
--- a/libs/ui/brushhud/kis_dlg_brush_hud_config.h
+++ b/libs/ui/brushhud/kis_dlg_brush_hud_config.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DLG_BRUSH_HUD_CONFIG_H
#define KIS_DLG_BRUSH_HUD_CONFIG_H
#include <QScopedPointer>
#include <QDialog>
#include "kis_types.h"
namespace Ui {
class KisDlgConfigureBrushHud;
}
class KisDlgConfigureBrushHud : public QDialog
{
Q_OBJECT
public:
explicit KisDlgConfigureBrushHud(KisPaintOpPresetSP preset, QWidget *parent = 0);
- ~KisDlgConfigureBrushHud();
+ ~KisDlgConfigureBrushHud() override;
private Q_SLOTS:
void slotConfigAccepted();
void slotMoveRight();
void slotMoveLeft();
void slotMoveUp();
void slotMoveDown();
private:
Ui::KisDlgConfigureBrushHud *ui;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KIS_DLG_BRUSH_HUD_CONFIG_H
diff --git a/libs/ui/brushhud/kis_round_hud_button.h b/libs/ui/brushhud/kis_round_hud_button.h
index 4ebee9f4b7..7ff9b869d1 100644
--- a/libs/ui/brushhud/kis_round_hud_button.h
+++ b/libs/ui/brushhud/kis_round_hud_button.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ROUND_HUD_BUTTON_H
#define __KIS_ROUND_HUD_BUTTON_H
#include <QScopedPointer>
#include <QAbstractButton>
class KisRoundHudButton : public QAbstractButton
{
public:
KisRoundHudButton(QWidget *parent);
- ~KisRoundHudButton();
+ ~KisRoundHudButton() override;
void setOnOffIcons(const QIcon &on, const QIcon &off);
protected:
- void paintEvent(QPaintEvent *event);
- bool hitButton(const QPoint &pos) const;
+ void paintEvent(QPaintEvent *event) override;
+ bool hitButton(const QPoint &pos) const override;
- void mouseMoveEvent(QMouseEvent *event);
- void leaveEvent(QEvent *event);
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void leaveEvent(QEvent *event) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_ROUND_HUD_BUTTON_H */
diff --git a/libs/ui/brushhud/kis_uniform_paintop_property_widget.h b/libs/ui/brushhud/kis_uniform_paintop_property_widget.h
index 8bb42bed41..bacbaa04e3 100644
--- a/libs/ui/brushhud/kis_uniform_paintop_property_widget.h
+++ b/libs/ui/brushhud/kis_uniform_paintop_property_widget.h
@@ -1,119 +1,119 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_UNIFORM_PAINTOP_PROPERTY_WIDGET_H
#define __KIS_UNIFORM_PAINTOP_PROPERTY_WIDGET_H
#include <QScopedPointer>
#include <QWidget>
#include "kis_uniform_paintop_property.h"
class KisUniformPaintOpPropertyWidget : public QWidget
{
Q_OBJECT
public:
KisUniformPaintOpPropertyWidget(KisUniformPaintOpPropertySP property, QWidget *parent);
- ~KisUniformPaintOpPropertyWidget();
+ ~KisUniformPaintOpPropertyWidget() override;
protected:
KisUniformPaintOpPropertySP property() const;
protected Q_SLOTS:
virtual void setValue(const QVariant &value) = 0;
Q_SIGNALS:
void valueChanged(const QVariant &value);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
class KisSliderSpinBox;
class KisDoubleSliderSpinBox;
class QCheckBox;
template <typename T> class KisSliderBasedPaintOpProperty;
typedef KisSliderBasedPaintOpProperty<int> KisIntSliderBasedPaintOpProperty;
typedef KisSliderBasedPaintOpProperty<qreal> KisDoubleSliderBasedPaintOpProperty;
class KisUniformPaintOpPropertyIntSlider : public KisUniformPaintOpPropertyWidget
{
Q_OBJECT
public:
KisUniformPaintOpPropertyIntSlider(KisUniformPaintOpPropertySP property, QWidget *parent);
- virtual void setValue(const QVariant &value);
+ void setValue(const QVariant &value) override;
private Q_SLOTS:
void slotSliderChanged(int value);
private:
KisSliderSpinBox *m_slider;
};
class KisUniformPaintOpPropertyDoubleSlider : public KisUniformPaintOpPropertyWidget
{
Q_OBJECT
public:
KisUniformPaintOpPropertyDoubleSlider(KisUniformPaintOpPropertySP property, QWidget *parent);
- virtual void setValue(const QVariant &value);
+ void setValue(const QVariant &value) override;
private Q_SLOTS:
void slotSliderChanged(qreal value);
private:
KisDoubleSliderSpinBox *m_slider;
};
class KisUniformPaintOpPropertyCheckBox : public KisUniformPaintOpPropertyWidget
{
Q_OBJECT
public:
KisUniformPaintOpPropertyCheckBox(KisUniformPaintOpPropertySP property, QWidget *parent);
- virtual void setValue(const QVariant &value);
+ void setValue(const QVariant &value) override;
private Q_SLOTS:
void slotCheckBoxChanged(bool value);
private:
QCheckBox *m_checkBox;
};
class QComboBox;
class KisUniformPaintOpPropertyComboBox : public KisUniformPaintOpPropertyWidget
{
Q_OBJECT
public:
KisUniformPaintOpPropertyComboBox(KisUniformPaintOpPropertySP property, QWidget *parent);
- virtual void setValue(const QVariant &value);
+ void setValue(const QVariant &value) override;
private Q_SLOTS:
void slotComboBoxChanged(int value);
private:
QComboBox *m_comboBox;
};
#endif /* __KIS_UNIFORM_PAINTOP_PROPERTY_WIDGET_H */
diff --git a/libs/ui/canvas/KisSnapPointStrategy.h b/libs/ui/canvas/KisSnapPointStrategy.h
index 506f1da047..5eb75cfbd7 100644
--- a/libs/ui/canvas/KisSnapPointStrategy.h
+++ b/libs/ui/canvas/KisSnapPointStrategy.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSNAPPOINTSTRATEGY_H
#define KISSNAPPOINTSTRATEGY_H
#include <QScopedPointer>
#include "KoSnapStrategy.h"
#include "kritaui_export.h"
/**
* The KisSnapPointStrategy class is a custom strategy that allows snapping to
* arbitrary points on canvas, not linked to any real objects. It can be used,
* for example, for snapping to the *previous position* of the handle, while it
* is dragging by the user.
*/
class KRITAUI_EXPORT KisSnapPointStrategy : public KoSnapStrategy
{
public:
KisSnapPointStrategy(KoSnapGuide::Strategy type = KoSnapGuide::CustomSnapping);
- ~KisSnapPointStrategy();
+ ~KisSnapPointStrategy() override;
bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
QPainterPath decoration(const KoViewConverter &converter) const override;
void addPoint(const QPointF &pt);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KISSNAPPOINTSTRATEGY_H
diff --git a/libs/ui/canvas/kis_animation_player.cpp b/libs/ui/canvas/kis_animation_player.cpp
index a944cf6347..425e38d6a4 100644
--- a/libs/ui/canvas/kis_animation_player.cpp
+++ b/libs/ui/canvas/kis_animation_player.cpp
@@ -1,541 +1,544 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_animation_player.h"
#include <QElapsedTimer>
#include <QTimer>
#include <QtMath>
//#define PLAYER_DEBUG_FRAMERATE
#include "kis_global.h"
#include "kis_config.h"
#include "kis_config_notifier.h"
#include "kis_image.h"
#include "kis_canvas2.h"
#include "kis_animation_frame_cache.h"
#include "kis_signal_auto_connection.h"
#include "kis_image_animation_interface.h"
#include "kis_time_range.h"
#include "kis_signal_compressor.h"
#include <KisDocument.h>
#include <QFileInfo>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/rolling_mean.hpp>
#include "KisSyncedAudioPlayback.h"
#include "kis_signal_compressor_with_param.h"
#include "KisViewManager.h"
#include "kis_icon_utils.h"
#include "KisPart.h"
#include "dialogs/KisAnimationCacheUpdateProgressDialog.h"
using namespace boost::accumulators;
typedef accumulator_set<qreal, stats<tag::rolling_mean> > FpsAccumulator;
struct KisAnimationPlayer::Private
{
public:
Private(KisAnimationPlayer *_q)
: q(_q),
realFpsAccumulator(tag::rolling_window::window_size = 24),
droppedFpsAccumulator(tag::rolling_window::window_size = 24),
droppedFramesPortion(tag::rolling_window::window_size = 24),
dropFramesMode(true),
nextFrameExpectedTime(0),
expectedInterval(0),
expectedFrame(0),
lastTimerInterval(0),
lastPaintedFrame(0),
playbackStatisticsCompressor(1000, KisSignalCompressor::FIRST_INACTIVE),
stopAudioOnScrubbingCompressor(100, KisSignalCompressor::POSTPONE),
audioOffsetTolerance(-1)
{}
KisAnimationPlayer *q;
bool useFastFrameUpload;
bool playing;
QTimer *timer;
int initialFrame;
int firstFrame;
int lastFrame;
qreal playbackSpeed;
KisCanvas2 *canvas;
KisSignalAutoConnectionsStore cancelStrokeConnections;
QElapsedTimer realFpsTimer;
FpsAccumulator realFpsAccumulator;
FpsAccumulator droppedFpsAccumulator;
FpsAccumulator droppedFramesPortion;
bool dropFramesMode;
QElapsedTimer playbackTime;
int nextFrameExpectedTime;
int expectedInterval;
int expectedFrame;
int lastTimerInterval;
int lastPaintedFrame;
KisSignalCompressor playbackStatisticsCompressor;
QScopedPointer<KisSyncedAudioPlayback> syncedAudio;
QScopedPointer<KisSignalCompressorWithParam<int> > audioSyncScrubbingCompressor;
KisSignalCompressor stopAudioOnScrubbingCompressor;
int audioOffsetTolerance;
void stopImpl(bool doUpdates);
int incFrame(int frame, int inc) {
frame += inc;
if (frame > lastFrame) {
frame = firstFrame + frame - lastFrame - 1;
}
return frame;
}
qint64 frameToMSec(int value, int fps) {
return qreal(value) / fps * 1000.0;
}
int msecToFrame(qint64 value, int fps) {
return qreal(value) * fps / 1000.0;
}
};
KisAnimationPlayer::KisAnimationPlayer(KisCanvas2 *canvas)
: QObject(canvas)
, m_d(new Private(this))
{
m_d->useFastFrameUpload = false;
m_d->playing = false;
m_d->canvas = canvas;
m_d->playbackSpeed = 1.0;
m_d->timer = new QTimer(this);
connect(m_d->timer, SIGNAL(timeout()), this, SLOT(slotUpdate()));
m_d->timer->setSingleShot(true);
connect(KisConfigNotifier::instance(),
SIGNAL(dropFramesModeChanged()),
SLOT(slotUpdateDropFramesMode()));
slotUpdateDropFramesMode();
connect(&m_d->playbackStatisticsCompressor, SIGNAL(timeout()),
this, SIGNAL(sigPlaybackStatisticsUpdated()));
using namespace std::placeholders;
std::function<void (int)> callback(
std::bind(&KisAnimationPlayer::slotSyncScrubbingAudio, this, _1));
const int defaultScrubbingUdpatesDelay = 40; /* 40 ms == 25 fps */
m_d->audioSyncScrubbingCompressor.reset(
new KisSignalCompressorWithParam<int>(defaultScrubbingUdpatesDelay, callback, KisSignalCompressor::FIRST_ACTIVE));
m_d->stopAudioOnScrubbingCompressor.setDelay(defaultScrubbingUdpatesDelay);
connect(&m_d->stopAudioOnScrubbingCompressor, SIGNAL(timeout()), SLOT(slotTryStopScrubbingAudio()));
connect(m_d->canvas->image()->animationInterface(), SIGNAL(sigFramerateChanged()), SLOT(slotUpdateAudioChunkLength()));
slotUpdateAudioChunkLength();
connect(m_d->canvas->image()->animationInterface(), SIGNAL(sigAudioChannelChanged()), SLOT(slotAudioChannelChanged()));
connect(m_d->canvas->image()->animationInterface(), SIGNAL(sigAudioVolumeChanged()), SLOT(slotAudioVolumeChanged()));
slotAudioChannelChanged();
}
KisAnimationPlayer::~KisAnimationPlayer()
{}
void KisAnimationPlayer::slotUpdateDropFramesMode()
{
KisConfig cfg;
m_d->dropFramesMode = cfg.animationDropFrames();
}
void KisAnimationPlayer::slotSyncScrubbingAudio(int msecTime)
{
KIS_SAFE_ASSERT_RECOVER_RETURN(m_d->syncedAudio);
if (!m_d->syncedAudio->isPlaying()) {
m_d->syncedAudio->play(msecTime);
} else {
m_d->syncedAudio->syncWithVideo(msecTime);
}
if (!isPlaying()) {
m_d->stopAudioOnScrubbingCompressor.start();
}
}
void KisAnimationPlayer::slotTryStopScrubbingAudio()
{
KIS_SAFE_ASSERT_RECOVER_RETURN(m_d->syncedAudio);
if (m_d->syncedAudio && !isPlaying()) {
m_d->syncedAudio->stop();
}
}
void KisAnimationPlayer::slotAudioChannelChanged()
{
KisImageAnimationInterface *interface = m_d->canvas->image()->animationInterface();
QString fileName = interface->audioChannelFileName();
QFileInfo info(fileName);
if (info.exists() && !interface->isAudioMuted()) {
m_d->syncedAudio.reset(new KisSyncedAudioPlayback(info.absoluteFilePath()));
m_d->syncedAudio->setVolume(interface->audioVolume());
m_d->syncedAudio->setSoundOffsetTolerance(m_d->audioOffsetTolerance);
connect(m_d->syncedAudio.data(), SIGNAL(error(const QString &, const QString &)), SLOT(slotOnAudioError(const QString &, const QString &)));
} else {
m_d->syncedAudio.reset();
}
}
void KisAnimationPlayer::slotAudioVolumeChanged()
{
KisImageAnimationInterface *interface = m_d->canvas->image()->animationInterface();
if (m_d->syncedAudio) {
m_d->syncedAudio->setVolume(interface->audioVolume());
}
}
void KisAnimationPlayer::slotOnAudioError(const QString &fileName, const QString &message)
{
QString errorMessage(i18nc("floating on-canvas message", "Cannot open audio: \"%1\"\nError: %2", fileName, message));
m_d->canvas->viewManager()->showFloatingMessage(errorMessage, KisIconUtils::loadIcon("dialog-warning"));
}
void KisAnimationPlayer::connectCancelSignals()
{
m_d->cancelStrokeConnections.addConnection(
m_d->canvas->image().data(), SIGNAL(sigUndoDuringStrokeRequested()),
this, SLOT(slotCancelPlayback()));
m_d->cancelStrokeConnections.addConnection(
m_d->canvas->image().data(), SIGNAL(sigStrokeCancellationRequested()),
this, SLOT(slotCancelPlayback()));
m_d->cancelStrokeConnections.addConnection(
m_d->canvas->image().data(), SIGNAL(sigStrokeEndRequested()),
this, SLOT(slotCancelPlaybackSafe()));
m_d->cancelStrokeConnections.addConnection(
m_d->canvas->image()->animationInterface(), SIGNAL(sigFramerateChanged()),
this, SLOT(slotUpdatePlaybackTimer()));
m_d->cancelStrokeConnections.addConnection(
m_d->canvas->image()->animationInterface(), SIGNAL(sigFullClipRangeChanged()),
this, SLOT(slotUpdatePlaybackTimer()));
m_d->cancelStrokeConnections.addConnection(
m_d->canvas->image()->animationInterface(), SIGNAL(sigPlaybackRangeChanged()),
this, SLOT(slotUpdatePlaybackTimer()));
}
void KisAnimationPlayer::disconnectCancelSignals()
{
m_d->cancelStrokeConnections.clear();
}
void KisAnimationPlayer::slotUpdateAudioChunkLength()
{
const KisImageAnimationInterface *animation = m_d->canvas->image()->animationInterface();
const int animationFramePeriod = qMax(1, 1000 / animation->framerate());
KisConfig cfg;
int scrubbingAudioUdpatesDelay = cfg.scrubbingAudioUpdatesDelay();
if (scrubbingAudioUdpatesDelay < 0) {
scrubbingAudioUdpatesDelay = qMax(1, animationFramePeriod);
}
m_d->audioSyncScrubbingCompressor->setDelay(scrubbingAudioUdpatesDelay);
m_d->stopAudioOnScrubbingCompressor.setDelay(scrubbingAudioUdpatesDelay);
m_d->audioOffsetTolerance = cfg.audioOffsetTolerance();
if (m_d->audioOffsetTolerance < 0) {
m_d->audioOffsetTolerance = animationFramePeriod;
}
if (m_d->syncedAudio) {
m_d->syncedAudio->setSoundOffsetTolerance(m_d->audioOffsetTolerance);
}
}
void KisAnimationPlayer::slotUpdatePlaybackTimer()
{
m_d->timer->stop();
const KisImageAnimationInterface *animation = m_d->canvas->image()->animationInterface();
const KisTimeRange &range = animation->playbackRange();
if (!range.isValid()) return;
const int fps = animation->framerate();
m_d->initialFrame = animation->currentUITime();
m_d->firstFrame = range.start();
m_d->lastFrame = range.end();
m_d->expectedFrame = qBound(m_d->firstFrame, m_d->expectedFrame, m_d->lastFrame);
m_d->expectedInterval = qreal(1000) / fps / m_d->playbackSpeed;
m_d->lastTimerInterval = m_d->expectedInterval;
if (m_d->syncedAudio) {
m_d->syncedAudio->setSpeed(m_d->playbackSpeed);
}
m_d->timer->start(m_d->expectedInterval);
if (m_d->playbackTime.isValid()) {
m_d->playbackTime.restart();
} else {
m_d->playbackTime.start();
}
m_d->nextFrameExpectedTime = m_d->playbackTime.elapsed() + m_d->expectedInterval;
}
void KisAnimationPlayer::play()
{
{
const KisImageAnimationInterface *animation = m_d->canvas->image()->animationInterface();
const KisTimeRange &range = animation->playbackRange();
if (!range.isValid()) return;
- KisAnimationCacheUpdateProgressDialog dlg(200, KisPart::instance()->currentMainwindow());
- dlg.regenerateRange(m_d->canvas->frameCache(), range, m_d->canvas->viewManager());
+ // when openGL is disabled, there is no animation cache
+ if (m_d->canvas->frameCache()) {
+ KisAnimationCacheUpdateProgressDialog dlg(200, KisPart::instance()->currentMainwindow());
+ dlg.regenerateRange(m_d->canvas->frameCache(), range, m_d->canvas->viewManager());
+ }
}
m_d->playing = true;
slotUpdatePlaybackTimer();
m_d->expectedFrame = m_d->firstFrame;
m_d->lastPaintedFrame = m_d->firstFrame;
connectCancelSignals();
if (m_d->syncedAudio) {
KisImageAnimationInterface *animationInterface = m_d->canvas->image()->animationInterface();
m_d->syncedAudio->play(m_d->frameToMSec(m_d->firstFrame, animationInterface->framerate()));
}
}
void KisAnimationPlayer::Private::stopImpl(bool doUpdates)
{
if (syncedAudio) {
syncedAudio->stop();
}
q->disconnectCancelSignals();
timer->stop();
playing = false;
if (doUpdates) {
KisImageAnimationInterface *animation = canvas->image()->animationInterface();
if (animation->currentUITime() == initialFrame) {
canvas->refetchDataFromImage();
} else {
animation->switchCurrentTimeAsync(initialFrame);
}
}
emit q->sigPlaybackStopped();
}
void KisAnimationPlayer::stop()
{
m_d->stopImpl(true);
}
void KisAnimationPlayer::forcedStopOnExit()
{
m_d->stopImpl(false);
}
bool KisAnimationPlayer::isPlaying()
{
return m_d->playing;
}
int KisAnimationPlayer::currentTime()
{
return m_d->lastPaintedFrame;
}
void KisAnimationPlayer::displayFrame(int time)
{
uploadFrame(time);
}
void KisAnimationPlayer::slotUpdate()
{
uploadFrame(-1);
}
void KisAnimationPlayer::uploadFrame(int frame)
{
KisImageAnimationInterface *animationInterface = m_d->canvas->image()->animationInterface();
if (frame < 0) {
const int currentTime = m_d->playbackTime.elapsed();
const int framesDiff = currentTime - m_d->nextFrameExpectedTime;
const qreal framesDiffNorm = qreal(framesDiff) / m_d->expectedInterval;
// qDebug() << ppVar(framesDiff)
// << ppVar(m_d->expectedFrame)
// << ppVar(framesDiffNorm)
// << ppVar(m_d->lastTimerInterval);
if (m_d->dropFramesMode) {
const int numDroppedFrames = qMax(0, qRound(framesDiffNorm));
frame = m_d->incFrame(m_d->expectedFrame, numDroppedFrames);
} else {
frame = m_d->expectedFrame;
}
m_d->nextFrameExpectedTime = currentTime + m_d->expectedInterval;
m_d->lastTimerInterval = qMax(0.0, m_d->lastTimerInterval - 0.5 * framesDiff);
m_d->expectedFrame = m_d->incFrame(frame, 1);
m_d->timer->start(m_d->lastTimerInterval);
m_d->playbackStatisticsCompressor.start();
}
if (m_d->syncedAudio) {
const int msecTime = m_d->frameToMSec(frame, animationInterface->framerate());
if (isPlaying()) {
slotSyncScrubbingAudio(msecTime);
} else {
m_d->audioSyncScrubbingCompressor->start(msecTime);
}
}
if (m_d->canvas->frameCache() && m_d->canvas->frameCache()->uploadFrame(frame)) {
m_d->canvas->updateCanvas();
m_d->useFastFrameUpload = true;
emit sigFrameChanged();
} else {
m_d->useFastFrameUpload = false;
m_d->canvas->image()->barrierLock(true);
m_d->canvas->image()->unlock();
// no OpenGL cache or the frame just not cached yet
animationInterface->switchCurrentTimeAsync(frame);
emit sigFrameChanged();
}
if (!m_d->realFpsTimer.isValid()) {
m_d->realFpsTimer.start();
} else {
const int elapsed = m_d->realFpsTimer.restart();
m_d->realFpsAccumulator(elapsed);
int numFrames = frame - m_d->lastPaintedFrame;
if (numFrames < 0) {
numFrames += m_d->lastFrame - m_d->firstFrame + 1;
}
m_d->droppedFramesPortion(qreal(int(numFrames != 1)));
if (numFrames > 0) {
m_d->droppedFpsAccumulator(qreal(elapsed) / numFrames);
}
#ifdef PLAYER_DEBUG_FRAMERATE
qDebug() << " RFPS:" << 1000.0 / rolling_mean(m_d->realFpsAccumulator)
<< "DFPS:" << 1000.0 / rolling_mean(m_d->droppedFpsAccumulator) << ppVar(numFrames);
#endif /* PLAYER_DEBUG_FRAMERATE */
}
m_d->lastPaintedFrame = frame;
}
qreal KisAnimationPlayer::effectiveFps() const
{
return 1000.0 / rolling_mean(m_d->droppedFpsAccumulator);
}
qreal KisAnimationPlayer::realFps() const
{
return 1000.0 / rolling_mean(m_d->realFpsAccumulator);
}
qreal KisAnimationPlayer::framesDroppedPortion() const
{
return rolling_mean(m_d->droppedFramesPortion);
}
void KisAnimationPlayer::slotCancelPlayback()
{
stop();
}
void KisAnimationPlayer::slotCancelPlaybackSafe()
{
/**
* If there is no openGL support, then we have no (!) cache at
* all. Therefore we should regenerate frame on every time switch,
* which, yeah, can be very slow. What is more important, when
* regenerating a frame animation interface will emit a
* sigStrokeEndRequested() signal and we should ignore it. That is
* not an ideal solution, because the user will be able to paint
* on random frames while playing, but it lets users with faulty
* GPUs see at least some preview of their animation.
*/
if (m_d->useFastFrameUpload) {
stop();
}
}
qreal KisAnimationPlayer::playbackSpeed()
{
return m_d->playbackSpeed;
}
void KisAnimationPlayer::slotUpdatePlaybackSpeed(double value)
{
m_d->playbackSpeed = value;
if (m_d->playing) {
slotUpdatePlaybackTimer();
}
}
diff --git a/libs/ui/canvas/kis_animation_player.h b/libs/ui/canvas/kis_animation_player.h
index a7374eb0dd..94ecf1ce27 100644
--- a/libs/ui/canvas/kis_animation_player.h
+++ b/libs/ui/canvas/kis_animation_player.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ANIMATION_PLAYER_H
#define KIS_ANIMATION_PLAYER_H
#include <QScopedPointer>
#include <QObject>
#include "kritaui_export.h"
class KisCanvas2;
class KRITAUI_EXPORT KisAnimationPlayer : public QObject
{
Q_OBJECT
public:
KisAnimationPlayer(KisCanvas2 *canvas);
- ~KisAnimationPlayer();
+ ~KisAnimationPlayer() override;
void play();
void stop();
void displayFrame(int time);
bool isPlaying();
int currentTime();
qreal playbackSpeed();
void forcedStopOnExit();
qreal effectiveFps() const;
qreal realFps() const;
qreal framesDroppedPortion() const;
public Q_SLOTS:
void slotUpdate();
void slotCancelPlayback();
void slotCancelPlaybackSafe();
void slotUpdatePlaybackSpeed(double value);
void slotUpdatePlaybackTimer();
void slotUpdateDropFramesMode();
private Q_SLOTS:
void slotSyncScrubbingAudio(int msecTime);
void slotTryStopScrubbingAudio();
void slotUpdateAudioChunkLength();
void slotAudioChannelChanged();
void slotAudioVolumeChanged();
void slotOnAudioError(const QString &fileName, const QString &message);
Q_SIGNALS:
void sigFrameChanged();
void sigPlaybackStopped();
void sigPlaybackStatisticsUpdated();
private:
void connectCancelSignals();
void disconnectCancelSignals();
void uploadFrame(int time);
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/ui/canvas/kis_canvas2.h b/libs/ui/canvas/kis_canvas2.h
index 527860451a..663c07c31e 100644
--- a/libs/ui/canvas/kis_canvas2.h
+++ b/libs/ui/canvas/kis_canvas2.h
@@ -1,303 +1,303 @@
/* This file is part of the KDE project
* Copyright (C) 2006, 2010 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CANVAS_H
#define KIS_CANVAS_H
#include <QObject>
#include <QWidget>
#include <QSize>
#include <QString>
#include <KoConfig.h>
#include <KoColorConversionTransformation.h>
#include <KoCanvasBase.h>
#include <kritaui_export.h>
#include <kis_types.h>
#include <KoPointerEvent.h>
#include "opengl/kis_opengl.h"
#include "kis_ui_types.h"
#include "kis_coordinates_converter.h"
#include "kis_canvas_decoration.h"
#include "kis_painting_assistants_decoration.h"
class KoToolProxy;
class KoColorProfile;
class KisViewManager;
class KisFavoriteResourceManager;
class KisDisplayFilter;
class KisDisplayColorConverter;
struct KisExposureGammaCorrectionInterface;
class KisView;
class KisInputManager;
class KisAnimationPlayer;
class KisShapeController;
class KisCoordinatesConverter;
class KoViewConverter;
/**
* KisCanvas2 is not an actual widget class, but rather an adapter for
* the widget it contains, which may be either a QPainter based
* canvas, or an OpenGL based canvas: that are the real widgets.
*/
class KRITAUI_EXPORT KisCanvas2 : public KoCanvasBase
{
Q_OBJECT
public:
/**
* Create a new canvas. The canvas manages a widget that will do
* the actual painting: the canvas itself is not a widget.
*
* @param viewConverter the viewconverter for converting between
* window and document coordinates.
*/
KisCanvas2(KisCoordinatesConverter *coordConverter, KoCanvasResourceManager *resourceManager, KisView *view, KoShapeBasedDocumentBase *sc);
- virtual ~KisCanvas2();
+ ~KisCanvas2() override;
void notifyZoomChanged();
- virtual void disconnectCanvasObserver(QObject *object);
+ void disconnectCanvasObserver(QObject *object) override;
public: // KoCanvasBase implementation
- bool canvasIsOpenGL() const;
+ bool canvasIsOpenGL() const override;
KisOpenGL::FilterMode openGLFilterMode() const;
- void gridSize(QPointF *offset, QSizeF *spacing) const;
+ void gridSize(QPointF *offset, QSizeF *spacing) const override;
- bool snapToGrid() const;
+ bool snapToGrid() const override;
// This method only exists to support flake-related operations
- void addCommand(KUndo2Command *command);
+ void addCommand(KUndo2Command *command) override;
- virtual QPoint documentOrigin() const;
+ QPoint documentOrigin() const override;
QPoint documentOffset() const;
/**
* Return the right shape manager for the current layer. That is
* to say, if the current layer is a vector layer, return the shape
* layer's canvas' shapemanager, else the shapemanager associated
* with the global krita canvas.
*/
KoShapeManager * shapeManager() const override;
/**
* Since shapeManager() may change, we need a persistent object where we can
* connect to and thack the selection. See more comments in KoCanvasBase.
*/
KoSelectedShapesProxy *selectedShapesProxy() const override;
/**
* Return the shape manager associated with this canvas
*/
KoShapeManager *globalShapeManager() const;
- void updateCanvas(const QRectF& rc);
+ void updateCanvas(const QRectF& rc) override;
- virtual void updateInputMethodInfo();
+ void updateInputMethodInfo() override;
const KisCoordinatesConverter* coordinatesConverter() const;
- virtual KoViewConverter *viewConverter() const;
+ KoViewConverter *viewConverter() const override;
- virtual QWidget* canvasWidget();
+ QWidget* canvasWidget() override;
- virtual const QWidget* canvasWidget() const;
+ const QWidget* canvasWidget() const override;
- virtual KoUnit unit() const;
+ KoUnit unit() const override;
- virtual KoToolProxy* toolProxy() const;
+ KoToolProxy* toolProxy() const override;
const KoColorProfile* monitorProfile();
// FIXME:
// Temporary! Either get the current layer and image from the
// resource provider, or use this, which gets them from the
// current shape selection.
KisImageWSP currentImage() const;
/**
* Filters events and sends them to canvas actions. Shared
* among all the views/canvases
*
* NOTE: May be null while initialization!
*/
KisInputManager* globalInputManager() const;
KisPaintingAssistantsDecorationSP paintingAssistantsDecoration() const;
public: // KisCanvas2 methods
KisImageWSP image() const;
KisViewManager* viewManager() const;
QPointer<KisView> imageView() const;
/// @return true if the canvas image should be displayed in vertically mirrored mode
void addDecoration(KisCanvasDecorationSP deco);
KisCanvasDecorationSP decoration(const QString& id) const;
void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
QSharedPointer<KisDisplayFilter> displayFilter() const;
KisDisplayColorConverter *displayColorConverter() const;
KisExposureGammaCorrectionInterface* exposureGammaCorrectionInterface() const;
/**
* @brief setProofingOptions
* set the options for softproofing, without affecting the proofing options as stored inside the image.
*/
void setProofingOptions(bool softProof, bool gamutCheck);
KisProofingConfigurationSP proofingConfiguration() const;
/**
* @brief setProofingConfigUpdated This function is to set whether the proofing config is updated,
* this is needed for determining whether or not to generate a new proofing transform.
* @param updated whether it's updated. Just set it to false in normal usage.
*/
void setProofingConfigUpdated(bool updated);
/**
* @brief proofingConfigUpdated ask the canvas whether or not it updated the proofing config.
* @return whether or not the proofing config is updated, if so, a new proofing transform needs to be made
* in KisOpenGL canvas.
*/
bool proofingConfigUpdated();
- void setCursor(const QCursor &cursor);
+ void setCursor(const QCursor &cursor) override;
KisAnimationFrameCacheSP frameCache() const;
KisAnimationPlayer *animationPlayer() const;
void refetchDataFromImage();
Q_SIGNALS:
void imageChanged(KisImageWSP image);
void sigCanvasCacheUpdated();
void sigContinueResizeImage(qint32 w, qint32 h);
void documentOffsetUpdateFinished();
// emitted whenever the canvas widget thinks sketch should update
void updateCanvasRequested(const QRect &rc);
public Q_SLOTS:
/// Update the entire canvas area
void updateCanvas();
void startResizingImage();
void finishResizingImage(qint32 w, qint32 h);
/// canvas rotation in degrees
qreal rotationAngle() const;
/// Bools indicating canvasmirroring.
bool xAxisMirrored() const;
bool yAxisMirrored() const;
void slotSoftProofing(bool softProofing);
void slotGamutCheck(bool gamutCheck);
void slotChangeProofingConfig();
void slotZoomChanged(int zoom);
void channelSelectionChanged();
/**
* Called whenever the display monitor profile resource changes
*/
void slotSetDisplayProfile(const KoColorProfile *profile);
void startUpdateInPatches(const QRect &imageRect);
void slotTrySwitchShapeManager();
private Q_SLOTS:
/// The image projection has changed, now start an update
/// of the canvas representation.
void startUpdateCanvasProjection(const QRect & rc);
void updateCanvasProjection();
/**
* Called whenever the view widget needs to show a different part of
* the document
*
* @param documentOffset the offset in widget pixels
*/
void documentOffsetMoved(const QPoint &documentOffset);
/**
* Called whenever the configuration settings change.
*/
void slotConfigChanged();
void slotSelectionChanged();
void slotDoCanvasUpdate();
void bootstrapFinished();
public:
bool isPopupPaletteVisible() const;
void slotShowPopupPalette(const QPoint& = QPoint(0,0));
// interface for KisCanvasController only
void setWrapAroundViewingMode(bool value);
bool wrapAroundViewingMode() const;
void setLodAllowedInCanvas(bool value);
bool lodAllowedInCanvas() const;
void initializeImage();
void setFavoriteResourceManager(KisFavoriteResourceManager* favoriteResourceManager);
private:
Q_DISABLE_COPY(KisCanvas2)
void connectCurrentCanvas();
void createCanvas(bool useOpenGL);
void createQPainterCanvas();
void createOpenGLCanvas();
void updateCanvasWidgetImpl(const QRect &rc = QRect());
void setCanvasWidget(QWidget *widget);
void resetCanvas(bool useOpenGL);
void notifyLevelOfDetailChange();
// Completes construction of canvas.
// To be called by KisView in its constructor, once it has been setup enough
// (to be defined what that means) for things KisCanvas2 expects from KisView
// TODO: see to avoid that
void setup();
private:
friend class KisView; // calls setup()
class KisCanvas2Private;
KisCanvas2Private * const m_d;
};
#endif
diff --git a/libs/ui/canvas/kis_canvas_controller.h b/libs/ui/canvas/kis_canvas_controller.h
index cc7122c2ab..22e980e532 100644
--- a/libs/ui/canvas/kis_canvas_controller.h
+++ b/libs/ui/canvas/kis_canvas_controller.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CANVAS_CONTROLLER_H
#define KIS_CANVAS_CONTROLLER_H
#include <KoCanvasControllerWidget.h>
#include "kritaui_export.h"
#include "kis_types.h"
class KisView;
class KRITAUI_EXPORT KisCanvasController : public KoCanvasControllerWidget
{
Q_OBJECT
public:
KisCanvasController(QPointer<KisView>parent, KActionCollection * actionCollection);
- ~KisCanvasController();
+ ~KisCanvasController() override;
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void changeCanvasWidget(QWidget *widget);
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void wheelEvent(QWheelEvent *event);
- virtual bool eventFilter(QObject *watched, QEvent *event);
- virtual void updateDocumentSize(const QSize &sz, bool recalculateCenter);
- virtual void activate();
+ void setCanvas(KoCanvasBase *canvas) override;
+ void changeCanvasWidget(QWidget *widget) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void wheelEvent(QWheelEvent *event) override;
+ bool eventFilter(QObject *watched, QEvent *event) override;
+ void updateDocumentSize(const QSize &sz, bool recalculateCenter) override;
+ void activate() override;
QPointF currentCursorPosition() const override;
public:
using KoCanvasController::documentSize;
bool wrapAroundMode() const;
bool levelOfDetailMode() const;
public Q_SLOTS:
void mirrorCanvas(bool enable);
void rotateCanvas(qreal angle);
void rotateCanvasRight15();
void rotateCanvasLeft15();
qreal rotation() const;
void resetCanvasRotation();
void slotToggleWrapAroundMode(bool value);
void slotToggleLevelOfDetailMode(bool value);
Q_SIGNALS:
void documentSizeChanged();
private:
struct Private;
Private * const m_d;
};
#endif /* KIS_CANVAS_CONTROLLER_H */
diff --git a/libs/ui/canvas/kis_canvas_decoration.h b/libs/ui/canvas/kis_canvas_decoration.h
index a15ec2e971..e1f351830f 100644
--- a/libs/ui/canvas/kis_canvas_decoration.h
+++ b/libs/ui/canvas/kis_canvas_decoration.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CANVAS_DECORATION_H_
#define _KIS_CANVAS_DECORATION_H_
#include <QObject>
#include <QPointer>
#include <kritaui_export.h>
#include <kis_image.h>
#include "KisView.h"
#include <kis_shared.h>
class KisCanvas2;
class QRectF;
class QPainter;
class KisCoordinatesConverter;
class KisCanvasDecoration;
typedef KisSharedPtr<KisCanvasDecoration> KisCanvasDecorationSP;
/**
* This class is the base class for object that draw a decoration on the canvas,
* for instance, selections, grids, tools, ...
*/
class KRITAUI_EXPORT KisCanvasDecoration : public QObject, public KisShared
{
Q_OBJECT
public:
KisCanvasDecoration(const QString& id, QPointer<KisView>parent);
- ~KisCanvasDecoration();
+ ~KisCanvasDecoration() override;
void setView(QPointer<KisView> imageView);
const QString& id() const;
/**
* @return whether the decoration is visible.
*/
bool visible() const;
/**
* Will paint the decoration on the QPainter, if the visible is set to true.
*
* @param updateRect dirty rect in document pixels
*/
void paint(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas);
public Q_SLOTS:
/**
* Set if the decoration is visible or not.
*/
virtual void setVisible(bool v);
/**
* If decoration is visible, hide it, if not show it.
*/
void toggleVisibility();
protected:
virtual void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter,KisCanvas2* canvas) = 0;
/// XXX: unify view and imageview!
QPointer<KisView>imageView();
/**
* @return the parent KisView
*/
QPointer<KisView> view() const;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/canvas/kis_canvas_widget_base.h b/libs/ui/canvas/kis_canvas_widget_base.h
index 73db91893e..a97be68e81 100644
--- a/libs/ui/canvas/kis_canvas_widget_base.h
+++ b/libs/ui/canvas/kis_canvas_widget_base.h
@@ -1,102 +1,102 @@
/*
* Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org>, (C)
* Copyright (C) 2010 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CANVAS_WIDGET_BASE_
#define _KIS_CANVAS_WIDGET_BASE_
#include <QList>
#include <Qt>
#include "kis_abstract_canvas_widget.h"
class QColor;
class QImage;
class QInputMethodEvent;
class QVariant;
class KisCoordinatesConverter;
class KisDisplayFilter;
class KisCanvas2;
#include "kritaui_export.h"
class KRITAUI_EXPORT KisCanvasWidgetBase : public KisAbstractCanvasWidget
{
public:
KisCanvasWidgetBase(KisCanvas2 * canvas, KisCoordinatesConverter *coordinatesConverter);
- virtual ~KisCanvasWidgetBase();
+ ~KisCanvasWidgetBase() override;
public: // KisAbstractCanvasWidget
- virtual KoToolProxy *toolProxy() const;
+ KoToolProxy *toolProxy() const override;
/// set the specified display filter on the canvas
- virtual void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter) = 0;
+ void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter) override = 0;
/**
* Draw the specified decorations on the view.
*/
- virtual void drawDecorations(QPainter & gc, const QRect &updateWidgetRect) const;
+ void drawDecorations(QPainter & gc, const QRect &updateWidgetRect) const override;
- virtual void addDecoration(KisCanvasDecorationSP deco);
- virtual KisCanvasDecorationSP decoration(const QString& id) const;
+ void addDecoration(KisCanvasDecorationSP deco) override;
+ KisCanvasDecorationSP decoration(const QString& id) const override;
- virtual void setDecorations(const QList<KisCanvasDecorationSP > &);
- virtual QList<KisCanvasDecorationSP > decorations() const;
+ void setDecorations(const QList<KisCanvasDecorationSP > &) override;
+ QList<KisCanvasDecorationSP > decorations() const override;
- virtual void setWrapAroundViewingMode(bool value);
+ void setWrapAroundViewingMode(bool value) override;
/**
* Returns the color of the border, i.e. the part of the canvas
* outside the image contents.
*
*/
QColor borderColor() const;
/**
* Returns one check of the background checkerboard pattern.
*/
static QImage createCheckersImage(qint32 checkSize = -1);
KisCoordinatesConverter* coordinatesConverter() const;
protected:
KisCanvas2 *canvas() const;
/**
* Event handlers to be called by derived canvas event handlers.
* All common event processing is carried out by these
* functions.
*/
QVariant processInputMethodQuery(Qt::InputMethodQuery query) const;
void processInputMethodEvent(QInputMethodEvent *event);
void notifyConfigChanged();
/// To be implemented by the derived canvas
virtual bool callFocusNextPrevChild(bool next) = 0;
private:
struct Private;
Private * const m_d;
};
#endif // _KIS_CANVAS_WIDGET_BASE_
diff --git a/libs/ui/canvas/kis_change_guides_command.h b/libs/ui/canvas/kis_change_guides_command.h
index a83c859f0d..a66649b346 100644
--- a/libs/ui/canvas/kis_change_guides_command.h
+++ b/libs/ui/canvas/kis_change_guides_command.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CHANGE_GUIDES_COMMAND_H
#define __KIS_CHANGE_GUIDES_COMMAND_H
#include <QScopedPointer>
#include <kundo2command.h>
class KisDocument;
class KUndo2Command;
class KisGuidesConfig;
class KisChangeGuidesCommand : public KUndo2Command
{
public:
KisChangeGuidesCommand(KisDocument *doc, const KisGuidesConfig &newGuides);
KisChangeGuidesCommand(KisDocument *document);
- ~KisChangeGuidesCommand();
+ ~KisChangeGuidesCommand() override;
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
- int id() const;
- bool mergeWith(const KUndo2Command *command);
+ int id() const override;
+ bool mergeWith(const KUndo2Command *command) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_CHANGE_GUIDES_COMMAND_H */
diff --git a/libs/ui/canvas/kis_coordinates_converter.h b/libs/ui/canvas/kis_coordinates_converter.h
index ba02a66d66..803a5d94bd 100644
--- a/libs/ui/canvas/kis_coordinates_converter.h
+++ b/libs/ui/canvas/kis_coordinates_converter.h
@@ -1,162 +1,162 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COORDINATES_CONVERTER_H
#define KIS_COORDINATES_CONVERTER_H
#include <QTransform>
#include <KoZoomHandler.h>
#include "kritaui_export.h"
#include "kis_types.h"
#define EPSILON 1e-6
#define SCALE_LESS_THAN(scX, scY, value) \
(scX < (value) - EPSILON && scY < (value) - EPSILON)
#define SCALE_MORE_OR_EQUAL_TO(scX, scY, value) \
(scX > (value) - EPSILON && scY > (value) - EPSILON)
namespace _Private
{
template<class T> struct Traits
{
typedef T Result;
static T map(const QTransform& transform, const T& obj) { return transform.map(obj); }
};
template<> struct Traits<QRectF>
{
typedef QRectF Result;
static QRectF map(const QTransform& transform, const QRectF& rc) { return transform.mapRect(rc); }
};
template<> struct Traits<QRect>: public Traits<QRectF> { };
template<> struct Traits<QPoint>: public Traits<QPointF> { };
template<> struct Traits<QPolygon>: public Traits<QPolygonF> { };
template<> struct Traits<QLine>: public Traits<QLineF> { };
}
class KRITAUI_EXPORT KisCoordinatesConverter: public KoZoomHandler
{
public:
KisCoordinatesConverter();
- ~KisCoordinatesConverter();
+ ~KisCoordinatesConverter() override;
void setCanvasWidgetSize(QSize size);
void setImage(KisImageWSP image);
void setDocumentOffset(const QPoint &offset);
QPoint documentOffset() const;
qreal rotationAngle() const;
QPoint rotate(QPointF center, qreal angle);
QPoint mirror(QPointF center, bool mirrorXAxis, bool mirrorYAxis);
bool xAxisMirrored() const;
bool yAxisMirrored() const;
QPoint resetRotation(QPointF center);
- virtual void setZoom(qreal zoom);
+ void setZoom(qreal zoom) override;
/**
* A composition of to scale methods: zoom level + image resolution
*/
qreal effectiveZoom() const;
template<class T> typename _Private::Traits<T>::Result
imageToViewport(const T& obj) const { return _Private::Traits<T>::map(imageToViewportTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
viewportToImage(const T& obj) const { return _Private::Traits<T>::map(imageToViewportTransform().inverted(), obj); }
template<class T> typename _Private::Traits<T>::Result
flakeToWidget(const T& obj) const { return _Private::Traits<T>::map(flakeToWidgetTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
widgetToFlake(const T& obj) const { return _Private::Traits<T>::map(flakeToWidgetTransform().inverted(), obj); }
template<class T> typename _Private::Traits<T>::Result
widgetToViewport(const T& obj) const { return _Private::Traits<T>::map(viewportToWidgetTransform().inverted(), obj); }
template<class T> typename _Private::Traits<T>::Result
viewportToWidget(const T& obj) const { return _Private::Traits<T>::map(viewportToWidgetTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
documentToWidget(const T& obj) const { return _Private::Traits<T>::map(documentToWidgetTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
widgetToDocument(const T& obj) const { return _Private::Traits<T>::map(documentToWidgetTransform().inverted(), obj); }
template<class T> typename _Private::Traits<T>::Result
imageToDocument(const T& obj) const { return _Private::Traits<T>::map(imageToDocumentTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
documentToImage(const T& obj) const { return _Private::Traits<T>::map(imageToDocumentTransform().inverted(), obj); }
template<class T> typename _Private::Traits<T>::Result
documentToFlake(const T& obj) const { return _Private::Traits<T>::map(documentToFlakeTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
flakeToDocument(const T& obj) const { return _Private::Traits<T>::map(documentToFlakeTransform().inverted(), obj); }
template<class T> typename _Private::Traits<T>::Result
imageToWidget(const T& obj) const { return _Private::Traits<T>::map(imageToWidgetTransform(), obj); }
template<class T> typename _Private::Traits<T>::Result
widgetToImage(const T& obj) const { return _Private::Traits<T>::map(imageToWidgetTransform().inverted(), obj); }
QTransform imageToWidgetTransform() const;
QTransform imageToDocumentTransform() const;
QTransform documentToFlakeTransform() const;
QTransform imageToViewportTransform() const;
QTransform viewportToWidgetTransform() const;
QTransform flakeToWidgetTransform() const;
QTransform documentToWidgetTransform() const;
void getQPainterCheckersInfo(QTransform *transform,
QPointF *brushOrigin,
QPolygonF *poligon) const;
void getOpenGLCheckersInfo(const QRectF &viewportRect,
QTransform *textureTransform,
QTransform *modelTransform,
QRectF *textureRect,
QRectF *modelRect,
bool scrollCheckers) const;
QPointF imageCenterInWidgetPixel() const;
QRectF imageRectInWidgetPixels() const;
QRectF imageRectInViewportPixels() const;
QSizeF imageSizeInFlakePixels() const;
QRectF widgetRectInFlakePixels() const;
QRect imageRectInImagePixels() const;
QRectF imageRectInDocumentPixels() const;
QPointF flakeCenterPoint() const;
QPointF widgetCenterPoint() const;
void imageScale(qreal *scaleX, qreal *scaleY) const;
private:
friend class KisZoomAndPanTest;
QPointF centeringCorrection() const;
void correctOffsetToTransformation();
void correctTransformationToOffset();
void recalculateTransformations();
private:
struct Private;
Private * const m_d;
};
#endif /* KIS_COORDINATES_CONVERTER_H */
diff --git a/libs/ui/canvas/kis_display_color_converter.cpp b/libs/ui/canvas/kis_display_color_converter.cpp
index 5c57a0d324..2c69d0ba24 100644
--- a/libs/ui/canvas/kis_display_color_converter.cpp
+++ b/libs/ui/canvas/kis_display_color_converter.cpp
@@ -1,641 +1,641 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_display_color_converter.h"
#include <QGlobalStatic>
#include <QPointer>
#include <KoColor.h>
#include <KoColorDisplayRendererInterface.h>
#include <KoColorSpaceMaths.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorModelStandardIds.h>
#include <KoColorConversions.h>
#include <KoCanvasResourceManager.h>
#include "kis_config_notifier.h"
#include "kis_canvas_resource_provider.h"
#include "kis_canvas2.h"
#include "KisViewManager.h"
#include "kis_image.h"
#include "kis_node.h"
#include "kundo2command.h"
#include "kis_config.h"
#include "kis_paint_device.h"
#include "kis_iterator_ng.h"
Q_GLOBAL_STATIC(KisDisplayColorConverter, s_instance)
struct KisDisplayColorConverter::Private
{
Private(KisDisplayColorConverter *_q, KoCanvasResourceManager *_resourceManager)
: q(_q),
resourceManager(_resourceManager),
nodeColorSpace(0),
paintingColorSpace(0),
monitorColorSpace(0),
monitorProfile(0),
renderingIntent(KoColorConversionTransformation::internalRenderingIntent()),
conversionFlags(KoColorConversionTransformation::internalConversionFlags()),
displayFilter(0),
intermediateColorSpace(0),
displayRenderer(new DisplayRenderer(_q, _resourceManager))
{
}
KisDisplayColorConverter *const q;
KoCanvasResourceManager *resourceManager;
const KoColorSpace *nodeColorSpace;
const KoColorSpace *paintingColorSpace;
const KoColorSpace *monitorColorSpace;
const KoColorProfile *monitorProfile;
KoColorConversionTransformation::Intent renderingIntent;
KoColorConversionTransformation::ConversionFlags conversionFlags;
QSharedPointer<KisDisplayFilter> displayFilter;
const KoColorSpace *intermediateColorSpace;
KoColor intermediateFgColor;
KisNodeSP connectedNode;
inline KoColor approximateFromQColor(const QColor &qcolor);
inline QColor approximateToQColor(const KoColor &color);
void slotCanvasResourceChanged(int key, const QVariant &v);
void slotUpdateCurrentNodeColorSpace();
void selectPaintingColorSpace();
void updateIntermediateFgColor(const KoColor &color);
void setCurrentNode(KisNodeSP node);
bool useOcio() const;
bool finalIsRgba(const KoColorSpace *cs) const;
template <bool flipToBgra>
QColor floatArrayToQColor(const float *p);
template <bool flipToBgra>
QImage convertToQImageDirect(KisPaintDeviceSP device);
class DisplayRenderer : public KoColorDisplayRendererInterface {
public:
DisplayRenderer(KisDisplayColorConverter *displayColorConverter, KoCanvasResourceManager *resourceManager)
: m_displayColorConverter(displayColorConverter),
m_resourceManager(resourceManager)
{
displayColorConverter->connect(displayColorConverter, SIGNAL(displayConfigurationChanged()),
this, SIGNAL(displayConfigurationChanged()));
}
- QImage convertToQImage(const KoColorSpace *srcColorSpace, const quint8 *data, qint32 width, qint32 height) const {
+ QImage convertToQImage(const KoColorSpace *srcColorSpace, const quint8 *data, qint32 width, qint32 height) const override {
KisPaintDeviceSP dev = new KisPaintDevice(srcColorSpace);
dev->writeBytes(data, 0, 0, width, height);
return m_displayColorConverter->toQImage(dev);
}
QColor toQColor(const KoColor &c) const override {
return m_displayColorConverter->toQColor(c);
}
KoColor approximateFromRenderedQColor(const QColor &c) const override {
return m_displayColorConverter->approximateFromRenderedQColor(c);
}
KoColor fromHsv(int h, int s, int v, int a) const override {
return m_displayColorConverter->fromHsv(h, s, v, a);
}
void getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a) const override {
m_displayColorConverter->getHsv(srcColor, h, s, v, a);
}
qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const override {
return chaninfo->getUIMin();
}
qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const override {
qreal maxValue = chaninfo->getUIMax();
if (m_resourceManager) {
qreal exposure = m_resourceManager->resource(KisCanvasResourceProvider::HdrExposure).value<qreal>();
// not sure if *= is what we want
maxValue *= std::pow(2.0, -exposure);
}
return maxValue;
}
const KoColorSpace* getPaintingColorSpace() const override {
return m_displayColorConverter->paintingColorSpace();
}
private:
KisDisplayColorConverter *m_displayColorConverter;
QPointer<KoCanvasResourceManager> m_resourceManager;
};
QScopedPointer<KoColorDisplayRendererInterface> displayRenderer;
};
KisDisplayColorConverter::KisDisplayColorConverter(KoCanvasResourceManager *resourceManager, QObject *parent)
: QObject(parent),
m_d(new Private(this, resourceManager))
{
connect(m_d->resourceManager, SIGNAL(canvasResourceChanged(int, const QVariant&)),
SLOT(slotCanvasResourceChanged(int, const QVariant&)));
connect(KisConfigNotifier::instance(), SIGNAL(configChanged()),
SLOT(selectPaintingColorSpace()));
m_d->setCurrentNode(0);
setMonitorProfile(0);
setDisplayFilter(QSharedPointer<KisDisplayFilter>(0));
}
KisDisplayColorConverter::KisDisplayColorConverter()
: m_d(new Private(this, 0))
{
setDisplayFilter(QSharedPointer<KisDisplayFilter>(0));
m_d->paintingColorSpace = KoColorSpaceRegistry::instance()->rgb8();
m_d->setCurrentNode(0);
setMonitorProfile(0);
}
KisDisplayColorConverter::~KisDisplayColorConverter()
{
}
KisDisplayColorConverter* KisDisplayColorConverter::dumbConverterInstance()
{
return s_instance;
}
KoColorDisplayRendererInterface* KisDisplayColorConverter::displayRendererInterface() const
{
return m_d->displayRenderer.data();
}
bool KisDisplayColorConverter::Private::useOcio() const
{
return displayFilter && paintingColorSpace->colorModelId() == RGBAColorModelID;
}
void KisDisplayColorConverter::Private::updateIntermediateFgColor(const KoColor &srcColor)
{
KIS_ASSERT_RECOVER_RETURN(displayFilter);
KoColor color = srcColor;
color.convertTo(intermediateColorSpace);
displayFilter->approximateForwardTransformation(color.data(), 1);
intermediateFgColor = color;
}
void KisDisplayColorConverter::Private::slotCanvasResourceChanged(int key, const QVariant &v)
{
if (key == KisCanvasResourceProvider::CurrentKritaNode) {
KisNodeSP currentNode = v.value<KisNodeWSP>();
setCurrentNode(currentNode);
} else if (useOcio() && key == KoCanvasResourceManager::ForegroundColor) {
updateIntermediateFgColor(v.value<KoColor>());
}
}
void KisDisplayColorConverter::Private::slotUpdateCurrentNodeColorSpace()
{
setCurrentNode(connectedNode);
}
inline KisPaintDeviceSP findValidDevice(KisNodeSP node) {
return node->paintDevice() ? node->paintDevice() : node->original();
}
void KisDisplayColorConverter::Private::setCurrentNode(KisNodeSP node)
{
if (connectedNode) {
KisPaintDeviceSP device = findValidDevice(connectedNode);
if (device) {
q->disconnect(device, 0);
}
}
if (node) {
KisPaintDeviceSP device = findValidDevice(node);
nodeColorSpace = device ?
device->compositionSourceColorSpace() :
node->colorSpace();
KIS_ASSERT_RECOVER_NOOP(nodeColorSpace);
if (device) {
q->connect(device, SIGNAL(profileChanged(const KoColorProfile*)),
SLOT(slotUpdateCurrentNodeColorSpace()), Qt::UniqueConnection);
q->connect(device, SIGNAL(colorSpaceChanged(const KoColorSpace*)),
SLOT(slotUpdateCurrentNodeColorSpace()), Qt::UniqueConnection);
}
} else {
nodeColorSpace = KoColorSpaceRegistry::instance()->rgb8();
}
connectedNode = node;
selectPaintingColorSpace();
}
void KisDisplayColorConverter::Private::selectPaintingColorSpace()
{
KisConfig cfg;
paintingColorSpace = cfg.customColorSelectorColorSpace();
if (!paintingColorSpace || displayFilter) {
paintingColorSpace = nodeColorSpace;
}
emit q->displayConfigurationChanged();
}
const KoColorSpace* KisDisplayColorConverter::paintingColorSpace() const
{
KIS_ASSERT_RECOVER(m_d->paintingColorSpace) {
return KoColorSpaceRegistry::instance()->rgb8();
}
return m_d->paintingColorSpace;
}
void KisDisplayColorConverter::setMonitorProfile(const KoColorProfile *monitorProfile)
{
m_d->monitorColorSpace = KoColorSpaceRegistry::instance()->rgb8(monitorProfile);
m_d->monitorProfile = monitorProfile;
m_d->renderingIntent = renderingIntent();
m_d->conversionFlags = conversionFlags();
emit displayConfigurationChanged();
}
void KisDisplayColorConverter::setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter)
{
if (m_d->displayFilter && displayFilter &&
displayFilter->lockCurrentColorVisualRepresentation()) {
KoColor color(m_d->intermediateFgColor);
displayFilter->approximateInverseTransformation(color.data(), 1);
color.convertTo(m_d->paintingColorSpace);
m_d->resourceManager->setForegroundColor(color);
}
m_d->displayFilter = displayFilter;
m_d->intermediateColorSpace = 0;
if (m_d->displayFilter) {
// choosing default profile, which is scRGB
const KoColorProfile *intermediateProfile = 0;
m_d->intermediateColorSpace =
KoColorSpaceRegistry::instance()->
colorSpace(RGBAColorModelID.id(), Float32BitsColorDepthID.id(), intermediateProfile);
KIS_ASSERT_RECOVER(m_d->intermediateColorSpace) {
m_d->intermediateColorSpace = m_d->monitorColorSpace;
}
m_d->updateIntermediateFgColor(
m_d->resourceManager->foregroundColor());
}
{ // sanity check
KisConfig cfg;
//KIS_ASSERT_RECOVER_NOOP(cfg.useOcio() == (bool) m_d->displayFilter);
}
m_d->selectPaintingColorSpace();
}
KoColorConversionTransformation::Intent
KisDisplayColorConverter::renderingIntent()
{
KisConfig cfg;
return (KoColorConversionTransformation::Intent)cfg.monitorRenderIntent();
}
KoColorConversionTransformation::ConversionFlags
KisDisplayColorConverter::conversionFlags()
{
KoColorConversionTransformation::ConversionFlags conversionFlags =
KoColorConversionTransformation::HighQuality;
KisConfig cfg;
if (cfg.useBlackPointCompensation()) conversionFlags |= KoColorConversionTransformation::BlackpointCompensation;
if (!cfg.allowLCMSOptimization()) conversionFlags |= KoColorConversionTransformation::NoOptimization;
return conversionFlags;
}
QSharedPointer<KisDisplayFilter> KisDisplayColorConverter::displayFilter() const
{
return m_d->displayFilter;
}
const KoColorProfile* KisDisplayColorConverter::monitorProfile() const
{
return m_d->monitorProfile;
}
bool KisDisplayColorConverter::Private::finalIsRgba(const KoColorSpace *cs) const
{
/**
* In Krita RGB color spaces differ: 8/16bit are BGRA, 16f/32f-bit RGBA
*/
KoID colorDepthId = cs->colorDepthId();
return colorDepthId == Float16BitsColorDepthID ||
colorDepthId == Float32BitsColorDepthID;
}
template <bool flipToBgra>
QColor KisDisplayColorConverter::Private::floatArrayToQColor(const float *p) {
if (flipToBgra) {
return QColor(KoColorSpaceMaths<float, quint8>::scaleToA(p[0]),
KoColorSpaceMaths<float, quint8>::scaleToA(p[1]),
KoColorSpaceMaths<float, quint8>::scaleToA(p[2]),
KoColorSpaceMaths<float, quint8>::scaleToA(p[3]));
} else {
return QColor(KoColorSpaceMaths<float, quint8>::scaleToA(p[2]),
KoColorSpaceMaths<float, quint8>::scaleToA(p[1]),
KoColorSpaceMaths<float, quint8>::scaleToA(p[0]),
KoColorSpaceMaths<float, quint8>::scaleToA(p[3]));
}
}
QColor KisDisplayColorConverter::toQColor(const KoColor &srcColor) const
{
KoColor c(srcColor);
c.convertTo(m_d->paintingColorSpace);
if (!m_d->useOcio()) {
// we expect the display profile is rgb8, which is BGRA here
KIS_ASSERT_RECOVER(m_d->monitorColorSpace->pixelSize() == 4) { return Qt::red; };
c.convertTo(m_d->monitorColorSpace, m_d->renderingIntent, m_d->conversionFlags);
const quint8 *p = c.data();
return QColor(p[2], p[1], p[0], p[3]);
} else {
const KoColorSpace *srcCS = c.colorSpace();
if (m_d->displayFilter->useInternalColorManagement()) {
srcCS = KoColorSpaceRegistry::instance()->colorSpace(
RGBAColorModelID.id(),
Float32BitsColorDepthID.id(),
m_d->monitorProfile);
c.convertTo(srcCS, m_d->renderingIntent, m_d->conversionFlags);
}
int numChannels = srcCS->channelCount();
QVector<float> normalizedChannels(numChannels);
srcCS->normalisedChannelsValue(c.data(), normalizedChannels);
m_d->displayFilter->filter((quint8*)normalizedChannels.data(), 1);
const float *p = (const float *)normalizedChannels.constData();
return m_d->finalIsRgba(srcCS) ?
m_d->floatArrayToQColor<true>(p) :
m_d->floatArrayToQColor<false>(p);
}
}
KoColor KisDisplayColorConverter::approximateFromRenderedQColor(const QColor &c) const
{
return m_d->approximateFromQColor(c);
}
template <bool flipToBgra>
QImage
KisDisplayColorConverter::Private::convertToQImageDirect(KisPaintDeviceSP device)
{
QRect bounds = device->exactBounds();
if (bounds.isEmpty()) return QImage();
QImage image(bounds.size(), QImage::Format_ARGB32);
KisSequentialConstIterator it(device, bounds);
quint8 *dstPtr = image.bits();
const KoColorSpace *cs = device->colorSpace();
int numChannels = cs->channelCount();
QVector<float> normalizedChannels(numChannels);
do {
cs->normalisedChannelsValue(it.rawDataConst(), normalizedChannels);
displayFilter->filter((quint8*)normalizedChannels.data(), 1);
const float *p = normalizedChannels.constData();
if (flipToBgra) {
dstPtr[0] = KoColorSpaceMaths<float, quint8>::scaleToA(p[2]);
dstPtr[1] = KoColorSpaceMaths<float, quint8>::scaleToA(p[1]);
dstPtr[2] = KoColorSpaceMaths<float, quint8>::scaleToA(p[0]);
dstPtr[3] = KoColorSpaceMaths<float, quint8>::scaleToA(p[3]);
} else {
dstPtr[0] = KoColorSpaceMaths<float, quint8>::scaleToA(p[0]);
dstPtr[1] = KoColorSpaceMaths<float, quint8>::scaleToA(p[1]);
dstPtr[2] = KoColorSpaceMaths<float, quint8>::scaleToA(p[2]);
dstPtr[3] = KoColorSpaceMaths<float, quint8>::scaleToA(p[3]);
}
dstPtr += 4;
} while (it.nextPixel());
return image;
}
QImage KisDisplayColorConverter::toQImage(KisPaintDeviceSP srcDevice) const
{
KisPaintDeviceSP device = srcDevice;
if (*device->colorSpace() != *m_d->paintingColorSpace) {
device = new KisPaintDevice(*srcDevice);
KUndo2Command *cmd = device->convertTo(m_d->paintingColorSpace);
delete cmd;
}
if (!m_d->useOcio()) {
return device->convertToQImage(m_d->monitorProfile, m_d->renderingIntent, m_d->conversionFlags);
} else {
if (m_d->displayFilter->useInternalColorManagement()) {
if (device == srcDevice) {
device = new KisPaintDevice(*srcDevice);
}
const KoColorSpace *srcCS =
KoColorSpaceRegistry::instance()->colorSpace(
RGBAColorModelID.id(),
Float32BitsColorDepthID.id(),
m_d->monitorProfile);
KUndo2Command *cmd = device->convertTo(srcCS, m_d->renderingIntent, m_d->conversionFlags);
delete cmd;
}
return m_d->finalIsRgba(device->colorSpace()) ?
m_d->convertToQImageDirect<true>(device) :
m_d->convertToQImageDirect<false>(device);
}
return QImage();
}
KoColor KisDisplayColorConverter::Private::approximateFromQColor(const QColor &qcolor)
{
if (!useOcio()) {
return KoColor(qcolor, paintingColorSpace);
} else {
KoColor color(qcolor, intermediateColorSpace);
displayFilter->approximateInverseTransformation(color.data(), 1);
color.convertTo(paintingColorSpace);
return color;
}
qFatal("Must not be reachable");
return KoColor();
}
QColor KisDisplayColorConverter::Private::approximateToQColor(const KoColor &srcColor)
{
KoColor color(srcColor);
if (useOcio()) {
color.convertTo(intermediateColorSpace);
displayFilter->approximateForwardTransformation(color.data(), 1);
}
return color.toQColor();
}
KoColor KisDisplayColorConverter::fromHsv(int h, int s, int v, int a) const
{
// generate HSV from sRGB!
QColor qcolor(QColor::fromHsv(h, s, v, a));
return m_d->approximateFromQColor(qcolor);
}
void KisDisplayColorConverter::getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a) const
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
color.getHsv(h, s, v, a);
}
KoColor KisDisplayColorConverter::fromHsvF(qreal h, qreal s, qreal v, qreal a)
{
// generate HSV from sRGB!
QColor qcolor(QColor::fromHsvF(h, s, v, a));
return m_d->approximateFromQColor(qcolor);
}
void KisDisplayColorConverter::getHsvF(const KoColor &srcColor, qreal *h, qreal *s, qreal *v, qreal *a)
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
color.getHsvF(h, s, v, a);
}
KoColor KisDisplayColorConverter::fromHslF(qreal h, qreal s, qreal l, qreal a)
{
// generate HSL from sRGB!
QColor qcolor(QColor::fromHslF(h, s, l, a));
if (!qcolor.isValid()) {
warnKrita << "Could not construct valid color from h" << h << "s" << s << "l" << l << "a" << a;
qcolor = Qt::black;
}
return m_d->approximateFromQColor(qcolor);
}
void KisDisplayColorConverter::getHslF(const KoColor &srcColor, qreal *h, qreal *s, qreal *l, qreal *a)
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
color.getHslF(h, s, l, a);
}
KoColor KisDisplayColorConverter::fromHsiF(qreal h, qreal s, qreal i)
{
// generate HSI from sRGB!
qreal r=0.0;
qreal g=0.0;
qreal b=0.0;
qreal a=1.0;
HSIToRGB(h, s, i, &r, &g, &b);
QColor qcolor;
qcolor.setRgbF(qBound(0.0,r,1.0), qBound(0.0,g,1.0), qBound(0.0,b,1.0), a);
return m_d->approximateFromQColor(qcolor);
}
void KisDisplayColorConverter::getHsiF(const KoColor &srcColor, qreal *h, qreal *s, qreal *i)
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
qreal r=color.redF();
qreal g=color.greenF();
qreal b=color.blueF();
RGBToHSI(r, g, b, h, s, i);
}
KoColor KisDisplayColorConverter::fromHsyF(qreal h, qreal s, qreal y, qreal R, qreal G, qreal B, qreal gamma)
{
// generate HSL from sRGB!
QVector <qreal> channelValues(3);
y = pow(y, gamma);
HSYToRGB(h, s, y, &channelValues[0], &channelValues[1], &channelValues[2], R, G, B);
KoColorSpaceRegistry::instance()->rgb8()->profile()->delinearizeFloatValueFast(channelValues);
QColor qcolor;
qcolor.setRgbF(qBound(0.0,channelValues[0],1.0), qBound(0.0,channelValues[1],1.0), qBound(0.0,channelValues[2],1.0), 1.0);
return m_d->approximateFromQColor(qcolor);
}
void KisDisplayColorConverter::getHsyF(const KoColor &srcColor, qreal *h, qreal *s, qreal *y, qreal R, qreal G, qreal B, qreal gamma)
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
QVector <qreal> channelValues(3);
channelValues[0]=color.redF();
channelValues[1]=color.greenF();
channelValues[2]=color.blueF();
//TODO: if we're going to have KoColor here, remember to check whether the TRC of the profile exists...
KoColorSpaceRegistry::instance()->rgb8()->profile()->linearizeFloatValueFast(channelValues);
RGBToHSY(channelValues[0], channelValues[1], channelValues[2], h, s, y, R, G, B);
*y = pow(*y, 1/gamma);
}
#include "moc_kis_display_color_converter.cpp"
diff --git a/libs/ui/canvas/kis_display_color_converter.h b/libs/ui/canvas/kis_display_color_converter.h
index a72ee44c3c..08416c9df3 100644
--- a/libs/ui/canvas/kis_display_color_converter.h
+++ b/libs/ui/canvas/kis_display_color_converter.h
@@ -1,111 +1,111 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DISPLAY_COLOR_CONVERTER_H
#define __KIS_DISPLAY_COLOR_CONVERTER_H
#include <QScopedPointer>
#include <KoColorDisplayRendererInterface.h>
#include <KoColorConversionTransformation.h>
#include "kis_types.h"
#include "canvas/kis_display_filter.h"
class KoColor;
class KoColorProfile;
class KoCanvasResourceManager;
/**
* Special helper class that provides primitives for converting colors when
* displaying. We have at least 3 color spaces:
*
* 1) Image color space (any: RGB, CMYK, Lab, etc)
* 2) Display color space (a limited RGB color space)
* 3) Color selectors color space (the one where color selectors generate
* their HSV-based colors. Right now it is sRGB.
*
* KoColor may be in any of these color spaces. QColor should always
* be in the display color space only.
*/
class KRITAUI_EXPORT KisDisplayColorConverter : public QObject
{
Q_OBJECT
public:
KisDisplayColorConverter();
KisDisplayColorConverter(KoCanvasResourceManager *resourceManager, QObject *parent);
- virtual ~KisDisplayColorConverter();
+ ~KisDisplayColorConverter() override;
static KisDisplayColorConverter* dumbConverterInstance();
KoColorDisplayRendererInterface* displayRendererInterface() const;
const KoColorSpace* paintingColorSpace() const;
void setMonitorProfile(const KoColorProfile *monitorProfile);
void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
QColor toQColor(const KoColor &c) const;
KoColor approximateFromRenderedQColor(const QColor &c) const;
/**
* Converts the exactBounds() (!) of the \p srcDevice into QImage
* properly rendered into display RGB space. Please note that the
* offset of the image in QImage is always zero for efficiency
* reasons.
*/
QImage toQImage(KisPaintDeviceSP srcDevice) const;
KoColor fromHsv(int h, int s, int v, int a = 255) const;
KoColor fromHsvF(qreal h, qreal s, qreal v, qreal a = 1.0);
KoColor fromHslF(qreal h, qreal s, qreal l, qreal a = 1.0);
KoColor fromHsiF(qreal h, qreal s, qreal i);
KoColor fromHsyF(qreal h, qreal s, qreal y, qreal R=0.2126, qreal G=0.7152, qreal B=0.0722, qreal gamma=2.2);
void getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a = 0) const;
void getHsvF(const KoColor &srcColor, qreal *h, qreal *s, qreal *v, qreal *a = 0);
void getHslF(const KoColor &srcColor, qreal *h, qreal *s, qreal *l, qreal *a = 0);
void getHsiF(const KoColor &srcColor, qreal *h, qreal *s, qreal *i);
void getHsyF(const KoColor &srcColor, qreal *h, qreal *s, qreal *y, qreal R=0.2126, qreal G=0.7152, qreal B=0.0722, qreal gamma=2.2);
static KoColorConversionTransformation::Intent renderingIntent();
static KoColorConversionTransformation::ConversionFlags conversionFlags();
QSharedPointer<KisDisplayFilter> displayFilter() const;
const KoColorProfile* monitorProfile() const;
Q_SIGNALS:
void displayConfigurationChanged();
private:
// is not possible to implement!
KoColor toKoColor(const QColor &c);
private:
Q_PRIVATE_SLOT(m_d, void slotCanvasResourceChanged(int key, const QVariant &v));
Q_PRIVATE_SLOT(m_d, void selectPaintingColorSpace());
Q_PRIVATE_SLOT(m_d, void slotUpdateCurrentNodeColorSpace());
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_DISPLAY_COLOR_CONVERTER_H */
diff --git a/libs/ui/canvas/kis_exposure_gamma_correction_interface.h b/libs/ui/canvas/kis_exposure_gamma_correction_interface.h
index b409ef0e51..d56dafc8f4 100644
--- a/libs/ui/canvas/kis_exposure_gamma_correction_interface.h
+++ b/libs/ui/canvas/kis_exposure_gamma_correction_interface.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_EXPOSURE_GAMMA_CORRECTION_INTERFACE_H
#define __KIS_EXPOSURE_GAMMA_CORRECTION_INTERFACE_H
#include <QtGlobal>
#include <kritaui_export.h>
/**
* A special interface for OCIO filter providing functionality for the
* main UI module. See Dependency Inversion Principle for more.
*/
struct KRITAUI_EXPORT KisExposureGammaCorrectionInterface {
virtual ~KisExposureGammaCorrectionInterface();
virtual bool canChangeExposureAndGamma() const = 0;
virtual qreal currentExposure() const = 0;
virtual void setCurrentExposure(qreal value) = 0;
virtual qreal currentGamma() const = 0;
virtual void setCurrentGamma(qreal value) = 0;
};
struct KRITAUI_EXPORT KisDumbExposureGammaCorrectionInterface : public KisExposureGammaCorrectionInterface
{
static KisDumbExposureGammaCorrectionInterface* instance();
- bool canChangeExposureAndGamma() const;
- qreal currentExposure() const;
- void setCurrentExposure(qreal value);
- qreal currentGamma() const;
- void setCurrentGamma(qreal value);
+ bool canChangeExposureAndGamma() const override;
+ qreal currentExposure() const override;
+ void setCurrentExposure(qreal value) override;
+ qreal currentGamma() const override;
+ void setCurrentGamma(qreal value) override;
};
#endif /* __KIS_EXPOSURE_GAMMA_CORRECTION_INTERFACE_H */
diff --git a/libs/ui/canvas/kis_grid_decoration.h b/libs/ui/canvas/kis_grid_decoration.h
index a81280d951..180660c61b 100644
--- a/libs/ui/canvas/kis_grid_decoration.h
+++ b/libs/ui/canvas/kis_grid_decoration.h
@@ -1,48 +1,48 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRID_DECORATION_H
#define KIS_GRID_DECORATION_H
#include <QScopedPointer>
#include <kis_canvas_decoration.h>
class KisGridConfig;
class KisGridDecoration : public KisCanvasDecoration
{
Q_OBJECT
public:
KisGridDecoration(KisView* parent);
- virtual ~KisGridDecoration();
+ ~KisGridDecoration() override;
void setGridConfig(const KisGridConfig &config);
protected:
- virtual void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas);
+ void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KIS_GRID_DECORATION_H
diff --git a/libs/ui/canvas/kis_grid_manager.h b/libs/ui/canvas/kis_grid_manager.h
index 76af5b65cf..51ff7a45d8 100644
--- a/libs/ui/canvas/kis_grid_manager.h
+++ b/libs/ui/canvas/kis_grid_manager.h
@@ -1,76 +1,76 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRID_MANAGER_H
#define KIS_GRID_MANAGER_H
#include <QPainter>
#include "kis_types.h"
#include <kritaui_export.h>
#include "kis_action_manager.h"
#include "kis_action.h"
class KisGridDecoration;
class KisViewManager;
class KisGridConfig;
class KRITAUI_EXPORT KisGridManager : public QObject
{
Q_OBJECT
public:
KisGridManager(KisViewManager * parent);
- virtual ~KisGridManager();
+ ~KisGridManager() override;
public:
void setup(KisActionManager * actionManager);
void setView(QPointer<KisView>imageView);
void setGridConfig(const KisGridConfig &config);
Q_SIGNALS:
void sigRequestUpdateGridConfig(const KisGridConfig &config);
public Q_SLOTS:
void updateGUI();
private Q_SLOTS:
void slotChangeGridVisibilityTriggered(bool value);
void slotSnapToGridTriggered(bool value);
private:
void setGridConfigImpl(const KisGridConfig &config, bool emitModified);
private:
void setFastConfig(int size);
KisAction *m_toggleGrid;
KisAction* m_toggleSnapToGrid;
QPointer<KisView> m_imageView;
KisGridDecoration* m_gridDecoration;
bool m_blockModifiedSignal;
};
#endif
diff --git a/libs/ui/canvas/kis_guides_decoration.h b/libs/ui/canvas/kis_guides_decoration.h
index caf679685d..a9a850901d 100644
--- a/libs/ui/canvas/kis_guides_decoration.h
+++ b/libs/ui/canvas/kis_guides_decoration.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_GUIDES_DECORATION_H
#define __KIS_GUIDES_DECORATION_H
#include <QScopedPointer>
#include "kis_canvas_decoration.h"
class KisGuidesConfig;
static const QString GUIDES_DECORATION_ID = "guides-decoration";
class KRITAUI_EXPORT KisGuidesDecoration : public KisCanvasDecoration
{
Q_OBJECT
public:
KisGuidesDecoration(QPointer<KisView> view);
- ~KisGuidesDecoration();
+ ~KisGuidesDecoration() override;
void setGuidesConfig(const KisGuidesConfig &value);
const KisGuidesConfig& guidesConfig() const;
protected:
- void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter, KisCanvas2 *canvas);
+ void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter, KisCanvas2 *canvas) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_GUIDES_DECORATION_H */
diff --git a/libs/ui/canvas/kis_guides_manager.h b/libs/ui/canvas/kis_guides_manager.h
index fe9aede60b..3e670587bc 100644
--- a/libs/ui/canvas/kis_guides_manager.h
+++ b/libs/ui/canvas/kis_guides_manager.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_GUIDES_MANAGER_H
#define __KIS_GUIDES_MANAGER_H
#include <QScopedPointer>
#include <QObject>
#include "kritaui_export.h"
class KisView;
class KisActionManager;
class KisCanvasDecoration;
class KisGuidesConfig;
class KRITAUI_EXPORT KisGuidesManager : public QObject
{
Q_OBJECT
public:
KisGuidesManager(QObject *parent = 0);
- ~KisGuidesManager();
+ ~KisGuidesManager() override;
void setup(KisActionManager *actionManager);
void setView(QPointer<KisView> view);
bool showGuides() const;
bool lockGuides() const;
bool snapToGuides() const;
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
Q_SIGNALS:
void sigRequestUpdateGuidesConfig(const KisGuidesConfig &config);
public Q_SLOTS:
void setGuidesConfig(const KisGuidesConfig &config);
void slotDocumentRequestedConfig(const KisGuidesConfig &config);
void setShowGuides(bool value);
void setLockGuides(bool value);
void setSnapToGuides(bool value);
void slotGuideCreationInProgress(Qt::Orientation orientation, const QPoint &globalPos);
void slotGuideCreationFinished(Qt::Orientation orientation, const QPoint &globalPos);
void slotShowSnapOptions();
void setSnapOrthogonal(bool value);
void setSnapNode(bool value);
void setSnapExtension(bool value);
void setSnapIntersection(bool value);
void setSnapBoundingBox(bool value);
void setSnapImageBounds(bool value);
void setSnapImageCenter(bool value);
void slotUploadConfigToDocument();
private:
void setGuidesConfigImpl(const KisGuidesConfig &value, bool emitModified = true);
void attachEventFilterImpl(bool value);
void syncActionsStatus();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_GUIDES_MANAGER_H */
diff --git a/libs/ui/canvas/kis_image_pyramid.h b/libs/ui/canvas/kis_image_pyramid.h
index d26cf33347..d81f816240 100644
--- a/libs/ui/canvas/kis_image_pyramid.h
+++ b/libs/ui/canvas/kis_image_pyramid.h
@@ -1,144 +1,144 @@
/*
* Copyright (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_IMAGE_PYRAMID
#define __KIS_IMAGE_PYRAMID
#include <QImage>
#include <QVector>
#include <QThreadStorage>
#include <KoColorSpace.h>
#include <kis_image.h>
#include <kis_paint_device.h>
#include "kis_projection_backend.h"
class KisImagePyramid : QObject, public KisProjectionBackend
{
Q_OBJECT
public:
KisImagePyramid(qint32 pyramidHeight);
- virtual ~KisImagePyramid();
+ ~KisImagePyramid() override;
- void setImage(KisImageWSP newImage);
- void setImageSize(qint32 w, qint32 h);
- void setMonitorProfile(const KoColorProfile* monitorProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags);
- void setChannelFlags(const QBitArray &channelFlags);
- void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
- void updateCache(const QRect &dirtyImageRect);
- void recalculateCache(KisPPUpdateInfoSP info);
+ void setImage(KisImageWSP newImage) override;
+ void setImageSize(qint32 w, qint32 h) override;
+ void setMonitorProfile(const KoColorProfile* monitorProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) override;
+ void setChannelFlags(const QBitArray &channelFlags) override;
+ void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter) override;
+ void updateCache(const QRect &dirtyImageRect) override;
+ void recalculateCache(KisPPUpdateInfoSP info) override;
- KisImagePatch getNearestPatch(KisPPUpdateInfoSP info);
- void drawFromOriginalImage(QPainter& gc, KisPPUpdateInfoSP info);
+ KisImagePatch getNearestPatch(KisPPUpdateInfoSP info) override;
+ void drawFromOriginalImage(QPainter& gc, KisPPUpdateInfoSP info) override;
/**
* Render the projection onto a QImage.
* Color profiling occurs here
*/
QImage convertToQImage(qreal scale,
const QRect& unscaledRect,
enum Qt::TransformationMode transformMode);
QImage convertToQImage(qreal scale,
qint32 unscaledX,
qint32 unscaledY,
qint32 unscaledWidth,
qint32 unscaledHeight);
/**
* Draw the projection onto a QPainter.
* Color profiling accurs here
*/
void drawImage(qreal scale,
QPainter& gc,
const QPoint& topLeftScaled,
const QRect& unscaledSourceRect);
- void alignSourceRect(QRect& rect, qreal scale);
+ void alignSourceRect(QRect& rect, qreal scale) override;
private:
void retrieveImageData(const QRect &rect);
void rebuildPyramid();
void clearPyramid();
/**
* Downsamples @srcRect from @src paint device and writes
* result into proper place of @dst paint device
* Returns modified rect of @dst paintDevice
*/
QRect downsampleByFactor2(const QRect& srcRect,
KisPaintDevice* src, KisPaintDevice* dst);
/**
* Auxiliary function. Downsamples two lines in @srcRow0
* and @srcRow1 into one line @dstRow
* Note: @numSrcPixels must be EVEN
*/
void downsamplePixels(const quint8 *srcRow0, const quint8 *srcRow1,
quint8 *dstRow, qint32 numSrcPixels);
/**
* Searches for the last pyramid plane that can cover
* canvans on current zoom level
*/
int findFirstGoodPlaneIndex(qreal scale, QSize originalSize);
/**
* Fast workaround for converting paintDevices
*/
QImage convertToQImageFast(KisPaintDeviceSP paintDevice,
const QRect& unscaledRect);
private Q_SLOTS:
void configChanged();
private:
QVector<KisPaintDeviceSP> m_pyramid;
KisImageWSP m_originalImage;
const KoColorProfile* m_monitorProfile;
const KoColorSpace* m_monitorColorSpace;
QSharedPointer<KisDisplayFilter> m_displayFilter;
KoColorConversionTransformation::Intent m_renderingIntent;
KoColorConversionTransformation::ConversionFlags m_conversionFlags;
/**
* Number of planes inside pyramid
*/
qint32 m_pyramidHeight;
bool m_useOcio;
QBitArray m_channelFlags;
bool m_allChannelsSelected;
bool m_onlyOneChannelSelected;
int m_selectedChannelIndex;
};
#endif /* __KIS_IMAGE_PYRAMID */
diff --git a/libs/ui/canvas/kis_infinity_manager.h b/libs/ui/canvas/kis_infinity_manager.h
index ef25bebf75..cb7b5f99b0 100644
--- a/libs/ui/canvas/kis_infinity_manager.h
+++ b/libs/ui/canvas/kis_infinity_manager.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_INFINITY_MANAGER_H
#define __KIS_INFINITY_MANAGER_H
#include "kis_canvas_decoration.h"
#include <QPointer>
#include <QPainterPath>
#include <QCursor>
#include <kis_canvas2.h>
class KisView;
static const QString INFINITY_DECORATION_ID = "infinity-decorations";
class KRITAUI_EXPORT KisInfinityManager : public KisCanvasDecoration
{
Q_OBJECT
public:
KisInfinityManager(QPointer<KisView>view, KisCanvas2 *canvas);
protected:
- void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter, KisCanvas2 *canvas);
- bool eventFilter(QObject *obj, QEvent *event);
+ void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter *converter, KisCanvas2 *canvas) override;
+ bool eventFilter(QObject *obj, QEvent *event) override;
public Q_SLOTS:
void imagePositionChanged();
private:
enum Side {
Right = 0,
Bottom,
Left,
Top,
NSides
};
inline void addDecoration(const QRect &areaRect, const QPointF &handlePoint, qreal angle, Side side);
private:
QPainterPath m_decorationPath;
bool m_filteringEnabled;
bool m_cursorSwitched;
QCursor m_oldCursor;
QVector<QTransform> m_handleTransform;
QVector<QRect> m_sideRects;
QPointer<KisCanvas2> m_canvas;
};
#endif /* __KIS_INFINITY_MANAGER_H */
diff --git a/libs/ui/canvas/kis_mirror_axis.h b/libs/ui/canvas/kis_mirror_axis.h
index 5c5a3b0078..69d39b3976 100644
--- a/libs/ui/canvas/kis_mirror_axis.h
+++ b/libs/ui/canvas/kis_mirror_axis.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2014 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef KISMIRRORAXIS_H
#define KISMIRRORAXIS_H
#include "kis_canvas_decoration.h"
class KisView;
class KisCanvasResourceProvider;
class KisMirrorAxis : public KisCanvasDecoration
{
Q_OBJECT
Q_PROPERTY(float handleSize READ handleSize WRITE setHandleSize NOTIFY handleSizeChanged)
public:
KisMirrorAxis(KisCanvasResourceProvider* provider, QPointer<KisView> parent);
- ~KisMirrorAxis();
+ ~KisMirrorAxis() override;
float handleSize() const;
void setHandleSize(float newSize);
- void setVisible(bool v);
+ void setVisible(bool v) override;
Q_SIGNALS:
void handleSizeChanged();
protected:
- virtual void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas);
- virtual bool eventFilter(QObject* target, QEvent* event);
+ void drawDecoration(QPainter& gc, const QRectF& updateArea, const KisCoordinatesConverter* converter, KisCanvas2* canvas) override;
+ bool eventFilter(QObject* target, QEvent* event) override;
private:
class Private;
Private * const d;
private Q_SLOTS:
void mirrorModeChanged();
void moveHorizontalAxisToCenter();
void moveVerticalAxisToCenter();
};
#endif // KISMIRRORAXIS_H
diff --git a/libs/ui/canvas/kis_prescaled_projection.h b/libs/ui/canvas/kis_prescaled_projection.h
index 7bdfee359a..bed19900f2 100644
--- a/libs/ui/canvas/kis_prescaled_projection.h
+++ b/libs/ui/canvas/kis_prescaled_projection.h
@@ -1,180 +1,180 @@
/*
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESCALED_PROJECTION_H
#define KIS_PRESCALED_PROJECTION_H
#include <QObject>
#include <kritaui_export.h>
#include <kis_shared.h>
#include "KoColorConversionTransformation.h"
class QImage;
class QRect;
class QSize;
class QPainter;
class KoColorProfile;
class KisCoordinatesConverter;
class KisDisplayFilter;
#include <kis_types.h>
#include "kis_ui_types.h"
/**
* KisPrescaledProjection is responsible for keeping around a
* prescaled QImage representation that is always suitable for
* painting onto the canvas.
*
* Note: the export macro is only for the unittest.
*/
class KRITAUI_EXPORT KisPrescaledProjection : public QObject, public KisShared
{
Q_OBJECT
public:
KisPrescaledProjection();
- virtual ~KisPrescaledProjection();
+ ~KisPrescaledProjection() override;
void setImage(KisImageWSP image);
/**
* Return the prescaled QImage. The prescaled image is exactly as big as
* the canvas widget in pixels.
*/
QImage prescaledQImage() const;
void setCoordinatesConverter(KisCoordinatesConverter *coordinatesConverter);
public Q_SLOTS:
/**
* Retrieves image's data from KisImage object and updates
* internal cache
* @param dirtyImageRect the rect changed on the image
* @see recalculateCache
*/
KisUpdateInfoSP updateCache(const QRect &dirtyImageRect);
/**
* Updates the prescaled cache at current zoom level
* @param info update structure returned by updateCache
* @see updateCache
*/
void recalculateCache(KisUpdateInfoSP info);
/**
* Called whenever the configuration settings change.
*/
void updateSettings();
/**
* Called whenever the view widget needs to show a different part of
* the document
*/
void viewportMoved(const QPointF &offset);
/**
* Called whenever the size of the KisImage changes.
* It is a part of a complex update ritual, when the size
* fo the image changes. This method just resizes the storage
* for the image cache, it doesn't update any cached data.
*/
void slotImageSizeChanged(qint32 w, qint32 h);
/**
* Checks whether it is needed to resize the prescaled image and
* updates it. The size is given in canvas widget pixels.
*/
void notifyCanvasSizeChanged(const QSize &widgetSize);
void notifyZoomChanged();
/**
* Set the current monitor profile
*/
void setMonitorProfile(const KoColorProfile *monitorProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags);
void setChannelFlags(const QBitArray &channelFlags);
void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
/**
* Called whenever the zoom level changes or another chunk of the
* image becomes visible. The currently visible area of the image
* is complete scaled again.
*/
void preScale();
private:
friend class KisPrescaledProjectionTest;
KisPrescaledProjection(const KisPrescaledProjection &);
KisPrescaledProjection operator=(const KisPrescaledProjection &);
void updateViewportSize();
/**
* This creates an empty update information and fills it with the only
* parameter: @p dirtyImageRect
* This function is supposed to be run in the context of the image
* threads, so it does no accesses to zoom or any UI specific values.
* All the needed information for zooming will be fetched in the context
* of the UI thread in fillInUpdateInformation().
*
* @see fillInUpdateInformation()
*/
KisPPUpdateInfoSP getInitialUpdateInformation(const QRect &dirtyImageRect);
/**
* Prepare all the information about rects needed during
* projection updating.
*
* @param viewportRect the part of the viewport that has to be updated
* @param info the structure to be filled in. It's member dirtyImageRect
* is supposed to have already been set up in the previous step of the
* update in getInitialUpdateInformation(). Though it is allowed to
* be null rect.
*
* @see getInitialUpdateInformation()
*/
void fillInUpdateInformation(const QRect &viewportRect,
KisPPUpdateInfoSP info);
/**
* Initiates the process of prescaled image update
*
* @param info prepared information
*/
void updateScaledImage(KisPPUpdateInfoSP info);
/**
* Atual drawing is done here
* @param info prepared information
* @param gc The painter we draw on
*/
void drawUsingBackend(QPainter &gc, KisPPUpdateInfoSP info);
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/canvas/kis_qpainter_canvas.h b/libs/ui/canvas/kis_qpainter_canvas.h
index 128f34562a..f4812de554 100644
--- a/libs/ui/canvas/kis_qpainter_canvas.h
+++ b/libs/ui/canvas/kis_qpainter_canvas.h
@@ -1,95 +1,95 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
* Copyright (C) Lukáš Tvrdý <lukast.dev@gmail.com>, (C) 2009
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_QPAINTER_CANVAS_H
#define KIS_QPAINTER_CANVAS_H
#include <QWidget>
#include "kis_canvas_widget_base.h"
#include "kis_ui_types.h"
class QPaintEvent;
class KisCanvas2;
class KisDisplayColorConverter;
/**
*
* KisQPainterCanvas is the widget that shows the actual image using arthur.
*
* NOTE: if you change something in the event handling here, also change it
* in the opengl canvas.
*
* @author Boudewijn Rempt <boud@valdyas.org>
*/
class KisQPainterCanvas : public QWidget, public KisCanvasWidgetBase
{
Q_OBJECT
public:
KisQPainterCanvas(KisCanvas2 * canvas, KisCoordinatesConverter *coordinatesConverter, QWidget * parent);
- virtual ~KisQPainterCanvas();
+ ~KisQPainterCanvas() override;
void setPrescaledProjection(KisPrescaledProjectionSP prescaledProjection);
public: // QWidget overrides
- void paintEvent(QPaintEvent * ev);
+ void paintEvent(QPaintEvent * ev) override;
- void resizeEvent(QResizeEvent *e);
+ void resizeEvent(QResizeEvent *e) override;
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
- virtual void inputMethodEvent(QInputMethodEvent *event);
+ void inputMethodEvent(QInputMethodEvent *event) override;
public: // Implement kis_abstract_canvas_widget interface
- void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
- void setWrapAroundViewingMode(bool value);
- void channelSelectionChanged(const QBitArray &channelFlags);
- void setDisplayProfile(KisDisplayColorConverter *colorConverter);
- void finishResizingImage(qint32 w, qint32 h);
- KisUpdateInfoSP startUpdateCanvasProjection(const QRect & rc, const QBitArray &channelFlags);
- QRect updateCanvasProjection(KisUpdateInfoSP info);
-
- QWidget * widget() {
+ void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter) override;
+ void setWrapAroundViewingMode(bool value) override;
+ void channelSelectionChanged(const QBitArray &channelFlags) override;
+ void setDisplayProfile(KisDisplayColorConverter *colorConverter) override;
+ void finishResizingImage(qint32 w, qint32 h) override;
+ KisUpdateInfoSP startUpdateCanvasProjection(const QRect & rc, const QBitArray &channelFlags) override;
+ QRect updateCanvasProjection(KisUpdateInfoSP info) override;
+
+ QWidget * widget() override {
return this;
}
- bool isBusy() const {
+ bool isBusy() const override {
return false;
}
protected: // KisCanvasWidgetBase
- virtual bool callFocusNextPrevChild(bool next);
+ bool callFocusNextPrevChild(bool next) override;
protected:
virtual void drawImage(QPainter & gc, const QRect &updateWidgetRect) const;
private Q_SLOTS:
void slotConfigChanged();
private:
class Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/canvas/kis_snap_line_strategy.h b/libs/ui/canvas/kis_snap_line_strategy.h
index b3a7454bce..d17c3be00e 100644
--- a/libs/ui/canvas/kis_snap_line_strategy.h
+++ b/libs/ui/canvas/kis_snap_line_strategy.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SNAP_LINE_STRATEGY_H
#define __KIS_SNAP_LINE_STRATEGY_H
#include <QScopedPointer>
#include "KoSnapStrategy.h"
class KisSnapLineStrategy : public KoSnapStrategy
{
public:
KisSnapLineStrategy(KoSnapGuide::Strategy type = KoSnapGuide::CustomSnapping);
- ~KisSnapLineStrategy();
+ ~KisSnapLineStrategy() override;
- bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance);
- QPainterPath decoration(const KoViewConverter &converter) const;
+ bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
+ QPainterPath decoration(const KoViewConverter &converter) const override;
void addLine(Qt::Orientation orientation, qreal pos);
void setHorizontalLines(const QList<qreal> &lines);
void setVerticalLines(const QList<qreal> &lines);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_SNAP_LINE_STRATEGY_H */
diff --git a/libs/ui/canvas/kis_tool_proxy.h b/libs/ui/canvas/kis_tool_proxy.h
index 97f7dfee84..0903bc924c 100644
--- a/libs/ui/canvas/kis_tool_proxy.h
+++ b/libs/ui/canvas/kis_tool_proxy.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_PROXY_H
#define __KIS_TOOL_PROXY_H
#include <KoToolProxy.h>
#include <kis_tool.h>
class KisToolProxy : public KoToolProxy
{
public:
enum ActionState {
BEGIN, /**< Beginning an action */
CONTINUE, /**< Continuing an action */
END /**< Ending an action */
};
public:
KisToolProxy(KoCanvasBase *canvas, QObject *parent = 0);
void initializeImage(KisImageSP image);
void forwardHoverEvent(QEvent *event);
/**
* Forwards the event to the active tool and returns true if the
* event was not ignored. That is by default the event is
* considered accepted, but the tool can explicitly ignore it.
* @param state beginning, continuing, or ending the action.
* @param action alternate tool action requested.
* @param event the event being sent to the tool by the AbstractInputAction.
* @param originalEvent the original event received by the AbstractInputAction.
*/
bool forwardEvent(ActionState state, KisTool::ToolAction action, QEvent *event, QEvent *originalEvent);
bool primaryActionSupportsHiResEvents() const;
- void setActiveTool(KoToolBase *tool);
+ void setActiveTool(KoToolBase *tool) override;
void activateToolAction(KisTool::ToolAction action);
void deactivateToolAction(KisTool::ToolAction action);
private:
KoPointerEvent convertEventToPointerEvent(QEvent *event, const QPointF &docPoint, bool *result);
QPointF tabletToDocument(const QPointF &globalPos);
void forwardToTool(ActionState state, KisTool::ToolAction action, QEvent *event, const QPointF &docPoint);
protected:
- QPointF widgetToDocument(const QPointF &widgetPoint) const;
+ QPointF widgetToDocument(const QPointF &widgetPoint) const override;
private:
bool m_isActionActivated;
KisTool::ToolAction m_lastAction;
};
#endif /* __KIS_TOOL_PROXY_H */
diff --git a/libs/ui/canvas/kis_update_info.h b/libs/ui/canvas/kis_update_info.h
index c62ef274e8..2106518168 100644
--- a/libs/ui/canvas/kis_update_info.h
+++ b/libs/ui/canvas/kis_update_info.h
@@ -1,147 +1,147 @@
/*
* Copyright (c) 2010, Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_UPDATE_INFO_H_
#define KIS_UPDATE_INFO_H_
#include <QPainter>
#include "kis_image_patch.h"
#include "kis_shared.h"
#include "kritaui_export.h"
#include "opengl/kis_texture_tile_update_info.h"
#include "kis_ui_types.h"
class KRITAUI_EXPORT KisUpdateInfo : public KisShared
{
public:
KisUpdateInfo();
virtual ~KisUpdateInfo();
virtual QRect dirtyViewportRect();
virtual QRect dirtyImageRect() const = 0;
virtual int levelOfDetail() const = 0;
};
Q_DECLARE_METATYPE(KisUpdateInfoSP)
struct ConversionOptions {
ConversionOptions() : m_needsConversion(false) {}
ConversionOptions(const KoColorSpace *destinationColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
KoColorConversionTransformation::ConversionFlags conversionFlags)
: m_needsConversion(true),
m_destinationColorSpace(destinationColorSpace),
m_renderingIntent(renderingIntent),
m_conversionFlags(conversionFlags)
{
}
bool m_needsConversion;
const KoColorSpace *m_destinationColorSpace;
KoColorConversionTransformation::Intent m_renderingIntent;
KoColorConversionTransformation::ConversionFlags m_conversionFlags;
};
class KisOpenGLUpdateInfo;
typedef KisSharedPtr<KisOpenGLUpdateInfo> KisOpenGLUpdateInfoSP;
class KisOpenGLUpdateInfo : public KisUpdateInfo
{
public:
KisOpenGLUpdateInfo(ConversionOptions options);
KisTextureTileUpdateInfoSPList tileList;
- QRect dirtyViewportRect();
- QRect dirtyImageRect() const;
+ QRect dirtyViewportRect() override;
+ QRect dirtyImageRect() const override;
void assignDirtyImageRect(const QRect &rect);
void assignLevelOfDetail(int lod);
bool needsConversion() const;
void convertColorSpace();
- int levelOfDetail() const;
+ int levelOfDetail() const override;
private:
QRect m_dirtyImageRect;
ConversionOptions m_options;
int m_levelOfDetail;
};
class KisPPUpdateInfo : public KisUpdateInfo
{
public:
enum TransferType {
DIRECT,
PATCH
};
- QRect dirtyViewportRect();
- QRect dirtyImageRect() const;
- int levelOfDetail() const;
+ QRect dirtyViewportRect() override;
+ QRect dirtyImageRect() const override;
+ int levelOfDetail() const override;
/**
* The rect that was reported by KisImage as dirty
*/
QRect dirtyImageRectVar;
/**
* Rect of KisImage corresponding to @viewportRect.
* It is cropped and aligned corresponding to the canvas.
*/
QRect imageRect;
/**
* Rect of canvas widget corresponding to @imageRect
*/
QRectF viewportRect;
qreal scaleX;
qreal scaleY;
/**
* Defines the way the source image is painted onto
* prescaled QImage
*/
TransferType transfer;
/**
* Render hints for painting the direct painting/patch painting
*/
QPainter::RenderHints renderHints;
/**
* The number of additional pixels those should be added
* to the patch
*/
qint32 borderWidth;
/**
* Used for temporary sorage of KisImage's data
* by KisProjectionCache
*/
KisImagePatch patch;
};
#endif /* KIS_UPDATE_INFO_H_ */
diff --git a/libs/ui/dialogs/KisAnimationCacheUpdateProgressDialog.h b/libs/ui/dialogs/KisAnimationCacheUpdateProgressDialog.h
index 5505d3953b..342f19778c 100644
--- a/libs/ui/dialogs/KisAnimationCacheUpdateProgressDialog.h
+++ b/libs/ui/dialogs/KisAnimationCacheUpdateProgressDialog.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISANIMATIONCACHEUPDATEPROGRESSDIALOG_H
#define KISANIMATIONCACHEUPDATEPROGRESSDIALOG_H
#include <QObject>
#include <QScopedPointer>
#include "kis_types.h"
class KisTimeRange;
class KisViewManager;
class KisAnimationCacheUpdateProgressDialog : public QObject
{
Q_OBJECT
public:
explicit KisAnimationCacheUpdateProgressDialog(int busyWait = 200, QWidget *parent = 0);
- ~KisAnimationCacheUpdateProgressDialog();
+ ~KisAnimationCacheUpdateProgressDialog() override;
void regenerateRange(KisAnimationFrameCacheSP cache, const KisTimeRange &playbackRange, KisViewManager *viewManager);
Q_SIGNALS:
public Q_SLOTS:
void slotFrameFinished();
void slotFrameCancelled();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KISANIMATIONCACHEUPDATEPROGRESSDIALOG_H
diff --git a/libs/ui/dialogs/kis_delayed_save_dialog.h b/libs/ui/dialogs/kis_delayed_save_dialog.h
index f6c7c19c93..dfe94f20ad 100644
--- a/libs/ui/dialogs/kis_delayed_save_dialog.h
+++ b/libs/ui/dialogs/kis_delayed_save_dialog.h
@@ -1,66 +1,66 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DELAYED_SAVE_DIALOG_H
#define KIS_DELAYED_SAVE_DIALOG_H
#include <QDialog>
#include <QScopedPointer>
#include "kis_types.h"
namespace Ui {
class KisDelayedSaveDialog;
}
class KisDelayedSaveDialog : public QDialog
{
Q_OBJECT
public:
enum ResultType {
Rejected = QDialog::Rejected,
Accepted = QDialog::Accepted,
Ignored = 2
};
enum Type {
SaveDialog,
GeneralDialog,
ForcedDialog
};
public:
explicit KisDelayedSaveDialog(KisImageSP image, Type type, int busyWait, QWidget *parent = 0);
- ~KisDelayedSaveDialog();
+ ~KisDelayedSaveDialog() override;
void blockIfImageIsBusy();
private Q_SLOTS:
void slotTimerTimeout();
void slotCancelRequested();
void slotIgnoreRequested();
private:
Ui::KisDelayedSaveDialog *ui;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KIS_DELAYED_SAVE_DIALOG_H
diff --git a/libs/ui/dialogs/kis_dlg_adjustment_layer.h b/libs/ui/dialogs/kis_dlg_adjustment_layer.h
index 69f6651445..8c583f533f 100644
--- a/libs/ui/dialogs/kis_dlg_adjustment_layer.h
+++ b/libs/ui/dialogs/kis_dlg_adjustment_layer.h
@@ -1,79 +1,79 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISDLGAdjustMENTLAYER_H
#define KISDLGAdjustMENTLAYER_H
#include <KoDialog.h>
#include <QLabel>
class KisFilterConfiguration;
class KisNodeFilterInterface;
class KisViewManager;
#include "kis_types.h"
#include "ui_wdgfilternodecreation.h"
/**
* Create a new adjustment layer.
*/
class KisDlgAdjustmentLayer : public KoDialog
{
Q_OBJECT
public:
/**
* Create a new adjustmentlayer dialog
*
* @param layerName the name of the adjustment layer
* @param paintDevice the paint device that is used as source for the preview
* @param caption the caption for the dialog -- create or properties
* @param parent the widget parent of this dialog
* @param name the QObject name, if any
*/
KisDlgAdjustmentLayer(KisNodeSP node,
KisNodeFilterInterface* nfi,
KisPaintDeviceSP paintDevice,
const QString & layerName,
const QString & caption,
KisViewManager *view,
QWidget *parent = 0);
- ~KisDlgAdjustmentLayer();
+ ~KisDlgAdjustmentLayer() override;
KisFilterConfigurationSP filterConfiguration() const;
QString layerName() const;
public Q_SLOTS:
void adjustSize();
protected Q_SLOTS:
void slotNameChanged(const QString &);
void slotConfigChanged();
void slotFilterWidgetSizeChanged();
private:
KisNodeSP m_node;
KisNodeFilterInterface *m_nodeFilterInterface;
Ui::WdgFilterNodeCreation wdgFilterNodeCreation;
KisFilterConfigurationSP m_currentFilter;
bool m_customName;
QString m_layerName;
};
#endif
diff --git a/libs/ui/dialogs/kis_dlg_blacklist_cleanup.h b/libs/ui/dialogs/kis_dlg_blacklist_cleanup.h
index 9ce32c1ba5..8b66731778 100644
--- a/libs/ui/dialogs/kis_dlg_blacklist_cleanup.h
+++ b/libs/ui/dialogs/kis_dlg_blacklist_cleanup.h
@@ -1,34 +1,34 @@
/*
*
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DLG_BLACKLIST_CLEANUP_H
#define KIS_DLG_BLACKLIST_CLEANUP_H
#include <KoDialog.h>
#include <ui_wdgdlgblacklistcleanup.h>
class KisDlgBlacklistCleanup : public KoDialog, public Ui_WdgDisplayBlacklist
{
public:
KisDlgBlacklistCleanup();
- virtual void accept();
+ void accept() override;
};
#endif // KIS_DLG_BLACKLIST_CLEANUP_H
diff --git a/libs/ui/dialogs/kis_dlg_filter.h b/libs/ui/dialogs/kis_dlg_filter.h
index 9051fa83b9..65cb393984 100644
--- a/libs/ui/dialogs/kis_dlg_filter.h
+++ b/libs/ui/dialogs/kis_dlg_filter.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DLG_FILTER_H_
#define _KIS_DLG_FILTER_H_
#include <QDialog>
#include <kis_types.h>
class KisViewManager;
class KisFilterManager;
class KisDlgFilter : public QDialog
{
Q_OBJECT
public:
KisDlgFilter(KisViewManager *view, KisNodeSP node, KisFilterManager *filterManager, QWidget *parent = 0);
- ~KisDlgFilter();
+ ~KisDlgFilter() override;
void setFilter(KisFilterSP f);
protected Q_SLOTS:
void slotOnAccept();
void slotOnReject();
void createMask();
void enablePreviewToggled(bool state);
void filterSelectionChanged();
- virtual void resizeEvent(QResizeEvent* );
+ void resizeEvent(QResizeEvent* ) override;
public Q_SLOTS:
void adjustSize();
private:
void startApplyingFilter(KisFilterConfigurationSP config);
void setDialogTitle(KisFilterSP f);
void updatePreview();
private Q_SLOTS:
void slotFilterWidgetSizeChanged();
private:
struct Private;
KisDlgFilter::Private* const d;
};
#endif
diff --git a/libs/ui/dialogs/kis_dlg_image_properties.h b/libs/ui/dialogs/kis_dlg_image_properties.h
index 4c35e89328..1c9c50e26f 100644
--- a/libs/ui/dialogs/kis_dlg_image_properties.h
+++ b/libs/ui/dialogs/kis_dlg_image_properties.h
@@ -1,65 +1,65 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DLG_IMAGE_PROPERTIES_H_
#define KIS_DLG_IMAGE_PROPERTIES_H_
#include <KoDialog.h>
#include "KisProofingConfiguration.h"
#include <kis_types.h>
#include "ui_wdgimageproperties.h"
class KoColorSpace;
class WdgImageProperties : public QWidget, public Ui::WdgImageProperties
{
Q_OBJECT
public:
WdgImageProperties(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KisDlgImageProperties : public KoDialog
{
Q_OBJECT
public:
KisDlgImageProperties(KisImageWSP image,
QWidget *parent = 0,
const char *name = 0);
- virtual ~KisDlgImageProperties();
+ ~KisDlgImageProperties() override;
const KoColorSpace * colorSpace();
private Q_SLOTS:
void setAnnotation(const QString& type);
void setCurrentColor();
void setProofingConfig();
private:
WdgImageProperties * m_page;
KisImageWSP m_image;
KisProofingConfigurationSP m_proofingConfig;
};
#endif // KIS_DLG_IMAGE_PROPERTIES_H_
diff --git a/libs/ui/dialogs/kis_dlg_internal_color_selector.h b/libs/ui/dialogs/kis_dlg_internal_color_selector.h
index a7e3672e25..682f28263e 100644
--- a/libs/ui/dialogs/kis_dlg_internal_color_selector.h
+++ b/libs/ui/dialogs/kis_dlg_internal_color_selector.h
@@ -1,177 +1,177 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINTERNALCOLORSELECTOR_H
#define KISINTERNALCOLORSELECTOR_H
#include "kritaui_export.h"
#include "KoColor.h"
#include "KoColorSpace.h"
#include "KoColorDisplayRendererInterface.h"
#include <QScopedPointer>
#include "ui_wdgdlginternalcolorselector.h"
/**
* @brief The KisInternalColorSelector class
*
* A non-modal color selector dialog that is not a plugin and can thus be used for filters.
*/
class KRITAUI_EXPORT KisDlgInternalColorSelector : public QDialog
{
Q_OBJECT
public:
struct Config
{
Config() :
modal(true),
visualColorSelector(true),
paletteBox(true),
screenColorPicker(true),
prevNextButtons(true),
hexInput(true),
useAlpha(false){}
bool modal;
bool visualColorSelector;
bool paletteBox;
bool screenColorPicker;
bool prevNextButtons;
bool hexInput;
bool useAlpha;
};
KisDlgInternalColorSelector(QWidget* parent, KoColor color, Config config, const QString &caption, const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
- ~KisDlgInternalColorSelector();
+ ~KisDlgInternalColorSelector() override;
/**
* @brief slotColorSpaceChanged
* Color space has changed, use this dialog to change the colorspace.
*/
void colorSpaceChanged(const KoColorSpace *cs);
/**
* @brief lockUsedColorSpace
* Lock the used colorspace of this selector.
* @param cs
*/
void lockUsedColorSpace(const KoColorSpace *cs);
/**
* @brief setDisplayRenderer
* Set the display renderer. This is necessary for HDR color manage support.
* @param displayRenderer
*/
void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer);
/**
* @brief getModalColorDialog
* Excecute this dialog modally. The function returns
* the KoColor you want.
* @param color - The current color. Make sure this is in the color space you want your
* end color to be in.
* @param chooseAlpha - Whether or not the alpha-choosing functionality should be used.
*/
static KoColor getModalColorDialog(const KoColor color, QWidget* parent = Q_NULLPTR, QString caption = QString());
/**
* @brief getCurrentColor
* @return gives currently active color;
*/
KoColor getCurrentColor();
void chooseAlpha(bool chooseAlpha);
Q_SIGNALS:
/**
* @brief signalForegroundColorChosen
* The most important signal. This will sent out when a color has been picked from the selector.
* There will be a small delay to make sure that the selector causes too many updates.
*
* Do not connect this to slotColorUpdated.
* @param color The new color chosen
*/
void signalForegroundColorChosen(KoColor color);
public Q_SLOTS:
/**
* @brief slotColorUpdated
* Very important slot. Is connected to krita's resources to make sure it has
* the currently active color. It's very important that this function is able to understand
* when the signal came from itself.
* @param newColor This is the new color.
*/
void slotColorUpdated(KoColor newColor);
/**
* @brief setPreviousColor
* set the previous color.
*/
void setPreviousColor(KoColor c);
private Q_SLOTS:
/**
* @brief slotLockSelector
* This slot will prevent the color from being updated.
*/
void slotLockSelector();
/**
* @brief slotConfigurationChanged
* Wrapper slot for changes to the colorspace.
*/
void slotConfigurationChanged();
void endUpdateWithNewColor();
/**
* @brief slotFinishUp
* This is called when the selector is closed, for saving the current palette.
*/
void slotFinishUp();
/**
* @brief slotSetColorFromPatch
* update current color from kocolorpatch.
* @param patch
*/
void slotSetColorFromPatch(KoColorPatch* patch);
/**
* @brief slotSetColorFromHex
* Update from the hex color input.
*/
void slotSetColorFromHex();
private:
Ui_WdgDlgInternalColorSelector *m_ui; //the UI
struct Private; //The private struct
const QScopedPointer<Private> m_d; //the private pointer
/**
* @brief updateAllElements
* Updates each widget with the new element, and if it's responsible for the update sents
* a signal out that there's a new color.
*/
void updateAllElements(QObject *source);
- virtual void focusInEvent(QFocusEvent *);
+ void focusInEvent(QFocusEvent *) override;
};
#endif // KISINTERNALCOLORSELECTOR_H
diff --git a/libs/ui/dialogs/kis_dlg_layer_properties.h b/libs/ui/dialogs/kis_dlg_layer_properties.h
index 8332e8fc43..2ba053f73c 100644
--- a/libs/ui/dialogs/kis_dlg_layer_properties.h
+++ b/libs/ui/dialogs/kis_dlg_layer_properties.h
@@ -1,86 +1,86 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DLG_LAYER_PROPERTIES_H_
#define KIS_DLG_LAYER_PROPERTIES_H_
#include <QList>
#include <QCheckBox>
#include <QScopedPointer>
#include "kis_types.h"
#include <KoDialog.h>
#include "ui_wdglayerproperties.h"
class QWidget;
class QBitArray;
class KisViewManager;
class KisDocument;
class WdgLayerProperties : public QWidget, public Ui::WdgLayerProperties
{
Q_OBJECT
public:
WdgLayerProperties(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* KisDlgLayerProperties is a dialogue for displaying and modifying information on a KisLayer.
* The dialog is non modal by default and uses a timer to check for user changes to the
* configuration, showing a preview of them.
*/
class KisDlgLayerProperties : public KoDialog
{
Q_OBJECT
public:
KisDlgLayerProperties(KisNodeList nodes, KisViewManager *view, QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0);
- virtual ~KisDlgLayerProperties();
+ ~KisDlgLayerProperties() override;
protected Q_SLOTS:
void updatePreview();
void slotCompositeOpValueChangedInternally();
void slotCompositeOpValueChangedExternally();
void slotColorLabelValueChangedInternally();
void slotColorLabelValueChangedExternally();
void slotOpacityValueChangedInternally();
void slotOpacityValueChangedExternally();
void slotNameValueChangedInternally();
void slotNameValueChangedExternally();
void slotPropertyValueChangedInternally();
void slotFlagsValueChangedInternally();
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif // KIS_DLG_LAYER_PROPERTIES_H_
diff --git a/libs/ui/dialogs/kis_dlg_layer_style.h b/libs/ui/dialogs/kis_dlg_layer_style.h
index 09b39a9d53..98a561e53b 100644
--- a/libs/ui/dialogs/kis_dlg_layer_style.h
+++ b/libs/ui/dialogs/kis_dlg_layer_style.h
@@ -1,323 +1,323 @@
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DLG_LAYER_STYLE_H
#define KIS_DLG_LAYER_STYLE_H
#include <QUuid>
#include <KoDialog.h>
#include "kis_types.h"
#include <psd.h>
#include "ui_wdglayerstyles.h"
#include "ui_wdgBevelAndEmboss.h"
#include "ui_wdgblendingoptions.h"
#include "ui_WdgColorOverlay.h"
#include "ui_wdgContour.h"
#include "ui_wdgdropshadow.h"
#include "ui_WdgGradientOverlay.h"
#include "ui_wdgInnerGlow.h"
#include "ui_WdgPatternOverlay.h"
#include "ui_WdgSatin.h"
#include "ui_WdgStroke.h"
#include "ui_wdgstylesselector.h"
#include "ui_wdgTexture.h"
#include <kis_psd_layer_style.h>
class QListWidgetItem;
class KisSignalCompressor;
class KisCanvasResourceProvider;
class Contour : public QWidget {
Q_OBJECT
public:
Contour(QWidget *parent);
Ui::WdgContour ui;
};
class Texture : public QWidget {
Q_OBJECT
public:
Texture(QWidget *parent);
Ui::WdgTexture ui;
};
class BevelAndEmboss : public QWidget {
Q_OBJECT
public:
BevelAndEmboss(Contour *contour, Texture *texture, QWidget *parent);
void setBevelAndEmboss(const psd_layer_effects_bevel_emboss *bevelAndEmboss);
void fetchBevelAndEmboss(psd_layer_effects_bevel_emboss *bevelAndEmboss) const;
private Q_SLOTS:
void slotDialAngleChanged(int value);
void slotIntAngleChanged(int value);
void slotGlobalLightToggled();
Q_SIGNALS:
void configChanged();
void globalAngleChanged(int value);
private:
Contour *m_contour;
Texture *m_texture;
Ui::WdgBevelAndEmboss ui;
};
class BlendingOptions : public QWidget {
Q_OBJECT
public:
BlendingOptions(QWidget *parent);
Q_SIGNALS:
void configChanged();
private:
Ui::WdgBlendingOptions ui;
};
class ColorOverlay : public QWidget {
Q_OBJECT
public:
ColorOverlay(QWidget *parent);
void setColorOverlay(const psd_layer_effects_color_overlay *colorOverlay);
void fetchColorOverlay(psd_layer_effects_color_overlay *colorOverlay) const;
Q_SIGNALS:
void configChanged();
private:
Ui::WdgColorOverlay ui;
};
class DropShadow : public QWidget {
Q_OBJECT
public:
enum Mode {
DropShadowMode,
InnerShadowMode
};
public:
DropShadow(Mode mode, QWidget *parent);
void setShadow(const psd_layer_effects_shadow_common *shadow);
void fetchShadow(psd_layer_effects_shadow_common *shadow) const;
private Q_SLOTS:
void slotDialAngleChanged(int value);
void slotIntAngleChanged(int value);
void slotGlobalLightToggled();
Q_SIGNALS:
void configChanged();
void globalAngleChanged(int value);
private:
Ui::WdgDropShadow ui;
Mode m_mode;
};
class GradientOverlay : public QWidget {
Q_OBJECT
public:
GradientOverlay(KisCanvasResourceProvider *resourceProvider, QWidget *parent);
void setGradientOverlay(const psd_layer_effects_gradient_overlay *gradient);
void fetchGradientOverlay(psd_layer_effects_gradient_overlay *gradient) const;
private Q_SLOTS:
void slotDialAngleChanged(int value);
void slotIntAngleChanged(int value);
Q_SIGNALS:
void configChanged();
private:
Ui::WdgGradientOverlay ui;
KisCanvasResourceProvider *m_resourceProvider;
};
class InnerGlow : public QWidget {
Q_OBJECT
public:
enum Mode {
InnerGlowMode = 0,
OuterGlowMode
};
public:
InnerGlow(Mode mode, KisCanvasResourceProvider *resourceProvider, QWidget *parent);
void setConfig(const psd_layer_effects_glow_common *innerGlow);
void fetchConfig(psd_layer_effects_glow_common *innerGlow) const;
Q_SIGNALS:
void configChanged();
private:
Ui::WdgInnerGlow ui;
Mode m_mode;
KisCanvasResourceProvider *m_resourceProvider;
};
class PatternOverlay : public QWidget {
Q_OBJECT
public:
PatternOverlay(QWidget *parent);
void setPatternOverlay(const psd_layer_effects_pattern_overlay *pattern);
void fetchPatternOverlay(psd_layer_effects_pattern_overlay *pattern) const;
Q_SIGNALS:
void configChanged();
private:
Ui::WdgPatternOverlay ui;
};
class Satin : public QWidget {
Q_OBJECT
public:
Satin(QWidget *parent);
void setSatin(const psd_layer_effects_satin *satin);
void fetchSatin(psd_layer_effects_satin *satin) const;
private Q_SLOTS:
void slotDialAngleChanged(int value);
void slotIntAngleChanged(int value);
Q_SIGNALS:
void configChanged();
private:
Ui::WdgSatin ui;
};
class Stroke : public QWidget {
Q_OBJECT
public:
Stroke(KisCanvasResourceProvider *resourceProvider, QWidget *parent);
void setStroke(const psd_layer_effects_stroke *stroke);
void fetchStroke(psd_layer_effects_stroke *stroke) const;
private Q_SLOTS:
void slotDialAngleChanged(int value);
void slotIntAngleChanged(int value);
Q_SIGNALS:
void configChanged();
private:
Ui::WdgStroke ui;
KisCanvasResourceProvider *m_resourceProvider;
};
class StylesSelector : public QWidget {
Q_OBJECT
public:
StylesSelector(QWidget *parent);
void notifyExternalStyleChanged(const QString &name, const QUuid &uuid);
void addNewStyle(KisPSDLayerStyleSP style);
void loadCollection(const QString &fileName);
private Q_SLOTS:
void loadStyles(const QString &name);
void selectStyle(QListWidgetItem *previous, QListWidgetItem* current);
Q_SIGNALS:
void styleSelected(KisPSDLayerStyleSP style);
private:
void refillCollections();
private:
Ui::WdgStylesSelector ui;
};
class KisDlgLayerStyle : public KoDialog
{
Q_OBJECT
public:
explicit KisDlgLayerStyle(KisPSDLayerStyleSP layerStyle, KisCanvasResourceProvider *resourceProvider, QWidget *parent = 0);
- ~KisDlgLayerStyle();
+ ~KisDlgLayerStyle() override;
KisPSDLayerStyleSP style() const;
Q_SIGNALS:
void configChanged();
public Q_SLOTS:
void slotMasterFxSwitchChanged(bool value);
void syncGlobalAngle(int angle);
void notifyGuiConfigChanged();
void notifyPredefinedStyleSelected(KisPSDLayerStyleSP style);
void changePage(QListWidgetItem *, QListWidgetItem*);
void slotNotifyOnAccept();
void slotNotifyOnReject();
// Sets all the widgets to the contents of the given style
void setStyle(KisPSDLayerStyleSP style);
void slotLoadStyle();
void slotSaveStyle();
void slotNewStyle();
private:
KisPSDLayerStyleSP m_layerStyle;
KisPSDLayerStyleSP m_initialLayerStyle;
Ui::WdgStylesDialog wdgLayerStyles;
BevelAndEmboss *m_bevelAndEmboss;
BlendingOptions *m_blendingOptions;
ColorOverlay *m_colorOverlay;
Contour *m_contour;
DropShadow *m_dropShadow;
GradientOverlay *m_gradientOverlay;
InnerGlow *m_innerGlow;
DropShadow *m_innerShadow;
InnerGlow *m_outerGlow;
PatternOverlay * m_patternOverlay;
Satin *m_satin;
Stroke *m_stroke;
StylesSelector *m_stylesSelector;
Texture *m_texture;
KisSignalCompressor *m_configChangedCompressor;
bool m_isSwitchingPredefinedStyle;
/**
* Used for debugging purposes only to track if m_layerStyle is in
* sync with what is stored in the GUI
*/
mutable bool m_sanityLayerStyleDirty;
};
#endif // KIS_DLG_LAYER_STYLE_H
diff --git a/libs/ui/dialogs/kis_dlg_png_import.cpp b/libs/ui/dialogs/kis_dlg_png_import.cpp
index 0b9c5de286..b976b60090 100644
--- a/libs/ui/dialogs/kis_dlg_png_import.cpp
+++ b/libs/ui/dialogs/kis_dlg_png_import.cpp
@@ -1,67 +1,64 @@
/*
* Copyright (C) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kis_dlg_png_import.h"
#include <QLabel>
#include <KoColorProfile.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceEngine.h>
#include <KoID.h>
#include "widgets/squeezedcombobox.h"
#include "kis_config.h"
KisDlgPngImport::KisDlgPngImport(const QString &path, const QString &colorModelID, const QString &colorDepthID, QWidget *parent)
: KoDialog(parent)
{
setButtons(Ok);
setDefaultButton(Ok);
QWidget *page = new QWidget(this);
dlgWidget.setupUi(page);
setMainWidget(page);
dlgWidget.lblFilename->setText(path);
- QString s = KoColorSpaceRegistry::instance()->colorSpaceId(colorModelID, colorDepthID);
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(colorModelID, colorDepthID);
dlgWidget.cmbProfile->clear();
- const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s);
- if (csf) {
- QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
- QStringList profileNames;
- Q_FOREACH (const KoColorProfile *profile, profileList) {
- profileNames.append(profile->name());
- }
- qSort(profileNames);
- Q_FOREACH (QString stringName, profileNames) {
- dlgWidget.cmbProfile->addSqueezedItem(stringName);
- }
- KisConfig cfg;
- QString profile = cfg.readEntry<QString>("pngImportProfile", csf->defaultProfile());
- dlgWidget.cmbProfile->setCurrent(profile);
+ QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId);
+ QStringList profileNames;
+ Q_FOREACH (const KoColorProfile *profile, profileList) {
+ profileNames.append(profile->name());
}
+ qSort(profileNames);
+ Q_FOREACH (QString stringName, profileNames) {
+ dlgWidget.cmbProfile->addSqueezedItem(stringName);
+ }
+ KisConfig cfg;
+ QString profile = cfg.readEntry<QString>("pngImportProfile", KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId));
+ dlgWidget.cmbProfile->setCurrent(profile);
}
QString KisDlgPngImport::profile() const
{
QString p = dlgWidget.cmbProfile->itemHighlighted();
KisConfig cfg;
cfg.writeEntry("pngImportProfile", p);
return p;
}
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index 4b72ddc9d1..5cac7e5ea1 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -1,1128 +1,1123 @@
/*
* preferencesdlg.cc - part of KImageShop
*
* Copyright (c) 1999 Michael Koch <koch@kde.org>
* Copyright (c) 2003-2011 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_dlg_preferences.h"
#include <opengl/kis_opengl.h>
#include <QBitmap>
#include <QCheckBox>
#include <QCursor>
#include <QLabel>
#include <QLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QSlider>
#include <QToolButton>
#include <QThread>
#include <QDesktopServices>
#include <QGridLayout>
#include <QRadioButton>
#include <QGroupBox>
#include <QMdiArea>
#include <QMessageBox>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QFormLayout>
#include <QSettings>
#include <KisDocument.h>
#include <KoColorProfile.h>
#include <KisApplication.h>
#include <KoFileDialog.h>
#include <KisPart.h>
#include <KoColorSpaceEngine.h>
#include <kis_icon.h>
#include <KoConfig.h>
#include "KoID.h"
#include <KoConfigAuthorPage.h>
#include <KoVBox.h>
#include <klocalizedstring.h>
#include <kundo2stack.h>
#include <KoResourcePaths.h>
#include "kis_action_registry.h"
#include "widgets/squeezedcombobox.h"
#include "kis_clipboard.h"
#include "widgets/kis_cmb_idlist.h"
#include "KoColorSpace.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorConversionTransformation.h"
#include "kis_cursor.h"
#include "kis_config.h"
#include "kis_canvas_resource_provider.h"
#include "kis_preference_set_registry.h"
#include "kis_color_manager.h"
#include "KisProofingConfiguration.h"
#include "kis_image_config.h"
#include "slider_and_spin_box_sync.h"
// for the performance update
#include <kis_cubic_curve.h>
#include "input/config/kis_input_configuration_page.h"
GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
: WdgGeneralSettings(_parent, _name)
{
KisConfig cfg;
m_cmbCursorShape->addItem(i18n("No Cursor"));
m_cmbCursorShape->addItem(i18n("Tool Icon"));
m_cmbCursorShape->addItem(i18n("Arrow"));
m_cmbCursorShape->addItem(i18n("Small Circle"));
m_cmbCursorShape->addItem(i18n("Crosshair"));
m_cmbCursorShape->addItem(i18n("Triangle Righthanded"));
m_cmbCursorShape->addItem(i18n("Triangle Lefthanded"));
m_cmbCursorShape->addItem(i18n("Black Pixel"));
m_cmbCursorShape->addItem(i18n("White Pixel"));
m_cmbOutlineShape->addItem(i18n("No Outline"));
m_cmbOutlineShape->addItem(i18n("Circle Outline"));
m_cmbOutlineShape->addItem(i18n("Preview Outline"));
m_cmbOutlineShape->addItem(i18n("Tilt Outline"));
m_cmbCursorShape->setCurrentIndex(cfg.newCursorStyle());
m_cmbOutlineShape->setCurrentIndex(cfg.newOutlineStyle());
chkShowRootLayer->setChecked(cfg.showRootLayer());
int autosaveInterval = cfg.autoSaveInterval();
//convert to minutes
m_autosaveSpinBox->setValue(autosaveInterval / 60);
m_autosaveCheckBox->setChecked(autosaveInterval > 0);
m_undoStackSize->setValue(cfg.undoStackLimit());
m_backupFileCheckBox->setChecked(cfg.backupFile());
m_showOutlinePainting->setChecked(cfg.showOutlineWhilePainting());
m_hideSplashScreen->setChecked(cfg.hideSplashScreen());
KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
m_chkNativeFileDialog->setChecked(!group.readEntry("DontUseNativeFileDialog", true));
intMaxBrushSize->setValue(cfg.readEntry("maximumBrushSize", 1000));
m_cmbMDIType->setCurrentIndex(cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView));
m_chkRubberBand->setChecked(cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
m_favoritePresetsSpinBox->setValue(cfg.favoritePresets());
KoColor mdiColor;
mdiColor.fromQColor(cfg.getMDIBackgroundColor());
m_mdiColor->setColor(mdiColor);
m_backgroundimage->setText(cfg.getMDIBackgroundImage());
m_chkCanvasMessages->setChecked(cfg.showCanvasMessages());
m_chkCompressKra->setChecked(cfg.compressKra());
const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
m_chkHiDPI->setChecked(kritarc.value("EnableHiDPI", false).toBool());
m_chkSingleApplication->setChecked(kritarc.value("EnableSingleApplication", true).toBool());
m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker());
m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt());
m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport());
m_chkCacheAnimatioInBackground->setChecked(cfg.calculateAnimationCacheInBackground());
connect(m_bnFileName, SIGNAL(clicked()), SLOT(getBackgroundImage()));
connect(clearBgImageButton, SIGNAL(clicked()), SLOT(clearBackgroundImage()));
}
void GeneralTab::setDefault()
{
KisConfig cfg;
m_cmbCursorShape->setCurrentIndex(cfg.newCursorStyle(true));
m_cmbOutlineShape->setCurrentIndex(cfg.newOutlineStyle(true));
chkShowRootLayer->setChecked(cfg.showRootLayer(true));
m_autosaveCheckBox->setChecked(cfg.autoSaveInterval(true) > 0);
//convert to minutes
m_autosaveSpinBox->setValue(cfg.autoSaveInterval(true) / 60);
m_undoStackSize->setValue(cfg.undoStackLimit(true));
m_backupFileCheckBox->setChecked(cfg.backupFile(true));
m_showOutlinePainting->setChecked(cfg.showOutlineWhilePainting(true));
m_hideSplashScreen->setChecked(cfg.hideSplashScreen(true));
m_chkNativeFileDialog->setChecked(false);
intMaxBrushSize->setValue(1000);
m_cmbMDIType->setCurrentIndex((int)QMdiArea::TabbedView);
m_chkRubberBand->setChecked(cfg.useOpenGL(true));
m_favoritePresetsSpinBox->setValue(cfg.favoritePresets(true));
KoColor mdiColor;
mdiColor.fromQColor(cfg.getMDIBackgroundColor(true));
m_mdiColor->setColor(mdiColor);
m_backgroundimage->setText(cfg.getMDIBackgroundImage(true));
m_chkCanvasMessages->setChecked(cfg.showCanvasMessages(true));
m_chkCompressKra->setChecked(cfg.compressKra(true));
m_chkHiDPI->setChecked(false);
m_chkSingleApplication->setChecked(true);
m_chkHiDPI->setChecked(true);
m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker(true));
m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt(true));
m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport(true));
m_chkCacheAnimatioInBackground->setChecked(cfg.calculateAnimationCacheInBackground(true));
}
CursorStyle GeneralTab::cursorStyle()
{
return (CursorStyle)m_cmbCursorShape->currentIndex();
}
OutlineStyle GeneralTab::outlineStyle()
{
return (OutlineStyle)m_cmbOutlineShape->currentIndex();
}
bool GeneralTab::showRootLayer()
{
return chkShowRootLayer->isChecked();
}
int GeneralTab::autoSaveInterval()
{
//convert to seconds
return m_autosaveCheckBox->isChecked() ? m_autosaveSpinBox->value() * 60 : 0;
}
int GeneralTab::undoStackSize()
{
return m_undoStackSize->value();
}
bool GeneralTab::showOutlineWhilePainting()
{
return m_showOutlinePainting->isChecked();
}
bool GeneralTab::hideSplashScreen()
{
return m_hideSplashScreen->isChecked();
}
int GeneralTab::mdiMode()
{
return m_cmbMDIType->currentIndex();
}
int GeneralTab::favoritePresets()
{
return m_favoritePresetsSpinBox->value();
}
bool GeneralTab::showCanvasMessages()
{
return m_chkCanvasMessages->isChecked();
}
bool GeneralTab::compressKra()
{
return m_chkCompressKra->isChecked();
}
bool GeneralTab::toolOptionsInDocker()
{
return m_radioToolOptionsInDocker->isChecked();
}
bool GeneralTab::switchSelectionCtrlAlt()
{
return m_chkSwitchSelectionCtrlAlt->isChecked();
}
bool GeneralTab::convertToImageColorspaceOnImport()
{
return m_chkConvertOnImport->isChecked();
}
bool GeneralTab::calculateAnimationCacheInBackground()
{
return m_chkCacheAnimatioInBackground->isChecked();
}
void GeneralTab::getBackgroundImage()
{
KoFileDialog dialog(this, KoFileDialog::OpenFile, "BackgroundImages");
dialog.setCaption(i18n("Select a Background Image"));
dialog.setDefaultDir(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
dialog.setImageFilters();
QString fn = dialog.filename();
// dialog box was canceled or somehow no file was selected
if (fn.isEmpty()) {
return;
}
QImage image(fn);
if (image.isNull()) {
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("%1 is not a valid image file!", fn));
}
else {
m_backgroundimage->setText(fn);
}
}
void GeneralTab::clearBackgroundImage()
{
// clearing the background image text will implicitly make the background color be used
m_backgroundimage->setText("");
}
#include "kactioncollection.h"
#include "KisActionsSnapshot.h"
ShortcutSettingsTab::ShortcutSettingsTab(QWidget *parent, const char *name)
: QWidget(parent)
{
setObjectName(name);
QGridLayout * l = new QGridLayout(this);
l->setMargin(0);
m_page = new WdgShortcutSettings(this);
l->addWidget(m_page, 0, 0);
m_snapshot.reset(new KisActionsSnapshot);
KActionCollection *collection =
KisPart::instance()->currentMainwindow()->actionCollection();
Q_FOREACH (QAction *action, collection->actions()) {
m_snapshot->addAction(action->objectName(), action);
}
QMap<QString, KActionCollection*> sortedCollections =
m_snapshot->actionCollections();
for (auto it = sortedCollections.constBegin(); it != sortedCollections.constEnd(); ++it) {
m_page->addCollection(it.value(), it.key());
}
}
ShortcutSettingsTab::~ShortcutSettingsTab()
{
}
void ShortcutSettingsTab::setDefault()
{
m_page->allDefault();
}
void ShortcutSettingsTab::saveChanges()
{
m_page->save();
KisActionRegistry::instance()->settingsPageSaved();
}
void ShortcutSettingsTab::cancelChanges()
{
m_page->undo();
}
ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
: QWidget(parent)
{
setObjectName(name);
// XXX: Make sure only profiles that fit the specified color model
// are shown in the profile combos
QGridLayout * l = new QGridLayout(this);
l->setMargin(0);
m_page = new WdgColorSettings(this);
l->addWidget(m_page, 0, 0);
KisConfig cfg;
m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile());
connect(m_page->chkUseSystemMonitorProfile, SIGNAL(toggled(bool)), this, SLOT(toggleAllowMonitorProfileSelection(bool)));
m_page->cmbWorkingColorSpace->setIDList(KoColorSpaceRegistry::instance()->listKeys());
m_page->cmbWorkingColorSpace->setCurrent(cfg.workingColorSpace());
m_page->bnAddColorProfile->setIcon(KisIconUtils::loadIcon("document-open"));
m_page->bnAddColorProfile->setToolTip( i18n("Open Color Profile") );
connect(m_page->bnAddColorProfile, SIGNAL(clicked()), SLOT(installProfile()));
QFormLayout *monitorProfileGrid = new QFormLayout(m_page->monitorprofileholder);
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
QLabel *lbl = new QLabel(i18nc("The number of the screen", "Screen %1:", i + 1));
m_monitorProfileLabels << lbl;
SqueezedComboBox *cmb = new SqueezedComboBox();
cmb->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
monitorProfileGrid->addRow(lbl, cmb);
m_monitorProfileWidgets << cmb;
}
refillMonitorProfiles(KoID("RGBA", ""));
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
}
}
m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation());
m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization());
KisImageConfig cfgImage;
KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
m_page->sldAdaptationState->setMaximum(20);
m_page->sldAdaptationState->setMinimum(0);
m_page->sldAdaptationState->setValue((int)proofingConfig->adaptationState*20);
//probably this should become the screenprofile?
KoColor ga(KoColorSpaceRegistry::instance()->rgb8());
ga.fromKoColor(proofingConfig->warningColor);
m_page->gamutAlarm->setColor(ga);
const KoColorSpace *proofingSpace = KoColorSpaceRegistry::instance()->colorSpace(proofingConfig->proofingModel,
proofingConfig->proofingDepth,
proofingConfig->proofingProfile);
if (proofingSpace) {
m_page->proofingSpaceSelector->setCurrentColorSpace(proofingSpace);
}
m_page->cmbProofingIntent->setCurrentIndex((int)proofingConfig->intent);
m_page->ckbProofBlackPoint->setChecked(proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_pasteBehaviourGroup.addButton(m_page->radioPasteWeb, PASTE_ASSUME_WEB);
m_pasteBehaviourGroup.addButton(m_page->radioPasteMonitor, PASTE_ASSUME_MONITOR);
m_pasteBehaviourGroup.addButton(m_page->radioPasteAsk, PASTE_ASK);
QAbstractButton *button = m_pasteBehaviourGroup.button(cfg.pasteBehaviour());
Q_ASSERT(button);
if (button) {
button->setChecked(true);
}
m_page->cmbMonitorIntent->setCurrentIndex(cfg.monitorRenderIntent());
toggleAllowMonitorProfileSelection(cfg.useSystemMonitorProfile());
}
void ColorSettingsTab::installProfile()
{
KoFileDialog dialog(this, KoFileDialog::OpenFiles, "OpenDocumentICC");
dialog.setCaption(i18n("Install Color Profiles"));
dialog.setDefaultDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
dialog.setMimeTypeFilters(QStringList() << "application/vnd.iccprofile", "application/vnd.iccprofile");
QStringList profileNames = dialog.filenames();
KoColorSpaceEngine *iccEngine = KoColorSpaceEngineRegistry::instance()->get("icc");
Q_ASSERT(iccEngine);
QString saveLocation = KoResourcePaths::saveLocation("icc_profiles");
Q_FOREACH (const QString &profileName, profileNames) {
if (!QFile::copy(profileName, saveLocation + QFileInfo(profileName).fileName())) {
qWarning() << "Could not install profile!" << saveLocation + QFileInfo(profileName).fileName();
continue;
}
iccEngine->addProfile(saveLocation + QFileInfo(profileName).fileName());
}
KisConfig cfg;
refillMonitorProfiles(KoID("RGBA", ""));
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
}
}
}
void ColorSettingsTab::toggleAllowMonitorProfileSelection(bool useSystemProfile)
{
if (useSystemProfile) {
KisConfig cfg;
QStringList devices = KisColorManager::instance()->devices();
if (devices.size() == QApplication::desktop()->screenCount()) {
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
m_monitorProfileWidgets[i]->clear();
QString monitorForScreen = cfg.monitorForScreen(i, devices[i]);
Q_FOREACH (const QString &device, devices) {
m_monitorProfileLabels[i]->setText(i18nc("The display/screen we got from Qt", "Screen %1:", i + 1));
m_monitorProfileWidgets[i]->addSqueezedItem(KisColorManager::instance()->deviceName(device), device);
if (devices[i] == monitorForScreen) {
m_monitorProfileWidgets[i]->setCurrentIndex(i);
}
}
}
}
}
else {
KisConfig cfg;
refillMonitorProfiles(KoID("RGBA", ""));
for(int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
}
}
}
}
void ColorSettingsTab::setDefault()
{
m_page->cmbWorkingColorSpace->setCurrent("RGBA");
refillMonitorProfiles(KoID("RGBA", ""));
KisConfig cfg;
KisImageConfig cfgImage;
KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
const KoColorSpace *proofingSpace = KoColorSpaceRegistry::instance()->colorSpace(proofingConfig->proofingModel,proofingConfig->proofingDepth,proofingConfig->proofingProfile);
if (proofingSpace) {
m_page->proofingSpaceSelector->setCurrentColorSpace(proofingSpace);
}
m_page->cmbProofingIntent->setCurrentIndex((int)proofingConfig->intent);
m_page->ckbProofBlackPoint->setChecked(proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
m_page->sldAdaptationState->setValue(0);
//probably this should become the screenprofile?
KoColor ga(KoColorSpaceRegistry::instance()->rgb8());
ga.fromKoColor(proofingConfig->warningColor);
m_page->gamutAlarm->setColor(ga);
m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation(true));
m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization(true));
m_page->cmbMonitorIntent->setCurrentIndex(cfg.monitorRenderIntent(true));
m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile(true));
QAbstractButton *button = m_pasteBehaviourGroup.button(cfg.pasteBehaviour(true));
Q_ASSERT(button);
if (button) {
button->setChecked(true);
}
}
-void ColorSettingsTab::refillMonitorProfiles(const KoID & s)
+void ColorSettingsTab::refillMonitorProfiles(const KoID & colorSpaceId)
{
- const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s.id());
-
for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
m_monitorProfileWidgets[i]->clear();
}
- if (!csf)
- return;
-
QMap<QString, const KoColorProfile *> profileList;
- Q_FOREACH(const KoColorProfile *profile, KoColorSpaceRegistry::instance()->profilesFor(csf)) {
+ Q_FOREACH(const KoColorProfile *profile, KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId.id())) {
profileList[profile->name()] = profile;
}
Q_FOREACH (const KoColorProfile *profile, profileList.values()) {
//qDebug() << "Profile" << profile->name() << profile->isSuitableForDisplay() << csf->defaultProfile();
if (profile->isSuitableForDisplay()) {
for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
m_monitorProfileWidgets[i]->addSqueezedItem(profile->name());
}
}
}
for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
m_monitorProfileLabels[i]->setText(i18nc("The number of the screen", "Screen %1:", i + 1));
- m_monitorProfileWidgets[i]->setCurrent(csf->defaultProfile());
+ m_monitorProfileWidgets[i]->setCurrent(KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId.id()));
}
}
//---------------------------------------------------------------------------------------------------
void TabletSettingsTab::setDefault()
{
KisCubicCurve curve;
curve.fromString(DEFAULT_CURVE_STRING);
m_page->pressureCurve->setCurve(curve);
}
TabletSettingsTab::TabletSettingsTab(QWidget* parent, const char* name): QWidget(parent)
{
setObjectName(name);
QGridLayout * l = new QGridLayout(this);
l->setMargin(0);
m_page = new WdgTabletSettings(this);
l->addWidget(m_page, 0, 0);
KisConfig cfg;
KisCubicCurve curve;
curve.fromString( cfg.pressureTabletCurve() );
m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
m_page->pressureCurve->setCurve(curve);
}
//---------------------------------------------------------------------------------------------------
#include "kis_acyclic_signal_connector.h"
int getTotalRAM() {
KisImageConfig cfg;
return cfg.totalRAM();
}
int PerformanceTab::realTilesRAM()
{
return intMemoryLimit->value() - intPoolLimit->value();
}
PerformanceTab::PerformanceTab(QWidget *parent, const char *name)
: WdgPerformanceSettings(parent, name)
{
KisImageConfig cfg;
const int totalRAM = cfg.totalRAM();
lblTotalMemory->setText(i18n("%1 MiB", totalRAM));
sliderMemoryLimit->setSuffix(i18n(" %"));
sliderMemoryLimit->setRange(1, 100, 2);
sliderMemoryLimit->setSingleStep(0.01);
sliderPoolLimit->setSuffix(i18n(" %"));
sliderPoolLimit->setRange(0, 20, 2);
sliderMemoryLimit->setSingleStep(0.01);
sliderUndoLimit->setSuffix(i18n(" %"));
sliderUndoLimit->setRange(0, 50, 2);
sliderMemoryLimit->setSingleStep(0.01);
intMemoryLimit->setMinimumWidth(80);
intPoolLimit->setMinimumWidth(80);
intUndoLimit->setMinimumWidth(80);
SliderAndSpinBoxSync *sync1 =
new SliderAndSpinBoxSync(sliderMemoryLimit,
intMemoryLimit,
getTotalRAM);
sync1->slotParentValueChanged();
m_syncs << sync1;
SliderAndSpinBoxSync *sync2 =
new SliderAndSpinBoxSync(sliderPoolLimit,
intPoolLimit,
std::bind(&KisIntParseSpinBox::value,
intMemoryLimit));
connect(intMemoryLimit, SIGNAL(valueChanged(int)), sync2, SLOT(slotParentValueChanged()));
sync2->slotParentValueChanged();
m_syncs << sync2;
SliderAndSpinBoxSync *sync3 =
new SliderAndSpinBoxSync(sliderUndoLimit,
intUndoLimit,
std::bind(&PerformanceTab::realTilesRAM,
this));
connect(intPoolLimit, SIGNAL(valueChanged(int)), sync3, SLOT(slotParentValueChanged()));
sync3->slotParentValueChanged();
m_syncs << sync3;
sliderSwapSize->setSuffix(i18n(" GiB"));
sliderSwapSize->setRange(1, 64);
intSwapSize->setRange(1, 64);
KisAcyclicSignalConnector *swapSizeConnector = new KisAcyclicSignalConnector(this);
swapSizeConnector->connectForwardInt(sliderSwapSize, SIGNAL(valueChanged(int)),
intSwapSize, SLOT(setValue(int)));
swapSizeConnector->connectBackwardInt(intSwapSize, SIGNAL(valueChanged(int)),
sliderSwapSize, SLOT(setValue(int)));
lblSwapFileLocation->setText(cfg.swapDir());
connect(bnSwapFile, SIGNAL(clicked()), SLOT(selectSwapDir()));
load(false);
}
PerformanceTab::~PerformanceTab()
{
qDeleteAll(m_syncs);
}
void PerformanceTab::load(bool requestDefault)
{
KisImageConfig cfg;
sliderMemoryLimit->setValue(cfg.memoryHardLimitPercent(requestDefault));
sliderPoolLimit->setValue(cfg.memoryPoolLimitPercent(requestDefault));
sliderUndoLimit->setValue(cfg.memorySoftLimitPercent(requestDefault));
chkPerformanceLogging->setChecked(cfg.enablePerfLog(requestDefault));
chkProgressReporting->setChecked(cfg.enableProgressReporting(requestDefault));
sliderSwapSize->setValue(cfg.maxSwapSize(requestDefault) / 1024);
lblSwapFileLocation->setText(cfg.swapDir(requestDefault));
{
KisConfig cfg2;
chkOpenGLLogging->setChecked(cfg2.enableOpenGLDebugging(requestDefault));
chkDisableVectorOptimizations->setChecked(cfg2.enableAmdVectorizationWorkaround(requestDefault));
}
}
void PerformanceTab::save()
{
KisImageConfig cfg;
cfg.setMemoryHardLimitPercent(sliderMemoryLimit->value());
cfg.setMemorySoftLimitPercent(sliderUndoLimit->value());
cfg.setMemoryPoolLimitPercent(sliderPoolLimit->value());
cfg.setEnablePerfLog(chkPerformanceLogging->isChecked());
cfg.setEnableProgressReporting(chkProgressReporting->isChecked());
cfg.setMaxSwapSize(sliderSwapSize->value() * 1024);
cfg.setSwapDir(lblSwapFileLocation->text());
{
KisConfig cfg2;
cfg2.setEnableOpenGLDebugging(chkOpenGLLogging->isChecked());
cfg2.setEnableAmdVectorizationWorkaround(chkDisableVectorOptimizations->isChecked());
}
}
void PerformanceTab::selectSwapDir()
{
KisImageConfig cfg;
QString swapDir = cfg.swapDir();
swapDir = QFileDialog::getExistingDirectory(0, i18nc("@title:window", "Select a swap directory"), swapDir);
lblSwapFileLocation->setText(swapDir);
}
//---------------------------------------------------------------------------------------------------
#include "KoColor.h"
DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
: WdgDisplaySettings(parent, name)
{
KisConfig cfg;
if (!KisOpenGL::hasOpenGL()) {
grpOpenGL->setEnabled(false);
grpOpenGL->setChecked(false);
chkUseTextureBuffer->setEnabled(false);
chkDisableVsync->setEnabled(false);
cmbFilterMode->setEnabled(false);
} else {
grpOpenGL->setEnabled(true);
grpOpenGL->setChecked(cfg.useOpenGL());
chkUseTextureBuffer->setEnabled(cfg.useOpenGL());
chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer());
chkDisableVsync->setVisible(cfg.showAdvancedOpenGLSettings());
chkDisableVsync->setEnabled(cfg.useOpenGL());
chkDisableVsync->setChecked(cfg.disableVSync());
cmbFilterMode->setEnabled(cfg.useOpenGL());
cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode());
// Don't show the high quality filtering mode if it's not available
if (!KisOpenGL::supportsLoD()) {
cmbFilterMode->removeItem(3);
}
}
if (qApp->applicationName() == "kritasketch" || qApp->applicationName() == "kritagemini") {
grpOpenGL->setVisible(false);
grpOpenGL->setMaximumHeight(0);
}
KoColor c;
c.fromQColor(cfg.selectionOverlayMaskColor());
c.setOpacity(1.0);
btnSelectionOverlayColor->setColor(c);
sldSelectionOverlayOpacity->setRange(0.0, 1.0, 2);
sldSelectionOverlayOpacity->setSingleStep(0.05);
sldSelectionOverlayOpacity->setValue(cfg.selectionOverlayMaskColor().alphaF());
intCheckSize->setValue(cfg.checkSize());
chkMoving->setChecked(cfg.scrollCheckers());
KoColor ck1(KoColorSpaceRegistry::instance()->rgb8());
ck1.fromQColor(cfg.checkersColor1());
colorChecks1->setColor(ck1);
KoColor ck2(KoColorSpaceRegistry::instance()->rgb8());
ck2.fromQColor(cfg.checkersColor2());
colorChecks2->setColor(ck2);
KoColor cb(KoColorSpaceRegistry::instance()->rgb8());
cb.fromQColor(cfg.canvasBorderColor());
canvasBorder->setColor(cb);
hideScrollbars->setChecked(cfg.hideScrollbars());
chkCurveAntialiasing->setChecked(cfg.antialiasCurves());
chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline());
chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor());
chkHidePopups->setChecked(cfg.hidePopups());
connect(grpOpenGL, SIGNAL(toggled(bool)), SLOT(slotUseOpenGLToggled(bool)));
}
void DisplaySettingsTab::setDefault()
{
KisConfig cfg;
if (!KisOpenGL::hasOpenGL()) {
grpOpenGL->setEnabled(false);
grpOpenGL->setChecked(false);
chkUseTextureBuffer->setEnabled(false);
chkDisableVsync->setEnabled(false);
cmbFilterMode->setEnabled(false);
}
else {
grpOpenGL->setEnabled(true);
grpOpenGL->setChecked(cfg.useOpenGL(true));
chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer(true));
chkUseTextureBuffer->setEnabled(true);
chkDisableVsync->setEnabled(true);
chkDisableVsync->setChecked(cfg.disableVSync(true));
cmbFilterMode->setEnabled(true);
cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode(true));
}
chkMoving->setChecked(cfg.scrollCheckers(true));
intCheckSize->setValue(cfg.checkSize(true));
KoColor ck1(KoColorSpaceRegistry::instance()->rgb8());
ck1.fromQColor(cfg.checkersColor1(true));
colorChecks1->setColor(ck1);
KoColor ck2(KoColorSpaceRegistry::instance()->rgb8());
ck2.fromQColor(cfg.checkersColor2(true));
colorChecks2->setColor(ck2);
KoColor cvb(KoColorSpaceRegistry::instance()->rgb8());
cvb.fromQColor(cfg.canvasBorderColor(true));
canvasBorder->setColor(cvb);
hideScrollbars->setChecked(cfg.hideScrollbars(true));
chkCurveAntialiasing->setChecked(cfg.antialiasCurves(true));
chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline(true));
chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor(true));
chkHidePopups->setChecked(cfg.hidePopups(true));
}
void DisplaySettingsTab::slotUseOpenGLToggled(bool isChecked)
{
chkUseTextureBuffer->setEnabled(isChecked);
chkDisableVsync->setEnabled(isChecked);
cmbFilterMode->setEnabled(isChecked);
}
//---------------------------------------------------------------------------------------------------
FullscreenSettingsTab::FullscreenSettingsTab(QWidget* parent) : WdgFullscreenSettingsBase(parent)
{
KisConfig cfg;
chkDockers->setChecked(cfg.hideDockersFullscreen());
chkMenu->setChecked(cfg.hideMenuFullscreen());
chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen());
chkStatusbar->setChecked(cfg.hideStatusbarFullscreen());
chkTitlebar->setChecked(cfg.hideTitlebarFullscreen());
chkToolbar->setChecked(cfg.hideToolbarFullscreen());
}
void FullscreenSettingsTab::setDefault()
{
KisConfig cfg;
chkDockers->setChecked(cfg.hideDockersFullscreen(true));
chkMenu->setChecked(cfg.hideMenuFullscreen(true));
chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen(true));
chkStatusbar->setChecked(cfg.hideStatusbarFullscreen(true));
chkTitlebar->setChecked(cfg.hideTitlebarFullscreen(true));
chkToolbar->setChecked(cfg.hideToolbarFullscreen(true));
}
//---------------------------------------------------------------------------------------------------
KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
: KPageDialog(parent)
{
Q_UNUSED(name);
setWindowTitle(i18n("Configure Krita"));
setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
button(QDialogButtonBox::Ok)->setDefault(true);
setFaceType(KPageDialog::List);
// General
KoVBox *vbox = new KoVBox();
KPageWidgetItem *page = new KPageWidgetItem(vbox, i18n("General"));
page->setObjectName("general");
page->setHeader(i18n("General"));
page->setIcon(KisIconUtils::loadIcon("go-home"));
addPage(page);
m_general = new GeneralTab(vbox);
// Shortcuts
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, i18n("Keyboard Shortcuts"));
page->setObjectName("shortcuts");
page->setHeader(i18n("Shortcuts"));
page->setIcon(KisIconUtils::loadIcon("document-export"));
addPage(page);
m_shortcutSettings = new ShortcutSettingsTab(vbox);
connect(this, SIGNAL(accepted()), m_shortcutSettings, SLOT(saveChanges()));
connect(this, SIGNAL(rejected()), m_shortcutSettings, SLOT(cancelChanges()));
// Canvas input settings
m_inputConfiguration = new KisInputConfigurationPage();
page = addPage(m_inputConfiguration, i18n("Canvas Input Settings"));
page->setHeader(i18n("Canvas Input"));
page->setObjectName("canvasinput");
page->setIcon(KisIconUtils::loadIcon("configure"));
// Display
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, i18n("Display"));
page->setObjectName("display");
page->setHeader(i18n("Display"));
page->setIcon(KisIconUtils::loadIcon("preferences-desktop-display"));
addPage(page);
m_displaySettings = new DisplaySettingsTab(vbox);
// Color
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, i18n("Color Management"));
page->setObjectName("colormanagement");
page->setHeader(i18n("Color"));
page->setIcon(KisIconUtils::loadIcon("preferences-desktop-color"));
addPage(page);
m_colorSettings = new ColorSettingsTab(vbox);
// Performance
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, i18n("Performance"));
page->setObjectName("performance");
page->setHeader(i18n("Performance"));
page->setIcon(KisIconUtils::loadIcon("applications-system"));
addPage(page);
m_performanceSettings = new PerformanceTab(vbox);
// Tablet
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, i18n("Tablet settings"));
page->setObjectName("tablet");
page->setHeader(i18n("Tablet"));
page->setIcon(KisIconUtils::loadIcon("document-edit"));
addPage(page);
m_tabletSettings = new TabletSettingsTab(vbox);
// full-screen mode
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, i18n("Canvas-only settings"));
page->setObjectName("canvasonly");
page->setHeader(i18n("Canvas-only"));
page->setIcon(KisIconUtils::loadIcon("folder-pictures"));
addPage(page);
m_fullscreenSettings = new FullscreenSettingsTab(vbox);
// Author profiles
m_authorPage = new KoConfigAuthorPage();
page = addPage(m_authorPage, i18nc("@title:tab Author page", "Author" ));
page->setObjectName("author");
page->setHeader(i18n("Author"));
page->setIcon(KisIconUtils::loadIcon("im-user"));
QPushButton *restoreDefaultsButton = button(QDialogButtonBox::RestoreDefaults);
connect(this, SIGNAL(accepted()), m_inputConfiguration, SLOT(saveChanges()));
connect(this, SIGNAL(rejected()), m_inputConfiguration, SLOT(revertChanges()));
KisPreferenceSetRegistry *preferenceSetRegistry = KisPreferenceSetRegistry::instance();
Q_FOREACH (KisAbstractPreferenceSetFactory *preferenceSetFactory, preferenceSetRegistry->values()) {
KisPreferenceSet* preferenceSet = preferenceSetFactory->createPreferenceSet();
vbox = new KoVBox();
page = new KPageWidgetItem(vbox, preferenceSet->name());
page->setHeader(preferenceSet->header());
page->setIcon(preferenceSet->icon());
addPage(page);
preferenceSet->setParent(vbox);
preferenceSet->loadPreferences();
connect(restoreDefaultsButton, SIGNAL(clicked(bool)), preferenceSet, SLOT(loadDefaultPreferences()), Qt::UniqueConnection);
connect(this, SIGNAL(accepted()), preferenceSet, SLOT(savePreferences()), Qt::UniqueConnection);
}
connect(restoreDefaultsButton, SIGNAL(clicked(bool)), this, SLOT(slotDefault()));
}
KisDlgPreferences::~KisDlgPreferences()
{
}
void KisDlgPreferences::slotDefault()
{
if (currentPage()->objectName() == "general") {
m_general->setDefault();
}
else if (currentPage()->objectName() == "shortcuts") {
m_shortcutSettings->setDefault();
}
else if (currentPage()->objectName() == "display") {
m_displaySettings->setDefault();
}
else if (currentPage()->objectName() == "colormanagement") {
m_colorSettings->setDefault();
}
else if (currentPage()->objectName() == "performance") {
m_performanceSettings->load(true);
}
else if (currentPage()->objectName() == "tablet") {
m_tabletSettings->setDefault();
}
else if (currentPage()->objectName() == "canvasonly") {
m_fullscreenSettings->setDefault();
}
else if (currentPage()->objectName() == "canvasinput") {
m_inputConfiguration->setDefaults();
}
}
bool KisDlgPreferences::editPreferences()
{
KisDlgPreferences* dialog;
dialog = new KisDlgPreferences();
bool baccept = (dialog->exec() == Accepted);
if (baccept) {
// General settings
KisConfig cfg;
cfg.setNewCursorStyle(dialog->m_general->cursorStyle());
cfg.setNewOutlineStyle(dialog->m_general->outlineStyle());
cfg.setShowRootLayer(dialog->m_general->showRootLayer());
cfg.setShowOutlineWhilePainting(dialog->m_general->showOutlineWhilePainting());
cfg.setHideSplashScreen(dialog->m_general->hideSplashScreen());
cfg.setCalculateAnimationCacheInBackground(dialog->m_general->calculateAnimationCacheInBackground());
KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
group.writeEntry("DontUseNativeFileDialog", !dialog->m_general->m_chkNativeFileDialog->isChecked());
cfg.writeEntry<int>("maximumBrushSize", dialog->m_general->intMaxBrushSize->value());
cfg.writeEntry<int>("mdi_viewmode", dialog->m_general->mdiMode());
cfg.setMDIBackgroundColor(dialog->m_general->m_mdiColor->color().toQColor());
cfg.setMDIBackgroundImage(dialog->m_general->m_backgroundimage->text());
cfg.setAutoSaveInterval(dialog->m_general->autoSaveInterval());
cfg.setBackupFile(dialog->m_general->m_backupFileCheckBox->isChecked());
cfg.setShowCanvasMessages(dialog->m_general->showCanvasMessages());
cfg.setCompressKra(dialog->m_general->compressKra());
const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
kritarc.setValue("EnableHiDPI", dialog->m_general->m_chkHiDPI->isChecked());
kritarc.setValue("EnableSingleApplication", dialog->m_general->m_chkSingleApplication->isChecked());
cfg.setToolOptionsInDocker(dialog->m_general->toolOptionsInDocker());
cfg.setSwitchSelectionCtrlAlt(dialog->m_general->switchSelectionCtrlAlt());
cfg.setConvertToImageColorspaceOnImport(dialog->m_general->convertToImageColorspaceOnImport());
KisPart *part = KisPart::instance();
if (part) {
Q_FOREACH (QPointer<KisDocument> doc, part->documents()) {
if (doc) {
doc->setAutoSaveDelay(dialog->m_general->autoSaveInterval());
doc->setBackupFile(dialog->m_general->m_backupFileCheckBox->isChecked());
doc->undoStack()->setUndoLimit(dialog->m_general->undoStackSize());
}
}
}
cfg.setUndoStackLimit(dialog->m_general->undoStackSize());
cfg.setFavoritePresets(dialog->m_general->favoritePresets());
// Color settings
cfg.setUseSystemMonitorProfile(dialog->m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
for (int i = 0; i < QApplication::desktop()->screenCount(); ++i) {
if (dialog->m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked()) {
int currentIndex = dialog->m_colorSettings->m_monitorProfileWidgets[i]->currentIndex();
QString monitorid = dialog->m_colorSettings->m_monitorProfileWidgets[i]->itemData(currentIndex).toString();
cfg.setMonitorForScreen(i, monitorid);
}
else {
cfg.setMonitorProfile(i,
dialog->m_colorSettings->m_monitorProfileWidgets[i]->itemHighlighted(),
dialog->m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
}
}
cfg.setWorkingColorSpace(dialog->m_colorSettings->m_page->cmbWorkingColorSpace->currentItem().id());
KisImageConfig cfgImage;
cfgImage.setDefaultProofingConfig(dialog->m_colorSettings->m_page->proofingSpaceSelector->currentColorSpace(),
dialog->m_colorSettings->m_page->cmbProofingIntent->currentIndex(),
dialog->m_colorSettings->m_page->ckbProofBlackPoint->isChecked(),
dialog->m_colorSettings->m_page->gamutAlarm->color(),
(double)dialog->m_colorSettings->m_page->sldAdaptationState->value()/20);
cfg.setUseBlackPointCompensation(dialog->m_colorSettings->m_page->chkBlackpoint->isChecked());
cfg.setAllowLCMSOptimization(dialog->m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
cfg.setPasteBehaviour(dialog->m_colorSettings->m_pasteBehaviourGroup.checkedId());
cfg.setRenderIntent(dialog->m_colorSettings->m_page->cmbMonitorIntent->currentIndex());
// Tablet settings
cfg.setPressureTabletCurve( dialog->m_tabletSettings->m_page->pressureCurve->curve().toString() );
dialog->m_performanceSettings->save();
if (!cfg.useOpenGL() && dialog->m_displaySettings->grpOpenGL->isChecked())
cfg.setCanvasState("TRY_OPENGL");
cfg.setUseOpenGL(dialog->m_displaySettings->grpOpenGL->isChecked());
cfg.setUseOpenGLTextureBuffer(dialog->m_displaySettings->chkUseTextureBuffer->isChecked());
cfg.setOpenGLFilteringMode(dialog->m_displaySettings->cmbFilterMode->currentIndex());
cfg.setDisableVSync(dialog->m_displaySettings->chkDisableVsync->isChecked());
cfg.setCheckSize(dialog->m_displaySettings->intCheckSize->value());
cfg.setScrollingCheckers(dialog->m_displaySettings->chkMoving->isChecked());
cfg.setCheckersColor1(dialog->m_displaySettings->colorChecks1->color().toQColor());
cfg.setCheckersColor2(dialog->m_displaySettings->colorChecks2->color().toQColor());
cfg.setCanvasBorderColor(dialog->m_displaySettings->canvasBorder->color().toQColor());
cfg.setHideScrollbars(dialog->m_displaySettings->hideScrollbars->isChecked());
KoColor c = dialog->m_displaySettings->btnSelectionOverlayColor->color();
c.setOpacity(dialog->m_displaySettings->sldSelectionOverlayOpacity->value());
cfg.setSelectionOverlayMaskColor(c.toQColor());
cfg.setAntialiasCurves(dialog->m_displaySettings->chkCurveAntialiasing->isChecked());
cfg.setAntialiasSelectionOutline(dialog->m_displaySettings->chkSelectionOutlineAntialiasing->isChecked());
cfg.setShowSingleChannelAsColor(dialog->m_displaySettings->chkChannelsAsColor->isChecked());
cfg.setHidePopups(dialog->m_displaySettings->chkHidePopups->isChecked());
cfg.setHideDockersFullscreen(dialog->m_fullscreenSettings->chkDockers->checkState());
cfg.setHideMenuFullscreen(dialog->m_fullscreenSettings->chkMenu->checkState());
cfg.setHideScrollbarsFullscreen(dialog->m_fullscreenSettings->chkScrollbars->checkState());
cfg.setHideStatusbarFullscreen(dialog->m_fullscreenSettings->chkStatusbar->checkState());
cfg.setHideTitlebarFullscreen(dialog->m_fullscreenSettings->chkTitlebar->checkState());
cfg.setHideToolbarFullscreen(dialog->m_fullscreenSettings->chkToolbar->checkState());
dialog->m_authorPage->apply();
}
delete dialog;
return baccept;
}
diff --git a/libs/ui/dialogs/kis_dlg_preferences.h b/libs/ui/dialogs/kis_dlg_preferences.h
index 6ade17541e..2c286ee8a6 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.h
+++ b/libs/ui/dialogs/kis_dlg_preferences.h
@@ -1,333 +1,333 @@
/*
* preferencesdlg.h - part of KImageShop^WKrita
*
* Copyright (c) 1999 Michael Koch <koch@kde.org>
* Copyright (c) 2003-2011 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DLG_PREFERENCES_H_
#define _KIS_DLG_PREFERENCES_H_
#include <QWidget>
#include <kpagedialog.h>
#include "kis_global.h"
#include "widgets/squeezedcombobox.h"
#include "ui_wdggeneralsettings.h"
#include "ui_wdgdisplaysettings.h"
#include "ui_wdgcolorsettings.h"
#include "ui_wdgtabletsettings.h"
#include "ui_wdgperformancesettings.h"
#include "ui_wdgfullscreensettings.h"
#include "KisShortcutsDialog.h"
class KoID;
class KisInputConfigurationPage;
class KoConfigAuthorPage;
/**
* "General"-tab for preferences dialog
*/
class WdgGeneralSettings : public QWidget, public Ui::WdgGeneralSettings
{
Q_OBJECT
public:
WdgGeneralSettings(QWidget *parent, const char *name) : QWidget(parent) {
setObjectName(name);
setupUi(this);
chkShowRootLayer->setVisible(false);
}
};
class GeneralTab : public WdgGeneralSettings
{
Q_OBJECT
public:
GeneralTab(QWidget *parent = 0, const char *name = 0);
CursorStyle cursorStyle();
OutlineStyle outlineStyle();
bool showRootLayer();
int autoSaveInterval();
void setDefault();
int undoStackSize();
bool showOutlineWhilePainting();
bool hideSplashScreen();
int mdiMode();
int favoritePresets();
bool showCanvasMessages();
bool compressKra();
bool toolOptionsInDocker();
bool switchSelectionCtrlAlt();
bool convertToImageColorspaceOnImport();
bool calculateAnimationCacheInBackground();
private Q_SLOTS:
void getBackgroundImage();
void clearBackgroundImage();
};
/**
* "Shortcuts" tab for preferences dialog
*/
class WdgShortcutSettings : public KisShortcutsDialog
{
Q_OBJECT
public:
WdgShortcutSettings(QWidget *parent)
: KisShortcutsDialog(KisShortcutsEditor::AllActions,
KisShortcutsEditor::LetterShortcutsAllowed,
parent)
{ }
};
class KisActionsSnapshot;
class ShortcutSettingsTab : public QWidget
{
Q_OBJECT
public:
ShortcutSettingsTab(QWidget *parent = 0, const char *name = 0);
- ~ShortcutSettingsTab();
+ ~ShortcutSettingsTab() override;
public:
void setDefault();
WdgShortcutSettings *m_page;
QScopedPointer<KisActionsSnapshot> m_snapshot;
public Q_SLOTS:
void saveChanges();
void cancelChanges();
};
/**
* "Color" tab for preferences dialog
*/
class WdgColorSettings : public QWidget, public Ui::WdgColorSettings
{
Q_OBJECT
public:
WdgColorSettings(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class ColorSettingsTab : public QWidget
{
Q_OBJECT
public:
ColorSettingsTab(QWidget *parent = 0, const char *name = 0);
private Q_SLOTS:
void refillMonitorProfiles(const KoID & s);
void installProfile();
void toggleAllowMonitorProfileSelection(bool useSystemProfile);
public:
void setDefault();
WdgColorSettings *m_page;
QButtonGroup m_pasteBehaviourGroup;
QList<QLabel*> m_monitorProfileLabels;
QList<SqueezedComboBox*> m_monitorProfileWidgets;
};
//=======================
class WdgTabletSettings : public QWidget, public Ui::WdgTabletSettings {
Q_OBJECT
public:
WdgTabletSettings(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class TabletSettingsTab : public QWidget {
Q_OBJECT
public:
TabletSettingsTab(QWidget *parent = 0, const char *name = 0);
public:
void setDefault();
WdgTabletSettings *m_page;
};
//=======================
/**
* "Performance"-tab for preferences dialog
*/
class SliderAndSpinBoxSync;
class WdgPerformanceSettings : public QWidget, public Ui::WdgPerformanceSettings
{
Q_OBJECT
public:
WdgPerformanceSettings(QWidget *parent, const char *name) : QWidget(parent) {
setObjectName(name); setupUi(this);
}
};
class PerformanceTab : public WdgPerformanceSettings
{
Q_OBJECT
public:
PerformanceTab(QWidget *parent = 0, const char *name = 0);
- ~PerformanceTab();
+ ~PerformanceTab() override;
void load(bool requestDefault);
void save();
private Q_SLOTS:
void selectSwapDir();
private:
int realTilesRAM();
private:
QVector<SliderAndSpinBoxSync*> m_syncs;
};
//=======================
class WdgDisplaySettings : public QWidget, public Ui::WdgDisplaySettings
{
Q_OBJECT
public:
WdgDisplaySettings(QWidget *parent, const char *name) : QWidget(parent) {
setObjectName(name); setupUi(this);
}
};
/**
* Display settings tab for preferences dialog
*/
class DisplaySettingsTab : public WdgDisplaySettings
{
Q_OBJECT
public:
DisplaySettingsTab(QWidget *parent = 0, const char *name = 0);
public:
void setDefault();
protected Q_SLOTS:
void slotUseOpenGLToggled(bool isChecked);
public:
};
//=======================
/**
* Full screen settings tab for preferences dialog
*/
class WdgFullscreenSettingsBase : public QWidget, public Ui::WdgFullscreenSettings
{
Q_OBJECT
public:
WdgFullscreenSettingsBase(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class FullscreenSettingsTab : public WdgFullscreenSettingsBase
{
Q_OBJECT
public:
FullscreenSettingsTab(QWidget *parent);
public:
void setDefault();
};
//=======================
/**
* Preferences dialog of KImageShop^WKrayon^WKrita
*/
class KisDlgPreferences : public KPageDialog
{
Q_OBJECT
public:
static bool editPreferences();
protected:
KisDlgPreferences(QWidget *parent = 0, const char *name = 0);
- ~KisDlgPreferences();
+ ~KisDlgPreferences() override;
protected:
GeneralTab *m_general;
ShortcutSettingsTab *m_shortcutSettings;
ColorSettingsTab *m_colorSettings;
PerformanceTab *m_performanceSettings;
DisplaySettingsTab *m_displaySettings;
TabletSettingsTab *m_tabletSettings;
FullscreenSettingsTab *m_fullscreenSettings;
KisInputConfigurationPage *m_inputConfiguration;
KoConfigAuthorPage *m_authorPage;
protected Q_SLOTS:
void slotDefault();
};
#endif
diff --git a/libs/ui/dialogs/kis_dlg_stroke_selection_properties.h b/libs/ui/dialogs/kis_dlg_stroke_selection_properties.h
index e3c6a34594..6c0e0a3354 100644
--- a/libs/ui/dialogs/kis_dlg_stroke_selection_properties.h
+++ b/libs/ui/dialogs/kis_dlg_stroke_selection_properties.h
@@ -1,113 +1,113 @@
/*
* Copyright (c) 2016 Alexey Kapustin <akapust1n@yandex.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DLG_STROKE_SELECTION_PROPERTIES_H_
#define KIS_DLG_STROKE_SELECTION_PROPERTIES_H_
#include <KoDialog.h>
#include "KisProofingConfiguration.h"
#include <kis_types.h>
#include "KisViewManager.h"
#include "KoStrokeConfigWidget.h"
#include "ui_wdgstrokeselectionproperties.h"
#include <kis_painter.h>
#include <kis_canvas2.h>
class KoColorSpace;
class KoColorPopupAction;
enum class linePosition
{
OUTSIDE, INSIDE, CENTER
};
enum class drawType{
brushDraw, lineDraw
};
enum class colorFillSource {
None, PaintColor, BGColor, CustomColor, FGColor
};
struct StrokeSelectionOptions {
StrokeSelectionOptions ();
int lineSize;
bool brushSelected;
int _colorFillSource;
int lineColorSource;
int lineDimension;
KoColor color;
KoColor fillColor;
KoColor customColor;
KisPainter::FillStyle fillStyle() const;
void lock();
};
class WdgStrokeSelection : public QWidget, public Ui::WdgStrokeSelection
{
Q_OBJECT
public:
WdgStrokeSelection(QWidget *parent) ;
StrokeSelectionOptions m_options;
Q_SIGNALS:
void colorFillSelectorChanged();
void colorSelectorChanged();
private Q_SLOTS:
void on_fillBox_currentIndexChanged(int index);
void on_typeBox_currentIndexChanged(const QString &arg1);
void on_lineColorBox_currentIndexChanged(const QString &arg1);
};
class KisDlgStrokeSelection : public KoDialog
{
Q_OBJECT
public:
KisDlgStrokeSelection(KisImageWSP image, KisViewManager *view, bool isVectorLayer);
- virtual ~KisDlgStrokeSelection();
+ ~KisDlgStrokeSelection() override;
int getLineSize() const;
linePosition getLinePosition() const;
KoColor getSelectedColor() const;
bool isBrushSelected() const;
KoColor getFillSelectedColor() const;
StrokeSelectionOptions getParams() const;
void lockVectorLayerFunctions();
void unlockVectorLayerFunctions();
private:
WdgStrokeSelection * m_page;
KisImageWSP m_image;
KoCanvasResourceManager *m_resourceManager;
KisDisplayColorConverter *converter;
private Q_SLOTS:
void setColorFillButton();
void setColorButton();
void colorChanged(const QColor &newColor);
void colorFillChanged(const QColor &newColor);
};
#endif // KIS_DLG_STROKE_SEL_PROPERTIES_H_
diff --git a/libs/ui/dialogs/slider_and_spin_box_sync.h b/libs/ui/dialogs/slider_and_spin_box_sync.h
index ef3421306c..1ae81086d8 100644
--- a/libs/ui/dialogs/slider_and_spin_box_sync.h
+++ b/libs/ui/dialogs/slider_and_spin_box_sync.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __SLIDER_AND_SPIN_BOX_SYNC_H
#define __SLIDER_AND_SPIN_BOX_SYNC_H
#include <QObject>
#include <functional>
class QSpinBox;
class KisDoubleSliderSpinBox;
/**
* Syncs a slider measured in percentage with a spin box
* measuring real value getting value from \p parentValueOp.
*
* E.g.
*
* parentValueOp() --- total system memory in MiB
* slider --- percentage of the memory we can use
* spinBox --- amount o fmemory we can use in MiB
* slotParentValueChanged() --- should be called every time
* total memory changes
*/
class SliderAndSpinBoxSync : public QObject
{
Q_OBJECT
using IntFunction = std::function<int()>;
public:
SliderAndSpinBoxSync(KisDoubleSliderSpinBox *slider,
QSpinBox *spinBox,
IntFunction parentValueOp);
- ~SliderAndSpinBoxSync();
+ ~SliderAndSpinBoxSync() override;
public Q_SLOTS:
void slotParentValueChanged();
private Q_SLOTS:
void sliderChanged(qreal value);
void spinBoxChanged(int value);
private:
KisDoubleSliderSpinBox *m_slider;
QSpinBox *m_spinBox;
IntFunction m_parentValueOp;
bool m_blockUpdates;
};
#endif /* __SLIDER_AND_SPIN_BOX_SYNC_H */
diff --git a/libs/ui/flake/kis_dummies_facade.h b/libs/ui/flake/kis_dummies_facade.h
index 31a23870d1..9bcb91deea 100644
--- a/libs/ui/flake/kis_dummies_facade.h
+++ b/libs/ui/flake/kis_dummies_facade.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DUMMIES_FACADE_H
#define __KIS_DUMMIES_FACADE_H
#include "kis_dummies_facade_base.h"
/**
* The simple implementation of KisDummiesFacadeBase. It can be used
* in cases when KisShapeController is not accessible, e.g. when you
* need to show layers in a filter and you need to create KisNodeModel
*/
class KRITAUI_EXPORT KisDummiesFacade : public KisDummiesFacadeBase
{
Q_OBJECT
public:
KisDummiesFacade(QObject *parent = 0);
- ~KisDummiesFacade();
+ ~KisDummiesFacade() override;
- virtual bool hasDummyForNode(KisNodeSP node) const;
- KisNodeDummy* dummyForNode(KisNodeSP node) const;
- KisNodeDummy* rootDummy() const;
- int dummiesCount() const;
+ bool hasDummyForNode(KisNodeSP node) const override;
+ KisNodeDummy* dummyForNode(KisNodeSP node) const override;
+ KisNodeDummy* rootDummy() const override;
+ int dummiesCount() const override;
private:
- void addNodeImpl(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis);
- void removeNodeImpl(KisNodeSP node);
+ void addNodeImpl(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis) override;
+ void removeNodeImpl(KisNodeSP node) override;
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_DUMMIES_FACADE_H */
diff --git a/libs/ui/flake/kis_dummies_facade_base.h b/libs/ui/flake/kis_dummies_facade_base.h
index 86eba0b2a5..00325d377e 100644
--- a/libs/ui/flake/kis_dummies_facade_base.h
+++ b/libs/ui/flake/kis_dummies_facade_base.h
@@ -1,103 +1,103 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DUMMIES_FACADE_BASE_H
#define __KIS_DUMMIES_FACADE_BASE_H
#include <QObject>
#include "kis_types.h"
#include "kritaui_export.h"
class KisNodeDummy;
/**
* Keeps track of the node stack and manages local (UI-wide) representation
* of the node stack. It uses KisNodeDummy objects to represent the stack.
* This is done to break synchronization tie between UI and Image threads,
* caused by the fact that KisNodeModel must be synchronously notified
* when a node is removed/deleted.
*/
class KRITAUI_EXPORT KisDummiesFacadeBase : public QObject
{
Q_OBJECT
public:
KisDummiesFacadeBase(QObject *parent = 0);
- virtual ~KisDummiesFacadeBase();
+ ~KisDummiesFacadeBase() override;
void setImage(KisImageWSP image);
virtual bool hasDummyForNode(KisNodeSP node) const = 0;
virtual KisNodeDummy* dummyForNode(KisNodeSP node) const = 0;
virtual KisNodeDummy* rootDummy() const = 0;
virtual int dummiesCount() const = 0;
protected:
KisImageWSP image() const;
virtual void addNodeImpl(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis) = 0;
virtual void removeNodeImpl(KisNodeSP node) = 0;
Q_SIGNALS:
void sigContinueAddNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis);
void sigContinueRemoveNode(KisNodeSP node);
/**
* The signals for controlling the node model
*/
void sigBeginInsertDummy(KisNodeDummy *parent, int index, const QString &metaObjectType);
void sigEndInsertDummy(KisNodeDummy *dummy);
void sigBeginRemoveDummy(KisNodeDummy *dummy);
void sigEndRemoveDummy();
void sigDummyChanged(KisNodeDummy *dummy);
/**
* This signal is emitted when the shape controller wants to request
* the change of an active layer. E.g. when a new layer is added or
* when the root layer of the image is changed. It should be forwarded
* through a signal to allow queueing and synchronization of threads.
*/
void sigActivateNode(KisNodeSP node);
private Q_SLOTS:
void slotLayersChanged();
void slotNodeChanged(KisNodeSP node);
void slotNodeActivationRequested(KisNodeSP node);
void slotNodeAdded(KisNodeSP node);
void slotRemoveNode(KisNodeSP node);
void slotContinueAddNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis);
void slotContinueRemoveNode(KisNodeSP node);
private:
static KisNodeSP findFirstLayer(KisNodeSP root);
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_DUMMIES_FACADE_BASE_H */
diff --git a/libs/ui/flake/kis_node_dummies_graph.h b/libs/ui/flake/kis_node_dummies_graph.h
index 30dd0bfbad..4c91dcc567 100644
--- a/libs/ui/flake/kis_node_dummies_graph.h
+++ b/libs/ui/flake/kis_node_dummies_graph.h
@@ -1,146 +1,146 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_NODE_DUMMIES_GRAPH_H
#define __KIS_NODE_DUMMIES_GRAPH_H
#include <QList>
#include <QMap>
#include "kritaui_export.h"
#include "kis_types.h"
#include "kis_node.h"
class KisNodeShape;
/**
* KisNodeDummy is a simplified representation of a node
* in the node stack. It stores all the hierarchy information
* about the node, so you needn't access from the node
* directly (actually, you cannot do it usually, because UI
* works in a different thread and race conditions are possible).
*
* The dummy stores a KisNodeShape which can store a pointer to
* to node. You can access to the node data through it, but take
* care -- not all the information is accessible in
* multithreading environment.
*
* The ownership on the KisNodeShape is taken by the dummy.
* The ownership on the children of the dummy is taken as well.
*/
class KRITAUI_EXPORT KisNodeDummy : public QObject
{
Q_OBJECT
public:
/**
* Take care tha KisNodeDummy does not take ownership over
* the \p nodeShape since the handling of the removal of the
* children of the shape is done by flake. So please handle it
* manually.
*
* The children dummies of the dummy are still owned by the
* dummy and are deleted automatically.
*/
KisNodeDummy(KisNodeShape *nodeShape, KisNodeSP node);
- ~KisNodeDummy();
+ ~KisNodeDummy() override;
KisNodeDummy* firstChild() const;
KisNodeDummy* lastChild() const;
KisNodeDummy* nextSibling() const;
KisNodeDummy* prevSibling() const;
KisNodeDummy* parent() const;
KisNodeDummy* at(int index) const;
int childCount() const;
int indexOf(KisNodeDummy *child) const;
KisNodeSP node() const;
private:
friend class KisNodeShapesGraph; // for ::nodeShape() method
friend class KisNodeShapesGraphTest;
KisNodeShape* nodeShape() const;
friend class KisNodeDummiesGraph;
QList<KisNodeDummy*> m_children;
KisNodeShape *m_nodeShape;
KisNodeSP m_node;
};
/**
* KisNodeDummiesGraph manages the hierarchy of dummy objects
* representing nodes in the UI environment.
*/
class KRITAUI_EXPORT KisNodeDummiesGraph
{
public:
KisNodeDummiesGraph();
KisNodeDummy* rootDummy() const;
KisNodeDummy* nodeToDummy(KisNodeSP node);
bool containsNode(KisNodeSP node) const;
int dummiesCount() const;
/**
* Adds a dummy \p node to the position specified
* by \p parent and \p aboveThis.
*
* It is not expected that you would add a dummy twice.
*/
void addNode(KisNodeDummy *node, KisNodeDummy *parent, KisNodeDummy *aboveThis);
/**
* Moves a dummy \p node from its current position to
* the position specified by \p parent and \p aboveThis.
*
* It is expected that the dummy \p node has been added
* to the graph with addNode() before calling this function.
*/
void moveNode(KisNodeDummy *node, KisNodeDummy *parent, KisNodeDummy *aboveThis);
/**
* Removes the dummy \p node from the graph.
*
* WARNING: The dummy is only "unlinked" from the graph. Neither
* deletion of the node nor deletion of its children happens.
* The dummy keeps maintaining its children so after unlinking
* it from the graph you can just type to free memory recursively:
* \code
* graph.removeNode(node);
* delete node;
* \endcode
*/
void removeNode(KisNodeDummy *node);
private:
void unmapDummyRecursively(KisNodeDummy *dummy);
private:
typedef QMap<KisNodeSP, KisNodeDummy*> NodeMap;
private:
KisNodeDummy *m_rootDummy;
NodeMap m_dummiesMap;
};
#endif /* __KIS_NODE_DUMMIES_GRAPH_H */
diff --git a/libs/ui/flake/kis_node_shape.h b/libs/ui/flake/kis_node_shape.h
index a145a5312e..b1536d93d1 100644
--- a/libs/ui/flake/kis_node_shape.h
+++ b/libs/ui/flake/kis_node_shape.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_SHAPE_H_
#define KIS_NODE_SHAPE_H_
#include <QObject>
#include <KoShapeLayer.h>
#include <kritaui_export.h>
#include <kis_types.h>
class KoViewConverter;
#define KIS_NODE_SHAPE_ID "KisNodeShape"
/**
* A KisNodeShape is a flake wrapper around Krita nodes. It is used
* for dealing with currently active node for tools.
*/
class KRITAUI_EXPORT KisNodeShape : public QObject, public KoShapeLayer
{
Q_OBJECT
public:
KisNodeShape(KisNodeSP node);
- virtual ~KisNodeShape();
+ ~KisNodeShape() override;
KisNodeSP node();
// Empty implementations as the node is not painted anywhere
- QSizeF size() const;
- QRectF boundingRect() const;
- void setPosition(const QPointF &);
- void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
- void saveOdf(KoShapeSavingContext & context) const;
- bool loadOdf(const KoXmlElement & element, KoShapeLoadingContext &context);
+ QSizeF size() const override;
+ QRectF boundingRect() const override;
+ void setPosition(const QPointF &) override;
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
+ void saveOdf(KoShapeSavingContext & context) const override;
+ bool loadOdf(const KoXmlElement & element, KoShapeLoadingContext &context) override;
private Q_SLOTS:
void setNodeVisible(bool);
void editabilityChanged();
private:
bool checkIfDescendant(KoShapeLayer *activeLayer);
private:
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/flake/kis_shape_controller.h b/libs/ui/flake/kis_shape_controller.h
index 4dabf118cd..23e6f413c3 100644
--- a/libs/ui/flake/kis_shape_controller.h
+++ b/libs/ui/flake/kis_shape_controller.h
@@ -1,87 +1,87 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHAPE_CONTROLLER
#define KIS_SHAPE_CONTROLLER
#include <QMap>
#include "kis_dummies_facade_base.h"
#include <KoShapeBasedDocumentBase.h>
class KisNodeDummy;
class KoShapeLayer;
class KisCanvas2;
class KisDocument;
class KisNameServer;
/**
* KisShapeController keeps track of new layers, shapes, masks and
* selections -- everything that needs to be wrapped as a shape for
* the tools to work on.
*/
class KRITAUI_EXPORT KisShapeController : public KisDummiesFacadeBase, public KoShapeBasedDocumentBase
{
Q_OBJECT
public:
KisShapeController(KisDocument *doc, KisNameServer *nameServer);
- ~KisShapeController();
+ ~KisShapeController() override;
- bool hasDummyForNode(KisNodeSP node) const;
- KisNodeDummy* dummyForNode(KisNodeSP layer) const;
- KisNodeDummy* rootDummy() const;
- int dummiesCount() const;
+ bool hasDummyForNode(KisNodeSP node) const override;
+ KisNodeDummy* dummyForNode(KisNodeSP layer) const override;
+ KisNodeDummy* rootDummy() const override;
+ int dummiesCount() const override;
KoShapeLayer* shapeForNode(KisNodeSP layer) const;
void setInitialShapeForCanvas(KisCanvas2 *canvas);
private:
- void addNodeImpl(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis);
- void removeNodeImpl(KisNodeSP node);
+ void addNodeImpl(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis) override;
+ void removeNodeImpl(KisNodeSP node) override;
Q_SIGNALS:
/**
* These three signals are forwarded from the local shape manager of
* KisShapeLayer. This is done because we switch KoShapeManager and
* therefore KoSelection in KisCanvas2, so we need to connect local
* managers to the UI as well.
*
* \see comment in the constructor of KisCanvas2
*/
void selectionChanged();
void selectionContentChanged();
void currentLayerChanged(const KoShapeLayer*);
public:
void addShapes(const QList<KoShape*> shapes) override;
void removeShape(KoShape* shape) override;
QRectF documentRectInPixels() const override;
qreal pixelsPerInch() const override;
private:
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/flake/kis_shape_layer.h b/libs/ui/flake/kis_shape_layer.h
index ef466c3d06..3118d208c0 100644
--- a/libs/ui/flake/kis_shape_layer.h
+++ b/libs/ui/flake/kis_shape_layer.h
@@ -1,181 +1,181 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2007 Thomas Zander <zander@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHAPE_LAYER_H_
#define KIS_SHAPE_LAYER_H_
#include <KoShapeLayer.h>
#include <kis_types.h>
#include <kis_external_layer_iface.h>
#include <kritaui_export.h>
#include <KisDelayedUpdateNodeInterface.h>
class QRect;
class QIcon;
class QRect;
class QString;
class KoShapeManager;
class KoStore;
class KoViewConverter;
class KoShapeBasedDocumentBase;
class KoDocumentResourceManager;
const QString KIS_SHAPE_LAYER_ID = "KisShapeLayer";
/**
A KisShapeLayer contains any number of non-krita flakes, such as
path shapes, text shapes and anything else people come up with.
The KisShapeLayer has a shapemanager and a canvas of its own. The
canvas paints onto the projection, and the projection is what we
render in Krita. This means that no matter how many views you have,
you cannot have a different view on your shapes per view.
XXX: what about removing shapes?
*/
class KRITAUI_EXPORT KisShapeLayer : public KisExternalLayer, public KoShapeLayer, public KisDelayedUpdateNodeInterface
{
Q_OBJECT
public:
KisShapeLayer(KoShapeBasedDocumentBase* shapeController, KisImageWSP image, const QString &name, quint8 opacity);
KisShapeLayer(const KisShapeLayer& _rhs);
KisShapeLayer(const KisShapeLayer& _rhs, KoShapeBasedDocumentBase* controller);
/**
* Merge constructor.
*
* Creates a new layer as a merge of two existing layers.
*
* This is used by createMergedLayer()
*/
KisShapeLayer(const KisShapeLayer& _merge, const KisShapeLayer &_addShapes);
- virtual ~KisShapeLayer();
+ ~KisShapeLayer() override;
private:
void initShapeLayer(KoShapeBasedDocumentBase* controller);
public:
KisNodeSP clone() const override {
return new KisShapeLayer(*this);
}
bool allowAsChild(KisNodeSP) const override;
void setImage(KisImageWSP image) override;
- virtual KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer) override;
- virtual void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer) override;
+ KisLayerSP createMergedLayerTemplate(KisLayerSP prevLayer) override;
+ void fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prevLayer) override;
public:
// KoShape overrides
bool isSelectable() const {
return false;
}
void setParent(KoShapeContainer *parent);
// KisExternalLayer implementation
QIcon icon() const override;
void resetCache() override;
KisPaintDeviceSP original() const override;
KisPaintDeviceSP paintDevice() const override;
qint32 x() const override;
qint32 y() const override;
void setX(qint32) override;
void setY(qint32) override;
bool accept(KisNodeVisitor&) override;
void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
KoShapeManager *shapeManager() const;
static bool saveShapesToStore(KoStore *store, QList<KoShape*> shapes, const QSizeF &sizeInPt);
static QList<KoShape *> createShapesFromSvg(QIODevice *device,
const QString &baseXmlDir,
const QRectF &rectInPixels,
qreal resolutionPPI,
KoDocumentResourceManager *resourceManager,
QSizeF *fragmentSize);
bool saveLayer(KoStore * store) const;
bool loadLayer(KoStore* store);
KUndo2Command* crop(const QRect & rect) override;
KUndo2Command* transform(const QTransform &transform) override;
bool visible(bool recursive = false) const override;
void setVisible(bool visible, bool isLoading = false) override;
/**
* Forces a repaint of a shape layer without waiting for an event loop
* calling a delayed timer update. If you want to see the result of the shape
* layer right here and right now, you should do:
*
* shapeLayer->setDirty();
* shapeLayer->image()->waitForDone();
* shapeLayer->forceUpdateTimedNode();
* shapeLayer->image()->waitForDone();
*
*/
void forceUpdateTimedNode() override;
protected:
using KoShape::isVisible;
bool loadSvg(QIODevice *device, const QString &baseXmlDir);
friend class ShapeLayerContainerModel;
KoViewConverter* converter() const;
Q_SIGNALS:
/**
* These signals are forwarded from the local shape manager
* This is done because we switch KoShapeManager and therefore
* KoSelection in KisCanvas2, so we need to connect local managers
* to the UI as well.
*
* \see comment in the constructor of KisCanvas2
*/
void selectionChanged();
void currentLayerChanged(const KoShapeLayer *layer);
Q_SIGNALS:
/**
* A signal + slot to synchronize UI and image
* threads. Image thread emits the signal, UI
* thread performes the action
*/
void sigMoveShapes(const QPointF &diff);
private Q_SLOTS:
void slotMoveShapes(const QPointF &diff);
private:
QList<KoShape*> shapesToBeTransformed();
private:
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/flake/kis_shape_layer_canvas.h b/libs/ui/flake/kis_shape_layer_canvas.h
index 845cba8cbb..823570c1be 100644
--- a/libs/ui/flake/kis_shape_layer_canvas.h
+++ b/libs/ui/flake/kis_shape_layer_canvas.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHAPE_LAYER_CANVAS_H
#define KIS_SHAPE_LAYER_CANVAS_H
#include <QMutex>
#include <QRegion>
#include <KoCanvasBase.h>
#include <kis_types.h>
class KoShapeManager;
class KoToolProxy;
class KoViewConverter;
class KUndo2Command;
class QWidget;
class KoUnit;
class KisImageViewConverter;
/**
* KisShapeLayerCanvas is a special canvas implementation that Krita
* uses for non-krita shapes to request updates on.
*
* Do NOT give this canvas to tools or to the KoCanvasController, it's
* not made for that.
*/
class KisShapeLayerCanvas : public KoCanvasBase
{
Q_OBJECT
public:
KisShapeLayerCanvas(KisShapeLayer *parent, KisImageWSP image);
- virtual ~KisShapeLayerCanvas();
+ ~KisShapeLayerCanvas() override;
/// This canvas won't render onto a widget, but a projection
void setProjection(KisPaintDeviceSP projection) {
m_projection = projection;
}
void setImage(KisImageWSP image);
void prepareForDestroying();
- void gridSize(QPointF *offset, QSizeF *spacing) const;
- bool snapToGrid() const;
- void addCommand(KUndo2Command *command);
+ void gridSize(QPointF *offset, QSizeF *spacing) const override;
+ bool snapToGrid() const override;
+ void addCommand(KUndo2Command *command) override;
KoShapeManager *shapeManager() const override;
KoSelectedShapesProxy *selectedShapesProxy() const override;
- void updateCanvas(const QRectF& rc);
- KoToolProxy * toolProxy() const;
- KoViewConverter* viewConverter() const;
- QWidget* canvasWidget();
- const QWidget* canvasWidget() const;
- KoUnit unit() const;
- virtual void updateInputMethodInfo() {}
- virtual void setCursor(const QCursor &) {}
+ void updateCanvas(const QRectF& rc) override;
+ KoToolProxy * toolProxy() const override;
+ KoViewConverter* viewConverter() const override;
+ QWidget* canvasWidget() override;
+ const QWidget* canvasWidget() const override;
+ KoUnit unit() const override;
+ void updateInputMethodInfo() override {}
+ void setCursor(const QCursor &) override {}
void forceRepaint();
private Q_SLOTS:
void repaint();
Q_SIGNALS:
void forwardRepaint();
private:
bool m_isDestroying;
QScopedPointer<KisImageViewConverter> m_viewConverter;
QScopedPointer<KoShapeManager> m_shapeManager;
QScopedPointer<KoSelectedShapesProxy> m_selectedShapesProxy;
KisPaintDeviceSP m_projection;
KisShapeLayer *m_parentLayer;
QRegion m_dirtyRegion;
QMutex m_dirtyRegionMutex;
};
#endif
diff --git a/libs/ui/flake/kis_shape_selection.h b/libs/ui/flake/kis_shape_selection.h
index c21b7e26e3..c5d09b06db 100644
--- a/libs/ui/flake/kis_shape_selection.h
+++ b/libs/ui/flake/kis_shape_selection.h
@@ -1,131 +1,131 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHAPE_SELECTION_H
#define KIS_SHAPE_SELECTION_H
#include <KoShapeLayer.h>
#include <KoShapeFactoryBase.h>
#include <KoShapeUserData.h>
#include <KoShapeLoadingContext.h>
#include <kis_selection_component.h>
#include <kis_types.h>
#include <kritaui_export.h>
class KoStore;
class KoShapeManager;
class KisShapeSelectionCanvas;
class KisShapeSelectionModel;
class KisImageViewConverter;
class KUndo2Command;
/**
* The marker class.
* It is added to the shape's user data to show this shape
* is a part of a shape selection
*/
class KisShapeSelectionMarker : public KoShapeUserData
{
KoShapeUserData* clone() const override {
return new KisShapeSelectionMarker(*this);
}
};
class KRITAUI_EXPORT KisShapeSelection : public KoShapeLayer, public KisSelectionComponent
{
KisShapeSelection(const KisShapeSelection& rhs);
public:
KisShapeSelection(KisImageWSP image, KisSelectionWSP selection);
- virtual ~KisShapeSelection();
+ ~KisShapeSelection() override;
KisShapeSelection(const KisShapeSelection& rhs, KisSelection* selection);
- KisSelectionComponent* clone(KisSelection* selection);
+ KisSelectionComponent* clone(KisSelection* selection) override;
bool saveSelection(KoStore * store) const;
bool loadSelection(KoStore * store);
/**
* Renders the shapes to a selection. This method should only be called
* by KisSelection to update it's projection.
*
* @param projection the target selection
*/
- virtual void renderToProjection(KisPaintDeviceSP projection);
- virtual void renderToProjection(KisPaintDeviceSP projection, const QRect& r);
+ void renderToProjection(KisPaintDeviceSP projection) override;
+ void renderToProjection(KisPaintDeviceSP projection, const QRect& r) override;
- KUndo2Command* resetToEmpty();
- bool isEmpty() const;
+ KUndo2Command* resetToEmpty() override;
+ bool isEmpty() const override;
- QPainterPath outlineCache() const;
- bool outlineCacheValid() const;
- void recalculateOutlineCache();
+ QPainterPath outlineCache() const override;
+ bool outlineCacheValid() const override;
+ void recalculateOutlineCache() override;
KoShapeManager *shapeManager() const;
- void moveX(qint32 x);
- void moveY(qint32 y);
+ void moveX(qint32 x) override;
+ void moveY(qint32 y) override;
- KUndo2Command* transform(const QTransform &transform);
+ KUndo2Command* transform(const QTransform &transform) override;
protected:
- virtual void paintComponent(QPainter& painter, const KoViewConverter& converter, KoShapePaintingContext &paintcontext);
+ void paintComponent(QPainter& painter, const KoViewConverter& converter, KoShapePaintingContext &paintcontext) override;
private:
friend class KisTakeAllShapesCommand;
void setUpdatesEnabled(bool enabled);
bool updatesEnabled() const;
private:
void renderSelection(KisPaintDeviceSP projection, const QRect& r);
KisImageWSP m_image;
QPainterPath m_outline;
KisImageViewConverter* m_converter;
KisShapeSelectionCanvas* m_canvas;
KisShapeSelectionModel* m_model;
friend class KisShapeSelectionModel;
};
class KRITAUI_EXPORT KisShapeSelectionFactory : public KoShapeFactoryBase
{
public:
KisShapeSelectionFactory();
- ~KisShapeSelectionFactory() {}
+ ~KisShapeSelectionFactory() override {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const {
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override {
Q_UNUSED(documentResources);
return 0;
}
- virtual bool supports(const KoXmlElement & e, KoShapeLoadingContext &context) const {
+ bool supports(const KoXmlElement & e, KoShapeLoadingContext &context) const override {
Q_UNUSED(e);
Q_UNUSED(context);
return false;
}
};
#endif
diff --git a/libs/ui/flake/kis_shape_selection_canvas.h b/libs/ui/flake/kis_shape_selection_canvas.h
index f50a2410b7..73d3fa0b66 100644
--- a/libs/ui/flake/kis_shape_selection_canvas.h
+++ b/libs/ui/flake/kis_shape_selection_canvas.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHAPE_SELECTION_CANVAS_H
#define KIS_SHAPE_SELECTION_CANVAS_H
#include <QScopedPointer>
#include <KoCanvasBase.h>
#include <kis_types.h>
class KoShapeManager;
class KoToolProxy;
class KoViewConverter;
class KUndo2Command;
class QWidget;
class KoUnit;
/**
* Dummy canvas just to have a shapemanager for the shape selection
*/
class KisShapeSelectionCanvas : public KoCanvasBase
{
Q_OBJECT
public:
KisShapeSelectionCanvas();
- virtual ~KisShapeSelectionCanvas();
+ ~KisShapeSelectionCanvas() override;
- void gridSize(QPointF *offset, QSizeF *spacing) const;
- bool snapToGrid() const;
- void addCommand(KUndo2Command *command);
+ void gridSize(QPointF *offset, QSizeF *spacing) const override;
+ bool snapToGrid() const override;
+ void addCommand(KUndo2Command *command) override;
KoShapeManager *shapeManager() const override;
KoSelectedShapesProxy *selectedShapesProxy() const override;
- void updateCanvas(const QRectF& rc);
- KoToolProxy * toolProxy() const;
- KoViewConverter *viewConverter() const;
- QWidget* canvasWidget();
- const QWidget* canvasWidget() const;
- KoUnit unit() const;
- virtual void updateInputMethodInfo() {}
- virtual void setCursor(const QCursor &) {}
+ void updateCanvas(const QRectF& rc) override;
+ KoToolProxy * toolProxy() const override;
+ KoViewConverter *viewConverter() const override;
+ QWidget* canvasWidget() override;
+ const QWidget* canvasWidget() const override;
+ KoUnit unit() const override;
+ void updateInputMethodInfo() override {}
+ void setCursor(const QCursor &) override {}
private:
QScopedPointer<KoShapeManager> m_shapeManager;
QScopedPointer<KoSelectedShapesProxy> m_selectedShapesProxy;
};
#endif
diff --git a/libs/ui/flake/kis_shape_selection_model.h b/libs/ui/flake/kis_shape_selection_model.h
index 3e37e9189f..f4fe2ba35f 100644
--- a/libs/ui/flake/kis_shape_selection_model.h
+++ b/libs/ui/flake/kis_shape_selection_model.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHAPE_SELECTION_MODEL_H
#define KIS_SHAPE_SELECTION_MODEL_H
#include <QObject>
#include <QRect>
#include "KoShapeContainerModel.h"
#include "kis_types.h"
#include "kis_signal_compressor.h"
class KisShapeSelection;
/**
*
*/
class KisShapeSelectionModel: public QObject, public KoShapeContainerModel
{
Q_OBJECT
public:
KisShapeSelectionModel(KisImageWSP image, KisSelectionWSP selection, KisShapeSelection* shapeSelection);
- ~KisShapeSelectionModel();
+ ~KisShapeSelectionModel() override;
- void add(KoShape *child);
- void remove(KoShape *child);
+ void add(KoShape *child) override;
+ void remove(KoShape *child) override;
void setUpdatesEnabled(bool enabled);
bool updatesEnabled() const;
- void setClipped(const KoShape *child, bool clipping);
- bool isClipped(const KoShape *child) const;
- virtual void setInheritsTransform(const KoShape *shape, bool inherit);
- virtual bool inheritsTransform(const KoShape *shape) const;
+ void setClipped(const KoShape *child, bool clipping) override;
+ bool isClipped(const KoShape *child) const override;
+ void setInheritsTransform(const KoShape *shape, bool inherit) override;
+ bool inheritsTransform(const KoShape *shape) const override;
- int count() const;
- QList<KoShape*> shapes() const;
+ int count() const override;
+ QList<KoShape*> shapes() const override;
- void containerChanged(KoShapeContainer *, KoShape::ChangeType);
- void childChanged(KoShape * child, KoShape::ChangeType type);
- bool isChildLocked(const KoShape *child) const;
+ void containerChanged(KoShapeContainer *, KoShape::ChangeType) override;
+ void childChanged(KoShape * child, KoShape::ChangeType type) override;
+ bool isChildLocked(const KoShape *child) const override;
void setShapeSelection(KisShapeSelection* selection);
private Q_SLOTS:
void requestUpdate(const QRect &updateRect);
void startUpdateJob();
private:
QMap<KoShape*, QRectF> m_shapeMap;
KisImageWSP m_image;
KisSelectionWSP m_parentSelection;
KisShapeSelection* m_shapeSelection;
KisSignalCompressor *m_updateSignalCompressor;
QRect m_updateRect;
bool m_updatesEnabled;
bool m_fullUpdateRequested;
};
#endif
diff --git a/libs/ui/flake/kis_take_all_shapes_command.h b/libs/ui/flake/kis_take_all_shapes_command.h
index 5a84758690..e07f4af8e0 100644
--- a/libs/ui/flake/kis_take_all_shapes_command.h
+++ b/libs/ui/flake/kis_take_all_shapes_command.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TAKE_ALL_SHAPES_COMMAND_H
#define __KIS_TAKE_ALL_SHAPES_COMMAND_H
#include <QList>
#include "kundo2command.h"
#include "kritaui_export.h"
#include "kis_types.h"
class KoShape;
class KisShapeSelection;
class KisTakeAllShapesCommand : public KUndo2Command
{
public:
KisTakeAllShapesCommand(KisShapeSelection *shapeSelection, bool takeSilently);
- ~KisTakeAllShapesCommand();
+ ~KisTakeAllShapesCommand() override;
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
KisShapeSelection *m_shapeSelection;
QList<KoShape*> m_shapes;
bool m_takeSilently;
};
#endif /* __KIS_TAKE_ALL_SHAPES_COMMAND_H */
diff --git a/libs/ui/forms/KisOpenPaneBase.ui b/libs/ui/forms/KisOpenPaneBase.ui
index 1768c7e224..09275f8796 100644
--- a/libs/ui/forms/KisOpenPaneBase.ui
+++ b/libs/ui/forms/KisOpenPaneBase.ui
@@ -1,96 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KisOpenPaneBase</class>
<widget class="QWidget" name="KisOpenPaneBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>505</width>
<height>270</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QSplitter" name="splitter">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="m_sectionList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>170</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>48</width>
+ <height>48</height>
+ </size>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights">
+ <bool>false</bool>
+ </property>
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <widget class="QStackedWidget" name="m_widgetStack">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <widget class="QWidget" name="layoutWidget">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTreeWidget" name="m_sectionList">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>170</width>
- <height>0</height>
- </size>
- </property>
- <property name="iconSize">
- <size>
- <width>48</width>
- <height>48</height>
- </size>
- </property>
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="uniformRowHeights">
- <bool>false</bool>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <property name="allColumnsShowFocus">
- <bool>true</bool>
- </property>
- <attribute name="headerVisible">
- <bool>false</bool>
- </attribute>
- <column>
- <property name="text">
- <string notr="true">1</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelButton">
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QStackedWidget" name="m_widgetStack">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <widget class="QWidget" name="WStackPage"/>
- </widget>
+ <widget class="QWidget" name="WStackPage"/>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
diff --git a/libs/ui/forms/wdgpaintopsettings.ui b/libs/ui/forms/wdgpaintopsettings.ui
index 6b523533bc..a31e331e3a 100644
--- a/libs/ui/forms/wdgpaintopsettings.ui
+++ b/libs/ui/forms/wdgpaintopsettings.ui
@@ -1,569 +1,568 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WdgPaintOpSettings</class>
<widget class="QWidget" name="WdgPaintOpSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1405</width>
<height>512</height>
</rect>
</property>
<property name="windowTitle">
<string>Brush Editor</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QGroupBox" name="brushEditorSettingsControls">
<layout class="QVBoxLayout" name="brushEditorLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<item>
<widget class="QFrame" name="frmOptionWidgetContainer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0,0,0">
<property name="spacing">
<number>20</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QCheckBox" name="eraserBrushSizeCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase mode will use a separate brush size</string>
</property>
<property name="text">
<string>Eraser switch size</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="dirtyPresetCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Temporarily Save Tweaks To Presets</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="eraserBrushOpacityCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase mode will use a separate brush opacity</string>
</property>
<property name="text">
<string>Eraser switch opacity</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KisLodAvailabilityWidget" name="wdgLodAvailability" native="true">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="bnDefaultPreset">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Load Engine Defaults</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reload">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Reload Preset</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txtPreset">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Current Brush Preset. Typed in italic when the preset has unsaved settings.</string>
</property>
<property name="frame">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bnSave">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Save the current brush settings under this name</string>
</property>
<property name="text">
<string>&amp;Save to Presets</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="2">
<widget class="QGroupBox" name="scratchpadControls">
<property name="title">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="KisScratchPad" name="scratchPad" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>300</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0,0">
<item>
<widget class="QPushButton" name="paintPresetIcon">
<property name="toolTip">
<string>Fill preset area with current icon</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fillLayer">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fillGradient">
<property name="toolTip">
<string>Fill area with gradient</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fillSolid">
<property name="toolTip">
<string>Fill area with background color</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="eraseScratchPad">
<property name="toolTip">
<string>Reset area to white</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="3">
<layout class="QHBoxLayout" name="brushEditorDashboard">
<item>
<widget class="KisHighlightedToolButton" name="showPresetsButton" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>35</width>
<height>20</height>
</size>
</property>
<property name="text" stdset="0">
<string/>
</property>
</widget>
</item>
<item>
<widget class="KisHighlightedToolButton" name="showEditorButton" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>35</width>
<height>30</height>
</size>
</property>
<property name="text" stdset="0">
<string>Settings</string>
</property>
</widget>
</item>
<item>
<widget class="KisHighlightedToolButton" name="showScratchpadButton" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>35</width>
<height>30</height>
</size>
</property>
<property name="text" stdset="0">
<string>Scratchpad</string>
</property>
<property name="checkable" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="currentBrushNameLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Current Brush Name</string>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>20</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="presetsContainer">
<layout class="QVBoxLayout" name="paintEngineOpContainer">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Engine:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="brushEgineComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="presetChangeViewToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>View</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="KisPresetSelectorStrip" name="presetWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>350</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1677215</width>
<height>1677215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<zorder>presetsContainer</zorder>
<zorder>brushEditorSettingsControls</zorder>
<zorder>scratchpadControls</zorder>
- <zorder></zorder>
</widget>
<customwidgets>
<customwidget>
<class>KisScratchPad</class>
<extends>QWidget</extends>
<header>kis_scratch_pad.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisPresetSelectorStrip</class>
<extends>QWidget</extends>
<header>kis_preset_selector_strip.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisLodAvailabilityWidget</class>
<extends>QWidget</extends>
<header>kis_lod_availability_widget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisHighlightedToolButton</class>
<extends>QWidget</extends>
<header>kis_highlighted_button.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/libs/ui/input/config/kis_action_shortcuts_model.h b/libs/ui/input/config/kis_action_shortcuts_model.h
index 1312526f29..e3fffaf8f3 100644
--- a/libs/ui/input/config/kis_action_shortcuts_model.h
+++ b/libs/ui/input/config/kis_action_shortcuts_model.h
@@ -1,124 +1,124 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISACTIONSHORTCUTSMODEL_H
#define KISACTIONSHORTCUTSMODEL_H
#include <QAbstractListModel>
class KisAbstractInputAction;
class KisInputProfile;
/**
* \brief A QAbstractListModel subclass that lists shortcuts associated with an action from a profile.
*
* This class lists all shortcuts from the set profile that correspond to a specific action. This is
* used to allow editing of shortcuts from the ui.
*
* It defines the following columns:
* - Type: The type of shortcut, can be one of Key Combination, Mouse Button, Mouse Wheel, Gesture
* - Input: What input is used to activate the shortcut. Depends on the type.
* - Action: What mode of the action will be activated by the shortcut.
*
* \note Before this model will provide any data you should call setAction and setProfile.
* \note This model is editable and provides an implementation of removeRows.
*/
class KisActionShortcutsModel : public QAbstractListModel
{
Q_OBJECT
public:
/**
* Constructor.
*/
explicit KisActionShortcutsModel(QObject *parent = 0);
/**
* Destructor.
*/
- ~KisActionShortcutsModel();
+ ~KisActionShortcutsModel() override;
/**
* Reimplemented from QAbstractItemModel::data()
*/
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/**
* Reimplemented from QAbstractItemModel::rowCount()
*/
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
/**
* Reimplemented from QAbstractItemModel::columnCount()
*/
- virtual int columnCount(const QModelIndex &) const;
+ int columnCount(const QModelIndex &) const override;
/**
* Reimplemented from QAbstractItemModel::headerData()
*/
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role =
- Qt::DisplayRole) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role =
+ Qt::DisplayRole) const override;
/**
* Reimplemented from QAbstractItemModel::flags()
*/
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
/**
* Reimplemented from QAbstractItemModel::setData()
*/
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
/**
* Reimplemented from QAbstractItemModel::removeRows.
*
* Removes `count` rows starting at `row`.
*
* \note The associated shortcuts will also be removed from the profile and completely
* deleted.
*/
- virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
/**
* \return The action used as data constraint for this model.
*/
KisAbstractInputAction *action() const;
/**
* \return The profile used as data source for this model.
*/
KisInputProfile *profile() const;
bool canRemoveRow(int row) const;
public Q_SLOTS:
/**
* Set the action used as data constraint for this model.
*
* \param action The action to use.
*/
void setAction(KisAbstractInputAction *action);
/**
* Set the profile used as data source for this model.
*
* \param profile The profile to get the data from.
*/
void setProfile(KisInputProfile *profile);
private Q_SLOTS:
void currentProfileChanged();
private:
class Private;
Private *const d;
};
#endif // KISACTIONSHORTCUTSMODEL_H
diff --git a/libs/ui/input/config/kis_edit_profiles_dialog.h b/libs/ui/input/config/kis_edit_profiles_dialog.h
index a3dc165ac5..c22b416be6 100644
--- a/libs/ui/input/config/kis_edit_profiles_dialog.h
+++ b/libs/ui/input/config/kis_edit_profiles_dialog.h
@@ -1,47 +1,47 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISEDITPROFILESDIALOG_H
#define KISEDITPROFILESDIALOG_H
#include <KoDialog.h>
/**
* \brief A dialog that provides facilities to edit all the available profiles.
*
*/
class KisEditProfilesDialog : public KoDialog
{
Q_OBJECT
public:
KisEditProfilesDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~KisEditProfilesDialog();
+ ~KisEditProfilesDialog() override;
private Q_SLOTS:
void removeButtonClicked();
void duplicateButtonClicked();
void renameButtonClicked();
void resetButtonClicked();
private:
class Private;
Private *const d;
};
#endif // KISEDITPROFILESDIALOG_H
diff --git a/libs/ui/input/config/kis_input_button.h b/libs/ui/input/config/kis_input_button.h
index 58ba21a76d..b9ae279778 100644
--- a/libs/ui/input/config/kis_input_button.h
+++ b/libs/ui/input/config/kis_input_button.h
@@ -1,143 +1,143 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTBUTTON_H
#define KISINPUTBUTTON_H
#include <QPushButton>
#include "input/kis_shortcut_configuration.h"
/**
* \brief A button that can detect input and will store its value.
*
* This button, when pressed, will detect input based on what type has been set.
* It is mainly intended for shortcut configuration, that is, picking some input that is
* later reused for shortcuts or similar.
*
*/
class KisInputButton : public QPushButton
{
Q_OBJECT
public:
/**
* The type of button.
*/
enum ButtonType {
MouseType, ///< Detect and store any combination of pressed mouse buttons.
KeyType, ///< Detect and store any combination of key presses.
WheelType, ///< Detect and store mouse wheel movement.
};
/**
* Constructor.
*/
explicit KisInputButton(QWidget *parent = 0);
/**
* Destructor.
*/
- virtual ~KisInputButton();
+ ~KisInputButton() override;
/**
* \return The type of input this button detects.
*/
ButtonType type() const;
/**
* Set the type of input this button should detect.
*
* \param newType The type of input to detect.
*/
void setType(ButtonType newType);
/**
* \return The list of keys that was detected. Only applicable when type is `KeyType`.
*/
QList<Qt::Key> keys() const;
/**
* Set the list of keys to display.
*
* This is mostly intended to make sure the button displays the right keys when viewed
* in a dialog or similar UI.
*
* Only applicable when type is `KeyType`.
*
* \param newKeys The list of keys to display.
*/
void setKeys(const QList<Qt::Key> &newKeys);
/**
* \return The mouse buttons that were detected. Only applicable when type is `MouseType`.
*/
Qt::MouseButtons buttons() const;
/**
* Set the mouse buttons to display.
*
* This is mostly intended to make sure the button displays the right buttons when viewed
* in a dialog or similar UI.
*
* Only applicable when type is `MouseType`.
*
* \param newButtons The mouse buttons to display.
*/
void setButtons(Qt::MouseButtons newButtons);
/**
* \return The mouse wheel movement that was detected. Only applicable when type is `WheelType`.
*/
KisShortcutConfiguration::MouseWheelMovement wheel() const;
/**
* Set the mouse wheel movement to display.
*
* This is mostly intended to make sure the button displays the right wheel movement when
* viewed in a dialog or similar UI.
*
* Only applicable when type is `WheelType`.
*
* \param newButtons The wheel movement to display.
*/
void setWheel(KisShortcutConfiguration::MouseWheelMovement wheel);
public Q_SLOTS:
/**
* Clear all detected input and reset the button to an empty state.
*/
void clear();
Q_SIGNALS:
/**
* Emitted whenever one of the values (keys, buttons, wheel) changes.
*/
void dataChanged();
protected:
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void wheelEvent(QWheelEvent *event);
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void keyReleaseEvent(QKeyEvent *event);
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void wheelEvent(QWheelEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
private Q_SLOTS:
void reset();
private:
class Private;
Private *const d;
};
#endif // KISINPUTBUTTON_H
diff --git a/libs/ui/input/config/kis_input_configuration_page_item.h b/libs/ui/input/config/kis_input_configuration_page_item.h
index f0c26ae496..0aa6575bf3 100644
--- a/libs/ui/input/config/kis_input_configuration_page_item.h
+++ b/libs/ui/input/config/kis_input_configuration_page_item.h
@@ -1,59 +1,59 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTCONFIGURATIONPAGEITEM_H
#define KISINPUTCONFIGURATIONPAGEITEM_H
#include <QWidget>
namespace Ui
{
class KisInputConfigurationPageItem;
}
class KisActionShortcutsModel;
class KisAbstractInputAction;
/**
* \brief A collapsible widget displaying an action, its description and associated shortcuts.
*
* This is used in KisInputConfigurationPage to display a list of actions and the associated
* shortcuts, depending on the current profile.
*/
class KisInputConfigurationPageItem : public QWidget
{
Q_OBJECT
public:
KisInputConfigurationPageItem(QWidget *parent = 0, Qt::WindowFlags f = 0);
- ~KisInputConfigurationPageItem();
+ ~KisInputConfigurationPageItem() override;
void setAction(KisAbstractInputAction *action);
public Q_SLOTS:
void setExpanded(bool expand);
private Q_SLOTS:
void deleteShortcut();
private:
Ui::KisInputConfigurationPageItem *ui;
KisAbstractInputAction *m_action;
KisActionShortcutsModel *m_shortcutsModel;
};
#endif // KISINPUTCONFIGURATIONPAGEITEM_H
diff --git a/libs/ui/input/config/kis_input_editor_delegate.h b/libs/ui/input/config/kis_input_editor_delegate.h
index fbc38a8c2e..de75e7dfff 100644
--- a/libs/ui/input/config/kis_input_editor_delegate.h
+++ b/libs/ui/input/config/kis_input_editor_delegate.h
@@ -1,46 +1,46 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTEDITORDELEGATE_H
#define KISINPUTEDITORDELEGATE_H
#include <QStyledItemDelegate>
/**
* \brief A delegate providing editors for the keys/buttons/etc. of KisShortcutConfiguration.
*/
class KisInputEditorDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
KisInputEditorDelegate(QObject *parent = 0);
- ~KisInputEditorDelegate();
+ ~KisInputEditorDelegate() override;
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const;
- virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
- virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
- virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const override;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
class Private;
Private *const d;
};
#endif // KISINPUTEDITORDELEGATE_H
diff --git a/libs/ui/input/config/kis_input_mode_delegate.h b/libs/ui/input/config/kis_input_mode_delegate.h
index c25908d48d..666d5997d5 100644
--- a/libs/ui/input/config/kis_input_mode_delegate.h
+++ b/libs/ui/input/config/kis_input_mode_delegate.h
@@ -1,48 +1,48 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTMODEDELEGATE_H
#define KISINPUTMODEDELEGATE_H
#include <QStyledItemDelegate>
class KisAbstractInputAction;
/**
* \brief A delegate providing editors for the mode property of KisShortcutConfiguration.
*/
class KisInputModeDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit KisInputModeDelegate(QObject *parent = 0);
- ~KisInputModeDelegate();
+ ~KisInputModeDelegate() override;
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const;
- virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
- virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
- virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const override;
void setAction(KisAbstractInputAction *action);
private:
class Private;
Private *const d;
};
#endif // KISINPUTMODEDELEGATE_H
diff --git a/libs/ui/input/config/kis_input_profile_model.h b/libs/ui/input/config/kis_input_profile_model.h
index 58f208a9a2..0e2a74dca8 100644
--- a/libs/ui/input/config/kis_input_profile_model.h
+++ b/libs/ui/input/config/kis_input_profile_model.h
@@ -1,44 +1,44 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTPROFILEMODEL_H
#define KISINPUTPROFILEMODEL_H
#include <QStringListModel>
/**
* \brief A model providing a list of profiles available.
*/
class KisInputProfileModel : public QStringListModel
{
Q_OBJECT
public:
KisInputProfileModel(QObject *parent = 0);
- ~KisInputProfileModel();
+ ~KisInputProfileModel() override;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int = Qt::EditRole);
+ bool setData(const QModelIndex &index, const QVariant &value, int = Qt::EditRole) override;
QString profileName(const QModelIndex &index);
QModelIndex find(const QString &name);
private Q_SLOTS:
void profileNamesChanged();
};
#endif // KISINPUTPROFILEMODEL_H
diff --git a/libs/ui/input/config/kis_input_type_delegate.h b/libs/ui/input/config/kis_input_type_delegate.h
index d3594dded2..fc31e31511 100644
--- a/libs/ui/input/config/kis_input_type_delegate.h
+++ b/libs/ui/input/config/kis_input_type_delegate.h
@@ -1,45 +1,45 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTTYPEDELEGATE_H
#define KISINPUTTYPEDELEGATE_H
#include <QStyledItemDelegate>
/**
* \brief A delegate providing editors for the type property of KisShortcutConfiguration.
*/
class KisInputTypeDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit KisInputTypeDelegate(QObject *parent = 0);
- ~KisInputTypeDelegate();
+ ~KisInputTypeDelegate() override;
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const;
- virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
- virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
- virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const;
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &) const override;
private:
class Private;
Private *const d;
};
#endif // KISINPUTTYPEDELEGATE_H
diff --git a/libs/ui/input/config/kis_key_input_editor.h b/libs/ui/input/config/kis_key_input_editor.h
index 900daac3b7..e44390f235 100644
--- a/libs/ui/input/config/kis_key_input_editor.h
+++ b/libs/ui/input/config/kis_key_input_editor.h
@@ -1,54 +1,54 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISKEYINPUTEDITOR_H
#define KISKEYINPUTEDITOR_H
#include <QPushButton>
namespace Ui
{
class KisKeyInputEditor;
}
/**
* \brief An editor widget for a list of keys.
*/
class KisKeyInputEditor : public QPushButton
{
Q_OBJECT
public:
KisKeyInputEditor(QWidget *parent = 0);
- ~KisKeyInputEditor();
+ ~KisKeyInputEditor() override;
QList<Qt::Key> keys() const;
void setKeys(const QList<Qt::Key> &newKeys);
Qt::MouseButtons buttons() const;
void setButtons(Qt::MouseButtons newButtons);
private Q_SLOTS:
void updateLabel();
private:
class Private;
Private *const d;
};
#endif // KISKEYINPUTEDITOR_H
diff --git a/libs/ui/input/config/kis_mouse_input_editor.h b/libs/ui/input/config/kis_mouse_input_editor.h
index 59cb30e03e..f2664044e9 100644
--- a/libs/ui/input/config/kis_mouse_input_editor.h
+++ b/libs/ui/input/config/kis_mouse_input_editor.h
@@ -1,54 +1,54 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISMOUSEINPUTEDITOR_H
#define KISMOUSEINPUTEDITOR_H
#include <QPushButton>
namespace Ui
{
class KisMouseInputEditor;
}
/**
* \brief An editor widget for mouse buttons with modifiers.
*/
class KisMouseInputEditor : public QPushButton
{
Q_OBJECT
public:
KisMouseInputEditor(QWidget *parent = 0);
- ~KisMouseInputEditor();
+ ~KisMouseInputEditor() override;
QList<Qt::Key> keys() const;
void setKeys(const QList<Qt::Key> &newKeys);
Qt::MouseButtons buttons() const;
void setButtons(Qt::MouseButtons newButtons);
private Q_SLOTS:
void updateLabel();
private:
class Private;
Private *const d;
};
#endif // KISMOUSEINPUTEDITOR_H
diff --git a/libs/ui/input/config/kis_wheel_input_editor.h b/libs/ui/input/config/kis_wheel_input_editor.h
index d69b605863..4ee8f6ba11 100644
--- a/libs/ui/input/config/kis_wheel_input_editor.h
+++ b/libs/ui/input/config/kis_wheel_input_editor.h
@@ -1,56 +1,56 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISWHEELINPUTEDITOR_H
#define KISWHEELINPUTEDITOR_H
#include <QPushButton>
#include "input/kis_shortcut_configuration.h"
namespace Ui
{
class KisWheelInputEditor;
}
/**
* \brief An editor widget for mouse wheel input with modifiers.
*/
class KisWheelInputEditor : public QPushButton
{
Q_OBJECT
public:
KisWheelInputEditor(QWidget *parent = 0);
- ~KisWheelInputEditor();
+ ~KisWheelInputEditor() override;
QList<Qt::Key> keys() const;
void setKeys(const QList<Qt::Key> &newKeys);
KisShortcutConfiguration::MouseWheelMovement wheel() const;
void setWheel(KisShortcutConfiguration::MouseWheelMovement newWheel);
private Q_SLOTS:
void updateLabel();
private:
class Private;
Private *const d;
};
#endif // KISWHEELINPUTEDITOR_H
diff --git a/libs/ui/input/kis_alternate_invocation_action.h b/libs/ui/input/kis_alternate_invocation_action.h
index b47c59e753..dd8e5fdeb5 100644
--- a/libs/ui/input/kis_alternate_invocation_action.h
+++ b/libs/ui/input/kis_alternate_invocation_action.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ALTERNATE_INVOCATION_ACTION_H
#define KIS_ALTERNATE_INVOCATION_ACTION_H
#include "kis_abstract_input_action.h"
#include <QScopedPointer>
#include "kis_tool.h"
/**
* \brief Alternate Invocation implementation of KisAbstractInputAction.
*
* The Alternate Invocation action performs an alternate action with the
* current tool. For example, using the brush tool it picks a color from
* the canvas.
*/
class KisAlternateInvocationAction : public KisAbstractInputAction
{
public:
/**
* The different behaviours for this action.
*/
enum Shortcut {
PrimaryAlternateModeShortcut, ///< Toggle Primary mode.
SecondaryAlternateModeShortcut, ///< Toggle Secondary mode.
PickColorFgLayerModeShortcut,
PickColorBgLayerModeShortcut,
PickColorFgImageModeShortcut,
PickColorBgImageModeShortcut,
};
explicit KisAlternateInvocationAction();
- virtual ~KisAlternateInvocationAction();
+ ~KisAlternateInvocationAction() override;
- void activate(int shortcut);
- void deactivate(int shortcut);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
- virtual int priority() const;
+ int priority() const override;
- void begin(int shortcut, QEvent *event);
- void end(QEvent *event);
- void inputEvent(QEvent* event);
+ void begin(int shortcut, QEvent *event) override;
+ void end(QEvent *event) override;
+ void inputEvent(QEvent* event) override;
private:
KisTool::ToolAction shortcutToToolAction(int shortcut);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KIS_ALTERNATE_INVOCATION_ACTION_H
diff --git a/libs/ui/input/kis_change_frame_action.h b/libs/ui/input/kis_change_frame_action.h
index 014e41ef51..1c84e45d40 100644
--- a/libs/ui/input/kis_change_frame_action.h
+++ b/libs/ui/input/kis_change_frame_action.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CHANGE_FRAME_ACTION_H
#define __KIS_CHANGE_FRAME_ACTION_H
#include <QScopedPointer>
#include "kis_abstract_input_action.h"
class KisChangeFrameAction : public KisAbstractInputAction
{
public:
enum Shortcuts {
NextFrameShortcut,
PreviousFrameShortcut
};
KisChangeFrameAction();
- ~KisChangeFrameAction();
+ ~KisChangeFrameAction() override;
- void begin(int shortcut, QEvent *event);
- bool isAvailable() const;
+ void begin(int shortcut, QEvent *event) override;
+ bool isAvailable() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_CHANGE_FRAME_ACTION_H */
diff --git a/libs/ui/input/kis_change_primary_setting_action.h b/libs/ui/input/kis_change_primary_setting_action.h
index 53a30d7b2f..85876984d1 100644
--- a/libs/ui/input/kis_change_primary_setting_action.h
+++ b/libs/ui/input/kis_change_primary_setting_action.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISCHANGEPRIMARYSETTINGACTION_H
#define KISCHANGEPRIMARYSETTINGACTION_H
#include "kis_abstract_input_action.h"
/**
* \brief Change Primary Setting implementation of KisAbstractInputAction.
*
* The Change Primary Setting action changes a tool's "Primary Setting",
* for example the brush size for the brush tool.
*/
class KisChangePrimarySettingAction : public KisAbstractInputAction
{
public:
explicit KisChangePrimarySettingAction();
- virtual ~KisChangePrimarySettingAction();
+ ~KisChangePrimarySettingAction() override;
- void activate(int shortcut);
- void deactivate(int shortcut);
- int priority() const;
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
+ int priority() const override;
- void begin(int shortcut, QEvent *event);
- void end(QEvent *event);
- void inputEvent(QEvent* event);
+ void begin(int shortcut, QEvent *event) override;
+ void end(QEvent *event) override;
+ void inputEvent(QEvent* event) override;
};
#endif // KISCHANGEPRIMARYSETTINGACTION_H
diff --git a/libs/ui/input/kis_gamma_exposure_action.h b/libs/ui/input/kis_gamma_exposure_action.h
index 23b63a7d09..3aa46f1c15 100644
--- a/libs/ui/input/kis_gamma_exposure_action.h
+++ b/libs/ui/input/kis_gamma_exposure_action.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_GAMMA_EXPOSURE_ACTION_H
#define __KIS_GAMMA_EXPOSURE_ACTION_H
#include "kis_abstract_input_action.h"
class KisGammaExposureAction : public KisAbstractInputAction
{
public:
/**
* The different behaviours for this action.
*/
enum Shortcuts {
ExposureShortcut,
GammaShortcut,
AddExposure05Shortcut,
RemoveExposure05Shortcut,
AddGamma05Shortcut,
RemoveGamma05Shortcut,
AddExposure02Shortcut,
RemoveExposure02Shortcut,
AddGamma02Shortcut,
RemoveGamma02Shortcut,
ResetExposureAndGammaShortcut
};
explicit KisGammaExposureAction();
- virtual ~KisGammaExposureAction();
+ ~KisGammaExposureAction() override;
- virtual int priority() const;
+ int priority() const override;
- void activate(int shortcut);
- void deactivate(int shortcut);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
- void begin(int shortcut, QEvent *event = 0);
- void cursorMoved(const QPointF &lastPos, const QPointF &pos);
+ void begin(int shortcut, QEvent *event = 0) override;
+ void cursorMoved(const QPointF &lastPos, const QPointF &pos) override;
- bool isShortcutRequired(int shortcut) const;
+ bool isShortcutRequired(int shortcut) const override;
private:
class Private;
Private * const d;
};
#endif /* __KIS_GAMMA_EXPOSURE_ACTION_H */
diff --git a/libs/ui/input/kis_input_manager.h b/libs/ui/input/kis_input_manager.h
index 8d64613d0c..932ef17b75 100644
--- a/libs/ui/input/kis_input_manager.h
+++ b/libs/ui/input/kis_input_manager.h
@@ -1,128 +1,128 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_INPUTMANAGER_H
#define KIS_INPUTMANAGER_H
#include <QObject>
#include <kritaui_export.h>
class QPointF;
class QTouchEvent;
class KisToolProxy;
class KisCanvas2;
/**
* \brief Central object to manage canvas input.
*
* The Input Manager class manages all canvas input. It is created
* by KisCanvas2 and processes all events related to input sent to the
* canvas.
*
* The Input Manager keeps track of a set of actions and a set of
* shortcuts. The actions are pre-defined while the shortcuts are
* set from configuration.
*
* For each event, it will try to determine if there is a shortcut that
* matches the input. It will then activate this action and pass all
* consecutive events on to this action.
*
* \sa KisAbstractInputAction
*/
class KRITAUI_EXPORT KisInputManager : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
*/
KisInputManager(QObject *parent);
/**
* Destructor.
*/
- ~KisInputManager();
+ ~KisInputManager() override;
void addTrackedCanvas(KisCanvas2 *canvas);
void removeTrackedCanvas(KisCanvas2 *canvas);
void toggleTabletLogger();
/**
* Installs the input manager as an event filter for \p receiver.
* Please note that KisInputManager is supposed to handle events
* for a single receiver only. This is defined by the fact that it
* resends some of the events back through the Qt's queue to the
* reciever. That is why the input manager will assert when it gets
* an event with wrong destination.
*/
void setupAsEventFilter(QObject *receiver);
/**
* Event filter method. Overridden from QObject.
*/
- bool eventFilter(QObject* object, QEvent* event );
+ bool eventFilter(QObject* object, QEvent* event ) override;
void attachPriorityEventFilter(QObject *filter, int priority = 0);
void detachPriorityEventFilter(QObject *filter);
/**
* Return the canvas this input manager is associated with.
*/
KisCanvas2 *canvas() const;
/**
* The tool proxy of the current application.
*/
KisToolProxy *toolProxy() const;
/**
* Touch events are special, too.
*
* \return a touch event if there was one, otherwise 0
*/
QTouchEvent *lastTouchEvent() const;
/**
* Convert a widget position to a document position.
*/
QPointF widgetToDocument(const QPointF &position);
public Q_SLOTS:
void stopIgnoringEvents();
void slotFocusOnEnter(bool value);
private Q_SLOTS:
void slotAboutToChangeTool();
void slotToolChanged();
void profileChanged();
void slotCompressedMoveEvent();
private:
bool eventFilterImpl(QEvent * event);
template <class Event>
bool compressMoveEventCommon(Event *event);
private:
class Private;
Private* const d;
};
#endif // KIS_INPUTMANAGER_H
diff --git a/libs/ui/input/kis_input_manager_p.h b/libs/ui/input/kis_input_manager_p.h
index 8c4c28f423..1249859b20 100644
--- a/libs/ui/input/kis_input_manager_p.h
+++ b/libs/ui/input/kis_input_manager_p.h
@@ -1,149 +1,149 @@
/*
* Copyright (C) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QList>
#include <QPointer>
#include <QSet>
#include <QEvent>
#include <QTouchEvent>
#include <QScopedPointer>
#include "kis_input_manager.h"
#include "kis_shortcut_matcher.h"
#include "kis_shortcut_configuration.h"
#include "kis_canvas2.h"
#include "kis_tool_proxy.h"
#include "kis_signal_compressor.h"
#include "input/kis_tablet_debugger.h"
#include "kis_timed_signal_threshold.h"
#include "kis_signal_auto_connection.h"
class KisToolInvocationAction;
class KisInputManager::Private
{
public:
Private(KisInputManager *qq);
bool tryHidePopupPalette();
void addStrokeShortcut(KisAbstractInputAction* action, int index, const QList< Qt::Key >& modifiers, Qt::MouseButtons buttons);
void addKeyShortcut(KisAbstractInputAction* action, int index,const QList<Qt::Key> &keys);
void addTouchShortcut( KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture );
void addWheelShortcut(KisAbstractInputAction* action, int index, const QList< Qt::Key >& modifiers, KisShortcutConfiguration::MouseWheelMovement wheelAction);
bool processUnhandledEvent(QEvent *event);
void setupActions();
void saveTouchEvent( QTouchEvent* event );
bool handleCompressedTabletEvent(QEvent *event);
KisInputManager *q;
QPointer<KisCanvas2> canvas = 0;
KisToolProxy *toolProxy = 0;
bool forwardAllEventsToTool = false;
bool ignoringQtCursorEvents();
bool disableTouchOnCanvas = false;
bool touchHasBlockedPressEvents = false;
KisShortcutMatcher matcher;
QTouchEvent *lastTouchEvent = 0;
KisToolInvocationAction *defaultInputAction = 0;
QObject *eventsReceiver = 0;
KisSignalCompressor moveEventCompressor;
QScopedPointer<QEvent> compressedMoveEvent;
bool testingAcceptCompressedTabletEvents = false;
bool testingCompressBrushEvents = false;
bool tabletActive = false; // Indicates whether or not tablet is in proximity
typedef QPair<int, QPointer<QObject> > PriorityPair;
typedef QList<PriorityPair> PriorityList;
PriorityList priorityEventFilter;
int priorityEventFilterSeqNo;
void blockMouseEvents();
void allowMouseEvents();
void eatOneMousePress();
void maskSyntheticEvents(bool value);
void setTabletActive(bool value);
void resetCompressor();
template <class Event, bool useBlocking>
void debugEvent(QEvent *event)
{
if (!KisTabletDebugger::instance()->debugEnabled()) return;
QString msg1 = useBlocking && ignoringQtCursorEvents() ? "[BLOCKED] " : "[ ]";
Event *specificEvent = static_cast<Event*>(event);
dbgTablet << KisTabletDebugger::instance()->eventToString(*specificEvent, msg1);
}
class ProximityNotifier : public QObject
{
public:
ProximityNotifier(Private *_d, QObject *p);
- bool eventFilter(QObject* object, QEvent* event );
+ bool eventFilter(QObject* object, QEvent* event ) override;
private:
KisInputManager::Private *d;
};
class CanvasSwitcher : public QObject
{
public:
CanvasSwitcher(Private *_d, QObject *p);
void addCanvas(KisCanvas2 *canvas);
void removeCanvas(KisCanvas2 *canvas);
- bool eventFilter(QObject* object, QEvent* event );
+ bool eventFilter(QObject* object, QEvent* event ) override;
private:
void setupFocusThreshold(QObject *object);
private:
KisInputManager::Private *d;
QMap<QObject*, QPointer<KisCanvas2>> canvasResolver;
int eatOneMouseStroke;
KisTimedSignalThreshold focusSwitchThreshold;
KisSignalAutoConnectionsStore thresholdConnections;
};
CanvasSwitcher canvasSwitcher;
struct EventEater
{
bool eventFilter(QObject* target, QEvent* event);
// This should be called after we're certain a tablet stroke has started.
void activate();
// This should be called after a tablet stroke has ended.
void deactivate();
// On Windows, we sometimes receive mouse events very late, so watch & wait.
void eatOneMousePress();
bool hungry{false}; // Continue eating mouse strokes
bool peckish{false}; // Eat a single mouse press event
bool eatSyntheticEvents{true}; // Mask all synthetic events
};
EventEater eventEater;
bool containsPointer = true;
int accumulatedScrollDelta = 0;
};
diff --git a/libs/ui/input/kis_input_profile.h b/libs/ui/input/kis_input_profile.h
index 675e709195..949d2fef5c 100644
--- a/libs/ui/input/kis_input_profile.h
+++ b/libs/ui/input/kis_input_profile.h
@@ -1,95 +1,95 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTPROFILE_H
#define KISINPUTPROFILE_H
#include <QObject>
#include <QMetaType>
class KisAbstractInputAction;
class KisShortcutConfiguration;
/**
* \brief A container class for sets of shortcuts associated with an action.
*
*
*/
class KisInputProfile : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
*/
KisInputProfile(QObject *parent = 0);
/**
* Destructor.
*/
- virtual ~KisInputProfile();
+ ~KisInputProfile() override;
/**
* \return The name of the profile.
*/
QString name() const;
/**
* \return A list of all shortcuts available.
*/
QList<KisShortcutConfiguration *> allShortcuts() const;
/**
* \return A list of shortcuts associated with the given action.
*
* \param action The action for which to list the shortcuts.
*/
QList<KisShortcutConfiguration *> shortcutsForAction(KisAbstractInputAction *action) const;
/**
* Add a shortcut to this profile.
*
* \param shortcut The shortcut to add.
*/
void addShortcut(KisShortcutConfiguration *shortcut);
/**
* Remove a shortcut from this profile.
*
* \param shortcut The shortcut to remove.
*/
void removeShortcut(KisShortcutConfiguration *shortcut);
public Q_SLOTS:
/**
* Set the name of this profile.
*
* \param name The name to set.
*/
void setName(const QString &name);
Q_SIGNALS:
/**
* Emitted when the name of this profile changes.
*/
void nameChanged();
private:
class Private;
Private *const d;
};
#endif // KISINPUTPROFILE_H
diff --git a/libs/ui/input/kis_input_profile_manager.h b/libs/ui/input/kis_input_profile_manager.h
index e21f2addc2..d9e2565a8e 100644
--- a/libs/ui/input/kis_input_profile_manager.h
+++ b/libs/ui/input/kis_input_profile_manager.h
@@ -1,148 +1,148 @@
/*
* This file is part of the KDE project
* Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINPUTPROFILEMANAGER_H
#define KISINPUTPROFILEMANAGER_H
#include <QObject>
#include "kritaui_export.h"
class KisAbstractInputAction;
class KisInputProfile;
/**
* \brief A class to manage a list of profiles and actions.
*
*
*/
class KRITAUI_EXPORT KisInputProfileManager : public QObject
{
Q_OBJECT
public:
KisInputProfileManager(QObject *parent = 0);
- ~KisInputProfileManager();
+ ~KisInputProfileManager() override;
Q_DISABLE_COPY(KisInputProfileManager)
/**
* Retrieve a profile by name.
*
* \param name The name of the profile to retrieve.
*
* \return The profile with the given name, or 0 if not found.
*/
KisInputProfile *profile(const QString &name) const;
/**
* \return A list of all profiles.
*/
QList<KisInputProfile *> profiles() const;
/**
* \return A list of the names of all profiles.
*/
QStringList profileNames() const;
/**
* \return The current active profile.
*/
KisInputProfile *currentProfile() const;
/**
* Set the current active profile.
*
* \param profile The profile to set as current.
*/
void setCurrentProfile(KisInputProfile *profile);
/**
* Add a profile.
*
* \param name The name of the new profile.
*
* \return The new, empty profile or the non-empty profile if it already exists.
*/
KisInputProfile *addProfile(const QString &name);
/**
* Remove a profile.
*
* This will remove the given profile from the list of profiles and delete it.
*
* \param name The profile to remove.
*/
void removeProfile(const QString &name);
/**
* Rename a profile.
*
* \param oldName The current name of the profile.
* \param newName The new name of the profile.
*
* \return true if successful, false if not.
*/
bool renameProfile(const QString &oldName, const QString &newName);
/**
* Duplicate a profile.
*
* This creates a new profile with the given name and copies all
* data from the old profile to the new profile.
*
* \param name The name of the profile to duplicate.
* \param newName The name of the new profile.
*/
void duplicateProfile(const QString &name, const QString &newName);
/**
* \return The list of all available actions.
*/
QList< KisAbstractInputAction * > actions();
/**
* Load all profiles from the configuration stored on disk.
*/
void loadProfiles();
/**
* Save all profiles to configuration on disk.
*/
void saveProfiles();
/**
* Reset all profiles to the default state.
*
* This will remove all custom profiles the user created and reset any changed profiles.
*/
void resetAll();
/**
* \return The singleton instance of this class.
*/
static KisInputProfileManager *instance();
Q_SIGNALS:
/**
* Emitted when the list of profiles changes.
*/
void profilesChanged();
/**
* Emitted when the current active profile changes.
*/
void currentProfileChanged();
private:
class Private;
Private *const d;
};
#endif // KISINPUTPROFILEMANAGER_H
diff --git a/libs/ui/input/kis_pan_action.h b/libs/ui/input/kis_pan_action.h
index 99aa072d7d..4a1ee1574e 100644
--- a/libs/ui/input/kis_pan_action.h
+++ b/libs/ui/input/kis_pan_action.h
@@ -1,63 +1,63 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAN_ACTION_H
#define KIS_PAN_ACTION_H
#include "kis_abstract_input_action.h"
/**
* \brief Pan Canvas implementation of KisAbstractInputAction.
*
* The Pan Canvas action pans the canvas.
*/
class KisPanAction : public KisAbstractInputAction
{
public:
/**
* The different behaviours for this action.
*/
enum Shortcut {
PanModeShortcut, ///< Toggle the pan mode.
PanLeftShortcut, ///< Pan left by a fixed amount.
PanRightShortcut, ///< Pan right by a fixed amount.
PanUpShortcut, ///< Pan up by a fixed amount.
PanDownShortcut ///< Pan down by a fixed amount.
};
explicit KisPanAction();
- virtual ~KisPanAction();
+ ~KisPanAction() override;
- virtual int priority() const;
+ int priority() const override;
- void activate(int shortcut);
- void deactivate(int shortcut);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
- void begin(int shortcut, QEvent *event);
+ void begin(int shortcut, QEvent *event) override;
- virtual void inputEvent(QEvent* event);
- void cursorMoved(const QPointF &lastPos, const QPointF &pos);
+ void inputEvent(QEvent* event) override;
+ void cursorMoved(const QPointF &lastPos, const QPointF &pos) override;
- virtual bool isShortcutRequired(int shortcut) const;
+ bool isShortcutRequired(int shortcut) const override;
private:
class Private;
Private * const d;
};
#endif // KIS_PAN_ACTION_H
diff --git a/libs/ui/input/kis_rotate_canvas_action.h b/libs/ui/input/kis_rotate_canvas_action.h
index 3e9c53d60d..29381f791f 100644
--- a/libs/ui/input/kis_rotate_canvas_action.h
+++ b/libs/ui/input/kis_rotate_canvas_action.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ROTATE_CANVAS_ACTION_H
#define KIS_ROTATE_CANVAS_ACTION_H
#include "kis_abstract_input_action.h"
/**
* \brief Rotate Canvas implementation of KisAbstractInputAction.
*
* The Rotate Canvas action rotates the canvas.
*/
class KisRotateCanvasAction : public KisAbstractInputAction
{
public:
/**
* The different behaviours for this action.
*/
enum Shortcut {
RotateModeShortcut, ///< Toggle Rotate mode.
DiscreteRotateModeShortcut, ///< Toggle Discrete Rotate mode.
RotateLeftShortcut, ///< Rotate left by a fixed amount.
RotateRightShortcut, ///< Rotate right by a fixed amount.
RotateResetShortcut ///< Reset the rotation to 0.
};
explicit KisRotateCanvasAction();
- virtual ~KisRotateCanvasAction();
+ ~KisRotateCanvasAction() override;
- virtual int priority() const;
+ int priority() const override;
- void activate(int shortcut);
- void deactivate(int shortcut);
- void begin(int shortcut, QEvent *event);
- void cursorMoved(const QPointF &lastPos, const QPointF &pos);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
+ void begin(int shortcut, QEvent *event) override;
+ void cursorMoved(const QPointF &lastPos, const QPointF &pos) override;
private:
class Private;
Private * const d;
};
#endif // KIS_ROTATE_CANVAS_ACTION_H
diff --git a/libs/ui/input/kis_select_layer_action.h b/libs/ui/input/kis_select_layer_action.h
index 0e7aff0ab9..36e33a8bff 100644
--- a/libs/ui/input/kis_select_layer_action.h
+++ b/libs/ui/input/kis_select_layer_action.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SELECT_LAYER_ACTION_H
#define KIS_SELECT_LAYER_ACTION_H
#include "kis_abstract_input_action.h"
/**
* \brief Select Layer implementation of KisAbstractInputAction.
*
* The Select Layer action selects a layer under a cursor.
*/
class KisSelectLayerAction : public KisAbstractInputAction
{
public:
enum Shortcut {
SelectLayerModeShortcut, ///< Toggle the layer select mode.
SelectMultipleLayerModeShortcut, ///< Toggle the multiple layer select mode.
};
explicit KisSelectLayerAction();
- virtual ~KisSelectLayerAction();
+ ~KisSelectLayerAction() override;
- virtual int priority() const;
+ int priority() const override;
- void activate(int shortcut);
- void deactivate(int shortcut);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
- void begin(int shortcut, QEvent *event);
- void inputEvent(QEvent *event);
+ void begin(int shortcut, QEvent *event) override;
+ void inputEvent(QEvent *event) override;
private:
class Private;
Private * const d;
};
#endif // KIS_SELECT_LAYER_ACTION_H
diff --git a/libs/ui/input/kis_show_palette_action.cpp b/libs/ui/input/kis_show_palette_action.cpp
index c10da1fa24..bfc85a8881 100644
--- a/libs/ui/input/kis_show_palette_action.cpp
+++ b/libs/ui/input/kis_show_palette_action.cpp
@@ -1,104 +1,104 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_show_palette_action.h"
#include <QCursor>
#include <QMenu>
#include <klocalizedstring.h>
#include <kis_favorite_resource_manager.h>
#include <kis_canvas2.h>
#include "kis_tool_proxy.h"
#include "kis_input_manager.h"
KisShowPaletteAction::KisShowPaletteAction()
: KisAbstractInputAction("Show Popup Palette"),
m_requestedWithStylus(false)
{
setName(i18n("Show Popup Palette"));
setDescription(i18n("The <i>Show Popup Palette</i> displays the popup palette."));
}
KisShowPaletteAction::~KisShowPaletteAction()
{
}
int KisShowPaletteAction::priority() const
{
return 1;
}
void KisShowPaletteAction::begin(int, QEvent *event)
{
m_menu = inputManager()->toolProxy()->popupActionsMenu();
if (m_menu) {
m_requestedWithStylus = event->type() == QEvent::TabletPress;
/**
* Opening a menu changes the focus of the windows, so we should not open it
* inside the filtering loop. Just raise it using the timer.
*/
QTimer::singleShot(0, this, SLOT(slotShowMenu()));
} else {
QPoint pos = eventPos(event);
if (pos.isNull()) {
pos = inputManager()->canvas()->canvasWidget()->mapFromGlobal(QCursor::pos());
}
inputManager()->canvas()->slotShowPopupPalette(pos);
}
}
struct SinglePressEventEater : public QObject
{
- bool eventFilter(QObject *, QEvent *event) {
+ bool eventFilter(QObject *, QEvent *event) override {
if (hungry && event->type() == QEvent::MouseButtonPress) {
hungry = false;
return true;
}
return false;
}
private:
bool hungry = true;
};
void KisShowPaletteAction::slotShowMenu()
{
if (m_menu) {
QPoint stylusOffset;
QScopedPointer<SinglePressEventEater> eater;
if (m_requestedWithStylus) {
eater.reset(new SinglePressEventEater());
m_menu->installEventFilter(eater.data());
stylusOffset += QPoint(10,10);
}
m_menu->exec(QCursor::pos() + stylusOffset);
m_menu.clear();
}
}
diff --git a/libs/ui/input/kis_show_palette_action.h b/libs/ui/input/kis_show_palette_action.h
index 6cd2606845..c2e4b415bb 100644
--- a/libs/ui/input/kis_show_palette_action.h
+++ b/libs/ui/input/kis_show_palette_action.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHOW_PALETTE_ACTION_H
#define KIS_SHOW_PALETTE_ACTION_H
#include "kis_abstract_input_action.h"
#include <QObject>
#include <QPointer>
class QMenu;
/**
* \brief Show Palette implementation of KisAbstractInputAction.
*
* The Show Palette action shows the popup palette.
*/
class KisShowPaletteAction : public QObject, public KisAbstractInputAction
{
Q_OBJECT
public:
explicit KisShowPaletteAction();
- virtual ~KisShowPaletteAction();
+ ~KisShowPaletteAction() override;
- virtual int priority() const;
+ int priority() const override;
- virtual void begin(int, QEvent *);
+ void begin(int, QEvent *) override;
private Q_SLOTS:
void slotShowMenu();
private:
QPointer<QMenu> m_menu;
bool m_requestedWithStylus;
};
#endif // KIS_SHOW_PALETTE_ACTION_H
diff --git a/libs/ui/input/kis_single_action_shortcut.h b/libs/ui/input/kis_single_action_shortcut.h
index 6f46b34168..cc9ed96642 100644
--- a/libs/ui/input/kis_single_action_shortcut.h
+++ b/libs/ui/input/kis_single_action_shortcut.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SINGLE_ACTION_SHORTCUT_H
#define __KIS_SINGLE_ACTION_SHORTCUT_H
#include "kis_abstract_shortcut.h"
/**
* This class represents a shortcut that executes a simple atomic
* action. It can be initiated either by a keyboard hotkey or by
* a mouse wheel rotation.
*/
class KRITAUI_EXPORT KisSingleActionShortcut : public KisAbstractShortcut
{
public:
enum WheelAction {
WheelUp, ///< Mouse wheel moves up.
WheelDown, ///< Mouse wheel moves down.
WheelLeft, ///< Mouse wheel moves left.
WheelRight, ///< Mouse wheel moves right.
};
KisSingleActionShortcut(KisAbstractInputAction *action, int index);
- ~KisSingleActionShortcut();
+ ~KisSingleActionShortcut() override;
- int priority() const;
+ int priority() const override;
void setKey(const QSet<Qt::Key> &modifiers, Qt::Key key);
void setWheel(const QSet<Qt::Key> &modifiers, WheelAction wheelAction);
bool match(const QSet<Qt::Key> &modifiers, Qt::Key key);
bool match(const QSet<Qt::Key> &modifiers, WheelAction wheelAction);
private:
class Private;
Private * const m_d;
};
#endif /* __KIS_SINGLE_ACTION_SHORTCUT_H */
diff --git a/libs/ui/input/kis_stroke_shortcut.h b/libs/ui/input/kis_stroke_shortcut.h
index 57bf476b28..fb42a232de 100644
--- a/libs/ui/input/kis_stroke_shortcut.h
+++ b/libs/ui/input/kis_stroke_shortcut.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_STROKE_SHORTCUT_H
#define __KIS_STROKE_SHORTCUT_H
#include "kis_abstract_shortcut.h"
class QMouseEvent;
class QPointF;
/**
* This class represents a shortcut that starts an action that can
* involve pressing the mouse button and, probably, moving the cursor.
*
* The stroke shortcut may be represented as a simple state machine:
* It transits between 3 states:
*
* Idle <-> Ready <-> Running
*
* The possibility of trasition between Idle <-> Ready is defined
* with a matchReady() method. The transition Ready <-> Running is
* defined by matchBegin(). The Ready state is used for showing the
* user the cursor of the upcoming action and the Running state shows
* that the action linked to the shortcut should be activated.
*/
class KRITAUI_EXPORT KisStrokeShortcut : public KisAbstractShortcut
{
public:
KisStrokeShortcut(KisAbstractInputAction *action, int index);
- ~KisStrokeShortcut();
+ ~KisStrokeShortcut() override;
- int priority() const;
+ int priority() const override;
/**
* Sets the configuration for this shortcut
*
* \param modifiers keyboard keys that should be holded
* for the shortcut to trigger
* \param buttons mouse buttons that should be pressed (simultaneously)
* for the shortcut to trigger
*/
void setButtons(const QSet<Qt::Key> &modifiers,
const QSet<Qt::MouseButton> &buttons);
/**
* Reports whether all but one buttons and modifiers are pressed
* for the shortcut. Such configuration means that the input manager
* can show the user that pressing the mouse button will start some
* action. This can be done with, e.g. changing the cursor.
*/
bool matchReady(const QSet<Qt::Key> &modifiers,
const QSet<Qt::MouseButton> &buttons);
/**
* Reports whether the shortcut can transit form the "Ready"
* to "Running" state. It means that the last button of the shortcut
* is pressed.
*/
bool matchBegin(Qt::MouseButton button);
QMouseEvent fakeEndEvent(const QPointF &localPos) const;
private:
class Private;
Private * const m_d;
};
#endif /* __KIS_STROKE_SHORTCUT_H */
diff --git a/libs/ui/input/kis_tablet_event.h b/libs/ui/input/kis_tablet_event.h
index 8bedb66575..9b6c39508a 100644
--- a/libs/ui/input/kis_tablet_event.h
+++ b/libs/ui/input/kis_tablet_event.h
@@ -1,110 +1,110 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TABLET_EVENT_H
#define KIS_TABLET_EVENT_H
#include <QTabletEvent>
class KisTabletEvent : public QInputEvent
{
public:
enum ExtraEventType {
TabletMoveEx = QEvent::User,
TabletPressEx,
TabletReleaseEx,
TouchProximityInEx,
TouchProximityOutEx,
};
enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
XFreeEraser /*internal*/, RotationStylus };
enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
KisTabletEvent(ExtraEventType t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
int device, int pointerType, qreal pressure, int xTilt, int yTilt,
qreal tangentialPressure, qreal rotation, int z,
Qt::KeyboardModifiers keyState, qint64 uniqueID,
Qt::MouseButton button, Qt::MouseButtons buttons);
- ~KisTabletEvent();
+ ~KisTabletEvent() override;
inline const QPoint &pos() const { return mPos; }
inline const QPoint &globalPos() const { return mGPos; }
inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
inline int x() const { return mPos.x(); }
inline int y() const { return mPos.y(); }
inline int globalX() const { return mGPos.x(); }
inline int globalY() const { return mGPos.y(); }
inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
inline TabletDevice device() const { return TabletDevice(mDev); }
inline PointerType pointerType() const { return PointerType(mPointerType); }
inline qint64 uniqueId() const { return mUnique; }
inline qreal pressure() const { return mPress; }
inline int z() const { return mZ; }
inline qreal tangentialPressure() const { return mTangential; }
inline qreal rotation() const { return mRot; }
inline int xTilt() const { return mXT; }
inline int yTilt() const { return mYT; }
inline Qt::MouseButton button() const { return mouseButton; }
inline Qt::MouseButtons buttons() const { return mouseButtons; }
inline QEvent::Type getMouseEventType() const {
return
(ExtraEventType) type() == TabletMoveEx ? MouseMove :
(ExtraEventType) type() == TabletPressEx ? MouseButtonPress :
(ExtraEventType) type() == TabletReleaseEx ? MouseButtonRelease :
QEvent::None;
}
inline QMouseEvent toQMouseEvent() const {
QEvent::Type t = getMouseEventType();
return QMouseEvent(t, pos(), globalPos(),
button(), buttons(), modifiers());
}
inline QTabletEvent toQTabletEvent() const {
QEvent::Type t =
(ExtraEventType) type() == TabletMoveEx ? TabletMove :
(ExtraEventType) type() == TabletPressEx ? TabletPress :
(ExtraEventType) type() == TabletReleaseEx ? TabletRelease :
QEvent::None;
return QTabletEvent(t, pos(), globalPos(),
device(), pointerType(),
pressure(), xTilt(), yTilt(), tangentialPressure(),
rotation(), z(), modifiers(), uniqueId());
}
protected:
QPoint mPos, mGPos;
QPointF mHiResGlobalPos;
int mDev, mPointerType, mXT, mYT, mZ;
qreal mPress, mTangential, mRot;
qint64 mUnique;
Qt::MouseButton mouseButton;
Qt::MouseButtons mouseButtons;
};
#endif // KIS_TABLET_EVENT_H
diff --git a/libs/ui/input/kis_tool_invocation_action.h b/libs/ui/input/kis_tool_invocation_action.h
index 131c6f7789..d23c9bce96 100644
--- a/libs/ui/input/kis_tool_invocation_action.h
+++ b/libs/ui/input/kis_tool_invocation_action.h
@@ -1,63 +1,63 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_INVOCATION_ACTION_H
#define KIS_TOOL_INVOCATION_ACTION_H
#include "kis_abstract_input_action.h"
/**
* \brief Tool Invocation action of KisAbstractInputAction.
*
* The Tool Invocation action invokes the current tool, for example,
* using the brush tool, it will start painting.
*/
class KisToolInvocationAction : public KisAbstractInputAction
{
public:
enum Shortcut {
ActivateShortcut,
ConfirmShortcut,
CancelShortcut,
LineToolShortcut
};
explicit KisToolInvocationAction();
- virtual ~KisToolInvocationAction();
+ ~KisToolInvocationAction() override;
- void activate(int shortcut);
- void deactivate(int shortcut);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
- virtual int priority() const;
- virtual bool canIgnoreModifiers() const;
+ int priority() const override;
+ bool canIgnoreModifiers() const override;
- void begin(int shortcut, QEvent *event);
- void end(QEvent *event);
- void inputEvent(QEvent* event);
+ void begin(int shortcut, QEvent *event) override;
+ void end(QEvent *event) override;
+ void inputEvent(QEvent* event) override;
void processUnhandledEvent(QEvent* event);
- bool supportsHiResInputEvents() const;
+ bool supportsHiResInputEvents() const override;
- virtual bool isShortcutRequired(int shortcut) const;
+ bool isShortcutRequired(int shortcut) const override;
private:
class Private;
Private * const d;
};
#endif // KISTOOLINVOCATIONACTION_H
diff --git a/libs/ui/input/kis_touch_shortcut.h b/libs/ui/input/kis_touch_shortcut.h
index 6a73a84ca5..d2b59d3b5e 100644
--- a/libs/ui/input/kis_touch_shortcut.h
+++ b/libs/ui/input/kis_touch_shortcut.h
@@ -1,45 +1,45 @@
/*
* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef KISTOUCHSHORTCUT_H
#define KISTOUCHSHORTCUT_H
#include "kis_abstract_shortcut.h"
class QTouchEvent;
class KisTouchShortcut : public KisAbstractShortcut
{
public:
KisTouchShortcut( KisAbstractInputAction* action, int index );
- ~KisTouchShortcut();
+ ~KisTouchShortcut() override;
- virtual int priority() const;
+ int priority() const override;
void setMinimumTouchPoints( int min );
void setMaximumTouchPoints( int max );
bool match( QTouchEvent* event );
private:
class Private;
Private * const d;
};
#endif // KISTOUCHSHORTCUT_H
diff --git a/libs/ui/input/kis_zoom_action.h b/libs/ui/input/kis_zoom_action.h
index 28f79fec7d..231109ccd8 100644
--- a/libs/ui/input/kis_zoom_action.h
+++ b/libs/ui/input/kis_zoom_action.h
@@ -1,65 +1,65 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ZOOM_ACTION_H
#define KIS_ZOOM_ACTION_H
#include "kis_abstract_input_action.h"
/**
* \brief Zoom Canvas implementation of KisAbstractInputAction.
*
* The Zoom Canvas action zooms the canvas.
*/
class KisZoomAction : public KisAbstractInputAction
{
public:
/**
* The different behaviours for this action.
*/
enum Shortcuts {
ZoomModeShortcut, ///< Toggle zoom mode.
DiscreteZoomModeShortcut, ///< Toggle discrete zoom mode
ZoomInShortcut, ///< Zoom in by a fixed amount.
ZoomOutShortcut, ///< Zoom out by a fixed amount.
ZoomResetShortcut, ///< Reset zoom to 100%.
ZoomToPageShortcut, ///< Zoom fit to page.
ZoomToWidthShortcut, ///< Zoom fit to width.
RelativeZoomModeShortcut, ///< Toggle zoom mode relative to cursor
RelativeDiscreteZoomModeShortcut ///< Toggle discrete zoom mode relative to cursor
};
explicit KisZoomAction();
- virtual ~KisZoomAction();
+ ~KisZoomAction() override;
- virtual int priority() const;
+ int priority() const override;
- void activate(int shortcut);
- void deactivate(int shortcut);
+ void activate(int shortcut) override;
+ void deactivate(int shortcut) override;
- void begin(int shortcut, QEvent *event = 0);
- void inputEvent(QEvent* event);
- void cursorMoved(const QPointF &lastPos, const QPointF &pos);
+ void begin(int shortcut, QEvent *event = 0) override;
+ void inputEvent(QEvent* event) override;
+ void cursorMoved(const QPointF &lastPos, const QPointF &pos) override;
- virtual bool isShortcutRequired(int shortcut) const;
+ bool isShortcutRequired(int shortcut) const override;
private:
class Private;
Private * const d;
};
#endif // KIS_ZOOM_ACTION_H
diff --git a/libs/ui/input/wintab/kis_tablet_support_win.cpp b/libs/ui/input/wintab/kis_tablet_support_win.cpp
index 9c775daa59..4a9a247b9c 100644
--- a/libs/ui/input/wintab/kis_tablet_support_win.cpp
+++ b/libs/ui/input/wintab/kis_tablet_support_win.cpp
@@ -1,974 +1,979 @@
/*
* Copyright (c) 2013 Digia Plc and/or its subsidiary(-ies).
* Copyright (c) 2013 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
* Copyright (c) 2015 The Qt Company Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_tablet_support_win_p.h"
#include <input/kis_tablet_event.h>
#include "kis_tablet_support_win.h"
// #include "kis_tablet_support.h"
#include <kis_debug.h>
#include <QApplication>
#include <QGuiApplication>
#include <QDesktopWidget>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformscreen.h>
#include <private/qguiapplication_p.h>
#include <QScreen>
#include <QWidget>
#include <QLibrary>
#include <cmath>
#define Q_PI M_PI
#include <input/kis_extended_modifiers_mapper.h>
#include <input/kis_tablet_debugger.h>
// For "inline tool switches"
#include <KoToolManager.h>
#include <KoInputDevice.h>
#include "kis_screen_size_choice_dialog.h"
// NOTE: we stub out qwindowcontext.cpp::347 to disable Qt's own tablet support.
// Note: The definition of the PACKET structure in pktdef.h depends on this define.
#define PACKETDATA (PK_X | PK_Y | PK_BUTTONS | PK_TIME | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ORIENTATION | PK_CURSOR | PK_Z)
#include "pktdef.h"
QT_BEGIN_NAMESPACE
enum {
PacketMode = 0,
TabletPacketQSize = 128,
DeviceIdMask = 0xFF6, // device type mask && device color mask
CursorTypeBitMask = 0x0F06 // bitmask to find the specific cursor type (see Wacom FAQ)
};
/*
*
* Krita extensions begin here
*
*
*/
QWindowsTabletSupport *QTAB = 0;
static QPointer<QWidget> targetWindow = 0; //< Window receiving last tablet event
static QPointer<QWidget> qt_tablet_target = 0; //< Widget receiving last tablet event
static bool dialogOpen = false; //< KisTabletSupportWin is not a Q_OBJECT and can't accept dialog signals
HWND createDummyWindow(const QString &className, const wchar_t *windowName, WNDPROC wndProc)
{
if (!wndProc)
wndProc = DefWindowProc;
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = wndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = (HINSTANCE)GetModuleHandle(0);
wc.hCursor = 0;
wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.hIcon = 0;
wc.hIconSm = 0;
wc.lpszMenuName = 0;
wc.lpszClassName = (wchar_t*)className.utf16();
ATOM atom = RegisterClassEx(&wc);
if (!atom)
qErrnoWarning("Registering tablet fake window class failed.");
return CreateWindowEx(0, (wchar_t*)className.utf16(),
windowName, WS_OVERLAPPED,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
HWND_MESSAGE, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
}
void printContext(const LOGCONTEXT &lc)
{
dbgTablet << "# Getting current context data:";
dbgTablet << ppVar(lc.lcName);
dbgTablet << ppVar(lc.lcDevice);
dbgTablet << ppVar(lc.lcInOrgX);
dbgTablet << ppVar(lc.lcInOrgY);
dbgTablet << ppVar(lc.lcInExtX);
dbgTablet << ppVar(lc.lcInExtY);
dbgTablet << ppVar(lc.lcOutOrgX);
dbgTablet << ppVar(lc.lcOutOrgY);
dbgTablet << ppVar(lc.lcOutExtX);
dbgTablet << ppVar(lc.lcOutExtY);
dbgTablet << ppVar(lc.lcSysOrgX);
dbgTablet << ppVar(lc.lcSysOrgY);
dbgTablet << ppVar(lc.lcSysExtX);
dbgTablet << ppVar(lc.lcSysExtY);
dbgTablet << "Qt Desktop Geometry" << QApplication::desktop()->geometry();
}
static QRect mapToNative(const QRect &qRect, int m_factor)
{
return QRect(qRect.x() * m_factor, qRect.y() * m_factor, qRect.width() * m_factor, qRect.height() * m_factor);
}
static inline QEvent::Type mouseEventType(QEvent::Type t)
{
return (t == QEvent::TabletMove ? QEvent::MouseMove :
t == QEvent::TabletPress ? QEvent::MouseButtonPress :
t == QEvent::TabletRelease ? QEvent::MouseButtonRelease :
QEvent::None);
}
static inline bool isMouseEventType(QEvent::Type t)
{
return (t == QEvent::MouseMove ||
t == QEvent::MouseButtonPress ||
t == QEvent::MouseButtonRelease);
}
static QPoint mousePosition()
{
POINT p;
GetCursorPos(&p);
return QPoint(p.x, p.y);
}
QWindowsWinTab32DLL QWindowsTabletSupport::m_winTab32DLL;
void KisTabletSupportWin::init()
{
if (!QWindowsTabletSupport::m_winTab32DLL.init()) {
qWarning() << "Failed to initialize Wintab";
return;
}
QTAB = QWindowsTabletSupport::create();
// Refresh tablet context after tablet rotated, screen added, etc.
QObject::connect(qApp->primaryScreen(), &QScreen::geometryChanged,
[=](const QRect & geometry){
delete QTAB;
QTAB = QWindowsTabletSupport::create();
});
}
// Derived from qwidgetwindow.
//
// The work done by processTabletEvent from qguiapplicationprivate is divided
// between here and translateTabletPacketEvent.
static void handleTabletEvent(QWidget *windowWidget, const QPointF &local, const QPointF &global,
int device, int pointerType, Qt::MouseButton button, Qt::MouseButtons buttons,
qreal pressure,int xTilt, int yTilt, qreal tangentialPressure, qreal rotation,
int z, qint64 uniqueId, Qt::KeyboardModifiers modifiers, QEvent::Type type, LONG time)
{
// Lock in target window
if (type == QEvent::TabletPress) {
targetWindow = windowWidget;
dbgInput << "Locking target window" << targetWindow;
} else if ((type == QEvent::TabletRelease || buttons == Qt::NoButton) && (targetWindow != 0)) {
dbgInput << "Releasing target window" << targetWindow;
targetWindow = 0;
}
if (!windowWidget) // Should never happen
return;
// We do this instead of constructing the event e beforehand
const QPoint localPos = local.toPoint();
const QPoint globalPos = global.toPoint();
if (type == QEvent::TabletPress) {
QWidget *widget = windowWidget->childAt(localPos);
if (!widget)
widget = windowWidget;
qt_tablet_target = widget;
}
QWidget *finalDestination = qt_tablet_target;
if (!finalDestination) {
finalDestination = windowWidget->childAt(localPos);
}
if ((type == QEvent::TabletRelease || buttons == Qt::NoButton) && (qt_tablet_target != 0)) {
dbgInput << "releasing tablet target" << qt_tablet_target;
qt_tablet_target = 0;
}
if (finalDestination) {
// The event was specified relative to windowWidget, so we remap it
QPointF delta = global - globalPos;
QPointF mapped = finalDestination->mapFromGlobal(global.toPoint()) + delta;
QTabletEvent ev(type, mapped, global, device, pointerType, pressure, xTilt, yTilt,
tangentialPressure, rotation, z, modifiers, uniqueId, button, buttons);
ev.setTimestamp(time);
QGuiApplication::sendEvent(finalDestination, &ev);
if (ev.isAccepted()) {
// dbgTablet << "Tablet event" << type << "accepted" << "by target widget" << finalDestination;
}
else {
// Turn off eventEater send a synthetic mouse event.
// dbgTablet << "Tablet event" << type << "rejected; sending mouse event to" << finalDestination;
qt_tablet_target = 0;
// We shouldn't ever get a widget accepting a tablet event from this
// call, so we won't worry about any interactions with our own
// widget-locking code.
// QWindow *target = platformScreen->topLevelAt(globalPos);
// if (!target) return;
// QPointF windowLocal = global - QPointF(target->mapFromGlobal(QPoint())) + delta;
// QWindowSystemInterface::handleTabletEvent(target, ev.timestamp(), windowLocal,
// global, device, pointerType,
// buttons, pressure, xTilt, yTilt,
// tangentialPressure, rotation, z,
// uniqueId, modifiers);
}
} else {
qt_tablet_target = 0;
targetWindow = 0;
}
}
/**
* This is a default implementation of a class for converting the
* WinTab value of the buttons pressed to the Qt buttons. This class
* may be substituted from the UI.
*/
struct DefaultButtonsConverter
{
void convert(DWORD btnOld, DWORD btnNew,
Qt::MouseButton *button,
Qt::MouseButtons *buttons,
const QWindowsTabletDeviceData &tdd) {
int pressedButtonValue = btnNew ^ btnOld;
*button = buttonValueToEnum(pressedButtonValue, tdd);
*buttons = Qt::NoButton;
for (int i = 0; i < 3; i++) {
int btn = 0x1 << i;
if (btn & btnNew) {
Qt::MouseButton convertedButton =
buttonValueToEnum(btn, tdd);
*buttons |= convertedButton;
/**
* If a button that is present in hardware input is
* mapped to a Qt::NoButton, it means that it is going
* to be eaten by the driver, for example by its
* "Pan/Scroll" feature. Therefore we shouldn't handle
* any of the events associated to it. So just return
* Qt::NoButton here.
*/
if (convertedButton == Qt::NoButton) {
/**
* Sometimes the driver-handled sortcuts are just
* keyboard modifiers, so ideally we should handle
* them as well. The problem is that we cannot
* know if the shortcut was a pan/zoom action or a
* shortcut. So here we use a "hackish" approash.
* We just check if any modifier has been pressed
* and, if so, pass the button to Krita. Of
* course, if the driver uses some really complex
* shortcuts like "Shift + stylus btn" to generate
* some recorded shortcut, it will not work. But I
* guess it will be ok for th emost of the
* usecases.
*
* WARNING: this hack will *not* work if you bind
* any non-modifier key to the stylus
* button, e.g. Space.
*/
const Qt::KeyboardModifiers keyboardModifiers = QApplication::queryKeyboardModifiers();
if (KisTabletDebugger::instance()->shouldEatDriverShortcuts() ||
keyboardModifiers == Qt::NoModifier) {
*button = Qt::NoButton;
*buttons = Qt::NoButton;
break;
}
}
}
}
}
private:
Qt::MouseButton buttonValueToEnum(DWORD button,
const QWindowsTabletDeviceData &tdd) {
const int leftButtonValue = 0x1;
const int middleButtonValue = 0x2;
const int rightButtonValue = 0x4;
const int doubleClickButtonValue = 0x7;
button = tdd.buttonsMap.value(button);
return button == leftButtonValue ? Qt::LeftButton :
button == rightButtonValue ? Qt::RightButton :
button == doubleClickButtonValue ? Qt::MiddleButton :
button == middleButtonValue ? Qt::MiddleButton :
button ? Qt::LeftButton /* fallback item */ :
Qt::NoButton;
}
};
static DefaultButtonsConverter *globalButtonsConverter =
new DefaultButtonsConverter();
/*
*
* Krita extensions end here
*
*
*/
// This is the WndProc for a single additional hidden window used to collect tablet events.
extern "C" LRESULT QT_WIN_CALLBACK qWindowsTabletSupportWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WT_PROXIMITY:
if (QTAB->translateTabletProximityEvent(wParam, lParam))
return 0;
break;
case WT_PACKET:
if (QTAB->translateTabletPacketEvent())
return 0;
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
// Scale tablet coordinates to screen coordinates.
static inline int sign(int x)
{
return x >= 0 ? 1 : -1;
}
inline QPointF QWindowsTabletDeviceData::scaleCoordinates(int coordX, int coordY, const QRect &targetArea) const
{
const int targetX = targetArea.x();
const int targetY = targetArea.y();
const int targetWidth = targetArea.width();
const int targetHeight = targetArea.height();
const qreal x = sign(targetWidth) == sign(maxX) ?
((coordX - minX) * qAbs(targetWidth) / qAbs(qreal(maxX - minX))) + targetX :
((qAbs(maxX) - (coordX - minX)) * qAbs(targetWidth) / qAbs(qreal(maxX - minX))) + targetX;
const qreal y = sign(targetHeight) == sign(maxY) ?
((coordY - minY) * qAbs(targetHeight) / qAbs(qreal(maxY - minY))) + targetY :
((qAbs(maxY) - (coordY - minY)) * qAbs(targetHeight) / qAbs(qreal(maxY - minY))) + targetY;
return QPointF(x, y);
}
/*!
\class QWindowsWinTab32DLL QWindowsTabletSupport
\brief Functions from wintabl32.dll shipped with WACOM tablets used by QWindowsTabletSupport.
\internal
\ingroup qt-lighthouse-win
*/
bool QWindowsWinTab32DLL::init()
{
if (wTInfo)
return true;
QLibrary library(QStringLiteral("wintab32"));
if (!library.load()) {
qWarning() << "Could not load wintab32 dll";
return false;
}
wTOpen = (PtrWTOpen) library.resolve("WTOpenW");
wTClose = (PtrWTClose) library.resolve("WTClose");
wTInfo = (PtrWTInfo) library.resolve("WTInfoW");
wTEnable = (PtrWTEnable) library.resolve("WTEnable");
wTOverlap = (PtrWTOverlap) library.resolve("WTOverlap");
wTPacketsGet = (PtrWTPacketsGet) library.resolve("WTPacketsGet");
wTGet = (PtrWTGet) library.resolve("WTGetW");
wTQueueSizeGet = (PtrWTQueueSizeGet) library.resolve("WTQueueSizeGet");
wTQueueSizeSet = (PtrWTQueueSizeSet) library.resolve("WTQueueSizeSet");
if (wTOpen && wTClose && wTInfo && wTEnable && wTOverlap && wTPacketsGet && wTQueueSizeGet && wTQueueSizeSet) {
return true;
}
qWarning() << "Could not resolve the following symbols:\n"
<< "\t wTOpen" << wTOpen << "\n"
<< "\t wtClose" << wTClose << "\n"
<< "\t wtInfo" << wTInfo << "\n"
<< "\t wTEnable" << wTEnable << "\n"
<< "\t wTOverlap" << wTOverlap << "\n"
<< "\t wTPacketsGet" << wTPacketsGet << "\n"
<< "\t wTQueueSizeGet" << wTQueueSizeGet << "\n"
<< "\t wTQueueSizeSet" << wTQueueSizeSet << "\n";
return false;
}
/*!
\class QWindowsTabletSupport
\brief Tablet support for Windows.
Support for WACOM tablets.
\sa http://www.wacomeng.com/windows/docs/Wintab_v140.htm
\internal
\since 5.2
\ingroup qt-lighthouse-win
*/
QWindowsTabletSupport::QWindowsTabletSupport(HWND window, HCTX context)
: m_window(window)
, m_context(context)
, m_absoluteRange(20)
, m_tiltSupport(false)
, m_currentDevice(-1)
{
AXIS orientation[3];
// Some tablets don't support tilt, check if it is possible,
if (QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES, DVC_ORIENTATION, &orientation))
m_tiltSupport = orientation[0].axResolution && orientation[1].axResolution;
}
QWindowsTabletSupport::~QWindowsTabletSupport()
{
QWindowsTabletSupport::m_winTab32DLL.wTClose(m_context);
DestroyWindow(m_window);
}
QWindowsTabletSupport *QWindowsTabletSupport::create()
{
const HWND window = createDummyWindow(QStringLiteral("TabletDummyWindow"),
L"TabletDummyWindow",
qWindowsTabletSupportWndProc);
LOGCONTEXT lcMine;
// build our context from the default context
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEFSYSCTX, 0, &lcMine);
// Go for the raw coordinates, the tablet event will return good stuff. The
// defaults for lcOut rectangle are the desktop dimensions in pixels, which
// means Wintab will do lossy rounding. Instead we specify this trivial
// scaling for the output context, then do the scaling ourselves later to
// obtain higher resolution coordinates.
lcMine.lcOptions |= CXO_MESSAGES | CXO_CSRMESSAGES;
lcMine.lcPktData = lcMine.lcMoveMask = PACKETDATA;
lcMine.lcPktMode = PacketMode;
lcMine.lcOutOrgX = 0;
lcMine.lcOutExtX = lcMine.lcInExtX;
lcMine.lcOutOrgY = 0;
lcMine.lcOutExtY = -lcMine.lcInExtY;
const HCTX context = QWindowsTabletSupport::m_winTab32DLL.wTOpen(window, &lcMine, true);
if (!context) {
dbgTablet << __FUNCTION__ << "Unable to open tablet.";
DestroyWindow(window);
return 0;
}
// Set the size of the Packet Queue to the correct size
const int currentQueueSize = QWindowsTabletSupport::m_winTab32DLL.wTQueueSizeGet(context);
if (currentQueueSize != TabletPacketQSize) {
if (!QWindowsTabletSupport::m_winTab32DLL.wTQueueSizeSet(context, TabletPacketQSize)) {
if (!QWindowsTabletSupport::m_winTab32DLL.wTQueueSizeSet(context, currentQueueSize)) {
qWarning() << "Unable to set queue size on tablet. The tablet will not work.";
QWindowsTabletSupport::m_winTab32DLL.wTClose(context);
DestroyWindow(window);
return 0;
} // cannot restore old size
} // cannot set
} // mismatch
dbgTablet << "Opened tablet context " << context << " on window "
<< window << "changed packet queue size " << currentQueueSize
<< "->" << TabletPacketQSize;
return new QWindowsTabletSupport(window, context);
}
unsigned QWindowsTabletSupport::options() const
{
UINT result = 0;
m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_CTXOPTIONS, &result);
return result;
}
QString QWindowsTabletSupport::description() const
{
const unsigned size = m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_WINTABID, 0);
if (!size)
return QString();
QScopedPointer<TCHAR> winTabId(new TCHAR[size + 1]);
m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_WINTABID, winTabId.data());
WORD implementationVersion = 0;
m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_IMPLVERSION, &implementationVersion);
WORD specificationVersion = 0;
m_winTab32DLL.wTInfo(WTI_INTERFACE, IFC_SPECVERSION, &specificationVersion);
const unsigned opts = options();
QString result = QString::fromLatin1("%1 specification: v%2.%3 implementation: v%4.%5 options: 0x%6")
.arg(QString::fromWCharArray(winTabId.data()))
.arg(specificationVersion >> 8).arg(specificationVersion & 0xFF)
.arg(implementationVersion >> 8).arg(implementationVersion & 0xFF)
.arg(opts, 0, 16);
if (opts & CXO_MESSAGES)
result += QStringLiteral(" CXO_MESSAGES");
if (opts & CXO_CSRMESSAGES)
result += QStringLiteral(" CXO_CSRMESSAGES");
if (m_tiltSupport)
result += QStringLiteral(" tilt");
return result;
}
void QWindowsTabletSupport::notifyActivate()
{
// Cooperate with other tablet applications, but when we get focus, I want to use the tablet.
const bool result = QWindowsTabletSupport::m_winTab32DLL.wTEnable(m_context, true)
&& QWindowsTabletSupport::m_winTab32DLL.wTOverlap(m_context, true);
dbgTablet << __FUNCTION__ << result;
}
static inline int indexOfDevice(const QVector<QWindowsTabletDeviceData> &devices, qint64 uniqueId)
{
for (int i = 0; i < devices.size(); ++i)
if (devices.at(i).uniqueId == uniqueId)
return i;
return -1;
}
static inline QTabletEvent::TabletDevice deviceType(const UINT cursorType)
{
if (((cursorType & 0x0006) == 0x0002) && ((cursorType & CursorTypeBitMask) != 0x0902))
return QTabletEvent::Stylus;
if (cursorType == 0x4020) // Surface Pro 2 tablet device
return QTabletEvent::Stylus;
switch (cursorType & CursorTypeBitMask) {
case 0x0802:
return QTabletEvent::Stylus;
case 0x0902:
return QTabletEvent::Airbrush;
case 0x0004:
return QTabletEvent::FourDMouse;
case 0x0006:
return QTabletEvent::Puck;
case 0x0804:
return QTabletEvent::RotationStylus;
default:
break;
}
return QTabletEvent::NoDevice;
};
static inline QTabletEvent::PointerType pointerType(unsigned pkCursor)
{
switch (pkCursor % 3) { // %3 for dual track
case 0:
return QTabletEvent::Cursor;
case 1:
return QTabletEvent::Pen;
case 2:
return QTabletEvent::Eraser;
default:
break;
}
return QTabletEvent::UnknownPointer;
}
QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
{
d << "TabletDevice id:" << t.uniqueId << " pressure: " << t.minPressure
<< ".." << t.maxPressure << " tan pressure: " << t.minTanPressure << ".."
<< t.maxTanPressure << " area:" << t.minX << t.minY << t.minZ
<< ".." << t.maxX << t.maxY << t.maxZ << " device " << t.currentDevice
<< " pointer " << t.currentPointerType;
return d;
}
QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(const quint64 uniqueId, const UINT cursorType) const
{
QWindowsTabletDeviceData result;
result.uniqueId = uniqueId;
/* browse WinTab's many info items to discover pressure handling. */
AXIS axis;
LOGCONTEXT lc;
/* get the current context for its device variable. */
QWindowsTabletSupport::m_winTab32DLL.wTGet(m_context, &lc);
if (KisTabletDebugger::instance()->initializationDebugEnabled()) {
printContext(lc);
}
/* get the size of the pressure axis. */
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &axis);
result.minPressure = int(axis.axMin);
result.maxPressure = int(axis.axMax);
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &axis);
result.minTanPressure = int(axis.axMin);
result.maxTanPressure = int(axis.axMax);
LOGCONTEXT defaultLc;
/* get default region */
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEFCONTEXT, 0, &defaultLc);
result.maxX = int(defaultLc.lcInExtX) - int(defaultLc.lcInOrgX);
result.maxY = int(defaultLc.lcInExtY) - int(defaultLc.lcInOrgY);
result.maxZ = int(defaultLc.lcInExtZ) - int(defaultLc.lcInOrgZ);
result.currentDevice = deviceType(cursorType);
// Define a rectangle representing the whole screen as seen by Wintab.
QRect qtDesktopRect = QApplication::desktop()->geometry();
QRect wintabDesktopRect(defaultLc.lcSysOrgX, defaultLc.lcSysOrgY,
defaultLc.lcSysExtX, defaultLc.lcSysExtY);
qDebug() << ppVar(qtDesktopRect);
qDebug() << ppVar(wintabDesktopRect);
// Show screen choice dialog
- {
+ if (!dialogOpen) {
KisScreenSizeChoiceDialog dlg(0,
wintabDesktopRect,
qtDesktopRect);
KisExtendedModifiersMapper mapper;
KisExtendedModifiersMapper::ExtendedModifiers modifiers =
mapper.queryExtendedModifiers();
if (modifiers.contains(Qt::Key_Shift) ||
(!dlg.canUseDefaultSettings() &&
qtDesktopRect != wintabDesktopRect)) {
dialogOpen = true;
dlg.exec();
}
result.virtualDesktopArea = dlg.screenRect();
dialogOpen = false;
+ } else {
+ // this branch is really improbable and most probably means
+ // a bug in the tablet driver. Anyway, we just shouldn't show
+ // hundreds of tablet initialization dialogs
+ result.virtualDesktopArea = qtDesktopRect;
}
return result;
};
bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, LPARAM lParam)
{
auto sendProximityEvent = [&](QEvent::Type type) {
QPointF emptyPos;
qreal zero = 0.0;
QTabletEvent e(type, emptyPos, emptyPos, 0, m_devices.at(m_currentDevice).currentPointerType,
zero, 0, 0, zero, zero, 0, Qt::NoModifier,
m_devices.at(m_currentDevice).uniqueId, Qt::NoButton, (Qt::MouseButtons)0);
qApp->sendEvent(qApp, &e);
};
if (!LOWORD(lParam)) {
// dbgTablet << "leave proximity for device #" << m_currentDevice;
sendProximityEvent(QEvent::TabletLeaveProximity);
return true;
}
PACKET proximityBuffer[1]; // we are only interested in the first packet in this case
const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer);
if (!totalPacks)
return false;
UINT pkCursor = proximityBuffer[0].pkCursor;
// initializing and updating the cursor should be done in response to
// WT_CSRCHANGE. We do it in WT_PROXIMITY because some wintab never send
// the event WT_CSRCHANGE even if asked with CXO_CSRMESSAGES
tabletUpdateCursor(pkCursor);
// dbgTablet << "enter proximity for device #" << m_currentDevice << m_devices.at(m_currentDevice);
sendProximityEvent(QEvent::TabletEnterProximity);
return true;
}
bool QWindowsTabletSupport::translateTabletPacketEvent()
{
static PACKET localPacketBuf[TabletPacketQSize]; // our own tablet packet queue.
const int packetCount = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, TabletPacketQSize, &localPacketBuf);
if (!packetCount || m_currentDevice < 0 || dialogOpen)
return false;
// In contrast to Qt, these will not be "const" during our loop.
// This is because the Surface Pro 3 may cause us to switch devices.
QWindowsTabletDeviceData tabletData = m_devices.at(m_currentDevice);
int currentDevice = tabletData.currentDevice;
int currentPointerType = tabletData.currentPointerType;
// static Qt::MouseButtons buttons = Qt::NoButton, btnOld, btnChange;
static DWORD btnNew, btnOld, btnChange;
// The tablet can be used in 2 different modes, depending on its settings:
// 1) Absolute (pen) mode:
// The coordinates are scaled to the virtual desktop (by default). The user
// can also choose to scale to the monitor or a region of the screen.
// When entering proximity, the tablet driver snaps the mouse pointer to the
// tablet position scaled to that area and keeps it in sync.
// 2) Relative (mouse) mode:
// The pen follows the mouse. The constant 'absoluteRange' specifies the
// manhattanLength difference for detecting if a tablet input device is in this mode,
// in which case we snap the position to the mouse position.
// It seems there is no way to find out the mode programmatically, the LOGCONTEXT orgX/Y/Ext
// area is always the virtual desktop.
static qreal dpr = 1.0;
auto activeWindow = qApp->activeWindow();
if (activeWindow) {
dpr = activeWindow->devicePixelRatio();
}
const Qt::KeyboardModifiers keyboardModifiers = QApplication::queryKeyboardModifiers();
for (int i = 0; i < packetCount; ++i) {
const PACKET &packet = localPacketBuf[i];
btnOld = btnNew;
btnNew = localPacketBuf[i].pkButtons;
btnChange = btnOld ^ btnNew;
bool buttonPressed = btnChange && btnNew > btnOld;
bool buttonReleased = btnChange && btnNew < btnOld;
bool anyButtonsStillPressed = btnNew;
Qt::MouseButton button = Qt::NoButton;
Qt::MouseButtons buttons;
globalButtonsConverter->convert(btnOld, btnNew, &button, &buttons, tabletData);
QEvent::Type type = QEvent::TabletMove;
if (buttonPressed && button != Qt::NoButton) {
type = QEvent::TabletPress;
} else if (buttonReleased && button != Qt::NoButton) {
type = QEvent::TabletRelease;
}
const int z = currentDevice == QTabletEvent::FourDMouse ? int(packet.pkZ) : 0;
// This code is to delay the tablet data one cycle to sync with the mouse location.
QPointF globalPosF = m_oldGlobalPosF / dpr; // Convert from "native" to "device independent pixels."
m_oldGlobalPosF = tabletData.scaleCoordinates(packet.pkX, packet.pkY,
tabletData.virtualDesktopArea);
QPoint globalPos = globalPosF.toPoint();
// Find top-level window
QWidget *w = targetWindow; // If we had a target already, use it.
if (!w) {
w = qApp->activePopupWidget();
if (!w) w = qApp->activeModalWidget();
if (!w) w = qApp->topLevelAt(globalPos);
if (!w) continue;
w = w->window();
}
const QPoint localPos = w->mapFromGlobal(globalPos);
const QPointF delta = globalPosF - globalPos;
const QPointF localPosF = globalPosF + QPointF(localPos - globalPos) + delta;
const qreal pressureNew = packet.pkButtons && (currentPointerType == QTabletEvent::Pen || currentPointerType == QTabletEvent::Eraser) ?
m_devices.at(m_currentDevice).scalePressure(packet.pkNormalPressure) :
qreal(0);
const qreal tangentialPressure = currentDevice == QTabletEvent::Airbrush ?
m_devices.at(m_currentDevice).scaleTangentialPressure(packet.pkTangentPressure) :
qreal(0);
int tiltX = 0;
int tiltY = 0;
qreal rotation = 0;
if (m_tiltSupport) {
// Convert from azimuth and altitude to x tilt and y tilt. What
// follows is the optimized version. Here are the equations used:
// X = sin(azimuth) * cos(altitude)
// Y = cos(azimuth) * cos(altitude)
// Z = sin(altitude)
// X Tilt = arctan(X / Z)
// Y Tilt = arctan(Y / Z)
const double radAzim = (packet.pkOrientation.orAzimuth / 10.0) * (M_PI / 180);
const double tanAlt = std::tan((std::abs(packet.pkOrientation.orAltitude / 10.0)) * (M_PI / 180));
const double degX = std::atan(std::sin(radAzim) / tanAlt);
const double degY = std::atan(std::cos(radAzim) / tanAlt);
tiltX = int(degX * (180 / M_PI));
tiltY = int(-degY * (180 / M_PI));
rotation = 360.0 - (packet.pkOrientation.orTwist / 10.0);
if (rotation > 180.0)
rotation -= 360.0;
}
// This is adds *a lot* of noise to the output log
if (false) {
dbgTablet
<< "Packet #" << (i+1) << '/' << packetCount << "button:" << packet.pkButtons
<< globalPosF << z << "to:" << w << localPos << "(packet" << packet.pkX
<< packet.pkY << ") dev:" << currentDevice << "pointer:"
<< currentPointerType << "P:" << pressureNew << "tilt:" << tiltX << ','
<< tiltY << "tanP:" << tangentialPressure << "rotation:" << rotation;
}
// Reusable helper function. Better than compiler macros!
auto sendTabletEvent = [&](QTabletEvent::Type t){
handleTabletEvent(w, localPosF, globalPosF, currentDevice, currentPointerType,
button, buttons, pressureNew, tiltX, tiltY, tangentialPressure, rotation, z,
m_devices.at(m_currentDevice).uniqueId, keyboardModifiers, t, packet.pkTime);
};
/**
* Workaround to deal with "inline" tool switches.
* These are caused by the eraser trigger button on the Surface Pro 3.
* We shoot out a tabletUpdateCursor request and a switchInputDevice request.
*/
if (isSurfacePro3 && (packet.pkCursor != currentPkCursor)) {
dbgTablet << "Got an inline tool switch.";
// Send tablet release event.
sendTabletEvent(QTabletEvent::TabletRelease);
// Read the new cursor info.
UINT pkCursor = packet.pkCursor;
tabletUpdateCursor(pkCursor);
// Update the local loop variables.
tabletData = m_devices.at(m_currentDevice);
currentDevice = deviceType(tabletData.currentDevice);
currentPointerType = pointerType(pkCursor);
sendTabletEvent(QTabletEvent::TabletPress);
}
sendTabletEvent(type);
} // Loop over packets
return true;
}
void QWindowsTabletSupport::tabletUpdateCursor(const int pkCursor)
{
UINT physicalCursorId;
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + pkCursor, CSR_PHYSID, &physicalCursorId);
UINT cursorType;
QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + pkCursor, CSR_TYPE, &cursorType);
const qint64 uniqueId = (qint64(cursorType & DeviceIdMask) << 32L) | qint64(physicalCursorId);
m_currentDevice = indexOfDevice(m_devices, uniqueId);
if (m_currentDevice < 0) {
m_currentDevice = m_devices.size();
m_devices.push_back(tabletInit(uniqueId, cursorType));
// Note: ideally we might check this button map for changes every
// update. However there seems to be an issue with Wintab altering the
// button map when the user right-clicks in Krita while another
// application has focus. This forces Krita to load button settings only
// once, when the tablet is first detected.
//
// See https://bugs.kde.org/show_bug.cgi?id=359561
BYTE logicalButtons[32];
memset(logicalButtons, 0, 32);
m_winTab32DLL.wTInfo(WTI_CURSORS + pkCursor, CSR_SYSBTNMAP, &logicalButtons);
m_devices[m_currentDevice].buttonsMap[0x1] = logicalButtons[0];
m_devices[m_currentDevice].buttonsMap[0x2] = logicalButtons[1];
m_devices[m_currentDevice].buttonsMap[0x4] = logicalButtons[2];
}
m_devices[m_currentDevice].currentPointerType = pointerType(pkCursor);
currentPkCursor = pkCursor;
// Check tablet name to enable Surface Pro 3 workaround.
#ifdef UNICODE
if (!isSurfacePro3) {
/**
* Some really "nice" tablet drivers don't know that trhey are
* supposed to return their name length when the buffer is
* null and they try to write into it effectively causing a
* suicide. So we cannot rely on it :(
*
* We workaround it by just allocating a big array and hoping
* for the best.
*
* Failing tablets:
* - Adesso Cybertablet M14
* - Peritab-302
* - Trust Tablet TB7300
* - VisTablet Realm Pro
* - Aiptek 14000u (latest driver: v5.03, 2013-10-21)
* - Genius G-Pen F350
* - Genius G-Pen 560 (supported on win7 only)
*/
// we cannot use the correct api :(
// UINT nameLength = QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES, DVC_NAME, 0);
// 1024 chars should be enough for everyone! (c)
UINT nameLength = 1024;
TCHAR* dvcName = new TCHAR[nameLength + 1];
memset(dvcName, 0, sizeof(TCHAR) * nameLength);
UINT writtenBytes = QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_DEVICES, DVC_NAME, dvcName);
if (writtenBytes > sizeof(TCHAR) * nameLength) {
qWarning() << "WINTAB WARNING: tablet name is too long!" << writtenBytes;
// avoid crash when trying to read it
dvcName[nameLength - 1] = (TCHAR)0;
}
QString qDvcName = QString::fromWCharArray((const wchar_t*)dvcName);
dbgInput << "DVC_NAME =" << qDvcName;
// Name changed between older and newer Surface Pro 3 drivers
if (qDvcName == QString::fromLatin1("N-trig DuoSense device") ||
qDvcName == QString::fromLatin1("Microsoft device")) {
dbgInput << "This looks like a Surface Pro 3. Enabling eraser workaround.";
isSurfacePro3 = true;
}
delete[] dvcName;
}
#endif
}
QT_END_NAMESPACE
diff --git a/libs/ui/input/wintab/kis_tablet_support_x11.h b/libs/ui/input/wintab/kis_tablet_support_x11.h
index b664e3c737..0adf0d3dda 100644
--- a/libs/ui/input/wintab/kis_tablet_support_x11.h
+++ b/libs/ui/input/wintab/kis_tablet_support_x11.h
@@ -1,32 +1,32 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TABLET_SUPPORT_X11_H
#define __KIS_TABLET_SUPPORT_X11_H
#include <QAbstractNativeEventFilter>
#include <kritaui_export.h>
class KRITAUI_EXPORT KisTabletSupportX11 : public QAbstractNativeEventFilter
{
public:
static void init();
- virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
};
#endif /* __KIS_TABLET_SUPPORT_X11_H */
diff --git a/libs/ui/input/wintab/kis_xi2_event_filter.h b/libs/ui/input/wintab/kis_xi2_event_filter.h
index 9038c08999..0eb2b6e54e 100644
--- a/libs/ui/input/wintab/kis_xi2_event_filter.h
+++ b/libs/ui/input/wintab/kis_xi2_event_filter.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_XI2_EVENT_FILTER_H
#define __KIS_XI2_EVENT_FILTER_H
#include <QAbstractNativeEventFilter>
#include "kritaui_export.h"
#include <QScopedPointer>
class KRITAUI_EXPORT KisXi2EventFilter : public QAbstractNativeEventFilter
{
public:
KisXi2EventFilter();
- ~KisXi2EventFilter();
+ ~KisXi2EventFilter() override;
static KisXi2EventFilter* instance();
- bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_XI2_EVENT_FILTER_H */
diff --git a/libs/ui/kis_abstract_perspective_grid.h b/libs/ui/kis_abstract_perspective_grid.h
index 26d90359d2..7655bb3690 100644
--- a/libs/ui/kis_abstract_perspective_grid.h
+++ b/libs/ui/kis_abstract_perspective_grid.h
@@ -1,47 +1,47 @@
/*
* This file is part of Krita
*
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ABSTRACT_PERSPECTIVE_GRID_H
#define KIS_ABSTRACT_PERSPECTIVE_GRID_H
#include <QPointF>
#include <QObject>
#include "kritaui_export.h"
class KRITAUI_EXPORT KisAbstractPerspectiveGrid : public QObject
{
Q_OBJECT
public:
KisAbstractPerspectiveGrid(QObject * parent = 0);
- virtual ~KisAbstractPerspectiveGrid() {}
+ ~KisAbstractPerspectiveGrid() override {}
virtual bool contains(const QPointF& pt) const = 0;
/**
* Returns the reciprocal of the distance from the given point
* to the 'observer', in the range [0, 1] where 0 = inifinite
* distance and 1 = closest.
*/
virtual qreal distance(const QPointF& pt) const = 0;
};
#endif
diff --git a/libs/ui/kis_action.h b/libs/ui/kis_action.h
index 901b73ed24..623fd713e8 100644
--- a/libs/ui/kis_action.h
+++ b/libs/ui/kis_action.h
@@ -1,131 +1,131 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ACTION_H
#define KIS_ACTION_H
#include <QWidgetAction>
#include <kritaui_export.h>
#include <kis_debug.h>
#include <QIcon>
class KisActionManager;
/**
* KisAction, inheriting from QWidgetAction, is a convenience class for GUI
* actions, with Krita's configuration system and GUI states. A widget like a
* "save" button may be enabled/disabled, hidden or shown depending on the
* state of the application, e.g. whether the image currently being viewed was
* modified since it was opened.
*
* Copies of these actions are created for each MainWindow instance. They are
* owned by a KisActionManager, of which there is one for each MainWindow. Most
* of these instantiations happen inside the constructor for KisMainWindow as
* well as the various functions called in KisViewManager::setupManagers().
*
**/
class KRITAUI_EXPORT KisAction : public QWidgetAction
{
Q_OBJECT
public:
/**
* If you re-order these, you must change the associated values in
* krita.action and kritamenu.action!
*/
enum ActivationFlag {
NONE = 0x0000, ///< Always activate
ACTIVE_IMAGE = 0x0001, ///< Activate if there is at least one image
MULTIPLE_IMAGES = 0x0002, ///< Activate if there is more than one image open
CURRENT_IMAGE_MODIFIED = 0x0004, ///< Activate if the current image is modified
ACTIVE_NODE = 0x0008, ///< Activate if there's an active node (layer or mask)
ACTIVE_DEVICE = 0x0010, ///< Activate if the active node has a paint device, i.e. there are pixels to be modified
ACTIVE_LAYER = 0x0020, ///< Activate if the current node is a layer (vector or pixel)
ACTIVE_TRANSPARENCY_MASK = 0x0040, ///< Activate if the current node is a transparency mask
ACTIVE_SHAPE_LAYER = 0x0080, ///< Activate if the current node is a vector layer
PIXELS_SELECTED = 0x0100, ///< Activate if there is an active pixel selection
SHAPES_SELECTED = 0x0200, ///< Activate if there is an active vector selection
PIXEL_SELECTION_WITH_PIXELS = 0x0400, ///< ???
PIXELS_IN_CLIPBOARD = 0x0800, ///< Activate if the clipboard contains pixels
SHAPES_IN_CLIPBOARD = 0x1000, ///< Activate if the clipboard contains vector data
NEVER_ACTIVATE = 0x2000, ///< ???
LAYERS_IN_CLIPBOARD = 0x4000, ///< ???
IMAGE_HAS_ANIMATION = 0x8000, ///< Activate if the image has an animation
};
Q_DECLARE_FLAGS(ActivationFlags, ActivationFlag)
enum ActivationCondition {
NO_CONDITION = 0,
ACTIVE_NODE_EDITABLE = 0x1,
ACTIVE_NODE_EDITABLE_PAINT_DEVICE = 0x2,
SELECTION_EDITABLE = 0x4
};
Q_DECLARE_FLAGS(ActivationConditions, ActivationCondition)
explicit KisAction(QObject* parent = 0);
KisAction(const QString& text, QObject* parent = 0);
KisAction(const QIcon& icon, const QString& text, QObject* parent = 0);
- virtual ~KisAction();
+ ~KisAction() override;
void setDefaultShortcut(const QKeySequence & shortcut);
QKeySequence defaultShortcut() const;
void setActivationFlags(ActivationFlags flags);
ActivationFlags activationFlags();
void setActivationConditions(ActivationConditions conditions);
ActivationConditions activationConditions();
void setExcludedNodeTypes(const QStringList &nodeTypes);
const QStringList& excludedNodeTypes() const;
virtual void setActionEnabled(bool enabled);
/**
* Set operation id. This will used to run an operation in the KisActionManager
*/
void setOperationID(const QString& id);
Q_SIGNALS:
void sigEnableSlaves(bool value);
private Q_SLOTS:
void slotTriggered();
void slotChanged();
private:
friend class KisActionManager;
/**
* Set the action manager. Only used by KisActionManager
*/
void setActionManager(KisActionManager* actionManager);
class Private;
Private* const d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KisAction::ActivationFlags)
Q_DECLARE_OPERATORS_FOR_FLAGS(KisAction::ActivationConditions)
#endif // KIS_ACTION_H
diff --git a/libs/ui/kis_action_manager.h b/libs/ui/kis_action_manager.h
index c796433e0f..fbb59de377 100644
--- a/libs/ui/kis_action_manager.h
+++ b/libs/ui/kis_action_manager.h
@@ -1,113 +1,113 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ACTION_MANAGER_H
#define KIS_ACTION_MANAGER_H
#include <kritaui_export.h>
#include <QPointer>
#include "KisView.h"
#include "kstandardaction.h"
#include "kis_action_registry.h"
#include "operations/kis_operation_configuration.h"
class KisViewManager;
class KisAction;
class KisOperationUIFactory;
class KisOperation;
/**
* @brief A KisActionManager class keeps track of KisActions.
* These actions are always associated with the GUI. That means each MainWindow
* will create its own duplicate of these actions.
*
* KisActionManager enables and disables actions, to grey out buttons according
* to the state of the application.
*
* Some of the primitive actions (load/save and so on) are not defined as
* KisActions, but instead KActions, automacially registered through KXMLGUI.
* It tracks these actions through the KActionCollection owned by the window.
* Ultimately it would be nice to unify these things more fully.
*
*/
class KRITAUI_EXPORT KisActionManager : public QObject
{
Q_OBJECT
public:
KisActionManager(KisViewManager* viewManager, KActionCollection *actionCollection);
- virtual ~KisActionManager();
+ ~KisActionManager() override;
void setView(QPointer<KisView> imageView);
/**
* Add an existing action to the action manager.
*/
void addAction(const QString& name, KisAction* action);
/**
* Stop managing an action.
*/
void takeAction(KisAction* action);
/**
* Create a new KisAction. Looks up data from the .action data files.
*/
KisAction *createAction(const QString &name);
/**
* Look up an action by name.
*/
KisAction *actionByName(const QString &name) const;
void registerOperationUIFactory(KisOperationUIFactory* factory);
void registerOperation(KisOperation* operation);
void runOperation(const QString &id);
void runOperationFromConfiguration(KisOperationConfigurationSP config);
/**
* Update actions handled by kis_action_manager to set enabled.
* This is used to grey out buttons that can't be pressed.
*/
void updateGUI();
/**
* Create a KisAction based on a KStandardAction. The KStandardAction is deleted.
*/
KisAction *createStandardAction(KStandardAction::StandardAction,
const QObject *receiver, const char *member);
private Q_SLOTS:
void slotActionAddedToCollection(QAction *action);
private:
void dumpActionFlags();
class Private;
Private* const d;
};
#endif // KIS_ACTION_MANAGER_H
diff --git a/libs/ui/kis_animation_cache_populator.h b/libs/ui/kis_animation_cache_populator.h
index 3a117a233d..7e177dbeae 100644
--- a/libs/ui/kis_animation_cache_populator.h
+++ b/libs/ui/kis_animation_cache_populator.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ANIMATION_CACHE_POPULATOR_H
#define KIS_ANIMATION_CACHE_POPULATOR_H
#include <QObject>
#include "kis_types.h"
class KisPart;
class KisAnimationCachePopulator : public QObject
{
Q_OBJECT
public:
KisAnimationCachePopulator(KisPart *part);
- ~KisAnimationCachePopulator();
+ ~KisAnimationCachePopulator() override;
/**
* Request generation of given frame. The request will
* be ignored if the populator is already requesting a frame.
* @return true if generation reqeusted, false if busy
*/
bool regenerate(KisAnimationFrameCacheSP cache, int frame);
public Q_SLOTS:
void slotRequestRegeneration();
private Q_SLOTS:
void slotTimer();
void slotRegeneratorFrameCancelled();
void slotRegeneratorFrameReady();
void slotConfigChanged();
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/ui/kis_animation_exporter.cpp b/libs/ui/kis_animation_exporter.cpp
index bf35d690c4..0dada1e4ea 100644
--- a/libs/ui/kis_animation_exporter.cpp
+++ b/libs/ui/kis_animation_exporter.cpp
@@ -1,378 +1,390 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_animation_exporter.h"
#include <QDesktopServices>
#include <QProgressDialog>
#include <KisMimeDatabase.h>
#include <QEventLoop>
#include <QMessageBox>
#include "KoFileDialog.h"
#include "KisDocument.h"
#include "kis_image.h"
#include "KisImportExportManager.h"
#include "kis_image_animation_interface.h"
#include "KisPart.h"
#include "KisMainWindow.h"
#include "kis_paint_layer.h"
#include "kis_group_layer.h"
#include "kis_time_range.h"
#include "kis_painter.h"
#include "kis_image_lock_hijacker.h"
struct KisAnimationExporterUI::Private
{
QWidget *parentWidget;
KisAnimationExportSaver *exporter;
Private(QWidget *parent)
: parentWidget(parent),
exporter(0)
{}
};
KisAnimationExporterUI::KisAnimationExporterUI(QWidget *parent)
: m_d(new Private(parent))
{
}
KisAnimationExporterUI::~KisAnimationExporterUI()
{
if (m_d->exporter) {
delete m_d->exporter;
}
}
struct KisAnimationExporter::Private
{
Private(KisDocument *document, int fromTime, int toTime)
: document(document)
, image(document->image())
, firstFrame(fromTime)
, lastFrame(toTime)
, currentFrame(-1)
, batchMode(document->fileBatchMode())
, isCancelled(false)
, status(KisImportExportFilter::OK)
, tmpDevice(new KisPaintDevice(image->colorSpace()))
{
}
KisDocument *document;
KisImageWSP image;
int firstFrame;
int lastFrame;
int currentFrame;
bool batchMode;
bool isCancelled;
KisImportExportFilter::ConversionStatus status;
SaveFrameCallback saveFrameCallback;
KisPaintDeviceSP tmpDevice;
KisPropertiesConfigurationSP exportConfiguration;
QProgressDialog progress;
};
KisAnimationExporter::KisAnimationExporter(KisDocument *document, int fromTime, int toTime)
: m_d(new Private(document, fromTime, toTime))
{
connect(m_d->image->animationInterface(), SIGNAL(sigFrameReady(int)),
this, SLOT(frameReadyToCopy(int)), Qt::DirectConnection);
connect(this, SIGNAL(sigFrameReadyToSave()),
this, SLOT(frameReadyToSave()), Qt::QueuedConnection);
}
KisAnimationExporter::~KisAnimationExporter()
{
}
void KisAnimationExporter::setExportConfiguration(KisPropertiesConfigurationSP exportConfiguration)
{
m_d->exportConfiguration = exportConfiguration;
}
void KisAnimationExporter::setSaveFrameCallback(SaveFrameCallback func)
{
m_d->saveFrameCallback = func;
}
KisImportExportFilter::ConversionStatus KisAnimationExporter::exportAnimation()
{
if (!m_d->batchMode) {
QString message = i18n("Preparing to export frames...");
m_d->progress.reset();
m_d->progress.setLabelText(message);
m_d->progress.setWindowModality(Qt::ApplicationModal);
m_d->progress.setCancelButton(0);
m_d->progress.setMinimumDuration(0);
m_d->progress.setValue(0);
m_d->progress.setMinimum(0);
m_d->progress.setMaximum(100);
emit m_d->document->statusBarMessage(message);
emit m_d->document->sigProgress(0);
connect(m_d->document, SIGNAL(sigProgressCanceled()), this, SLOT(cancel()));
}
/**
* HACK ALERT: Here we remove the image lock! We do it in a GUI
* thread under the barrier lock held, so it is
* guaranteed no other stroke will accidentally be
* started by this. And showing an app-modal dialog to
* the user will prevent him from doing anything
* nasty.
*/
KisImageLockHijacker badGuy(m_d->image);
Q_UNUSED(badGuy);
KIS_ASSERT_RECOVER(!m_d->image->locked()) { return KisImportExportFilter::InternalError; }
m_d->status = KisImportExportFilter::OK;
m_d->currentFrame = m_d->firstFrame;
m_d->image->animationInterface()->requestFrameRegeneration(m_d->currentFrame, m_d->image->bounds());
QEventLoop loop;
loop.connect(this, SIGNAL(sigFinished()), SLOT(quit()));
loop.exec();
if (!m_d->batchMode) {
disconnect(m_d->document, SIGNAL(sigProgressCanceled()), this, SLOT(cancel()));
emit m_d->document->sigProgress(100);
emit m_d->document->clearStatusBarMessage();
m_d->progress.reset();
}
return m_d->status;
}
void KisAnimationExporter::cancel()
{
m_d->isCancelled = true;
}
void KisAnimationExporter::frameReadyToCopy(int time)
{
if (time != m_d->currentFrame) return;
QRect rc = m_d->image->bounds();
KisPainter::copyAreaOptimized(rc.topLeft(), m_d->image->projection(), m_d->tmpDevice, rc);
emit sigFrameReadyToSave();
}
void KisAnimationExporter::frameReadyToSave()
{
KIS_ASSERT_RECOVER(m_d->saveFrameCallback) {
m_d->status = KisImportExportFilter::InternalError;
emit sigFinished();
return;
}
if (m_d->isCancelled) {
m_d->status = KisImportExportFilter::UserCancelled;
emit sigFinished();
return;
}
KisImportExportFilter::ConversionStatus result =
KisImportExportFilter::OK;
int time = m_d->currentFrame;
result = m_d->saveFrameCallback(time, m_d->tmpDevice, m_d->exportConfiguration);
if (!m_d->batchMode) {
int length = m_d->lastFrame - m_d->firstFrame + 1;
emit m_d->document->sigProgress((time - m_d->firstFrame) * 100 / length);
}
qDebug() << result << time << m_d->lastFrame;
QString dialogText = QString("Exporting Frame ").append(QString::number(time)).append(" of ").append(QString::number(m_d->lastFrame));
int percentageProcessed = (float(time) / float(m_d->lastFrame) * 100);
m_d->progress.setLabelText(dialogText);
m_d->progress.setValue(int(percentageProcessed));
if (result == KisImportExportFilter::OK && time < m_d->lastFrame) {
m_d->currentFrame = time + 1;
m_d->image->animationInterface()->requestFrameRegeneration(m_d->currentFrame, m_d->image->bounds());
} else {
+ m_d->status = result;
emit sigFinished();
}
}
struct KisAnimationExportSaver::Private
{
Private(KisDocument *document, int fromTime, int toTime, int _sequenceNumberingOffset)
: document(document)
, image(document->image())
, firstFrame(fromTime)
, lastFrame(toTime)
, sequenceNumberingOffset(_sequenceNumberingOffset)
, tmpDoc(KisPart::instance()->createDocument())
, exporter(document, fromTime, toTime)
{
tmpDoc->setAutoSaveDelay(0);
tmpImage = new KisImage(tmpDoc->createUndoStore(),
image->bounds().width(),
image->bounds().height(),
image->colorSpace(),
QString());
tmpImage->setResolution(image->xRes(), image->yRes());
tmpDoc->setCurrentImage(tmpImage);
KisPaintLayer* paintLayer = new KisPaintLayer(tmpImage, "paint device", 255);
tmpImage->addNode(paintLayer, tmpImage->rootLayer(), KisLayerSP(0));
tmpDevice = paintLayer->paintDevice();
}
KisDocument *document;
KisImageWSP image;
int firstFrame;
int lastFrame;
int sequenceNumberingOffset;
QScopedPointer<KisDocument> tmpDoc;
KisImageSP tmpImage;
KisPaintDeviceSP tmpDevice;
KisAnimationExporter exporter;
QString filenamePrefix;
QString filenameSuffix;
};
KisAnimationExportSaver::KisAnimationExportSaver(KisDocument *document, const QString &baseFilename, int fromTime, int toTime, int sequenceNumberingOffset)
: m_d(new Private(document, fromTime, toTime, sequenceNumberingOffset))
{
int baseLength = baseFilename.lastIndexOf(".");
if (baseLength > -1) {
m_d->filenamePrefix = baseFilename.left(baseLength);
m_d->filenameSuffix = baseFilename.right(baseFilename.length() - baseLength);
} else {
m_d->filenamePrefix = baseFilename;
}
QString mimefilter = KisMimeDatabase::mimeTypeForFile(baseFilename);
m_d->tmpDoc->setOutputMimeType(mimefilter.toLatin1());
m_d->tmpDoc->setFileBatchMode(true);
using namespace std::placeholders; // For _1 placeholder
m_d->exporter.setSaveFrameCallback(std::bind(&KisAnimationExportSaver::saveFrameCallback, this, _1, _2, _3));
}
KisAnimationExportSaver::~KisAnimationExportSaver()
{
}
KisImportExportFilter::ConversionStatus KisAnimationExportSaver::exportAnimation(KisPropertiesConfigurationSP cfg)
{
- QFileInfo info(savedFilesMask());
+ QFileInfo info(savedFilesMaskWildcard());
QDir dir(info.absolutePath());
+
+ if (!dir.exists()) {
+ dir.mkpath(info.absolutePath());
+ }
+ KIS_SAFE_ASSERT_RECOVER_NOOP(dir.exists());
+
QStringList filesList = dir.entryList({ info.fileName() });
if (!filesList.isEmpty()) {
if (m_d->document->fileBatchMode()) {
return KisImportExportFilter::CreationError;
}
QStringList truncatedList = filesList;
while (truncatedList.size() > 3) {
truncatedList.takeLast();
}
QString exampleFiles = truncatedList.join(", ");
if (truncatedList.size() != filesList.size()) {
exampleFiles += QString(", ...");
}
QMessageBox::StandardButton result =
QMessageBox::warning(0,
i18n("Delete old frames?"),
i18n("Frames with the same naming "
"scheme exist in the destination "
"directory. They are going to be "
"deleted, continue?\n\n"
"Directory: %1\n"
"Files: %2",
info.absolutePath(), exampleFiles),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (result == QMessageBox::Yes) {
Q_FOREACH (const QString &file, filesList) {
if (!dir.remove(file)) {
QMessageBox::critical(0,
i18n("Failed to delete"),
i18n("Failed to delete an old frame file:\n\n"
"%1\n\n"
"Rendering cancelled.", dir.absoluteFilePath(file)));
return KisImportExportFilter::CreationError;
}
}
} else {
return KisImportExportFilter::UserCancelled;
}
}
m_d->exporter.setExportConfiguration(cfg);
return m_d->exporter.exportAnimation();
}
KisImportExportFilter::ConversionStatus KisAnimationExportSaver::saveFrameCallback(int time, KisPaintDeviceSP frame, KisPropertiesConfigurationSP exportConfiguration)
{
KisImportExportFilter::ConversionStatus status = KisImportExportFilter::OK;
QString frameNumber = QString("%1").arg(time - m_d->firstFrame + m_d->sequenceNumberingOffset, 4, 10, QChar('0'));
QString filename = m_d->filenamePrefix + frameNumber + m_d->filenameSuffix;
QRect rc = m_d->image->bounds();
KisPainter::copyAreaOptimized(rc.topLeft(), frame, m_d->tmpDevice, rc);
if (!m_d->tmpDoc->exportDocument(QUrl::fromLocalFile(filename), exportConfiguration)) {
- status = KisImportExportFilter::InternalError;
+ status = KisImportExportFilter::CreationError;
}
return status;
}
QString KisAnimationExportSaver::savedFilesMask() const
{
return m_d->filenamePrefix + "%04d" + m_d->filenameSuffix;
}
+
+QString KisAnimationExportSaver::savedFilesMaskWildcard() const
+{
+ return m_d->filenamePrefix + "????" + m_d->filenameSuffix;
+}
diff --git a/libs/ui/kis_animation_exporter.h b/libs/ui/kis_animation_exporter.h
index fd7ef69993..f7f429c01a 100644
--- a/libs/ui/kis_animation_exporter.h
+++ b/libs/ui/kis_animation_exporter.h
@@ -1,103 +1,112 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ANIMATION_EXPORTER_H
#define KIS_ANIMATION_EXPORTER_H
#include "kis_types.h"
#include "kritaui_export.h"
#include <KisImportExportFilter.h>
#include <functional>
class KisDocument;
/**
* @brief The KisAnimationExporterUI class
*/
class KRITAUI_EXPORT KisAnimationExporterUI : public QObject
{
Q_OBJECT
public:
KisAnimationExporterUI(QWidget *parent);
- virtual ~KisAnimationExporterUI();
+ ~KisAnimationExporterUI() override;
private:
struct Private;
QScopedPointer<Private> m_d;
};
/**
* @brief The KisAnimationExporter class
*/
class KRITAUI_EXPORT KisAnimationExporter : public QObject
{
Q_OBJECT
public:
typedef std::function<KisImportExportFilter::ConversionStatus (int , KisPaintDeviceSP, KisPropertiesConfigurationSP)> SaveFrameCallback;
public:
KisAnimationExporter(KisDocument *document, int fromTime, int toTime);
- ~KisAnimationExporter();
+ ~KisAnimationExporter() override;
void setExportConfiguration(KisPropertiesConfigurationSP exportConfiguration);
KisImportExportFilter::ConversionStatus exportAnimation();
void setSaveFrameCallback(SaveFrameCallback func);
Q_SIGNALS:
// Internal, used for getting back to main thread
void sigFrameReadyToSave();
void sigFinished();
private Q_SLOTS:
void frameReadyToCopy(int time);
void frameReadyToSave();
void cancel();
private:
struct Private;
QScopedPointer<Private> m_d;
};
/**
* @brief The KisAnimationExportSaver class
*/
class KRITAUI_EXPORT KisAnimationExportSaver : public QObject
{
Q_OBJECT
public:
KisAnimationExportSaver(KisDocument *document, const QString &baseFilename, int fromTime, int toTime, int sequenceNumberingOffset = 0);
- ~KisAnimationExportSaver();
+ ~KisAnimationExportSaver() override;
KisImportExportFilter::ConversionStatus exportAnimation(KisPropertiesConfigurationSP cfg = 0);
+ /**
+ * A standard exported files mask for ffmpeg
+ */
QString savedFilesMask() const;
+ /**
+ * Wildcards are not supported ffmpeg on Windows, so they are used for QDir
+ * only.
+ */
+ QString savedFilesMaskWildcard() const;
+
private:
KisImportExportFilter::ConversionStatus saveFrameCallback(int time, KisPaintDeviceSP frame, KisPropertiesConfigurationSP exportConfiguration = 0);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/ui/kis_animation_frame_cache.h b/libs/ui/kis_animation_frame_cache.h
index c1a54de8df..8cdfb5727b 100644
--- a/libs/ui/kis_animation_frame_cache.h
+++ b/libs/ui/kis_animation_frame_cache.h
@@ -1,78 +1,78 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ANIMATION_FRAME_CACHE_H
#define KIS_ANIMATION_FRAME_CACHE_H
#include <QImage>
#include <QObject>
#include "kritaui_export.h"
#include "kis_types.h"
#include "kis_shared.h"
class KisImage;
class KisImageAnimationInterface;
class KisTimeRange;
class KisOpenGLImageTextures;
typedef KisSharedPtr<KisOpenGLImageTextures> KisOpenGLImageTexturesSP;
class KisOpenGLUpdateInfo;
typedef KisSharedPtr<KisOpenGLUpdateInfo> KisOpenGLUpdateInfoSP;
class KRITAUI_EXPORT KisAnimationFrameCache : public QObject, public KisShared
{
Q_OBJECT
public:
static KisAnimationFrameCacheSP getFrameCache(KisOpenGLImageTexturesSP textures);
static const QList<KisAnimationFrameCache*> caches();
KisAnimationFrameCache(KisOpenGLImageTexturesSP textures);
- ~KisAnimationFrameCache();
+ ~KisAnimationFrameCache() override;
QImage getFrame(int time);
bool uploadFrame(int time);
enum CacheStatus {
Cached,
Uncached,
};
CacheStatus frameStatus(int time) const;
KisImageWSP image();
KisOpenGLUpdateInfoSP fetchFrameData(int time) const;
void addConvertedFrameData(KisOpenGLUpdateInfoSP info, int time);
Q_SIGNALS:
void changed();
private:
struct Private;
QScopedPointer<Private> m_d;
private Q_SLOTS:
void framesChanged(const KisTimeRange &range, const QRect &rect);
};
#endif
diff --git a/libs/ui/kis_animation_importer.h b/libs/ui/kis_animation_importer.h
index 42d9807118..b5d2761371 100644
--- a/libs/ui/kis_animation_importer.h
+++ b/libs/ui/kis_animation_importer.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ANIMATION_IMPORTER_H
#define KIS_ANIMATION_IMPORTER_H
#include "kis_types.h"
#include "kritaui_export.h"
#include <KisImportExportFilter.h>
class KisDocument;
class KisMainWindow;
class KRITAUI_EXPORT KisAnimationImporter : public QObject
{
Q_OBJECT
public:
KisAnimationImporter(KisImageSP image);
KisAnimationImporter(KisDocument* document);
- ~KisAnimationImporter();
+ ~KisAnimationImporter() override;
KisImportExportFilter::ConversionStatus import(QStringList files, int firstFrame, int step);
private Q_SLOTS:
void cancel();
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/libs/ui/kis_aspect_ratio_locker.h b/libs/ui/kis_aspect_ratio_locker.h
index d8793cfff9..c1cb9b642f 100644
--- a/libs/ui/kis_aspect_ratio_locker.h
+++ b/libs/ui/kis_aspect_ratio_locker.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ASPECT_RATIO_LOCKER_H
#define __KIS_ASPECT_RATIO_LOCKER_H
#include <QScopedPointer>
#include <QObject>
#include "kritaui_export.h"
class QSpinBox;
class QDoubleSpinBox;
class KisSliderSpinBox;
class KisDoubleSliderSpinBox;
class KoAspectButton;
class KRITAUI_EXPORT KisAspectRatioLocker : public QObject
{
Q_OBJECT
public:
KisAspectRatioLocker(QObject *parent = 0);
- ~KisAspectRatioLocker();
+ ~KisAspectRatioLocker() override;
template <class SpinBoxType>
void connectSpinBoxes(SpinBoxType *spinOne, SpinBoxType *spinTwo, KoAspectButton *aspectButton);
void setBlockUpdateSignalOnDrag(bool block);
void updateAspect();
private Q_SLOTS:
void slotSpinOneChanged();
void slotSpinTwoChanged();
void slotAspectButtonChanged();
Q_SIGNALS:
void sliderValueChanged();
void aspectButtonChanged();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_ASPECT_RATIO_LOCKER_H */
diff --git a/libs/ui/kis_bookmarked_configurations_editor.h b/libs/ui/kis_bookmarked_configurations_editor.h
index 4e6686fa37..a0b8d85a6f 100644
--- a/libs/ui/kis_bookmarked_configurations_editor.h
+++ b/libs/ui/kis_bookmarked_configurations_editor.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BOOKMARKED_CONFIGURATIONS_EDITOR_H_
#define _KIS_BOOKMARKED_CONFIGURATIONS_EDITOR_H_
#include <QDialog>
#include <kritaui_export.h>
#include <kis_serializable_configuration.h>
class KisBookmarkedConfigurationsModel;
class QItemSelection;
/**
* This dialog is used to edit the content of a bookmark manager
*/
class KRITAUI_EXPORT KisBookmarkedConfigurationsEditor : public QDialog
{
Q_OBJECT
public:
/**
* @param parent
* @param manager the model representing the bookmark manager
* @param currentConfig is used if the user choose to create a new configuration
* entry or to replace an existing entry
*/
KisBookmarkedConfigurationsEditor(QWidget* parent, KisBookmarkedConfigurationsModel* manager, const KisSerializableConfigurationSP currentConfig);
- ~KisBookmarkedConfigurationsEditor();
+ ~KisBookmarkedConfigurationsEditor() override;
private Q_SLOTS:
void currentConfigChanged(const QItemSelection& selected, const QItemSelection&);
void addCurrentConfiguration();
void deleteConfiguration();
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/kis_bookmarked_configurations_model.h b/libs/ui/kis_bookmarked_configurations_model.h
index 11f00bde8d..4eefd80797 100644
--- a/libs/ui/kis_bookmarked_configurations_model.h
+++ b/libs/ui/kis_bookmarked_configurations_model.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BOOKMARKED_CONFIGURATIONS_MODEL_H_
#define _KIS_BOOKMARKED_CONFIGURATIONS_MODEL_H_
#include <QAbstractListModel>
#include <kritaui_export.h>
class KLocalizedString;
class KisBookmarkedConfigurationManager;
#include <kis_serializable_configuration.h>
/**
* This class provides the basic functionality for a model of a bookmark
* of configurations.
*/
class KRITAUI_EXPORT KisBookmarkedConfigurationsModel : public QAbstractListModel
{
public:
/**
* Initialized thee model with the bookmarks manager
*/
KisBookmarkedConfigurationsModel(KisBookmarkedConfigurationManager*);
- ~KisBookmarkedConfigurationsModel();
+ ~KisBookmarkedConfigurationsModel() override;
/**
* @return the bookmarked configuration manager associated with this model.
*/
KisBookmarkedConfigurationManager* bookmarkedConfigurationManager();
/**
* @return the number of configurations (the minimum is always 2, the default
* configuration and the last used configuration are always present)
*/
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
/**
* When role == Qt::DisplayRole, this function will return the name of the
* configuration.
*/
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override;
/**
* @return the configuration at the given index
*/
KisSerializableConfigurationSP configuration(const QModelIndex &index) const;
/**
* @return the index corresponding to the @p name .
*/
QModelIndex indexFor(const QString& name) const;
/**
* @return true if the configuration at the given index can be removed
*/
virtual bool isIndexDeletable(const QModelIndex &index) const;
/**
* @return the flags associated to the index
*/
- Qt::ItemFlags flags(const QModelIndex & index) const;
+ Qt::ItemFlags flags(const QModelIndex & index) const override;
/**
* Insert a new configuration.
*/
virtual void newConfiguration(KLocalizedString baseName, const KisSerializableConfigurationSP config);
/**
* Save a configuration to the bookmark manager.
*/
virtual void saveConfiguration(const QString & name, const KisSerializableConfigurationSP config);
/**
* Delete the configuration at the given index. (if possible)
*/
virtual void deleteIndex(const QModelIndex &index);
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/kis_bookmarked_filter_configurations_model.h b/libs/ui/kis_bookmarked_filter_configurations_model.h
index d969809bb5..459ae11639 100644
--- a/libs/ui/kis_bookmarked_filter_configurations_model.h
+++ b/libs/ui/kis_bookmarked_filter_configurations_model.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BOOKMARKED_FILTER_CONFIGURATIONS_MODEL_H_
#define _KIS_BOOKMARKED_FILTER_CONFIGURATIONS_MODEL_H_
#include "kis_bookmarked_configurations_model.h"
#include "kis_types.h"
#include <kis_serializable_configuration.h>
/**
* Use this model to get the list of configuration for a Filter.
*/
class KisBookmarkedFilterConfigurationsModel : public KisBookmarkedConfigurationsModel
{
Q_OBJECT
public:
/**
* @param thumb a 100x100 thumbnail used to preview the filters
* @param filter the filter
*/
KisBookmarkedFilterConfigurationsModel(KisPaintDeviceSP thumb, KisFilterSP filter);
- ~KisBookmarkedFilterConfigurationsModel();
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ ~KisBookmarkedFilterConfigurationsModel() override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/**
* @return the filter configuration
*/
KisFilterConfigurationSP configuration(const QModelIndex &index) const;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/kis_canvas_controls_manager.h b/libs/ui/kis_canvas_controls_manager.h
index 26e069b4c6..b5a7c1e984 100644
--- a/libs/ui/kis_canvas_controls_manager.h
+++ b/libs/ui/kis_canvas_controls_manager.h
@@ -1,69 +1,69 @@
/*
* Copyright (c) 2003-2009 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CANVAS_CONTROLS_MANAGER_H
#define KIS_CANVAS_CONTROLS_MANAGER_H
#include <QObject>
#include <QPointer>
#include <kritaui_export.h>
class KisViewManager;
class KisActionManager;
class KisView;
class KRITAUI_EXPORT KisCanvasControlsManager: public QObject
{
Q_OBJECT
public:
KisCanvasControlsManager(KisViewManager * view);
- virtual ~KisCanvasControlsManager();
+ ~KisCanvasControlsManager() override;
void setup(KisActionManager *actionManager);
void setView(QPointer<KisView>imageView);
private Q_SLOTS:
void makeColorLighter();
void makeColorDarker();
void makeColorDesaturated();
void makeColorSaturated();
void shiftHueClockWise();
void shiftHueCounterClockWise();
void makeColorRed();
void makeColorGreen();
void makeColorBlue();
void makeColorYellow();
void increaseOpacity();
void decreaseOpacity();
private:
void transformColor(int step);
void transformSaturation(int step);
void transformHue(int step);
void transformRed(int step);
void transformBlue(int step);
void stepAlpha(float step);
private:
KisViewManager * m_view;
};
#endif // KIS_CANVAS_CONTROLS_MANAGER_H
diff --git a/libs/ui/kis_canvas_resource_provider.h b/libs/ui/kis_canvas_resource_provider.h
index c99b65f2cd..6f394a5656 100644
--- a/libs/ui/kis_canvas_resource_provider.h
+++ b/libs/ui/kis_canvas_resource_provider.h
@@ -1,243 +1,243 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CANVAS_RESOURCE_PROVIDER_H_
#define KIS_CANVAS_RESOURCE_PROVIDER_H_
#include <QObject>
#include <KoColor.h>
#include <KoID.h>
#include <KoCanvasResourceManager.h>
#include "kis_types.h"
#include "kritaui_export.h"
class KisWorkspaceResource;
class KoColorProfile;
class KoAbstractGradient;
class KoResource;
class KoCanvasBase;
class KisViewManager;
class KoPattern;
class KisFilterConfiguration;
#include <kis_abstract_perspective_grid.h>
/**
* KisCanvasResourceProvider contains the per-window current settings that
* influence painting, like paintop, color, gradients and so on.
*/
class KRITAUI_EXPORT KisCanvasResourceProvider : public QObject
{
Q_OBJECT
public:
enum Resources {
HdrExposure = KoCanvasResourceManager::KritaStart + 1,
CurrentPattern,
CurrentGradient,
CurrentDisplayProfile,
CurrentKritaNode,
CurrentPaintOpPreset,
CurrentGeneratorConfiguration,
CurrentCompositeOp,
CurrentEffectiveCompositeOp,
LodAvailability, ///<-user choice
EraserMode,
MirrorHorizontal,
MirrorVertical,
MirrorHorizontalLock,
MirrorVerticalLock,
MirrorVerticalHideDecorations,
MirrorHorizontalHideDecorations,
Opacity,
Flow,
Size,
HdrGamma,
GlobalAlphaLock,
DisablePressure,
PreviousPaintOpPreset,
EffectiveZoom, ///<-Used only by painting tools for non-displaying purposes
PresetAllowsLod, ///<-combination of the user choice and thechnical abilities of the preset
SelectionAction,
SelectionMode
};
KisCanvasResourceProvider(KisViewManager * view);
- ~KisCanvasResourceProvider();
+ ~KisCanvasResourceProvider() override;
void setResourceManager(KoCanvasResourceManager *resourceManager);
KoCanvasResourceManager* resourceManager();
KoCanvasBase * canvas() const;
KoColor bgColor() const;
void setBGColor(const KoColor& c);
KoColor fgColor() const;
void setFGColor(const KoColor& c);
float HDRExposure() const;
void setHDRExposure(float exposure);
float HDRGamma() const;
void setHDRGamma(float gamma);
bool eraserMode() const;
void setEraserMode(bool value);
KoPattern *currentPattern() const;
KoAbstractGradient *currentGradient() const;
KisImageWSP currentImage() const;
KisNodeSP currentNode() const;
KisPaintOpPresetSP currentPreset() const;
void setPaintOpPreset(const KisPaintOpPresetSP preset);
KisPaintOpPresetSP previousPreset() const;
void setPreviousPaintOpPreset(const KisPaintOpPresetSP preset);
void setCurrentCompositeOp(const QString& compositeOp);
QString currentCompositeOp() const;
QList<QPointer<KisAbstractPerspectiveGrid> > perspectiveGrids() const;
void addPerspectiveGrid(KisAbstractPerspectiveGrid*);
void removePerspectiveGrid(KisAbstractPerspectiveGrid*);
void clearPerspectiveGrids();
void setMirrorHorizontal(bool mirrorHorizontal);
bool mirrorHorizontal() const;
void setMirrorVertical(bool mirrorVertical);
bool mirrorVertical() const;
// options for horizontal and vertical mirror toolbar
void setMirrorHorizontalLock(bool isLocked);
bool mirrorHorizontalLock();
void setMirrorVerticalLock(bool isLocked);
bool mirrorVerticalLock();
void setMirrorVerticalHideDecorations(bool hide);
bool mirrorVerticalHideDecorations();
void setMirrorHorizontalHideDecorations(bool hide);
bool mirrorHorizontalHideDecorations();
void mirrorVerticalMoveCanvasToCenter();
void mirrorHorizontalMoveCanvasToCenter();
void setOpacity(qreal opacity);
qreal opacity() const;
void setFlow(qreal opacity);
qreal flow() const;
void setSize(qreal size);
qreal size() const;
void setGlobalAlphaLock(bool lock);
bool globalAlphaLock() const;
void setDisablePressure(bool value);
bool disablePressure() const;
///Notify that the workspace is saved and settings should be saved to it
void notifySavingWorkspace(KisWorkspaceResource* workspace);
///Notify that the workspace is loaded and settings can be read
void notifyLoadingWorkspace(KisWorkspaceResource* workspace);
int selectionAction();
void setSelectionAction(int action);
int selectionMode();
void setSelectionMode(int mode);
public Q_SLOTS:
void slotSetFGColor(const KoColor& c);
void slotSetBGColor(const KoColor& c);
void slotPatternActivated(KoResource *pattern);
void slotGradientActivated(KoResource *gradient);
void slotNodeActivated(const KisNodeSP node);
void slotPainting();
/**
* Set the image size in pixels. The resource provider will store
* the image size in postscript points.
*/
// FIXME: this slot doesn't catch the case when image resolution is changed
void slotImageSizeChanged();
void slotOnScreenResolutionChanged();
// This is a flag to handle a bug:
// If pop up palette is visible and a new colour is selected, the new colour
// will be added when the user clicks on the canvas to hide the palette
// In general, we want to be able to store recent color if the pop up palette
// is not visible
void slotResetEnableFGChange(bool);
private Q_SLOTS:
void slotCanvasResourceChanged(int key, const QVariant & res);
Q_SIGNALS:
void sigFGColorChanged(const KoColor &);
void sigBGColorChanged(const KoColor &);
void sigGradientChanged(KoAbstractGradient *);
void sigPatternChanged(KoPattern *);
void sigNodeChanged(const KisNodeSP);
void sigDisplayProfileChanged(const KoColorProfile *);
void sigFGColorUsed(const KoColor&);
void sigOnScreenResolutionChanged(qreal scaleX, qreal scaleY);
void sigOpacityChanged(qreal);
void sigSavingWorkspace(KisWorkspaceResource* workspace);
void sigLoadingWorkspace(KisWorkspaceResource* workspace);
void sigSelectionActionChanged(const int);
void sigSelectionModeChanged(const int);
void mirrorModeChanged();
void moveMirrorVerticalCenter();
void moveMirrorHorizontalCenter();
private:
KisViewManager * m_view;
KoCanvasResourceManager *m_resourceManager;
bool m_fGChanged;
QList<QPointer<KisAbstractPerspectiveGrid> > m_perspectiveGrids;
// This is a flag to handle a bug:
// If pop up palette is visible and a new colour is selected, the new colour
// will be added when the user clicks on the canvas to hide the palette
// In general, we want to be able to store recent color if the pop up palette
// is not visible
bool m_enablefGChange;
};
#endif
diff --git a/libs/ui/kis_categories_mapper.h b/libs/ui/kis_categories_mapper.h
index 223ec6e70b..fa0c8a36bc 100644
--- a/libs/ui/kis_categories_mapper.h
+++ b/libs/ui/kis_categories_mapper.h
@@ -1,341 +1,341 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CATEGORIES_MAPPER_H
#define __KIS_CATEGORIES_MAPPER_H
#include <QObject>
#include <QScopedPointer>
#include <kritaui_export.h>
/**
* Templated classes cannot inherit QObject, so the signal handling is
* moved to a separate class
*/
class KRITAUI_EXPORT __CategoriesSignalsBase : public QObject
{
Q_OBJECT
Q_SIGNALS:
void rowChanged(int row);
void beginInsertRow(int row);
void endInsertRow();
void beginRemoveRow(int row);
void endRemoveRow();
};
template<class TEntry, class TEntryToQStringConverter>
class KisCategoriesMapper : public __CategoriesSignalsBase
{
public:
class DataItem
{
public:
DataItem(const QString &categoryName, KisCategoriesMapper *parent)
: m_name(categoryName),
m_category(0),
m_expanded(false),
m_enabled(true),
m_checkable(false),
m_checked(false),
m_locked(false),
m_lockable(false),
m_toggled(false),
m_parent(parent)
{
}
DataItem(const TEntry &entry, DataItem *category, KisCategoriesMapper *parent)
: m_data(new TEntry(entry)),
m_category(category),
m_expanded(false),
m_enabled(true),
m_checkable(false),
m_checked(false),
m_locked(false),
m_lockable(false),
m_toggled(false),
m_parent(parent)
{
Q_ASSERT(category);
TEntryToQStringConverter converter;
m_name = converter(entry);
}
TEntry* data() const {
return m_data.data();
}
QString name() const {
return m_name;
}
bool isCategory() const {
Q_ASSERT(static_cast<bool>(m_category) == static_cast<bool>(m_data));
return !m_category;
}
DataItem* parentCategory() const {
return m_category;
}
bool isExpanded() const {
return m_expanded;
}
void setExpanded(bool value) {
Q_ASSERT(isCategory());
if (m_expanded == value) return;
m_expanded = value;
m_parent->notifyCategoryExpanded(this);
}
bool isEnabled() const {
return m_enabled;
}
void setEnabled(bool value) {
if (m_enabled == value) return;
m_enabled = value;
notifyItemChanged();
}
bool isCheckable() const {
return m_checkable;
}
void setCheckable(bool value) {
if (m_checkable == value) return;
m_checkable = value;
notifyItemChanged();
}
bool isChecked() const {
return m_checked;
}
void setChecked(bool value) {
if (m_checked == value) return;
setToggled(value != m_checked);
m_checked = value;
notifyItemChanged();
}
bool isLocked() const {
return m_locked;
}
void setLocked(bool value){
m_locked = value;
}
bool isLockable() const {
return m_lockable;
}
void setLockable(bool value){
m_lockable = value;
}
bool isToggled() const {
return m_toggled;
}
void setToggled(bool value){
m_toggled = value;
}
private:
void notifyItemChanged() {
m_parent->notifyItemChanged(this);
}
private:
QString m_name;
QScopedPointer<TEntry> m_data;
DataItem *m_category;
bool m_expanded;
bool m_enabled;
bool m_checkable;
bool m_checked;
bool m_locked;
bool m_lockable;
bool m_toggled;
KisCategoriesMapper *m_parent;
};
public:
KisCategoriesMapper() {}
- virtual ~KisCategoriesMapper() {
+ ~KisCategoriesMapper() override {
qDeleteAll(m_items);
}
DataItem* addCategory(const QString &category) {
if (fetchCategory(category)) return 0;
DataItem *item = new DataItem(category, this);
emit beginInsertRow(m_items.size());
m_items.append(item);
emit endInsertRow();
return item;
}
void removeCategory(const QString &category) {
QMutableListIterator<DataItem*> it(m_items);
DataItem *categoryItem = 0;
int row = 0;
while(it.hasNext()) {
DataItem *item = it.next();
if (!item->isCategory() &&
item->parentCategory()->name() == category) {
emit beginRemoveRow(row);
it.remove();
delete item;
emit endRemoveRow();
} else {
if (item->isCategory() && item->name() == category) {
Q_ASSERT(!categoryItem);
categoryItem = item;
}
row++;
}
}
if (categoryItem) {
int row = m_items.indexOf(categoryItem);
emit beginRemoveRow(row);
delete m_items.takeAt(row);
emit endRemoveRow();
}
}
DataItem* addEntry(const QString &category, const TEntry &entry) {
DataItem *categoryItem = fetchCategory(category);
if (!categoryItem) {
categoryItem = addCategory(category);
}
DataItem *item = new DataItem(entry, categoryItem, this);
emit beginInsertRow(m_items.size());
m_items.append(item);
emit endInsertRow();
return item;
}
void removeEntry(const QString &category, const TEntry &entry) {
DataItem *item = fetchEntry(category, entry);
if (!item) return;
int row = m_items.indexOf(item);
emit beginRemoveRow(row);
delete m_items.takeAt(row);
emit endRemoveRow();
}
DataItem* fetchCategory(const QString &category) const {
Q_FOREACH (DataItem *item, m_items) {
if (item->isCategory() && item->name() == category) return item;
}
return 0;
}
DataItem* fetchEntry(const QString &category, const TEntry &entry) const {
Q_FOREACH (DataItem *item, m_items) {
if (!item->isCategory() &&
*item->data() == entry &&
item->parentCategory()->name() == category) return item;
}
return 0;
}
DataItem* fetchOneEntry(const TEntry &entry) const {
Q_FOREACH (DataItem *item, m_items) {
if (!item->isCategory() &&
*item->data() == entry) return item;
}
return 0;
}
QVector<DataItem*> itemsForCategory(const QString &category) const {
QVector<DataItem*> filteredItems;
Q_FOREACH (DataItem *item, m_items) {
if (!item->isCategory() &&
item->parentCategory()->name() == category) {
filteredItems.append(item);
}
}
return filteredItems;
}
void expandAllCategories() {
Q_FOREACH (DataItem *item, m_items) {
if (item->isCategory()) {
item->setExpanded(true);
}
}
}
DataItem* itemFromRow(int row) const {
return m_items[row];
}
int rowFromItem(DataItem *item) const {
return m_items.indexOf(item);
}
int rowCount() const {
return m_items.size();
}
private:
void notifyItemChanged(DataItem *item) {
emit rowChanged(m_items.indexOf(item));
}
void notifyCategoryExpanded(DataItem *categoryItem) {
Q_ASSERT(categoryItem->isCategory());
notifyItemChanged(categoryItem);
Q_FOREACH (DataItem *item, m_items) {
if (!item->isCategory() &&
item->parentCategory() == categoryItem) {
notifyItemChanged(item);
}
}
}
protected:
QList<DataItem*>& testingGetItems() {
return m_items;
}
private:
QList<DataItem*> m_items;
};
#endif /* __KIS_CATEGORIES_MAPPER_H */
diff --git a/libs/ui/kis_categorized_item_delegate.h b/libs/ui/kis_categorized_item_delegate.h
index 4971138045..13acfcd4d4 100644
--- a/libs/ui/kis_categorized_item_delegate.h
+++ b/libs/ui/kis_categorized_item_delegate.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CATEGORIZED_ITEM_DELEGATE_H_
#define _KIS_CATEGORIZED_ITEM_DELEGATE_H_
#include <kritaui_export.h>
#include <QIcon>
#include <QStyledItemDelegate>
/**
* This delegate draw categories using information from a \ref KCategorizedSortFilterProxyModel .
*/
class KRITAUI_EXPORT KisCategorizedItemDelegate: public QStyledItemDelegate
{
public:
KisCategorizedItemDelegate(QObject *parent);
- virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
+ void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
+ QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
private:
void paintTriangle(QPainter* painter, qint32 x, qint32 y, qint32 size, bool rotate) const;
mutable qint32 m_minimumItemHeight;
};
#endif // _KIS_CATEGORIZED_ITEM_DELEGATE_H_
diff --git a/libs/ui/kis_categorized_list_model.h b/libs/ui/kis_categorized_list_model.h
index fc911c333c..9213ca6225 100644
--- a/libs/ui/kis_categorized_list_model.h
+++ b/libs/ui/kis_categorized_list_model.h
@@ -1,249 +1,249 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CATEGORIZED_LIST_MODEL_H
#define __KIS_CATEGORIZED_LIST_MODEL_H
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
#include "kis_categories_mapper.h"
class KRITAUI_EXPORT __CategorizedListModelBase : public QAbstractListModel
{
Q_OBJECT
public:
enum AdditionalRoles {
IsHeaderRole = Qt::UserRole + 1,
ExpandCategoryRole = Qt::UserRole + 2,
SortRole = Qt::UserRole + 3,
isLockedRole = Qt::UserRole + 4,
isLockableRole = Qt::UserRole + 5,
isToggledRole = Qt::UserRole + 6
};
public:
__CategorizedListModelBase(QObject *parent);
- virtual ~__CategorizedListModelBase();
+ ~__CategorizedListModelBase() override;
private Q_SLOTS:
void slotRowChanged(int row) {
QModelIndex changedIndex(index(row));
emit dataChanged(changedIndex, changedIndex);
}
void slotBeginInsertRow(int row) {
beginInsertRows(QModelIndex(), row, row);
}
void slotEndInsertRow() {
endInsertRows();
}
void slotBeginRemoveRow(int row) {
beginRemoveRows(QModelIndex(), row, row);
}
void slotEndRemoveRow() {
endRemoveRows();
}
};
template<class TEntry, class TEntryToQStringConverter>
class KisCategorizedListModel : public __CategorizedListModelBase
{
public:
typedef TEntry Entry_Type;
typedef KisCategoriesMapper<TEntry, TEntryToQStringConverter> SpecificCategoriesMapper;
typedef typename SpecificCategoriesMapper::DataItem DataItem;
public:
KisCategorizedListModel(QObject *parent = 0)
: __CategorizedListModelBase(parent)
{
connect(&m_mapper, SIGNAL(rowChanged(int)), SLOT(slotRowChanged(int)));
connect(&m_mapper, SIGNAL(beginInsertRow(int)), SLOT(slotBeginInsertRow(int)));
connect(&m_mapper, SIGNAL(endInsertRow()), SLOT(slotEndInsertRow()));
connect(&m_mapper, SIGNAL(beginRemoveRow(int)), SLOT(slotBeginRemoveRow(int)));
connect(&m_mapper, SIGNAL(endRemoveRow()), SLOT(slotEndRemoveRow()));
}
- int rowCount(const QModelIndex& parent) const {
+ int rowCount(const QModelIndex& parent) const override {
Q_UNUSED(parent);
return m_mapper.rowCount();
}
- QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const {
+ QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const override {
if (!idx.isValid()) return QVariant();
typename SpecificCategoriesMapper::DataItem *item =
m_mapper.itemFromRow(idx.row());
Q_ASSERT(item);
switch (role) {
case IsHeaderRole:
return item->isCategory();
case ExpandCategoryRole:
return item->isCategory() ? item->isExpanded() : item->parentCategory()->isExpanded();
case Qt::ToolTipRole:
case Qt::DisplayRole:
return item->name();
case Qt::CheckStateRole:
return item->isCheckable() ? item->isChecked() ? Qt::Checked : Qt::Unchecked : QVariant();
case SortRole:
return item->isCategory() ? item->name() : item->parentCategory()->name() + item->name();
case isLockedRole:
return item->isLocked();
case isLockableRole:
return item->isLockable();
case isToggledRole:
return item->isToggled();
}
return QVariant();
}
- bool setData(const QModelIndex& idx, const QVariant& value, int role = Qt::EditRole) {
+ bool setData(const QModelIndex& idx, const QVariant& value, int role = Qt::EditRole) override {
if (!idx.isValid()) return false;
typename SpecificCategoriesMapper::DataItem *item =
m_mapper.itemFromRow(idx.row());
Q_ASSERT(item);
switch (role) {
case ExpandCategoryRole:
Q_ASSERT(item->isCategory());
item->setExpanded(value.toBool());
break;
case Qt::CheckStateRole:
Q_ASSERT(item->isCheckable());
item->setChecked(value.toInt() == Qt::Checked);
break;
}
return true;
}
- Qt::ItemFlags flags(const QModelIndex& idx) const {
+ Qt::ItemFlags flags(const QModelIndex& idx) const override {
if (!idx.isValid()) return Qt::NoItemFlags;
typename SpecificCategoriesMapper::DataItem *item =
m_mapper.itemFromRow(idx.row());
Q_ASSERT(item);
Qt::ItemFlags flags = Qt::NoItemFlags;
if (item->isEnabled()) {
flags |= Qt::ItemIsEnabled;
}
if (!item->isCategory()) {
flags |= Qt::ItemIsSelectable;
if (item->isCheckable()) {
flags |= Qt::ItemIsUserCheckable;
}
}
return flags;
}
QModelIndex indexOf(const TEntry& entry) const {
typename SpecificCategoriesMapper::DataItem *item =
m_mapper.fetchOneEntry(entry);
return index(m_mapper.rowFromItem(item));
}
bool entryAt(TEntry& entry, QModelIndex index) const {
int row = index.row();
if (row < 0 || row >= m_mapper.rowCount()) return false;
typename SpecificCategoriesMapper::DataItem *item =
m_mapper.itemFromRow(row);
if (!item->isCategory()) {
entry = *item->data();
return true;
}
return false;
}
SpecificCategoriesMapper* categoriesMapper() {
return &m_mapper;
}
const SpecificCategoriesMapper* categoriesMapper() const {
return &m_mapper;
}
private:
SpecificCategoriesMapper m_mapper;
};
template<class TModel>
class KRITAUI_EXPORT KisSortedCategorizedListModel : public QSortFilterProxyModel
{
typedef typename TModel::Entry_Type Entry_Type;
public:
KisSortedCategorizedListModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
}
QModelIndex indexOf(const Entry_Type& entry) const {
QModelIndex srcIndex = m_model->indexOf(entry);
return mapFromSource(srcIndex);
}
bool entryAt(Entry_Type &entry, QModelIndex index) const {
QModelIndex srcIndex = mapToSource(index);
return m_model->entryAt(entry, srcIndex);
}
protected:
void initializeModel(TModel *model) {
m_model = model;
setSourceModel(model);
setSortRole(TModel::SortRole);
}
bool lessThanPriority(const QModelIndex &left,
const QModelIndex &right,
const QString &priorityCategory) const {
QString leftKey = sourceModel()->data(left, sortRole()).toString();
QString rightKey = sourceModel()->data(right, sortRole()).toString();
bool leftIsSpecial = leftKey.startsWith(priorityCategory);
bool rightIsSpecial = rightKey.startsWith(priorityCategory);
return leftIsSpecial != rightIsSpecial ?
leftIsSpecial : leftKey < rightKey;
}
private:
TModel *m_model;
};
#endif /* __KIS_CATEGORIZED_LIST_MODEL_H */
diff --git a/libs/ui/kis_clipboard.h b/libs/ui/kis_clipboard.h
index 66a9f4d067..81bd038130 100644
--- a/libs/ui/kis_clipboard.h
+++ b/libs/ui/kis_clipboard.h
@@ -1,98 +1,98 @@
/*
* kis_clipboard.h - part of Krayon
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CLIPBOARD_H_
#define __KIS_CLIPBOARD_H_
#include <QObject>
#include <QSize>
#include "kis_types.h"
#include <kritaui_export.h>
class QRect;
class QMimeData;
class KisBlockUntilOperationsFinishedMediator;
enum enumPasteBehaviour {
PASTE_ASSUME_WEB,
PASTE_ASSUME_MONITOR,
PASTE_ASK
};
/**
* The Krita clipboard is a clipboard that can store paint devices
* instead of just qimage's.
*/
class KRITAUI_EXPORT KisClipboard : public QObject
{
Q_OBJECT
Q_PROPERTY(bool clip READ hasClip NOTIFY clipChanged)
public:
KisClipboard();
- virtual ~KisClipboard();
+ ~KisClipboard() override;
static KisClipboard* instance();
/**
* Sets the clipboard to the contents of the specified paint device; also
* set the system clipboard to a QImage representation of the specified
* paint device.
*
* @param dev The paint device that will be stored on the clipboard
* @param topLeft a hint about the place where the clip should be pasted by default
*/
void setClip(KisPaintDeviceSP dev, const QPoint& topLeft);
/**
* Get the contents of the clipboard in the form of a paint device.
*/
KisPaintDeviceSP clip(const QRect &imageBounds, bool showPopup);
bool hasClip() const;
QSize clipSize() const;
void setLayers(KisNodeList nodes, KisImageSP image, bool forceCopy = false);
bool hasLayers() const;
const QMimeData* layersMimeData() const;
Q_SIGNALS:
void clipCreated();
private Q_SLOTS:
void clipboardDataChanged();
private:
KisClipboard(const KisClipboard &);
KisClipboard operator=(const KisClipboard &);
bool m_hasClip;
bool m_pushedClipboard;
Q_SIGNALS:
void clipChanged();
};
#endif // __KIS_CLIPBOARD_H_
diff --git a/libs/ui/kis_composite_ops_model.h b/libs/ui/kis_composite_ops_model.h
index ee2bacb867..6b4c092c58 100644
--- a/libs/ui/kis_composite_ops_model.h
+++ b/libs/ui/kis_composite_ops_model.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COMPOSITE_OPS_MODEL_H_
#define _KIS_COMPOSITE_OPS_MODEL_H_
#include <KoID.h>
#include "kis_categorized_list_model.h"
class KoColorSpace;
struct KoIDToQStringConverter {
QString operator() (const KoID &id) {
return id.name();
}
};
typedef KisCategorizedListModel<KoID,KoIDToQStringConverter> BaseKoIDCategorizedListModel;
class KRITAUI_EXPORT KisCompositeOpListModel: public BaseKoIDCategorizedListModel
{
public:
static KisCompositeOpListModel* sharedInstance();
virtual QString categoryToString(const KoID& val) const { return val.name(); }
virtual QString entryToString (const KoID& val) const { return val.name(); }
- virtual bool setData (const QModelIndex& idx, const QVariant& value, int role=Qt::EditRole);
- virtual QVariant data (const QModelIndex& idx, int role=Qt::DisplayRole) const;
+ bool setData (const QModelIndex& idx, const QVariant& value, int role=Qt::EditRole) override;
+ QVariant data (const QModelIndex& idx, int role=Qt::DisplayRole) const override;
void validate(const KoColorSpace *cs);
void readFavoriteCompositeOpsFromConfig();
void writeFavoriteCompositeOpsToConfig() const;
static KoID favoriteCategory();
private:
void addFavoriteEntry(const KoID &entry);
void removeFavoriteEntry(const KoID &entry);
};
class KRITAUI_EXPORT KisSortedCompositeOpListModel : public KisSortedCategorizedListModel<KisCompositeOpListModel>
{
public:
KisSortedCompositeOpListModel(QObject *parent)
: KisSortedCategorizedListModel<KisCompositeOpListModel>(parent)
{
initializeModel(KisCompositeOpListModel::sharedInstance());
}
void validate(const KoColorSpace *cs) {
KisCompositeOpListModel::sharedInstance()->validate(cs);
}
protected:
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const {
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const override {
return lessThanPriority(left, right, KisCompositeOpListModel::favoriteCategory().name());
}
};
#endif
diff --git a/libs/ui/kis_config_notifier.h b/libs/ui/kis_config_notifier.h
index 6234669ef9..97d5e50261 100644
--- a/libs/ui/kis_config_notifier.h
+++ b/libs/ui/kis_config_notifier.h
@@ -1,65 +1,65 @@
/*
* Copyright (c) 2007 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CONFIG_NOTIFIER_H_
#define KIS_CONFIG_NOTIFIER_H_
#include <QObject>
#include <QScopedPointer>
#include "kritaui_export.h"
/**
* An object that emits a signal to inform interested parties that the
* configuration settings have changed.
*/
class KRITAUI_EXPORT KisConfigNotifier : public QObject
{
Q_OBJECT
public:
KisConfigNotifier();
- ~KisConfigNotifier();
+ ~KisConfigNotifier() override;
/**
* @return the KisConfigNotifier singleton
*/
static KisConfigNotifier *instance();
/**
* Notify that the configuration has changed. This will cause the
* configChanged() signal to be emitted.
*/
void notifyConfigChanged(void);
void notifyDropFramesModeChanged();
Q_SIGNALS:
/**
* This signal is emitted whenever notifyConfigChanged() is called.
*/
void configChanged(void);
void dropFramesModeChanged();
private:
KisConfigNotifier(const KisConfigNotifier&);
KisConfigNotifier operator=(const KisConfigNotifier&);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // KIS_CONFIG_NOTIFIER_H_
diff --git a/libs/ui/kis_control_frame.h b/libs/ui/kis_control_frame.h
index f07c7246c7..71fc9433cc 100644
--- a/libs/ui/kis_control_frame.h
+++ b/libs/ui/kis_control_frame.h
@@ -1,95 +1,95 @@
/*
* kis_control_frame.h - part of Krita
*
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (c) 2003-2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __kis_control_frame_h__
#define __kis_control_frame_h__
#include <QMenu>
#include <QKeyEvent>
#include <QObject>
class QWidget;
class QTabWidget;
class KoAbstractGradient;
class KisGradientChooser;
class KisPatternChooser;
class KisPaintopBox;
class KisViewManager;
class KisIconWidget;
class KoPattern;
class KoDualColorButton;
/**
* Control Frame - status display with access to
* color selector, gradient, patterns, and paintop presets
*/
class KisControlFrame : public QObject
{
Q_OBJECT
public:
KisControlFrame(KisViewManager *view, QWidget *parent = 0, const char *name = 0);
- virtual ~KisControlFrame() {}
+ ~KisControlFrame() override {}
void setup(QWidget *parent);
KisPaintopBox* paintopBox() {
return m_paintopBox;
}
private Q_SLOTS:
void slotSetPattern(KoPattern * pattern);
void slotSetGradient(KoAbstractGradient * gradient);
void slotUpdateDisplayRenderer();
private:
void createPatternsChooser(KisViewManager * view);
void createGradientsChooser(KisViewManager * view);
private:
QFont m_font;
KisViewManager *m_viewManager;
QTabWidget *m_gradientTab;
QTabWidget *m_patternsTab;
KisIconWidget *m_patternWidget;
KisIconWidget *m_gradientWidget;
QWidget *m_patternChooserPopup;
QWidget *m_gradientChooserPopup;
KisGradientChooser *m_gradientChooser;
KisPatternChooser *m_patternChooser;
KisPaintopBox *m_paintopBox;
KoDualColorButton *m_dual;
};
#endif
diff --git a/libs/ui/kis_custom_pattern.h b/libs/ui/kis_custom_pattern.h
index 53f2331846..76545bd91f 100644
--- a/libs/ui/kis_custom_pattern.h
+++ b/libs/ui/kis_custom_pattern.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2006 Bart Coppens <kde@bartcoppens.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CUSTOM_PATTERN_H_
#define KIS_CUSTOM_PATTERN_H_
#include <QObject>
#include <QShowEvent>
#include <KoResourceServerAdapter.h>
#include "ui_wdgcustompattern.h"
class KoPattern;
class KoResource;
class KisViewManager;
class KisWdgCustomPattern : public QWidget, public Ui::KisWdgCustomPattern
{
Q_OBJECT
public:
KisWdgCustomPattern(QWidget *parent, const char *name) : QWidget(parent) {
setObjectName(name); setupUi(this);
}
};
class KisCustomPattern : public KisWdgCustomPattern
{
Q_OBJECT
public:
KisCustomPattern(QWidget *parent, const char* name, const QString& caption, KisViewManager* view);
- virtual ~KisCustomPattern();
+ ~KisCustomPattern() override;
Q_SIGNALS:
void activatedResource(KoResource *);
void addPattern(KoPattern*);
private Q_SLOTS:
void slotAddPredefined();
void slotUsePattern();
void slotUpdateCurrentPattern();
private:
void createPattern();
KisViewManager* m_view;
KoPattern* m_pattern;
QSharedPointer<KoAbstractResourceServerAdapter> m_rServerAdapter;
};
#endif // KIS_CUSTOM_PATTERN_H_
diff --git a/libs/ui/kis_derived_resources.h b/libs/ui/kis_derived_resources.h
index d5e775f4de..14974ad05b 100644
--- a/libs/ui/kis_derived_resources.h
+++ b/libs/ui/kis_derived_resources.h
@@ -1,107 +1,107 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DERIVED_RESOURCES_H
#define __KIS_DERIVED_RESOURCES_H
#include "KoDerivedResourceConverter.h"
#include "KoResourceUpdateMediator.h"
#include <QScopedPointer>
class KisPresetUpdateMediator : public KoResourceUpdateMediator
{
Q_OBJECT
public:
KisPresetUpdateMediator();
- ~KisPresetUpdateMediator();
- void connectResource(QVariant sourceResource);
+ ~KisPresetUpdateMediator() override;
+ void connectResource(QVariant sourceResource) override;
private Q_SLOTS:
void slotSettingsChanged();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
class KisCompositeOpResourceConverter : public KoDerivedResourceConverter
{
public:
KisCompositeOpResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
class KisEffectiveCompositeOpResourceConverter : public KoDerivedResourceConverter
{
public:
KisEffectiveCompositeOpResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
class KisOpacityResourceConverter : public KoDerivedResourceConverter, public QObject
{
public:
KisOpacityResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
class KisFlowResourceConverter : public KoDerivedResourceConverter, public QObject
{
public:
KisFlowResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
class KisSizeResourceConverter : public KoDerivedResourceConverter, public QObject
{
public:
KisSizeResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
class KisLodAvailabilityResourceConverter : public KoDerivedResourceConverter
{
public:
KisLodAvailabilityResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
class KisEraserModeResourceConverter : public KoDerivedResourceConverter
{
public:
KisEraserModeResourceConverter();
- QVariant fromSource(const QVariant &value);
- QVariant toSource(const QVariant &value, const QVariant &sourceValue);
+ QVariant fromSource(const QVariant &value) override;
+ QVariant toSource(const QVariant &value, const QVariant &sourceValue) override;
};
#endif /* __KIS_DERIVED_RESOURCES_H */
diff --git a/libs/ui/kis_document_undo_store.h b/libs/ui/kis_document_undo_store.h
index 97515886f8..f50619cc79 100644
--- a/libs/ui/kis_document_undo_store.h
+++ b/libs/ui/kis_document_undo_store.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DOCUMENT_UNDO_STORE_H
#define __KIS_DOCUMENT_UNDO_STORE_H
#include "kis_undo_store.h"
#include "kritaui_export.h"
class KisDocument;
class KRITAUI_EXPORT KisDocumentUndoStore : public KisUndoStore
{
public:
KisDocumentUndoStore(KisDocument *doc);
- const KUndo2Command* presentCommand();
- void undoLastCommand();
- void addCommand(KUndo2Command *cmd);
- void beginMacro(const KUndo2MagicString& macroName);
- void endMacro();
- void purgeRedoState();
+ const KUndo2Command* presentCommand() override;
+ void undoLastCommand() override;
+ void addCommand(KUndo2Command *cmd) override;
+ void beginMacro(const KUndo2MagicString& macroName) override;
+ void endMacro() override;
+ void purgeRedoState() override;
private:
KisDocument* m_doc;
};
#endif /* __KIS_DOCUMENT_UNDO_STORES_H */
diff --git a/libs/ui/kis_favorite_resource_manager.h b/libs/ui/kis_favorite_resource_manager.h
index 244e0f8ec5..aa168a6028 100644
--- a/libs/ui/kis_favorite_resource_manager.h
+++ b/libs/ui/kis_favorite_resource_manager.h
@@ -1,135 +1,135 @@
/* This file is part of the KDE project
Copyright 2009 Vera Lukman <shicmap@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FAVORITE_RESOURCE_MANAGER_H
#define KIS_FAVORITE_RESOURCE_MANAGER_H
#include <QObject>
#include <kis_types.h>
#include <QQueue>
#include <QList>
#include "KoResourceServerObserver.h"
#include <KoColor.h>
class QString;
class KisPaintopBox;
class KisPaintOpPreset;
class KisFavoriteResourceManager : public QObject, public KoResourceServerObserver<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> >
{
Q_OBJECT
public:
KisFavoriteResourceManager(KisPaintopBox *paintopBox);
- ~KisFavoriteResourceManager();
+ ~KisFavoriteResourceManager() override;
- virtual void unsetResourceServer();
+ void unsetResourceServer() override;
QList<QImage> favoritePresetImages();
void setCurrentTag(const QString& tagName);
int numFavoritePresets();
QVector<KisPaintOpPresetSP> favoritePresetList();
int recentColorsTotal();
const KoColor& recentColorAt(int pos);
// Reimplemented from KoResourceServerObserver
- virtual void removingResource(PointerType resource);
- virtual void resourceAdded(PointerType resource);
- virtual void resourceChanged(PointerType resource);
- virtual void syncTaggedResourceView();
- virtual void syncTagAddition(const QString& tag);
- virtual void syncTagRemoval(const QString& tag);
+ void removingResource(PointerType resource) override;
+ void resourceAdded(PointerType resource) override;
+ void resourceChanged(PointerType resource) override;
+ void syncTaggedResourceView() override;
+ void syncTagAddition(const QString& tag) override;
+ void syncTagRemoval(const QString& tag) override;
//BgColor;
KoColor bgColor() const;
/**
* Set palette to block updates, paintops won't be deleted when they are deleted from server
* Used when overwriting a resource
*/
void setBlockUpdates(bool block);
Q_SIGNALS:
void sigSetFGColor(const KoColor& c);
void sigSetBGColor(const KoColor& c);
// This is a flag to handle a bug:
// If pop up palette is visible and a new colour is selected, the new colour
// will be added when the user clicks on the canvas to hide the palette
// In general, we want to be able to store recent colours if the pop up palette
// is not visible
void sigEnableChangeColor(bool b);
void sigChangeFGColorSelector(const KoColor&);
void setSelectedColor(int);
void updatePalettes();
void hidePalettes();
public Q_SLOTS:
void slotChangeActivePaintop(int);
/*update the priority of a colour in m_colorList, used only by m_popupPalette*/
void slotUpdateRecentColor(int);
/*add a colour to m_colorList, used by KisCanvasResourceProvider*/
void slotAddRecentColor(const KoColor&);
void slotChangeFGColorSelector(KoColor c);
void slotSetBGColor(const KoColor c);
private Q_SLOTS:
void updateFavoritePresets();
void configChanged();
private:
// Loads the favorite preset list for the first time
void init();
KisPaintopBox *m_paintopBox;
QVector<KisPaintOpPresetSP> m_favoritePresetsList;
class ColorDataList;
ColorDataList *m_colorList;
bool m_blockUpdates;
void saveFavoritePresets();
KoColor m_bgColor;
QString m_currentTag;
bool m_initialized;
int m_maxPresets;
};
#endif
diff --git a/libs/ui/kis_file_layer.h b/libs/ui/kis_file_layer.h
index be3a5ee4de..b3d86fb205 100644
--- a/libs/ui/kis_file_layer.h
+++ b/libs/ui/kis_file_layer.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2013 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILE_LAYER_H
#define KIS_FILE_LAYER_H
#include "kritaui_export.h"
#include "kis_external_layer_iface.h"
#include "kis_safe_document_loader.h"
/**
* @brief The KisFileLayer class loads a particular file as a layer into the layer stack.
*/
class KRITAUI_EXPORT KisFileLayer : public KisExternalLayer
{
Q_OBJECT
public:
enum ScalingMethod {
None,
ToImageSize,
ToImagePPI
};
KisFileLayer(KisImageWSP image, const QString &name, quint8 opacity);
KisFileLayer(KisImageWSP image, const QString& basePath, const QString &filename, ScalingMethod scalingMethod, const QString &name, quint8 opacity);
- ~KisFileLayer();
+ ~KisFileLayer() override;
KisFileLayer(const KisFileLayer& rhs);
- QIcon icon() const;
+ QIcon icon() const override;
- void resetCache();
+ void resetCache() override;
- virtual const KoColorSpace *colorSpace() const;
+ const KoColorSpace *colorSpace() const override;
- KisPaintDeviceSP original() const;
- KisPaintDeviceSP paintDevice() const;
- KisBaseNode::PropertyList sectionModelProperties() const;
+ KisPaintDeviceSP original() const override;
+ KisPaintDeviceSP paintDevice() const override;
+ KisBaseNode::PropertyList sectionModelProperties() const override;
void setFileName(const QString &basePath, const QString &filename);
QString fileName() const;
QString path() const;
ScalingMethod scalingMethod() const;
- KisNodeSP clone() const;
- bool allowAsChild(KisNodeSP) const;
+ KisNodeSP clone() const override;
+ bool allowAsChild(KisNodeSP) const override;
- bool accept(KisNodeVisitor&);
- void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter);
+ bool accept(KisNodeVisitor&) override;
+ void accept(KisProcessingVisitor &visitor, KisUndoAdapter *undoAdapter) override;
- KUndo2Command* crop(const QRect & rect);
- KUndo2Command* transform(const QTransform &transform);
+ KUndo2Command* crop(const QRect & rect) override;
+ KUndo2Command* transform(const QTransform &transform) override;
public Q_SLOTS:
void slotLoadingFinished(KisPaintDeviceSP projection, int xRes, int yRes);
private:
QString m_basePath;
QString m_filename;
ScalingMethod m_scalingMethod;
KisPaintDeviceSP m_paintDevice;
KisSafeDocumentLoader m_loader;
};
#endif // KIS_FILE_LAYER_H
diff --git a/libs/ui/kis_filter_manager.h b/libs/ui/kis_filter_manager.h
index 86a1d19bd5..07dd9cf7f4 100644
--- a/libs/ui/kis_filter_manager.h
+++ b/libs/ui/kis_filter_manager.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_FILTER_MANAGER_
#define _KIS_FILTER_MANAGER_
#include <QObject>
#include <kritaui_export.h>
#include <kis_types.h>
class KisViewManager;
class KActionCollection;
class KisActionManager;
class KisView;
/**
* Create all the filter actions for the specified view and implement re-apply filter
*/
class KRITAUI_EXPORT KisFilterManager : public QObject
{
Q_OBJECT
public:
KisFilterManager(KisViewManager * parent);
- ~KisFilterManager();
+ ~KisFilterManager() override;
void setView(QPointer<KisView>imageView);
void setup(KActionCollection * ac, KisActionManager *actionManager);
void updateGUI();
void apply(KisFilterConfigurationSP filterConfig);
void finish();
void cancel();
bool isStrokeRunning() const;
private Q_SLOTS:
void insertFilter(const QString &name);
void showFilterDialog(const QString &filterId);
void reapplyLastFilter();
void slotStrokeEndRequested();
void slotStrokeCancelRequested();
private:
struct Private;
Private * const d;
};
#endif
diff --git a/libs/ui/kis_filters_model.h b/libs/ui/kis_filters_model.h
index 1758fa0516..5bc0210951 100644
--- a/libs/ui/kis_filters_model.h
+++ b/libs/ui/kis_filters_model.h
@@ -1,58 +1,58 @@
/*
* This file is part of Krita
*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_FILTERS_MODEL_H_
#define _KIS_FILTERS_MODEL_H_
#include <QAbstractItemModel>
#include <kis_types.h>
class KisFilter;
/**
*
*/
class KisFiltersModel : public QAbstractItemModel
{
Q_OBJECT
public:
/**
* @brief KisFiltersModel create a new filters model
* @param showAll if true, show all filters, if false, do not show filters that don't work in adjustment layers
* @param thumb the thumbnail image that is filtered
*/
KisFiltersModel(bool showAll, KisPaintDeviceSP thumb);
- ~KisFiltersModel();
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
+ ~KisFiltersModel() override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
QModelIndex indexForFilter(const QString& id);
const KisFilter* indexToFilter(const QModelIndex& idx);
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual Qt::ItemFlags flags(const QModelIndex & index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex & index) const override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/kis_fps_decoration.h b/libs/ui/kis_fps_decoration.h
index 02cab83bad..373570844a 100644
--- a/libs/ui/kis_fps_decoration.h
+++ b/libs/ui/kis_fps_decoration.h
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_FPS_DECORATION_H
#define __KIS_FPS_DECORATION_H
#include "canvas/kis_canvas_decoration.h"
class KisFpsDecoration : public KisCanvasDecoration
{
public:
KisFpsDecoration(QPointer<KisView> view);
- ~KisFpsDecoration();
+ ~KisFpsDecoration() override;
- void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter, KisCanvas2* canvas);
+ void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter, KisCanvas2* canvas) override;
static const QString idTag;
};
#endif /* __KIS_FPS_DECORATION_H */
diff --git a/libs/ui/kis_gui_context_command.h b/libs/ui/kis_gui_context_command.h
index 0119b2fe60..9fe34fc74a 100644
--- a/libs/ui/kis_gui_context_command.h
+++ b/libs/ui/kis_gui_context_command.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_GUI_CONTEXT_COMMAND_H
#define __KIS_GUI_CONTEXT_COMMAND_H
#include <QObject>
#include "kundo2command.h"
class KisGuiContextCommandDelegate;
/**
* KisGuiContextCommand is a special command-wrapper which ensures
* that the holding command is executed in the GUI thread only. Please
* note that any activity done by the containing command must *not*
* lead to the blocking on the image, otherwise you'll get a deadlock!
*/
class KisGuiContextCommand : public QObject, public KUndo2Command
{
Q_OBJECT
public:
KisGuiContextCommand(KUndo2Command *command, QObject *guiObject);
- ~KisGuiContextCommand();
+ ~KisGuiContextCommand() override;
- void undo();
- void redo();
+ void undo() override;
+ void redo() override;
Q_SIGNALS:
void sigExecuteCommand(KUndo2Command *command, bool undo);
private:
QScopedPointer<KUndo2Command> m_command;
QScopedPointer<KisGuiContextCommandDelegate> m_delegate;
};
#endif /* __KIS_GUI_CONTEXT_COMMAND_H */
diff --git a/libs/ui/kis_highlighted_button.h b/libs/ui/kis_highlighted_button.h
index bfa15c2538..c6ea0dc5ce 100644
--- a/libs/ui/kis_highlighted_button.h
+++ b/libs/ui/kis_highlighted_button.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_HIGHLIGHTED_BUTTON_H
#define __KIS_HIGHLIGHTED_BUTTON_H
template <class BaseButton>
class HighlightedButtonBase : public BaseButton
{
public:
HighlightedButtonBase(QWidget *parent = 0) : BaseButton(parent) {}
protected:
- void checkStateSet() {
+ void checkStateSet() override {
BaseButton::checkStateSet();
updatePalette();
}
- void nextCheckState() {
+ void nextCheckState() override {
BaseButton::nextCheckState();
updatePalette();
}
private:
void updatePalette() {
QWidget *parent = this->parentWidget();
if (parent) {
QPalette p = parent->palette();
QColor color = p.color(this->isChecked() ? QPalette::Highlight : QPalette::Button);
p.setColor(QPalette::Button, color);
this->setPalette(p);
}
}
};
class QPushButton;
class QToolButton;
typedef HighlightedButtonBase<QPushButton> KisHighlightedButton;
typedef HighlightedButtonBase<QToolButton> KisHighlightedToolButton;
#endif /* __KIS_HIGHLIGHTED_BUTTON_H */
diff --git a/libs/ui/kis_histogram_view.h b/libs/ui/kis_histogram_view.h
index a5d266df55..a710c9a85d 100644
--- a/libs/ui/kis_histogram_view.h
+++ b/libs/ui/kis_histogram_view.h
@@ -1,106 +1,106 @@
/*
* Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_HISTOGRAM_VIEW_
#define _KIS_HISTOGRAM_VIEW_
#include <QLabel>
#include <QPixmap>
#include <QVector>
#include <QStringList>
#include <QMouseEvent>
#include <QSharedPointer>
#include "kis_types.h"
#include "kis_histogram.h"
#include <kritaui_export.h>
class KoChannelInfo;
/**
* This class displays a histogram. It has a list of channels it can
* select. The easy way is to display channelStrings() to the user,
* and then use a setActiveChannel with the integer the same as the
* one the selected string in that stringlist has. If the selected one
* is a producer, the histogram will automatically display all its
* channels, and color them if that is possible.
*
* You can also set the channels manually, just don't forget that the
* displayed channels all need to belong to the same producer! If you
* set them manually, don't forget to set the (non)usage of color as
* well.
*
* You can either set this to use a specific layer, or use a specific
* histogram. With the latter, some functionality will disappear, like
* listProducers(). Setting a histogram will discard info on the
* layer, and setting a layer will discard info on the histogram.
*
**/
class KRITAUI_EXPORT KisHistogramView : public QLabel
{
Q_OBJECT
public:
KisHistogramView(QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0);
- virtual ~KisHistogramView();
+ ~KisHistogramView() override;
void setPaintDevice(KisPaintDeviceSP dev, KoHistogramProducer *producer, const QRect &bounds);
void setView(double from, double size);
KoHistogramProducer *currentProducer();
bool hasColor();
void setColor(bool set);
void setProducer(KoHistogramProducer* producer);
void setChannels(QList<KoChannelInfo*> & channels);
- virtual void paintEvent(QPaintEvent* event);
+ void paintEvent(QPaintEvent* event) override;
virtual void updateHistogramCalculation();
void setSmoothHistogram(bool smoothHistogram);
public Q_SLOTS:
virtual void setHistogramType(enumHistogramType type);
virtual void startUpdateCanvasProjection();
Q_SIGNALS:
void rightClicked(const QPoint& pos);
protected:
- virtual void mousePressEvent(QMouseEvent * e);
+ void mousePressEvent(QMouseEvent * e) override;
private:
void setChannels(void);
void addProducerChannels(KoHistogramProducer *producer);
KisHistogramSP m_histogram;
KisPaintDeviceSP m_currentDev;
QRect m_currentBounds;
KoHistogramProducer *m_currentProducer;
QList<KoChannelInfo *> m_channels;
bool m_color;
bool m_smoothHistogram;
enumHistogramType m_histogram_type;
};
#endif // _KIS_HISTOGRAM_VIEW_
diff --git a/libs/ui/kis_image_manager.h b/libs/ui/kis_image_manager.h
index 82966551c1..ea4371345f 100644
--- a/libs/ui/kis_image_manager.h
+++ b/libs/ui/kis_image_manager.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA..
*/
#ifndef KIS_IMAGE_MANAGER
#define KIS_IMAGE_MANAGER
#include <QObject>
#include <QPointer>
#include <QUrl>
#include <kritaui_export.h>
class KisViewManager;
class KisFilterStrategy;
class KisActionManager;
class KisView;
class KRITAUI_EXPORT KisImageManager : public QObject
{
Q_OBJECT
public:
KisImageManager(KisViewManager * view);
- ~KisImageManager() {}
+ ~KisImageManager() override {}
void setView(QPointer<KisView>imageView);
void setup(KisActionManager *actionManager);
public Q_SLOTS:
void slotImportLayerFromFile();
void slotImportLayerAsTransparencyMask();
void slotImportLayerAsFilterMask();
void slotImportLayerAsSelectionMask();
/**
* Import an image as a layer. If there is more than
* one layer in the image, import all of them as separate
* layers.
*
* @param url the url to the image file
* @return the number of layers added
*/
qint32 importImage(const QUrl &url, const QString &layerType = "KisPaintLayer");
void resizeCurrentImage(qint32 w, qint32 h, qint32 xOffset, qint32 yOffset);
void scaleCurrentImage(const QSize &size, qreal xres, qreal yres, KisFilterStrategy *filterStrategy);
void rotateCurrentImage(double radians);
void shearCurrentImage(double angleX, double angleY);
void slotImageProperties();
void slotImageColor();
private:
KisViewManager * m_view;
};
#endif // KIS_IMAGE_MANAGER
diff --git a/libs/ui/kis_image_view_converter.h b/libs/ui/kis_image_view_converter.h
index e7d80bc84b..0767d91391 100644
--- a/libs/ui/kis_image_view_converter.h
+++ b/libs/ui/kis_image_view_converter.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2007 Thomas Zander <zander@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_VIEW_CONVERTER_H
#define KIS_IMAGE_VIEW_CONVERTER_H
#include <kritaui_export.h>
#include "kis_image.h"
#include "kis_types.h"
#include <KoViewConverter.h>
class QTransform;
/**
* ViewConverter to convert from flake-internal points to
* krita-internal pixels and back. You can use this class whereever
* the flake tools or shapes come in contact with the krita-image.
*
* For usage remember that the document here is the flake-points. And
* the view is the krita-pixels.
*/
class KRITAUI_EXPORT KisImageViewConverter : public KoViewConverter
{
public:
/**
* constructor
* @param image the image this viewConverter works for.
*/
KisImageViewConverter(const KisImageWSP image);
void setImage(KisImageWSP image);
QTransform documentToView() const;
QTransform viewToDocument() const;
using KoViewConverter::documentToView;
using KoViewConverter::viewToDocument;
/// reimplemented from superclass
- void zoom(qreal *zoomX, qreal *zoomY) const;
+ void zoom(qreal *zoomX, qreal *zoomY) const override;
- qreal documentToViewX(qreal documentX) const;
- qreal documentToViewY(qreal documentY) const;
- qreal viewToDocumentX(qreal viewX) const;
- qreal viewToDocumentY(qreal viewY) const;
+ qreal documentToViewX(qreal documentX) const override;
+ qreal documentToViewY(qreal documentY) const override;
+ qreal viewToDocumentX(qreal viewX) const override;
+ qreal viewToDocumentY(qreal viewY) const override;
// This method shouldn't be used for image
qreal zoom() const;
private:
KisImageWSP m_image;
};
#endif
diff --git a/libs/ui/kis_import_catcher.h b/libs/ui/kis_import_catcher.h
index 0f1bbcd906..368192c855 100644
--- a/libs/ui/kis_import_catcher.h
+++ b/libs/ui/kis_import_catcher.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMPORT_CATCHER_H_
#define KIS_IMPORT_CATCHER_H_
#include <QObject>
#include <kis_types.h>
class KisViewManager;
class QUrl;
/**
* This small helper class takes an url and an image; tries to import
* the image at the url and shove the layers of the imported image
* into the first image after loading is done. This is a separate class
* because loading can be asynchronous.
*
* Caveat: this class calls "delete this", which means that you new
* it and then never touch it again. Thank you very much.
*/
class KisImportCatcher : QObject
{
Q_OBJECT
public:
KisImportCatcher(const QUrl &url, KisViewManager* view, const QString &layerType);
- ~KisImportCatcher();
+ ~KisImportCatcher() override;
static void adaptClipToImageColorSpace(KisPaintDeviceSP dev, KisImageSP image);
private Q_SLOTS:
void slotLoadingFinished();
private:
void deleteMyself();
private:
struct Private;
Private* const m_d;
};
#endif
diff --git a/libs/ui/kis_layer_manager.h b/libs/ui/kis_layer_manager.h
index 824c3d14db..15b8b3ef37 100644
--- a/libs/ui/kis_layer_manager.h
+++ b/libs/ui/kis_layer_manager.h
@@ -1,131 +1,131 @@
/*
* Copyright (C) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LAYER_MANAGER
#define KIS_LAYER_MANAGER
#include <QObject>
#include <QPointer>
#include <QList>
#include "kis_adjustment_layer.h"
#include "kis_types.h"
#include "KisView.h"
#include <filter/kis_filter_configuration.h>
class KisViewManager;
class KisNodeCommandsAdapter;
class KisAction;
class KisActionManager;
/**
* KisLayerManager takes care of the gui around working with layers:
* adding, removing, editing. It also keeps track of the active layer
* for this view.
*/
class KisLayerManager : public QObject
{
Q_OBJECT
public:
KisLayerManager(KisViewManager * view);
- ~KisLayerManager();
+ ~KisLayerManager() override;
void setView(QPointer<KisView>view);
Q_SIGNALS:
void sigLayerActivated(KisLayerSP layer);
private:
friend class KisNodeManager;
/**
* Activate the specified layer. The layer may be 0.
*/
void activateLayer(KisLayerSP layer);
KisLayerSP activeLayer();
KisPaintDeviceSP activeDevice();
void setup(KisActionManager *actionManager);
void updateGUI();
private Q_SLOTS:
void mergeLayer();
void imageResizeToActiveLayer();
void trimToImage();
void layerProperties();
void flattenImage();
void flattenLayer();
void rasterizeLayer();
void layersUpdated();
void saveGroupLayers();
bool activeLayerHasSelection();
void convertNodeToPaintLayer(KisNodeSP source);
void convertGroupToAnimated();
KisLayerSP addLayer(KisNodeSP activeNode);
void addGroupLayer(KisNodeSP activeNode);
void addCloneLayer(KisNodeSP activeNode);
void addShapeLayer(KisNodeSP activeNode);
void addAdjustmentLayer(KisNodeSP activeNode);
KisAdjustmentLayerSP addAdjustmentLayer(KisNodeSP activeNode, const QString & name, KisFilterConfigurationSP filter, KisSelectionSP selection);
void addGeneratorLayer(KisNodeSP activeNode);
void addFileLayer(KisNodeSP activeNode);
void layerStyle();
private:
void adjustLayerPosition(KisNodeSP node, KisNodeSP activeNode, KisNodeSP &parent, KisNodeSP &above);
void addLayerCommon(KisNodeSP activeNode, KisLayerSP layer, bool updateImage = true);
private:
KisViewManager * m_view;
QPointer<KisView>m_imageView;
KisAction *m_imageFlatten;
KisAction *m_imageMergeLayer;
KisAction *m_groupLayersSave;
KisAction *m_convertGroupAnimated;
KisAction *m_imageResizeToLayer;
KisAction *m_flattenLayer;
KisAction *m_rasterizeLayer;
KisNodeCommandsAdapter* m_commandsAdapter;
KisAction *m_layerStyle;
};
#endif
diff --git a/libs/ui/kis_mainwindow_observer.h b/libs/ui/kis_mainwindow_observer.h
index b904d5864e..d6bcbbdd13 100644
--- a/libs/ui/kis_mainwindow_observer.h
+++ b/libs/ui/kis_mainwindow_observer.h
@@ -1,19 +1,19 @@
#ifndef KIS_MAINWINDOW_OBSERVER_H
#define KIS_MAINWINDOW_OBSERVER_H
#include <KoCanvasObserverBase.h>
#include <kritaui_export.h>
class KisViewManager;
class KRITAUI_EXPORT KisMainwindowObserver : public KoCanvasObserverBase
{
public:
KisMainwindowObserver();
- virtual ~KisMainwindowObserver();
+ ~KisMainwindowObserver() override;
virtual void setMainWindow(KisViewManager* kisview) = 0;
};
#endif // KIS_MAINWINDOW_OBSERVER_H
diff --git a/libs/ui/kis_mask_manager.cc b/libs/ui/kis_mask_manager.cc
index 1ca79de71d..88493f0b96 100644
--- a/libs/ui/kis_mask_manager.cc
+++ b/libs/ui/kis_mask_manager.cc
@@ -1,311 +1,310 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_mask_manager.h"
#include <kactioncollection.h>
#include <KoProperties.h>
#include <kis_transaction.h>
#include <filter/kis_filter_configuration.h>
#include <commands/kis_node_commands.h>
#include <kis_undo_adapter.h>
#include <kis_paint_layer.h>
#include "KisDocument.h"
#include "KisViewManager.h"
#include <kis_layer.h>
#include <kis_clone_layer.h>
#include <kis_group_layer.h>
#include <kis_filter_mask.h>
#include <lazybrush/kis_colorize_mask.h>
#include <kis_transform_mask.h>
#include <kis_transparency_mask.h>
-#include <kis_inpaint_mask.h>
#include <kis_selection_mask.h>
#include <kis_effect_mask.h>
#include "dialogs/kis_dlg_adjustment_layer.h"
#include "widgets/kis_mask_widgets.h"
#include <kis_selection.h>
#include <kis_selection_manager.h>
#include <kis_pixel_selection.h>
#include "dialogs/kis_dlg_adj_layer_props.h"
#include <kis_image.h>
#include <kis_transform_worker.h>
#include <KoColorSpace.h>
#include <KoColor.h>
#include "kis_node_commands_adapter.h"
#include "commands/kis_selection_commands.h"
#include "kis_iterator_ng.h"
KisMaskManager::KisMaskManager(KisViewManager * view)
: m_view(view)
, m_imageView(0)
, m_commandsAdapter(new KisNodeCommandsAdapter(m_view))
{
}
void KisMaskManager::setView(QPointer<KisView>imageView)
{
m_imageView = imageView;
}
void KisMaskManager::setup(KActionCollection *actionCollection, KisActionManager *actionManager)
{
Q_UNUSED(actionCollection);
Q_UNUSED(actionManager);
}
void KisMaskManager::updateGUI()
{
// XXX: enable/disable menu items according to whether there's a mask selected currently
// XXX: disable the selection mask item if there's already a selection mask
// YYY: doesn't KisAction do that already?
}
KisMaskSP KisMaskManager::activeMask()
{
if (m_imageView) {
return m_imageView->currentMask();
}
return 0;
}
KisPaintDeviceSP KisMaskManager::activeDevice()
{
KisMaskSP mask = activeMask();
return mask ? mask->paintDevice() : 0;
}
void KisMaskManager::activateMask(KisMaskSP mask)
{
Q_UNUSED(mask);
}
void KisMaskManager::masksUpdated()
{
m_view->updateGUI();
}
void KisMaskManager::adjustMaskPosition(KisNodeSP node, KisNodeSP activeNode, bool avoidActiveNode, KisNodeSP &parent, KisNodeSP &above)
{
Q_ASSERT(node);
Q_ASSERT(activeNode);
if (!avoidActiveNode && activeNode->allowAsChild(node)) {
parent = activeNode;
above = activeNode->lastChild();
} else if (activeNode->parent() && activeNode->parent()->allowAsChild(node)) {
parent = activeNode->parent();
above = activeNode;
} else {
KisNodeSP t = activeNode;
while ((t = t->nextSibling())) {
if (t->allowAsChild(node)) {
parent = t;
above = t->lastChild();
break;
}
}
if (!t) {
t = activeNode;
while ((t = t->prevSibling())) {
if (t->allowAsChild(node)) {
parent = t;
above = t->lastChild();
break;
}
}
}
if (!t && activeNode->parent()) {
adjustMaskPosition(node, activeNode->parent(), true, parent, above);
} else if (!t) {
KisImageWSP image = m_view->image();
KisLayerSP layer = new KisPaintLayer(image.data(), image->nextLayerName(), OPACITY_OPAQUE_U8, image->colorSpace());
m_commandsAdapter->addNode(layer, activeNode, 0);
parent = layer;
above = 0;
}
}
}
void KisMaskManager::createMaskCommon(KisMaskSP mask, KisNodeSP activeNode, KisPaintDeviceSP copyFrom, const KUndo2MagicString& macroName, const QString &nodeType, const QString &nodeName, bool suppressSelection, bool avoidActiveNode, bool updateImage)
{
m_commandsAdapter->beginMacro(macroName);
KisNodeSP parent;
KisNodeSP above;
adjustMaskPosition(mask, activeNode, avoidActiveNode, parent, above);
KisLayerSP parentLayer = qobject_cast<KisLayer*>(parent.data());
Q_ASSERT(parentLayer);
if (!suppressSelection) {
if (copyFrom) {
mask->initSelection(copyFrom, parentLayer);
} else {
mask->initSelection(m_view->selection(), parentLayer);
}
}
//counting number of KisSelectionMask
QList<KisNodeSP> masks = parentLayer->childNodes(QStringList(nodeType),KoProperties());
int number = masks.count() + 1;
mask->setName(nodeName + QString(" ") + QString::number(number));
m_commandsAdapter->addNode(mask, parentLayer, above, updateImage, updateImage);
m_commandsAdapter->endMacro();
masksUpdated();
}
void KisMaskManager::createSelectionMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool avoidActiveNode)
{
KisSelectionMaskSP mask = new KisSelectionMask(m_view->image());
createMaskCommon(mask, activeNode, copyFrom, kundo2_i18n("Add Selection Mask"), "KisSelectionMask", i18n("Selection"), false, avoidActiveNode, false);
mask->setActive(true);
}
void KisMaskManager::createTransparencyMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool avoidActiveNode)
{
KisMaskSP mask = new KisTransparencyMask();
createMaskCommon(mask, activeNode, copyFrom, kundo2_i18n("Add Transparency Mask"), "KisTransparencyMask", i18n("Transparency Mask"), false, avoidActiveNode);
}
void KisMaskManager::createFilterMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool quiet, bool avoidActiveNode)
{
KisFilterMaskSP mask = new KisFilterMask();
createMaskCommon(mask, activeNode, copyFrom, kundo2_i18n("Add Filter Mask"), "KisFilterMask", i18n("Filter Mask"), false, avoidActiveNode);
/**
* FIXME: We'll use layer's original for creation of a thumbnail.
* Actually, we can't use it's projection as newly created mask
* may be going to be inserted in the middle of the masks stack
*/
KisPaintDeviceSP originalDevice = mask->parent()->original();
KisDlgAdjustmentLayer dialog(mask, mask.data(), originalDevice,
mask->name(), i18n("New Filter Mask"),
m_view);
// If we are supposed to not disturb the user, don't start asking them about things.
if(quiet) {
KisFilterConfigurationSP filter = KisFilterRegistry::instance()->values().first()->defaultConfiguration();
if (filter) {
mask->setFilter(filter);
mask->setName(mask->name());
}
return;
}
if (dialog.exec() == QDialog::Accepted) {
KisFilterConfigurationSP filter = dialog.filterConfiguration();
if (filter) {
QString name = dialog.layerName();
mask->setFilter(filter);
mask->setName(name);
}
} else {
m_commandsAdapter->undoLastCommand();
}
}
void KisMaskManager::createColorizeMask(KisNodeSP activeNode)
{
KisColorizeMaskSP mask = new KisColorizeMask();
createMaskCommon(mask, activeNode, 0, kundo2_i18n("Add Colorize Mask"), "KisColorizeMask", i18n("Colorize Mask"), true, false);
mask->setImage(m_view->image());
mask->initializeCompositeOp();
delete mask->setColorSpace(mask->parent()->colorSpace());
}
void KisMaskManager::createTransformMask(KisNodeSP activeNode)
{
KisTransformMaskSP mask = new KisTransformMask();
createMaskCommon(mask, activeNode, 0, kundo2_i18n("Add Transform Mask"), "KisTransformMask", i18n("Transform Mask"), true, false);
}
void KisMaskManager::maskProperties()
{
if (!activeMask()) return;
if (activeMask()->inherits("KisFilterMask")) {
KisFilterMask *mask = static_cast<KisFilterMask*>(activeMask().data());
KisLayerSP layer = qobject_cast<KisLayer*>(mask->parent().data());
if (! layer)
return;
KisPaintDeviceSP dev = layer->original();
if (!dev) {
return;
}
KisDlgAdjLayerProps dlg(layer, mask, dev, m_view, mask->filter().data(), mask->name(), i18n("Filter Mask Properties"), m_view->mainWindow(), "dlgeffectmaskprops");
KisFilterConfigurationSP configBefore(mask->filter());
Q_ASSERT(configBefore);
QString xmlBefore = configBefore->toXML();
if (dlg.exec() == QDialog::Accepted) {
KisFilterConfigurationSP configAfter(dlg.filterConfiguration());
Q_ASSERT(configAfter);
QString xmlAfter = configAfter->toXML();
mask->setName(dlg.layerName());
if(xmlBefore != xmlAfter) {
KisChangeFilterCmd *cmd
= new KisChangeFilterCmd(mask,
configBefore->name(),
xmlBefore,
configAfter->name(),
xmlAfter,
false);
// FIXME: check whether is needed
cmd->redo();
m_view->undoAdapter()->addCommand(cmd);
m_view->document()->setModified(true);
}
}
else {
KisFilterConfigurationSP configAfter(dlg.filterConfiguration());
Q_ASSERT(configAfter);
QString xmlAfter = configAfter->toXML();
if(xmlBefore != xmlAfter) {
mask->setFilter(KisFilterRegistry::instance()->cloneConfiguration(configBefore.data()));
mask->setDirty();
}
}
} else {
// Not much to show for transparency or selection masks?
}
}
diff --git a/libs/ui/kis_mask_manager.h b/libs/ui/kis_mask_manager.h
index 58a16ae562..d543d1cd69 100644
--- a/libs/ui/kis_mask_manager.h
+++ b/libs/ui/kis_mask_manager.h
@@ -1,100 +1,100 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MASK_MANAGER
#define KIS_MASK_MANAGER
#include <QObject>
#include <QPointer>
#include "kis_types.h"
#include "KisView.h"
class KisViewManager;
class KActionCollection;
class KisNodeCommandsAdapter;
class KisActionManager;
#include "kis_mask.h"
/**
* Handle the gui for manipulating masks.
*/
class KisMaskManager : public QObject
{
Q_OBJECT
public:
KisMaskManager(KisViewManager * view);
- ~KisMaskManager() {}
+ ~KisMaskManager() override {}
void setView(QPointer<KisView>view);
private:
friend class KisNodeManager;
void setup(KActionCollection * actionCollection, KisActionManager *actionManager);
void updateGUI();
/**
* @return the paint device associated with the currently
* active mask, if there is one.
*/
KisPaintDeviceSP activeDevice();
/**
* @return the active mask, if there is one
*/
KisMaskSP activeMask();
/**
* Show the mask properties dialog
*/
void maskProperties();
/**
* called whenever the mask stack is updated to enable/disable all
* menu items
*/
void masksUpdated();
/**
* Activate a new mask. There can be only one mask active per
* view; and if the mask is active, it becomes the paint device.
*/
void activateMask(KisMaskSP mask);
void adjustMaskPosition(KisNodeSP node, KisNodeSP activeNode, bool avoidActiveNode, KisNodeSP &parent, KisNodeSP &above);
void createMaskCommon(KisMaskSP mask, KisNodeSP activeNode, KisPaintDeviceSP copyFrom, const KUndo2MagicString &macroName, const QString &nodeType, const QString &nodeName, bool suppressSelection, bool avoidActiveNode, bool updateImage = true);
void createSelectionMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool avoidActiveNode);
void createFilterMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool quiet, bool avoidActiveNode);
void createColorizeMask(KisNodeSP activeNode);
void createTransformMask(KisNodeSP activeNode);
void createTransparencyMask(KisNodeSP activeNode, KisPaintDeviceSP copyFrom, bool avoidActiveNode);
KisViewManager * m_view;
QPointer<KisView>m_imageView;
KisNodeCommandsAdapter* m_commandsAdapter;
};
#endif // KIS_MASK_MANAGER
diff --git a/libs/ui/kis_md5_generator.h b/libs/ui/kis_md5_generator.h
index e4603b6f5d..5acc7138fe 100644
--- a/libs/ui/kis_md5_generator.h
+++ b/libs/ui/kis_md5_generator.h
@@ -1,29 +1,29 @@
/*
* Copyright (c) 2015 Stefano Bonicatti <smjert@gmail.com>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <resources/KoMD5Generator.h>
#include "kritaui_export.h"
class KRITAUI_EXPORT KisMD5Generator : public KoMD5Generator
{
public:
KisMD5Generator();
- ~KisMD5Generator();
+ ~KisMD5Generator() override;
- QByteArray generateHash(const QString &filename);
+ QByteArray generateHash(const QString &filename) override;
using KoMD5Generator::generateHash;
};
diff --git a/libs/ui/kis_mimedata.h b/libs/ui/kis_mimedata.h
index 76009bc220..32a7ab1452 100644
--- a/libs/ui/kis_mimedata.h
+++ b/libs/ui/kis_mimedata.h
@@ -1,118 +1,118 @@
/*
* Copyright (c) 2011 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MIMEDATA_H
#define KIS_MIMEDATA_H
#include <QMimeData>
#include <kis_types.h>
#include <kritaui_export.h>
class KisShapeController;
class KisNodeDummy;
class KisNodeInsertionAdapter;
class KisNodeGraphListener;
/**
* KisMimeData implements delayed retrieval of nodes for d&d and copy/paste.
*
* TODO: implement support for the ora format.
*/
class KRITAUI_EXPORT KisMimeData : public QMimeData
{
Q_OBJECT
public:
KisMimeData(QList<KisNodeSP> nodes, KisImageSP image, bool forceCopy = false);
/// return the node set on this mimedata object -- for internal use
QList<KisNodeSP> nodes() const;
/**
* For Cut/Copy/Paste operations we should detach the contents of
* the mime data from the actual image because the user can modify
* our image between the Copy/Cut and Paste calls. So we just copy
* all our nodes into the internal array.
*
* It also fixes the problem of Cutting group layers. If we don't copy
* the node and all its children, it'll be deleted by the Cut operation
* and we will not be able to paste it correctly later.
*/
void deepCopyNodes();
/**
* KisMimeData provides the following formats if a node has been set:
* <ul>
* <li>application/x-krita-node: requests a whole serialized node. For d&d between instances of Krita.
* <li>application/x-qt-image: fallback for other applications, returns a QImage of the
* current node's paintdevice
* <li>application/zip: allows drop targets that can handle zip files to open the data
* </ul>
*/
- QStringList formats() const;
+ QStringList formats() const override;
/**
* Loads a node from a mime container
* Supports application/x-krita-node and image types.
*/
static KisNodeList loadNodes(const QMimeData *data,
const QRect &imageBounds,
const QPoint &preferredCenter,
bool forceRecenter,
KisImageWSP image,
KisShapeController *shapeController);
private:
/**
* Try load the node, which belongs to the same Krita instance,
* that is can be fetched without serialization
*/
static KisNodeList tryLoadInternalNodes(const QMimeData *data,
KisImageSP image,
KisShapeController *shapeController,
bool /* IN-OUT */ &copyNode);
public:
static QMimeData* mimeForLayers(const KisNodeList &nodes, KisImageSP image, bool forceCopy = false);
static QMimeData* mimeForLayersDeepCopy(const KisNodeList &nodes, KisImageSP image, bool forceCopy);
static bool insertMimeLayers(const QMimeData *data,
KisImageSP image,
KisShapeController *shapeController,
KisNodeDummy *parentDummy,
KisNodeDummy *aboveThisDummy,
bool copyNode,
KisNodeInsertionAdapter *nodeInsertionAdapter);
protected:
- QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const;
+ QVariant retrieveData(const QString &mimetype, QVariant::Type preferredType) const override;
private:
static void initializeExternalNode(KisNodeSP *nodes,
KisImageWSP image,
KisShapeController *shapeController);
private:
QList<KisNodeSP> m_nodes;
bool m_forceCopy;
KisImageSP m_image;
};
#endif // KIS_MIMEDATA_H
diff --git a/libs/ui/kis_mirror_manager.h b/libs/ui/kis_mirror_manager.h
index 065d0113e7..ed915bc983 100644
--- a/libs/ui/kis_mirror_manager.h
+++ b/libs/ui/kis_mirror_manager.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MIRROR_MANAGER_H
#define KIS_MIRROR_MANAGER_H
#include <QObject>
#include <QPointer>
#include "KisView.h"
class KisViewManager;
class KActionCollection;
class KisMirrorAxis;
class KisMirrorManager : public QObject
{
Q_OBJECT
public:
KisMirrorManager(KisViewManager* view);
- virtual ~KisMirrorManager();
+ ~KisMirrorManager() override;
void setup(KActionCollection* collection);
void setView(QPointer<KisView> imageView);
private Q_SLOTS:
void updateAction();
private:
QPointer<KisView> m_imageView;
QAction *m_mirrorCanvas;
KisMirrorAxis* hasDecoration();
};
#endif // KIS_PAINTING_ASSISTANTS_MANAGER_H
diff --git a/libs/ui/kis_model_index_converter.h b/libs/ui/kis_model_index_converter.h
index 491c5951ef..1cd034ab05 100644
--- a/libs/ui/kis_model_index_converter.h
+++ b/libs/ui/kis_model_index_converter.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MODEL_INDEX_CONVERTER_H
#define __KIS_MODEL_INDEX_CONVERTER_H
#include "kis_model_index_converter_base.h"
class KisDummiesFacadeBase;
class KisNodeModel;
/**
* The class for converting to/from QModelIndex and KisNodeDummy when
* the root node is *hidden* (ShowRootLayer == *false*). All the selection
* masks owned by the root layer are hidden as well.
*/
class KRITAUI_EXPORT KisModelIndexConverter : public KisModelIndexConverterBase
{
public:
KisModelIndexConverter(KisDummiesFacadeBase *dummiesFacade,
KisNodeModel *model,
bool showGlobalSelection);
- KisNodeDummy* dummyFromRow(int row, QModelIndex parent);
- KisNodeDummy* dummyFromIndex(QModelIndex index);
+ KisNodeDummy* dummyFromRow(int row, QModelIndex parent) override;
+ KisNodeDummy* dummyFromIndex(QModelIndex index) override;
- QModelIndex indexFromDummy(KisNodeDummy *dummy);
+ QModelIndex indexFromDummy(KisNodeDummy *dummy) override;
bool indexFromAddedDummy(KisNodeDummy *parentDummy, int index,
const QString &newNodeMetaObjectType,
- QModelIndex &parentIndex, int &row);
+ QModelIndex &parentIndex, int &row) override;
- int rowCount(QModelIndex parent);
+ int rowCount(QModelIndex parent) override;
private:
inline bool checkDummyType(KisNodeDummy *dummy);
inline bool checkDummyMetaObjectType(const QString &type);
private:
KisDummiesFacadeBase *m_dummiesFacade;
KisNodeModel *m_model;
bool m_showGlobalSelection;
};
#endif /* __KIS_MODEL_INDEX_CONVERTER_H */
diff --git a/libs/ui/kis_model_index_converter_show_all.h b/libs/ui/kis_model_index_converter_show_all.h
index 4bca30e431..6192568756 100644
--- a/libs/ui/kis_model_index_converter_show_all.h
+++ b/libs/ui/kis_model_index_converter_show_all.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MODEL_INDEX_CONVERTER_SHOW_ALL_H
#define __KIS_MODEL_INDEX_CONVERTER_SHOW_ALL_H
#include "kis_model_index_converter_base.h"
class KisDummiesFacadeBase;
class KisNodeModel;
/**
* The class for converting to/from QModelIndex and KisNodeDummy when
* the root node is *shown* (ShowRootLayer == *true*). The selection
* masks owned by the root layer are shown as well.
*/
class KRITAUI_EXPORT KisModelIndexConverterShowAll : public KisModelIndexConverterBase
{
public:
KisModelIndexConverterShowAll(KisDummiesFacadeBase *dummiesFacade,
KisNodeModel *model);
- KisNodeDummy* dummyFromRow(int row, QModelIndex parent);
- KisNodeDummy* dummyFromIndex(QModelIndex index);
+ KisNodeDummy* dummyFromRow(int row, QModelIndex parent) override;
+ KisNodeDummy* dummyFromIndex(QModelIndex index) override;
- QModelIndex indexFromDummy(KisNodeDummy *dummy);
+ QModelIndex indexFromDummy(KisNodeDummy *dummy) override;
bool indexFromAddedDummy(KisNodeDummy *parentDummy, int index,
const QString &newNodeMetaObjectType,
- QModelIndex &parentIndex, int &row);
+ QModelIndex &parentIndex, int &row) override;
- int rowCount(QModelIndex parent);
+ int rowCount(QModelIndex parent) override;
private:
KisDummiesFacadeBase *m_dummiesFacade;
KisNodeModel *m_model;
};
#endif /* __KIS_MODEL_INDEX_CONVERTER_SHOW_ALL_H */
diff --git a/libs/ui/kis_multinode_property.h b/libs/ui/kis_multinode_property.h
index f20564f85f..56ca1898f9 100644
--- a/libs/ui/kis_multinode_property.h
+++ b/libs/ui/kis_multinode_property.h
@@ -1,648 +1,648 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_MULTINODE_PROPERTY_H
#define __KIS_MULTINODE_PROPERTY_H
#include <QObject>
#include <QCheckBox>
#include <QPointer>
#include <QRegExp>
#include <QBitArray>
#include <kundo2command.h>
#include <KoColorSpace.h>
#include <KoChannelInfo.h>
#include "kis_node.h"
#include "kis_layer.h"
#include "kis_layer_utils.h"
#include "kritaui_export.h"
class KisMultinodePropertyInterface;
class MultinodePropertyBaseConnector;
template <class PropertyAdapter> class MultinodePropertyBoolConnector;
template <class PropertyAdapter> class KisMultinodeProperty;
/******************************************************************/
/* Adapters */
/******************************************************************/
struct BaseAdapter {
static KisNodeList filterNodes(KisNodeList nodes) { return nodes; }
void setNumNodes(int numNodes) { m_numNodes = numNodes; }
int m_numNodes = 0;
};
struct CompositeOpAdapter : public BaseAdapter {
typedef QString ValueType;
typedef MultinodePropertyBaseConnector ConnectorType;
static const bool forceIgnoreByDefault = false;
static ValueType propForNode(KisNodeSP node) {
return node->compositeOpId();
}
static void setPropForNode(KisNodeSP node, const ValueType &value, int index) {
Q_UNUSED(index);
node->setCompositeOpId(value);
}
};
struct NameAdapter : public BaseAdapter {
typedef QString ValueType;
typedef MultinodePropertyBaseConnector ConnectorType;
static const bool forceIgnoreByDefault = true;
ValueType propForNode(KisNodeSP node) {
return m_numNodes == 1 ? node->name() : stripName(node->name());
}
void setPropForNode(KisNodeSP node, const ValueType &value, int index) {
QString name;
if (index < 0 || m_numNodes == 1) {
name = value;
} else {
name = QString("%1 %2").arg(stripName(value)).arg(index);
}
node->setName(name);
}
private:
static QString stripName(QString name) {
QRegExp rexp("^(.+) (\\d{1,3})$");
int pos = rexp.indexIn(name);
if (pos > -1) {
name = rexp.cap(1);
}
return name;
}
};
struct ColorLabelAdapter : public BaseAdapter {
typedef int ValueType;
typedef MultinodePropertyBaseConnector ConnectorType;
static const bool forceIgnoreByDefault = false;
static ValueType propForNode(KisNodeSP node) {
return node->colorLabelIndex();
}
static void setPropForNode(KisNodeSP node, const ValueType &value, int index) {
Q_UNUSED(index);
node->setColorLabelIndex(value);
}
};
struct OpacityAdapter : public BaseAdapter {
typedef int ValueType;
typedef MultinodePropertyBaseConnector ConnectorType;
static const bool forceIgnoreByDefault = false;
static ValueType propForNode(KisNodeSP node) {
return qRound(node->opacity() / 255.0 * 100);
}
static void setPropForNode(KisNodeSP node, const ValueType &value, int index) {
Q_UNUSED(index);
node->setOpacity(qRound(value * 255.0 / 100));
}
};
inline uint qHash(const KisBaseNode::Property &prop, uint seed = 0) {
return qHash(prop.name, seed);
}
struct LayerPropertyAdapter : public BaseAdapter {
typedef bool ValueType;
typedef MultinodePropertyBoolConnector<LayerPropertyAdapter> ConnectorType;
static const bool forceIgnoreByDefault = false;
LayerPropertyAdapter(const QString &propName) : m_propName(propName) {}
ValueType propForNode(KisNodeSP node) {
KisBaseNode::PropertyList props = node->sectionModelProperties();
Q_FOREACH (const KisBaseNode::Property &prop, props) {
if (prop.name == m_propName) {
return prop.state.toBool();
}
}
return false;
}
void setPropForNode(KisNodeSP node, const ValueType &value, int index) {
Q_UNUSED(index);
bool stateChanged = false;
KisBaseNode::PropertyList props = node->sectionModelProperties();
KisBaseNode::PropertyList::iterator it = props.begin();
KisBaseNode::PropertyList::iterator end = props.end();
for (; it != end; ++it) {
if (it->name == m_propName) {
it->state = value;
stateChanged = true;
break;
}
}
if (stateChanged) {
node->setSectionModelProperties(props);
}
}
QString name() const {
return m_propName;
}
static KisBaseNode::PropertyList adaptersList(KisNodeList nodes) {
QHash<KisBaseNode::Property, int> adapters;
Q_FOREACH (KisNodeSP node, nodes) {
int sortingIndex = 0;
KisBaseNode::PropertyList props = node->sectionModelProperties();
Q_FOREACH (const KisBaseNode::Property &prop, props) {
if (prop.state.type() != QVariant::Bool) continue;
if (!adapters.contains(prop)) {
adapters.insert(prop, sortingIndex);
} else {
adapters[prop] = qMin(adapters[prop], sortingIndex);
}
sortingIndex++;
}
}
QMultiMap<int, KisBaseNode::Property> sortedAdapters;
auto it = adapters.constBegin();
auto end = adapters.constEnd();
for (; it != end; ++it) {
sortedAdapters.insert(it.value(), it.key());
}
return sortedAdapters.values();
}
private:
QString m_propName;
};
struct ChannelFlagAdapter : public BaseAdapter {
typedef bool ValueType;
typedef MultinodePropertyBoolConnector<ChannelFlagAdapter> ConnectorType;
static const bool forceIgnoreByDefault = false;
struct Property {
Property(QString _name, int _channelIndex) : name(_name), channelIndex(_channelIndex) {}
QString name;
int channelIndex;
};
typedef QList<Property> PropertyList;
ChannelFlagAdapter(const Property &prop) : m_prop(prop) {}
ValueType propForNode(KisNodeSP node) {
KisLayerSP layer = toLayer(node);
Q_ASSERT(layer);
QBitArray flags = layer->channelFlags();
if (flags.isEmpty()) return true;
return flags.testBit(m_prop.channelIndex);
}
void setPropForNode(KisNodeSP node, const ValueType &value, int index) {
Q_UNUSED(index);
KisLayerSP layer = toLayer(node);
Q_ASSERT(layer);
QBitArray flags = layer->channelFlags();
if (flags.isEmpty()) {
flags = QBitArray(layer->colorSpace()->channelCount(), true);
}
if (flags.testBit(m_prop.channelIndex) != value) {
flags.setBit(m_prop.channelIndex, value);
layer->setChannelFlags(flags);
}
}
QString name() const {
return m_prop.name;;
}
static PropertyList adaptersList(KisNodeList nodes) {
PropertyList props;
{
bool nodesDiffer = KisLayerUtils::checkNodesDiffer<const KoColorSpace*>(nodes, [](KisNodeSP node) { return node->colorSpace(); });
if (nodesDiffer) {
return props;
}
}
QList<KoChannelInfo*> channels = nodes.first()->colorSpace()->channels();
int index = 0;
Q_FOREACH (KoChannelInfo *info, channels) {
props << Property(info->name(), index);
index++;
}
return props;
}
static KisNodeList filterNodes(KisNodeList nodes) {
KisNodeList filteredNodes;
Q_FOREACH (KisNodeSP node, nodes) {
if (toLayer(node)) {
filteredNodes << node;
}
}
return filteredNodes;
}
private:
static KisLayerSP toLayer(KisNodeSP node) {
return qobject_cast<KisLayer*>(node.data());
}
private:
Property m_prop;
};
/******************************************************************/
/* MultinodePropertyConnectorInterface */
/******************************************************************/
class KRITAUI_EXPORT MultinodePropertyConnectorInterface : public QObject
{
Q_OBJECT
public:
- virtual ~MultinodePropertyConnectorInterface();
+ ~MultinodePropertyConnectorInterface() override;
/**
* Public interface
*/
virtual void connectIgnoreCheckBox(QCheckBox *ignoreBox) = 0;
void connectValueChangedSignal(const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection);
/**
* Clicking on this widget will automatically enable it,
* setting "Ignored" property to false.
*
* Default implementation does nothing.
*/
virtual void connectAutoEnableWidget(QWidget *widget);
Q_SIGNALS:
void sigValueChanged();
protected Q_SLOTS:
virtual void slotIgnoreCheckBoxChanged(int state) = 0;
public:
/**
* Interface for KisMultinodeProperty's notifications
*/
virtual void notifyValueChanged();
virtual void notifyIgnoreChanged() = 0;
};
/******************************************************************/
/* MultinodePropertyBaseConnector */
/******************************************************************/
class KRITAUI_EXPORT MultinodePropertyBaseConnector : public MultinodePropertyConnectorInterface
{
public:
MultinodePropertyBaseConnector(KisMultinodePropertyInterface *parent);
- void connectIgnoreCheckBox(QCheckBox *ignoreBox);
- void notifyIgnoreChanged();
+ void connectIgnoreCheckBox(QCheckBox *ignoreBox) override;
+ void notifyIgnoreChanged() override;
- void connectAutoEnableWidget(QWidget *widget);
+ void connectAutoEnableWidget(QWidget *widget) override;
protected:
- void slotIgnoreCheckBoxChanged(int state);
+ void slotIgnoreCheckBoxChanged(int state) override;
private:
QPointer<QCheckBox> m_ignoreBox;
KisMultinodePropertyInterface *m_parent;
};
/******************************************************************/
/* MultinodePropertyBoolConnector */
/******************************************************************/
template <class PropertyAdapter>
class MultinodePropertyBoolConnector : public MultinodePropertyConnectorInterface
{
typedef KisMultinodeProperty<PropertyAdapter> PropertyType;
public:
MultinodePropertyBoolConnector(PropertyType *parent)
: m_parent(parent)
{
}
- void connectIgnoreCheckBox(QCheckBox *ignoreBox) {
+ void connectIgnoreCheckBox(QCheckBox *ignoreBox) override {
m_ignoreBox = ignoreBox;
if ((!m_parent->isIgnored() && !m_parent->savedValuesDiffer())
|| m_parent->haveTheOnlyNode()) {
m_ignoreBox->setTristate(false);
} else {
m_ignoreBox->setTristate(true);
}
connect(m_ignoreBox, SIGNAL(stateChanged(int)), SLOT(slotIgnoreCheckBoxChanged(int)));
}
- void notifyIgnoreChanged() {
+ void notifyIgnoreChanged() override {
// noop
}
- void notifyValueChanged() {
+ void notifyValueChanged() override {
if (m_ignoreBox) {
Qt::CheckState newState =
m_parent->isIgnored() ? Qt::PartiallyChecked :
bool(m_parent->value()) ? Qt::Checked :
Qt::Unchecked;
if (m_ignoreBox->checkState() != newState) {
m_ignoreBox->setCheckState(newState);
}
}
MultinodePropertyConnectorInterface::notifyValueChanged();
}
protected:
- void slotIgnoreCheckBoxChanged(int state) {
+ void slotIgnoreCheckBoxChanged(int state) override {
if (state == Qt::PartiallyChecked) {
m_parent->setIgnored(true);
} else {
m_parent->setIgnored(false);
m_parent->setValue(bool(state == Qt::Checked));
}
}
private:
QPointer<QCheckBox> m_ignoreBox;
PropertyType *m_parent;
};
/******************************************************************/
/* MultinodePropertyUndoCommand */
/******************************************************************/
template <class PropertyAdapter>
class MultinodePropertyUndoCommand : public KUndo2Command
{
public:
typedef typename PropertyAdapter::ValueType ValueType;
public:
MultinodePropertyUndoCommand(PropertyAdapter propAdapter,
KisNodeList nodes,
const QList<ValueType> &oldValues,
ValueType newValue,
KUndo2Command *parent = 0)
: KUndo2Command(parent),
m_propAdapter(propAdapter),
m_nodes(nodes),
m_oldValues(oldValues),
m_newValue(newValue)
{
}
- void undo() {
+ void undo() override {
int index = 0;
Q_FOREACH (KisNodeSP node, m_nodes) {
m_propAdapter.setPropForNode(node, m_oldValues[index], -1);
index++;
}
}
- void redo() {
+ void redo() override {
int index = 0;
Q_FOREACH (KisNodeSP node, m_nodes) {
m_propAdapter.setPropForNode(node, m_newValue, index);
index++;
}
}
private:
PropertyAdapter m_propAdapter;
KisNodeList m_nodes;
QList<ValueType> m_oldValues;
ValueType m_newValue;
};
/******************************************************************/
/* KisMultinodePropertyInterface */
/******************************************************************/
class KRITAUI_EXPORT KisMultinodePropertyInterface
{
public:
KisMultinodePropertyInterface();
virtual ~KisMultinodePropertyInterface();
virtual void rereadCurrentValue() = 0;
virtual void setIgnored(bool value) = 0;
virtual bool isIgnored() const = 0;
virtual bool savedValuesDiffer() const = 0;
virtual bool haveTheOnlyNode() const = 0;
virtual void connectValueChangedSignal(const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection) = 0;
virtual void connectIgnoreCheckBox(QCheckBox *ignoreBox) = 0;
virtual void connectAutoEnableWidget(QWidget *widget) = 0;
virtual KUndo2Command* createPostExecutionUndoCommand() = 0;
};
typedef QSharedPointer<KisMultinodePropertyInterface> KisMultinodePropertyInterfaceSP;
/******************************************************************/
/* KisMultinodeProperty */
/******************************************************************/
template <class PropertyAdapter>
class KisMultinodeProperty : public KisMultinodePropertyInterface
{
public:
typedef typename PropertyAdapter::ValueType ValueType;
typedef typename PropertyAdapter::ConnectorType ConnectorType;
public:
KisMultinodeProperty(KisNodeList nodes, PropertyAdapter adapter = PropertyAdapter())
: m_nodes(PropertyAdapter::filterNodes(nodes)),
m_savedValuesDiffer(false),
m_propAdapter(adapter),
m_connector(new ConnectorType(this))
{
Q_ASSERT(!m_nodes.isEmpty());
m_propAdapter.setNumNodes(m_nodes.size());
ValueType lastValue = m_propAdapter.propForNode(m_nodes.first());
Q_FOREACH (KisNodeSP node, m_nodes) {
ValueType value = m_propAdapter.propForNode(node);
m_savedValues.append(value);
if (value != lastValue) {
m_savedValuesDiffer = true;
}
lastValue = value;
}
m_isIgnored =
m_nodes.size() > 1 && PropertyAdapter::forceIgnoreByDefault ?
true : m_savedValuesDiffer;
m_currentValue = defaultValue();
}
- ~KisMultinodeProperty() {}
+ ~KisMultinodeProperty() override {}
- void rereadCurrentValue() {
+ void rereadCurrentValue() override {
if (m_isIgnored) return;
ValueType lastValue = m_propAdapter.propForNode(m_nodes.first());
Q_FOREACH (KisNodeSP node, m_nodes) {
ValueType value = m_propAdapter.propForNode(node);
if (value != lastValue) {
qWarning() << "WARNING: mutiprops: values differ after reread!";
}
lastValue = value;
}
if (lastValue != m_currentValue) {
m_currentValue = lastValue;
m_connector->notifyValueChanged();
}
}
void setValue(const ValueType &value) {
Q_ASSERT(!m_isIgnored);
if (value == m_currentValue) return;
int index = 0;
Q_FOREACH (KisNodeSP node, m_nodes) {
m_propAdapter.setPropForNode(node, value, index);
index++;
}
m_currentValue = value;
m_connector->notifyValueChanged();
}
ValueType value() const {
return m_currentValue;
}
- void setIgnored(bool value) {
+ void setIgnored(bool value) override {
if (value == m_isIgnored) return;
m_isIgnored = value;
if (m_isIgnored) {
int index = 0;
Q_FOREACH (KisNodeSP node, m_nodes) {
m_propAdapter.setPropForNode(node, m_savedValues[index], -1);
index++;
}
m_currentValue = defaultValue();
} else {
int index = 0;
Q_FOREACH (KisNodeSP node, m_nodes) {
m_propAdapter.setPropForNode(node, m_currentValue, index);
index++;
}
}
m_connector->notifyValueChanged();
m_connector->notifyIgnoreChanged();
}
- bool isIgnored() const {
+ bool isIgnored() const override {
return m_isIgnored;
}
- KUndo2Command* createPostExecutionUndoCommand() {
+ KUndo2Command* createPostExecutionUndoCommand() override {
KIS_ASSERT_RECOVER(!m_isIgnored) { return new KUndo2Command(); }
return new MultinodePropertyUndoCommand<PropertyAdapter>(m_propAdapter, m_nodes,
m_savedValues, m_currentValue);
}
// TODO: disconnect methods...
- void connectIgnoreCheckBox(QCheckBox *ignoreBox) {
+ void connectIgnoreCheckBox(QCheckBox *ignoreBox) override {
m_connector->connectIgnoreCheckBox(ignoreBox);
}
- void connectValueChangedSignal(const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection) {
+ void connectValueChangedSignal(const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection) override {
m_connector->connectValueChangedSignal(receiver, method, type);
}
- void connectAutoEnableWidget(QWidget *widget) {
+ void connectAutoEnableWidget(QWidget *widget) override {
m_connector->connectAutoEnableWidget(widget);
}
/**
* Interface for the connector
*/
- bool savedValuesDiffer() const {
+ bool savedValuesDiffer() const override {
return m_savedValuesDiffer;
}
- bool haveTheOnlyNode() const {
+ bool haveTheOnlyNode() const override {
return m_nodes.size() == 1;
}
private:
ValueType defaultValue() const {
return m_savedValues.first();
}
private:
bool m_isIgnored;
ValueType m_currentValue;
KisNodeList m_nodes;
QList<ValueType> m_savedValues;
bool m_savedValuesDiffer;
PropertyAdapter m_propAdapter;
QScopedPointer<MultinodePropertyConnectorInterface> m_connector;
};
typedef KisMultinodeProperty<CompositeOpAdapter> KisMultinodeCompositeOpProperty;
typedef KisMultinodeProperty<OpacityAdapter> KisMultinodeOpacityProperty;
typedef KisMultinodeProperty<NameAdapter> KisMultinodeNameProperty;
typedef KisMultinodeProperty<ColorLabelAdapter> KisMultinodeColorLabelProperty;
#endif /* __KIS_MULTINODE_PROPERTY_H */
diff --git a/libs/ui/kis_node_commands_adapter.h b/libs/ui/kis_node_commands_adapter.h
index e981c36001..56b6419310 100644
--- a/libs/ui/kis_node_commands_adapter.h
+++ b/libs/ui/kis_node_commands_adapter.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_COMMANDS_ADAPTER_H
#define KIS_NODE_COMMANDS_ADAPTER_H
class KisViewManager;
class KoCompositeOp;
class KUndo2MagicString;
#include <kis_types.h>
#include <kritaui_export.h>
#include <QObject>
/**
* This class allows the manipulation of nodes in a KisImage
* and creates commands as needed.
*/
class KRITAUI_EXPORT KisNodeCommandsAdapter : public QObject
{
Q_OBJECT
public:
KisNodeCommandsAdapter(KisViewManager * view);
- virtual ~KisNodeCommandsAdapter();
+ ~KisNodeCommandsAdapter() override;
public:
void beginMacro(const KUndo2MagicString& macroName);
void addExtraCommand(KUndo2Command *command);
void endMacro();
void addNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis, bool doRedoUpdates = true, bool doUndoUpdates = true);
void addNode(KisNodeSP node, KisNodeSP parent, quint32 index, bool doRedoUpdates = true, bool doUndoUpdates = true);
void moveNode(KisNodeSP node, KisNodeSP parent, KisNodeSP aboveThis);
void moveNode(KisNodeSP node, KisNodeSP parent, quint32 indexaboveThis);
void removeNode(KisNodeSP node);
void setOpacity(KisNodeSP node, qint32 opacity);
void setCompositeOp(KisNodeSP node, const KoCompositeOp* compositeOp);
void undoLastCommand();
private:
KisViewManager* m_view;
};
#endif // KIS_NODE_COMMANDS_ADAPTER_H
diff --git a/libs/ui/kis_node_filter_proxy_model.cpp b/libs/ui/kis_node_filter_proxy_model.cpp
index 4ce8118c79..e9218bd6bb 100644
--- a/libs/ui/kis_node_filter_proxy_model.cpp
+++ b/libs/ui/kis_node_filter_proxy_model.cpp
@@ -1,139 +1,164 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_node_filter_proxy_model.h"
#include <QSet>
#include "kis_node.h"
#include "kis_node_model.h"
#include "kis_node_manager.h"
#include "kis_signal_compressor.h"
#include "kis_image.h"
struct KisNodeFilterProxyModel::Private
{
- Private() : nodeModel(0), activeNodeCompressor(1000, KisSignalCompressor::FIRST_INACTIVE) {}
+ Private()
+ : nodeModel(0),
+ activeNodeCompressor(1000, KisSignalCompressor::FIRST_INACTIVE)
+ {}
KisNodeModel *nodeModel;
KisNodeSP pendingActiveNode;
KisNodeSP activeNode;
QSet<int> acceptedLabels;
KisSignalCompressor activeNodeCompressor;
+ bool isUpdatingFilter = false;
bool checkIndexAllowedRecursively(QModelIndex srcIndex);
};
KisNodeFilterProxyModel::KisNodeFilterProxyModel(QObject *parent)
: QSortFilterProxyModel(parent),
m_d(new Private)
{
connect(&m_d->activeNodeCompressor, SIGNAL(timeout()), SLOT(slotUpdateCurrentNodeFilter()));
}
KisNodeFilterProxyModel::~KisNodeFilterProxyModel()
{
}
void KisNodeFilterProxyModel::setNodeModel(KisNodeModel *model)
{
m_d->nodeModel = model;
setSourceModel(model);
}
+bool KisNodeFilterProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (m_d->isUpdatingFilter && role == KisNodeModel::ActiveRole) {
+ return false;
+ }
+
+ return QSortFilterProxyModel::setData(index, value, role);
+}
+
bool KisNodeFilterProxyModel::Private::checkIndexAllowedRecursively(QModelIndex srcIndex)
{
KisNodeSP node = nodeModel->nodeFromIndex(srcIndex);
if (node == activeNode ||
acceptedLabels.contains(node->colorLabelIndex())) {
return true;
}
bool result = false;
const int numChildren = srcIndex.model()->rowCount(srcIndex);
for (int i = 0; i < numChildren; i++) {
QModelIndex child = srcIndex.child(i, 0);
if (checkIndexAllowedRecursively(child)) {
result = true;
break;
}
}
return result;
}
bool KisNodeFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
KIS_ASSERT_RECOVER(m_d->nodeModel) { return true; }
const QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
KisNodeSP node = m_d->nodeModel->nodeFromIndex(index);
return !node ||
m_d->acceptedLabels.isEmpty() ||
m_d->checkIndexAllowedRecursively(index);
}
KisNodeSP KisNodeFilterProxyModel::nodeFromIndex(const QModelIndex &index) const
{
KIS_ASSERT_RECOVER(m_d->nodeModel) { return 0; }
QModelIndex srcIndex = mapToSource(index);
return m_d->nodeModel->nodeFromIndex(srcIndex);
}
QModelIndex KisNodeFilterProxyModel::indexFromNode(KisNodeSP node) const
{
KIS_ASSERT_RECOVER(m_d->nodeModel) { return QModelIndex(); }
QModelIndex srcIndex = m_d->nodeModel->indexFromNode(node);
return mapFromSource(srcIndex);
}
void KisNodeFilterProxyModel::setAcceptedLabels(const QList<int> &value)
{
m_d->acceptedLabels = QSet<int>::fromList(value);
invalidateFilter();
}
void KisNodeFilterProxyModel::setActiveNode(KisNodeSP node)
{
+ KIS_SAFE_ASSERT_RECOVER_RETURN(node);
m_d->pendingActiveNode = node;
if (node && indexFromNode(node).isValid()) {
m_d->activeNodeCompressor.start();
} else {
slotUpdateCurrentNodeFilter();
}
}
void KisNodeFilterProxyModel::slotUpdateCurrentNodeFilter()
{
m_d->activeNode = m_d->pendingActiveNode;
+
+ /**
+ * During the filter update the model might emit "current changed" signals,
+ * which (in their turn) will issue setData(..., KisNodeModel::ActiveRole)
+ * call, leading to a double recursion. Which, obviously, crashes Krita.
+ *
+ * Right now, just blocking the KisNodeModel::ActiveRole call is the
+ * most obvious solution for the problem.
+ */
+ m_d->isUpdatingFilter = true;
invalidateFilter();
+ m_d->isUpdatingFilter = false;
}
void KisNodeFilterProxyModel::unsetDummiesFacade()
{
m_d->nodeModel->setDummiesFacade(0, 0, 0, 0, 0);
m_d->pendingActiveNode = 0;
m_d->activeNode = 0;
}
diff --git a/libs/ui/kis_node_filter_proxy_model.h b/libs/ui/kis_node_filter_proxy_model.h
index efd325d70d..f7a56af662 100644
--- a/libs/ui/kis_node_filter_proxy_model.h
+++ b/libs/ui/kis_node_filter_proxy_model.h
@@ -1,60 +1,62 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_NODE_FILTER_PROXY_MODEL_H
#define __KIS_NODE_FILTER_PROXY_MODEL_H
#include <QScopedPointer>
#include <QSortFilterProxyModel>
#include "kis_types.h"
#include "kritaui_export.h"
class KisNodeModel;
class KisNodeDummy;
class KisNodeManager;
class KRITAUI_EXPORT KisNodeFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
KisNodeFilterProxyModel(QObject *parent);
- ~KisNodeFilterProxyModel();
+ ~KisNodeFilterProxyModel() override;
void setNodeModel(KisNodeModel *model);
- bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+
+ bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
void setAcceptedLabels(const QList<int> &value);
KisNodeSP nodeFromIndex(const QModelIndex &index) const;
QModelIndex indexFromNode(KisNodeSP node) const;
void unsetDummiesFacade();
public Q_SLOTS:
void setActiveNode(KisNodeSP node);
private Q_SLOTS:
void slotUpdateCurrentNodeFilter();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_NODE_FILTER_PROXY_MODEL_H */
diff --git a/libs/ui/kis_node_juggler_compressed.h b/libs/ui/kis_node_juggler_compressed.h
index ee5ab46218..8373cfb8a1 100644
--- a/libs/ui/kis_node_juggler_compressed.h
+++ b/libs/ui/kis_node_juggler_compressed.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_NODE_JUGGLER_COMPRESSED_H
#define __KIS_NODE_JUGGLER_COMPRESSED_H
#include <QObject>
#include <QScopedPointer>
#include <kritaui_export.h>
#include <kundo2command.h>
#include "kis_types.h"
#include "kis_node_manager.h"
class KRITAUI_EXPORT KisNodeJugglerCompressed : public QObject
{
Q_OBJECT
public:
KisNodeJugglerCompressed(const KUndo2MagicString &actionName, KisImageSP image, KisNodeManager *nodeManager, int timeout);
- ~KisNodeJugglerCompressed();
+ ~KisNodeJugglerCompressed() override;
void moveNode(KisNodeSP node, KisNodeSP parent, KisNodeSP above);
void setAutoDelete(bool value);
bool isEnded() const;
void lowerNode(const KisNodeList &nodes);
void raiseNode(const KisNodeList &nodes);
void removeNode(const KisNodeList &nodes);
void duplicateNode(const KisNodeList &nodes);
void copyNode(const KisNodeList &nodes, KisNodeSP dstParent, KisNodeSP dstAbove);
void moveNode(const KisNodeList &nodes, KisNodeSP dstParent, KisNodeSP dstAbove);
void addNode(const KisNodeList &nodes, KisNodeSP dstParent, KisNodeSP dstAbove);
bool canMergeAction(const KUndo2MagicString &actionName);
public Q_SLOTS:
void end();
private Q_SLOTS:
void startTimers();
void slotUpdateTimeout();
void slotEndStrokeRequested();
void slotCancelStrokeRequested();
void slotImageAboutToBeDeleted();
Q_SIGNALS:
void requestUpdateAsyncFromCommand();
private:
void cleanup();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_NODE_JUGGLER_COMPRESSED_H */
diff --git a/libs/ui/kis_node_manager.h b/libs/ui/kis_node_manager.h
index 970ace32c0..6f22ce1e26 100644
--- a/libs/ui/kis_node_manager.h
+++ b/libs/ui/kis_node_manager.h
@@ -1,253 +1,253 @@
/*
* Copyright (C) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_MANAGER
#define KIS_NODE_MANAGER
#include <QObject>
#include <QList>
#include "kis_types.h"
#include <kritaui_export.h>
class KActionCollection;
class KoCompositeOp;
class KoColorSpace;
class KUndo2MagicString;
class KisFilterStrategy;
class KisViewManager;
class KisActionManager;
class KisView;
class KisNodeSelectionAdapter;
class KisNodeInsertionAdapter;
class KisNodeJugglerCompressed;
class KoProperties;
/**
* The node manager passes requests for new layers or masks on to the mask and layer
* managers.
*/
class KRITAUI_EXPORT KisNodeManager : public QObject
{
Q_OBJECT
public:
KisNodeManager(KisViewManager * view);
- ~KisNodeManager();
+ ~KisNodeManager() override;
void setView(QPointer<KisView>imageView);
Q_SIGNALS:
/// emitted whenever a node is selected.
void sigNodeActivated(KisNodeSP node);
/// emitted whenever a different layer is selected.
void sigLayerActivated(KisLayerSP layer);
/// for the layer box: this sets the current node in the layerbox
/// without telling the node manager that the node is activated,
/// preventing loops (I think...)
void sigUiNeedChangeActiveNode(KisNodeSP node);
void sigUiNeedChangeSelectedNodes(const KisNodeList &nodes);
public:
void setup(KActionCollection * collection, KisActionManager* actionManager);
void updateGUI();
/// Convenience function to get the active layer or mask
KisNodeSP activeNode();
/// convenience function to get the active layer. If a mask is
/// active, it's parent layer is the active layer.
KisLayerSP activeLayer();
/// Get the paint device the user wants to paint on now
KisPaintDeviceSP activePaintDevice();
/**
* @return the active color space used for composition, meaning the color space
* of the active mask, or the color space of the parent of the active layer
*/
const KoColorSpace* activeColorSpace();
/**
* Sets opacity for the node in a universal way (masks/layers)
*/
void setNodeOpacity(KisNodeSP node, qint32 opacity, bool finalChange);
/**
* Sets compositeOp for the node in a universal way (masks/layers)
*/
void setNodeCompositeOp(KisNodeSP node, const KoCompositeOp* compositeOp);
KisNodeList selectedNodes();
KisNodeSelectionAdapter* nodeSelectionAdapter() const;
KisNodeInsertionAdapter* nodeInsertionAdapter() const;
public Q_SLOTS:
/**
* Explicitly activates \p node
* The UI will be noticed that active node has been changed.
* Both sigNodeActivated and sigUiNeedChangeActiveNode are emitted.
*
* WARNING: normally you needn't call this method manually. It is
* automatically called when a node is added to the graph. If you
* have some special cases when you need to activate a node, consider
* adding them to KisDummiesFacadeBase instead. Calling this method
* directly should be the last resort.
*
* \see slotUiActivatedNode for comparison
*/
void slotNonUiActivatedNode(KisNodeSP node);
/**
* Activates \p node.
* All non-ui listeners are notified with sigNodeActivated,
* sigUiNeedChangeActiveNode is *not* emitted.
*
* \see activateNode
*/
void slotUiActivatedNode(KisNodeSP node);
/**
* Adds a list of nodes without searching appropriate position for
* it. You *must* ensure that the nodes are allowed to be added
* to the parent, otherwise you'll get an assert.
*/
void addNodesDirect(KisNodeList nodes, KisNodeSP parent, KisNodeSP aboveThis);
/**
* Moves a list of nodes without searching appropriate position
* for it. You *must* ensure that the nodes are allowed to be
* added to the parent, otherwise you'll get an assert.
*/
void moveNodesDirect(KisNodeList nodes, KisNodeSP parent, KisNodeSP aboveThis);
/**
* Copies a list of nodes without searching appropriate position
* for it. You *must* ensure that the nodes are allowed to be
* added to the parent, otherwise you'll get an assert.
*/
void copyNodesDirect(KisNodeList nodes, KisNodeSP parent, KisNodeSP aboveThis);
/**
* Create new layer from actually visible
*/
void createFromVisible();
void toggleIsolateActiveNode();
void toggleIsolateMode(bool checked);
void slotUpdateIsolateModeAction();
void slotTryFinishIsolatedMode();
void moveNodeAt(KisNodeSP node, KisNodeSP parent, int index);
void createNode(const QString& nodeType, bool quiet = false, KisPaintDeviceSP copyFrom = 0);
void convertNode(const QString &nodeType);
void nodesUpdated();
void nodeProperties(KisNodeSP node);
void nodeOpacityChanged(qreal opacity, bool finalChange);
void nodeCompositeOpChanged(const KoCompositeOp* op);
void duplicateActiveNode();
void removeNode();
void mirrorNodeX();
void mirrorNodeY();
void mirrorNode(KisNodeSP node, const KUndo2MagicString& commandName, Qt::Orientation orientation);
void activateNextNode();
void activatePreviousNode();
void switchToPreviouslyActiveNode();
/**
* move the active node up the nodestack.
*/
void raiseNode();
/**
* move the active node down the nodestack
*/
void lowerNode();
void rotate(double radians);
void rotate180();
void rotateLeft90();
void rotateRight90();
void saveNodeAsImage();
void slotSplitAlphaIntoMask();
void slotSplitAlphaWrite();
void slotSplitAlphaSaveMerged();
/**
* @brief slotSetSelectedNodes set the list of nodes selected in the layerbox. Selected nodes are not necessarily active nodes.
* @param nodes the selected nodes
*/
void slotSetSelectedNodes(const KisNodeList &nodes);
void slotImageRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes);
void cutLayersToClipboard();
void copyLayersToClipboard();
void pasteLayersFromClipboard();
void createQuickGroup();
void createQuickClippingGroup();
void quickUngroup();
void selectAllNodes();
void selectVisibleNodes();
void selectLockedNodes();
void selectInvisibleNodes();
void selectUnlockedNodes();
public:
void shear(double angleX, double angleY);
void scale(double sx, double sy, KisFilterStrategy *filterStrategy);
void removeSingleNode(KisNodeSP node);
KisLayerSP createPaintLayer();
private:
/**
* Scales opacity from the range 0...1
* to the integer range 0...255
*/
qint32 convertOpacityToInt(qreal opacity);
void removeSelectedNodes(KisNodeList selectedNodes);
void slotSomethingActivatedNodeImpl(KisNodeSP node);
void createQuickGroupImpl(KisNodeJugglerCompressed *juggler,
const QString &overrideGroupName,
KisNodeSP *newGroup,
KisNodeSP *newLastChild);
void selectLayersImpl(const KoProperties &props, const KoProperties &invertedProps);
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/kis_node_model.h b/libs/ui/kis_node_model.h
index dc6ca75d33..68ee5e21b2 100644
--- a/libs/ui/kis_node_model.h
+++ b/libs/ui/kis_node_model.h
@@ -1,168 +1,168 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_NODE_MODEL
#define KIS_NODE_MODEL
#include "kritaui_export.h"
#include <kis_types.h>
#include <QAbstractItemModel>
#include <QIcon>
#include <QList>
#include <QString>
#include <QVariant>
class KisDummiesFacadeBase;
class KisNodeDummy;
class KisShapeController;
class KisModelIndexConverterBase;
class KisNodeSelectionAdapter;
class KisNodeInsertionAdapter;
/**
* KisNodeModel offers a Qt model-view compatible view of the node
* hierarchy. The KisNodeView displays a thumbnail and a row of
* icon properties for every document section.
*
* Note that there's a discrepancy between the krita node tree model
* and the model Qt wants to see: we hide the root node from Qt.
*
* The node model also shows an inverse view of the layer tree: we want
* the first layer to show up at the bottom.
*
* See also the Qt documentation for QAbstractItemModel.
* This class extends that interface to provide a name and set of toggle
* properties (like visible, locked, selected.)
*
*/
class KRITAUI_EXPORT KisNodeModel : public QAbstractItemModel
{
Q_OBJECT
public:
/// Extensions to Qt::ItemDataRole.
enum ItemDataRole
{
/// Whether the section is the active one
ActiveRole = Qt::UserRole + 1,
/// A list of properties the part has.
PropertiesRole,
/// The aspect ratio of the section as a floating point value: width divided by height.
AspectRatioRole,
/// Use to communicate a progress report to the section delegate on an action (a value of -1 or a QVariant() disable the progress bar
ProgressRole,
/// Speacial activation role which is emitted when the user Atl-clicks on a section
/// The item is first activated with ActiveRole, then a separate AlternateActiveRole comes
AlternateActiveRole,
// When a layer is not (recursively) visible, then it should be gayed out
ShouldGrayOutRole,
// An index of a color label associated with the node
ColorLabelIndexRole,
/// This is to ensure that we can extend the data role in the future, since it's not possible to add a role after BeginThumbnailRole (due to "Hack")
ReservedRole = 99,
/**
* For values of BeginThumbnailRole or higher, a thumbnail of the layer of which neither dimension
* is larger than (int) value - (int) BeginThumbnailRole.
* This is a hack to work around the fact that Interview doesn't have a nice way to
* request thumbnails of arbitrary size.
*/
BeginThumbnailRole
};
public: // from QAbstractItemModel
KisNodeModel(QObject * parent);
- ~KisNodeModel();
+ ~KisNodeModel() override;
void setDummiesFacade(KisDummiesFacadeBase *dummiesFacade, KisImageWSP image, KisShapeController *shapeController, KisNodeSelectionAdapter *nodeSelectionAdapter, KisNodeInsertionAdapter *nodeInsertionAdapter);
KisNodeSP nodeFromIndex(const QModelIndex &index) const;
QModelIndex indexFromNode(KisNodeSP node) const;
bool showGlobalSelection() const;
public Q_SLOTS:
void setShowGlobalSelection(bool value);
public:
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- QStringList mimeTypes() const;
- QMimeData* mimeData(const QModelIndexList & indexes) const;
- bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
- Qt::DropActions supportedDragActions() const;
- Qt::DropActions supportedDropActions() const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &index) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ QStringList mimeTypes() const override;
+ QMimeData* mimeData(const QModelIndexList & indexes) const override;
+ bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) override;
+ Qt::DropActions supportedDragActions() const override;
+ Qt::DropActions supportedDropActions() const override;
bool hasDummiesFacade();
static bool belongsToIsolatedGroup(KisImageSP image, KisNodeSP node, KisDummiesFacadeBase *dummiesFacade);
Q_SIGNALS:
void toggleIsolateActiveNode();
protected Q_SLOTS:
void slotBeginInsertDummy(KisNodeDummy *parent, int index, const QString &metaObjectType);
void slotEndInsertDummy(KisNodeDummy *dummy);
void slotBeginRemoveDummy(KisNodeDummy *dummy);
void slotEndRemoveDummy();
void slotDummyChanged(KisNodeDummy *dummy);
void slotIsolatedModeChanged();
void updateSettings();
void processUpdateQueue();
void progressPercentageChanged(int, const KisNodeSP);
protected:
virtual KisModelIndexConverterBase *createIndexConverter();
KisModelIndexConverterBase *indexConverter() const;
KisDummiesFacadeBase *dummiesFacade() const;
private:
friend class KisModelIndexConverter;
friend class KisModelIndexConverterShowAll;
void connectDummy(KisNodeDummy *dummy, bool needConnect);
void connectDummies(KisNodeDummy *dummy, bool needConnect);
void resetIndexConverter();
void regenerateItems(KisNodeDummy *dummy);
bool belongsToIsolatedGroup(KisNodeSP node) const;
private:
struct Private;
Private * const m_d;
};
#endif
diff --git a/libs/ui/kis_node_view_visibility_delegate.h b/libs/ui/kis_node_view_visibility_delegate.h
index 1b16bd4f55..b5d8da9094 100644
--- a/libs/ui/kis_node_view_visibility_delegate.h
+++ b/libs/ui/kis_node_view_visibility_delegate.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_NODE_VIEW_VISIBILITY_DELEGATE_H
#define __KIS_NODE_VIEW_VISIBILITY_DELEGATE_H
#include <QAbstractItemDelegate>
class KisNodeViewVisibilityDelegate : public QAbstractItemDelegate
{
public:
KisNodeViewVisibilityDelegate(QObject *parent);
- ~KisNodeViewVisibilityDelegate();
+ ~KisNodeViewVisibilityDelegate() override;
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};
#endif /* __KIS_NODE_VIEW_VISIBILITY_DELEGATE_H */
diff --git a/libs/ui/kis_paint_ops_model.h b/libs/ui/kis_paint_ops_model.h
index b472440c06..7adf397e14 100644
--- a/libs/ui/kis_paint_ops_model.h
+++ b/libs/ui/kis_paint_ops_model.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PAINTOP_LIST_MODEL_H_
#define _KIS_PAINTOP_LIST_MODEL_H_
#include <QAbstractListModel>
#include <QPixmap>
#include <kritaui_export.h>
#include "kis_categorized_list_model.h"
#include <brushengine/kis_paintop_factory.h>
class KisPaintOpFactory;
struct KRITAUI_EXPORT KisPaintOpInfo
{
KisPaintOpInfo() { }
KisPaintOpInfo(const QString& _id, const QString& _name, const QString& _category, const QPixmap& _icon, qint32 _priority):
id(_id), name(_name), category(_category), icon(_icon), priority(_priority) { }
KisPaintOpInfo(const QString& _id):
id(_id) { }
bool operator==(const KisPaintOpInfo info) const{
return (info.id == id);
}
QString id;
QString name;
QString category;
QPixmap icon;
qint32 priority;
};
struct PaintOpInfoToQStringConverter {
QString operator() (const KisPaintOpInfo &info) {
return info.name;
}
};
typedef KisCategorizedListModel<KisPaintOpInfo, PaintOpInfoToQStringConverter> BasePaintOpCategorizedListModel;
class KRITAUI_EXPORT KisPaintOpListModel : public BasePaintOpCategorizedListModel
{
public:
KisPaintOpListModel(QObject *parent);
- virtual QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const override;
void fill(const QList<KisPaintOpFactory*>& list);
};
class KRITAUI_EXPORT KisSortedPaintOpListModel : public KisSortedCategorizedListModel<KisPaintOpListModel>
{
public:
KisSortedPaintOpListModel(QObject *parent)
: KisSortedCategorizedListModel<KisPaintOpListModel>(parent),
m_model(new KisPaintOpListModel(this))
{
initializeModel(m_model);
}
void fill(const QList<KisPaintOpFactory*> &list) {
m_model->fill(list);
}
protected:
- bool lessThan(const QModelIndex &left, const QModelIndex &right) const {
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const override {
return lessThanPriority(left, right, KisPaintOpFactory::categoryStable());
}
private:
KisPaintOpListModel *m_model;
};
#endif //_KIS_PAINTOP_LIST_MODEL_H_
diff --git a/libs/ui/kis_painting_assistant.h b/libs/ui/kis_painting_assistant.h
index 943aca293a..8e8765a148 100644
--- a/libs/ui/kis_painting_assistant.h
+++ b/libs/ui/kis_painting_assistant.h
@@ -1,175 +1,175 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PAINTING_ASSISTANT_H_
#define _KIS_PAINTING_ASSISTANT_H_
#include <QString>
#include <QPointF>
#include <QRect>
#include <QFile>
#include <QObject>
#include <kritaui_export.h>
#include <kis_shared.h>
class QPainter;
class QRect;
class QRectF;
class KoStore;
class KisCoordinatesConverter;
class KisCanvas2;
class QDomDocument;
class QDomElement;
#include <kis_shared_ptr.h>
#include <KoGenericRegistry.h>
class KisPaintingAssistantHandle;
typedef KisSharedPtr<KisPaintingAssistantHandle> KisPaintingAssistantHandleSP;
class KisPaintingAssistant;
class QPainterPath;
/**
* Represent an handle of the assistant, used to edit the parameters
* of an assistants. Handles can be shared between assistants.
*/
class KRITAUI_EXPORT KisPaintingAssistantHandle : public QPointF, public KisShared
{
friend class KisPaintingAssistant;
public:
KisPaintingAssistantHandle(double x, double y);
explicit KisPaintingAssistantHandle(QPointF p);
KisPaintingAssistantHandle(const KisPaintingAssistantHandle&);
~KisPaintingAssistantHandle();
void mergeWith(KisPaintingAssistantHandleSP);
QList<KisPaintingAssistantHandleSP> split();
void uncache();
KisPaintingAssistantHandle& operator=(const QPointF&);
void setType(char type);
char handleType();
private:
void registerAssistant(KisPaintingAssistant*);
void unregisterAssistant(KisPaintingAssistant*);
bool containsAssistant(KisPaintingAssistant*);
private:
struct Private;
Private* const d;
};
/**
* A KisPaintingAssistant is an object that assist the drawing on the canvas.
* With this class you can implement virtual equivalent to ruler or compas.
*/
class KRITAUI_EXPORT KisPaintingAssistant
{
public:
KisPaintingAssistant(const QString& id, const QString& name);
virtual ~KisPaintingAssistant();
const QString& id() const;
const QString& name() const;
bool snapping() const;//this returns whether or not the snapping is/should be active.
void setSnapping(bool set);
bool outline() const;//this returns whether or not the preview is/should be active.
void setOutline(bool set);
/**
* Adjust the position given in parameter.
* @param point the coordinates in point in the document reference
* @param strokeBegin the coordinates of the beginning of the stroke
*/
virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) = 0;
virtual void endStroke() { }
virtual QPointF buttonPosition() const = 0;
virtual int numHandles() const = 0;
void replaceHandle(KisPaintingAssistantHandleSP _handle, KisPaintingAssistantHandleSP _with);
void addHandle(KisPaintingAssistantHandleSP handle);
void addSideHandle(KisPaintingAssistantHandleSP handle);
virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter, bool cached = true,KisCanvas2 *canvas=0, bool assistantVisible=true, bool previewVisible=true);
void uncache();
const QList<KisPaintingAssistantHandleSP>& handles() const;
QList<KisPaintingAssistantHandleSP> handles();
const QList<KisPaintingAssistantHandleSP>& sideHandles() const;
QList<KisPaintingAssistantHandleSP> sideHandles();
QByteArray saveXml( QMap<KisPaintingAssistantHandleSP, int> &handleMap);
void loadXml(KoStore *store, QMap<int, KisPaintingAssistantHandleSP> &handleMap, QString path);
void saveXmlList(QDomDocument& doc, QDomElement& ssistantsElement, int count);
void findHandleLocation();
KisPaintingAssistantHandleSP oppHandleOne();
/**
* Get the topLeft, bottomLeft, topRight and BottomRight corners of the assistant
*/
const KisPaintingAssistantHandleSP topLeft() const;
KisPaintingAssistantHandleSP topLeft();
const KisPaintingAssistantHandleSP topRight() const;
KisPaintingAssistantHandleSP topRight();
const KisPaintingAssistantHandleSP bottomLeft() const;
KisPaintingAssistantHandleSP bottomLeft();
const KisPaintingAssistantHandleSP bottomRight() const;
KisPaintingAssistantHandleSP bottomRight();
const KisPaintingAssistantHandleSP topMiddle() const;
KisPaintingAssistantHandleSP topMiddle();
const KisPaintingAssistantHandleSP rightMiddle() const;
KisPaintingAssistantHandleSP rightMiddle();
const KisPaintingAssistantHandleSP leftMiddle() const;
KisPaintingAssistantHandleSP leftMiddle();
const KisPaintingAssistantHandleSP bottomMiddle() const;
KisPaintingAssistantHandleSP bottomMiddle();
public:
/**
* This will paint a path using a white and black colors.
*/
static void drawPath(QPainter& painter, const QPainterPath& path, bool drawActive=true);
static void drawPreview(QPainter& painter, const QPainterPath& path);
protected:
virtual QRect boundingRect() const;
virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) = 0;
void initHandles(QList<KisPaintingAssistantHandleSP> _handles);
QList<KisPaintingAssistantHandleSP> m_handles;
private:
struct Private;
Private* const d;
};
/**
* Allow to create a painting assistant.
*/
class KRITAUI_EXPORT KisPaintingAssistantFactory
{
public:
KisPaintingAssistantFactory();
virtual ~KisPaintingAssistantFactory();
virtual QString id() const = 0;
virtual QString name() const = 0;
virtual KisPaintingAssistant* createPaintingAssistant() const = 0;
};
class KRITAUI_EXPORT KisPaintingAssistantFactoryRegistry : public KoGenericRegistry<KisPaintingAssistantFactory*>
{
public:
KisPaintingAssistantFactoryRegistry();
- ~KisPaintingAssistantFactoryRegistry();
+ ~KisPaintingAssistantFactoryRegistry() override;
static KisPaintingAssistantFactoryRegistry* instance();
};
#endif
diff --git a/libs/ui/kis_painting_assistants_decoration.h b/libs/ui/kis_painting_assistants_decoration.h
index 3db3c77aaa..61362b9e92 100644
--- a/libs/ui/kis_painting_assistants_decoration.h
+++ b/libs/ui/kis_painting_assistants_decoration.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PAINTING_ASSISTANTS_MANAGER_H_
#define _KIS_PAINTING_ASSISTANTS_MANAGER_H_
#include <QPointF>
#include "canvas/kis_canvas_decoration.h"
#include "kis_painting_assistant.h"
#include <kritaui_export.h>
class KisView;
class KisPaintingAssistantsDecoration;
typedef KisSharedPtr<KisPaintingAssistantsDecoration> KisPaintingAssistantsDecorationSP;
/**
* This class hold a list of painting assistants.
*/
class KRITAUI_EXPORT KisPaintingAssistantsDecoration : public KisCanvasDecoration
{
Q_OBJECT
public:
KisPaintingAssistantsDecoration(QPointer<KisView> parent);
- ~KisPaintingAssistantsDecoration();
+ ~KisPaintingAssistantsDecoration() override;
void addAssistant(KisPaintingAssistantSP assistant);
void removeAssistant(KisPaintingAssistantSP assistant);
void removeAll();
QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
void endStroke();
QList<KisPaintingAssistantHandleSP> handles();
QList<KisPaintingAssistantSP> assistants();
/*sets whether the main assistant is visible*/
void setAssistantVisible(bool set);
/*sets whether the preview is visible*/
void setOutlineVisible(bool set);
/*sets whether we snap to only one assistant*/
void setOnlyOneAssistantSnap(bool assistant);
/*returns assistant visibility*/
bool assistantVisibility();
/*returns preview visibility*/
bool outlineVisibility();
/*uncache all assistants*/
void uncache();
Q_SIGNALS:
void assistantChanged();
public Q_SLOTS:
void toggleAssistantVisible();
void toggleOutlineVisible();
protected:
- void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas);
+ void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas) override;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/kis_painting_assistants_manager.h b/libs/ui/kis_painting_assistants_manager.h
index 8040ba8b60..aebf275cd9 100644
--- a/libs/ui/kis_painting_assistants_manager.h
+++ b/libs/ui/kis_painting_assistants_manager.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTING_ASSISTANTS_MANAGER_H
#define KIS_PAINTING_ASSISTANTS_MANAGER_H
#include <QObject>
#include <QPointer>
#include "KisView.h"
#include "kis_painting_assistants_decoration.h"
class KisViewManager;
class KisAction;
class KisActionManager;
class KisPaintingAssistantsManager : public QObject
{
Q_OBJECT
public:
KisPaintingAssistantsManager(KisViewManager* view);
- virtual ~KisPaintingAssistantsManager();
+ ~KisPaintingAssistantsManager() override;
void setup(KisActionManager* actionManager);
void setView(QPointer<KisView> imageView);
private Q_SLOTS:
void updateAction();
private:
KisPaintingAssistantsDecorationSP decoration();
QPointer<KisView> m_imageView;
KisAction* m_toggleAssistant;
KisAction* m_togglePreview;
};
#endif // KIS_PAINTING_ASSISTANTS_MANAGER_H
diff --git a/libs/ui/kis_paintop_box.cc b/libs/ui/kis_paintop_box.cc
index e7431a55ff..5e3c69954c 100644
--- a/libs/ui/kis_paintop_box.cc
+++ b/libs/ui/kis_paintop_box.cc
@@ -1,1317 +1,1324 @@
/*
* kis_paintop_box.cc - part of KImageShop/Krayon/Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2009-2011 Sven Langkamp (sven.langkamp@gmail.com)
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_paintop_box.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
#include <QPixmap>
#include <QWidgetAction>
#include <QApplication>
#include <QMenu>
#include <kis_debug.h>
#include <kactioncollection.h>
#include <kacceleratormanager.h>
#include <QKeySequence>
#include <kis_icon.h>
#include <KoColorSpace.h>
#include <KoCompositeOpRegistry.h>
#include <KoResourceSelector.h>
#include <KoResourceServerAdapter.h>
#include <KoToolManager.h>
#include <QTemporaryFile>
#include <KoColorSpaceRegistry.h>
#include <kis_paint_device.h>
#include <brushengine/kis_paintop_registry.h>
#include <brushengine/kis_paintop_preset.h>
#include <brushengine/kis_paintop_settings.h>
#include <brushengine/kis_paintop_settings_update_proxy.h>
#include <kis_config_widget.h>
#include <kis_image.h>
#include <kis_node.h>
#include <brushengine/kis_paintop_config_widget.h>
#include <kis_action.h>
#include "kis_canvas2.h"
#include "kis_node_manager.h"
#include "KisViewManager.h"
#include "kis_canvas_resource_provider.h"
#include "kis_resource_server_provider.h"
#include "kis_favorite_resource_manager.h"
#include "kis_config.h"
#include "widgets/kis_popup_button.h"
#include "widgets/kis_tool_options_popup.h"
#include "widgets/kis_paintop_presets_popup.h"
#include "widgets/kis_tool_options_popup.h"
#include "widgets/kis_paintop_presets_chooser_popup.h"
#include "widgets/kis_workspace_chooser.h"
#include "widgets/kis_paintop_list_widget.h"
#include "widgets/kis_slider_spin_box.h"
#include "widgets/kis_cmb_composite.h"
#include "widgets/kis_widget_chooser.h"
#include "tool/kis_tool.h"
#include "kis_signals_blocker.h"
#include "kis_action_manager.h"
#include "kis_highlighted_button.h"
typedef KoResourceServerSimpleConstruction<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServer;
typedef KoResourceServerAdapter<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServerAdapter;
KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *name)
: QWidget(parent)
, m_resourceProvider(view->resourceProvider())
, m_optionWidget(0)
, m_toolOptionsPopupButton(0)
, m_brushEditorPopupButton(0)
, m_presetSelectorPopupButton(0)
, m_toolOptionsPopup(0)
, m_viewManager(view)
, m_previousNode(0)
, m_currTabletToolID(KoInputDevice::invalid())
, m_presetsEnabled(true)
, m_blockUpdate(false)
, m_dirtyPresetsEnabled(false)
, m_eraserBrushSizeEnabled(false)
, m_eraserBrushOpacityEnabled(false)
{
Q_ASSERT(view != 0);
setObjectName(name);
KisConfig cfg;
m_dirtyPresetsEnabled = cfg.useDirtyPresets();
m_eraserBrushSizeEnabled = cfg.useEraserBrushSize();
m_eraserBrushOpacityEnabled = cfg.useEraserBrushOpacity();
KAcceleratorManager::setNoAccel(this);
setWindowTitle(i18n("Painter's Toolchest"));
KConfigGroup grp = KSharedConfig::openConfig()->group("krita").group("Toolbar BrushesAndStuff");
int iconsize = grp.readEntry("IconSize", 32);
if (!cfg.toolOptionsInDocker()) {
m_toolOptionsPopupButton = new KisPopupButton(this);
m_toolOptionsPopupButton->setIcon(KisIconUtils::loadIcon("configure"));
m_toolOptionsPopupButton->setToolTip(i18n("Tool Settings"));
m_toolOptionsPopupButton->setFixedSize(iconsize, iconsize);
}
m_brushEditorPopupButton = new KisPopupButton(this);
m_brushEditorPopupButton->setIcon(KisIconUtils::loadIcon("paintop_settings_02"));
m_brushEditorPopupButton->setToolTip(i18n("Edit brush settings"));
m_brushEditorPopupButton->setFixedSize(iconsize, iconsize);
m_presetSelectorPopupButton = new KisPopupButton(this);
m_presetSelectorPopupButton->setIcon(KisIconUtils::loadIcon("paintop_settings_01"));
m_presetSelectorPopupButton->setToolTip(i18n("Choose brush preset"));
m_presetSelectorPopupButton->setFixedSize(iconsize, iconsize);
m_eraseModeButton = new KisHighlightedToolButton(this);
m_eraseModeButton->setFixedSize(iconsize, iconsize);
m_eraseModeButton->setCheckable(true);
m_eraseAction = m_viewManager->actionManager()->createAction("erase_action");
m_eraseModeButton->setDefaultAction(m_eraseAction);
m_reloadButton = new QToolButton(this);
m_reloadButton->setFixedSize(iconsize, iconsize);
m_reloadAction = m_viewManager->actionManager()->createAction("reload_preset_action");
m_reloadButton->setDefaultAction(m_reloadAction);
m_alphaLockButton = new KisHighlightedToolButton(this);
m_alphaLockButton->setFixedSize(iconsize, iconsize);
m_alphaLockButton->setCheckable(true);
KisAction* alphaLockAction = m_viewManager->actionManager()->createAction("preserve_alpha");
m_alphaLockButton->setDefaultAction(alphaLockAction);
// pen pressure
m_disablePressureButton = new KisHighlightedToolButton(this);
m_disablePressureButton->setFixedSize(iconsize, iconsize);
m_disablePressureButton->setCheckable(true);
m_disablePressureAction = m_viewManager->actionManager()->createAction("disable_pressure");
m_disablePressureButton->setDefaultAction(m_disablePressureAction);
// horizontal and vertical mirror toolbar buttons
// mirror tool options for the X Mirror
QMenu *toolbarMenuXMirror = new QMenu();
KisAction* hideCanvasDecorationsX = m_viewManager->actionManager()->createAction("mirrorX-hideDecorations");
hideCanvasDecorationsX->setCheckable(true);
hideCanvasDecorationsX->setText(i18n("Hide Mirror Line"));
toolbarMenuXMirror->addAction(hideCanvasDecorationsX);
KisAction* lockActionX = m_viewManager->actionManager()->createAction("mirrorX-lock");
lockActionX->setText(i18n("Lock"));
lockActionX->setCheckable(true);
toolbarMenuXMirror->addAction(lockActionX);
KisAction* moveToCenterActionX = m_viewManager->actionManager()->createAction("mirrorX-moveToCenter");
moveToCenterActionX->setCheckable(false);
moveToCenterActionX->setText(i18n("Move to Canvas Center"));
toolbarMenuXMirror->addAction(moveToCenterActionX);
// mirror tool options for the Y Mirror
QMenu *toolbarMenuYMirror = new QMenu();
KisAction* hideCanvasDecorationsY = m_viewManager->actionManager()->createAction("mirrorY-hideDecorations");
hideCanvasDecorationsY->setCheckable(true);
hideCanvasDecorationsY->setText(i18n("Hide Mirror Line"));
toolbarMenuYMirror->addAction(hideCanvasDecorationsY);
KisAction* lockActionY = m_viewManager->actionManager()->createAction("mirrorY-lock");
lockActionY->setText(i18n("Lock"));
lockActionY->setCheckable(true);
toolbarMenuYMirror->addAction(lockActionY);
KisAction* moveToCenterActionY = m_viewManager->actionManager()->createAction("mirrorY-moveToCenter");
moveToCenterActionY->setCheckable(false);
moveToCenterActionY->setText(i18n("Move to Canvas Center"));
toolbarMenuYMirror->addAction(moveToCenterActionY);
// create horizontal and vertical mirror buttons
m_hMirrorButton = new KisHighlightedToolButton(this);
int menuPadding = 10;
m_hMirrorButton->setFixedSize(iconsize + menuPadding, iconsize);
m_hMirrorButton->setCheckable(true);
m_hMirrorAction = m_viewManager->actionManager()->createAction("hmirror_action");
m_hMirrorButton->setDefaultAction(m_hMirrorAction);
m_hMirrorButton->setMenu(toolbarMenuXMirror);
m_hMirrorButton->setPopupMode(QToolButton::MenuButtonPopup);
m_vMirrorButton = new KisHighlightedToolButton(this);
m_vMirrorButton->setFixedSize(iconsize + menuPadding, iconsize);
m_vMirrorButton->setCheckable(true);
m_vMirrorAction = m_viewManager->actionManager()->createAction("vmirror_action");
m_vMirrorButton->setDefaultAction(m_vMirrorAction);
m_vMirrorButton->setMenu(toolbarMenuYMirror);
m_vMirrorButton->setPopupMode(QToolButton::MenuButtonPopup);
// add connections for horizontal and mirrror buttons
connect(lockActionX, SIGNAL(toggled(bool)), this, SLOT(slotLockXMirrorToggle(bool)));
connect(lockActionY, SIGNAL(toggled(bool)), this, SLOT(slotLockYMirrorToggle(bool)));
connect(moveToCenterActionX, SIGNAL(triggered(bool)), this, SLOT(slotMoveToCenterMirrorX()));
connect(moveToCenterActionY, SIGNAL(triggered(bool)), this, SLOT(slotMoveToCenterMirrorY()));
connect(hideCanvasDecorationsX, SIGNAL(toggled(bool)), this, SLOT(slotHideDecorationMirrorX(bool)));
connect(hideCanvasDecorationsY, SIGNAL(toggled(bool)), this, SLOT(slotHideDecorationMirrorY(bool)));
const bool sliderLabels = cfg.sliderLabels();
int sliderWidth;
if (sliderLabels) {
sliderWidth = 150 * logicalDpiX() / 96;
}
else {
sliderWidth = 120 * logicalDpiX() / 96;
}
for (int i = 0; i < 3; ++i) {
m_sliderChooser[i] = new KisWidgetChooser(i + 1);
KisDoubleSliderSpinBox* slOpacity;
KisDoubleSliderSpinBox* slFlow;
KisDoubleSliderSpinBox* slSize;
if (sliderLabels) {
slOpacity = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("opacity");
slFlow = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("flow");
slSize = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("size");
slOpacity->setPrefix(QString("%1 ").arg(i18n("Opacity:")));
slFlow->setPrefix(QString("%1 ").arg(i18n("Flow:")));
slSize->setPrefix(QString("%1 ").arg(i18n("Size:")));
}
else {
slOpacity = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("opacity", i18n("Opacity:"));
slFlow = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("flow", i18n("Flow:"));
slSize = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("size", i18n("Size:"));
}
slOpacity->setRange(0.0, 1.0, 2);
slOpacity->setValue(1.0);
slOpacity->setSingleStep(0.05);
slOpacity->setMinimumWidth(qMax(sliderWidth, slOpacity->sizeHint().width()));
slOpacity->setFixedHeight(iconsize);
slOpacity->setBlockUpdateSignalOnDrag(true);
slFlow->setRange(0.0, 1.0, 2);
slFlow->setValue(1.0);
slFlow->setSingleStep(0.05);
slFlow->setMinimumWidth(qMax(sliderWidth, slFlow->sizeHint().width()));
slFlow->setFixedHeight(iconsize);
slFlow->setBlockUpdateSignalOnDrag(true);
slSize->setRange(0, cfg.readEntry("maximumBrushSize", 1000), 2);
slSize->setValue(100);
slSize->setSingleStep(1);
slSize->setExponentRatio(3.0);
slSize->setSuffix(i18n(" px"));
slSize->setMinimumWidth(qMax(sliderWidth, slSize->sizeHint().width()));
slSize->setFixedHeight(iconsize);
slSize->setBlockUpdateSignalOnDrag(true);
m_sliderChooser[i]->chooseWidget(cfg.toolbarSlider(i + 1));
}
m_cmbCompositeOp = new KisCompositeOpComboBox();
m_cmbCompositeOp->setFixedHeight(iconsize);
Q_FOREACH (KisAction * a, m_cmbCompositeOp->blendmodeActions()) {
m_viewManager->actionManager()->addAction(a->text(), a);
}
m_workspaceWidget = new KisPopupButton(this);
m_workspaceWidget->setIcon(KisIconUtils::loadIcon("view-choose"));
m_workspaceWidget->setToolTip(i18n("Choose workspace"));
m_workspaceWidget->setFixedSize(iconsize, iconsize);
m_workspaceWidget->setPopupWidget(new KisWorkspaceChooser(view));
QHBoxLayout* baseLayout = new QHBoxLayout(this);
m_paintopWidget = new QWidget(this);
baseLayout->addWidget(m_paintopWidget);
baseLayout->setSpacing(4);
baseLayout->setContentsMargins(0, 0, 0, 0);
m_layout = new QHBoxLayout(m_paintopWidget);
if (!cfg.toolOptionsInDocker()) {
m_layout->addWidget(m_toolOptionsPopupButton);
}
m_layout->addWidget(m_brushEditorPopupButton);
m_layout->addWidget(m_presetSelectorPopupButton);
m_layout->setSpacing(4);
m_layout->setContentsMargins(0, 0, 0, 0);
QWidget* compositeActions = new QWidget(this);
QHBoxLayout* compositeLayout = new QHBoxLayout(compositeActions);
compositeLayout->addWidget(m_cmbCompositeOp);
compositeLayout->addWidget(m_eraseModeButton);
compositeLayout->addWidget(m_alphaLockButton);
compositeLayout->setSpacing(4);
compositeLayout->setContentsMargins(0, 0, 0, 0);
compositeLayout->addWidget(m_reloadButton);
QWidgetAction * action;
action = new QWidgetAction(this);
view->actionCollection()->addAction("composite_actions", action);
action->setText(i18n("Brush composite"));
action->setDefaultWidget(compositeActions);
QWidget* compositePressure = new QWidget(this);
QHBoxLayout* pressureLayout = new QHBoxLayout(compositePressure);
pressureLayout->addWidget(m_disablePressureButton);
pressureLayout->setSpacing(4);
pressureLayout->setContentsMargins(0, 0, 0, 0);
action = new QWidgetAction(this);
view->actionCollection()->addAction("pressure_action", action);
action->setText(i18n("Pressure usage (small button)"));
action->setDefaultWidget(compositePressure);
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("brushslider1", action);
view->actionCollection()->addAction("brushslider1", action);
action->setDefaultWidget(m_sliderChooser[0]);
connect(action, SIGNAL(triggered()), m_sliderChooser[0], SLOT(showPopupWidget()));
connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_sliderChooser[0], SLOT(updateThemedIcons()));
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("brushslider2", action);
view->actionCollection()->addAction("brushslider2", action);
action->setDefaultWidget(m_sliderChooser[1]);
connect(action, SIGNAL(triggered()), m_sliderChooser[1], SLOT(showPopupWidget()));
connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_sliderChooser[1], SLOT(updateThemedIcons()));
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("brushslider3", action);
view->actionCollection()->addAction("brushslider3", action);
action->setDefaultWidget(m_sliderChooser[2]);
connect(action, SIGNAL(triggered()), m_sliderChooser[2], SLOT(showPopupWidget()));
connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_sliderChooser[2], SLOT(updateThemedIcons()));
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("next_favorite_preset", action);
view->actionCollection()->addAction("next_favorite_preset", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotNextFavoritePreset()));
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("previous_favorite_preset", action);
view->actionCollection()->addAction("previous_favorite_preset", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotPreviousFavoritePreset()));
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("previous_preset", action);
view->actionCollection()->addAction("previous_preset", action);
connect(action, SIGNAL(triggered()), this, SLOT(slotSwitchToPreviousPreset()));
if (!cfg.toolOptionsInDocker()) {
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("show_tool_options", action);
view->actionCollection()->addAction("show_tool_options", action);
connect(action, SIGNAL(triggered()), m_toolOptionsPopupButton, SLOT(showPopupWidget()));
}
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("show_brush_editor", action);
view->actionCollection()->addAction("show_brush_editor", action);
connect(action, SIGNAL(triggered()), m_brushEditorPopupButton, SLOT(showPopupWidget()));
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("show_brush_presets", action);
view->actionCollection()->addAction("show_brush_presets", action);
connect(action, SIGNAL(triggered()), m_presetSelectorPopupButton, SLOT(showPopupWidget()));
QWidget* mirrorActions = new QWidget(this);
QHBoxLayout* mirrorLayout = new QHBoxLayout(mirrorActions);
mirrorLayout->addWidget(m_hMirrorButton);
mirrorLayout->addWidget(m_vMirrorButton);
mirrorLayout->setSpacing(4);
mirrorLayout->setContentsMargins(0, 0, 0, 0);
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("mirror_actions", action);
action->setDefaultWidget(mirrorActions);
view->actionCollection()->addAction("mirror_actions", action);
action = new QWidgetAction(this);
KisActionRegistry::instance()->propertizeAction("workspaces", action);
view->actionCollection()->addAction("workspaces", action);
action->setDefaultWidget(m_workspaceWidget);
if (!cfg.toolOptionsInDocker()) {
m_toolOptionsPopup = new KisToolOptionsPopup();
m_toolOptionsPopupButton->setPopupWidget(m_toolOptionsPopup);
m_toolOptionsPopup->switchDetached(false);
}
m_presetsPopup = new KisPaintOpPresetsPopup(m_resourceProvider);
m_brushEditorPopupButton->setPopupWidget(m_presetsPopup);
m_presetsPopup->parentWidget()->setWindowTitle(i18n("Brush Editor"));
connect(m_presetsPopup, SIGNAL(brushEditorShown()), SLOT(slotUpdateOptionsWidgetPopup()));
connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_presetsPopup, SLOT(updateThemedIcons()));
m_presetsChooserPopup = new KisPaintOpPresetsChooserPopup();
m_presetSelectorPopupButton->setPopupWidget(m_presetsChooserPopup);
m_currCompositeOpID = KoCompositeOpRegistry::instance().getDefaultCompositeOp().id();
slotNodeChanged(view->activeNode());
// Get all the paintops
QList<QString> keys = KisPaintOpRegistry::instance()->keys();
QList<KisPaintOpFactory*> factoryList;
Q_FOREACH (const QString & paintopId, keys) {
factoryList.append(KisPaintOpRegistry::instance()->get(paintopId));
}
m_presetsPopup->setPaintOpList(factoryList);
connect(m_presetsPopup , SIGNAL(paintopActivated(QString)) , SLOT(slotSetPaintop(QString)));
connect(m_presetsPopup , SIGNAL(savePresetClicked()) , SLOT(slotSaveActivePreset()));
connect(m_presetsPopup , SIGNAL(defaultPresetClicked()) , SLOT(slotSetupDefaultPreset()));
connect(m_presetsPopup , SIGNAL(signalResourceSelected(KoResource*)), SLOT(resourceSelected(KoResource*)));
connect(m_presetsPopup , SIGNAL(reloadPresetClicked()) , SLOT(slotReloadPreset()));
connect(m_presetsPopup , SIGNAL(dirtyPresetToggled(bool)) , SLOT(slotDirtyPresetToggled(bool)));
connect(m_presetsPopup , SIGNAL(eraserBrushSizeToggled(bool)) , SLOT(slotEraserBrushSizeToggled(bool)));
connect(m_presetsPopup , SIGNAL(eraserBrushOpacityToggled(bool)) , SLOT(slotEraserBrushOpacityToggled(bool)));
connect(m_presetsChooserPopup, SIGNAL(resourceSelected(KoResource*)) , SLOT(resourceSelected(KoResource*)));
connect(m_presetsChooserPopup, SIGNAL(resourceClicked(KoResource*)) , SLOT(resourceSelected(KoResource*)));
connect(m_resourceProvider , SIGNAL(sigNodeChanged(const KisNodeSP)) , SLOT(slotNodeChanged(const KisNodeSP)));
connect(m_cmbCompositeOp , SIGNAL(currentIndexChanged(int)) , SLOT(slotSetCompositeMode(int)));
connect(m_eraseAction , SIGNAL(toggled(bool)) , SLOT(slotToggleEraseMode(bool)));
connect(alphaLockAction , SIGNAL(toggled(bool)) , SLOT(slotToggleAlphaLockMode(bool)));
connect(m_disablePressureAction , SIGNAL(toggled(bool)) , SLOT(slotDisablePressureMode(bool)));
m_disablePressureAction->setChecked(true);
connect(m_hMirrorAction , SIGNAL(toggled(bool)) , SLOT(slotHorizontalMirrorChanged(bool)));
connect(m_vMirrorAction , SIGNAL(toggled(bool)) , SLOT(slotVerticalMirrorChanged(bool)));
connect(m_reloadAction , SIGNAL(triggered()) , SLOT(slotReloadPreset()));
connect(m_sliderChooser[0]->getWidget<KisDoubleSliderSpinBox>("opacity"), SIGNAL(valueChanged(qreal)), SLOT(slotSlider1Changed()));
connect(m_sliderChooser[0]->getWidget<KisDoubleSliderSpinBox>("flow") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider1Changed()));
connect(m_sliderChooser[0]->getWidget<KisDoubleSliderSpinBox>("size") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider1Changed()));
connect(m_sliderChooser[1]->getWidget<KisDoubleSliderSpinBox>("opacity"), SIGNAL(valueChanged(qreal)), SLOT(slotSlider2Changed()));
connect(m_sliderChooser[1]->getWidget<KisDoubleSliderSpinBox>("flow") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider2Changed()));
connect(m_sliderChooser[1]->getWidget<KisDoubleSliderSpinBox>("size") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider2Changed()));
connect(m_sliderChooser[2]->getWidget<KisDoubleSliderSpinBox>("opacity"), SIGNAL(valueChanged(qreal)), SLOT(slotSlider3Changed()));
connect(m_sliderChooser[2]->getWidget<KisDoubleSliderSpinBox>("flow") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider3Changed()));
connect(m_sliderChooser[2]->getWidget<KisDoubleSliderSpinBox>("size") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider3Changed()));
//Needed to connect canvas to favorite resource manager
connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), SLOT(slotUnsetEraseMode()));
m_favoriteResourceManager = new KisFavoriteResourceManager(this);
connect(m_resourceProvider, SIGNAL(sigFGColorUsed(KoColor)), m_favoriteResourceManager, SLOT(slotAddRecentColor(KoColor)));
connect(m_resourceProvider, SIGNAL(sigFGColorChanged(KoColor)), m_favoriteResourceManager, SLOT(slotChangeFGColorSelector(KoColor)));
connect(m_resourceProvider, SIGNAL(sigBGColorChanged(KoColor)), m_favoriteResourceManager, SLOT(slotSetBGColor(KoColor)));
// cold initialization
m_favoriteResourceManager->slotChangeFGColorSelector(m_resourceProvider->fgColor());
m_favoriteResourceManager->slotSetBGColor(m_resourceProvider->bgColor());
connect(m_favoriteResourceManager, SIGNAL(sigSetFGColor(KoColor)), m_resourceProvider, SLOT(slotSetFGColor(KoColor)));
connect(m_favoriteResourceManager, SIGNAL(sigSetBGColor(KoColor)), m_resourceProvider, SLOT(slotSetBGColor(KoColor)));
connect(m_favoriteResourceManager, SIGNAL(sigEnableChangeColor(bool)), m_resourceProvider, SLOT(slotResetEnableFGChange(bool)));
connect(view->mainWindow(), SIGNAL(themeChanged()), this, SLOT(slotUpdateSelectionIcon()));
slotInputDeviceChanged(KoToolManager::instance()->currentInputDevice());
}
KisPaintopBox::~KisPaintopBox()
{
KisConfig cfg;
QMapIterator<TabletToolID, TabletToolData> iter(m_tabletToolMap);
while (iter.hasNext()) {
iter.next();
//qDebug() << "Writing last used preset for" << iter.key().pointer << iter.key().uniqueID << iter.value().preset->name();
if ((iter.key().pointer) == QTabletEvent::Eraser) {
cfg.writeEntry(QString("LastEraser_%1").arg(iter.key().uniqueID) , iter.value().preset->name());
}
else {
cfg.writeEntry(QString("LastPreset_%1").arg(iter.key().uniqueID) , iter.value().preset->name());
}
}
// Do not delete the widget, since it it is global to the application, not owned by the view
m_presetsPopup->setPaintOpSettingsWidget(0);
qDeleteAll(m_paintopOptionWidgets);
delete m_favoriteResourceManager;
for (int i = 0; i < 3; ++i) {
delete m_sliderChooser[i];
}
}
void KisPaintopBox::restoreResource(KoResource* resource)
{
KisPaintOpPreset* preset = dynamic_cast<KisPaintOpPreset*>(resource);
//qDebug() << "restoreResource" << resource << preset;
if (preset) {
setCurrentPaintop(preset);
m_presetsPopup->setPresetImage(preset->image());
m_presetsPopup->resourceSelected(resource);
}
}
void KisPaintopBox::newOptionWidgets(const QList<QPointer<QWidget> > &optionWidgetList)
{
if (m_toolOptionsPopup) {
m_toolOptionsPopup->newOptionWidgets(optionWidgetList);
}
}
void KisPaintopBox::resourceSelected(KoResource* resource)
{
KisPaintOpPreset* preset = dynamic_cast<KisPaintOpPreset*>(resource);
if (preset && preset != m_resourceProvider->currentPreset()) {
if (!preset->settings()->isLoadable())
return;
if (!m_dirtyPresetsEnabled) {
KisSignalsBlocker blocker(m_optionWidget);
if (!preset->load()) {
warnKrita << "failed to load the preset.";
}
}
//qDebug() << "resourceSelected" << resource->name();
setCurrentPaintop(preset);
m_presetsPopup->setPresetImage(preset->image());
m_presetsPopup->resourceSelected(resource);
}
}
void KisPaintopBox::setCurrentPaintop(const KoID& paintop)
{
KisPaintOpPresetSP preset = activePreset(paintop);
Q_ASSERT(preset && preset->settings());
//qDebug() << "setCurrentPaintop();" << paintop << preset;
setCurrentPaintop(preset);
}
void KisPaintopBox::setCurrentPaintop(KisPaintOpPresetSP preset)
{
//qDebug() << "setCurrentPaintop(); " << preset->name();
if (preset == m_resourceProvider->currentPreset()) {
if (preset == m_tabletToolMap[m_currTabletToolID].preset) {
return;
}
}
Q_ASSERT(preset);
const KoID& paintop = preset->paintOp();
m_presetConnections.clear();
if (m_resourceProvider->currentPreset()) {
m_resourceProvider->setPreviousPaintOpPreset(m_resourceProvider->currentPreset());
if (m_optionWidget) {
m_optionWidget->hide();
}
}
if (!m_paintopOptionWidgets.contains(paintop))
m_paintopOptionWidgets[paintop] = KisPaintOpRegistry::instance()->get(paintop.id())->createConfigWidget(this);
m_optionWidget = m_paintopOptionWidgets[paintop];
KisSignalsBlocker b(m_optionWidget);
preset->setOptionsWidget(m_optionWidget);
m_optionWidget->setImage(m_viewManager->image());
m_optionWidget->setNode(m_viewManager->activeNode());
m_presetsPopup->setPaintOpSettingsWidget(m_optionWidget);
m_resourceProvider->setPaintOpPreset(preset);
Q_ASSERT(m_optionWidget && m_presetSelectorPopupButton);
m_presetConnections.addConnection(m_optionWidget, SIGNAL(sigConfigurationUpdated()), this, SLOT(slotGuiChangedCurrentPreset()));
m_presetConnections.addConnection(m_optionWidget, SIGNAL(sigSaveLockedConfig(KisPropertiesConfigurationSP)), this, SLOT(slotSaveLockedOptionToPreset(KisPropertiesConfigurationSP)));
m_presetConnections.addConnection(m_optionWidget, SIGNAL(sigDropLockedConfig(KisPropertiesConfigurationSP)), this, SLOT(slotDropLockedOption(KisPropertiesConfigurationSP)));
// load the current brush engine icon for the brush editor toolbar button
KisPaintOpFactory* paintOp = KisPaintOpRegistry::instance()->get(paintop.id());
QString pixFilename = KoResourcePaths::findResource("kis_images", paintOp->pixmap());
m_brushEditorPopupButton->setIcon(QIcon(pixFilename));
m_presetsPopup->setCurrentPaintOpId(paintop.id());
////qDebug() << "\tsetting the new preset for" << m_currTabletToolID.uniqueID << "to" << preset->name();
m_paintOpPresetMap[m_resourceProvider->currentPreset()->paintOp()] = preset;
m_tabletToolMap[m_currTabletToolID].preset = preset;
m_tabletToolMap[m_currTabletToolID].paintOpID = preset->paintOp();
if (m_presetsPopup->currentPaintOpId() != paintop.id()) {
// Must change the paintop as the current one is not supported
// by the new colorspace.
dbgKrita << "current paintop " << paintop.name() << " was not set, not supported by colorspace";
}
}
void KisPaintopBox::slotUpdateOptionsWidgetPopup()
{
KisPaintOpPresetSP preset = m_resourceProvider->currentPreset();
KIS_SAFE_ASSERT_RECOVER_RETURN(preset);
KIS_SAFE_ASSERT_RECOVER_RETURN(m_optionWidget);
m_optionWidget->setConfigurationSafe(preset->settings());
m_presetsPopup->resourceSelected(preset.data());
m_presetsPopup->updateViewSettings();
// the m_viewManager->image() is set earlier, but the reference will be missing when the stamp button is pressed
// need to later do some research on how and when we should be using weak shared pointers (WSP) that creates this situation
m_optionWidget->setImage(m_viewManager->image());
}
KisPaintOpPresetSP KisPaintopBox::defaultPreset(const KoID& paintOp)
{
QString defaultName = paintOp.id() + ".kpp";
QString path = KoResourcePaths::findResource("kis_defaultpresets", defaultName);
KisPaintOpPresetSP preset = new KisPaintOpPreset(path);
if (!preset->load()) {
preset = KisPaintOpRegistry::instance()->defaultPreset(paintOp);
}
Q_ASSERT(preset);
Q_ASSERT(preset->valid());
return preset;
}
KisPaintOpPresetSP KisPaintopBox::activePreset(const KoID& paintOp)
{
if (m_paintOpPresetMap[paintOp] == 0) {
m_paintOpPresetMap[paintOp] = defaultPreset(paintOp);
}
return m_paintOpPresetMap[paintOp];
}
void KisPaintopBox::updateCompositeOp(QString compositeOpID)
{
if (!m_optionWidget) return;
KisSignalsBlocker blocker(m_optionWidget);
KisNodeSP node = m_resourceProvider->currentNode();
if (node && node->paintDevice()) {
if (!node->paintDevice()->colorSpace()->hasCompositeOp(compositeOpID))
compositeOpID = KoCompositeOpRegistry::instance().getDefaultCompositeOp().id();
{
KisSignalsBlocker b1(m_cmbCompositeOp);
m_cmbCompositeOp->selectCompositeOp(KoID(compositeOpID));
}
if (compositeOpID != m_currCompositeOpID) {
m_currCompositeOpID = compositeOpID;
}
if (compositeOpID == COMPOSITE_ERASE) {
m_eraseModeButton->setChecked(true);
}
else {
m_eraseModeButton->setChecked(false);
}
}
}
void KisPaintopBox::setWidgetState(int flags)
{
if (flags & (ENABLE_COMPOSITEOP | DISABLE_COMPOSITEOP)) {
m_cmbCompositeOp->setEnabled(flags & ENABLE_COMPOSITEOP);
m_eraseModeButton->setEnabled(flags & ENABLE_COMPOSITEOP);
}
if (flags & (ENABLE_PRESETS | DISABLE_PRESETS)) {
m_presetSelectorPopupButton->setEnabled(flags & ENABLE_PRESETS);
m_brushEditorPopupButton->setEnabled(flags & ENABLE_PRESETS);
}
for (int i = 0; i < 3; ++i) {
if (flags & (ENABLE_OPACITY | DISABLE_OPACITY))
m_sliderChooser[i]->getWidget("opacity")->setEnabled(flags & ENABLE_OPACITY);
if (flags & (ENABLE_FLOW | DISABLE_FLOW))
m_sliderChooser[i]->getWidget("flow")->setEnabled(flags & ENABLE_FLOW);
if (flags & (ENABLE_SIZE | DISABLE_SIZE))
m_sliderChooser[i]->getWidget("size")->setEnabled(flags & ENABLE_SIZE);
}
}
void KisPaintopBox::setSliderValue(const QString& sliderID, qreal value)
{
for (int i = 0; i < 3; ++i) {
KisDoubleSliderSpinBox* slider = m_sliderChooser[i]->getWidget<KisDoubleSliderSpinBox>(sliderID);
KisSignalsBlocker b(slider);
slider->setValue(value);
}
}
void KisPaintopBox::slotSetPaintop(const QString& paintOpId)
{
if (KisPaintOpRegistry::instance()->get(paintOpId) != 0) {
KoID id(paintOpId, KisPaintOpRegistry::instance()->get(paintOpId)->name());
//qDebug() << "slotsetpaintop" << id;
setCurrentPaintop(id);
}
}
void KisPaintopBox::slotInputDeviceChanged(const KoInputDevice& inputDevice)
{
TabletToolMap::iterator toolData = m_tabletToolMap.find(inputDevice);
//qDebug() << "slotInputDeviceChanged()" << inputDevice.device() << inputDevice.uniqueTabletId();
m_currTabletToolID = TabletToolID(inputDevice);
if (toolData == m_tabletToolMap.end()) {
KisConfig cfg;
KisPaintOpPresetResourceServer *rserver = KisResourceServerProvider::instance()->paintOpPresetServer(false);
KisPaintOpPresetSP preset;
if (inputDevice.pointer() == QTabletEvent::Eraser) {
preset = rserver->resourceByName(cfg.readEntry<QString>(QString("LastEraser_%1").arg(inputDevice.uniqueTabletId()), "Eraser_circle"));
}
else {
preset = rserver->resourceByName(cfg.readEntry<QString>(QString("LastPreset_%1").arg(inputDevice.uniqueTabletId()), "Basic_tip_default"));
//if (preset)
//qDebug() << "found stored preset " << preset->name() << "for" << inputDevice.uniqueTabletId();
//else
//qDebug() << "no preset fcound for" << inputDevice.uniqueTabletId();
}
if (!preset) {
preset = rserver->resourceByName("Basic_tip_default");
}
if (preset) {
//qDebug() << "inputdevicechanged 1" << preset;
setCurrentPaintop(preset);
}
}
else {
if (toolData->preset) {
//qDebug() << "inputdevicechanged 2" << toolData->preset;
setCurrentPaintop(toolData->preset);
}
else {
//qDebug() << "inputdevicechanged 3" << toolData->paintOpID;
setCurrentPaintop(toolData->paintOpID);
}
}
}
void KisPaintopBox::slotCanvasResourceChanged(int key, const QVariant &value)
{
if (m_viewManager) {
sender()->blockSignals(true);
KisPaintOpPresetSP preset = m_viewManager->resourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentPaintOpPreset).value<KisPaintOpPresetSP>();
if (preset && m_resourceProvider->currentPreset()->name() != preset->name()) {
QString compositeOp = preset->settings()->getString("CompositeOp");
updateCompositeOp(compositeOp);
resourceSelected(preset.data());
}
/**
* Update currently selected preset in both the popup widgets
*/
m_presetsChooserPopup->canvasResourceChanged(preset);
m_presetsPopup->currentPresetChanged(preset);
if (key == KisCanvasResourceProvider::CurrentCompositeOp) {
if (m_resourceProvider->currentCompositeOp() != m_currCompositeOpID) {
updateCompositeOp(m_resourceProvider->currentCompositeOp());
}
}
if (key == KisCanvasResourceProvider::Size) {
setSliderValue("size", m_resourceProvider->size());
}
if (key == KisCanvasResourceProvider::Opacity) {
setSliderValue("opacity", m_resourceProvider->opacity());
}
if (key == KisCanvasResourceProvider::Flow) {
setSliderValue("flow", m_resourceProvider->flow());
}
if (key == KisCanvasResourceProvider::EraserMode) {
m_eraseAction->setChecked(value.toBool());
}
if (key == KisCanvasResourceProvider::DisablePressure) {
m_disablePressureAction->setChecked(value.toBool());
}
sender()->blockSignals(false);
}
}
void KisPaintopBox::slotSaveActivePreset()
{
KisPaintOpPresetSP curPreset = m_resourceProvider->currentPreset();
if (!curPreset)
return;
m_favoriteResourceManager->setBlockUpdates(true);
KisPaintOpPresetSP newPreset = curPreset->clone();
KisPaintOpPresetResourceServer * rServer = KisResourceServerProvider::instance()->paintOpPresetServer();
QString saveLocation = rServer->saveLocation();
QString presetName = m_presetsPopup->getPresetName();
QString presetFilename = saveLocation + presetName + newPreset->defaultFileExtension();
QStringList tags;
KisPaintOpPresetSP resource = rServer->resourceByName(presetName);
if (resource) {
tags = rServer->assignedTagsList(resource.data());
rServer->removeResourceAndBlacklist(resource);
}
newPreset->setImage(m_presetsPopup->cutOutOverlay());
newPreset->setFilename(presetFilename);
newPreset->setName(presetName);
newPreset->setPresetDirty(false);
rServer->addResource(newPreset);
Q_FOREACH (const QString & tag, tags) {
rServer->addTag(newPreset.data(), tag);
}
// HACK ALERT! the server does not notify the observers
// automatically, so we need to call theupdate manually!
rServer->tagCategoryMembersChanged();
restoreResource(newPreset.data());
m_favoriteResourceManager->setBlockUpdates(false);
}
void KisPaintopBox::slotUpdatePreset()
{
if (!m_resourceProvider->currentPreset()) return;
// block updates of avoid some over updating of the option widget
m_blockUpdate = true;
setSliderValue("size", m_resourceProvider->size());
{
qreal opacity = m_resourceProvider->currentPreset()->settings()->paintOpOpacity();
m_resourceProvider->setOpacity(opacity);
setSliderValue("opacity", opacity);
setWidgetState(ENABLE_OPACITY);
}
{
setSliderValue("flow", m_resourceProvider->currentPreset()->settings()->paintOpFlow());
setWidgetState(ENABLE_FLOW);
}
{
updateCompositeOp(m_resourceProvider->currentPreset()->settings()->paintOpCompositeOp());
setWidgetState(ENABLE_COMPOSITEOP);
}
m_blockUpdate = false;
}
void KisPaintopBox::slotSetupDefaultPreset()
{
KisPaintOpPresetSP preset = defaultPreset(m_resourceProvider->currentPreset()->paintOp());
preset->setOptionsWidget(m_optionWidget);
m_resourceProvider->setPaintOpPreset(preset);
}
void KisPaintopBox::slotNodeChanged(const KisNodeSP node)
{
if (m_previousNode.isValid() && m_previousNode->paintDevice())
disconnect(m_previousNode->paintDevice().data(), SIGNAL(colorSpaceChanged(const KoColorSpace*)), this, SLOT(slotColorSpaceChanged(const KoColorSpace*)));
// Reconnect colorspace change of node
if (node && node->paintDevice()) {
connect(node->paintDevice().data(), SIGNAL(colorSpaceChanged(const KoColorSpace*)), this, SLOT(slotColorSpaceChanged(const KoColorSpace*)));
m_resourceProvider->setCurrentCompositeOp(m_currCompositeOpID);
m_previousNode = node;
slotColorSpaceChanged(node->colorSpace());
}
if (m_optionWidget) {
m_optionWidget->setNode(node);
}
}
void KisPaintopBox::slotColorSpaceChanged(const KoColorSpace* colorSpace)
{
m_cmbCompositeOp->validate(colorSpace);
}
void KisPaintopBox::slotToggleEraseMode(bool checked)
{
const bool oldEraserMode = m_resourceProvider->eraserMode();
m_resourceProvider->setEraserMode(checked);
if (oldEraserMode != checked && m_eraserBrushSizeEnabled) {
const qreal currentSize = m_resourceProvider->size();
KisPaintOpSettingsSP settings = m_resourceProvider->currentPreset()->settings();
// remember brush size. set the eraser size to the normal brush size if not set
if (checked) {
settings->setSavedBrushSize(currentSize);
if (qFuzzyIsNull(settings->savedEraserSize())) {
settings->setSavedEraserSize(currentSize);
}
} else {
settings->setSavedEraserSize(currentSize);
if (qFuzzyIsNull(settings->savedBrushSize())) {
settings->setSavedBrushSize(currentSize);
}
}
//update value in UI (this is the main place the value is 'stored' in memory)
qreal newSize = checked ? settings->savedEraserSize() : settings->savedBrushSize();
m_resourceProvider->setSize(newSize);
}
if (oldEraserMode != checked && m_eraserBrushOpacityEnabled) {
const qreal currentOpacity = m_resourceProvider->opacity();
KisPaintOpSettingsSP settings = m_resourceProvider->currentPreset()->settings();
// remember brush opacity. set the eraser opacity to the normal brush opacity if not set
if (checked) {
settings->setSavedBrushOpacity(currentOpacity);
if (qFuzzyIsNull(settings->savedEraserOpacity())) {
settings->setSavedEraserOpacity(currentOpacity);
}
} else {
settings->setSavedEraserOpacity(currentOpacity);
if (qFuzzyIsNull(settings->savedBrushOpacity())) {
settings->setSavedBrushOpacity(currentOpacity);
}
}
//update value in UI (this is the main place the value is 'stored' in memory)
qreal newOpacity = checked ? settings->savedEraserOpacity() : settings->savedBrushOpacity();
m_resourceProvider->setOpacity(newOpacity);
}
}
void KisPaintopBox::slotSetCompositeMode(int index)
{
Q_UNUSED(index);
QString compositeOp = m_cmbCompositeOp->selectedCompositeOp().id();
m_resourceProvider->setCurrentCompositeOp(compositeOp);
}
void KisPaintopBox::slotHorizontalMirrorChanged(bool value)
{
m_resourceProvider->setMirrorHorizontal(value);
}
void KisPaintopBox::slotVerticalMirrorChanged(bool value)
{
m_resourceProvider->setMirrorVertical(value);
}
void KisPaintopBox::sliderChanged(int n)
{
if (!m_optionWidget) // widget will not exist if the are no documents open
return;
KisSignalsBlocker blocker(m_optionWidget);
qreal opacity = m_sliderChooser[n]->getWidget<KisDoubleSliderSpinBox>("opacity")->value();
qreal flow = m_sliderChooser[n]->getWidget<KisDoubleSliderSpinBox>("flow")->value();
qreal size = m_sliderChooser[n]->getWidget<KisDoubleSliderSpinBox>("size")->value();
setSliderValue("opacity", opacity);
setSliderValue("flow" , flow);
setSliderValue("size" , size);
if (m_presetsEnabled) {
// IMPORTANT: set the PaintOp size before setting the other properties
// it wont work the other way
// TODO: why?!
m_resourceProvider->setSize(size);
m_resourceProvider->setOpacity(opacity);
m_resourceProvider->setFlow(flow);
KisLockedPropertiesProxySP propertiesProxy = KisLockedPropertiesServer::instance()->createLockedPropertiesProxy(m_resourceProvider->currentPreset()->settings());
propertiesProxy->setProperty("OpacityValue", opacity);
propertiesProxy->setProperty("FlowValue", flow);
m_optionWidget->setConfigurationSafe(m_resourceProvider->currentPreset()->settings().data());
} else {
m_resourceProvider->setOpacity(opacity);
}
m_presetsPopup->resourceSelected(m_resourceProvider->currentPreset().data());
}
void KisPaintopBox::slotSlider1Changed()
{
sliderChanged(0);
}
void KisPaintopBox::slotSlider2Changed()
{
sliderChanged(1);
}
void KisPaintopBox::slotSlider3Changed()
{
sliderChanged(2);
}
void KisPaintopBox::slotToolChanged(KoCanvasController* canvas, int toolId)
{
Q_UNUSED(canvas);
Q_UNUSED(toolId);
if (!m_viewManager->canvasBase()) return;
QString id = KoToolManager::instance()->activeToolId();
KisTool* tool = dynamic_cast<KisTool*>(KoToolManager::instance()->toolById(m_viewManager->canvasBase(), id));
if (tool) {
int flags = tool->flags();
if (flags & KisTool::FLAG_USES_CUSTOM_COMPOSITEOP) {
setWidgetState(ENABLE_COMPOSITEOP | ENABLE_OPACITY);
} else {
setWidgetState(DISABLE_COMPOSITEOP | DISABLE_OPACITY);
}
if (flags & KisTool::FLAG_USES_CUSTOM_PRESET) {
setWidgetState(ENABLE_PRESETS | ENABLE_SIZE | ENABLE_FLOW);
slotUpdatePreset();
m_presetsEnabled = true;
} else {
setWidgetState(DISABLE_PRESETS | DISABLE_SIZE | DISABLE_FLOW);
m_presetsEnabled = false;
}
+
+ if (flags & KisTool::FLAG_USES_CUSTOM_SIZE) {
+ setWidgetState(ENABLE_SIZE | ENABLE_FLOW);
+ } else {
+ setWidgetState(DISABLE_SIZE | DISABLE_FLOW);
+ }
+
} else setWidgetState(DISABLE_ALL);
}
void KisPaintopBox::slotPreviousFavoritePreset()
{
if (!m_favoriteResourceManager) return;
int i = 0;
Q_FOREACH (KisPaintOpPresetSP preset, m_favoriteResourceManager->favoritePresetList()) {
if (m_resourceProvider->currentPreset() && m_resourceProvider->currentPreset()->name() == preset->name()) {
if (i > 0) {
m_favoriteResourceManager->slotChangeActivePaintop(i - 1);
} else {
m_favoriteResourceManager->slotChangeActivePaintop(m_favoriteResourceManager->numFavoritePresets() - 1);
}
return;
}
i++;
}
}
void KisPaintopBox::slotNextFavoritePreset()
{
if (!m_favoriteResourceManager) return;
int i = 0;
Q_FOREACH (KisPaintOpPresetSP preset, m_favoriteResourceManager->favoritePresetList()) {
if (m_resourceProvider->currentPreset()->name() == preset->name()) {
if (i < m_favoriteResourceManager->numFavoritePresets() - 1) {
m_favoriteResourceManager->slotChangeActivePaintop(i + 1);
} else {
m_favoriteResourceManager->slotChangeActivePaintop(0);
}
return;
}
i++;
}
}
void KisPaintopBox::slotSwitchToPreviousPreset()
{
if (m_resourceProvider->previousPreset()) {
//qDebug() << "slotSwitchToPreviousPreset();" << m_resourceProvider->previousPreset();
setCurrentPaintop(m_resourceProvider->previousPreset());
}
}
void KisPaintopBox::slotUnsetEraseMode()
{
m_eraseAction->setChecked(false);
}
void KisPaintopBox::slotToggleAlphaLockMode(bool checked)
{
if (checked) {
m_alphaLockButton->actions()[0]->setIcon(KisIconUtils::loadIcon("transparency-locked"));
} else {
m_alphaLockButton->actions()[0]->setIcon(KisIconUtils::loadIcon("transparency-unlocked"));
}
m_resourceProvider->setGlobalAlphaLock(checked);
}
void KisPaintopBox::slotDisablePressureMode(bool checked)
{
if (checked) {
m_disablePressureButton->actions()[0]->setIcon(KisIconUtils::loadIcon("transform_icons_penPressure"));
} else {
m_disablePressureButton->actions()[0]->setIcon(KisIconUtils::loadIcon("transform_icons_penPressure_locked"));
}
m_resourceProvider->setDisablePressure(checked);
}
void KisPaintopBox::slotReloadPreset()
{
KisSignalsBlocker blocker(m_optionWidget);
//Here using the name and fetching the preset from the server was the only way the load was working. Otherwise it was not loading.
KisPaintOpPresetResourceServer * rserver = KisResourceServerProvider::instance()->paintOpPresetServer();
KisPaintOpPresetSP preset = rserver->resourceByName(m_resourceProvider->currentPreset()->name());
if (preset) {
preset->load();
}
}
void KisPaintopBox::slotGuiChangedCurrentPreset() // Called only when UI is changed and not when preset is changed
{
KisPaintOpPresetSP preset = m_resourceProvider->currentPreset();
{
/**
* Here we postpone all the settings updates events until thye entire writing
* operation will be finished. As soon as it is finished, the updates will be
* emitted happily (if there were any).
*/
KisPaintOpPreset::UpdatedPostponer postponer(preset.data());
m_optionWidget->writeConfigurationSafe(const_cast<KisPaintOpSettings*>(preset->settings().data()));
}
// we should also update the preset strip to update the status of the "dirty" mark
m_presetsPopup->resourceSelected(m_resourceProvider->currentPreset().data());
// TODO!!!!!!!!
//m_presetsPopup->updateViewSettings();
}
void KisPaintopBox::slotSaveLockedOptionToPreset(KisPropertiesConfigurationSP p)
{
QMapIterator<QString, QVariant> i(p->getProperties());
while (i.hasNext()) {
i.next();
m_resourceProvider->currentPreset()->settings()->setProperty(i.key(), QVariant(i.value()));
if (m_resourceProvider->currentPreset()->settings()->hasProperty(i.key() + "_previous")) {
m_resourceProvider->currentPreset()->settings()->removeProperty(i.key() + "_previous");
}
}
slotGuiChangedCurrentPreset();
}
void KisPaintopBox::slotDropLockedOption(KisPropertiesConfigurationSP p)
{
KisSignalsBlocker blocker(m_optionWidget);
KisPaintOpPresetSP preset = m_resourceProvider->currentPreset();
{
KisPaintOpPreset::DirtyStateSaver dirtySaver(preset.data());
QMapIterator<QString, QVariant> i(p->getProperties());
while (i.hasNext()) {
i.next();
if (preset->settings()->hasProperty(i.key() + "_previous")) {
preset->settings()->setProperty(i.key(), preset->settings()->getProperty(i.key() + "_previous"));
preset->settings()->removeProperty(i.key() + "_previous");
}
}
}
//slotUpdatePreset();
}
void KisPaintopBox::slotDirtyPresetToggled(bool value)
{
if (!value) {
slotReloadPreset();
m_presetsPopup->resourceSelected(m_resourceProvider->currentPreset().data());
m_presetsPopup->updateViewSettings();
}
m_dirtyPresetsEnabled = value;
KisConfig cfg;
cfg.setUseDirtyPresets(m_dirtyPresetsEnabled);
}
void KisPaintopBox::slotEraserBrushSizeToggled(bool value)
{
m_eraserBrushSizeEnabled = value;
KisConfig cfg;
cfg.setUseEraserBrushSize(m_eraserBrushSizeEnabled);
}
void KisPaintopBox::slotEraserBrushOpacityToggled(bool value)
{
m_eraserBrushOpacityEnabled = value;
KisConfig cfg;
cfg.setUseEraserBrushOpacity(m_eraserBrushOpacityEnabled);
}
void KisPaintopBox::slotUpdateSelectionIcon()
{
m_hMirrorAction->setIcon(KisIconUtils::loadIcon("symmetry-horizontal"));
m_vMirrorAction->setIcon(KisIconUtils::loadIcon("symmetry-vertical"));
KisConfig cfg;
if (!cfg.toolOptionsInDocker() && m_toolOptionsPopupButton) {
m_toolOptionsPopupButton->setIcon(KisIconUtils::loadIcon("configure"));
}
m_presetSelectorPopupButton->setIcon(KisIconUtils::loadIcon("paintop_settings_01"));
m_brushEditorPopupButton->setIcon(KisIconUtils::loadIcon("paintop_settings_02"));
m_workspaceWidget->setIcon(KisIconUtils::loadIcon("view-choose"));
m_eraseAction->setIcon(KisIconUtils::loadIcon("draw-eraser"));
m_reloadAction->setIcon(KisIconUtils::loadIcon("view-refresh"));
if (m_disablePressureAction->isChecked()) {
m_disablePressureButton->setIcon(KisIconUtils::loadIcon("transform_icons_penPressure"));
} else {
m_disablePressureButton->setIcon(KisIconUtils::loadIcon("transform_icons_penPressure_locked"));
}
}
void KisPaintopBox::slotLockXMirrorToggle(bool toggleLock) {
m_resourceProvider->setMirrorHorizontalLock(toggleLock);
}
void KisPaintopBox::slotLockYMirrorToggle(bool toggleLock) {
m_resourceProvider->setMirrorVerticalLock(toggleLock);
}
void KisPaintopBox::slotHideDecorationMirrorX(bool toggled) {
m_resourceProvider->setMirrorHorizontalHideDecorations(toggled);
}
void KisPaintopBox::slotHideDecorationMirrorY(bool toggled) {
m_resourceProvider->setMirrorVerticalHideDecorations(toggled);
}
void KisPaintopBox::slotMoveToCenterMirrorX() {
m_resourceProvider->mirrorHorizontalMoveCanvasToCenter();
}
void KisPaintopBox::slotMoveToCenterMirrorY() {
m_resourceProvider->mirrorVerticalMoveCanvasToCenter();
}
diff --git a/libs/ui/kis_paintop_box.h b/libs/ui/kis_paintop_box.h
index 1892283c46..1b589bfcf1 100644
--- a/libs/ui/kis_paintop_box.h
+++ b/libs/ui/kis_paintop_box.h
@@ -1,253 +1,253 @@
/*
* kis_paintop_box.h - part of KImageShop/Krayon/Krita
*
* Copyright (c) 2004-2008 Boudewijn Rempt (boud@valdyas.org)
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_BOX_H_
#define KIS_PAINTOP_BOX_H_
#include <QMap>
#include <QWidget>
#include <QList>
#include <KoID.h>
#include <KoInputDevice.h>
#include <kis_types.h>
#include <brushengine/kis_paintop_settings.h>
#include <brushengine/kis_locked_properties_proxy.h>
#include <brushengine/kis_locked_properties_server.h>
#include <brushengine/kis_locked_properties.h>
#include "kritaui_export.h"
#include "kis_signal_auto_connection.h"
#include "kis_signal_compressor.h"
class QToolButton;
class QString;
class QHBoxLayout;
class KoColorSpace;
class KoResource;
class KoCanvasController;
class KisViewManager;
class KisCanvasResourceProvider;
class KisPopupButton;
class KisToolOptionsPopup;
class KisPaintOpPresetsPopup;
class KisPaintOpPresetsChooserPopup;
class KisPaintOpConfigWidget;
class KisCompositeOpComboBox;
class KisWidgetChooser;
class KisFavoriteResourceManager;
class KisAction;
/**
* This widget presents all paintops that a user can paint with.
* Paintops represent real-world tools or the well-known Shoup
* computer equivalents that do nothing but change color.
*
* To incorporate the dirty preset functionality and locked settings
* the following slots are added
* void slotReloadPreset();
void slotGuiChangedCurrentPreset();
void slotSaveLockedOptionToPreset(KisPropertiesConfigurationSP p);
void slotDropLockedOption(KisPropertiesConfigurationSP p);
void slotDirtyPresetToggled(bool);
Everytime a value is changed in a preset, the preset is made dirty through the onChange() function.
For Locked Settings however, a changed Locked Setting will not cause a preset to become dirty. That is
becuase it borrows its values from the KisLockedPropertiesServer.
Hence the dirty state of the Preset is kept consistent before and after a writeConfiguration operation in most cases.
* XXX: When we have a lot of paintops, replace the listbox
* with a table, and for every category a combobox.
*
* XXX: instead of text, use pretty pictures.
*/
class KRITAUI_EXPORT KisPaintopBox : public QWidget
{
Q_OBJECT
enum {
ENABLE_PRESETS = 0x0001,
DISABLE_PRESETS = 0x0002,
ENABLE_COMPOSITEOP = 0x0004,
DISABLE_COMPOSITEOP = 0x0008,
ENABLE_OPACITY = 0x0010,
DISABLE_OPACITY = 0x0020,
ENABLE_FLOW = 0x0040,
DISABLE_FLOW = 0x0080,
ENABLE_SIZE = 0x0100,
DISABLE_SIZE = 0x0200,
ENABLE_ALL = 0x5555,
DISABLE_ALL = 0xAAAA
};
public:
KisPaintopBox(KisViewManager* view, QWidget* parent, const char* name);
- ~KisPaintopBox();
+ ~KisPaintopBox() override;
void restoreResource(KoResource* resource);
/**
* Update the option widgets to the argument ones, removing the currently set widgets.
*/
void newOptionWidgets(const QList<QPointer<QWidget> > & optionWidgetList);
KisFavoriteResourceManager *favoriteResourcesManager() { return m_favoriteResourceManager; }
public Q_SLOTS:
void slotColorSpaceChanged(const KoColorSpace* colorSpace);
void slotInputDeviceChanged(const KoInputDevice & inputDevice);
void slotCanvasResourceChanged(int key, const QVariant& v);
void resourceSelected(KoResource* resource);
private:
void setCurrentPaintop(const KoID& paintop);
void setCurrentPaintop(KisPaintOpPresetSP preset);
KisPaintOpPresetSP defaultPreset(const KoID& paintOp);
KisPaintOpPresetSP activePreset(const KoID& paintOp);
void updateCompositeOp(QString compositeOpID);
void setWidgetState(int flags);
void setSliderValue(const QString& sliderID, qreal value);
void sliderChanged(int n);
private Q_SLOTS:
void slotSaveActivePreset();
void slotUpdatePreset();
void slotSetupDefaultPreset();
void slotNodeChanged(const KisNodeSP node);
void slotToggleEraseMode(bool checked);
void slotSetCompositeMode(int index);
void slotSetPaintop(const QString& paintOpId);
void slotHorizontalMirrorChanged(bool value);
void slotVerticalMirrorChanged(bool value);
void slotSlider1Changed();
void slotSlider2Changed();
void slotSlider3Changed();
void slotToolChanged(KoCanvasController* canvas, int toolId);
void slotPreviousFavoritePreset();
void slotNextFavoritePreset();
void slotSwitchToPreviousPreset();
void slotUnsetEraseMode();
void slotToggleAlphaLockMode(bool);
void slotDisablePressureMode(bool);
void slotReloadPreset();
void slotGuiChangedCurrentPreset();
void slotSaveLockedOptionToPreset(KisPropertiesConfigurationSP p);
void slotDropLockedOption(KisPropertiesConfigurationSP p);
void slotDirtyPresetToggled(bool);
void slotEraserBrushSizeToggled(bool);
void slotEraserBrushOpacityToggled(bool);
void slotUpdateSelectionIcon();
void slotLockXMirrorToggle(bool);
void slotLockYMirrorToggle(bool);
void slotMoveToCenterMirrorX();
void slotMoveToCenterMirrorY();
void slotHideDecorationMirrorX(bool);
void slotHideDecorationMirrorY(bool);
void slotUpdateOptionsWidgetPopup();
private:
KisCanvasResourceProvider* m_resourceProvider;
QHBoxLayout* m_layout;
QWidget* m_paintopWidget;
KisPaintOpConfigWidget* m_optionWidget;
KisPopupButton* m_toolOptionsPopupButton;
KisPopupButton* m_brushEditorPopupButton;
KisPopupButton* m_presetSelectorPopupButton;
KisCompositeOpComboBox* m_cmbCompositeOp;
QToolButton* m_eraseModeButton;
QToolButton* m_alphaLockButton;
QToolButton* m_disablePressureButton;
QToolButton* m_hMirrorButton;
QToolButton* m_vMirrorButton;
KisToolOptionsPopup* m_toolOptionsPopup;
KisPaintOpPresetsPopup* m_presetsPopup;
KisPaintOpPresetsChooserPopup* m_presetsChooserPopup;
KisViewManager* m_viewManager;
KisPopupButton* m_workspaceWidget;
KisWidgetChooser* m_sliderChooser[3];
QMap<KoID, KisPaintOpConfigWidget*> m_paintopOptionWidgets;
KisFavoriteResourceManager* m_favoriteResourceManager;
QToolButton* m_reloadButton;
KisAction* m_eraseAction;
KisAction* m_reloadAction;
KisAction* m_disablePressureAction;
QString m_currCompositeOpID;
KisNodeWSP m_previousNode;
KisAction* m_hMirrorAction;
KisAction* m_vMirrorAction;
struct TabletToolID {
TabletToolID(const KoInputDevice& dev) {
uniqueID = dev.uniqueTabletId();
// Only the eraser is special, and we don't look at Cursor
pointer = QTabletEvent::Pen;
if (dev.pointer() == QTabletEvent::Eraser) {
pointer = QTabletEvent::Eraser;
}
}
bool operator == (const TabletToolID& id) const {
return pointer == id.pointer && uniqueID == id.uniqueID;
}
bool operator < (const TabletToolID& id) const {
if (uniqueID == id.uniqueID)
return pointer < id.pointer;
return uniqueID < id.uniqueID;
}
QTabletEvent::PointerType pointer;
qint64 uniqueID;
};
struct TabletToolData {
KoID paintOpID;
KisPaintOpPresetSP preset;
};
typedef QMap<TabletToolID, TabletToolData> TabletToolMap;
typedef QMap<KoID, KisPaintOpPresetSP> PaintOpPresetMap;
TabletToolMap m_tabletToolMap;
PaintOpPresetMap m_paintOpPresetMap;
TabletToolID m_currTabletToolID;
bool m_presetsEnabled;
bool m_blockUpdate;
bool m_dirtyPresetsEnabled;
bool m_eraserBrushSizeEnabled;
bool m_eraserBrushOpacityEnabled;
KisSignalAutoConnectionsStore m_presetConnections;
};
#endif //KIS_PAINTOP_BOX_H_
diff --git a/libs/ui/kis_paintop_option.h b/libs/ui/kis_paintop_option.h
index a36e5a218a..862675162e 100644
--- a/libs/ui/kis_paintop_option.h
+++ b/libs/ui/kis_paintop_option.h
@@ -1,120 +1,120 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_OPTION_H
#define KIS_PAINTOP_OPTION_H
#include <kis_types.h>
#include <kritaui_export.h>
#include <kis_properties_configuration.h>
#include <brushengine/kis_locked_properties_proxy.h>
#include <kis_base_option.h>
class QWidget;
class QString;
class KisPaintopLodLimitations;
/**
* Base interface for paintop options. A paintop option
* can be enabled/disabled, has a configuration page
* (for example, a curve), a user-visible name and can
* be serialized and deserialized into KisPaintOpPresets
*
* Options are disabled by default.
*/
class KRITAUI_EXPORT KisPaintOpOption : public QObject
{
Q_OBJECT
public:
enum PaintopCategory {
GENERAL,
COLOR,
TEXTURE,
FILTER
};
KisPaintOpOption(KisPaintOpOption::PaintopCategory category, bool checked);
- virtual ~KisPaintOpOption();
+ ~KisPaintOpOption() override;
KisPaintOpOption::PaintopCategory category() const;
virtual bool isCheckable() const;
virtual bool isChecked() const;
virtual void setChecked(bool checked);
void setLocked(bool value);
bool isLocked() const;
/**
* Reimplement this to use the image in the option widget
*/
virtual void setImage(KisImageWSP image);
virtual void setNode(KisNodeWSP node);
void startReadOptionSetting(const KisPropertiesConfigurationSP setting);
void startWriteOptionSetting(KisPropertiesConfigurationSP setting) const;
QWidget* configurationPage() const;
virtual void lodLimitations(KisPaintopLodLimitations *l) const;
protected:
void setConfigurationPage(QWidget * page);
protected:
/**
* Re-implement this to save the configuration to the paint configuration.
*/
virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const {
Q_UNUSED(setting);
}
/**
* Re-implement this to set te widgets with the values in @param setting.
*/
virtual void readOptionSetting(const KisPropertiesConfigurationSP setting) {
Q_UNUSED(setting);
}
protected Q_SLOTS:
void emitSettingChanged();
Q_SIGNALS:
/**
* emit this whenever a setting has changed. It will update the preview
*/
void sigSettingChanged();
protected:
bool m_checkable;
bool m_locked;
private:
struct Private;
Private* const m_d;
};
#endif
diff --git a/libs/ui/kis_paintop_options_model.h b/libs/ui/kis_paintop_options_model.h
index 00c97919a5..f1365634e0 100644
--- a/libs/ui/kis_paintop_options_model.h
+++ b/libs/ui/kis_paintop_options_model.h
@@ -1,76 +1,76 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Silvio Heinrich <plassyqweb.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PAINTOP_OPTION_LIST_MODEL_H_
#define _KIS_PAINTOP_OPTION_LIST_MODEL_H_
#include <kis_categorized_list_model.h>
#include <kis_paintop_option.h>
#include <kritaui_export.h>
#include <QString>
struct KRITAUI_EXPORT KisOptionInfo
{
KisOptionInfo()
: option(0)
{}
KisOptionInfo(KisPaintOpOption* o, int i, const QString &label)
: label(label)
, option(o)
, index(i)
{}
KisOptionInfo(const KisOptionInfo& info)
: label(info.label)
, option(info.option)
, index(info.index)
{}
QString label;
KisPaintOpOption *option;
int index;
};
KRITAUI_EXPORT bool operator==(const KisOptionInfo& a, const KisOptionInfo& b);
struct KRITAUI_EXPORT OptionInfoToQStringConverter {
QString operator() (const KisOptionInfo &info) {
return info.label;
}
};
typedef KisCategorizedListModel<KisOptionInfo, OptionInfoToQStringConverter> BaseOptionCategorizedListModel;
/**
* This model can be use to show a list of visible composite op in a list view.
*/
class KRITAUI_EXPORT KisPaintOpOptionListModel : public BaseOptionCategorizedListModel
{
public:
KisPaintOpOptionListModel(QObject *parent);
void addPaintOpOption(KisPaintOpOption* option, int widgetIndex, const QString &label);
- QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const;
- bool setData(const QModelIndex& idx, const QVariant& value, int role=Qt::EditRole);
+ QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex& idx, const QVariant& value, int role=Qt::EditRole) override;
void signalDataChanged(const QModelIndex& index);
};
#endif // _KIS_PAINTOP_OPTION_LIST_MODEL_H_
diff --git a/libs/ui/kis_paintop_settings_widget.h b/libs/ui/kis_paintop_settings_widget.h
index 959b3ec4eb..a96be917b4 100644
--- a/libs/ui/kis_paintop_settings_widget.h
+++ b/libs/ui/kis_paintop_settings_widget.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_SETTINGS_WIDGET_H
#define KIS_PAINTOP_SETTINGS_WIDGET_H
#include <kritaui_export.h>
#include <brushengine/kis_paintop_config_widget.h>
class KisPaintOpOption;
class KisPropertiesConfiguration;
class KisPaintOpConfigWidget;
class KisPaintopLodLimitations;
/**
* A common widget for enabling/disabling and determining
* the effect of tablet pressure, tilt and rotation and
* other paintop settings.
*/
class KRITAUI_EXPORT KisPaintOpSettingsWidget : public KisPaintOpConfigWidget
{
Q_OBJECT
public:
KisPaintOpSettingsWidget(QWidget * parent = 0);
- ~KisPaintOpSettingsWidget();
+ ~KisPaintOpSettingsWidget() override;
void addPaintOpOption(KisPaintOpOption * option, const QString &label);
/// Reimplemented
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
/// Reimplemented
- virtual void writeConfiguration(KisPropertiesConfigurationSP config) const;
+ void writeConfiguration(KisPropertiesConfigurationSP config) const override;
- virtual KisPaintopLodLimitations lodLimitations() const;
+ KisPaintopLodLimitations lodLimitations() const override;
///Reimplemented, sets image on option widgets
- virtual void setImage(KisImageWSP image);
+ void setImage(KisImageWSP image) override;
///Reimplemented, sets node on option widgets
- virtual void setNode(KisNodeWSP node);
+ void setNode(KisNodeWSP node) override;
private Q_SLOTS:
void changePage(const QModelIndex&);
void lockProperties(const QModelIndex& index);
void slotLockPropertiesDrop();
void slotLockPropertiesSave();
void slotEntryChecked(const QModelIndex &index);
protected:
virtual void notifyPageChanged();
private:
struct Private;
Private* const m_d;
bool m_saveLockedOption;
};
#endif
diff --git a/libs/ui/kis_palette_delegate.h b/libs/ui/kis_palette_delegate.h
index e3ca71f8e5..010d3610f8 100644
--- a/libs/ui/kis_palette_delegate.h
+++ b/libs/ui/kis_palette_delegate.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PALETTE_DELEGATE_H
#define __KIS_PALETTE_DELEGATE_H
#include <QAbstractItemDelegate>
#include "kritaui_export.h"
class KRITAUI_EXPORT KisPaletteDelegate : public QAbstractItemDelegate
{
public:
KisPaletteDelegate(QObject * parent = 0);
- ~KisPaletteDelegate();
+ ~KisPaletteDelegate() override;
void setCrossedKeyword(const QString &value);
- void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const;
- QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex &) const;
+ void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override;
+ QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex &) const override;
private:
QString m_crossedKeyword;
};
#endif /* __KIS_PALETTE_DELEGATE_H */
diff --git a/libs/ui/kis_palette_view.h b/libs/ui/kis_palette_view.h
index 6dae7b3d11..b5a0d84d75 100644
--- a/libs/ui/kis_palette_view.h
+++ b/libs/ui/kis_palette_view.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PALETTE_VIEW_H
#define __KIS_PALETTE_VIEW_H
#include <QScopedPointer>
#include <KoTableView.h>
#include "kritaui_export.h"
class KisPaletteModel;
class QWheelEvent;
class KRITAUI_EXPORT KisPaletteView : public KoTableView
{
public:
KisPaletteView(QWidget *parent = 0);
- ~KisPaletteView();
+ ~KisPaletteView() override;
void setPaletteModel(KisPaletteModel *model);
KisPaletteModel* paletteModel() const;
void setCrossedKeyword(const QString &value);
protected:
- void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_PALETTE_VIEW_H */
diff --git a/libs/ui/kis_png_converter.cpp b/libs/ui/kis_png_converter.cpp
index ad18ad6a78..cca0451b49 100644
--- a/libs/ui/kis_png_converter.cpp
+++ b/libs/ui/kis_png_converter.cpp
@@ -1,1287 +1,1276 @@
/*
* Copyright (c) 2005-2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kis_png_converter.h"
// A big thank to Glenn Randers-Pehrson for his wonderful
// documentation of libpng available at
// http://www.libpng.org/pub/png/libpng-1.2.5-manual.html
#ifndef PNG_MAX_UINT // Removed in libpng 1.4
#define PNG_MAX_UINT PNG_UINT_31_MAX
#endif
#include <KoConfig.h> // WORDS_BIGENDIAN
#include <KoStore.h>
#include <KoStoreDevice.h>
#include <limits.h>
#include <stdio.h>
#include <zlib.h>
#include <QBuffer>
#include <QFile>
#include <QApplication>
#include <klocalizedstring.h>
#include <QUrl>
#include <KoColorSpace.h>
#include <KoDocumentInfo.h>
#include <KoID.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorProfile.h>
#include <KoColorSpace.h>
#include <KoColor.h>
#include <KoUnit.h>
#include <kis_config.h>
#include <kis_painter.h>
#include <KisDocument.h>
#include <kis_image.h>
#include <kis_iterator_ng.h>
#include <kis_layer.h>
#include <kis_paint_device.h>
#include <kis_transaction.h>
#include <kis_paint_layer.h>
#include <kis_group_layer.h>
#include <metadata/kis_meta_data_io_backend.h>
#include <metadata/kis_meta_data_store.h>
#include <KoColorModelStandardIds.h>
#include "dialogs/kis_dlg_png_import.h"
#include "kis_clipboard.h"
namespace
{
int getColorTypeforColorSpace(const KoColorSpace * cs , bool alpha)
{
QString id = cs->id();
if (id == "GRAYA" || id == "GRAYAU16" || id == "GRAYA16") {
return alpha ? PNG_COLOR_TYPE_GRAY_ALPHA : PNG_COLOR_TYPE_GRAY;
}
if (id == "RGBA" || id == "RGBA16") {
return alpha ? PNG_COLOR_TYPE_RGB_ALPHA : PNG_COLOR_TYPE_RGB;
}
return -1;
}
bool colorSpaceIdSupported(const QString &id)
{
return id == "RGBA" || id == "RGBA16" ||
id == "GRAYA" || id == "GRAYAU16" || id == "GRAYA16";
}
QPair<QString, QString> getColorSpaceForColorType(int color_type, int color_nb_bits)
{
QPair<QString, QString> r;
if (color_type == PNG_COLOR_TYPE_PALETTE) {
r.first = RGBAColorModelID.id();
r.second = Integer8BitsColorDepthID.id();
} else {
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
r.first = GrayAColorModelID.id();
} else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA || color_type == PNG_COLOR_TYPE_RGB) {
r.first = RGBAColorModelID.id();
}
if (color_nb_bits == 16) {
r.second = Integer16BitsColorDepthID.id();
} else if (color_nb_bits <= 8) {
r.second = Integer8BitsColorDepthID.id();
}
}
return r;
}
void fillText(png_text* p_text, const char* key, QString& text)
{
p_text->compression = PNG_TEXT_COMPRESSION_zTXt;
p_text->key = const_cast<char *>(key);
char* textc = new char[text.length()+1];
strcpy(textc, text.toLatin1());
p_text->text = textc;
p_text->text_length = text.length() + 1;
}
long formatStringList(char *string, const size_t length, const char *format, va_list operands)
{
int n = vsnprintf(string, length, format, operands);
if (n < 0)
string[length-1] = '\0';
return((long) n);
}
long formatString(char *string, const size_t length, const char *format, ...)
{
long n;
va_list operands;
va_start(operands, format);
n = (long) formatStringList(string, length, format, operands);
va_end(operands);
return(n);
}
void writeRawProfile(png_struct *ping, png_info *ping_info, QString profile_type, QByteArray profile_data)
{
png_textp text;
png_uint_32 allocated_length, description_length;
const uchar hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
dbgFile << "Writing Raw profile: type=" << profile_type << ", length=" << profile_data.length() << endl;
text = (png_textp) png_malloc(ping, (png_uint_32) sizeof(png_text));
description_length = profile_type.length();
allocated_length = (png_uint_32)(profile_data.length() * 2 + (profile_data.length() >> 5) + 20 + description_length);
text[0].text = (png_charp) png_malloc(ping, allocated_length);
QString key = QLatin1Literal("Raw profile type ") + profile_type.toLatin1();
QByteArray keyData = key.toLatin1();
text[0].key = keyData.data();
uchar* sp = (uchar*)profile_data.data();
png_charp dp = text[0].text;
*dp++ = '\n';
memcpy(dp, profile_type.toLatin1().constData(), profile_type.length());
dp += description_length;
*dp++ = '\n';
formatString(dp, allocated_length - strlen(text[0].text), "%8lu ", profile_data.length());
dp += 8;
for (long i = 0; i < (long) profile_data.length(); i++) {
if (i % 36 == 0)
*dp++ = '\n';
*(dp++) = (char) hex[((*sp >> 4) & 0x0f)];
*(dp++) = (char) hex[((*sp++) & 0x0f)];
}
*dp++ = '\n';
*dp = '\0';
text[0].text_length = (png_size_t)(dp - text[0].text);
text[0].compression = -1;
if (text[0].text_length <= allocated_length)
png_set_text(ping, ping_info, text, 1);
png_free(ping, text[0].text);
png_free(ping, text);
}
QByteArray png_read_raw_profile(png_textp text)
{
QByteArray profile;
static const unsigned char unhex[103] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12,
13, 14, 15
};
png_charp sp = text[0].text + 1;
/* look for newline */
while (*sp != '\n')
sp++;
/* look for length */
while (*sp == '\0' || *sp == ' ' || *sp == '\n')
sp++;
png_uint_32 length = (png_uint_32) atol(sp);
while (*sp != ' ' && *sp != '\n')
sp++;
if (length == 0) {
return profile;
}
profile.resize(length);
/* copy profile, skipping white space and column 1 "=" signs */
unsigned char *dp = (unsigned char*)profile.data();
png_uint_32 nibbles = length * 2;
for (png_uint_32 i = 0; i < nibbles; i++) {
while (*sp < '0' || (*sp > '9' && *sp < 'a') || *sp > 'f') {
if (*sp == '\0') {
return QByteArray();
}
sp++;
}
if (i % 2 == 0)
*dp = (unsigned char)(16 * unhex[(int) *sp++]);
else
(*dp++) += unhex[(int) *sp++];
}
return profile;
}
void decode_meta_data(png_textp text, KisMetaData::Store* store, QString type, int headerSize)
{
dbgFile << "Decoding " << type << " " << text[0].key;
KisMetaData::IOBackend* exifIO = KisMetaData::IOBackendRegistry::instance()->value(type);
Q_ASSERT(exifIO);
QByteArray rawProfile = png_read_raw_profile(text);
if (headerSize > 0) {
rawProfile.remove(0, headerSize);
}
if (rawProfile.size() > 0) {
QBuffer buffer;
buffer.setData(rawProfile);
exifIO->loadFrom(store, &buffer);
} else {
dbgFile << "Decoding failed";
}
}
}
KisPNGConverter::KisPNGConverter(KisDocument *doc, bool batchMode)
{
// Q_ASSERT(doc);
// Q_ASSERT(adapter);
m_doc = doc;
m_stop = false;
m_max_row = 0;
m_image = 0;
m_batchMode = batchMode;
}
KisPNGConverter::~KisPNGConverter()
{
}
class KisPNGReadStream
{
public:
KisPNGReadStream(quint8* buf, quint32 depth) : m_posinc(8), m_depth(depth), m_buf(buf) {
}
int nextValue() {
if (m_posinc == 0) {
m_posinc = 8;
m_buf++;
}
m_posinc -= m_depth;
return (((*m_buf) >> (m_posinc)) & ((1 << m_depth) - 1));
}
private:
quint32 m_posinc, m_depth;
quint8* m_buf;
};
class KisPNGWriteStream
{
public:
KisPNGWriteStream(quint8* buf, quint32 depth) : m_posinc(8), m_depth(depth), m_buf(buf) {
*m_buf = 0;
}
void setNextValue(int v) {
if (m_posinc == 0) {
m_posinc = 8;
m_buf++;
*m_buf = 0;
}
m_posinc -= m_depth;
*m_buf = (v << m_posinc) | *m_buf;
}
private:
quint32 m_posinc, m_depth;
quint8* m_buf;
};
class KisPNGReaderAbstract
{
public:
KisPNGReaderAbstract(png_structp _png_ptr, int _width, int _height) : png_ptr(_png_ptr), width(_width), height(_height) {}
virtual ~KisPNGReaderAbstract() {}
virtual png_bytep readLine() = 0;
protected:
png_structp png_ptr;
int width, height;
};
class KisPNGReaderLineByLine : public KisPNGReaderAbstract
{
public:
KisPNGReaderLineByLine(png_structp _png_ptr, png_infop info_ptr, int _width, int _height) : KisPNGReaderAbstract(_png_ptr, _width, _height) {
png_uint_32 rowbytes = png_get_rowbytes(png_ptr, info_ptr);
row_pointer = new png_byte[rowbytes];
}
~KisPNGReaderLineByLine() override {
delete[] row_pointer;
}
png_bytep readLine() override {
png_read_row(png_ptr, row_pointer, 0);
return row_pointer;
}
private:
png_bytep row_pointer;
};
class KisPNGReaderFullImage : public KisPNGReaderAbstract
{
public:
KisPNGReaderFullImage(png_structp _png_ptr, png_infop info_ptr, int _width, int _height) : KisPNGReaderAbstract(_png_ptr, _width, _height), y(0) {
row_pointers = new png_bytep[height];
png_uint_32 rowbytes = png_get_rowbytes(png_ptr, info_ptr);
for (int i = 0; i < height; i++) {
row_pointers[i] = new png_byte[rowbytes];
}
png_read_image(png_ptr, row_pointers);
}
~KisPNGReaderFullImage() override {
for (int i = 0; i < height; i++) {
delete[] row_pointers[i];
}
delete[] row_pointers;
}
png_bytep readLine() override {
return row_pointers[y++];
}
private:
png_bytepp row_pointers;
int y;
};
static
void _read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QIODevice *in = (QIODevice *)png_get_io_ptr(png_ptr);
while (length) {
int nr = in->read((char*)data, length);
if (nr <= 0) {
png_error(png_ptr, "Read Error");
return;
}
length -= nr;
}
}
static
void _write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QIODevice* out = (QIODevice*)png_get_io_ptr(png_ptr);
uint nr = out->write((char*)data, length);
if (nr != length) {
png_error(png_ptr, "Write Error");
return;
}
}
static
void _flush_fn(png_structp png_ptr)
{
Q_UNUSED(png_ptr);
}
KisImageBuilder_Result KisPNGConverter::buildImage(QIODevice* iod)
{
dbgFile << "Start decoding PNG File";
png_byte signature[8];
iod->peek((char*)signature, 8);
#if PNG_LIBPNG_VER < 10400
if (!png_check_sig(signature, 8)) {
#else
if (png_sig_cmp(signature, 0, 8) != 0) {
#endif
iod->close();
return (KisImageBuilder_RESULT_BAD_FETCH);
}
// Initialize the internal structures
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
if (!png_ptr) {
iod->close();
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_read_struct(&png_ptr, (png_infopp)0, (png_infopp)0);
iod->close();
return (KisImageBuilder_RESULT_FAILURE);
}
png_infop end_info = png_create_info_struct(png_ptr);
if (!end_info) {
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)0);
iod->close();
return (KisImageBuilder_RESULT_FAILURE);
}
// Catch errors
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
iod->close();
return (KisImageBuilder_RESULT_FAILURE);
}
// Initialize the special
png_set_read_fn(png_ptr, iod, _read_fn);
#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)
png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);
#endif
// read all PNG info up to image data
png_read_info(png_ptr, info_ptr);
if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY && png_get_bit_depth(png_ptr, info_ptr) < 8) {
png_set_expand(png_ptr);
}
if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE && png_get_bit_depth(png_ptr, info_ptr) < 8) {
png_set_packing(png_ptr);
}
if (png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_PALETTE &&
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) {
png_set_expand(png_ptr);
}
png_read_update_info(png_ptr, info_ptr);
// Read information about the png
png_uint_32 width, height;
int color_nb_bits, color_type, interlace_type;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &color_nb_bits, &color_type, &interlace_type, 0, 0);
dbgFile << "width = " << width << " height = " << height << " color_nb_bits = " << color_nb_bits << " color_type = " << color_type << " interlace_type = " << interlace_type << endl;
// swap byteorder on little endian machines.
#ifndef WORDS_BIGENDIAN
if (color_nb_bits > 8)
png_set_swap(png_ptr);
#endif
// Determine the colorspace
QPair<QString, QString> csName = getColorSpaceForColorType(color_type, color_nb_bits);
if (csName.first.isEmpty()) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
iod->close();
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
bool hasalpha = (color_type == PNG_COLOR_TYPE_RGB_ALPHA || color_type == PNG_COLOR_TYPE_GRAY_ALPHA);
// Read image profile
png_charp profile_name;
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 5
png_bytep profile_data;
#else
png_charp profile_data;
#endif
int compression_type;
png_uint_32 proflen;
// Get the various optional chunks
// https://www.w3.org/TR/PNG/#11cHRM
#if defined(PNG_cHRM_SUPPORTED)
double whitePointX, whitePointY;
double redX, redY;
double greenX, greenY;
double blueX, blueY;
png_get_cHRM(png_ptr,info_ptr, &whitePointX, &whitePointY, &redX, &redY, &greenX, &greenY, &blueX, &blueY);
qDebug() << "cHRM:" << whitePointX << whitePointY << redX << redY << greenX << greenY << blueX << blueY;
#endif
// https://www.w3.org/TR/PNG/#11gAMA
#if defined(PNG_GAMMA_SUPPORTED)
double gamma;
png_get_gAMA(png_ptr, info_ptr, &gamma);
qDebug() << "gAMA" << gamma;
#endif
// https://www.w3.org/TR/PNG/#11sRGB
#if defined(PNG_sRGB_SUPPORTED)
int sRGBIntent;
png_get_sRGB(png_ptr, info_ptr, &sRGBIntent);
qDebug() << "sRGB" << sRGBIntent;
#endif
bool fromBlender = false;
png_text* text_ptr;
int num_comments;
png_get_text(png_ptr, info_ptr, &text_ptr, &num_comments);
for (int i = 0; i < num_comments; i++) {
QString key = QString(text_ptr[i].key).toLower();
if (key == "file") {
QString relatedFile = text_ptr[i].text;
if (relatedFile.contains(".blend", Qt::CaseInsensitive)){
fromBlender=true;
}
}
}
const KoColorProfile* profile = 0;
if (png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &profile_data, &proflen)) {
QByteArray profile_rawdata;
// XXX: Hardcoded for icc type -- is that correct for us?
profile_rawdata.resize(proflen);
memcpy(profile_rawdata.data(), profile_data, proflen);
profile = KoColorSpaceRegistry::instance()->createColorProfile(csName.first, csName.second, profile_rawdata);
Q_CHECK_PTR(profile);
if (profile) {
// dbgFile << "profile name: " << profile->productName() << " profile description: " << profile->productDescription() << " information sur le produit: " << profile->productInfo();
if (!profile->isSuitableForOutput()) {
dbgFile << "the profile is not suitable for output and therefore cannot be used in krita, we need to convert the image to a standard profile"; // TODO: in ko2 popup a selection menu to inform the user
}
}
}
else {
dbgFile << "no embedded profile, will use the default profile";
if (color_nb_bits == 16 && !fromBlender && !qAppName().toLower().contains("test") && !m_batchMode) {
KisConfig cfg;
quint32 behaviour = cfg.pasteBehaviour();
if (behaviour == PASTE_ASK) {
KisDlgPngImport dlg(m_path, csName.first, csName.second);
QApplication::restoreOverrideCursor();
dlg.exec();
if (!dlg.profile().isEmpty()) {
-
- QString s = KoColorSpaceRegistry::instance()->colorSpaceId(csName.first, csName.second);
-
- const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s);
- if (csf) {
- QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
- Q_FOREACH (const KoColorProfile *p, profileList) {
- if (p->name() == dlg.profile()) {
- profile = p;
- break;
- }
- }
- }
+ profile = KoColorSpaceRegistry::instance()->profileByName(dlg.profile());
}
QApplication::setOverrideCursor(Qt::WaitCursor);
}
}
dbgFile << "no embedded profile, will use the default profile";
}
+ const QString colorSpaceId =
+ KoColorSpaceRegistry::instance()->colorSpaceId(csName.first, csName.second);
+
// Check that the profile is used by the color space
- if (profile && !KoColorSpaceRegistry::instance()->colorSpaceFactory(
- KoColorSpaceRegistry::instance()->colorSpaceId(
- csName.first, csName.second))->profileIsCompatible(profile)) {
+ if (profile && !KoColorSpaceRegistry::instance()->profileIsCompatible(profile, colorSpaceId)) {
warnFile << "The profile " << profile->name() << " is not compatible with the color space model " << csName.first << " " << csName.second;
profile = 0;
}
// Retrieve a pointer to the colorspace
const KoColorSpace* cs;
if (profile && profile->isSuitableForOutput()) {
dbgFile << "image has embedded profile: " << profile->name() << "\n";
cs = KoColorSpaceRegistry::instance()->colorSpace(csName.first, csName.second, profile);
}
else {
if (csName.first == RGBAColorModelID.id()) {
cs = KoColorSpaceRegistry::instance()->colorSpace(csName.first, csName.second, "sRGB-elle-V2-srgbtrc.icc");
}
else {
cs = KoColorSpaceRegistry::instance()->colorSpace(csName.first, csName.second, 0);
}
}
if (cs == 0) {
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
//TODO: two fixes : one tell the user about the problem and ask for a solution, and two once the kocolorspace include KoColorTransformation, use that instead of hacking a lcms transformation
// Create the cmsTransform if needed
KoColorTransformation* transform = 0;
if (profile && !profile->isSuitableForOutput()) {
transform = KoColorSpaceRegistry::instance()->colorSpace(csName.first, csName.second, profile)->createColorConverter(cs, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
}
// Creating the KisImageSP
if (m_image == 0) {
m_image = new KisImage(m_doc->createUndoStore(), width, height, cs, "built image");
Q_CHECK_PTR(m_image);
}
// Read resolution
int unit_type;
png_uint_32 x_resolution, y_resolution;
png_get_pHYs(png_ptr, info_ptr, &x_resolution, &y_resolution, &unit_type);
if (x_resolution > 0 && y_resolution > 0 && unit_type == PNG_RESOLUTION_METER) {
m_image->setResolution((double) POINT_TO_CM(x_resolution) / 100.0, (double) POINT_TO_CM(y_resolution) / 100.0); // It is the "invert" macro because we convert from pointer-per-inchs to points
}
double coeff = quint8_MAX / (double)(pow((double)2, color_nb_bits) - 1);
KisPaintLayerSP layer = new KisPaintLayer(m_image.data(), m_image -> nextLayerName(), UCHAR_MAX);
// Read comments/texts...
png_get_text(png_ptr, info_ptr, &text_ptr, &num_comments);
if (m_doc) {
KoDocumentInfo * info = m_doc->documentInfo();
dbgFile << "There are " << num_comments << " comments in the text";
for (int i = 0; i < num_comments; i++) {
QString key = QString(text_ptr[i].key).toLower();
dbgFile << "key is |" << text_ptr[i].key << "| containing " << text_ptr[i].text << " " << (key == "Raw profile type exif ");
if (key == "title") {
info->setAboutInfo("title", text_ptr[i].text);
} else if (key == "description") {
info->setAboutInfo("comment", text_ptr[i].text);
} else if (key == "author") {
qDebug()<<"Author:"<<text_ptr[i].text;
info->setAuthorInfo("creator", text_ptr[i].text);
} else if (key.contains("Raw profile type exif")) {
decode_meta_data(text_ptr + i, layer->metaData(), "exif", 6);
} else if (key.contains("Raw profile type iptc")) {
decode_meta_data(text_ptr + i, layer->metaData(), "iptc", 14);
} else if (key.contains("Raw profile type xmp")) {
decode_meta_data(text_ptr + i, layer->metaData(), "xmp", 0);
} else if (key == "version") {
m_image->addAnnotation(new KisAnnotation("kpp_version", "version", QByteArray(text_ptr[i].text)));
} else if (key == "preset") {
m_image->addAnnotation(new KisAnnotation("kpp_preset", "preset", QByteArray(text_ptr[i].text)));
}
}
}
// Read image data
KisPNGReaderAbstract* reader = 0;
try {
if (interlace_type == PNG_INTERLACE_ADAM7) {
reader = new KisPNGReaderFullImage(png_ptr, info_ptr, width, height);
} else {
reader = new KisPNGReaderLineByLine(png_ptr, info_ptr, width, height);
}
} catch (std::bad_alloc& e) {
// new png_byte[] may raise such an exception if the image
// is invalid / to large.
dbgFile << "bad alloc: " << e.what();
// Free only the already allocated png_byte instances.
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return (KisImageBuilder_RESULT_FAILURE);
}
// Read the palette if the file is indexed
png_colorp palette ;
int num_palette;
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
}
// Read the transparency palette
quint8 palette_alpha[256];
memset(palette_alpha, 255, 256);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_bytep alpha_ptr;
int num_alpha;
png_get_tRNS(png_ptr, info_ptr, &alpha_ptr, &num_alpha, 0);
for (int i = 0; i < num_alpha; ++i) {
palette_alpha[i] = alpha_ptr[i];
}
}
}
for (png_uint_32 y = 0; y < height; y++) {
KisHLineIteratorSP it = layer -> paintDevice() -> createHLineIteratorNG(0, y, width);
png_bytep row_pointer = reader->readLine();
switch (color_type) {
case PNG_COLOR_TYPE_GRAY:
case PNG_COLOR_TYPE_GRAY_ALPHA:
if (color_nb_bits == 16) {
quint16 *src = reinterpret_cast<quint16 *>(row_pointer);
do {
quint16 *d = reinterpret_cast<quint16 *>(it->rawData());
d[0] = *(src++);
if (transform) transform->transform(reinterpret_cast<quint8*>(d), reinterpret_cast<quint8*>(d), 1);
if (hasalpha) {
d[1] = *(src++);
} else {
d[1] = quint16_MAX;
}
} while (it->nextPixel());
} else {
KisPNGReadStream stream(row_pointer, color_nb_bits);
do {
quint8 *d = it->rawData();
d[0] = (quint8)(stream.nextValue() * coeff);
if (transform) transform->transform(d, d, 1);
if (hasalpha) {
d[1] = (quint8)(stream.nextValue() * coeff);
} else {
d[1] = UCHAR_MAX;
}
} while (it->nextPixel());
}
// FIXME:should be able to read 1 and 4 bits depth and scale them to 8 bits"
break;
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_RGB_ALPHA:
if (color_nb_bits == 16) {
quint16 *src = reinterpret_cast<quint16 *>(row_pointer);
do {
quint16 *d = reinterpret_cast<quint16 *>(it->rawData());
d[2] = *(src++);
d[1] = *(src++);
d[0] = *(src++);
if (transform) transform->transform(reinterpret_cast<quint8 *>(d), reinterpret_cast<quint8*>(d), 1);
if (hasalpha) d[3] = *(src++);
else d[3] = quint16_MAX;
} while (it->nextPixel());
} else {
KisPNGReadStream stream(row_pointer, color_nb_bits);
do {
quint8 *d = it->rawData();
d[2] = (quint8)(stream.nextValue() * coeff);
d[1] = (quint8)(stream.nextValue() * coeff);
d[0] = (quint8)(stream.nextValue() * coeff);
if (transform) transform->transform(d, d, 1);
if (hasalpha) d[3] = (quint8)(stream.nextValue() * coeff);
else d[3] = UCHAR_MAX;
} while (it->nextPixel());
}
break;
case PNG_COLOR_TYPE_PALETTE: {
KisPNGReadStream stream(row_pointer, color_nb_bits);
do {
quint8 *d = it->rawData();
quint8 index = stream.nextValue();
quint8 alpha = palette_alpha[ index ];
if (alpha == 0) {
memset(d, 0, 4);
} else {
png_color c = palette[ index ];
d[2] = c.red;
d[1] = c.green;
d[0] = c.blue;
d[3] = alpha;
}
} while (it->nextPixel());
}
break;
default:
return KisImageBuilder_RESULT_UNSUPPORTED;
}
}
m_image->addNode(layer.data(), m_image->rootLayer().data());
png_read_end(png_ptr, end_info);
iod->close();
// Freeing memory
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
delete reader;
return KisImageBuilder_RESULT_OK;
}
KisImageBuilder_Result KisPNGConverter::buildImage(const QString &filename)
{
m_path = filename;
QFile fp(filename);
if (fp.exists()) {
if (!fp.open(QIODevice::ReadOnly)) {
dbgFile << "Failed to open PNG File";
return (KisImageBuilder_RESULT_FAILURE);
}
return buildImage(&fp);
}
return (KisImageBuilder_RESULT_NOT_EXIST);
}
KisImageSP KisPNGConverter::image()
{
return m_image;
}
bool KisPNGConverter::saveDeviceToStore(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP dev, KoStore *store, KisMetaData::Store* metaData)
{
if (store->open(filename)) {
KoStoreDevice io(store);
if (!io.open(QIODevice::WriteOnly)) {
dbgFile << "Could not open for writing:" << filename;
return false;
}
KisPNGConverter pngconv(0);
vKisAnnotationSP_it annotIt = 0;
KisMetaData::Store* metaDataStore = 0;
if (metaData) {
metaDataStore = new KisMetaData::Store(*metaData);
}
KisPNGOptions options;
options.compression = 0;
options.interlace = false;
options.tryToSaveAsIndexed = false;
options.alpha = true;
options.saveSRGBProfile = false;
if (dev->colorSpace()->id() != "RGBA") {
dev = new KisPaintDevice(*dev.data());
KUndo2Command *cmd = dev->convertTo(KoColorSpaceRegistry::instance()->rgb8());
delete cmd;
}
bool success = pngconv.buildFile(&io, imageRect, xRes, yRes, dev, annotIt, annotIt, options, metaDataStore);
if (success != KisImageBuilder_RESULT_OK) {
dbgFile << "Saving PNG failed:" << filename;
delete metaDataStore;
return false;
}
delete metaDataStore;
io.close();
if (!store->close()) {
return false;
}
} else {
dbgFile << "Opening of data file failed :" << filename;
return false;
}
return true;
}
KisImageBuilder_Result KisPNGConverter::buildFile(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store* metaData)
{
dbgFile << "Start writing PNG File " << filename;
// Open a QIODevice for writing
QFile fp (filename);
if (!fp.open(QIODevice::WriteOnly)) {
dbgFile << "Failed to open PNG File for writing";
return (KisImageBuilder_RESULT_FAILURE);
}
KisImageBuilder_Result result = buildFile(&fp, imageRect, xRes, yRes, device, annotationsStart, annotationsEnd, options, metaData);
return result;
}
KisImageBuilder_Result KisPNGConverter::buildFile(QIODevice* iodevice, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store* metaData)
{
if (!device)
return KisImageBuilder_RESULT_INVALID_ARG;
if (!options.alpha) {
KisPaintDeviceSP tmp = new KisPaintDevice(device->colorSpace());
KoColor c(options.transparencyFillColor, device->colorSpace());
tmp->fill(imageRect, c);
KisPainter gc(tmp);
gc.bitBlt(imageRect.topLeft(), device, imageRect);
gc.end();
device = tmp;
}
if (device->colorSpace()->colorDepthId() == Float16BitsColorDepthID
|| device->colorSpace()->colorDepthId() == Float32BitsColorDepthID
|| device->colorSpace()->colorDepthId() == Float64BitsColorDepthID) {
const KoColorSpace *dstcs = KoColorSpaceRegistry::instance()->colorSpace(device->colorSpace()->colorModelId().id(), Integer8BitsColorDepthID.id(), "");
KisPaintDeviceSP tmp = new KisPaintDevice(dstcs);
KisPainter gc(tmp);
gc.bitBlt(imageRect.topLeft(), device, imageRect);
gc.end();
device = tmp;
}
if (options.forceSRGB) {
const KoColorSpace* cs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(), device->colorSpace()->colorDepthId().id(), "sRGB built-in - (lcms internal)");
device = new KisPaintDevice(*device);
KUndo2Command *cmd = device->convertTo(cs);
delete cmd;
}
// Initialize structures
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
if (!png_ptr) {
return (KisImageBuilder_RESULT_FAILURE);
}
#if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && defined(PNG_SET_OPTION_SUPPORTED)
png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE, PNG_OPTION_ON);
#endif
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
png_set_check_for_invalid_index(png_ptr, 0);
#endif
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_write_struct(&png_ptr, (png_infopp)0);
return (KisImageBuilder_RESULT_FAILURE);
}
// If an error occurs during writing, libpng will jump here
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_write_struct(&png_ptr, &info_ptr);
return (KisImageBuilder_RESULT_FAILURE);
}
// Initialize the writing
// png_init_io(png_ptr, fp);
// Setup the progress function
// XXX: Implement progress updating -- png_set_write_status_fn(png_ptr, progress);"
// setProgressTotalSteps(100/*height*/);
/* set the zlib compression level */
png_set_compression_level(png_ptr, options.compression);
png_set_write_fn(png_ptr, (void*)iodevice, _write_fn, _flush_fn);
/* set other zlib parameters */
png_set_compression_mem_level(png_ptr, 8);
png_set_compression_strategy(png_ptr, Z_DEFAULT_STRATEGY);
png_set_compression_window_bits(png_ptr, 15);
png_set_compression_method(png_ptr, 8);
png_set_compression_buffer_size(png_ptr, 8192);
int color_nb_bits = 8 * device->pixelSize() / device->channelCount();
int color_type = getColorTypeforColorSpace(device->colorSpace(), options.alpha);
Q_ASSERT(color_type > -1);
// Try to compute a table of color if the colorspace is RGB8f
png_colorp palette = 0;
int num_palette = 0;
if (!options.alpha && options.tryToSaveAsIndexed && KoID(device->colorSpace()->id()) == KoID("RGBA")) { // png doesn't handle indexed images and alpha, and only have indexed for RGB8
palette = new png_color[255];
KisSequentialIterator it(device, imageRect);
bool toomuchcolor = false;
do {
const quint8* c = it.oldRawData();
bool findit = false;
for (int i = 0; i < num_palette; i++) {
if (palette[i].red == c[2] &&
palette[i].green == c[1] &&
palette[i].blue == c[0]) {
findit = true;
break;
}
}
if (!findit) {
if (num_palette == 255) {
toomuchcolor = true;
break;
}
palette[num_palette].red = c[2];
palette[num_palette].green = c[1];
palette[num_palette].blue = c[0];
num_palette++;
}
} while (it.nextPixel());
if (!toomuchcolor) {
dbgFile << "Found a palette of " << num_palette << " colors";
color_type = PNG_COLOR_TYPE_PALETTE;
if (num_palette <= 2) {
color_nb_bits = 1;
} else if (num_palette <= 4) {
color_nb_bits = 2;
} else if (num_palette <= 16) {
color_nb_bits = 4;
} else {
color_nb_bits = 8;
}
} else {
delete [] palette;
}
}
int interlacetype = options.interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;
png_set_IHDR(png_ptr, info_ptr,
imageRect.width(),
imageRect.height(),
color_nb_bits,
color_type, interlacetype,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
// set sRGB only if the profile is sRGB -- http://www.w3.org/TR/PNG/#11sRGB says sRGB and iCCP should not both be present
bool sRGB = device->colorSpace()->profile()->name().contains(QLatin1String("srgb"), Qt::CaseInsensitive);
/*
* This automatically writes the correct gamma and chroma chunks along with the sRGB chunk, but firefox's
* color management is bugged, so once you give it any incentive to start color managing an sRGB image it
* will turn, for example, a nice desaturated rusty red into bright poppy red. So this is disabled for now.
*/
/*if (!options.saveSRGBProfile && sRGB) {
png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, PNG_sRGB_INTENT_PERCEPTUAL);
}*/
// set the palette
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_set_PLTE(png_ptr, info_ptr, palette, num_palette);
}
// Save annotation
vKisAnnotationSP_it it = annotationsStart;
while (it != annotationsEnd) {
if (!(*it) || (*it)->type().isEmpty()) {
dbgFile << "Warning: empty annotation";
it++;
continue;
}
dbgFile << "Trying to store annotation of type " << (*it) -> type() << " of size " << (*it) -> annotation() . size();
if ((*it) -> type().startsWith(QString("krita_attribute:"))) { //
// Attribute
// XXX: it should be possible to save krita_attributes in the \"CHUNKs\""
dbgFile << "cannot save this annotation : " << (*it) -> type();
} else if ((*it)->type() == "kpp_version" || (*it)->type() == "kpp_preset" ) {
dbgFile << "Saving preset information " << (*it)->description();
png_textp text = (png_textp) png_malloc(png_ptr, (png_uint_32) sizeof(png_text));
QByteArray keyData = (*it)->description().toLatin1();
text[0].key = keyData.data();
text[0].text = (char*)(*it)->annotation().data();
text[0].text_length = (*it)->annotation().size();
text[0].compression = -1;
png_set_text(png_ptr, info_ptr, text, 1);
png_free(png_ptr, text);
}
it++;
}
// Save the color profile
const KoColorProfile* colorProfile = device->colorSpace()->profile();
QByteArray colorProfileData = colorProfile->rawData();
if (!sRGB || options.saveSRGBProfile) {
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 5
png_set_iCCP(png_ptr, info_ptr, (char*)"icc", PNG_COMPRESSION_TYPE_BASE, (const png_bytep)colorProfileData.constData(), colorProfileData . size());
#else
png_set_iCCP(png_ptr, info_ptr, (char*)"icc", PNG_COMPRESSION_TYPE_BASE, (char*)colorProfileData.constData(), colorProfileData . size());
#endif
}
// read comments from the document information
// warning: according to the official png spec, the keys need to be capitalised!
if (m_doc) {
png_text texts[3];
int nbtexts = 0;
KoDocumentInfo * info = m_doc->documentInfo();
QString title = info->aboutInfo("title");
if (!title.isEmpty()) {
fillText(texts + nbtexts, "Title", title);
nbtexts++;
}
QString abstract = info->aboutInfo("comment");
if (!abstract.isEmpty()) {
fillText(texts + nbtexts, "Description", abstract);
nbtexts++;
}
QString author = info->authorInfo("creator");
if (!author.isEmpty()) {
fillText(texts + nbtexts, "Author", author);
nbtexts++;
}
png_set_text(png_ptr, info_ptr, texts, nbtexts);
}
// Save metadata following imagemagick way
// Save exif
if (metaData && !metaData->empty()) {
if (options.exif) {
dbgFile << "Trying to save exif information";
KisMetaData::IOBackend* exifIO = KisMetaData::IOBackendRegistry::instance()->value("exif");
Q_ASSERT(exifIO);
QBuffer buffer;
exifIO->saveTo(metaData, &buffer, KisMetaData::IOBackend::JpegHeader);
writeRawProfile(png_ptr, info_ptr, "exif", buffer.data());
}
// Save IPTC
if (options.iptc) {
dbgFile << "Trying to save exif information";
KisMetaData::IOBackend* iptcIO = KisMetaData::IOBackendRegistry::instance()->value("iptc");
Q_ASSERT(iptcIO);
QBuffer buffer;
iptcIO->saveTo(metaData, &buffer, KisMetaData::IOBackend::JpegHeader);
dbgFile << "IPTC information size is" << buffer.data().size();
writeRawProfile(png_ptr, info_ptr, "iptc", buffer.data());
}
// Save XMP
if (options.xmp) {
dbgFile << "Trying to save XMP information";
KisMetaData::IOBackend* xmpIO = KisMetaData::IOBackendRegistry::instance()->value("xmp");
Q_ASSERT(xmpIO);
QBuffer buffer;
xmpIO->saveTo(metaData, &buffer, KisMetaData::IOBackend::NoHeader);
dbgFile << "XMP information size is" << buffer.data().size();
writeRawProfile(png_ptr, info_ptr, "xmp", buffer.data());
}
}
#if 0 // Unimplemented?
// Save resolution
int unit_type;
png_uint_32 x_resolution, y_resolution;
#endif
png_set_pHYs(png_ptr, info_ptr, CM_TO_POINT(xRes) * 100.0, CM_TO_POINT(yRes) * 100.0, PNG_RESOLUTION_METER); // It is the "invert" macro because we convert from pointer-per-inchs to points
// Save the information to the file
png_write_info(png_ptr, info_ptr);
png_write_flush(png_ptr);
// swap byteorder on little endian machines.
#ifndef WORDS_BIGENDIAN
if (color_nb_bits > 8)
png_set_swap(png_ptr);
#endif
// Write the PNG
// png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, 0);
// Fill the data structure
png_byte** row_pointers = new png_byte*[imageRect.height()];
int row = 0;
for (int y = imageRect.y(); y < imageRect.y() + imageRect.height(); y++, row++) {
KisHLineConstIteratorSP it = device->createHLineConstIteratorNG(imageRect.x(), y, imageRect.width());
row_pointers[row] = new png_byte[imageRect.width() * device->pixelSize()];
switch (color_type) {
case PNG_COLOR_TYPE_GRAY:
case PNG_COLOR_TYPE_GRAY_ALPHA:
if (color_nb_bits == 16) {
quint16 *dst = reinterpret_cast<quint16 *>(row_pointers[row]);
do {
const quint16 *d = reinterpret_cast<const quint16 *>(it->oldRawData());
*(dst++) = d[0];
if (options.alpha) *(dst++) = d[1];
} while (it->nextPixel());
} else {
quint8 *dst = row_pointers[row];
do {
const quint8 *d = it->oldRawData();
*(dst++) = d[0];
if (options.alpha) *(dst++) = d[1];
} while (it->nextPixel());
}
break;
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_RGB_ALPHA:
if (color_nb_bits == 16) {
quint16 *dst = reinterpret_cast<quint16 *>(row_pointers[row]);
do {
const quint16 *d = reinterpret_cast<const quint16 *>(it->oldRawData());
*(dst++) = d[2];
*(dst++) = d[1];
*(dst++) = d[0];
if (options.alpha) *(dst++) = d[3];
} while (it->nextPixel());
} else {
quint8 *dst = row_pointers[row];
do {
const quint8 *d = it->oldRawData();
*(dst++) = d[2];
*(dst++) = d[1];
*(dst++) = d[0];
if (options.alpha) *(dst++) = d[3];
} while (it->nextPixel());
}
break;
case PNG_COLOR_TYPE_PALETTE: {
quint8 *dst = row_pointers[row];
KisPNGWriteStream writestream(dst, color_nb_bits);
do {
const quint8 *d = it->oldRawData();
int i;
for (i = 0; i < num_palette; i++) {
if (palette[i].red == d[2] &&
palette[i].green == d[1] &&
palette[i].blue == d[0]) {
break;
}
}
writestream.setNextValue(i);
} while (it->nextPixel());
}
break;
default:
delete[] row_pointers;
return KisImageBuilder_RESULT_UNSUPPORTED;
}
}
png_write_image(png_ptr, row_pointers);
// Writing is over
png_write_end(png_ptr, info_ptr);
// Free memory
png_destroy_write_struct(&png_ptr, &info_ptr);
for (int y = 0; y < imageRect.height(); y++) {
delete[] row_pointers[y];
}
delete[] row_pointers;
if (color_type == PNG_COLOR_TYPE_PALETTE) {
delete [] palette;
}
return KisImageBuilder_RESULT_OK;
}
void KisPNGConverter::cancel()
{
m_stop = true;
}
void KisPNGConverter::progress(png_structp png_ptr, png_uint_32 row_number, int pass)
{
if (png_ptr == 0 || row_number > PNG_MAX_UINT || pass > 7) return;
// setProgress(row_number);
}
bool KisPNGConverter::isColorSpaceSupported(const KoColorSpace *cs)
{
return colorSpaceIdSupported(cs->id());
}
diff --git a/libs/ui/kis_png_converter.h b/libs/ui/kis_png_converter.h
index 0bc43121f0..d6a4ff038d 100644
--- a/libs/ui/kis_png_converter.h
+++ b/libs/ui/kis_png_converter.h
@@ -1,138 +1,138 @@
/*
* Copyright (c) 2005, 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PNG_CONVERTER_H_
#define _KIS_PNG_CONVERTER_H_
#include <png.h>
#include <QColor>
#include <QVector>
#include "kis_types.h"
#include "kis_global.h"
#include "kis_annotation.h"
#include <kritaui_export.h>
#include <KisImageBuilderResult.h>
class KoStore;
class KisDocument;
class KoColorSpace;
namespace KisMetaData
{
class Filter;
class Store;
}
struct KisPNGOptions {
KisPNGOptions()
: compression(0)
, interlace(false)
, alpha(true)
, exif(true)
, iptc(true)
, xmp(true)
, tryToSaveAsIndexed(true)
, saveSRGBProfile(false)
, forceSRGB(false)
, transparencyFillColor(Qt::white)
{}
int compression;
bool interlace;
bool alpha;
bool exif;
bool iptc;
bool xmp;
bool tryToSaveAsIndexed;
bool saveSRGBProfile;
bool forceSRGB;
QList<const KisMetaData::Filter*> filters;
QColor transparencyFillColor;
};
/**
* This class allows to import/export a PNG from either a file or a QIODevice.
*/
// XXX_PROGRESS (pass KoUpdater to the png converter)
class KRITAUI_EXPORT KisPNGConverter : public QObject
{
Q_OBJECT
public:
/**
* Initialize the converter.
* @param doc the KisDocument related to the image, can be null if you don't have a KisDocument
* @param adapter the undo adapter to be used by the image, can be null if you don't want to use an undo adapter
*/
KisPNGConverter(KisDocument *doc, bool batchMode = false);
- virtual ~KisPNGConverter();
+ ~KisPNGConverter() override;
public:
/**
* Load an image from an URL. If the image is not on a local drive, the image is first downloaded to a
* temporary location.
* @param uri the url of the image
*/
KisImageBuilder_Result buildImage(const QString &filename);
/**
* Load an image from a QIODevice.
* @param iod device to access the data
*/
KisImageBuilder_Result buildImage(QIODevice* iod);
/**
* Save a layer to a PNG
* @param uri the url of the destination file
* @param device the paint device to save
* @param annotationsStart an iterator on the first annotation
* @param annotationsEnd an iterator on the last annotation
* @param compression a number between 0 and 9 to specify the compression rate (9 is most compressed)
* @param interlace set to true if you want to generate an interlaced png
* @param alpha set to true if you want to save the alpha channel
*/
KisImageBuilder_Result buildFile(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store* metaData);
KisImageBuilder_Result buildFile(QIODevice*, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store* metaData);
/**
* Retrieve the constructed image
*/
KisImageSP image();
/**
* @brief saveDeviceToStore saves the given paint device to the KoStore. If the device is not 8 bits sRGB, it will be converted to 8 bits sRGB.
* @return true if the saving succeeds
*/
static bool saveDeviceToStore(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP dev, KoStore *store, KisMetaData::Store* metaData = 0);
static bool isColorSpaceSupported(const KoColorSpace *cs);
public Q_SLOTS:
virtual void cancel();
private:
void progress(png_structp png_ptr, png_uint_32 row_number, int pass);
private:
png_uint_32 m_max_row;
KisImageSP m_image;
KisDocument *m_doc;
bool m_stop;
bool m_batchMode;
QString m_path;
};
#endif
diff --git a/libs/ui/kis_popup_palette.h b/libs/ui/kis_popup_palette.h
index 1aa922c1ee..df6c4c16c2 100644
--- a/libs/ui/kis_popup_palette.h
+++ b/libs/ui/kis_popup_palette.h
@@ -1,176 +1,176 @@
/* This file is part of the KDE project
Copyright 2009 Vera Lukman <shicmap@gmail.com>
Copyright 2016 Scott Petrovic <scottpetrovic@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_POPUP_PALETTE_H
#define KIS_POPUP_PALETTE_H
#include <kis_types.h>
#include <QWidget>
#include <QQueue>
#include <QPushButton>
#include <QSlider>
#include <KoColorDisplayRendererInterface.h>
#include "kis_action_manager.h"
#include "KisViewManager.h"
#include "kactioncollection.h"
#include "kis_coordinates_converter.h"
#include "kis_tool_button.h"
#include "kis_highlighted_button.h"
#include <KisColorSelectorInterface.h>
class KisFavoriteResourceManager;
class QWidget;
class KoColor;
class KoTriangleColorSelector;
class KisSignalCompressor;
class KisBrushHud;
class KisRoundHudButton;
class KisCanvasResourceProvider;
class KisVisualColorSelector;
class KisPopupPalette : public QWidget
{
Q_OBJECT
Q_PROPERTY(int hoveredPreset READ hoveredPreset WRITE setHoveredPreset)
Q_PROPERTY(int hoveredColor READ hoveredColor WRITE setHoveredColor)
Q_PROPERTY(int selectedColor READ selectedColor WRITE setSelectedColor)
public:
KisPopupPalette(KisViewManager*, KisCoordinatesConverter* ,KisFavoriteResourceManager*, const KoColorDisplayRendererInterface *displayRenderer,
KisCanvasResourceProvider *provider, QWidget *parent = 0);
- ~KisPopupPalette();
- QSize sizeHint() const;
+ ~KisPopupPalette() override;
+ QSize sizeHint() const override;
void showPopupPalette(const QPoint&);
void showPopupPalette(bool b);
//functions to set up selectedBrush
void setSelectedBrush(int x);
int selectedBrush() const;
//functions to set up selectedColor
void setSelectedColor(int x);
int selectedColor() const;
void setParent(QWidget *parent);
- virtual void tabletEvent(QTabletEvent * event);
+ void tabletEvent(QTabletEvent * event) override;
protected:
- void paintEvent(QPaintEvent*);
- void resizeEvent(QResizeEvent*);
- void mouseReleaseEvent(QMouseEvent*);
- void mouseMoveEvent(QMouseEvent*);
- void mousePressEvent(QMouseEvent*);
+ void paintEvent(QPaintEvent*) override;
+ void resizeEvent(QResizeEvent*) override;
+ void mouseReleaseEvent(QMouseEvent*) override;
+ void mouseMoveEvent(QMouseEvent*) override;
+ void mousePressEvent(QMouseEvent*) override;
//functions to calculate index of favorite brush or recent color in array
//n is the total number of favorite brushes or recent colors
int calculateIndex(QPointF, int n);
int calculatePresetIndex(QPointF, int n);
//functions to set up hoveredBrush
void setHoveredPreset(int x);
int hoveredPreset() const;
//functions to set up hoveredColor
void setHoveredColor(int x);
int hoveredColor() const;
private:
- void setVisible(bool b);
+ void setVisible(bool b) override;
QPainterPath drawDonutPathFull(int, int, int, int);
QPainterPath drawDonutPathAngle(int, int, int);
QPainterPath drawRotationIndicator(qreal rotationAngle, bool canDrag);
bool isPointInPixmap(QPointF&, int pos);
QPainterPath createPathFromPresetIndex(int index);
int numSlots();
void adjustLayout(const QPoint &p);
private:
int m_hoveredPreset;
int m_hoveredColor;
int m_selectedColor;
KisCoordinatesConverter* m_coordinatesConverter;
KisActionManager* m_actionManager;
KisFavoriteResourceManager* m_resourceManager;
KisColorSelectorInterface* m_triangleColorSelector {0};
const KoColorDisplayRendererInterface *m_displayRenderer;
QScopedPointer<KisSignalCompressor> m_colorChangeCompressor;
KActionCollection* m_actionCollection;
QTimer m_timer;
KisBrushHud *m_brushHud;
float m_popupPaletteSize;
float m_colorHistoryInnerRadius;
float m_colorHistoryOuterRadius;
KisRoundHudButton *m_settingsButton;
KisRoundHudButton *m_brushHudButton;
QPoint m_lastCenterPoint;
QRect m_canvasRotationIndicatorRect;
QRect m_resetCanvasRotationIndicatorRect;
bool m_isOverCanvasRotationIndicator;
bool m_isRotatingCanvasIndicator;
KisHighlightedToolButton* mirrorMode;
KisHighlightedToolButton* canvasOnlyButton;
QPushButton* zoomToOneHundredPercentButton;
QSlider* zoomCanvasSlider;
Q_SIGNALS:
void sigChangeActivePaintop(int);
void sigUpdateRecentColor(int);
void sigChangefGColor(const KoColor&);
void sigUpdateCanvas();
void zoomLevelChanged(int);
// These are used to handle a bug:
// If pop up palette is visible and a new colour is selected, the new colour
// will be added when the user clicks on the canvas to hide the palette
// In general, we want to be able to store recent color if the pop up palette
// is not visible
void sigEnableChangeFGColor(bool);
void sigTriggerTimer();
private Q_SLOTS:
void slotExternalFgColorChanged(const KoColor &color);
void slotEmitColorChanged();
void slotSetSelectedColor(int x) { setSelectedColor(x); update(); }
void slotTriggerTimer();
void slotEnableChangeFGColor();
void slotUpdate() { update(); }
void slotHide() { showPopupPalette(false); }
void slotShowTagsPopup();
void showHudWidget(bool visible);
void slotmirroModeClicked();
void slotCanvasonlyModeClicked();
void slotZoomToOneHundredPercentClicked();
void slotZoomSliderChanged(int zoom);
};
#endif // KIS_POPUP_PALETTE_H
diff --git a/libs/ui/kis_preference_set_registry.h b/libs/ui/kis_preference_set_registry.h
index bb9eb9533f..984ced018f 100644
--- a/libs/ui/kis_preference_set_registry.h
+++ b/libs/ui/kis_preference_set_registry.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2010 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PREFERENCE_SET_REGISTRY_H_
#define KIS_PREFERENCE_SET_REGISTRY_H_
#include <QObject>
#include <QWidget>
#include <QString>
#include "KoGenericRegistry.h"
#include "kis_types.h"
#include <kritaui_export.h>
class QIcon;
/**
* Implement this abstract class to provide a preferences pane for the preferences dialog.
*/
class KRITAUI_EXPORT KisPreferenceSet : public QWidget {
Q_OBJECT
public:
KisPreferenceSet(QWidget* parent=0) : QWidget(parent)
{}
virtual QString id() = 0;
virtual QString name() = 0;
virtual QString header() = 0;
virtual QIcon icon() = 0;
public Q_SLOTS:
virtual void savePreferences() const = 0;
virtual void loadPreferences() = 0;
virtual void loadDefaultPreferences() = 0;
};
class KRITAUI_EXPORT KisAbstractPreferenceSetFactory {
public:
virtual ~KisAbstractPreferenceSetFactory() {}
virtual KisPreferenceSet* createPreferenceSet() = 0;
virtual QString id() const = 0;
};
/**
* This registry does not load the plugins itself: plugins with preferences panes should
* add those panes when they are loaded themselves.
*/
class KRITAUI_EXPORT KisPreferenceSetRegistry : public QObject, public KoGenericRegistry<KisAbstractPreferenceSetFactory*>
{
public:
KisPreferenceSetRegistry();
- virtual ~KisPreferenceSetRegistry();
+ ~KisPreferenceSetRegistry() override;
static KisPreferenceSetRegistry * instance();
private:
Q_DISABLE_COPY(KisPreferenceSetRegistry)
};
#endif // KIS_PREFERENCE_SETSPACE_REGISTRY_H_
diff --git a/libs/ui/kis_psd_layer_style_resource.h b/libs/ui/kis_psd_layer_style_resource.h
index 5922e00e61..a6eb08356f 100644
--- a/libs/ui/kis_psd_layer_style_resource.h
+++ b/libs/ui/kis_psd_layer_style_resource.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PSD_LAYER_STYLE_RESOURCE_H
#define KIS_PSD_LAYER_STYLE_RESOURCE_H
#include <resources/KoResource.h>
#include <QVector>
#include <kritaui_export.h>
#include "kis_psd_layer_style.h"
/**
* @brief The KisPSDLayerStyleResource class represents an ASL file type resource.
*/
class KRITAUI_EXPORT KisPSDLayerStyleCollectionResource : public KoResource
{
public:
typedef QVector<KisPSDLayerStyleSP> StylesVector;
public:
explicit KisPSDLayerStyleCollectionResource(const QString &filename);
- virtual ~KisPSDLayerStyleCollectionResource();
+ ~KisPSDLayerStyleCollectionResource() override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
- virtual bool save();
- virtual bool saveToDevice(QIODevice *dev) const;
+ bool save() override;
+ bool saveToDevice(QIODevice *dev) const override;
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
StylesVector layerStyles() const;
void setLayerStyles(StylesVector styles);
void collectAllLayerStyles(KisNodeSP root);
void assignAllLayerStyles(KisNodeSP root);
protected:
- virtual QByteArray generateMD5() const;
+ QByteArray generateMD5() const override;
private:
StylesVector m_layerStyles;
};
#endif // KIS_PSD_LAYER_STYLE_RESOURCE_H
diff --git a/libs/ui/kis_resource_server_provider.h b/libs/ui/kis_resource_server_provider.h
index 2b87205f5f..a8b168eab7 100644
--- a/libs/ui/kis_resource_server_provider.h
+++ b/libs/ui/kis_resource_server_provider.h
@@ -1,79 +1,79 @@
/*
* kis_resource_server_provider.h - part of KImageShop
*
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (c) 2003-2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_RESOURCESERVERPROVIDER_H_
#define KIS_RESOURCESERVERPROVIDER_H_
#include <KoResourceServer.h>
#include <KoResourceServerAdapter.h>
#include <brushengine/kis_paintop_preset.h>
#include "KisResourceBundle.h"
#include "kritaui_export.h"
class KoResourceLoaderThread;
class KisWorkspaceResource;
class KisPSDLayerStyleCollectionResource;
typedef KoResourceServerSimpleConstruction<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServer;
typedef KoResourceServerAdapter<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServerAdapter;
class KRITAUI_EXPORT KisResourceServerProvider : public QObject
{
Q_OBJECT
public:
KisResourceServerProvider();
- virtual ~KisResourceServerProvider();
+ ~KisResourceServerProvider() override;
static KisResourceServerProvider* instance();
KoResourceServer<KisResourceBundle> *resourceBundleServer();
KisPaintOpPresetResourceServer* paintOpPresetServer(bool block = true);
KoResourceServer<KisWorkspaceResource>* workspaceServer(bool block = true);
KoResourceServer<KisPSDLayerStyleCollectionResource>* layerStyleCollectionServer(bool block = true);
void brushBlacklistCleanup();
Q_SIGNALS:
void notifyBrushBlacklistCleanup();
private:
KisResourceServerProvider(const KisResourceServerProvider&);
KisResourceServerProvider operator=(const KisResourceServerProvider&);
KisPaintOpPresetResourceServer *m_paintOpPresetServer;
KoResourceServer<KisWorkspaceResource> *m_workspaceServer;
KoResourceServer<KisPSDLayerStyleCollectionResource> *m_layerStyleCollectionServer;
KoResourceServer<KisResourceBundle> *m_resourceBundleServer;
private:
KoResourceLoaderThread *m_paintOpPresetThread;
KoResourceLoaderThread *m_workspaceThread;
KoResourceLoaderThread *m_layerStyleCollectionThread;
};
#endif // KIS_RESOURCESERVERPROVIDER_H_
diff --git a/libs/ui/kis_safe_document_loader.h b/libs/ui/kis_safe_document_loader.h
index 9d93082ad4..ecc7923bb3 100644
--- a/libs/ui/kis_safe_document_loader.h
+++ b/libs/ui/kis_safe_document_loader.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SAFE_DOCUMENT_LOADER_H
#define __KIS_SAFE_DOCUMENT_LOADER_H
#include <QObject>
#include "kis_types.h"
class KisSafeDocumentLoader : public QObject
{
Q_OBJECT
public:
KisSafeDocumentLoader(const QString &path = "", QObject *parent = 0);
- ~KisSafeDocumentLoader();
+ ~KisSafeDocumentLoader() override;
public:
void setPath(const QString &path);
void reloadImage();
private Q_SLOTS:
void fileChanged(QString);
void fileChangedCompressed(bool sync = false);
void delayedLoadStart();
Q_SIGNALS:
void loadingFinished(KisPaintDeviceSP paintDevice, int xRes, int yRes);
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_SAFE_DOCUMENT_LOADER_H */
diff --git a/libs/ui/kis_script_manager.h b/libs/ui/kis_script_manager.h
index f8cf9aa0d9..db4049f263 100644
--- a/libs/ui/kis_script_manager.h
+++ b/libs/ui/kis_script_manager.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SCRIPT_MANAGER_H
#define KIS_SCRIPT_MANAGER_H
#include <QObject>
#include <kritaui_export.h>
class QAction;
class KisActionManager;
class KisViewManager;
class KActionCollection;
/**
* @brief The KisScriptManager class is responsible for adding scripts to the menu
*/
class KRITAUI_EXPORT KisScriptManager : public QObject
{
Q_OBJECT
public:
explicit KisScriptManager(KisViewManager * view);
- ~KisScriptManager();
+ ~KisScriptManager() override;
void setup(KActionCollection * ac, KisActionManager *actionManager);
void updateGUI();
void addAction(QAction *action);
private:
struct Private;
Private * const d;
};
#endif // KIS_SCRIPT_MANAGER_H
diff --git a/libs/ui/kis_selection_decoration.h b/libs/ui/kis_selection_decoration.h
index 29973a8c8d..a20bb8aa01 100644
--- a/libs/ui/kis_selection_decoration.h
+++ b/libs/ui/kis_selection_decoration.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2008 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SELECTION_DECORATION_H_
#define _KIS_SELECTION_DECORATION_H_
#include <QTimer>
#include <QPolygon>
#include <QPen>
#include <kis_signal_compressor.h>
#include "canvas/kis_canvas_decoration.h"
class KisView;
class KRITAUI_EXPORT KisSelectionDecoration : public KisCanvasDecoration
{
Q_OBJECT
public:
KisSelectionDecoration(QPointer<KisView> view);
- ~KisSelectionDecoration();
+ ~KisSelectionDecoration() override;
enum Mode {
Ants,
Mask
};
Mode mode() const;
void setMode(Mode mode);
- void setVisible(bool v);
+ void setVisible(bool v) override;
protected:
- void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas);
+ void drawDecoration(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter *converter,KisCanvas2* canvas) override;
private Q_SLOTS:
void slotStartUpdateSelection();
public Q_SLOTS:
void selectionChanged();
void antsAttackEvent();
private:
bool selectionIsActive();
private:
KisSignalCompressor m_signalCompressor;
QPainterPath m_outlinePath;
QImage m_thumbnailImage;
QTransform m_thumbnailImageTransform;
QTimer* m_antsTimer;
int m_offset;
QPen m_antsPen;
QPen m_outlinePen;
Mode m_mode;
};
#endif
diff --git a/libs/ui/kis_selection_manager.h b/libs/ui/kis_selection_manager.h
index ea6cb67ee2..5b8046030e 100644
--- a/libs/ui/kis_selection_manager.h
+++ b/libs/ui/kis_selection_manager.h
@@ -1,171 +1,171 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SELECTION_MANAGER_
#define KIS_SELECTION_MANAGER_
#include <QObject>
#include <QList>
#include <QPointer>
#include <kis_image.h>
#include "KisView.h"
#include <kritaui_export.h>
class KisActionManager;
class KisAction;
class QAction;
class KoViewConverter;
class KisDocument;
class KisViewManager;
class KisClipboard;
class KisNodeCommandsAdapter;
class KisView;
class KisSelectionFilter;
class KisSelectionDecoration;
/**
* The selection manager is responsible selections
* and the clipboard.
*/
class KRITAUI_EXPORT KisSelectionManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool displaySelection READ displaySelection NOTIFY displaySelectionChanged);
Q_PROPERTY(bool havePixelsSelected READ havePixelsSelected NOTIFY currentSelectionChanged);
public:
KisSelectionManager(KisViewManager * view);
- virtual ~KisSelectionManager();
+ ~KisSelectionManager() override;
void setup(KisActionManager* actionManager);
void setView(QPointer<KisView>imageView);
public:
/**
* This function return if the selection should be displayed
*/
bool displaySelection();
bool showSelectionAsMask() const;
public Q_SLOTS:
void updateGUI();
void selectionChanged();
void clipboardDataChanged();
void cut();
void copy();
void cutSharp();
void copySharp();
void copyMerged();
void paste();
void pasteNew();
void pasteAt();
void cutToNewLayer();
void selectAll();
void deselect();
void invert();
void clear();
void fillForegroundColor();
void fillBackgroundColor();
void fillPattern();
void fillForegroundColorOpacity();
void fillBackgroundColorOpacity();
void fillPatternOpacity();
void reselect();
void convertToVectorSelection();
void convertShapesToVectorSelection();
void convertToShape();
void copySelectionToNewLayer();
void toggleDisplaySelection();
void shapeSelectionChanged();
void imageResizeToSelection();
void paintSelectedShapes();
void slotToggleSelectionDecoration();
void slotStrokeSelection();
Q_SIGNALS:
void currentSelectionChanged();
void signalUpdateGUI();
void displaySelectionChanged();
void strokeSelected();
public:
bool havePixelsSelected();
bool havePixelsInClipboard();
bool haveShapesSelected();
bool haveShapesInClipboard();
/// Checks if the current selection is editable and has some pixels selected in the pixel selection
bool havePixelSelectionWithPixels();
private:
void fill(const KoColor& color, bool fillWithPattern, const QString& transactionText);
void updateStatusBar();
KisViewManager * m_view;
KisDocument * m_doc;
QPointer<KisView>m_imageView;
KisClipboard * m_clipboard;
KisNodeCommandsAdapter* m_adapter;
KisAction *m_copy;
KisAction *m_copyMerged;
KisAction *m_cut;
KisAction *m_paste;
KisAction *m_pasteAt;
KisAction *m_pasteNew;
KisAction *m_cutToNewLayer;
KisAction *m_selectAll;
KisAction *m_deselect;
KisAction *m_clear;
KisAction *m_reselect;
KisAction *m_invert;
KisAction *m_copyToNewLayer;
KisAction *m_fillForegroundColor;
KisAction *m_fillBackgroundColor;
KisAction *m_fillPattern;
KisAction *m_fillForegroundColorOpacity;
KisAction *m_fillBackgroundColorOpacity;
KisAction *m_fillPatternOpacity;
KisAction *m_imageResizeToSelection;
KisAction *m_strokeShapes;
KisAction *m_toggleDisplaySelection;
KisAction *m_toggleSelectionOverlayMode;
KisAction *m_strokeSelected;
QList<QAction*> m_pluginActions;
QPointer<KisSelectionDecoration> m_selectionDecoration;
};
#endif // KIS_SELECTION_MANAGER_
diff --git a/libs/ui/kis_splash_screen.h b/libs/ui/kis_splash_screen.h
index ccfa1bb678..4ede0b164f 100644
--- a/libs/ui/kis_splash_screen.h
+++ b/libs/ui/kis_splash_screen.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPLASH_SCREEN_H
#define KIS_SPLASH_SCREEN_H
#include <QWidget>
#include <QTimer>
#include "ui_wdgsplash.h"
class QPixmap;
#include "kritaui_export.h"
class KRITAUI_EXPORT KisSplashScreen : public QWidget, public Ui::WdgSplash
{
Q_OBJECT
public:
explicit KisSplashScreen(const QString &m_version, const QPixmap &m_pixmap, bool themed = false, QWidget *parent = 0, Qt::WindowFlags f = 0);
void repaint();
void show();
void displayLinks();
void displayRecentFiles();
private Q_SLOTS:
void toggleShowAtStartup(bool toggle);
void linkClicked(const QString &link);
protected:
- void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
private:
void updateText();
QString colorString() const;
private:
QTimer m_timer;
bool m_themed;
};
#endif // KIS_SPLASH_SCREEN_H
diff --git a/libs/ui/kis_statusbar.h b/libs/ui/kis_statusbar.h
index f3337dd545..acb5ed1c1e 100644
--- a/libs/ui/kis_statusbar.h
+++ b/libs/ui/kis_statusbar.h
@@ -1,129 +1,129 @@
/* This file is part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2003-200^ Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_STATUSBAR_H
#define KIS_STATUSBAR_H
#include <QObject>
#include <QPointer>
#include <QIcon>
#include <QStatusBar>
#include <kis_types.h>
#include "KisView.h"
class QLabel;
class QToolButton;
class QPushButton;
class KSqueezedTextLabel;
class KisViewManager;
class KisProgressWidget;
#include "kritaui_export.h"
class KRITAUI_EXPORT KisStatusBar : public QObject
{
class StatusBarItem
{
public:
StatusBarItem() // for QValueList
: m_widget(0) {}
StatusBarItem(QWidget * widget)
: m_widget(widget) {}
bool operator==(const StatusBarItem& rhs) {
return m_widget == rhs.m_widget;
}
bool operator!=(const StatusBarItem& rhs) {
return m_widget != rhs.m_widget;
}
QWidget * widget() const {
return m_widget;
}
void show() const {
m_widget->show();
}
void hide() const {
m_widget->hide();
}
private:
QPointer<QWidget> m_widget;
};
Q_OBJECT
public:
KisStatusBar(KisViewManager *view);
- ~KisStatusBar();
+ ~KisStatusBar() override;
void setup();
void setView(QPointer<KisView> imageView);
void addStatusBarItem(QWidget *widget, int stretch = 0, bool permanent = false);
void removeStatusBarItem(QWidget *widget);
void hideAllStatusBarItems();
void showAllStatusBarItems();
KisProgressWidget *progress();
public Q_SLOTS:
void documentMousePositionChanged(const QPointF &p);
void imageSizeChanged();
void setSelection(KisImageWSP image);
void setProfile(KisImageWSP image);
void setHelp(const QString &t);
void updateStatusBarProfileLabel();
void updateSelectionToolTip();
private Q_SLOTS:
void updateSelectionIcon();
void showMemoryInfoToolTip();
private:
void updateMemoryStatus();
private:
QPointer<KisViewManager> m_view;
QPointer<KisView> m_imageView;
QPointer<QStatusBar> m_statusBar;
KisProgressWidget * m_progress;
QToolButton *m_selectionStatus;
QPushButton *m_memoryReportBox;
QLabel *m_pointerPositionLabel;
KSqueezedTextLabel *m_statusBarStatusLabel;
KSqueezedTextLabel *m_statusBarProfileLabel;
QString m_shortMemoryTag;
QString m_longMemoryTag;
QIcon m_memoryStatusIcon;
QVector<StatusBarItem> m_statusBarItems;
};
#endif
diff --git a/libs/ui/kis_stopgradient_editor.cpp b/libs/ui/kis_stopgradient_editor.cpp
index b185f040be..4e485ea63e 100644
--- a/libs/ui/kis_stopgradient_editor.cpp
+++ b/libs/ui/kis_stopgradient_editor.cpp
@@ -1,187 +1,189 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
* 2016 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_stopgradient_editor.h"
#include <QPainter>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <KoColorSpace.h>
#include <resources/KoStopGradient.h>
#include "kis_debug.h"
#include <kis_icon_utils.h>
/****************************** KisStopGradientEditor ******************************/
KisStopGradientEditor::KisStopGradientEditor(QWidget *parent)
: QWidget(parent),
m_gradient(0)
{
setupUi(this);
connect(gradientSlider, SIGNAL(sigSelectedStop(int)), this, SLOT(stopChanged(int)));
connect(nameedit, SIGNAL(editingFinished()), this, SLOT(nameChanged()));
connect(colorButton, SIGNAL(changed(const KoColor&)), SLOT(colorChanged(const KoColor&)));
opacitySlider->setPrefix(i18n("Opacity: "));
opacitySlider->setRange(0.0, 1.0, 2);
connect(opacitySlider, SIGNAL(valueChanged(qreal)), this, SLOT(opacityChanged(qreal)));
- buttonReverse->setIcon(KisIconUtils::loadIcon("mirrorAxis-HorizontalMove"));
+ buttonReverse->setIcon(KisIconUtils::loadIcon("view-refresh"));
+ buttonReverse->setToolTip(i18n("Flip Gradient"));
KisIconUtils::updateIcon(buttonReverse);
connect(buttonReverse, SIGNAL(pressed()), SLOT(reverse()));
- buttonReverseSecond->setIcon(KisIconUtils::loadIcon("mirrorAxis-HorizontalMove"));
+ buttonReverseSecond->setIcon(KisIconUtils::loadIcon("view-refresh"));
+ buttonReverseSecond->setToolTip(i18n("Flip Gradient"));
KisIconUtils::updateIcon(buttonReverseSecond);
connect(buttonReverseSecond, SIGNAL(clicked()), SLOT(reverse()));
setCompactMode(false);
setGradient(0);
stopChanged(-1);
}
KisStopGradientEditor::KisStopGradientEditor(KoStopGradient* gradient, QWidget *parent, const char* name, const QString& caption)
: KisStopGradientEditor(parent)
{
setObjectName(name);
setWindowTitle(caption);
setGradient(gradient);
}
void KisStopGradientEditor::setCompactMode(bool value)
{
lblName->setVisible(!value);
buttonReverse->setVisible(!value);
nameedit->setVisible(!value);
buttonReverseSecond->setVisible(value);
}
void KisStopGradientEditor::setGradient(KoStopGradient *gradient)
{
m_gradient = gradient;
setEnabled(m_gradient);
if (m_gradient) {
gradientSlider->setGradientResource(m_gradient);
nameedit->setText(gradient->name());
stopChanged(gradientSlider->selectedStop());
}
emit sigGradientChanged();
}
void KisStopGradientEditor::notifyGlobalColorChanged(const KoColor &color)
{
if (colorButton->isEnabled() &&
color != colorButton->color()) {
colorButton->setColor(color);
}
}
boost::optional<KoColor> KisStopGradientEditor::currentActiveStopColor() const
{
if (!colorButton->isEnabled()) return boost::none;
return colorButton->color();
}
void KisStopGradientEditor::stopChanged(int stop)
{
const bool hasStopSelected = stop >= 0;
opacitySlider->setEnabled(hasStopSelected);
colorButton->setEnabled(hasStopSelected);
stopLabel->setEnabled(hasStopSelected);
if (hasStopSelected) {
KoColor color = m_gradient->stops()[stop].second;
opacitySlider->setValue(color.opacityF());
color.setOpacity(1.0);
colorButton->setColor(color);
}
emit sigGradientChanged();
}
void KisStopGradientEditor::colorChanged(const KoColor& color)
{
QList<KoGradientStop> stops = m_gradient->stops();
int currentStop = gradientSlider->selectedStop();
double t = stops[currentStop].first;
KoColor c(color, stops[currentStop].second.colorSpace());
c.setOpacity(stops[currentStop].second.opacityU8());
stops.removeAt(currentStop);
stops.insert(currentStop, KoGradientStop(t, c));
m_gradient->setStops(stops);
gradientSlider->update();
emit sigGradientChanged();
}
void KisStopGradientEditor::opacityChanged(qreal value)
{
QList<KoGradientStop> stops = m_gradient->stops();
int currentStop = gradientSlider->selectedStop();
double t = stops[currentStop].first;
KoColor c = stops[currentStop].second;
c.setOpacity(value);
stops.removeAt(currentStop);
stops.insert(currentStop, KoGradientStop(t, c));
m_gradient->setStops(stops);
gradientSlider->update();
emit sigGradientChanged();
}
void KisStopGradientEditor::nameChanged()
{
m_gradient->setName(nameedit->text());
emit sigGradientChanged();
}
void KisStopGradientEditor::reverse()
{
QList<KoGradientStop> stops = m_gradient->stops();
QList<KoGradientStop> reversedStops;
for(const KoGradientStop& stop : stops) {
reversedStops.push_front(KoGradientStop(1 - stop.first, stop.second));
}
m_gradient->setStops(reversedStops);
gradientSlider->setSelectedStop(stops.size() - 1 - gradientSlider->selectedStop());
emit sigGradientChanged();
}
diff --git a/libs/ui/kis_store_paintdevice_writer.h b/libs/ui/kis_store_paintdevice_writer.h
index 186a1a1b5a..641d79d45f 100644
--- a/libs/ui/kis_store_paintdevice_writer.h
+++ b/libs/ui/kis_store_paintdevice_writer.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2013 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_STORE_PAINTDEVICE_WRITER_H
#define KIS_STORE_PAINTDEVICE_WRITER_H
#include <kis_paint_device_writer.h>
#include <KoStore.h>
class KisStorePaintDeviceWriter : public KisPaintDeviceWriter {
public:
KisStorePaintDeviceWriter(KoStore *store)
: m_store(store)
{
}
- virtual ~KisStorePaintDeviceWriter() {}
+ ~KisStorePaintDeviceWriter() override {}
- bool write(const QByteArray &data) {
+ bool write(const QByteArray &data) override {
qint64 len = m_store->write(data);
return (len == data.size());
}
- bool write(const char* data, qint64 length) {
+ bool write(const char* data, qint64 length) override {
qint64 len = m_store->write(data, length);
return (length == len);
}
KoStore *m_store;
};
#endif // KIS_STORE_PAINTDEVICE_WRITER_H
diff --git a/libs/ui/kis_tooltip_manager.h b/libs/ui/kis_tooltip_manager.h
index b2bff0928f..d5a6f88064 100644
--- a/libs/ui/kis_tooltip_manager.h
+++ b/libs/ui/kis_tooltip_manager.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISTOOLTIPMANAGER_H
#define KISTOOLTIPMANAGER_H
#include <QObject>
#include <QMap>
class KisViewManager;
class KisTooltipManager : public QObject
{
Q_OBJECT
public:
KisTooltipManager(KisViewManager* view);
- ~KisTooltipManager();
+ ~KisTooltipManager() override;
void record();
private Q_SLOTS:
void captureToolip();
private:
KisViewManager* m_view;
bool m_recording;
QMap<QString, QString> m_tooltipMap;
};
#endif // KISTOOLTIPMANAGER_H
diff --git a/libs/ui/kis_transaction_based_command.h b/libs/ui/kis_transaction_based_command.h
index 7584f15351..a47b1d40e0 100644
--- a/libs/ui/kis_transaction_based_command.h
+++ b/libs/ui/kis_transaction_based_command.h
@@ -1,40 +1,40 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TRANSACTION_BASED_COMMAND_H
#define KIS_TRANSACTION_BASED_COMMAND_H
#include <kritaui_export.h>
#include <kundo2command.h>
class KRITAUI_EXPORT KisTransactionBasedCommand : public KUndo2Command
{
public:
KisTransactionBasedCommand(const KUndo2MagicString &text = KUndo2MagicString(), KUndo2Command *parent = 0);
- ~KisTransactionBasedCommand();
+ ~KisTransactionBasedCommand() override;
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
protected:
virtual KUndo2Command* paint() = 0;
private:
KUndo2Command *m_transactionData;
};
#endif // KIS_TRANSACTION_BASED_COMMAND_H
diff --git a/libs/ui/kis_view_plugin.h b/libs/ui/kis_view_plugin.h
index 23b1bda9b4..1415e55bcc 100644
--- a/libs/ui/kis_view_plugin.h
+++ b/libs/ui/kis_view_plugin.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_VIEW_PLUGIN_H
#define KIS_VIEW_PLUGIN_H
#include <kritaui_export.h>
#include <QObject>
class KisOperation;
class KisOperationUIFactory;
class KisAction;
class KisViewManager;
/**
* KisViewPlugin is the base for plugins which add actions to the view
*/
class KRITAUI_EXPORT KisViewPlugin : public QObject
{
Q_OBJECT
public:
KisViewPlugin(QObject* parent = 0);
- virtual ~KisViewPlugin();
+ ~KisViewPlugin() override;
protected:
/**
* Registers a KisAction to the UI and action manager.
* @param name - title of the action in the krita.xmlgui file
* @param action the action that should be added
*/
void addAction(const QString& name, KisAction* action);
KisAction* createAction(const QString& name);
void addUIFactory(KisOperationUIFactory* factory);
void addOperation(KisOperation* operation);
KisViewManager* m_view;
};
#endif // KIS_VIEW_PLUGIN_H
diff --git a/libs/ui/kis_workspace_resource.h b/libs/ui/kis_workspace_resource.h
index 4a5aeb7f4d..b0436f8267 100644
--- a/libs/ui/kis_workspace_resource.h
+++ b/libs/ui/kis_workspace_resource.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WORKSPACE_RESOURCE_H
#define KIS_WORKSPACE_RESOURCE_H
#include <resources/KoResource.h>
#include <kis_properties_configuration.h>
#include "kritaui_export.h"
/// Resource for storing of workspaces
class KRITAUI_EXPORT KisWorkspaceResource : public KoResource , public KisPropertiesConfiguration
{
public:
KisWorkspaceResource(const QString& filename);
- virtual ~KisWorkspaceResource();
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
- virtual QString defaultFileExtension() const;
+ ~KisWorkspaceResource() override;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
+ QString defaultFileExtension() const override;
void setDockerState(const QByteArray& state);
QByteArray dockerState();
private:
QByteArray m_dockerState;
};
#endif // KIS_WORKSPACE_RESOURCE_H
diff --git a/libs/ui/kis_zoom_manager.h b/libs/ui/kis_zoom_manager.h
index f4f2082d21..f48e37a153 100644
--- a/libs/ui/kis_zoom_manager.h
+++ b/libs/ui/kis_zoom_manager.h
@@ -1,105 +1,105 @@
/*
* Copyright (C) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ZOOM_MANAGER
#define KIS_ZOOM_MANAGER
#include <QObject>
#include <QPointer>
#include <klocalizedstring.h>
#include <KoZoomMode.h>
#include <KoZoomAction.h>
#include <KoZoomHandler.h>
#include <KoZoomController.h>
#include "kis_signal_auto_connection.h"
#include "KisView.h"
class KoZoomHandler;
class KoZoomAction;
class KoRuler;
class KoUnit;
class KoCanvasController;
class QPoint;
#include "kritaui_export.h"
/**
* The zoom manager handles all user actions related to zooming
* and unzooming. The actual computation of zoom levels and things
* are the job of KoZoomHandler or its descendants
*/
class KRITAUI_EXPORT KisZoomManager : public QObject
{
Q_OBJECT
public:
KisZoomManager(QPointer<KisView> view, KoZoomHandler*, KoCanvasController *);
- ~KisZoomManager();
+ ~KisZoomManager() override;
void setup(KActionCollection * actionCollection);
void updateGUI();
KoZoomController * zoomController() const {
return m_zoomController;
}
void updateImageBoundsSnapping();
QWidget *zoomActionWidget() const;
KoRuler *horizontalRuler() const;
KoRuler *verticalRuler() const;
qreal zoom() const;
public Q_SLOTS:
void slotZoomChanged(KoZoomMode::Mode mode, qreal zoom);
void slotScrollAreaSizeChanged();
void setShowRulers(bool show);
void setRulersTrackMouse(bool value);
void mousePositionChanged(const QPoint &viewPos);
void changeAspectMode(bool aspectMode);
void pageOffsetChanged();
void zoomTo100();
void applyRulersUnit(const KoUnit &baseUnit);
void setMinMaxZoom();
private:
void updateMouseTrackingConnections();
private:
QPointer<KisView> m_view;
KoZoomHandler * m_zoomHandler;
KoCanvasController *m_canvasController;
KoZoomController *m_zoomController;
KoRuler * m_horizontalRuler;
KoRuler * m_verticalRuler;
KoZoomAction * m_zoomAction;
QPointer<QWidget> m_zoomActionWidget;
QPoint m_rulersOffset;
KisSignalAutoConnectionsStore m_mouseTrackingConnections;
};
#endif
diff --git a/libs/ui/kisexiv2/kis_exif_io.h b/libs/ui/kisexiv2/kis_exif_io.h
index e19498b0b5..f6a6198b5e 100644
--- a/libs/ui/kisexiv2/kis_exif_io.h
+++ b/libs/ui/kisexiv2/kis_exif_io.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_EXIF_IO_H_
#define _KIS_EXIF_IO_H_
#include <metadata/kis_meta_data_io_backend.h>
#include <klocalizedstring.h>
class KisExifIO : public KisMetaData::IOBackend
{
struct Private;
public:
KisExifIO();
- virtual ~KisExifIO();
- virtual QString id() const {
+ ~KisExifIO() override;
+ QString id() const override {
return "exif";
}
- virtual QString name() const {
+ QString name() const override {
return i18n("Exif");
}
- virtual BackendType type() const {
+ BackendType type() const override {
return Binary;
}
- virtual bool supportSaving() const {
+ bool supportSaving() const override {
return true;
}
- virtual bool saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const;
- virtual bool canSaveAllEntries(KisMetaData::Store* store) const;
- virtual bool supportLoading() const {
+ bool saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const override;
+ bool canSaveAllEntries(KisMetaData::Store* store) const override;
+ bool supportLoading() const override {
return true;
}
- virtual bool loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const;
+ bool loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const override;
private:
Private* const d;
};
#endif
diff --git a/libs/ui/kisexiv2/kis_iptc_io.h b/libs/ui/kisexiv2/kis_iptc_io.h
index f037b0e107..6d583272b6 100644
--- a/libs/ui/kisexiv2/kis_iptc_io.h
+++ b/libs/ui/kisexiv2/kis_iptc_io.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_IPTC_IO_H_
#define _KIS_IPTC_IO_H_
#include <metadata/kis_meta_data_io_backend.h>
#include <klocalizedstring.h>
class KisIptcIO : public KisMetaData::IOBackend
{
struct Private;
public:
KisIptcIO();
- virtual ~KisIptcIO();
- virtual QString id() const {
+ ~KisIptcIO() override;
+ QString id() const override {
return "iptc";
}
- virtual QString name() const {
+ QString name() const override {
return i18n("Iptc");
}
- virtual BackendType type() const {
+ BackendType type() const override {
return Binary;
}
- virtual bool supportSaving() const {
+ bool supportSaving() const override {
return true;
}
- virtual bool saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const;
- virtual bool canSaveAllEntries(KisMetaData::Store* store) const;
- virtual bool supportLoading() const {
+ bool saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const override;
+ bool canSaveAllEntries(KisMetaData::Store* store) const override;
+ bool supportLoading() const override {
return true;
}
- virtual bool loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const;
+ bool loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const override;
private:
void initMappingsTable() const;
private:
Private* const d;
};
#endif
diff --git a/libs/ui/kisexiv2/kis_xmp_io.h b/libs/ui/kisexiv2/kis_xmp_io.h
index ef6c811118..378f49ade6 100644
--- a/libs/ui/kisexiv2/kis_xmp_io.h
+++ b/libs/ui/kisexiv2/kis_xmp_io.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_XMP_IO_H_
#define _KIS_XMP_IO_H_
#include <metadata/kis_meta_data_io_backend.h>
#include <klocalizedstring.h>
class KisXMPIO : public KisMetaData::IOBackend
{
struct Private;
public:
KisXMPIO();
- virtual ~KisXMPIO();
- virtual QString id() const {
+ ~KisXMPIO() override;
+ QString id() const override {
return "xmp";
}
- virtual QString name() const {
+ QString name() const override {
return i18n("XMP");
}
- virtual BackendType type() const {
+ BackendType type() const override {
return Text;
}
- virtual bool supportSaving() const {
+ bool supportSaving() const override {
return true;
}
- virtual bool saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const;
- virtual bool canSaveAllEntries(KisMetaData::Store*) const {
+ bool saveTo(KisMetaData::Store* store, QIODevice* ioDevice, HeaderType headerType = NoHeader) const override;
+ bool canSaveAllEntries(KisMetaData::Store*) const override {
return true;
}
- virtual bool supportLoading() const {
+ bool supportLoading() const override {
return true;
}
- virtual bool loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const;
+ bool loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const override;
};
#endif
diff --git a/libs/ui/opengl/kis_opengl_canvas2.h b/libs/ui/opengl/kis_opengl_canvas2.h
index 283162d618..36c26ed987 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.h
+++ b/libs/ui/opengl/kis_opengl_canvas2.h
@@ -1,121 +1,121 @@
/*
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2006
* Copyright (C) Michael Abrahams <miabraha@gmail.com>, (C) 2015
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_OPENGL_CANVAS_2_H
#define KIS_OPENGL_CANVAS_2_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions_3_0>
#include <QOpenGLFunctions_3_2_Core>
#include "canvas/kis_canvas_widget_base.h"
#include "opengl/kis_opengl_image_textures.h"
#include "kritaui_export.h"
#include "kis_ui_types.h"
class KisCanvas2;
class KisDisplayColorConverter;
class QOpenGLShaderProgram;
class QPainterPath;
#ifndef Q_MOC_RUN
#ifndef Q_OS_MAC
#define GLFunctions QOpenGLFunctions_3_0
#else
#define GLFunctions QOpenGLFunctions_3_2_Core
#endif
#endif
/**
* KisOpenGLCanvas is the widget that shows the actual image using OpenGL
*
* NOTE: if you change something in the event handling here, also change it
* in the qpainter canvas.
*
*/
class KRITAUI_EXPORT KisOpenGLCanvas2
: public QOpenGLWidget
#ifndef Q_MOC_RUN
, protected GLFunctions
#endif
, public KisCanvasWidgetBase
{
Q_OBJECT
public:
KisOpenGLCanvas2(KisCanvas2 *canvas, KisCoordinatesConverter *coordinatesConverter, QWidget *parent, KisImageWSP image, KisDisplayColorConverter *colorConverter);
- virtual ~KisOpenGLCanvas2();
+ ~KisOpenGLCanvas2() override;
public: // QOpenGLWidget
- void resizeGL(int width, int height);
- void initializeGL();
- void paintGL();
+ void resizeGL(int width, int height) override;
+ void initializeGL() override;
+ void paintGL() override;
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
- virtual void inputMethodEvent(QInputMethodEvent *event);
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
public:
void renderCanvasGL();
void renderDecorations(QPainter *painter);
void paintToolOutline(const QPainterPath &path);
bool needsFpsDebugging() const;
public: // Implement kis_abstract_canvas_widget interface
void initializeShaders();
- void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter);
- void setWrapAroundViewingMode(bool value);
- void channelSelectionChanged(const QBitArray &channelFlags);
- void setDisplayProfile(KisDisplayColorConverter *colorConverter);
- void finishResizingImage(qint32 w, qint32 h);
- KisUpdateInfoSP startUpdateCanvasProjection(const QRect & rc, const QBitArray &channelFlags);
- QRect updateCanvasProjection(KisUpdateInfoSP info);
-
- QWidget *widget() {
+ void setDisplayFilter(QSharedPointer<KisDisplayFilter> displayFilter) override;
+ void setWrapAroundViewingMode(bool value) override;
+ void channelSelectionChanged(const QBitArray &channelFlags) override;
+ void setDisplayProfile(KisDisplayColorConverter *colorConverter) override;
+ void finishResizingImage(qint32 w, qint32 h) override;
+ KisUpdateInfoSP startUpdateCanvasProjection(const QRect & rc, const QBitArray &channelFlags) override;
+ QRect updateCanvasProjection(KisUpdateInfoSP info) override;
+
+ QWidget *widget() override {
return this;
}
- bool isBusy() const;
+ bool isBusy() const override;
void setDisplayFilterImpl(QSharedPointer<KisDisplayFilter> displayFilter, bool initializing);
KisOpenGLImageTexturesSP openGLImageTextures() const;
private Q_SLOTS:
void slotConfigChanged();
protected: // KisCanvasWidgetBase
- virtual bool callFocusNextPrevChild(bool next);
+ bool callFocusNextPrevChild(bool next) override;
private:
void reportFailedShaderCompilation(const QString &context);
void drawImage();
void drawCheckers();
private:
struct Private;
Private * const d;
};
#endif // KIS_OPENGL_CANVAS_2_H
diff --git a/libs/ui/operations/kis_operation_configuration.h b/libs/ui/operations/kis_operation_configuration.h
index 1af16b77f3..87a2869a57 100644
--- a/libs/ui/operations/kis_operation_configuration.h
+++ b/libs/ui/operations/kis_operation_configuration.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_OPERATION_CONFIGURATION_H
#define __KIS_OPERATION_CONFIGURATION_H
#include <QString>
#include <kritaui_export.h>
#include "kis_properties_configuration.h"
class KRITAUI_EXPORT KisOperationConfiguration : public KisPropertiesConfiguration
{
public:
KisOperationConfiguration();
- virtual ~KisOperationConfiguration() {}
+ ~KisOperationConfiguration() override {}
KisOperationConfiguration(const QString &id);
QString id() const;
private:
Q_DISABLE_COPY(KisOperationConfiguration)
};
typedef KisPinnedSharedPtr<KisOperationConfiguration> KisOperationConfigurationSP;
#endif /* __KIS_OPERATION_CONFIGURATION_H */
diff --git a/libs/ui/operations/kis_operation_registry.h b/libs/ui/operations/kis_operation_registry.h
index febb12d9e3..261e80ec8f 100644
--- a/libs/ui/operations/kis_operation_registry.h
+++ b/libs/ui/operations/kis_operation_registry.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_OPERATION_REGISTRY_H
#define __KIS_OPERATION_REGISTRY_H
#include <kritaui_export.h>
#include <KoGenericRegistry.h>
#include "kis_operation.h"
class KRITAUI_EXPORT KisOperationRegistry : public KoGenericRegistry<KisOperation*>
{
public:
KisOperationRegistry();
- ~KisOperationRegistry();
+ ~KisOperationRegistry() override;
static KisOperationRegistry* instance();
};
#endif /* __KIS_OPERATION_REGISTRY_H */
diff --git a/libs/ui/operations/kis_operation_ui_widget.h b/libs/ui/operations/kis_operation_ui_widget.h
index d2dafd3775..74c93ac316 100644
--- a/libs/ui/operations/kis_operation_ui_widget.h
+++ b/libs/ui/operations/kis_operation_ui_widget.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_OPERATION_UI_WIDGET_H
#define KIS_OPERATION_UI_WIDGET_H
#include <QWidget>
#include <kritaui_export.h>
#include "operations/kis_operation_configuration.h"
/**
* Base class for the QWidget based operation config widgets
*/
class KRITAUI_EXPORT KisOperationUIWidget : public QWidget
{
public:
explicit KisOperationUIWidget(const QString& caption, QWidget* parent = 0);
- virtual ~KisOperationUIWidget();
+ ~KisOperationUIWidget() override;
/**
* Caption of the operation widget, used in dialog caption
*/
QString caption() const;
/**
* Fetch the setting from the config widet
* @param config configuration to which the setting will be written
*/
virtual void getConfiguration(KisOperationConfigurationSP config) = 0;
private:
class Private;
Private* const d;
};
#endif // KIS_OPERATION_UI_WIDGET_H
diff --git a/libs/ui/operations/kis_operation_ui_widget_factory.h b/libs/ui/operations/kis_operation_ui_widget_factory.h
index a4de6dc089..79657de2b5 100644
--- a/libs/ui/operations/kis_operation_ui_widget_factory.h
+++ b/libs/ui/operations/kis_operation_ui_widget_factory.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_OPERATION_UI_WIDGET_FACTORY_H
#define KIS_OPERATION_UI_WIDGET_FACTORY_H
#include <KoDialog.h>
#include <klocalizedstring.h>
#include "kis_operation_ui_factory.h"
#include "operations/kis_operation_ui_widget.h"
#include "KisViewManager.h"
/**
* Factory to get operation configurations from QWidget based operation widgets
* T has to be a KisOperationUIWidget
*/
template <class T> class KisOperationUIWidgetFactory : public KisOperationUIFactory
{
public:
KisOperationUIWidgetFactory(const QString &id) : KisOperationUIFactory(id)
{
}
- virtual ~KisOperationUIWidgetFactory()
+ ~KisOperationUIWidgetFactory() override
{
}
/**
* Reimplemented. Show a dialog the widget specify as T
* @param view the view
* @param configuration the configuration to the operation
* @returns true if the configuration could be constructed (not canceled)
*/
- virtual bool fetchConfiguration(KisViewManager* view, KisOperationConfigurationSP configuration) {
+ bool fetchConfiguration(KisViewManager* view, KisOperationConfigurationSP configuration) override {
KoDialog * dialog = new KoDialog(view->mainWindow());
Q_CHECK_PTR(dialog);
T* configWidget = new T(dialog, view);
dialog->setCaption(configWidget->caption());
dialog->setMainWidget(configWidget);
bool success = false;
if (dialog->exec() == QDialog::Accepted) {
configWidget->getConfiguration(configuration);
success = true;
}
delete dialog;
return success;
}
};
#endif // KIS_OPERATION_UI_WIDGET_FACTORY_H
diff --git a/libs/ui/processing/fill_processing_visitor.h b/libs/ui/processing/fill_processing_visitor.h
index c3a5038f86..5814da57e3 100644
--- a/libs/ui/processing/fill_processing_visitor.h
+++ b/libs/ui/processing/fill_processing_visitor.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __FILL_PROCESSING_VISITOR_H
#define __FILL_PROCESSING_VISITOR_H
#include <processing/kis_simple_processing_visitor.h>
#include <QPoint>
#include <kis_selection.h>
#include <kis_resources_snapshot.h>
#include <kritaui_export.h>
class KRITAUI_EXPORT FillProcessingVisitor : public KisSimpleProcessingVisitor
{
public:
FillProcessingVisitor(const QPoint &startPoint,
KisSelectionSP selection,
KisResourcesSnapshotSP resources,
bool useFastMode,
bool usePattern,
bool selectionOnly,
int feather,
int sizemod,
int fillThreshold,
bool unmerged,
bool m_useBgColor);
private:
- void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter);
- void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
- void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter);
+ void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) override;
void fillPaintDevice(KisPaintDeviceSP device, KisUndoAdapter *undoAdapter, ProgressHelper &helper);
private:
QPoint m_startPoint;
KisSelectionSP m_selection;
bool m_useFastMode;
bool m_selectionOnly;
bool m_usePattern;
KisResourcesSnapshotSP m_resources;
int m_feather;
int m_sizemod;
int m_fillThreshold;
bool m_unmerged;
bool m_useBgColor;
};
#endif /* __FILL_PROCESSING_VISITOR_H */
diff --git a/libs/ui/qtlockedfile/qtlockedfile.h b/libs/ui/qtlockedfile/qtlockedfile.h
index 1dc345a084..7bc9338299 100644
--- a/libs/ui/qtlockedfile/qtlockedfile.h
+++ b/libs/ui/qtlockedfile/qtlockedfile.h
@@ -1,76 +1,76 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://www.qt.io/licensing. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H
#include <QFile>
#if defined(Q_OS_WIN)
# if !defined(QT_QTLOCKEDFILE_EXPORT) && !defined(QT_QTLOCKEDFILE_IMPORT)
# define QT_QTLOCKEDFILE_EXPORT
# elif defined(QT_QTLOCKEDFILE_IMPORT)
# if defined(QT_QTLOCKEDFILE_EXPORT)
# undef QT_QTLOCKEDFILE_EXPORT
# endif
# define QT_QTLOCKEDFILE_EXPORT __declspec(dllimport)
# elif defined(QT_QTLOCKEDFILE_EXPORT)
# undef QT_QTLOCKEDFILE_EXPORT
# define QT_QTLOCKEDFILE_EXPORT __declspec(dllexport)
# endif
#else
# define QT_QTLOCKEDFILE_EXPORT
#endif
class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile
{
public:
enum LockMode { NoLock = 0, ReadLock, WriteLock };
QtLockedFile();
QtLockedFile(const QString &name);
- ~QtLockedFile();
+ ~QtLockedFile() override;
bool lock(LockMode mode, bool block = true);
bool unlock();
bool isLocked() const;
LockMode lockMode() const;
private:
#ifdef Q_OS_WIN
Qt::HANDLE m_semaphore_hnd;
Qt::HANDLE m_mutex_hnd;
#endif
LockMode m_lock_mode;
};
#endif // QTLOCKEDFILE_H
diff --git a/libs/ui/qtsingleapplication/qtsingleapplication.h b/libs/ui/qtsingleapplication/qtsingleapplication.h
index efa75bf760..54261424f0 100644
--- a/libs/ui/qtsingleapplication/qtsingleapplication.h
+++ b/libs/ui/qtsingleapplication/qtsingleapplication.h
@@ -1,79 +1,79 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://www.qt.io/licensing. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QTSINGLEAPPLICATION
#define QTSINGLEAPPLICATION
#include <QApplication>
QT_FORWARD_DECLARE_CLASS(QSharedMemory)
class QtLocalPeer;
#include <kritaui_export.h>
class KRITAUI_EXPORT QtSingleApplication : public QApplication
{
Q_OBJECT
public:
QtSingleApplication(const QString &id, int &argc, char **argv);
- ~QtSingleApplication();
+ ~QtSingleApplication() override;
bool isRunning(qint64 pid = -1);
void setActivationWindow(QWidget* aw, bool activateOnMessage = true);
QWidget* activationWindow() const;
- bool event(QEvent *event);
+ bool event(QEvent *event) override;
QString applicationId() const;
void setBlock(bool value);
public Q_SLOTS:
bool sendMessage(const QByteArray &message, int timeout = 5000, qint64 pid = -1);
void activateWindow();
Q_SIGNALS:
void messageReceived(const QByteArray &message, QObject *socket);
void fileOpenRequest(const QString &file);
private:
QString instancesFileName(const QString &appId);
qint64 firstPeer;
QSharedMemory *instances;
QtLocalPeer *pidPeer;
QWidget *actWin;
QString appId;
bool block;
};
#endif
diff --git a/libs/ui/recorder/kis_node_query_path_editor.h b/libs/ui/recorder/kis_node_query_path_editor.h
index 1f3985b3b0..cfea6ea7b5 100644
--- a/libs/ui/recorder/kis_node_query_path_editor.h
+++ b/libs/ui/recorder/kis_node_query_path_editor.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_NODE_QUERY_PATH_EDITOR_H_
#define _KIS_NODE_QUERY_PATH_EDITOR_H_
#include <QWidget>
class KisNodeQueryPath;
/**
* This class is used to edit @ref KisNodeQueryPath
*/
class KisNodeQueryPathEditor : public QWidget
{
Q_OBJECT
public:
KisNodeQueryPathEditor(QWidget* parent);
- ~KisNodeQueryPathEditor();
+ ~KisNodeQueryPathEditor() override;
void setNodeQueryPath(const KisNodeQueryPath& path);
/**
* Generate a node query path based on the state of the widgets
*/
KisNodeQueryPath nodeQueryPath() const;
Q_SIGNALS:
void nodeQueryPathChanged();
private Q_SLOTS:
void currentLayerEnabled(bool v);
void customPathEnabled(bool v);
void slotPopupQuickHelp();
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/recorder/kis_recorded_action_creator.h b/libs/ui/recorder/kis_recorded_action_creator.h
index e4c37af1f2..bf3677f2e8 100644
--- a/libs/ui/recorder/kis_recorded_action_creator.h
+++ b/libs/ui/recorder/kis_recorded_action_creator.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_RECORDED_ACTION_CREATOR
#define KIS_RECORDED_ACTION_CREATOR
#include <QWidget>
class KisRecordedAction;
class KisRecordedActionCreator : public QWidget {
public:
explicit KisRecordedActionCreator(QWidget* parent = 0, Qt::WindowFlags f = 0);
- virtual ~KisRecordedActionCreator();
+ ~KisRecordedActionCreator() override;
/**
* This function is called when the dialog is closed and the action has to be created
* from the parameters in the widget.
*/
virtual KisRecordedAction* createAction() const = 0;
private:
struct Private;
Private * const d;
};
#endif
diff --git a/libs/ui/recorder/kis_recorded_filter_action_creator.h b/libs/ui/recorder/kis_recorded_filter_action_creator.h
index 60f36b7fa0..d329ea238c 100644
--- a/libs/ui/recorder/kis_recorded_filter_action_creator.h
+++ b/libs/ui/recorder/kis_recorded_filter_action_creator.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_FILTER_ACTION_CREATOR_FACTORY_H_
#define _KIS_RECORDED_FILTER_ACTION_CREATOR_FACTORY_H_
#include "kis_recorded_action_creator.h"
#include "kis_recorded_action_creator_factory.h"
class KisFiltersModel;
class QTreeView;
class KisRecordedFilterActionCreator : public KisRecordedActionCreator {
public:
explicit KisRecordedFilterActionCreator(QWidget* parent = 0, Qt::WindowFlags f = 0);
- ~KisRecordedFilterActionCreator();
- virtual KisRecordedAction* createAction() const;
+ ~KisRecordedFilterActionCreator() override;
+ KisRecordedAction* createAction() const override;
private:
KisFiltersModel* m_filterModel;
QTreeView* m_filterTree;
};
/**
* This class allows to create widgets that are used to create new actions.
*/
class KisRecordedFilterActionCreatorFactory : public KisRecordedActionCreatorFactory
{
public:
KisRecordedFilterActionCreatorFactory();
- virtual ~KisRecordedFilterActionCreatorFactory();
- virtual bool requireCreator() const;
- virtual KisRecordedActionCreator* createCreator(QWidget* parent) const;
+ ~KisRecordedFilterActionCreatorFactory() override;
+ bool requireCreator() const override;
+ KisRecordedActionCreator* createCreator(QWidget* parent) const override;
};
#endif
diff --git a/libs/ui/recorder/kis_recorded_filter_action_editor.h b/libs/ui/recorder/kis_recorded_filter_action_editor.h
index 162b36c6cc..3f034bacae 100644
--- a/libs/ui/recorder/kis_recorded_filter_action_editor.h
+++ b/libs/ui/recorder/kis_recorded_filter_action_editor.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_FILTER_ACTION_EDITOR_H_
#define _KIS_RECORDED_FILTER_ACTION_EDITOR_H_
#include <QWidget>
#include "kis_recorded_action_editor_factory.h"
class KisNodeQueryPathEditor;
class KisRecordedFilterAction;
class QGridLayout;
class KisConfigWidget;
class KisRecordedFilterActionEditor : public QWidget
{
Q_OBJECT
public:
KisRecordedFilterActionEditor(QWidget* parent, KisRecordedAction* action);
- ~KisRecordedFilterActionEditor();
+ ~KisRecordedFilterActionEditor() override;
private Q_SLOTS:
void configurationUpdated();
void nodeQueryPathChanged();
Q_SIGNALS:
void actionEdited();
private:
KisRecordedFilterAction* m_action;
QGridLayout* m_gridLayout;
KisConfigWidget* m_configWidget;
KisNodeQueryPathEditor* m_nodeQueryPathEditor;
};
class KisRecordedFilterActionEditorFactory : public KisRecordedActionEditorFactory
{
public:
KisRecordedFilterActionEditorFactory();
- virtual ~KisRecordedFilterActionEditorFactory();
- virtual QWidget* createEditor(QWidget* parent, KisRecordedAction* action) const;
- virtual bool canEdit(const KisRecordedAction* action) const;
+ ~KisRecordedFilterActionEditorFactory() override;
+ QWidget* createEditor(QWidget* parent, KisRecordedAction* action) const override;
+ bool canEdit(const KisRecordedAction* action) const override;
};
#endif
diff --git a/libs/ui/recorder/kis_recorded_paint_action_editor.h b/libs/ui/recorder/kis_recorded_paint_action_editor.h
index 50f907a7b7..5eeaaf79a4 100644
--- a/libs/ui/recorder/kis_recorded_paint_action_editor.h
+++ b/libs/ui/recorder/kis_recorded_paint_action_editor.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RECORDED_PAINT_ACTION_EDITOR_H_
#define _KIS_RECORDED_PAINT_ACTION_EDITOR_H_
#include <QWidget>
#include "kis_recorded_action_editor_factory.h"
#include "kis_types.h"
class QGridLayout;
class KoColorPopupAction;
class KisPaintOpConfigWidget;
class KisRecordedPaintAction;
class Ui_WdgPaintActionEditor;
class KoResource;
/**
* This is the editor for all \ref KisRecordedPaintAction
*/
class KisRecordedPaintActionEditor : public QWidget
{
Q_OBJECT
public:
KisRecordedPaintActionEditor(QWidget* parent, KisRecordedAction* action);
- ~KisRecordedPaintActionEditor();
+ ~KisRecordedPaintActionEditor() override;
private Q_SLOTS:
void configurationUpdated();
void paintOpChanged(int index);
void resourceSelected(KoResource* resource);
void nodeQueryPathChanged();
Q_SIGNALS:
void actionEdited();
private:
void setPaintOpPreset();
KisRecordedPaintAction* m_action;
Ui_WdgPaintActionEditor* m_actionEditor;
KisPaintOpConfigWidget* m_configWidget;
QGridLayout* m_gridLayout;
QList<QString> m_paintops;
QMap<QString, KisPaintOpPresetSP> m_paintOpsToPreset;
};
class KisRecordedPaintActionEditorFactory : public KisRecordedActionEditorFactory
{
public:
KisRecordedPaintActionEditorFactory();
- virtual ~KisRecordedPaintActionEditorFactory();
- virtual QWidget* createEditor(QWidget* parent, KisRecordedAction* action) const;
- virtual bool canEdit(const KisRecordedAction* action) const;
+ ~KisRecordedPaintActionEditorFactory() override;
+ QWidget* createEditor(QWidget* parent, KisRecordedAction* action) const override;
+ bool canEdit(const KisRecordedAction* action) const override;
};
#endif
diff --git a/libs/ui/tests/kis_dummies_facade_base_test.h b/libs/ui/tests/kis_dummies_facade_base_test.h
index f09633b5e9..b9b0ccdd67 100644
--- a/libs/ui/tests/kis_dummies_facade_base_test.h
+++ b/libs/ui/tests/kis_dummies_facade_base_test.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DUMMIES_FACADE_BASE_TEST_H
#define __KIS_DUMMIES_FACADE_BASE_TEST_H
#include <QtTest>
#include "empty_nodes_test.h"
class KisNodeDummy;
class KisDummiesFacadeBase;
class KisDummiesFacadeBaseTest : public QObject, public TestUtil::EmptyNodesTest
{
Q_OBJECT
public:
- virtual ~KisDummiesFacadeBaseTest();
+ ~KisDummiesFacadeBaseTest() override;
protected:
virtual KisDummiesFacadeBase* dummiesFacadeFactory() = 0;
virtual void destroyDummiesFacade(KisDummiesFacadeBase *dummiesFacade) = 0;
private Q_SLOTS:
void slotNodeActivated(KisNodeSP node);
void slotEndInsertDummy(KisNodeDummy *dummy);
void slotBeginRemoveDummy(KisNodeDummy *dummy);
private Q_SLOTS:
void init();
void cleanup();
void testSetImage();
void testAddNode();
void testRemoveNode();
void testMoveNodeSameParent();
void testMoveNodeDifferentParent();
void testSubstituteRootNode();
void testAddSelectionMasksNoActivation();
private:
void verifyActivatedNodes(const QString &nodes);
void verifyMovedDummies(const QString &nodes);
private:
KisDummiesFacadeBase *m_dummiesFacade;
QString m_activatedNodes;
QString m_movedDummies;
};
#endif /* __KIS_DUMMIES_FACADE_BASE_TEST_H */
diff --git a/libs/ui/tests/kis_dummies_facade_test.h b/libs/ui/tests/kis_dummies_facade_test.h
index 7424e3df9c..f5153d5eae 100644
--- a/libs/ui/tests/kis_dummies_facade_test.h
+++ b/libs/ui/tests/kis_dummies_facade_test.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DUMMIES_FACADE_TEST_H
#define __KIS_DUMMIES_FACADE_TEST_H
#include "kis_dummies_facade_base_test.h"
class KisDummiesFacadeTest : public KisDummiesFacadeBaseTest
{
Q_OBJECT
public:
- ~KisDummiesFacadeTest();
+ ~KisDummiesFacadeTest() override;
protected:
- KisDummiesFacadeBase* dummiesFacadeFactory();
- void destroyDummiesFacade(KisDummiesFacadeBase *dummiesFacade);
+ KisDummiesFacadeBase* dummiesFacadeFactory() override;
+ void destroyDummiesFacade(KisDummiesFacadeBase *dummiesFacade) override;
};
#endif /* __KIS_DUMMIES_FACADE_TEST_H */
diff --git a/libs/ui/tests/kis_shape_controller_test.h b/libs/ui/tests/kis_shape_controller_test.h
index 458e9c75c4..50d0d0f22b 100644
--- a/libs/ui/tests/kis_shape_controller_test.h
+++ b/libs/ui/tests/kis_shape_controller_test.h
@@ -1,45 +1,45 @@
/*
* Copyright (C) 2007 Boudewijn Rempt <boud@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSHAPECONTROLLER_TEST_H
#define KISSHAPECONTROLLER_TEST_H
#include "kis_dummies_facade_base_test.h"
class KisDocument;
class KisNameServer;
class KisShapeControllerTest : public KisDummiesFacadeBaseTest
{
Q_OBJECT
public:
- ~KisShapeControllerTest();
+ ~KisShapeControllerTest() override;
protected:
- KisDummiesFacadeBase* dummiesFacadeFactory();
- void destroyDummiesFacade(KisDummiesFacadeBase *dummiesFacade);
+ KisDummiesFacadeBase* dummiesFacadeFactory() override;
+ void destroyDummiesFacade(KisDummiesFacadeBase *dummiesFacade) override;
private:
KisDocument *m_doc;
KisNameServer *m_nameServer;
};
#endif
diff --git a/libs/ui/thememanager.h b/libs/ui/thememanager.h
index 736b1ca3ed..0e2dc818e8 100644
--- a/libs/ui/thememanager.h
+++ b/libs/ui/thememanager.h
@@ -1,85 +1,85 @@
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2004-08-02
* Description : theme manager
*
* Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef THEMEMANAGER_H
#define THEMEMANAGER_H
// Qt includes
#include <QObject>
#include <QPixmap>
#include <QString>
// KDE includes
#include <ksharedconfig.h>
class KActionCollection;
class KActionMenu;
namespace Digikam
{
class ThemeManager : public QObject
{
Q_OBJECT
public:
/**
* @brief ThemeManager
* @param theme the currently active theme: the palette will not be changed to this theme
* @param parent
*/
explicit ThemeManager(const QString &theme = "", QObject *parent = 0);
- ~ThemeManager();
+ ~ThemeManager() override;
QString currentThemeName() const;
void setCurrentTheme(const QString& name);
void setThemeMenuAction(KActionMenu* const action);
void registerThemeActions(KActionCollection *actionCollection);
Q_SIGNALS:
void signalThemeChanged();
private Q_SLOTS:
void slotChangePalette();
private:
void populateThemeMap();
void populateThemeMenu();
QPixmap createSchemePreviewIcon(const KSharedConfigPtr& config);
private:
class ThemeManagerPriv;
ThemeManagerPriv* const d;
};
} // namespace Digikam
#endif /* THEMEMANAGER_H */
diff --git a/libs/ui/tool/KisStabilizerDelayedPaintHelper.h b/libs/ui/tool/KisStabilizerDelayedPaintHelper.h
index db8b419154..8d898452b6 100644
--- a/libs/ui/tool/KisStabilizerDelayedPaintHelper.h
+++ b/libs/ui/tool/KisStabilizerDelayedPaintHelper.h
@@ -1,86 +1,86 @@
/*
* Copyright (c) 2016 Alvin Wong <alvinhochun-at-gmail-com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_STABILIZER_DELAYED_PAINT_HELPER_H
#define KIS_STABILIZER_DELAYED_PAINT_HELPER_H
#include <QElapsedTimer>
#include <QQueue>
#include <QTimer>
#include <QVector>
#include <functional>
#include "kis_paint_information.h"
#include "kritaui_export.h"
class KRITAUI_EXPORT KisStabilizerDelayedPaintHelper : public QObject
{
Q_OBJECT
struct TimedPaintInfo
{
int elapsedTime;
KisPaintInformation paintInfo;
TimedPaintInfo(int elapsedTime, KisPaintInformation paintInfo);
};
QTimer m_paintTimer;
QQueue<TimedPaintInfo> m_paintQueue;
int m_lastPendingTime;
QElapsedTimer m_elapsedTimer;
// Callbacks
std::function<void(const KisPaintInformation &, const KisPaintInformation &)> m_paintLine;
std::function<void()> m_requestUpdateOutline;
public:
KisStabilizerDelayedPaintHelper();
- virtual ~KisStabilizerDelayedPaintHelper() override {}
+ ~KisStabilizerDelayedPaintHelper() override {}
bool running() const {
return m_paintTimer.isActive();
}
bool hasLastPaintInformation() const {
return !m_paintQueue.isEmpty();
}
KisPaintInformation lastPaintInformation() const {
// Please call hasLastPaintInformation before this
return m_paintQueue.head().paintInfo;
}
void setPaintLineCallback(std::function<void(const KisPaintInformation &, const KisPaintInformation &)> paintLine) {
m_paintLine = paintLine;
}
void setUpdateOutlineCallback(std::function<void()> requestUpdateOutline) {
m_requestUpdateOutline = requestUpdateOutline;
}
void start(int paintInterval, const KisPaintInformation &firstPaintInfo);
void update(const QVector<KisPaintInformation> &newPaintInfos);
void end();
void cancel();
private Q_SLOTS:
void stabilizerDelayedPaint(bool isEndStroke = false);
};
#endif // KIS_STABILIZER_DELAYED_PAINT_HELPER_H
diff --git a/libs/ui/tool/kis_delegated_tool.h b/libs/ui/tool/kis_delegated_tool.h
index 1f90bb9c05..ec5cf555d0 100644
--- a/libs/ui/tool/kis_delegated_tool.h
+++ b/libs/ui/tool/kis_delegated_tool.h
@@ -1,139 +1,139 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DELEGATED_TOOL_H
#define __KIS_DELEGATED_TOOL_H
#include <KoPointerEvent.h>
#include <KoShape.h>
#include <QPointer>
#include "input/kis_input_manager.h"
#include "canvas/kis_canvas2.h"
#include "kis_delegated_tool_policies.h"
template <class BaseClass, class DelegateTool, class ActivationPolicy = NoopActivationPolicy>
class KisDelegatedTool : public BaseClass
{
public:
KisDelegatedTool(KoCanvasBase *canvas,
const QCursor &cursor,
DelegateTool *delegateTool)
: BaseClass(canvas, cursor),
m_localTool(delegateTool)
{
}
DelegateTool* localTool() const {
return m_localTool.data();
}
- void activate(typename BaseClass::ToolActivation toolActivation, const QSet<KoShape*> &shapes)
+ void activate(typename BaseClass::ToolActivation toolActivation, const QSet<KoShape*> &shapes) override
{
BaseClass::activate(toolActivation, shapes);
m_localTool->activate(toolActivation, shapes);
ActivationPolicy::onActivate(BaseClass::canvas());
KisInputManager *inputManager = (static_cast<KisCanvas2*>(BaseClass::canvas()))->globalInputManager();
if (inputManager) {
inputManager->attachPriorityEventFilter(this);
}
}
- void deactivate()
+ void deactivate() override
{
m_localTool->deactivate();
BaseClass::deactivate();
KisInputManager *inputManager = (static_cast<KisCanvas2*>(BaseClass::canvas()))->globalInputManager();
if (inputManager) {
inputManager->detachPriorityEventFilter(this);
}
}
- void mousePressEvent(KoPointerEvent *event)
+ void mousePressEvent(KoPointerEvent *event) override
{
if(PRESS_CONDITION_OM(event, KisTool::HOVER_MODE,
Qt::LeftButton, Qt::ShiftModifier |
Qt::ControlModifier | Qt::AltModifier)) {
this->setMode(KisTool::PAINT_MODE);
Q_ASSERT(m_localTool);
m_localTool->mousePressEvent(event);
}
else {
BaseClass::mousePressEvent(event);
}
}
- void mouseDoubleClickEvent(KoPointerEvent *event)
+ void mouseDoubleClickEvent(KoPointerEvent *event) override
{
if(PRESS_CONDITION_OM(event, KisTool::HOVER_MODE,
Qt::LeftButton, Qt::ShiftModifier |
Qt::ControlModifier | Qt::AltModifier)) {
Q_ASSERT(m_localTool);
m_localTool->mouseDoubleClickEvent(event);
}
else {
BaseClass::mouseDoubleClickEvent(event);
}
}
- void mouseMoveEvent(KoPointerEvent *event)
+ void mouseMoveEvent(KoPointerEvent *event) override
{
Q_ASSERT(m_localTool);
m_localTool->mouseMoveEvent(event);
BaseClass::mouseMoveEvent(event);
}
- void mouseReleaseEvent(KoPointerEvent *event)
+ void mouseReleaseEvent(KoPointerEvent *event) override
{
if(RELEASE_CONDITION(event, KisTool::PAINT_MODE, Qt::LeftButton)) {
this->setMode(KisTool::HOVER_MODE);
Q_ASSERT(m_localTool);
m_localTool->mouseReleaseEvent(event);
}
else {
BaseClass::mouseReleaseEvent(event);
}
}
- void paint(QPainter &painter, const KoViewConverter &converter)
+ void paint(QPainter &painter, const KoViewConverter &converter) override
{
Q_ASSERT(m_localTool);
m_localTool->paint(painter, converter);
}
- QList<QPointer<QWidget> > createOptionWidgets()
+ QList<QPointer<QWidget> > createOptionWidgets() override
{
QList<QPointer<QWidget> > list = BaseClass::createOptionWidgets();
list.append(m_localTool->createOptionWidgets());
return list;
}
protected:
QScopedPointer<DelegateTool> m_localTool;
};
#endif /* __KIS_DELEGATED_TOOL_H */
diff --git a/libs/ui/tool/kis_painting_information_builder.h b/libs/ui/tool/kis_painting_information_builder.h
index 979bf92566..5344ce9a0a 100644
--- a/libs/ui/tool/kis_painting_information_builder.h
+++ b/libs/ui/tool/kis_painting_information_builder.h
@@ -1,111 +1,111 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINTING_INFORMATION_BUILDER_H
#define __KIS_PAINTING_INFORMATION_BUILDER_H
#include <QObject>
#include <QVector>
#include "kis_types.h"
#include "kritaui_export.h"
#include <brushengine/kis_paint_information.h>
class KoPointerEvent;
class KisToolFreehand;
class KisCoordinatesConverter;
class KisSpeedSmoother;
class KoCanvasResourceManager;
class KRITAUI_EXPORT KisPaintingInformationBuilder : public QObject
{
Q_OBJECT
public:
KisPaintingInformationBuilder();
- ~KisPaintingInformationBuilder();
+ ~KisPaintingInformationBuilder() override;
KisPaintInformation startStroke(KoPointerEvent *event, int timeElapsed, const KoCanvasResourceManager *manager);
KisPaintInformation continueStroke(KoPointerEvent *event,
int timeElapsed);
KisPaintInformation hover(const QPointF &imagePoint,
const KoPointerEvent *event);
protected Q_SLOTS:
void updateSettings();
protected:
virtual QPointF adjustDocumentPoint(const QPointF &point, const QPointF &startPoint);
virtual QPointF documentToImage(const QPointF &point);
virtual QPointF imageToView(const QPointF &point);
virtual qreal calculatePerspective(const QPointF &documentPoint);
private:
KisPaintInformation createPaintingInformation(KoPointerEvent *event,
int timeElapsed);
/**
* Defines how many discrete samples are stored in a precomputed array
* of different pressures.
*/
static const int LEVEL_OF_PRESSURE_RESOLUTION;
qreal pressureToCurve(qreal pressure);
private:
QVector<qreal> m_pressureSamples;
QPointF m_startPoint;
QScopedPointer<KisSpeedSmoother> m_speedSmoother;
bool m_pressureDisabled;
};
class KRITAUI_EXPORT KisConverterPaintingInformationBuilder : public KisPaintingInformationBuilder
{
Q_OBJECT
public:
KisConverterPaintingInformationBuilder(const KisCoordinatesConverter *converter);
protected:
- virtual QPointF documentToImage(const QPointF &point);
- virtual QPointF imageToView(const QPointF &point);
+ QPointF documentToImage(const QPointF &point) override;
+ QPointF imageToView(const QPointF &point) override;
private:
const KisCoordinatesConverter *m_converter;
};
class KRITAUI_EXPORT KisToolFreehandPaintingInformationBuilder : public KisPaintingInformationBuilder
{
Q_OBJECT
public:
KisToolFreehandPaintingInformationBuilder(KisToolFreehand *tool);
protected:
- virtual QPointF documentToImage(const QPointF &point);
- virtual QPointF imageToView(const QPointF &point);
- virtual QPointF adjustDocumentPoint(const QPointF &point, const QPointF &startPoint);
- virtual qreal calculatePerspective(const QPointF &documentPoint);
+ QPointF documentToImage(const QPointF &point) override;
+ QPointF imageToView(const QPointF &point) override;
+ QPointF adjustDocumentPoint(const QPointF &point, const QPointF &startPoint) override;
+ qreal calculatePerspective(const QPointF &documentPoint) override;
private:
KisToolFreehand *m_tool;
};
#endif /* __KIS_PAINTING_INFORMATION_BUILDER_H */
diff --git a/libs/ui/tool/kis_smoothing_options.h b/libs/ui/tool/kis_smoothing_options.h
index dea4652df2..62c33afa1f 100644
--- a/libs/ui/tool/kis_smoothing_options.h
+++ b/libs/ui/tool/kis_smoothing_options.h
@@ -1,81 +1,81 @@
/*
* Copyright (c) 2012 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SMOOTHING_OPTIONS_H
#define KIS_SMOOTHING_OPTIONS_H
#include <qglobal.h>
#include <QObject>
#include <QSharedPointer>
#include <QScopedPointer>
#include <kritaui_export.h>
class KRITAUI_EXPORT KisSmoothingOptions : public QObject
{
Q_OBJECT
public:
enum SmoothingType {
NO_SMOOTHING = 0,
SIMPLE_SMOOTHING,
WEIGHTED_SMOOTHING,
STABILIZER
};
public:
KisSmoothingOptions(bool useSavedSmoothing = true);
- ~KisSmoothingOptions();
+ ~KisSmoothingOptions() override;
SmoothingType smoothingType() const;
void setSmoothingType(SmoothingType value);
qreal smoothnessDistance() const;
void setSmoothnessDistance(qreal value);
qreal tailAggressiveness() const;
void setTailAggressiveness(qreal value);
bool smoothPressure() const;
void setSmoothPressure(bool value);
bool useScalableDistance() const;
void setUseScalableDistance(bool value);
qreal delayDistance() const;
void setDelayDistance(qreal value);
void setUseDelayDistance(bool value);
bool useDelayDistance() const;
void setFinishStabilizedCurve(bool value);
bool finishStabilizedCurve() const;
void setStabilizeSensors(bool value);
bool stabilizeSensors() const;
private Q_SLOTS:
void slotWriteConfig();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
typedef QSharedPointer<KisSmoothingOptions> KisSmoothingOptionsSP;
#endif // KIS_SMOOTHING_OPTIONS_H
diff --git a/libs/ui/tool/kis_tool.h b/libs/ui/tool/kis_tool.h
index d69332543e..a8b65d61df 100644
--- a/libs/ui/tool/kis_tool.h
+++ b/libs/ui/tool/kis_tool.h
@@ -1,346 +1,346 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_H_
#define KIS_TOOL_H_
#include <QCursor>
#include <KoColor.h>
#include <KoToolBase.h>
#include <KoID.h>
#include <KoCanvasResourceManager.h>
#include <kritaui_export.h>
#include <kis_types.h>
#define PRESS_CONDITION(_event, _mode, _button, _modifier) \
(this->mode() == (_mode) && (_event)->button() == (_button) && \
(_event)->modifiers() == (_modifier))
#define PRESS_CONDITION_WB(_event, _mode, _button, _modifier) \
(this->mode() == (_mode) && (_event)->button() & (_button) && \
(_event)->modifiers() == (_modifier))
#define PRESS_CONDITION_OM(_event, _mode, _button, _modifier) \
(this->mode() == (_mode) && (_event)->button() == (_button) && \
((_event)->modifiers() & (_modifier) || \
(_event)->modifiers() == Qt::NoModifier))
#define RELEASE_CONDITION(_event, _mode, _button) \
(this->mode() == (_mode) && (_event)->button() == (_button))
#define RELEASE_CONDITION_WB(_event, _mode, _button) \
(this->mode() == (_mode) && (_event)->button() & (_button))
#define MOVE_CONDITION(_event, _mode) (this->mode() == (_mode))
#ifdef __GNUC__
#define WARN_WRONG_MODE(_mode) warnKrita << "Unexpected tool event has come to" << __func__ << "while being mode" << _mode << "!"
#else
#define WARN_WRONG_MODE(_mode) warnKrita << "Unexpected tool event has come while being mode" << _mode << "!"
#endif
#define CHECK_MODE_SANITY_OR_RETURN(_mode) if (mode() != _mode) { WARN_WRONG_MODE(mode()); return; }
class KoCanvasBase;
class KoPattern;
class KoAbstractGradient;
class KisFilterConfiguration;
class QPainter;
class QPainterPath;
class QPolygonF;
class KisRecordedPaintAction;
/// Definitions of the toolgroups of Krita
static const QString TOOL_TYPE_SHAPE = "0 Krita/Shape"; // Geometric shapes like ellipses and lines
static const QString TOOL_TYPE_TRANSFORM = "2 Krita/Transform"; // Tools that transform the layer;
static const QString TOOL_TYPE_FILL = "3 Krita/Fill"; // Tools that fill parts of the canvas
static const QString TOOL_TYPE_VIEW = "4 Krita/View"; // Tools that affect the canvas: pan, zoom, etc.
static const QString TOOL_TYPE_SELECTION = "5 Krita/Select"; // Tools that select pixels
//activation id for Krita tools, Krita tools are always active and handle locked and invisible layers by themself
static const QString KRITA_TOOL_ACTIVATION_ID = "flake/always";
class KRITAUI_EXPORT KisTool
: public KoToolBase
{
Q_OBJECT
Q_PROPERTY(bool isActive READ isActive NOTIFY isActiveChanged)
public:
- enum { FLAG_USES_CUSTOM_PRESET=0x01, FLAG_USES_CUSTOM_COMPOSITEOP=0x02 };
+ enum { FLAG_USES_CUSTOM_PRESET=0x01, FLAG_USES_CUSTOM_COMPOSITEOP=0x02, FLAG_USES_CUSTOM_SIZE=0x04 };
KisTool(KoCanvasBase * canvas, const QCursor & cursor);
- virtual ~KisTool();
+ ~KisTool() override;
virtual int flags() const { return 0; }
- void deleteSelection();
+ void deleteSelection() override;
// KoToolBase Implementation.
public:
/**
* Called by KisToolProxy when the primary action of the tool is
* going to be started now, that is when all the modifiers are
* pressed and the only thing left is just to press the mouse
* button. On coming of this callback the tool is supposed to
* prepare the cursor and/or the outline to show the user shat is
* going to happen next
*/
virtual void activatePrimaryAction();
/**
* Called by KisToolProxy when the primary is no longer possible
* to be started now, e.g. when its modifiers and released. The
* tool is supposed revert all the preparetions it has doen in
* activatePrimaryAction().
*/
virtual void deactivatePrimaryAction();
/**
* Called by KisToolProxy when a primary action for the tool is
* started. The \p event stores the original event that
* started the stroke. The \p event is _accepted_ by default. If
* the tool decides to ignore this particular action (e.g. when
* the node is not editable), it should call event->ignore(). Then
* no further continuePrimaryAction() or endPrimaryAction() will
* be called until the next user action.
*/
virtual void beginPrimaryAction(KoPointerEvent *event);
/**
* Called by KisToolProxy when the primary action is in progress
* of pointer movement. If the tool has ignored the event in
* beginPrimaryAction(), this method will not be called.
*/
virtual void continuePrimaryAction(KoPointerEvent *event);
/**
* Called by KisToolProxy when the primary action is being
* finished, that is while mouseRelease or tabletRelease event.
* If the tool has ignored the event in beginPrimaryAction(), this
* method will not be called.
*/
virtual void endPrimaryAction(KoPointerEvent *event);
/**
* The same as beginPrimaryAction(), but called when the stroke is
* started by a double-click
*
* \see beginPrimaryAction()
*/
virtual void beginPrimaryDoubleClickAction(KoPointerEvent *event);
/**
* Returns true if the tool can handle (and wants to handle) a
* very tight flow of input events from the tablet
*/
virtual bool primaryActionSupportsHiResEvents() const;
enum ToolAction {
Primary,
AlternateChangeSize,
AlternatePickFgNode,
AlternatePickBgNode,
AlternatePickFgImage,
AlternatePickBgImage,
AlternateSecondary,
AlternateThird,
AlternateFourth,
AlternateFifth,
Alternate_NONE = 10000
};
// Technically users are allowed to configure this, but nobody ever would do that.
// So these can basically be thought of as aliases to ctrl+click, etc.
enum AlternateAction {
ChangeSize = AlternateChangeSize, // Default: Shift+Left click
PickFgNode = AlternatePickFgNode, // Default: Ctrl+Alt+Left click
PickBgNode = AlternatePickBgNode, // Default: Ctrl+Alt+Right click
PickFgImage = AlternatePickFgImage, // Default: Ctrl+Left click
PickBgImage = AlternatePickBgImage, // Default: Ctrl+Right click
Secondary = AlternateSecondary,
Third = AlternateThird,
Fourth = AlternateFourth,
Fifth = AlternateFifth,
NONE = 10000
};
static AlternateAction actionToAlternateAction(ToolAction action);
virtual void activateAlternateAction(AlternateAction action);
virtual void deactivateAlternateAction(AlternateAction action);
virtual void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
virtual void continueAlternateAction(KoPointerEvent *event, AlternateAction action);
virtual void endAlternateAction(KoPointerEvent *event, AlternateAction action);
virtual void beginAlternateDoubleClickAction(KoPointerEvent *event, AlternateAction action);
- void mousePressEvent(KoPointerEvent *event);
- void mouseDoubleClickEvent(KoPointerEvent *event);
- void mouseTripleClickEvent(KoPointerEvent *event);
- void mouseReleaseEvent(KoPointerEvent *event);
- void mouseMoveEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
+ void mouseTripleClickEvent(KoPointerEvent *event) override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
bool isActive() const;
public Q_SLOTS:
- virtual void activate(ToolActivation activation, const QSet<KoShape*> &shapes);
- virtual void deactivate();
- virtual void canvasResourceChanged(int key, const QVariant & res);
+ void activate(ToolActivation activation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
+ void canvasResourceChanged(int key, const QVariant & res) override;
// Implement this slot in case there are any widgets or properties which need
// to be updated after certain operations, to reflect the inner state correctly.
// At the moment this is used for smoothing options in the freehand brush, but
// this will likely be expanded.
virtual void updateSettingsViews();
Q_SIGNALS:
void isActiveChanged();
protected:
// conversion methods are also needed by the paint information builder
friend class KisToolPaintingInformationBuilder;
/// Convert from native (postscript points) to image pixel
/// coordinates.
QPointF convertToPixelCoord(KoPointerEvent *e);
QPointF convertToPixelCoord(const QPointF& pt);
QPointF convertToPixelCoordAndSnap(KoPointerEvent *e, const QPointF &offset = QPointF(), bool useModifiers = true);
QPointF convertToPixelCoordAndSnap(const QPointF& pt, const QPointF &offset = QPointF());
protected:
QPointF widgetCenterInWidgetPixels();
QPointF convertDocumentToWidget(const QPointF& pt);
/// Convert from native (postscript points) to integer image pixel
/// coordinates. This truncates the floating point components and
/// should be used in preference to QPointF::toPoint(), which rounds,
/// to ensure the cursor acts on the pixel it is visually over.
QPoint convertToIntPixelCoord(KoPointerEvent *e);
QRectF convertToPt(const QRectF &rect);
QPointF viewToPixel(const QPointF &viewCoord) const;
/// Convert an integer pixel coordinate into a view coordinate.
/// The view coordinate is at the centre of the pixel.
QPointF pixelToView(const QPoint &pixelCoord) const;
/// Convert a floating point pixel coordinate into a view coordinate.
QPointF pixelToView(const QPointF &pixelCoord) const;
/// Convert a pixel rectangle into a view rectangle.
QRectF pixelToView(const QRectF &pixelRect) const;
/// Convert a pixel path into a view path
QPainterPath pixelToView(const QPainterPath &pixelPath) const;
/// Convert a pixel polygon into a view path
QPolygonF pixelToView(const QPolygonF &pixelPolygon) const;
/// Update the canvas for the given rectangle in image pixel coordinates.
void updateCanvasPixelRect(const QRectF &pixelRect);
/// Update the canvas for the given rectangle in view coordinates.
void updateCanvasViewRect(const QRectF &viewRect);
- virtual QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
/**
* To determine whether this tool will change its behavior when
* modifier keys are pressed
*/
virtual bool listeningToModifiers();
/**
* Request that this tool no longer listen to modifier keys
* (Responding to the request is optional)
*/
virtual void listenToModifiers(bool listen);
protected:
KisImageWSP image() const;
QCursor cursor() const;
/// Call this to set the document modified
void notifyModified() const;
KisImageWSP currentImage();
KoPattern* currentPattern();
KoAbstractGradient *currentGradient();
KisNodeSP currentNode() const;
KisNodeList selectedNodes() const;
KoColor currentFgColor();
KoColor currentBgColor();
KisPaintOpPresetSP currentPaintOpPreset();
KisFilterConfigurationSP currentGenerator();
virtual void setupPaintAction(KisRecordedPaintAction* action);
/// paint the path which is in view coordinates, default paint mode is XOR_MODE, BW_MODE is also possible
/// never apply transformations to the painter, they would be useless, if drawing in OpenGL mode. The coordinates in the path should be in view coordinates.
void paintToolOutline(QPainter * painter, const QPainterPath &path);
/// Checks checks if the current node is editable
bool nodeEditable();
/// Checks checks if the selection is editable, only applies to local selection as global selection is always editable
bool selectionEditable();
/// Override the cursor appropriately if current node is not editable
bool overrideCursorIfNotEditable();
bool blockUntilOperationsFinished();
void blockUntilOperationsFinishedForced();
protected:
enum ToolMode {
HOVER_MODE,
PAINT_MODE,
SECONDARY_PAINT_MODE,
MIRROR_AXIS_SETUP_MODE,
GESTURE_MODE,
PAN_MODE,
OTHER // not used now
};
virtual void setMode(ToolMode mode);
virtual ToolMode mode() const;
void setCursor(const QCursor &cursor);
protected Q_SLOTS:
/**
* Called whenever the configuration settings change.
*/
virtual void resetCursorStyle();
private Q_SLOTS:
void slotToggleFgBg();
void slotResetFgBg();
private:
struct Private;
Private* const d;
};
#endif // KIS_TOOL_H_
diff --git a/libs/ui/tool/kis_tool_ellipse_base.h b/libs/ui/tool/kis_tool_ellipse_base.h
index a35f466e9a..8d5231f9e5 100644
--- a/libs/ui/tool/kis_tool_ellipse_base.h
+++ b/libs/ui/tool/kis_tool_ellipse_base.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_ELLIPSE_BASE_H
#define KIS_TOOL_ELLIPSE_BASE_H
#include <kis_tool_rectangle_base.h>
#include <kis_cursor.h>
class KRITAUI_EXPORT KisToolEllipseBase : public KisToolRectangleBase
{
public:
KisToolEllipseBase(KoCanvasBase * canvas, KisToolEllipseBase::ToolType type, const QCursor & cursor=KisCursor::load("tool_ellipse_cursor.png", 6, 6));
- void paintRectangle(QPainter &gc, const QRectF &imageRect);
+ void paintRectangle(QPainter &gc, const QRectF &imageRect) override;
};
#endif // KIS_TOOL_ELLIPSE_BASE_H
diff --git a/libs/ui/tool/kis_tool_freehand.h b/libs/ui/tool/kis_tool_freehand.h
index a2827dc1c5..356229d5ae 100644
--- a/libs/ui/tool/kis_tool_freehand.h
+++ b/libs/ui/tool/kis_tool_freehand.h
@@ -1,141 +1,141 @@
/*
* Copyright (c) 2003-2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_FREEHAND_H_
#define KIS_TOOL_FREEHAND_H_
#include <Eigen/Core>
#include <brushengine/kis_paint_information.h>
#include <brushengine/kis_paintop_settings.h>
#include <kis_distance_information.h>
#include "kis_types.h"
#include "kis_tool_paint.h"
#include "kis_smoothing_options.h"
#include "kis_signal_compressor_with_param.h"
#include "kritaui_export.h"
class KoPointerEvent;
class KoCanvasBase;
class KisPaintingInformationBuilder;
class KisToolFreehandHelper;
class KisRecordingAdapter;
class KRITAUI_EXPORT KisToolFreehand : public KisToolPaint
{
Q_OBJECT
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
KisToolFreehand(KoCanvasBase * canvas, const QCursor & cursor, const KUndo2MagicString &transactionText);
- virtual ~KisToolFreehand();
- virtual int flags() const;
+ ~KisToolFreehand() override;
+ int flags() const override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
protected:
bool tryPickByPaintOp(KoPointerEvent *event, AlternateAction action);
- bool primaryActionSupportsHiResEvents() const;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ bool primaryActionSupportsHiResEvents() const override;
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- void activateAlternateAction(AlternateAction action);
- void deactivateAlternateAction(AlternateAction action);
+ void activateAlternateAction(AlternateAction action) override;
+ void deactivateAlternateAction(AlternateAction action) override;
- void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
- void continueAlternateAction(KoPointerEvent *event, AlternateAction action);
- void endAlternateAction(KoPointerEvent *event, AlternateAction action);
+ void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void endAlternateAction(KoPointerEvent *event, AlternateAction action) override;
- virtual bool wantsAutoScroll() const;
+ bool wantsAutoScroll() const override;
virtual void initStroke(KoPointerEvent *event);
virtual void doStroke(KoPointerEvent *event);
virtual void endStroke();
- virtual QPainterPath getOutlinePath(const QPointF &documentPos,
+ QPainterPath getOutlinePath(const QPointF &documentPos,
const KoPointerEvent *event,
- KisPaintOpSettings::OutlineMode outlineMode);
+ KisPaintOpSettings::OutlineMode outlineMode) override;
KisPaintingInformationBuilder* paintingInformationBuilder() const;
KisRecordingAdapter* recordingAdapter() const;
void resetHelper(KisToolFreehandHelper *helper);
protected Q_SLOTS:
void explicitUpdateOutline();
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
void setAssistant(bool assistant);
void setOnlyOneAssistantSnap(bool assistant);
void slotDoResizeBrush(qreal newSize);
private:
friend class KisToolFreehandPaintingInformationBuilder;
/**
* Adjusts a coordinates according to a KisPaintingAssitant,
* if available.
*/
QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
/**
* Calculates a coefficient for KisPaintInformation
* according to perspective grid values
*/
qreal calculatePerspective(const QPointF &documentPoint);
protected:
friend class KisViewManager;
friend class KisView;
friend class KisSketchView;
KisSmoothingOptionsSP smoothingOptions() const;
bool m_assistant;
double m_magnetism;
bool m_only_one_assistant;
private:
KisPaintingInformationBuilder *m_infoBuilder;
KisToolFreehandHelper *m_helper;
KisRecordingAdapter *m_recordingAdapter;
QPointF m_initialGestureDocPoint;
QPointF m_lastDocumentPoint;
qreal m_lastPaintOpSize;
QPoint m_initialGestureGlobalPoint;
bool m_paintopBasedPickingInAction;
KisSignalCompressorWithParam<qreal> m_brushResizeCompressor;
};
#endif // KIS_TOOL_FREEHAND_H_
diff --git a/libs/ui/tool/kis_tool_freehand_helper.h b/libs/ui/tool/kis_tool_freehand_helper.h
index b08c8d4869..9833a31e17 100644
--- a/libs/ui/tool/kis_tool_freehand_helper.h
+++ b/libs/ui/tool/kis_tool_freehand_helper.h
@@ -1,152 +1,152 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_FREEHAND_HELPER_H
#define __KIS_TOOL_FREEHAND_HELPER_H
#include <QObject>
#include "kis_types.h"
#include "kritaui_export.h"
#include <brushengine/kis_paint_information.h>
#include "kis_default_bounds.h"
#include <brushengine/kis_paintop_settings.h>
#include "kis_smoothing_options.h"
#include "strokes/freehand_stroke.h"
class KoPointerEvent;
class KoCanvasResourceManager;
class KisPaintingInformationBuilder;
class KisRecordingAdapter;
class KisStrokesFacade;
class KisPostExecutionUndoAdapter;
class KisPaintOp;
class KRITAUI_EXPORT KisToolFreehandHelper : public QObject
{
Q_OBJECT
protected:
typedef FreehandStrokeStrategy::PainterInfo PainterInfo;
public:
KisToolFreehandHelper(KisPaintingInformationBuilder *infoBuilder,
const KUndo2MagicString &transactionText = KUndo2MagicString(),
KisRecordingAdapter *recordingAdapter = 0,
KisSmoothingOptions *smoothingOptions = 0);
- ~KisToolFreehandHelper();
+ ~KisToolFreehandHelper() override;
void setSmoothness(KisSmoothingOptionsSP smoothingOptions);
KisSmoothingOptionsSP smoothingOptions() const;
bool isRunning() const;
void initPaint(KoPointerEvent *event,
KoCanvasResourceManager *resourceManager,
KisImageWSP image,
KisNodeSP currentNode,
KisStrokesFacade *strokesFacade,
KisNodeSP overrideNode = 0,
KisDefaultBoundsBaseSP bounds = 0);
void paint(KoPointerEvent *event);
void endPaint();
const KisPaintOp* currentPaintOp() const;
QPainterPath paintOpOutline(const QPointF &savedCursorPos,
const KoPointerEvent *event,
const KisPaintOpSettingsSP globalSettings,
KisPaintOpSettings::OutlineMode mode) const;
int canvasRotation();
void setCanvasRotation(int rotation = 0);
bool canvasMirroredH();
void setCanvasHorizontalMirrorState (bool mirrored = false);
Q_SIGNALS:
/**
* The signal is emitted when the outline should be updated
* explicitly by the tool. Used by Stabilizer option, because it
* paints on internal timer events instead of the on every paint()
* event
*/
void requestExplicitUpdateOutline();
protected:
void cancelPaint();
int elapsedStrokeTime() const;
void initPaintImpl(const KisPaintInformation &previousPaintInformation,
KoCanvasResourceManager *resourceManager,
KisImageWSP image,
KisNodeSP node,
KisStrokesFacade *strokesFacade,
KisNodeSP overrideNode = 0,
KisDefaultBoundsBaseSP bounds = 0);
protected:
virtual void createPainters(QVector<PainterInfo*> &painterInfos,
const QPointF &lastPosition,
int lastTime);
// lo-level methods for painting primitives
void paintAt(int painterInfoId, const KisPaintInformation &pi);
void paintLine(int painterInfoId,
const KisPaintInformation &pi1,
const KisPaintInformation &pi2);
void paintBezierCurve(int painterInfoId,
const KisPaintInformation &pi1,
const QPointF &control1,
const QPointF &control2,
const KisPaintInformation &pi2);
// hi-level methods for painting primitives
virtual void paintAt(const KisPaintInformation &pi);
virtual void paintLine(const KisPaintInformation &pi1,
const KisPaintInformation &pi2);
virtual void paintBezierCurve(const KisPaintInformation &pi1,
const QPointF &control1,
const QPointF &control2,
const KisPaintInformation &pi2);
private:
void paintBezierSegment(KisPaintInformation pi1, KisPaintInformation pi2,
QPointF tangent1, QPointF tangent2);
void stabilizerStart(KisPaintInformation firstPaintInfo);
void stabilizerEnd();
private Q_SLOTS:
void finishStroke();
void doAirbrushing();
void stabilizerPollAndPaint();
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_TOOL_FREEHAND_HELPER_H */
diff --git a/libs/ui/tool/kis_tool_multihand_helper.h b/libs/ui/tool/kis_tool_multihand_helper.h
index 256c4a04cc..c67ca9feb7 100644
--- a/libs/ui/tool/kis_tool_multihand_helper.h
+++ b/libs/ui/tool/kis_tool_multihand_helper.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_MULTIHAND_HELPER_H
#define __KIS_TOOL_MULTIHAND_HELPER_H
#include "kis_tool_freehand_helper.h"
class KRITAUI_EXPORT KisToolMultihandHelper : public KisToolFreehandHelper
{
Q_OBJECT
public:
KisToolMultihandHelper(KisPaintingInformationBuilder *infoBuilder,
const KUndo2MagicString &transactionText,
KisRecordingAdapter *recordingAdapter = 0);
- virtual ~KisToolMultihandHelper();
+ ~KisToolMultihandHelper() override;
void setupTransformations(const QVector<QTransform> &transformations);
protected:
void createPainters(QVector<PainterInfo*> &painterInfos,
const QPointF &lastPosition,
- int lastTime);
+ int lastTime) override;
- void paintAt(const KisPaintInformation &pi);
+ void paintAt(const KisPaintInformation &pi) override;
void paintLine(const KisPaintInformation &pi1,
- const KisPaintInformation &pi2);
+ const KisPaintInformation &pi2) override;
void paintBezierCurve(const KisPaintInformation &pi1,
const QPointF &control1,
const QPointF &control2,
- const KisPaintInformation &pi2);
+ const KisPaintInformation &pi2) override;
using KisToolFreehandHelper::paintAt;
using KisToolFreehandHelper::paintLine;
using KisToolFreehandHelper::paintBezierCurve;
private:
struct Private;
Private * const d;
};
#endif /* __KIS_TOOL_MULTIHAND_HELPER_H */
diff --git a/libs/ui/tool/kis_tool_paint.h b/libs/ui/tool/kis_tool_paint.h
index 11bd7691d9..d7eae7272f 100644
--- a/libs/ui/tool/kis_tool_paint.h
+++ b/libs/ui/tool/kis_tool_paint.h
@@ -1,236 +1,236 @@
/*
* Copyright (c) 2003 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_PAINT_H_
#define KIS_TOOL_PAINT_H_
#include <vector>
#include <QCursor>
#include <QLayout>
#include <QGridLayout>
#include <QVariant>
#include <QTimer>
#include <KoCanvasResourceManager.h>
#include <KoToolBase.h>
#include <resources/KoAbstractGradient.h>
#include <kritaui_export.h>
#include <kis_types.h>
#include <kis_image.h>
#include "kis_signal_compressor_with_param.h"
#include <brushengine/kis_paintop_settings.h>
#include <resources/KoPattern.h>
#include "kis_tool.h"
#include <QCheckBox>
class QGridLayout;
class KoCompositeOp;
class KoCanvasBase;
// wacom
const static int LEVEL_OF_PRESSURE_RESOLUTION = 1024;
class KRITAUI_EXPORT KisToolPaint : public KisTool
{
Q_OBJECT
public:
KisToolPaint(KoCanvasBase * canvas, const QCursor & cursor);
- virtual ~KisToolPaint();
- virtual int flags() const;
+ ~KisToolPaint() override;
+ int flags() const override;
- virtual void mousePressEvent(KoPointerEvent *event);
- virtual void mouseReleaseEvent(KoPointerEvent *event);
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
protected:
- void setMode(ToolMode mode);
+ void setMode(ToolMode mode) override;
- virtual void canvasResourceChanged(int key, const QVariant & v);
+ void canvasResourceChanged(int key, const QVariant & v) override;
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- virtual void activatePrimaryAction();
- virtual void deactivatePrimaryAction();
+ void activatePrimaryAction() override;
+ void deactivatePrimaryAction() override;
- virtual void activateAlternateAction(AlternateAction action);
- virtual void deactivateAlternateAction(AlternateAction action);
+ void activateAlternateAction(AlternateAction action) override;
+ void deactivateAlternateAction(AlternateAction action) override;
- virtual void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
- virtual void continueAlternateAction(KoPointerEvent *event, AlternateAction action);
- virtual void endAlternateAction(KoPointerEvent *event, AlternateAction action);
+ void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void endAlternateAction(KoPointerEvent *event, AlternateAction action) override;
virtual void requestUpdateOutline(const QPointF &outlineDocPoint, const KoPointerEvent *event);
/** If the paint tool support outline like brushes, set to true.
* If not (e.g. gradient tool), set to false. Default is false.
*/
void setSupportOutline(bool supportOutline) {
m_supportOutline = supportOutline;
}
virtual QPainterPath getOutlinePath(const QPointF &documentPos,
const KoPointerEvent *event,
KisPaintOpSettings::OutlineMode outlineMode);
protected:
bool isOutlineEnabled() const;
void setOutlineEnabled(bool enabled);
bool pickColor(const QPointF &documentPixel, AlternateAction action);
/// Add the tool-specific layout to the default option widget layout.
void addOptionWidgetLayout(QLayout *layout);
/// Add a widget and a label to the current option widget layout.
virtual void addOptionWidgetOption(QWidget *control, QWidget *label = 0);
void showControl(QWidget *control, bool value);
void enableControl(QWidget *control, bool value);
- virtual QWidget * createOptionWidget();
+ QWidget * createOptionWidget() override;
/**
* Quick help is a short help text about the way the tool functions.
*/
virtual QString quickHelp() const {
return QString();
}
- virtual void setupPaintAction(KisRecordedPaintAction* action);
+ void setupPaintAction(KisRecordedPaintAction* action) override;
qreal pressureToCurve(qreal pressure){
qreal p = qRound(pressure * LEVEL_OF_PRESSURE_RESOLUTION);
if (p < 0) {
return m_pressureSamples.first();
}
else if (p < m_pressureSamples.size()) {
return m_pressureSamples.at(p);
}
return m_pressureSamples.last();
}
enum NodePaintAbility {
NONE,
PAINT,
VECTOR
};
/// Checks if and how the tool can paint on the current node
NodePaintAbility nodePaintAbility();
const KoCompositeOp* compositeOp();
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- virtual void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
private Q_SLOTS:
void slotPopupQuickHelp();
void increaseBrushSize();
void decreaseBrushSize();
void activatePickColorDelayed();
void slotColorPickingFinished(const KoColor &color);
protected Q_SLOTS:
void updateTabletPressureSamples();
protected:
quint8 m_opacity;
bool m_paintOutline;
QVector<qreal> m_pressureSamples;
QPointF m_outlineDocPoint;
QPainterPath m_currentOutline;
QRectF m_oldOutlineRect;
bool m_showColorPreview;
QRectF m_oldColorPreviewRect;
QRectF m_oldColorPreviewUpdateRect;
QColor m_colorPreviewCurrentColor;
bool m_colorPreviewShowComparePlate;
QColor m_colorPreviewBaseColor;
private:
QPainterPath tryFixBrushOutline(const QPainterPath &originalOutline);
void setOpacity(qreal opacity);
void activatePickColor(AlternateAction action);
void deactivatePickColor(AlternateAction action);
void pickColorWasOverridden();
int colorPreviewResourceId(AlternateAction action);
QRectF colorPreviewDocRect(const QPointF &outlineDocPoint);
bool isPickingAction(AlternateAction action);
struct PickingJob {
PickingJob() {}
PickingJob(QPointF _documentPixel,
AlternateAction _action)
: documentPixel(_documentPixel),
action(_action) {}
QPointF documentPixel;
AlternateAction action;
};
void addPickerJob(const PickingJob &pickingJob);
private:
bool m_specialHoverModifier;
QGridLayout *m_optionsWidgetLayout;
bool m_supportOutline;
/**
* Used as a switch for pickColor
*/
// used to skip some of the tablet events and don't update the colour that often
QTimer m_colorPickerDelayTimer;
AlternateAction delayedAction;
bool m_isOutlineEnabled;
std::vector<int> m_standardBrushSizes;
KisStrokeId m_pickerStrokeId;
int m_pickingResource;
typedef KisSignalCompressorWithParam<PickingJob> PickingCompressor;
QScopedPointer<PickingCompressor> m_colorPickingCompressor;
Q_SIGNALS:
void sigPaintingFinished();
};
#endif // KIS_TOOL_PAINT_H_
diff --git a/libs/ui/tool/kis_tool_polyline_base.h b/libs/ui/tool/kis_tool_polyline_base.h
index ea6490cbef..91baff9707 100644
--- a/libs/ui/tool/kis_tool_polyline_base.h
+++ b/libs/ui/tool/kis_tool_polyline_base.h
@@ -1,76 +1,76 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_POLYLINE_BASE_H
#define KIS_TOOL_POLYLINE_BASE_H
#include <kis_tool_shape.h>
#include <kis_cursor.h>
class KRITAUI_EXPORT KisToolPolylineBase : public KisToolShape
{
Q_OBJECT
public:
enum ToolType {
PAINT,
SELECT
};
KisToolPolylineBase(KoCanvasBase * canvas, KisToolPolylineBase::ToolType type, const QCursor & cursor=KisCursor::load("tool_polygon_cursor.png", 6, 6));
- void beginPrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
- void beginPrimaryDoubleClickAction(KoPointerEvent *event);
- void mouseMoveEvent(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
+ void beginPrimaryDoubleClickAction(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
- void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
+ void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override;
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- void activate(ToolActivation activation, const QSet<KoShape*> &shapes);
- void deactivate();
- virtual void listenToModifiers(bool listen);
- virtual bool listeningToModifiers();
- void requestStrokeEnd();
- void requestStrokeCancellation();
+ void activate(ToolActivation activation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
+ void listenToModifiers(bool listen) override;
+ bool listeningToModifiers() override;
+ void requestStrokeEnd() override;
+ void requestStrokeCancellation() override;
protected:
virtual void finishPolyline(const QVector<QPointF>& points) = 0;
private:
void endStroke();
void cancelStroke();
void updateArea();
QRectF dragBoundingRect();
private Q_SLOTS:
virtual void undoSelection();
private:
QPointF m_dragStart;
QPointF m_dragEnd;
bool m_dragging;
bool m_listenToModifiers;
vQPointF m_points;
ToolType m_type;
bool m_closeSnappingActivated;
};
#endif // KIS_TOOL_POLYLINE_BASE_H
diff --git a/libs/ui/tool/kis_tool_rectangle_base.h b/libs/ui/tool/kis_tool_rectangle_base.h
index fbd8ea77f1..3ab9b2116d 100644
--- a/libs/ui/tool/kis_tool_rectangle_base.h
+++ b/libs/ui/tool/kis_tool_rectangle_base.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_RECTANGLE_BASE_H
#define KIS_TOOL_RECTANGLE_BASE_H
#include <kis_tool_shape.h>
#include <kis_cursor.h>
class KRITAUI_EXPORT KisToolRectangleBase : public KisToolShape
{
Q_OBJECT
Q_SIGNALS:
void rectangleChanged(const QRectF &newRect);
public Q_SLOTS:
void constraintsChanged(bool forceRatio, bool forceWidth, bool forceHeight, float ratio, float width, float height);
public:
enum ToolType {
PAINT,
SELECT
};
explicit KisToolRectangleBase(KoCanvasBase * canvas, KisToolRectangleBase::ToolType type, const QCursor & cursor=KisCursor::load("tool_rectangle_cursor.png", 6, 6));
- virtual void beginPrimaryAction(KoPointerEvent *event);
- virtual void continuePrimaryAction(KoPointerEvent *event);
- virtual void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
- virtual void deactivate();
- void listenToModifiers(bool listen);
- bool listeningToModifiers();
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
+ void deactivate() override;
+ void listenToModifiers(bool listen) override;
+ bool listeningToModifiers() override;
- QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
protected:
virtual void finishRect(const QRectF&)=0;
QPointF m_dragCenter;
QPointF m_dragStart;
QPointF m_dragEnd;
ToolType m_type;
bool m_isRatioForced;
bool m_isWidthForced;
bool m_isHeightForced;
bool m_listenToModifiers;
float m_forcedRatio;
float m_forcedWidth;
float m_forcedHeight;
bool isFixedSize();
void applyConstraints(QSizeF& area, bool overrideRatio);
void updateArea();
virtual void paintRectangle(QPainter &gc, const QRectF &imageRect);
virtual QRectF createRect(const QPointF &start, const QPointF &end);
};
#endif // KIS_TOOL_RECTANGLE_BASE_H
diff --git a/libs/ui/tool/kis_tool_shape.h b/libs/ui/tool/kis_tool_shape.h
index 5aee0e5782..fcd913d999 100644
--- a/libs/ui/tool/kis_tool_shape.h
+++ b/libs/ui/tool/kis_tool_shape.h
@@ -1,86 +1,86 @@
/*
* Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SHAPE_H_
#define KIS_TOOL_SHAPE_H_
#include <kritaui_export.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include "kis_tool_paint.h"
#include "kis_painter.h"
#include "ui_wdggeometryoptions.h"
class KoCanvasBase;
class KoPathShape;
class WdgGeometryOptions : public QWidget, public Ui::WdgGeometryOptions
{
Q_OBJECT
public:
WdgGeometryOptions(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* Base for tools specialized in drawing shapes
*/
class KRITAUI_EXPORT KisToolShape : public KisToolPaint
{
Q_OBJECT
public:
KisToolShape(KoCanvasBase * canvas, const QCursor & cursor);
- virtual ~KisToolShape();
- virtual int flags() const;
+ ~KisToolShape() override;
+ int flags() const override;
WdgGeometryOptions *m_shapeOptionsWidget;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
virtual void outlineSettingChanged(int value);
virtual void fillSettingChanged(int value);
protected:
- QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
virtual KisPainter::FillStyle fillStyle();
KisPainter::StrokeStyle strokeStyle();
qreal currentStrokeWidth() const;
- virtual void setupPaintAction(KisRecordedPaintAction* action);
+ void setupPaintAction(KisRecordedPaintAction* action) override;
void addShape(KoShape* shape);
void addPathShape(KoPathShape* pathShape, const KUndo2MagicString& name);
KConfigGroup m_configGroup;
};
#endif // KIS_TOOL_SHAPE_H_
diff --git a/libs/ui/tool/strokes/freehand_stroke.h b/libs/ui/tool/strokes/freehand_stroke.h
index 7750d4155c..09c316b000 100644
--- a/libs/ui/tool/strokes/freehand_stroke.h
+++ b/libs/ui/tool/strokes/freehand_stroke.h
@@ -1,204 +1,204 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __FREEHAND_STROKE_H
#define __FREEHAND_STROKE_H
#include "kritaui_export.h"
#include "kis_types.h"
#include "kis_node.h"
#include "kis_painter_based_stroke_strategy.h"
#include <kis_distance_information.h>
#include <brushengine/kis_paint_information.h>
#include "kis_lod_transform.h"
#include "KoColor.h"
class KRITAUI_EXPORT FreehandStrokeStrategy : public KisPainterBasedStrokeStrategy
{
public:
class Data : public KisStrokeJobData {
public:
enum DabType {
POINT,
LINE,
CURVE,
POLYLINE,
POLYGON,
RECT,
ELLIPSE,
PAINTER_PATH,
QPAINTER_PATH,
QPAINTER_PATH_FILL
};
Data(KisNodeSP _node, int _painterInfoId,
const KisPaintInformation &_pi)
: node(_node), painterInfoId(_painterInfoId),
type(POINT), pi1(_pi)
{}
Data(KisNodeSP _node, int _painterInfoId,
const KisPaintInformation &_pi1,
const KisPaintInformation &_pi2)
: node(_node), painterInfoId(_painterInfoId),
type(LINE), pi1(_pi1), pi2(_pi2)
{}
Data(KisNodeSP _node, int _painterInfoId,
const KisPaintInformation &_pi1,
const QPointF &_control1,
const QPointF &_control2,
const KisPaintInformation &_pi2)
: node(_node), painterInfoId(_painterInfoId),
type(CURVE), pi1(_pi1), pi2(_pi2),
control1(_control1), control2(_control2)
{}
Data(KisNodeSP _node, int _painterInfoId,
DabType _type,
const vQPointF &_points)
: node(_node), painterInfoId(_painterInfoId),
type(_type), points(_points)
{}
Data(KisNodeSP _node, int _painterInfoId,
DabType _type,
const QRectF &_rect)
: node(_node), painterInfoId(_painterInfoId),
type(_type), rect(_rect)
{}
Data(KisNodeSP _node, int _painterInfoId,
DabType _type,
const QPainterPath &_path)
: node(_node), painterInfoId(_painterInfoId),
type(_type), path(_path)
{}
Data(KisNodeSP _node, int _painterInfoId,
DabType _type,
const QPainterPath &_path,
const QPen &_pen, const KoColor &_customColor)
: node(_node), painterInfoId(_painterInfoId),
type(_type), path(_path),
pen(_pen), customColor(_customColor)
{}
- KisStrokeJobData* createLodClone(int levelOfDetail) {
+ KisStrokeJobData* createLodClone(int levelOfDetail) override {
return new Data(*this, levelOfDetail);
}
private:
Data(const Data &rhs, int levelOfDetail)
: KisStrokeJobData(rhs),
node(rhs.node),
painterInfoId(rhs.painterInfoId),
type(rhs.type)
{
KisLodTransform t(levelOfDetail);
switch(type) {
case Data::POINT:
pi1 = t.map(rhs.pi1);
break;
case Data::LINE:
pi1 = t.map(rhs.pi1);
pi2 = t.map(rhs.pi2);
break;
case Data::CURVE:
pi1 = t.map(rhs.pi1);
pi2 = t.map(rhs.pi2);
control1 = t.map(rhs.control1);
control2 = t.map(rhs.control2);
break;
case Data::POLYLINE:
points = t.map(rhs.points);
break;
case Data::POLYGON:
points = t.map(rhs.points);
break;
case Data::RECT:
rect = t.map(rhs.rect);
break;
case Data::ELLIPSE:
rect = t.map(rhs.rect);
break;
case Data::PAINTER_PATH:
path = t.map(rhs.path);
break;
case Data::QPAINTER_PATH:
path = t.map(rhs.path);
pen = rhs.pen;
break;
case Data::QPAINTER_PATH_FILL:
path = t.map(rhs.path);
pen = rhs.pen;
customColor = rhs.customColor;
break;
};
}
public:
KisNodeSP node;
int painterInfoId;
DabType type;
KisPaintInformation pi1;
KisPaintInformation pi2;
QPointF control1;
QPointF control2;
vQPointF points;
QRectF rect;
QPainterPath path;
QPen pen;
KoColor customColor;
};
public:
FreehandStrokeStrategy(bool needsIndirectPainting,
const QString &indirectPaintingCompositeOp,
KisResourcesSnapshotSP resources,
PainterInfo *painterInfo,
const KUndo2MagicString &name);
FreehandStrokeStrategy(bool needsIndirectPainting,
const QString &indirectPaintingCompositeOp,
KisResourcesSnapshotSP resources,
QVector<PainterInfo*> painterInfos,
const KUndo2MagicString &name);
- ~FreehandStrokeStrategy();
+ ~FreehandStrokeStrategy() override;
- void doStrokeCallback(KisStrokeJobData *data);
+ void doStrokeCallback(KisStrokeJobData *data) override;
- KisStrokeStrategy* createLodClone(int levelOfDetail);
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
protected:
FreehandStrokeStrategy(const FreehandStrokeStrategy &rhs, int levelOfDetail);
private:
void init(bool needsIndirectPainting, const QString &indirectPaintingCompositeOp);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __FREEHAND_STROKE_H */
diff --git a/libs/ui/tool/strokes/kis_color_picker_stroke_strategy.h b/libs/ui/tool/strokes/kis_color_picker_stroke_strategy.h
index 339d320a01..09633ea666 100644
--- a/libs/ui/tool/strokes/kis_color_picker_stroke_strategy.h
+++ b/libs/ui/tool/strokes/kis_color_picker_stroke_strategy.h
@@ -1,65 +1,65 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLOR_PICKER_STROKE_STRATEGY_H
#define __KIS_COLOR_PICKER_STROKE_STRATEGY_H
#include <QObject>
#include <QScopedPointer>
#include "kis_simple_stroke_strategy.h"
#include "kis_lod_transform.h"
class KoColor;
class KisColorPickerStrokeStrategy : public QObject, public KisSimpleStrokeStrategy
{
Q_OBJECT
public:
class Data : public KisStrokeJobData {
public:
Data(KisPaintDeviceSP _dev, const QPoint _pt)
: dev(_dev), pt(_pt)
{}
- KisStrokeJobData* createLodClone(int levelOfDetail) {
+ KisStrokeJobData* createLodClone(int levelOfDetail) override {
KisLodTransform t(levelOfDetail);
const QPoint realPoint = t.map(pt);
return new Data(dev, realPoint);
}
KisPaintDeviceSP dev;
QPoint pt;
};
public:
KisColorPickerStrokeStrategy(int lod = 0);
- ~KisColorPickerStrokeStrategy();
+ ~KisColorPickerStrokeStrategy() override;
- void doStrokeCallback(KisStrokeJobData *data);
- KisStrokeStrategy* createLodClone(int levelOfDetail);
+ void doStrokeCallback(KisStrokeJobData *data) override;
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
Q_SIGNALS:
void sigColorUpdated(const KoColor &color);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_COLOR_PICKER_STROKE_STRATEGY_H */
diff --git a/libs/ui/tool/strokes/kis_filter_stroke_strategy.h b/libs/ui/tool/strokes/kis_filter_stroke_strategy.h
index 831f454a2c..7591339e90 100644
--- a/libs/ui/tool/strokes/kis_filter_stroke_strategy.h
+++ b/libs/ui/tool/strokes/kis_filter_stroke_strategy.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_FILTER_STROKE_STRATEGY_H
#define __KIS_FILTER_STROKE_STRATEGY_H
#include "kis_types.h"
#include "kis_painter_based_stroke_strategy.h"
#include "kis_lod_transform.h"
class KRITAUI_EXPORT KisFilterStrokeStrategy : public KisPainterBasedStrokeStrategy
{
public:
class Data : public KisStrokeJobData {
public:
Data(const QRect &_processRect, bool concurrent)
: KisStrokeJobData(concurrent ? CONCURRENT : SEQUENTIAL),
processRect(_processRect) {}
- KisStrokeJobData* createLodClone(int levelOfDetail) {
+ KisStrokeJobData* createLodClone(int levelOfDetail) override {
return new Data(*this, levelOfDetail);
}
QRect processRect;
private:
Data(const Data &rhs, int levelOfDetail)
: KisStrokeJobData(rhs)
{
KisLodTransform t(levelOfDetail);
processRect = t.map(rhs.processRect);
}
};
class CancelSilentlyMarker : public KisStrokeJobData {
public:
CancelSilentlyMarker()
: KisStrokeJobData(SEQUENTIAL)
{}
- KisStrokeJobData* createLodClone(int /*levelOfDetail*/) {
+ KisStrokeJobData* createLodClone(int /*levelOfDetail*/) override {
return new CancelSilentlyMarker(*this);
}
};
public:
KisFilterStrokeStrategy(KisFilterSP filter,
KisFilterConfigurationSP filterConfig,
KisResourcesSnapshotSP resources);
KisFilterStrokeStrategy(const KisFilterStrokeStrategy &rhs, int levelOfDetail);
- ~KisFilterStrokeStrategy();
+ ~KisFilterStrokeStrategy() override;
- void initStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
- void cancelStrokeCallback();
- void finishStrokeCallback();
+ void initStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
+ void cancelStrokeCallback() override;
+ void finishStrokeCallback() override;
- KisStrokeStrategy* createLodClone(int levelOfDetail);
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
private:
struct Private;
Private* const m_d;
};
#endif /* __KIS_FILTER_STROKE_STRATEGY_H */
diff --git a/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h b/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h
index f8942d7c89..ab5540b5d1 100644
--- a/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h
+++ b/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h
@@ -1,110 +1,110 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PAINTER_BASED_STROKE_STRATEGY_H
#define __KIS_PAINTER_BASED_STROKE_STRATEGY_H
#include "kis_simple_stroke_strategy.h"
#include "kis_resources_snapshot.h"
#include "kis_selection.h"
class KisPainter;
class KisDistanceInformation;
class KisTransaction;
class KRITAUI_EXPORT KisPainterBasedStrokeStrategy : public KisSimpleStrokeStrategy
{
public:
/**
* The distance information should be associated with each
* painter individually, so we strore and manipulate with
* them together using the structure PainterInfo
*/
class KRITAUI_EXPORT PainterInfo {
public:
PainterInfo();
PainterInfo(const QPointF &lastPosition, int lastTime);
PainterInfo(PainterInfo *rhs, int levelOfDetail);
~PainterInfo();
KisPainter *painter;
KisDistanceInformation *dragDistance;
/**
* The distance inforametion of the associated LodN
* stroke. Returns zero if LodN stroke has already finished
* execution or does not exist.
*/
KisDistanceInformation* buddyDragDistance();
private:
PainterInfo *m_parentPainterInfo;
PainterInfo *m_childPainterInfo;
};
public:
KisPainterBasedStrokeStrategy(const QString &id,
const KUndo2MagicString &name,
KisResourcesSnapshotSP resources,
QVector<PainterInfo*> painterInfos,bool useMergeID = false);
KisPainterBasedStrokeStrategy(const QString &id,
const KUndo2MagicString &name,
KisResourcesSnapshotSP resources,
PainterInfo *painterInfo,bool useMergeID = false);
- void initStrokeCallback();
- void finishStrokeCallback();
- void cancelStrokeCallback();
+ void initStrokeCallback() override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
- void suspendStrokeCallback();
- void resumeStrokeCallback();
+ void suspendStrokeCallback() override;
+ void resumeStrokeCallback() override;
protected:
KisPaintDeviceSP targetDevice() const;
KisSelectionSP activeSelection() const;
const QVector<PainterInfo*> painterInfos() const;
void setUndoEnabled(bool value);
protected:
KisPainterBasedStrokeStrategy(const KisPainterBasedStrokeStrategy &rhs, int levelOfDetail);
private:
void init();
void initPainters(KisPaintDeviceSP targetDevice,
KisSelectionSP selection,
bool hasIndirectPainting,
const QString &indirectPaintingCompositeOp);
void deletePainters();
inline int timedID(const QString &id){
return int(qHash(id));
}
private:
KisResourcesSnapshotSP m_resources;
QVector<PainterInfo*> m_painterInfos;
KisTransaction *m_transaction;
KisPaintDeviceSP m_targetDevice;
KisSelectionSP m_activeSelection;
bool m_useMergeID;
};
#endif /* __KIS_PAINTER_BASED_STROKE_STRATEGY_H */
diff --git a/libs/ui/utils/kis_document_aware_spin_box_unit_manager.h b/libs/ui/utils/kis_document_aware_spin_box_unit_manager.h
index 1456ed692a..9add3a50a7 100644
--- a/libs/ui/utils/kis_document_aware_spin_box_unit_manager.h
+++ b/libs/ui/utils/kis_document_aware_spin_box_unit_manager.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2017 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISDOCUMENTAWARESPINBOXUNITMANAGER_H
#define KISDOCUMENTAWARESPINBOXUNITMANAGER_H
#include "kis_spin_box_unit_manager.h"
#include "kis_double_parse_unit_spin_box.h"
#include "kritaui_export.h"
class KisDocumentAwareSpinBoxUnitManagerBuilder : public KisSpinBoxUnitManagerBuilder
{
public:
- KisSpinBoxUnitManager* buildUnitManager(QObject* parent);
+ KisSpinBoxUnitManager* buildUnitManager(QObject* parent) override;
};
/*!
* \brief The KisDocumentAwareSpinBoxUnitManager class is a KisSpinBoxUnitManager that is able to connect to the current document to compute transformation for document relative units (the ones that depend of the resolution, or the size in pixels of the image).
* \see KisSpinBoxUnitManager
*/
class KRITAUI_EXPORT KisDocumentAwareSpinBoxUnitManager : public KisSpinBoxUnitManager
{
Q_OBJECT
public:
enum PixDir {
PIX_DIR_X,
PIX_DIR_Y
}; //in case the image has not the same x and y resolution, indicate on which direction get the resolution.
//! \brief configure a KisDocumentAwareSpinBoxUnitManager for the given spinbox (make the manager a child of the spinbox and attach it to the spinbox).
static void setDocumentAwarnessToExistingUnitSpinBox(KisDoubleParseUnitSpinBox* spinBox, bool setUnitFromOutsideToggle = false);
//! \brief create a unitSpinBox that is already document aware.
static KisDoubleParseUnitSpinBox* createUnitSpinBoxWithDocumentAwarness(QWidget* parent = 0);
KisDocumentAwareSpinBoxUnitManager(QObject *parent = 0, int pPixDir = PIX_DIR_X);
//! \reimp \see KisSpinBoxUnitManager
- virtual qreal getConversionFactor(int dim, QString symbol) const;
+ qreal getConversionFactor(int dim, QString symbol) const override;
//! \reimp \see KisSpinBoxUnitManager
- virtual qreal getConversionConstant(int dim, QString symbol) const;
+ qreal getConversionConstant(int dim, QString symbol) const override;
private:
PixDir pixDir;
};
#endif // KISDOCUMENTAWARESPINBOXUNITMANAGER_H
diff --git a/libs/ui/widgets/KisVisualColorSelector.h b/libs/ui/widgets/KisVisualColorSelector.h
index 1c4c881d3a..7f19849360 100644
--- a/libs/ui/widgets/KisVisualColorSelector.h
+++ b/libs/ui/widgets/KisVisualColorSelector.h
@@ -1,86 +1,86 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_VISUAL_COLOR_SELECTOR_H
#define KIS_VISUAL_COLOR_SELECTOR_H
#include <QWidget>
#include <QScopedPointer>
#include <QPixmap>
#include <QRegion>
#include <QMouseEvent>
#include <KoColor.h>
#include <KoColorSpace.h>
#include "KoColorDisplayRendererInterface.h"
#include "KisColorSelectorConfiguration.h"
#include "KisColorSelectorInterface.h"
#include "kritaui_export.h"
/**
* @brief The KisVisualColorSelector class
*
* This gives a color selector box that draws gradients and everything.
*
* Unlike other color selectors, this one draws the full gamut of the given
* colorspace.
*/
class KRITAUI_EXPORT KisVisualColorSelector : public KisColorSelectorInterface
{
Q_OBJECT
public:
explicit KisVisualColorSelector(QWidget *parent = 0);
- ~KisVisualColorSelector();
+ ~KisVisualColorSelector() override;
/**
* @brief setConfig
* @param forceCircular
* Force circular is for space where you only have room for a circular selector.
* @param forceSelfUpdate
* force self-update is for making it update itself when using a modal dialog.
*/
- void setConfig(bool forceCircular, bool forceSelfUpdate);
- KoColor getCurrentColor() const;
+ void setConfig(bool forceCircular, bool forceSelfUpdate) override;
+ KoColor getCurrentColor() const override;
public Q_SLOTS:
- void slotSetColor(const KoColor &c);
+ void slotSetColor(const KoColor &c) override;
void slotsetColorSpace(const KoColorSpace *cs);
void slotRebuildSelectors();
void configurationChanged();
- void setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer);
+ void setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer) override;
private Q_SLOTS:
void updateFromWidgets(KoColor c);
void HSXwrangler();
protected:
- void leaveEvent(QEvent *);
- void resizeEvent(QResizeEvent *);
+ void leaveEvent(QEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
void updateSelectorElements(QObject *source);
void drawGradients();
};
#endif
diff --git a/libs/ui/widgets/KisVisualColorSelectorShape.h b/libs/ui/widgets/KisVisualColorSelectorShape.h
index 1398428e63..f30a184e29 100644
--- a/libs/ui/widgets/KisVisualColorSelectorShape.h
+++ b/libs/ui/widgets/KisVisualColorSelectorShape.h
@@ -1,236 +1,236 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_VISUAL_COLOR_SELECTOR_SHAPE_H
#define KIS_VISUAL_COLOR_SELECTOR_SHAPE_H
#include <QWidget>
#include <QScopedPointer>
#include <QPixmap>
#include <QRegion>
#include <QMouseEvent>
#include <KoColor.h>
#include <KoColorSpace.h>
#include "KoColorDisplayRendererInterface.h"
#include "KisVisualColorSelector.h"
#include "KisColorSelectorConfiguration.h"
#include "kritaui_export.h"
/**
* @brief The KisVisualColorSelectorShape class
* A 2d widget can represent at maximum 2 coordinates.
* So first decide howmany coordinates you need. (onedimensional, or twodimensional)
* Then the model, (Channel, HSV, HSL, HSI, YUV). Channel is the raw color channels.
* When it finds a non-implemented feature it'll return to Channel.
* Then, select the channels you wish to be affected. This uses the model, so for cmyk
* the channel is c=0, m=1, y=2, k=3, but for hsv, hue=0, sat=1, and val=2
* These can also be set with 'slotsetactive channels'.
* Then finally, connect the displayrenderer, you can also do this with 'setdisplayrenderer'
*
* Either way, this class is made to be subclassed, with a few virtuals so that the geometry
* can be calculated properly.
*/
class KisVisualColorSelectorShape : public QWidget
{
Q_OBJECT
public:
/**
* @brief The Dimensions enum
* Wether or not the shape is single or two dimensional.
**/
enum Dimensions{onedimensional, twodimensional};
enum ColorModel{Channel, HSV, HSL, HSI, HSY, YUV};
explicit KisVisualColorSelectorShape(QWidget *parent,
KisVisualColorSelectorShape::Dimensions dimension,
KisVisualColorSelectorShape::ColorModel model,
const KoColorSpace *cs,
int channel1, int channel2,
const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
- ~KisVisualColorSelectorShape();
+ ~KisVisualColorSelectorShape() override;
/**
* @brief getCursorPosition
* @return current cursor position in shape-coordinates.
*/
QPointF getCursorPosition();
/**
* @brief getDimensions
* @return whether this is a single or twodimensional widget.
*/
Dimensions getDimensions();
/**
* @brief getColorModel
* @return the model of this widget.
*/
ColorModel getColorModel();
/**
* @brief getPixmap
* @return the pixmap of the gradient, for drawing on with a subclass.
* the pixmap will not change unless 'm_d->setPixmap=true' which is toggled by
* refresh and update functions.
*/
bool imagesNeedUpdate() const;
QImage getImageMap();
/**
* @brief setFullImage
* Set the full widget image to be painted.
* @param full this should be the full image.
*/
void setFullImage(QImage full);
/**
* @brief getCurrentColor
* @return the current kocolor
*/
KoColor getCurrentColor();
/**
* @brief setDisplayRenderer
* disconnect the old display renderer if needed and connect the new one.
* @param displayRenderer
*/
void setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer);
/**
* @brief getColorFromConverter
* @param c a koColor.
* @return get the qcolor from the given kocolorusing this widget's display renderer.
*/
QColor getColorFromConverter(KoColor c);
/**
* @brief getSpaceForSquare
* @param geom the full widget rectangle
* @return rectangle with enough space for second widget
*/
virtual QRect getSpaceForSquare(QRect geom) = 0;
virtual QRect getSpaceForCircle(QRect geom) = 0;
virtual QRect getSpaceForTriangle(QRect geom) = 0;
/**
* @brief forceImageUpdate
* force the image to recache.
*/
void forceImageUpdate();
/**
* @brief setBorderWidth
* set the border of the single dimensional selector.
* @param width
*/
virtual void setBorderWidth(int width) = 0;
/**
* @brief getChannels
* get used channels
* @return
*/
QVector <int> getChannels();
/**
* @brief setHSX
* This is for the cursor not to change when selecting
* black, white, and desaturated values. Will not change the non-native values.
* @param hsx the hsx value.
*/
void setHSX(QVector <qreal> hsx, bool wrangler=false);
/**
* @brief getHSX sets the sat and hue so they won't
* switch around much.
* @param hsx the hsx values.
* @return returns hsx, corrected.
*/
QVector <qreal> getHSX(QVector <qreal> hsx, bool wrangler= false);
Q_SIGNALS:
void sigNewColor(KoColor col);
void sigHSXchange();
public Q_SLOTS:
/**
* @brief setColor
* Set this widget's current color and change the cursor position.
* @param c
*/
void setColor(KoColor c);
/**
* @brief setColorFromSibling
* set this widget's current color, but don't change the cursor position,
* instead sent out a signal of the new color.
* @param c
*/
void setColorFromSibling(KoColor c);
/**
* @brief slotSetActiveChannels
* Change the active channels if necessary.
* @param channel1 used by single and twodimensional widgets.
* @param channel2 only used by twodimensional widgets.
*/
void slotSetActiveChannels(int channel1, int channel2);
/**
* @brief updateFromChangedDisplayRenderer
* for updating from the display renderer... not sure why this one is public.
*/
void updateFromChangedDisplayRenderer();
protected:
- void mousePressEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void paintEvent(QPaintEvent*);
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void paintEvent(QPaintEvent*) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
/**
* @brief convertShapeCoordinateToWidgetCoordinate
* @return take the position in the shape and convert it to screen coordinates.
*/
virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF) = 0;
/**
* @brief convertWidgetCoordinateToShapeCoordinate
* Convert a coordinate in the widget's height/width to a shape coordinate.
* @param coordinate the position your wish to have the shape coordinates of.
*/
virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate) = 0;
/**
* @brief updateCursor
* Update the cursor position.
*/
void updateCursor();
QPointF convertKoColorToShapeCoordinate(KoColor c);
KoColor convertShapeCoordinateToKoColor(QPointF coordinates, bool cursor = false);
/**
* @brief getPixmap
* @return the pixmap of this shape.
*/
virtual QRegion getMaskMap() = 0;
virtual void drawCursor() = 0;
QVector <float> convertvectorqrealTofloat(QVector<qreal> real);
QVector <qreal> convertvectorfloatToqreal(QVector <float> vloat);
};
#endif
diff --git a/libs/ui/widgets/KisVisualEllipticalSelectorShape.h b/libs/ui/widgets/KisVisualEllipticalSelectorShape.h
index 05ad55d9e0..ab8075dbae 100644
--- a/libs/ui/widgets/KisVisualEllipticalSelectorShape.h
+++ b/libs/ui/widgets/KisVisualEllipticalSelectorShape.h
@@ -1,75 +1,75 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISVISUALCOLORSELECTOR_H
#define KISVISUALCOLORSELECTOR_H
#include <QWidget>
#include <QScopedPointer>
#include <QPixmap>
#include <QRegion>
#include <QMouseEvent>
#include <KoColor.h>
#include <KoColorSpace.h>
#include "KoColorDisplayRendererInterface.h"
#include "KisColorSelectorConfiguration.h"
#include "KisVisualColorSelectorShape.h"
#include "kritaui_export.h"
class KisVisualEllipticalSelectorShape : public KisVisualColorSelectorShape
{
Q_OBJECT
public:
enum singelDTypes{border, borderMirrored};
explicit KisVisualEllipticalSelectorShape(QWidget *parent,
Dimensions dimension,
ColorModel model,
const KoColorSpace *cs,
int channel1, int channel2,
const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), int barWidth=20,
KisVisualEllipticalSelectorShape::singelDTypes d = KisVisualEllipticalSelectorShape::border
);
- ~KisVisualEllipticalSelectorShape();
+ ~KisVisualEllipticalSelectorShape() override;
- void setBorderWidth(int width);
+ void setBorderWidth(int width) override;
/**
* @brief getSpaceForSquare
* @param geom the full widget rectangle
* @return rectangle with enough space for second widget
*/
- virtual QRect getSpaceForSquare(QRect geom);
- virtual QRect getSpaceForCircle(QRect geom);
- virtual QRect getSpaceForTriangle(QRect geom);
+ QRect getSpaceForSquare(QRect geom) override;
+ QRect getSpaceForCircle(QRect geom) override;
+ QRect getSpaceForTriangle(QRect geom) override;
protected:
- void resizeEvent(QResizeEvent *);
+ void resizeEvent(QResizeEvent *) override;
private:
- virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate);
- virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate);
+ QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate) override;
+ QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate) override;
singelDTypes m_type;
int m_barWidth;
- virtual QRegion getMaskMap();
- virtual void drawCursor();
- QSize sizeHint() const;
+ QRegion getMaskMap() override;
+ void drawCursor() override;
+ QSize sizeHint() const override;
};
#endif // KISVISUALCOLORSELECTOR_H
diff --git a/libs/ui/widgets/KisVisualRectangleSelectorShape.h b/libs/ui/widgets/KisVisualRectangleSelectorShape.h
index ffc15b35f2..455a96ab11 100644
--- a/libs/ui/widgets/KisVisualRectangleSelectorShape.h
+++ b/libs/ui/widgets/KisVisualRectangleSelectorShape.h
@@ -1,73 +1,73 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_VISUAL_RECTANGLE_SELECTOR_SHAPE_H
#define KIS_VISUAL_RECTANGLE_SELECTOR_SHAPE_H
#include <QWidget>
#include <QScopedPointer>
#include <QPixmap>
#include <QRegion>
#include <QMouseEvent>
#include <KoColor.h>
#include <KoColorSpace.h>
#include "KoColorDisplayRendererInterface.h"
#include "KisColorSelectorConfiguration.h"
#include "KisVisualColorSelectorShape.h"
#include "kritaui_export.h"
class KisVisualRectangleSelectorShape : public KisVisualColorSelectorShape
{
Q_OBJECT
public:
enum singelDTypes{vertical, horizontal, border, borderMirrored};
explicit KisVisualRectangleSelectorShape(QWidget *parent,
Dimensions dimension,
ColorModel model,
const KoColorSpace *cs,
int channel1, int channel2,
const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), int width=20,
KisVisualRectangleSelectorShape::singelDTypes d = KisVisualRectangleSelectorShape::vertical
);
- ~KisVisualRectangleSelectorShape();
+ ~KisVisualRectangleSelectorShape() override;
- void setBorderWidth(int width);
+ void setBorderWidth(int width) override;
/**
* @brief getSpaceForSquare
* @param geom the full widget rectangle
* @return rectangle with enough space for second widget
*/
- virtual QRect getSpaceForSquare(QRect geom);
- virtual QRect getSpaceForCircle(QRect geom);
- virtual QRect getSpaceForTriangle(QRect geom);
+ QRect getSpaceForSquare(QRect geom) override;
+ QRect getSpaceForCircle(QRect geom) override;
+ QRect getSpaceForTriangle(QRect geom) override;
protected:
- void resizeEvent(QResizeEvent *);
+ void resizeEvent(QResizeEvent *) override;
private:
- virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate);
- virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate);
+ QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate) override;
+ QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate) override;
singelDTypes m_type;
int m_barWidth;
- virtual QRegion getMaskMap();
- virtual void drawCursor();
+ QRegion getMaskMap() override;
+ void drawCursor() override;
};
#endif
diff --git a/libs/ui/widgets/KisVisualTriangleSelectorShape.h b/libs/ui/widgets/KisVisualTriangleSelectorShape.h
index 81b35ac042..d5c12320e7 100644
--- a/libs/ui/widgets/KisVisualTriangleSelectorShape.h
+++ b/libs/ui/widgets/KisVisualTriangleSelectorShape.h
@@ -1,79 +1,79 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_VISUAL_TRIANGLE_SELECTOR_SHAPE_H
#define KIS_VISUAL_TRIANGLE_SELECTOR_SHAPE_H
#include <QWidget>
#include <QScopedPointer>
#include <QPixmap>
#include <QRegion>
#include <QMouseEvent>
#include <KoColor.h>
#include <KoColorSpace.h>
#include "KoColorDisplayRendererInterface.h"
#include "KisColorSelectorConfiguration.h"
#include "KisVisualColorSelectorShape.h"
#include "kritaui_export.h"
class KisVisualTriangleSelectorShape : public KisVisualColorSelectorShape
{
Q_OBJECT
public:
enum singelDTypes{border, borderMirrored};
explicit KisVisualTriangleSelectorShape(QWidget *parent,
Dimensions dimension,
ColorModel model,
const KoColorSpace *cs,
int channel1, int channel2,
const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(),
int barwidth=20
);
- ~KisVisualTriangleSelectorShape();
+ ~KisVisualTriangleSelectorShape() override;
- void setBorderWidth(int width);
+ void setBorderWidth(int width) override;
void setTriangle();
/**
* @brief getSpaceForSquare
* @param geom the full widget rectangle
* @return rectangle with enough space for second widget
*/
- virtual QRect getSpaceForSquare(QRect geom);
- virtual QRect getSpaceForCircle(QRect geom);
- virtual QRect getSpaceForTriangle(QRect geom);
+ QRect getSpaceForSquare(QRect geom) override;
+ QRect getSpaceForCircle(QRect geom) override;
+ QRect getSpaceForTriangle(QRect geom) override;
protected:
- void resizeEvent(QResizeEvent *);
+ void resizeEvent(QResizeEvent *) override;
private:
- virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate);
- virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate);
+ QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate) override;
+ QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate) override;
singelDTypes m_type;
int m_barWidth;
QPolygon m_triangle;
QPointF m_center;
qreal m_radius;
- virtual QRegion getMaskMap();
- virtual void drawCursor();
+ QRegion getMaskMap() override;
+ void drawCursor() override;
};
#endif
diff --git a/libs/ui/widgets/KoDualColorButton.h b/libs/ui/widgets/KoDualColorButton.h
index 998affad00..6c6e22067d 100644
--- a/libs/ui/widgets/KoDualColorButton.h
+++ b/libs/ui/widgets/KoDualColorButton.h
@@ -1,186 +1,186 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
2006 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KODUALCOLORBUTTON_H
#define KODUALCOLORBUTTON_H
#include <kritaui_export.h>
#include <KoColorDisplayRendererInterface.h>
#include <QWidget>
class KoColor;
class KoColorSpace;
/**
* @short A widget for selecting two related colors.
*
* KoDualColorButton allows the user to select two cascaded colors (usually a
* foreground and background color). Other features include drag and drop
* from other KDE color widgets, a reset to black and white control, and a
* swap colors control.
*
* When the user clicks on the foreground or background rectangle the
* rectangle is first sunken and the selectionChanged() signal is emitted.
* Further clicks will present a color dialog and emit either the foregroundColorChanged()
* or backgroundColorChanged() if a new color is selected.
*
* Note: With drag and drop when dropping a color the current selected color
* will be set, while when dragging a color it will use whatever color
* rectangle the mouse was pressed inside.
*
* @author Daniel M. Duley <mosfet@kde.org>
*/
class KRITAUI_EXPORT KoDualColorButton : public QWidget
{
Q_OBJECT
Q_ENUMS( Selection )
Q_PROPERTY( KoColor foregroundColor READ foregroundColor WRITE setForegroundColor )
Q_PROPERTY( KoColor backgroundColor READ backgroundColor WRITE setBackgroundColor )
Q_PROPERTY( bool popDialog READ popDialog WRITE setPopDialog )
public:
enum Selection {
Foreground,
Background
};
/**
* Constructs a new KoDualColorButton with the supplied foreground and
* background colors.
*
* @param parent The parent widget of the KoDualColorButton.
* @param dialogParent The parent widget of the color selection dialog.
*/
KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor,
QWidget *parent = 0, QWidget* dialogParent = 0 );
KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor,
const KoColorDisplayRendererInterface *displayRenderer,
QWidget *parent = 0, QWidget* dialogParent = 0 );
/**
* Destroys the KoDualColorButton.
*/
- ~KoDualColorButton();
+ ~KoDualColorButton() override;
/**
* Returns the current foreground color.
*/
KoColor foregroundColor() const;
/**
* Returns the current background color.
*/
KoColor backgroundColor() const;
/**
* Returns if a dialog with a color chooser will be popped up when clicking
* If false then you could/should connect to the pleasePopDialog signal
* and pop your own dialog. Just set the current color afterwards.
*/
bool popDialog() const;
/**
* Returns the minimum size needed to display the widget and all its
* controls.
*/
- virtual QSize sizeHint() const;
+ QSize sizeHint() const override;
public Q_SLOTS:
/**
* Sets the foreground color.
*/
void setForegroundColor( const KoColor &color );
/**
* Sets the background color.
*/
void setBackgroundColor( const KoColor &color );
void slotSetForeGroundColorFromDialog (const KoColor color);
void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
/**
* @brief setColorSpace
* set ColorSpace so we can lock the selector. Right now this'll be changed per view-change.
* @param cs
*/
void setColorSpace(const KoColorSpace *cs);
/**
* @brief getColorFromDisplayRenderer
* convenience function to get the right qcolor from the display renderer, including checking
* whether the display renderer actually exists.
* @param c the kocolor to convert.
* @return the qcolor to use for display.
*/
QColor getColorFromDisplayRenderer(KoColor c);
/**
* Sets if a dialog with a color chooser should be popped up when clicking
* If you set this to false then you could connect to the pleasePopDialog signal
* and pop your own dialog. Just set the current color afterwards.
*/
void setPopDialog( bool popDialog );
Q_SIGNALS:
/**
* Emitted when the foreground color is changed.
*/
void foregroundColorChanged( const KoColor &color );
/**
* Emitted when the background color is changed.
*/
void backgroundColorChanged( const KoColor &color );
/**
* Emitted when the user clicks one of the two color patches.
* You should/could pop you own color chooser dialog in response.
* Also see the popDialog attribute.
*/
void pleasePopDialog( const KoColor &color );
protected:
/**
* Sets the supplied rectangles to the proper size and position for the
* current widget size. You can reimplement this to change the layout
* of the widget. Restrictions are that the swap control will always
* be at the top right, the reset control will always be at the bottom
* left, and you must leave at least a 14x14 space in those corners.
*/
virtual void metrics( QRect &foregroundRect, QRect &backgroundRect );
- virtual void paintEvent( QPaintEvent *event );
- virtual void mousePressEvent( QMouseEvent *event );
- virtual void mouseMoveEvent( QMouseEvent *event );
- virtual void mouseReleaseEvent( QMouseEvent *event );
- virtual void dragEnterEvent( QDragEnterEvent *event );
- virtual void dropEvent( QDropEvent *event );
- virtual void changeEvent(QEvent *event);
+ void paintEvent( QPaintEvent *event ) override;
+ void mousePressEvent( QMouseEvent *event ) override;
+ void mouseMoveEvent( QMouseEvent *event ) override;
+ void mouseReleaseEvent( QMouseEvent *event ) override;
+ void dragEnterEvent( QDragEnterEvent *event ) override;
+ void dropEvent( QDropEvent *event ) override;
+ void changeEvent(QEvent *event) override;
private:
class Private;
Private *const d;
};
#endif
diff --git a/libs/ui/widgets/KoFillConfigWidget.cpp b/libs/ui/widgets/KoFillConfigWidget.cpp
index 358dff5efc..ce58458922 100644
--- a/libs/ui/widgets/KoFillConfigWidget.cpp
+++ b/libs/ui/widgets/KoFillConfigWidget.cpp
@@ -1,749 +1,804 @@
/* This file is part of the KDE project
* Made by Tomislav Lukman (tomislav.lukman@ck.tel.hr)
* Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoFillConfigWidget.h"
#include <QToolButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QButtonGroup>
#include <QLabel>
#include <QSizePolicy>
#include <QBitmap>
#include <QAction>
#include <QSharedPointer>
#include <klocalizedstring.h>
#include <KoIcon.h>
#include <KoColor.h>
#include <KoColorPopupAction.h>
#include "KoResourceServerProvider.h"
#include "KoResourceServerAdapter.h"
#include "KoResourceSelector.h"
#include <KoSelection.h>
#include <KoCanvasBase.h>
#include <KoCanvasResourceManager.h>
#include <KoDocumentResourceManager.h>
#include <KoShape.h>
#include <KoShapeController.h>
#include <KoShapeBackground.h>
#include <KoShapeBackgroundCommand.h>
#include <KoShapeStrokeCommand.h>
#include <KoShapeStroke.h>
#include <KoSelectedShapesProxy.h>
#include <KoColorBackground.h>
#include <KoGradientBackground.h>
#include <KoPatternBackground.h>
#include <KoImageCollection.h>
#include <KoResourcePopupAction.h>
#include "KoZoomHandler.h"
#include "KoColorPopupButton.h"
#include "ui_KoFillConfigWidget.h"
#include <kis_signals_blocker.h>
#include <kis_signal_compressor.h>
#include <kis_acyclic_signal_connector.h>
#include <kis_assert.h>
#include <KoCanvasResourceManager.h>
#include "kis_canvas_resource_provider.h"
#include <KoStopGradient.h>
#include <QInputDialog>
#include <KoShapeFillWrapper.h>
#include "kis_global.h"
#include "kis_debug.h"
static const char* const buttonnone[]={
"16 16 3 1",
"# c #000000",
"e c #ff0000",
"- c #ffffff",
"################",
"#--------------#",
"#-e----------e-#",
"#--e--------e--#",
"#---e------e---#",
"#----e----e----#",
"#-----e--e-----#",
"#------ee------#",
"#------ee------#",
"#-----e--e-----#",
"#----e----e----#",
"#---e------e---#",
"#--e--------e--#",
"#-e----------e-#",
"#--------------#",
"################"};
static const char* const buttonsolid[]={
"16 16 2 1",
"# c #000000",
". c #969696",
"################",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"#..............#",
"################"};
// FIXME: Smoother gradient button.
static const char* const buttongradient[]={
"16 16 15 1",
"# c #000000",
"n c #101010",
"m c #202020",
"l c #303030",
"k c #404040",
"j c #505050",
"i c #606060",
"h c #707070",
"g c #808080",
"f c #909090",
"e c #a0a0a0",
"d c #b0b0b0",
"c c #c0c0c0",
"b c #d0d0d0",
"a c #e0e0e0",
"################",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"#abcdefghijklmn#",
"################"};
static const char* const buttonpattern[]={
"16 16 4 1",
". c #0a0a0a",
"# c #333333",
"a c #a0a0a0",
"b c #ffffffff",
"################",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#bbbbbaaaabbbbb#",
"#bbbbbaaaabbbbb#",
"#bbbbbaaaabbbbb#",
"#bbbbbaaaabbbbb#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"#aaaaabbbbaaaaa#",
"################"};
class Q_DECL_HIDDEN KoFillConfigWidget::Private
{
public:
Private(KoFlake::FillVariant _fillVariant)
: canvas(0),
colorChangedCompressor(100, KisSignalCompressor::FIRST_ACTIVE),
gradientChangedCompressor(100, KisSignalCompressor::FIRST_ACTIVE),
fillVariant(_fillVariant),
noSelectionTrackingMode(false)
{
}
KoColorPopupAction *colorAction;
KoResourcePopupAction *gradientAction;
KoResourcePopupAction *patternAction;
QButtonGroup *group;
KoCanvasBase *canvas;
KisSignalCompressor colorChangedCompressor;
KisAcyclicSignalConnector shapeChangedAcyclicConnector;
KisAcyclicSignalConnector resourceManagerAcyclicConnector;
+ KoFillConfigWidget::StyleButton selectedFillIndex;
QSharedPointer<KoStopGradient> activeGradient;
KisSignalCompressor gradientChangedCompressor;
KoFlake::FillVariant fillVariant;
bool noSelectionTrackingMode;
Ui_KoFillConfigWidget *ui;
std::vector<KisAcyclicSignalConnector::Blocker> deactivationLocks;
};
KoFillConfigWidget::KoFillConfigWidget(KoCanvasBase *canvas, KoFlake::FillVariant fillVariant, QWidget *parent)
: QWidget(parent)
, d(new Private(fillVariant))
{
d->canvas = canvas;
d->shapeChangedAcyclicConnector.connectBackwardVoid(
d->canvas->selectedShapesProxy(), SIGNAL(selectionChanged()),
this, SLOT(shapeChanged()));
d->shapeChangedAcyclicConnector.connectBackwardVoid(
d->canvas->selectedShapesProxy(), SIGNAL(selectionContentChanged()),
this, SLOT(shapeChanged()));
d->resourceManagerAcyclicConnector.connectBackwardResourcePair(
d->canvas->resourceManager(), SIGNAL(canvasResourceChanged(int,QVariant)),
this, SLOT(slotCanvasResourceChanged(int,QVariant)));
d->resourceManagerAcyclicConnector.connectForwardVoid(
this, SIGNAL(sigInternalRequestColorToResourceManager()),
this, SLOT(slotProposeCurrentColorToResourceManager()));
// confure GUI
d->ui = new Ui_KoFillConfigWidget();
d->ui->setupUi(this);
d->group = new QButtonGroup(this);
d->group->setExclusive(true);
d->ui->btnNoFill->setIcon(QPixmap((const char **) buttonnone));
d->group->addButton(d->ui->btnNoFill, None);
d->ui->btnSolidFill->setIcon(QPixmap((const char **) buttonsolid));
d->group->addButton(d->ui->btnSolidFill, Solid);
d->ui->btnGradientFill->setIcon(QPixmap((const char **) buttongradient));
d->group->addButton(d->ui->btnGradientFill, Gradient);
d->ui->btnPatternFill->setIcon(QPixmap((const char **) buttonpattern));
d->group->addButton(d->ui->btnPatternFill, Pattern);
d->colorAction = new KoColorPopupAction(d->ui->btnChooseSolidColor);
d->colorAction->setToolTip(i18n("Change the filling color"));
d->colorAction->setCurrentColor(Qt::white);
d->ui->btnChooseSolidColor->setDefaultAction(d->colorAction);
d->ui->btnChooseSolidColor->setPopupMode(QToolButton::InstantPopup);
d->ui->btnSolidColorPick->setIcon(KisIconUtils::loadIcon("krita_tool_color_picker"));
// TODO: for now the color picking button is disabled!
d->ui->btnSolidColorPick->setEnabled(false);
connect(d->colorAction, SIGNAL(colorChanged(const KoColor &)), &d->colorChangedCompressor, SLOT(start()));
connect(&d->colorChangedCompressor, SIGNAL(timeout()), SLOT(colorChanged()));
connect(d->ui->btnChooseSolidColor, SIGNAL(iconSizeChanged()), d->colorAction, SLOT(updateIcon()));
connect(d->group, SIGNAL(buttonClicked(int)), SLOT(styleButtonPressed(int)));
- connect(d->ui->stackWidget, SIGNAL(currentChanged(int)), SLOT(slotUpdateFillTitle()));
+
+ connect(d->group, SIGNAL(buttonClicked(int)), SLOT(slotUpdateFillTitle()));
+
slotUpdateFillTitle();
styleButtonPressed(d->group->checkedId());
+
// Gradient selector
d->ui->wdgGradientEditor->setCompactMode(true);
connect(d->ui->wdgGradientEditor, SIGNAL(sigGradientChanged()), &d->gradientChangedCompressor, SLOT(start()));
connect(&d->gradientChangedCompressor, SIGNAL(timeout()), SLOT(activeGradientChanged()));
KoResourceServerProvider *serverProvider = KoResourceServerProvider::instance();
QSharedPointer<KoAbstractResourceServerAdapter> gradientResourceAdapter(
new KoResourceServerAdapter<KoAbstractGradient>(serverProvider->gradientServer()));
d->gradientAction = new KoResourcePopupAction(gradientResourceAdapter,
d->ui->btnChoosePredefinedGradient);
d->gradientAction->setToolTip(i18n("Change filling gradient"));
d->ui->btnChoosePredefinedGradient->setDefaultAction(d->gradientAction);
d->ui->btnChoosePredefinedGradient->setPopupMode(QToolButton::InstantPopup);
connect(d->gradientAction, SIGNAL(resourceSelected(QSharedPointer<KoShapeBackground> )),
SLOT(gradientResourceChanged()));
connect(d->ui->btnChoosePredefinedGradient, SIGNAL(iconSizeChanged()), d->gradientAction, SLOT(updateIcon()));
d->ui->btnSaveGradient->setIcon(KisIconUtils::loadIcon("document-save"));
connect(d->ui->btnSaveGradient, SIGNAL(clicked()), SLOT(slotSavePredefinedGradientClicked()));
connect(d->ui->cmbGradientRepeat, SIGNAL(currentIndexChanged(int)), SLOT(slotGradientRepeatChanged()));
connect(d->ui->cmbGradientType, SIGNAL(currentIndexChanged(int)), SLOT(slotGradientTypeChanged()));
deactivate();
#if 0
// Pattern selector
QSharedPointer<KoAbstractResourceServerAdapter>patternResourceAdapter(new KoResourceServerAdapter<KoPattern>(serverProvider->patternServer()));
d->patternAction = new KoResourcePopupAction(patternResourceAdapter, d->colorButton);
d->patternAction->setToolTip(i18n("Change the filling pattern"));
connect(d->patternAction, SIGNAL(resourceSelected(QSharedPointer<KoShapeBackground> )), this, SLOT(patternChanged(QSharedPointer<KoShapeBackground> )));
connect(d->colorButton, SIGNAL(iconSizeChanged()), d->patternAction, SLOT(updateIcon()));
#endif
}
KoFillConfigWidget::~KoFillConfigWidget()
{
delete d;
}
void KoFillConfigWidget::activate()
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!d->deactivationLocks.empty());
d->deactivationLocks.clear();
if (!d->noSelectionTrackingMode) {
shapeChanged();
} else {
loadCurrentFillFromResourceServer();
}
}
void KoFillConfigWidget::deactivate()
{
KIS_SAFE_ASSERT_RECOVER_RETURN(d->deactivationLocks.empty());
d->deactivationLocks.push_back(KisAcyclicSignalConnector::Blocker(d->shapeChangedAcyclicConnector));
d->deactivationLocks.push_back(KisAcyclicSignalConnector::Blocker(d->resourceManagerAcyclicConnector));
}
-
void KoFillConfigWidget::setNoSelectionTrackingMode(bool value)
{
d->noSelectionTrackingMode = value;
if (!d->noSelectionTrackingMode) {
shapeChanged();
}
}
void KoFillConfigWidget::slotUpdateFillTitle()
{
QString text = d->group->checkedButton() ? d->group->checkedButton()->text() : QString();
text.replace('&', QString());
d->ui->lblFillTitle->setText(text);
}
void KoFillConfigWidget::slotCanvasResourceChanged(int key, const QVariant &value)
{
if ((key == KoCanvasResourceManager::ForegroundColor && d->fillVariant == KoFlake::Fill) ||
(key == KoCanvasResourceManager::BackgroundColor &&
d->fillVariant == KoFlake::StrokeFill && !d->noSelectionTrackingMode) ||
(key == KoCanvasResourceManager::ForegroundColor && d->noSelectionTrackingMode)) {
KoColor color = value.value<KoColor>();
const int checkedId = d->group->checkedId();
if ((checkedId < 0 || checkedId == None || checkedId == Solid) &&
!(checkedId == Solid && d->colorAction->currentKoColor() == color)) {
d->group->button(Solid)->setChecked(true);
- d->ui->stackWidget->setCurrentIndex(Solid);
+ d->selectedFillIndex = Solid;
+
d->colorAction->setCurrentColor(color);
d->colorChangedCompressor.start();
} else if (checkedId == Gradient && key == KoCanvasResourceManager::ForegroundColor) {
d->ui->wdgGradientEditor->notifyGlobalColorChanged(color);
}
} else if (key == KisCanvasResourceProvider::CurrentGradient) {
KoResource *gradient = value.value<KoAbstractGradient*>();
const int checkedId = d->group->checkedId();
if (gradient && (checkedId < 0 || checkedId == None || checkedId == Gradient)) {
d->group->button(Gradient)->setChecked(true);
d->gradientAction->setCurrentResource(gradient);
}
}
}
QList<KoShape*> KoFillConfigWidget::currentShapes()
{
return d->canvas->selectedShapesProxy()->selection()->selectedEditableShapes();
}
+int KoFillConfigWidget::selectedFillIndex() {
+ return d->selectedFillIndex;
+}
+
void KoFillConfigWidget::styleButtonPressed(int buttonId)
{
switch (buttonId) {
case KoFillConfigWidget::None:
noColorSelected();
break;
case KoFillConfigWidget::Solid:
colorChanged();
break;
case KoFillConfigWidget::Gradient:
if (d->activeGradient) {
activeGradientChanged();
} else {
gradientResourceChanged();
}
break;
case KoFillConfigWidget::Pattern:
// Only select mode in the widget, don't set actual pattern :/
//d->colorButton->setDefaultAction(d->patternAction);
//patternChanged(d->patternAction->currentBackground());
break;
}
if (buttonId >= None && buttonId <= Pattern) {
- d->ui->stackWidget->setCurrentIndex(buttonId);
+ d->selectedFillIndex = static_cast<KoFillConfigWidget::StyleButton>(buttonId);
}
}
KoShapeStrokeSP KoFillConfigWidget::createShapeStroke()
{
KoShapeStrokeSP stroke(new KoShapeStroke());
KIS_ASSERT_RECOVER_RETURN_VALUE(d->fillVariant == KoFlake::StrokeFill, stroke);
switch (d->group->checkedId()) {
case KoFillConfigWidget::None:
stroke->setColor(Qt::transparent);
break;
case KoFillConfigWidget::Solid:
stroke->setColor(d->colorAction->currentColor());
break;
case KoFillConfigWidget::Gradient: {
QScopedPointer<QGradient> g(d->activeGradient->toQGradient());
QBrush newBrush = *g;
stroke->setLineBrush(newBrush);
stroke->setColor(Qt::transparent);
break;
}
case KoFillConfigWidget::Pattern:
break;
}
return stroke;
}
void KoFillConfigWidget::noColorSelected()
{
KisAcyclicSignalConnector::Blocker b(d->shapeChangedAcyclicConnector);
QList<KoShape*> selectedShapes = currentShapes();
if (selectedShapes.isEmpty()) {
emit sigFillChanged();
return;
}
KoShapeFillWrapper wrapper(selectedShapes, d->fillVariant);
KUndo2Command *command = wrapper.setColor(QColor());
if (command) {
d->canvas->addCommand(command);
}
emit sigFillChanged();
}
void KoFillConfigWidget::colorChanged()
{
KisAcyclicSignalConnector::Blocker b(d->shapeChangedAcyclicConnector);
QList<KoShape*> selectedShapes = currentShapes();
if (selectedShapes.isEmpty()) {
emit sigInternalRequestColorToResourceManager();
emit sigFillChanged();
return;
}
KoShapeFillWrapper wrapper(selectedShapes, d->fillVariant);
KUndo2Command *command = wrapper.setColor(d->colorAction->currentColor());
if (command) {
d->canvas->addCommand(command);
}
emit sigInternalRequestColorToResourceManager();
emit sigFillChanged();
}
void KoFillConfigWidget::slotProposeCurrentColorToResourceManager()
{
const int checkedId = d->group->checkedId();
bool hasColor = false;
KoColor color;
KoCanvasResourceManager::CanvasResource colorSlot = KoCanvasResourceManager::ForegroundColor;
if (checkedId == Solid) {
if (d->fillVariant == KoFlake::StrokeFill) {
colorSlot = KoCanvasResourceManager::BackgroundColor;
}
color = d->colorAction->currentKoColor();
hasColor = true;
} else if (checkedId == Gradient) {
if (boost::optional<KoColor> gradientColor = d->ui->wdgGradientEditor->currentActiveStopColor()) {
color = *gradientColor;
hasColor = true;
}
}
if (hasColor) {
d->canvas->resourceManager()->setResource(colorSlot, QVariant::fromValue(color));
}
}
template <class ResourceServer>
QString findFirstAvailableResourceName(const QString &baseName, ResourceServer *server)
{
if (!server->resourceByName(baseName)) return baseName;
int counter = 1;
QString result;
while ((result = QString("%1%2").arg(baseName).arg(counter)),
server->resourceByName(result)) {
counter++;
}
return result;
}
void KoFillConfigWidget::slotSavePredefinedGradientClicked()
{
KoResourceServerProvider *serverProvider = KoResourceServerProvider::instance();
auto server = serverProvider->gradientServer();
const QString defaultGradientNamePrefix = i18nc("default prefix for the saved gradient", "gradient");
QString name = d->activeGradient->name().isEmpty() ? defaultGradientNamePrefix : d->activeGradient->name();
name = findFirstAvailableResourceName(name, server);
name = QInputDialog::getText(this, i18nc("@title:window", "Save Gradient"), i18n("Enter gradient name:"), QLineEdit::Normal, name);
// TODO: currently we do not allow the user to
// create two resources with the same name!
// Please add some feedback for it!
name = findFirstAvailableResourceName(name, server);
d->activeGradient->setName(name);
const QString saveLocation = server->saveLocation();
d->activeGradient->setFilename(saveLocation + d->activeGradient->name() + d->activeGradient->defaultFileExtension());
KoAbstractGradient *newGradient = d->activeGradient->clone();
server->addResource(newGradient);
d->gradientAction->setCurrentResource(newGradient);
}
void KoFillConfigWidget::activeGradientChanged()
{
setNewGradientBackgroundToShape();
updateGradientSaveButtonAvailability();
emit sigInternalRequestColorToResourceManager();
}
void KoFillConfigWidget::gradientResourceChanged()
{
QSharedPointer<KoGradientBackground> bg =
qSharedPointerDynamicCast<KoGradientBackground>(
d->gradientAction->currentBackground());
uploadNewGradientBackground(bg->gradient());
setNewGradientBackgroundToShape();
updateGradientSaveButtonAvailability();
}
void KoFillConfigWidget::slotGradientTypeChanged()
{
QGradient::Type type =
d->ui->cmbGradientType->currentIndex() == 0 ?
QGradient::LinearGradient : QGradient::RadialGradient;
d->activeGradient->setType(type);
activeGradientChanged();
}
void KoFillConfigWidget::slotGradientRepeatChanged()
{
QGradient::Spread spread =
QGradient::Spread(d->ui->cmbGradientRepeat->currentIndex());
d->activeGradient->setSpread(spread);
activeGradientChanged();
}
void KoFillConfigWidget::uploadNewGradientBackground(const QGradient *gradient)
{
KisSignalsBlocker b1(d->ui->wdgGradientEditor,
d->ui->cmbGradientType,
d->ui->cmbGradientRepeat);
d->ui->wdgGradientEditor->setGradient(0);
d->activeGradient.reset(KoStopGradient::fromQGradient(gradient));
d->ui->wdgGradientEditor->setGradient(d->activeGradient.data());
d->ui->cmbGradientType->setCurrentIndex(d->activeGradient->type() != QGradient::LinearGradient);
d->ui->cmbGradientRepeat->setCurrentIndex(int(d->activeGradient->spread()));
}
void KoFillConfigWidget::setNewGradientBackgroundToShape()
{
QList<KoShape*> selectedShapes = currentShapes();
if (selectedShapes.isEmpty()) {
emit sigFillChanged();
return;
}
KisAcyclicSignalConnector::Blocker b(d->shapeChangedAcyclicConnector);
KoShapeFillWrapper wrapper(selectedShapes, d->fillVariant);
QScopedPointer<QGradient> srcQGradient(d->activeGradient->toQGradient());
KUndo2Command *command = wrapper.applyGradientStopsOnly(srcQGradient.data());
if (command) {
d->canvas->addCommand(command);
}
emit sigFillChanged();
}
void KoFillConfigWidget::updateGradientSaveButtonAvailability()
{
bool savingEnabled = false;
QScopedPointer<QGradient> currentGradient(d->activeGradient->toQGradient());
QSharedPointer<KoShapeBackground> bg = d->gradientAction->currentBackground();
if (bg) {
QSharedPointer<KoGradientBackground> resourceBackground =
qSharedPointerDynamicCast<KoGradientBackground>(bg);
savingEnabled = resourceBackground->gradient()->stops() != currentGradient->stops();
savingEnabled |= resourceBackground->gradient()->type() != currentGradient->type();
savingEnabled |= resourceBackground->gradient()->spread() != currentGradient->spread();
}
d->ui->btnSaveGradient->setEnabled(savingEnabled);
}
void KoFillConfigWidget::patternChanged(QSharedPointer<KoShapeBackground> background)
{
Q_UNUSED(background);
#if 0
QSharedPointer<KoPatternBackground> patternBackground = qSharedPointerDynamicCast<KoPatternBackground>(background);
if (! patternBackground) {
return;
}
QList<KoShape*> selectedShapes = currentShapes();
if (selectedShapes.isEmpty()) {
return;
}
KoImageCollection *imageCollection = d->canvas->shapeController()->resourceManager()->imageCollection();
if (imageCollection) {
QSharedPointer<KoPatternBackground> fill(new KoPatternBackground(imageCollection));
fill->setPattern(patternBackground->pattern());
d->canvas->addCommand(new KoShapeBackgroundCommand(selectedShapes, fill));
}
#endif
}
void KoFillConfigWidget::loadCurrentFillFromResourceServer()
{
{
KoColor color = d->canvas->resourceManager()->backgroundColor();
slotCanvasResourceChanged(KoCanvasResourceManager::BackgroundColor, QVariant::fromValue(color));
}
{
KoColor color = d->canvas->resourceManager()->foregroundColor();
slotCanvasResourceChanged(KoCanvasResourceManager::ForegroundColor, QVariant::fromValue(color));
}
Q_FOREACH (QAbstractButton *button, d->group->buttons()) {
button->setEnabled(true);
}
emit sigFillChanged();
}
void KoFillConfigWidget::shapeChanged()
{
QList<KoShape*> shapes = currentShapes();
if (shapes.isEmpty() ||
(shapes.size() > 1 && KoShapeFillWrapper(shapes, d->fillVariant).isMixedFill())) {
Q_FOREACH (QAbstractButton *button, d->group->buttons()) {
button->setEnabled(!shapes.isEmpty());
}
d->group->button(None)->setChecked(true);
- d->ui->stackWidget->setCurrentIndex(None);
+ d->selectedFillIndex = None;
} else {
Q_FOREACH (QAbstractButton *button, d->group->buttons()) {
button->setEnabled(true);
}
KoShape *shape = shapes.first();
updateWidget(shape);
}
}
void KoFillConfigWidget::updateWidget(KoShape *shape)
{
KIS_SAFE_ASSERT_RECOVER_RETURN(shape);
StyleButton newActiveButton = None;
KoShapeFillWrapper wrapper(shape, d->fillVariant);
switch (wrapper.type()) {
case KoFlake::None:
break;
case KoFlake::Solid: {
QColor color = wrapper.color();
if (color.alpha() > 0) {
newActiveButton = KoFillConfigWidget::Solid;
d->colorAction->setCurrentColor(wrapper.color());
}
break;
}
case KoFlake::Gradient:
newActiveButton = KoFillConfigWidget::Gradient;
uploadNewGradientBackground(wrapper.gradient());
updateGradientSaveButtonAvailability();
break;
case KoFlake::Pattern:
newActiveButton = KoFillConfigWidget::Pattern;
break;
}
d->group->button(newActiveButton)->setChecked(true);
- d->ui->stackWidget->setCurrentIndex(newActiveButton);
+
+ d->selectedFillIndex = newActiveButton;
+ updateWidgetComponentVisbility();
+}
+
+
+void KoFillConfigWidget::updateWidgetComponentVisbility()
+{
+ // The UI is showing/hiding things like this because the 'stacked widget' isn't very flexible
+ // and makes it difficult to put anything underneath it without a lot empty space
+
+ // hide everything first
+ d->ui->wdgGradientEditor->setVisible(false);
+ d->ui->btnChoosePredefinedGradient->setVisible(false);
+ d->ui->btnChooseSolidColor->setVisible(false);
+ d->ui->typeLabel->setVisible(false);
+ d->ui->repeatLabel->setVisible(false);
+ d->ui->cmbGradientRepeat->setVisible(false);
+ d->ui->cmbGradientType->setVisible(false);
+ d->ui->btnSolidColorPick->setVisible(false);
+ d->ui->btnSaveGradient->setVisible(false);
+ d->ui->gradientTypeLine->setVisible(false);
+ d->ui->soldStrokeColorLabel->setVisible(false);
+ d->ui->presetLabel->setVisible(false);
+
+ switch (d->selectedFillIndex) {
+ case KoFillConfigWidget::None:
+ break;
+ case KoFillConfigWidget::Solid:
+ d->ui->btnChooseSolidColor->setVisible(true);
+ d->ui->btnSolidColorPick->setVisible(true);
+ d->ui->soldStrokeColorLabel->setVisible(true);
+ break;
+ case KoFillConfigWidget::Gradient:
+ d->ui->wdgGradientEditor->setVisible(true);
+ d->ui->btnChoosePredefinedGradient->setVisible(true);
+ d->ui->typeLabel->setVisible(true);
+ d->ui->repeatLabel->setVisible(true);
+ d->ui->cmbGradientRepeat->setVisible(true);
+ d->ui->cmbGradientType->setVisible(true);
+ d->ui->btnSaveGradient->setVisible(true);
+ d->ui->gradientTypeLine->setVisible(true);
+ d->ui->presetLabel->setVisible(true);
+ break;
+ case KoFillConfigWidget::Pattern:
+ break;
+ }
+
}
diff --git a/libs/ui/widgets/KoFillConfigWidget.h b/libs/ui/widgets/KoFillConfigWidget.h
index 53306e9c40..e2f2e3888b 100644
--- a/libs/ui/widgets/KoFillConfigWidget.h
+++ b/libs/ui/widgets/KoFillConfigWidget.h
@@ -1,106 +1,111 @@
/* This file is part of the KDE project
* Made by Tomislav Lukman (tomislav.lukman@ck.tel.hr)
* Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILLCONFIGWIDGET_H
#define FILLCONFIGWIDGET_H
#include "kritaui_export.h"
#include <QWidget>
#include <QSharedPointer>
#include <KoFlake.h>
#include <KoFlakeTypes.h>
class KoCanvasBase;
class KoShapeBackground;
class KoShape;
/// A widget for configuring the fill of a shape
class KRITAUI_EXPORT KoFillConfigWidget : public QWidget
{
Q_OBJECT
enum StyleButton {
None = 0,
Solid,
Gradient,
Pattern
};
public:
explicit KoFillConfigWidget(KoCanvasBase *canvas, KoFlake::FillVariant fillVariant, QWidget *parent);
- ~KoFillConfigWidget();
+ ~KoFillConfigWidget() override;
void setNoSelectionTrackingMode(bool value);
/// Returns the list of the selected shape
/// If you need to use only one shape, call currentShape()
QList<KoShape*> currentShapes();
+ /// returns the selected index of the fill type
+ int selectedFillIndex();
+
KoShapeStrokeSP createShapeStroke();
void activate();
void deactivate();
private Q_SLOTS:
void styleButtonPressed(int buttonId);
void noColorSelected();
/// apply color changes to the selected shape
void colorChanged();
/// the pattern of the fill changed, apply the changes
void patternChanged(QSharedPointer<KoShapeBackground> background);
void shapeChanged();
void slotUpdateFillTitle();
void slotCanvasResourceChanged(int key, const QVariant &value);
void slotSavePredefinedGradientClicked();
void activeGradientChanged();
void gradientResourceChanged();
void slotGradientTypeChanged();
void slotGradientRepeatChanged();
void slotProposeCurrentColorToResourceManager();
Q_SIGNALS:
void sigFillChanged();
void sigInternalRequestColorToResourceManager();
private:
/// update the widget with the KoShape background
void updateWidget(KoShape *shape);
void uploadNewGradientBackground(const QGradient *gradient);
void setNewGradientBackgroundToShape();
void updateGradientSaveButtonAvailability();
void loadCurrentFillFromResourceServer();
+ void updateWidgetComponentVisbility();
+
class Private;
Private * const d;
};
#endif // FILLCONFIGWIDGET_H
diff --git a/libs/ui/widgets/KoFillConfigWidget.ui b/libs/ui/widgets/KoFillConfigWidget.ui
index 33a4b32d50..60c0e838ff 100644
--- a/libs/ui/widgets/KoFillConfigWidget.ui
+++ b/libs/ui/widgets/KoFillConfigWidget.ui
@@ -1,372 +1,371 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KoFillConfigWidget</class>
<widget class="QWidget" name="KoFillConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>779</width>
- <height>697</height>
+ <width>314</width>
+ <height>251</height>
</rect>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="fillConfigTypeLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="btnNoFill">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>No fill</string>
</property>
<property name="text">
<string>None</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnSolidFill">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Solid color fill</string>
</property>
<property name="text">
<string>Solid</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnGradientFill">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Gradient fill</string>
</property>
<property name="text">
<string>Gradient</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnPatternFill">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Pattern fill</string>
</property>
<property name="text">
<string>Pattern</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lblFillTitle">
<property name="text">
<string notr="true">TypeText</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
- <widget class="QStackedWidget" name="stackWidget">
- <property name="currentIndex">
- <number>2</number>
- </property>
- <widget class="QWidget" name="pageNone"/>
- <widget class="QWidget" name="pageSolid">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="KoColorPopupButton" name="btnChooseSolidColor">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="btnSolidColorPick">
- <property name="text">
- <string>...</string>
- </property>
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="pageGradient">
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QHBoxLayout" name="solidFillLayout">
+ <item>
+ <widget class="QLabel" name="soldStrokeColorLabel">
+ <property name="text">
+ <string>Color:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KoColorPopupButton" name="btnChooseSolidColor">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ <property name="arrowType">
+ <enum>Qt::NoArrow</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="btnSolidColorPick">
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="gradientLayout1">
+ <item row="0" column="0">
+ <widget class="QLabel" name="typeLabel">
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="cmbGradientType">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
<item>
- <widget class="KisStopGradientEditor" name="wdgGradientEditor" native="true"/>
+ <property name="text">
+ <string>Linear</string>
+ </property>
</item>
<item>
- <widget class="Line" name="line">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
+ <property name="text">
+ <string>Radial</string>
+ </property>
</item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="repeatLabel">
+ <property name="text">
+ <string>Repeat:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="cmbGradientRepeat">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
<item>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Type:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="cmbGradientType">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>Linear</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Radial</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Repeat:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="cmbGradientRepeat">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>None</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Repeat</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Reflect</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
+ <property name="text">
+ <string>None</string>
+ </property>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="KoColorPopupButton" name="btnChoosePredefinedGradient">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="btnSaveGradient">
- <property name="text">
- <string>...</string>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <property name="autoRaise">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
+ <property name="text">
+ <string>Repeat</string>
+ </property>
</item>
<item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>1</height>
- </size>
- </property>
- </spacer>
+ <property name="text">
+ <string>Reflect</string>
+ </property>
</item>
- </layout>
- </widget>
- <widget class="QWidget" name="pagePattern"/>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="gradientLayout2">
+ <item>
+ <widget class="QLabel" name="presetLabel">
+ <property name="text">
+ <string>Preset:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KoColorPopupButton" name="btnChoosePredefinedGradient">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>40</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ <property name="arrowType">
+ <enum>Qt::NoArrow</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="btnSaveGradient">
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="gradientTypeLine">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
</widget>
</item>
<item>
- <spacer name="verticalSpacer_2">
+ <layout class="QVBoxLayout" name="lastLayout">
+ <item>
+ <widget class="KisStopGradientEditor" name="wdgGradientEditor" native="true"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="bottomSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>13</height>
+ <height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KoColorPopupButton</class>
<extends>QToolButton</extends>
<header>KoColorPopupButton.h</header>
</customwidget>
<customwidget>
<class>KisStopGradientEditor</class>
<extends>QWidget</extends>
<header>kis_stopgradient_editor.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/libs/ui/widgets/KoStrokeConfigWidget.cpp b/libs/ui/widgets/KoStrokeConfigWidget.cpp
index 6c7d6dfc04..f5b90c02b5 100644
--- a/libs/ui/widgets/KoStrokeConfigWidget.cpp
+++ b/libs/ui/widgets/KoStrokeConfigWidget.cpp
@@ -1,777 +1,800 @@
/* This file is part of the KDE project
* Made by Tomislav Lukman (tomislav.lukman@ck.tel.hr)
* Copyright (C) 2002 Tomislav Lukman <tomislav.lukman@ck.t-com.hr>
* Copyright (C) 2002-2003 Rob Buis <buis@kde.org>
* Copyright (C) 2005-2006 Tim Beaulen <tbscope@gmail.com>
* Copyright (C) 2005-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2005-2006, 2011 Inge Wallin <inge@lysator.liu.se>
* Copyright (C) 2005-2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2006 Peter Simonsson <psn@linux.se>
* Copyright (C) 2006 Laurent Montel <montel@kde.org>
* Copyright (C) 2007,2011 Thorsten Zachmann <t.zachmann@zagge.de>
* Copyright (C) 2011 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// Own
#include "KoStrokeConfigWidget.h"
// Qt
#include <QMenu>
-#include <QLabel>
#include <QToolButton>
#include <QButtonGroup>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QSizePolicy>
#include <QSignalMapper>
// KDE
#include <klocalizedstring.h>
// Calligra
#include <KoIcon.h>
#include <KoUnit.h>
#include <KoLineStyleSelector.h>
#include <KoUnitDoubleSpinBox.h>
#include <KoMarkerSelector.h>
#include <KoColorPopupAction.h>
#include <KoMarker.h>
#include <KoShapeStroke.h>
#include <KoPathShape.h>
#include <KoMarkerCollection.h>
#include <KoPathShapeMarkerCommand.h>
#include <KoCanvasBase.h>
#include <KoCanvasController.h>
#include <KoCanvasResourceManager.h>
#include <KoDocumentResourceManager.h>
#include <KoSelection.h>
#include <KoShapeController.h>
#include <KoShapeStrokeCommand.h>
#include <KoShapeStrokeModel.h>
#include <KoSelectedShapesProxy.h>
-#include <KoFillConfigWidget.h>
+#include "ui_KoStrokeConfigWidget.h"
#include <KoFlakeUtils.h>
#include <KoCanvasBase.h>
-
+#include <KoFillConfigWidget.h>
#include "kis_canvas_resource_provider.h"
#include "kis_acyclic_signal_connector.h"
// Krita
#include "kis_double_parse_unit_spin_box.h"
class CapNJoinMenu : public QMenu
{
public:
CapNJoinMenu(QWidget *parent = 0);
QSize sizeHint() const override;
KisDoubleParseUnitSpinBox *miterLimit;
QButtonGroup *capGroup;
QButtonGroup *joinGroup;
};
CapNJoinMenu::CapNJoinMenu(QWidget *parent)
: QMenu(parent)
{
QGridLayout *mainLayout = new QGridLayout();
mainLayout->setMargin(2);
// The cap group
capGroup = new QButtonGroup(this);
capGroup->setExclusive(true);
QToolButton *button = 0;
button = new QToolButton(this);
button->setIcon(koIcon("stroke-cap-butt"));
button->setCheckable(true);
button->setToolTip(i18n("Butt cap"));
capGroup->addButton(button, Qt::FlatCap);
mainLayout->addWidget(button, 2, 0);
button = new QToolButton(this);
button->setIcon(koIcon("stroke-cap-round"));
button->setCheckable(true);
button->setToolTip(i18n("Round cap"));
capGroup->addButton(button, Qt::RoundCap);
mainLayout->addWidget(button, 2, 1);
button = new QToolButton(this);
button->setIcon(koIcon("stroke-cap-square"));
button->setCheckable(true);
button->setToolTip(i18n("Square cap"));
capGroup->addButton(button, Qt::SquareCap);
mainLayout->addWidget(button, 2, 2, Qt::AlignLeft);
// The join group
joinGroup = new QButtonGroup(this);
joinGroup->setExclusive(true);
button = new QToolButton(this);
button->setIcon(koIcon("stroke-join-miter"));
button->setCheckable(true);
button->setToolTip(i18n("Miter join"));
joinGroup->addButton(button, Qt::MiterJoin);
mainLayout->addWidget(button, 3, 0);
button = new QToolButton(this);
button->setIcon(koIcon("stroke-join-round"));
button->setCheckable(true);
button->setToolTip(i18n("Round join"));
joinGroup->addButton(button, Qt::RoundJoin);
mainLayout->addWidget(button, 3, 1);
button = new QToolButton(this);
button->setIcon(koIcon("stroke-join-bevel"));
button->setCheckable(true);
button->setToolTip(i18n("Bevel join"));
joinGroup->addButton(button, Qt::BevelJoin);
mainLayout->addWidget(button, 3, 2, Qt::AlignLeft);
// Miter limit
// set min/max/step and value in points, then set actual unit
miterLimit = new KisDoubleParseUnitSpinBox(this);
miterLimit->setMinMaxStep(0.0, 1000.0, 0.5);
miterLimit->setDecimals(2);
miterLimit->setUnit(KoUnit(KoUnit::Point));
miterLimit->setToolTip(i18n("Miter limit"));
mainLayout->addWidget(miterLimit, 4, 0, 1, 3);
mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
setLayout(mainLayout);
}
QSize CapNJoinMenu::sizeHint() const
{
return layout()->sizeHint();
}
class Q_DECL_HIDDEN KoStrokeConfigWidget::Private
{
public:
Private()
: canvas(0),
active(true),
allowLocalUnitManagement(true),
fillConfigWidget(0),
noSelectionTrackingMode(false)
{
}
KoLineStyleSelector *lineStyle;
KisDoubleParseUnitSpinBox *lineWidth;
KoMarkerSelector *startMarkerSelector;
KoMarkerSelector *midMarkerSelector;
KoMarkerSelector *endMarkerSelector;
- QToolButton *capNJoinButton;
- CapNJoinMenu *capNJoinMenu;
+ CapNJoinMenu *capNJoinMenu;
QWidget *spacer;
KoCanvasBase *canvas;
bool active;
bool allowLocalUnitManagement;
KoFillConfigWidget *fillConfigWidget;
bool noSelectionTrackingMode;
KisAcyclicSignalConnector shapeChangedAcyclicConnector;
KisAcyclicSignalConnector resourceManagerAcyclicConnector;
std::vector<KisAcyclicSignalConnector::Blocker> deactivationLocks;
+
+ Ui_KoStrokeConfigWidget *ui;
};
KoStrokeConfigWidget::KoStrokeConfigWidget(KoCanvasBase *canvas, QWidget * parent)
: QWidget(parent)
, d(new Private())
{
+ // confure GUI
+ d->ui = new Ui_KoStrokeConfigWidget();
+ d->ui->setupUi(this);
+
setObjectName("Stroke widget");
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->setMargin(2);
{ // connect the canvas
d->shapeChangedAcyclicConnector.connectBackwardVoid(
canvas->selectedShapesProxy(), SIGNAL(selectionChanged()),
this, SLOT(selectionChanged()));
d->shapeChangedAcyclicConnector.connectBackwardVoid(
canvas->selectedShapesProxy(), SIGNAL(selectionContentChanged()),
this, SLOT(selectionChanged()));
d->resourceManagerAcyclicConnector.connectBackwardResourcePair(
canvas->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
this, SLOT(canvasResourceChanged(int, const QVariant &)));
d->canvas = canvas;
}
- {
- QHBoxLayout *markersLineLayout = new QHBoxLayout();
- QList<KoMarker*> emptyMarkers;
+ {
- d->startMarkerSelector = new KoMarkerSelector(KoFlake::StartMarker, this);
- d->startMarkerSelector->setToolTip(i18nc("@info:tooltip", "Start marker"));
- d->startMarkerSelector->updateMarkers(emptyMarkers);
- markersLineLayout->addWidget(d->startMarkerSelector);
+ d->fillConfigWidget = new KoFillConfigWidget(canvas, KoFlake::StrokeFill, this);
+ d->fillConfigWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
+ d->ui->fillConfigWidgetLayout->addWidget(d->fillConfigWidget);
+ connect(d->fillConfigWidget, SIGNAL(sigFillChanged()), SIGNAL(sigStrokeChanged()));
+ }
- d->midMarkerSelector = new KoMarkerSelector(KoFlake::MidMarker, this);
- d->midMarkerSelector->setToolTip(i18nc("@info:tooltip", "Node marker"));
- d->midMarkerSelector->updateMarkers(emptyMarkers);
- markersLineLayout->addWidget(d->midMarkerSelector);
+ d->ui->thicknessLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ d->ui->thicknessLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- d->endMarkerSelector = new KoMarkerSelector(KoFlake::EndMarker, this);
- d->endMarkerSelector->setToolTip(i18nc("@info:tooltip", "End marker"));
- d->endMarkerSelector->updateMarkers(emptyMarkers);
- markersLineLayout->addWidget(d->endMarkerSelector);
+ // set min/max/step and value in points, then set actual unit
+ d->ui->lineWidth->setMinMaxStep(0.0, 1000.0, 0.5);
+ d->ui->lineWidth->setDecimals(2);
+ d->ui->lineWidth->setUnit(KoUnit(KoUnit::Point));
+ d->ui->lineWidth->setToolTip(i18n("Set line width of actual selection"));
- mainLayout->addLayout(markersLineLayout);
- }
+ d->ui->capNJoinButton->setMinimumHeight(25);
+ d->capNJoinMenu = new CapNJoinMenu(this);
+ d->ui->capNJoinButton->setMenu(d->capNJoinMenu);
+ d->ui->capNJoinButton->setText("...");
+ d->ui->capNJoinButton->setPopupMode(QToolButton::InstantPopup);
{
- QHBoxLayout *styleLineLayout = new QHBoxLayout();
-
// Line style
- d->lineStyle = new KoLineStyleSelector(this);
- d->lineStyle->setToolTip(i18nc("@info:tooltip", "Line style"));
- d->lineStyle->setMinimumWidth(70);
- d->lineStyle->setLineStyle(Qt::SolidLine, QVector<qreal>());
- styleLineLayout->addWidget(d->lineStyle);
+ d->ui->strokeStyleLabel->setText(i18n("Line Style:"));
+ d->ui->strokeStyleLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
- mainLayout->addLayout(styleLineLayout);
+ d->ui->lineStyle->setToolTip(i18nc("@info:tooltip", "Line style"));
+ d->ui->lineStyle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+ d->ui->lineStyle->setLineStyle(Qt::SolidLine, QVector<qreal>());
}
- QHBoxLayout *widthLineLayout = new QHBoxLayout();
- // Line width
- QLabel *l = new QLabel(this);
- l->setText(i18n("Thickness:"));
- l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- widthLineLayout->addWidget(l);
+ {
+ QList<KoMarker*> emptyMarkers;
- // set min/max/step and value in points, then set actual unit
- d->lineWidth = new KisDoubleParseUnitSpinBox(this);
- d->lineWidth->setMinMaxStep(0.0, 1000.0, 0.5);
- d->lineWidth->setDecimals(2);
- d->lineWidth->setUnit(KoUnit(KoUnit::Point));
- d->lineWidth->setToolTip(i18n("Set line width of actual selection"));
- widthLineLayout->addWidget(d->lineWidth);
-
- d->capNJoinButton = new QToolButton(this);
- d->capNJoinButton->setMinimumHeight(25);
- d->capNJoinMenu = new CapNJoinMenu(this);
- d->capNJoinButton->setMenu(d->capNJoinMenu);
- d->capNJoinButton->setText("...");
- d->capNJoinButton->setPopupMode(QToolButton::InstantPopup);
- widthLineLayout->addWidget(d->capNJoinButton);
+ d->startMarkerSelector = new KoMarkerSelector(KoFlake::StartMarker, this);
+ d->startMarkerSelector->setToolTip(i18nc("@info:tooltip", "Start marker"));
+ d->startMarkerSelector->updateMarkers(emptyMarkers);
+ d->startMarkerSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred );
+ d->ui->markerLayout->addWidget(d->startMarkerSelector);
- mainLayout->addLayout(widthLineLayout);
- { // add separator line
- QFrame* line = new QFrame();
- line->setFrameShape(QFrame::HLine);
- mainLayout->addWidget(line);
- }
+ d->midMarkerSelector = new KoMarkerSelector(KoFlake::MidMarker, this);
+ d->midMarkerSelector->setToolTip(i18nc("@info:tooltip", "Node marker"));
+ d->midMarkerSelector->updateMarkers(emptyMarkers);
+ d->midMarkerSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred );
+ d->ui->markerLayout->addWidget(d->midMarkerSelector);
- {
- d->fillConfigWidget = new KoFillConfigWidget(canvas, KoFlake::StrokeFill, this);
- mainLayout->addWidget(d->fillConfigWidget);
- connect(d->fillConfigWidget, SIGNAL(sigFillChanged()), SIGNAL(sigStrokeChanged()));
- d->fillConfigWidget->layout()->setMargin(0);
+ d->endMarkerSelector = new KoMarkerSelector(KoFlake::EndMarker, this);
+ d->endMarkerSelector->setToolTip(i18nc("@info:tooltip", "End marker"));
+ d->endMarkerSelector->updateMarkers(emptyMarkers);
+ d->endMarkerSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred );
+
+ d->ui->markerLayout->addWidget(d->endMarkerSelector);
}
// Spacer
d->spacer = new QWidget();
d->spacer->setObjectName("SpecialSpacer");
- mainLayout->addWidget(d->spacer);
- connect(d->lineStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(applyDashStyleChanges()));
- connect(d->lineWidth, SIGNAL(valueChangedPt(qreal)), this, SLOT(applyLineWidthChanges()));
+ d->ui->markerLayout->addWidget(d->spacer);
+
+ connect(d->ui->lineStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(applyDashStyleChanges()));
+ connect(d->ui->lineWidth, SIGNAL(valueChangedPt(qreal)), this, SLOT(applyLineWidthChanges()));
connect(d->capNJoinMenu->capGroup, SIGNAL(buttonClicked(int)), this, SLOT(applyJoinCapChanges()));
connect(d->capNJoinMenu->joinGroup, SIGNAL(buttonClicked(int)), this, SLOT(applyJoinCapChanges()));
connect(d->capNJoinMenu->miterLimit, SIGNAL(valueChangedPt(qreal)), this, SLOT(applyJoinCapChanges()));
{ // Map the marker signals correclty
QSignalMapper *mapper = new QSignalMapper(this);
connect(mapper, SIGNAL(mapped(int)), SLOT(applyMarkerChanges(int)));
connect(d->startMarkerSelector, SIGNAL(currentIndexChanged(int)), mapper, SLOT(map()));
connect(d->midMarkerSelector, SIGNAL(currentIndexChanged(int)), mapper, SLOT(map()));
connect(d->endMarkerSelector, SIGNAL(currentIndexChanged(int)), mapper, SLOT(map()));
mapper->setMapping(d->startMarkerSelector, KoFlake::StartMarker);
mapper->setMapping(d->midMarkerSelector, KoFlake::MidMarker);
mapper->setMapping(d->endMarkerSelector, KoFlake::EndMarker);
}
KoDocumentResourceManager *resourceManager = canvas->shapeController()->resourceManager();
if (resourceManager) {
KoMarkerCollection *collection = resourceManager->resource(KoDocumentResourceManager::MarkerCollection).value<KoMarkerCollection*>();
if (collection) {
updateMarkers(collection->markers());
}
}
selectionChanged();
d->fillConfigWidget->activate();
deactivate();
}
KoStrokeConfigWidget::~KoStrokeConfigWidget()
{
delete d;
}
void KoStrokeConfigWidget::setNoSelectionTrackingMode(bool value)
{
d->fillConfigWidget->setNoSelectionTrackingMode(value);
d->noSelectionTrackingMode = value;
if (!d->noSelectionTrackingMode) {
selectionChanged();
}
}
// ----------------------------------------------------------------
// getters and setters
Qt::PenStyle KoStrokeConfigWidget::lineStyle() const
{
- return d->lineStyle->lineStyle();
+ return d->ui->lineStyle->lineStyle();
}
QVector<qreal> KoStrokeConfigWidget::lineDashes() const
{
- return d->lineStyle->lineDashes();
+ return d->ui->lineStyle->lineDashes();
}
qreal KoStrokeConfigWidget::lineWidth() const
{
- return d->lineWidth->value();
+ return d->ui->lineWidth->value();
}
qreal KoStrokeConfigWidget::miterLimit() const
{
return d->capNJoinMenu->miterLimit->value();
}
KoMarker *KoStrokeConfigWidget::startMarker() const
{
return d->startMarkerSelector->marker();
}
KoMarker *KoStrokeConfigWidget::endMarker() const
{
return d->endMarkerSelector->marker();
}
Qt::PenCapStyle KoStrokeConfigWidget::capStyle() const
{
return static_cast<Qt::PenCapStyle>(d->capNJoinMenu->capGroup->checkedId());
}
Qt::PenJoinStyle KoStrokeConfigWidget::joinStyle() const
{
return static_cast<Qt::PenJoinStyle>(d->capNJoinMenu->joinGroup->checkedId());
}
KoShapeStrokeSP KoStrokeConfigWidget::createShapeStroke()
{
KoShapeStrokeSP stroke(d->fillConfigWidget->createShapeStroke());
stroke->setLineWidth(lineWidth());
stroke->setCapStyle(capStyle());
stroke->setJoinStyle(joinStyle());
stroke->setMiterLimit(miterLimit());
stroke->setLineStyle(lineStyle(), lineDashes());
return stroke;
}
// ----------------------------------------------------------------
// Other public functions
void KoStrokeConfigWidget::updateStyleControlsAvailability(bool enabled)
{
- d->lineWidth->setEnabled(enabled);
+ d->ui->lineWidth->setEnabled(enabled);
d->capNJoinMenu->setEnabled(enabled);
- d->lineStyle->setEnabled(enabled);
+ d->ui->lineStyle->setEnabled(enabled);
d->startMarkerSelector->setEnabled(enabled);
d->midMarkerSelector->setEnabled(enabled);
d->endMarkerSelector->setEnabled(enabled);
}
void KoStrokeConfigWidget::setUnit(const KoUnit &unit, KoShape *representativeShape)
{
if (!d->allowLocalUnitManagement) {
return; //the unit management is completly transfered to the unitManagers.
}
blockChildSignals(true);
/**
* KoStrokeShape knows nothing about the transformations applied
* to the shape, which doesn't prevent the shape to apply them and
* display the stroke differently. So just take that into account
* and show the user correct values using the multiplier in KoUnit.
*/
KoUnit newUnit(unit);
if (representativeShape) {
newUnit.adjustByPixelTransform(representativeShape->absoluteTransformation(0));
}
- d->lineWidth->setUnit(newUnit);
+ d->ui->lineWidth->setUnit(newUnit);
d->capNJoinMenu->miterLimit->setUnit(newUnit);
- d->lineWidth->setLineStep(1.0);
+ d->ui->lineWidth->setLineStep(1.0);
d->capNJoinMenu->miterLimit->setLineStep(1.0);
blockChildSignals(false);
}
void KoStrokeConfigWidget::setUnitManagers(KisSpinBoxUnitManager* managerLineWidth,
KisSpinBoxUnitManager *managerMitterLimit)
{
blockChildSignals(true);
d->allowLocalUnitManagement = false;
- d->lineWidth->setUnitManager(managerLineWidth);
+ d->ui->lineWidth->setUnitManager(managerLineWidth);
d->capNJoinMenu->miterLimit->setUnitManager(managerMitterLimit);
blockChildSignals(false);
}
void KoStrokeConfigWidget::updateMarkers(const QList<KoMarker*> &markers)
{
d->startMarkerSelector->updateMarkers(markers);
d->midMarkerSelector->updateMarkers(markers);
d->endMarkerSelector->updateMarkers(markers);
}
void KoStrokeConfigWidget::activate()
{
KIS_SAFE_ASSERT_RECOVER_RETURN(!d->deactivationLocks.empty());
d->deactivationLocks.clear();
d->fillConfigWidget->activate();
if (!d->noSelectionTrackingMode) {
selectionChanged();
} else {
loadCurrentStrokeFillFromResourceServer();
}
}
void KoStrokeConfigWidget::deactivate()
{
KIS_SAFE_ASSERT_RECOVER_RETURN(d->deactivationLocks.empty());
d->deactivationLocks.push_back(KisAcyclicSignalConnector::Blocker(d->shapeChangedAcyclicConnector));
d->deactivationLocks.push_back(KisAcyclicSignalConnector::Blocker(d->resourceManagerAcyclicConnector));
d->fillConfigWidget->deactivate();
}
void KoStrokeConfigWidget::blockChildSignals(bool block)
{
- d->lineWidth->blockSignals(block);
+ d->ui->lineWidth->blockSignals(block);
d->capNJoinMenu->capGroup->blockSignals(block);
d->capNJoinMenu->joinGroup->blockSignals(block);
d->capNJoinMenu->miterLimit->blockSignals(block);
- d->lineStyle->blockSignals(block);
+ d->ui->lineStyle->blockSignals(block);
d->startMarkerSelector->blockSignals(block);
d->midMarkerSelector->blockSignals(block);
d->endMarkerSelector->blockSignals(block);
}
void KoStrokeConfigWidget::setActive(bool active)
{
d->active = active;
}
//------------------------
template <typename ModifyFunction>
auto applyChangeToStrokes(KoCanvasBase *canvas, ModifyFunction modifyFunction)
-> decltype(modifyFunction(KoShapeStrokeSP()), void())
{
KoSelection *selection = canvas->selectedShapesProxy()->selection();
if (!selection) return;
QList<KoShape*> shapes = selection->selectedEditableShapes();
KUndo2Command *command = KoFlake::modifyShapesStrokes(shapes, modifyFunction);
if (command) {
canvas->addCommand(command);
}
}
void KoStrokeConfigWidget::applyDashStyleChanges()
{
applyChangeToStrokes(
d->canvas,
[this] (KoShapeStrokeSP stroke) {
stroke->setLineStyle(lineStyle(), lineDashes());
});
emit sigStrokeChanged();
}
void KoStrokeConfigWidget::applyLineWidthChanges()
{
applyChangeToStrokes(
d->canvas,
[this] (KoShapeStrokeSP stroke) {
stroke->setLineWidth(lineWidth());
});
emit sigStrokeChanged();
}
void KoStrokeConfigWidget::applyJoinCapChanges()
{
applyChangeToStrokes(
d->canvas,
[this] (KoShapeStrokeSP stroke) {
stroke->setCapStyle(static_cast<Qt::PenCapStyle>(d->capNJoinMenu->capGroup->checkedId()));
stroke->setJoinStyle(static_cast<Qt::PenJoinStyle>(d->capNJoinMenu->joinGroup->checkedId()));
stroke->setMiterLimit(miterLimit());
});
emit sigStrokeChanged();
}
void KoStrokeConfigWidget::applyMarkerChanges(int rawPosition)
{
KoSelection *selection = d->canvas->selectedShapesProxy()->selection();
if (!selection) {
emit sigStrokeChanged();
return;
}
QList<KoShape*> shapes = selection->selectedEditableShapes();
QList<KoPathShape*> pathShapes;
Q_FOREACH (KoShape *shape, shapes) {
KoPathShape *pathShape = dynamic_cast<KoPathShape*>(shape);
if (pathShape) {
pathShapes << pathShape;
}
}
if (pathShapes.isEmpty()) {
emit sigStrokeChanged();
return;
}
KoFlake::MarkerPosition position = KoFlake::MarkerPosition(rawPosition);
QScopedPointer<KoMarker> marker;
switch (position) {
case KoFlake::StartMarker:
if (d->startMarkerSelector->marker()) {
marker.reset(new KoMarker(*d->startMarkerSelector->marker()));
}
break;
case KoFlake::MidMarker:
if (d->midMarkerSelector->marker()) {
marker.reset(new KoMarker(*d->midMarkerSelector->marker()));
}
break;
case KoFlake::EndMarker:
if (d->endMarkerSelector->marker()) {
marker.reset(new KoMarker(*d->endMarkerSelector->marker()));
}
break;
}
KUndo2Command* command = new KoPathShapeMarkerCommand(pathShapes, marker.take(), position);
d->canvas->addCommand(command);
emit sigStrokeChanged();
}
// ----------------------------------------------------------------
struct CheckShapeStrokeStyleBasePolicy
{
typedef KoShapeStrokeSP PointerType;
static PointerType getProperty(KoShape *shape) {
return qSharedPointerDynamicCast<KoShapeStroke>(shape->stroke());
}
};
struct CheckShapeStrokeDashesPolicy : public CheckShapeStrokeStyleBasePolicy
{
static bool compareTo(PointerType p1, PointerType p2) {
return p1->lineStyle() == p2->lineStyle() &&
p1->lineDashes() == p2->lineDashes() &&
p1->dashOffset() == p2->dashOffset();
}
};
struct CheckShapeStrokeCapJoinPolicy : public CheckShapeStrokeStyleBasePolicy
{
static bool compareTo(PointerType p1, PointerType p2) {
return p1->capStyle() == p2->capStyle() &&
p1->joinStyle() == p2->joinStyle() &&
p1->miterLimit() == p2->miterLimit();
}
};
struct CheckShapeStrokeWidthPolicy : public CheckShapeStrokeStyleBasePolicy
{
static bool compareTo(PointerType p1, PointerType p2) {
return p1->lineWidth() == p2->lineWidth();
}
};
struct CheckShapeMarkerPolicy
{
CheckShapeMarkerPolicy(KoFlake::MarkerPosition position)
: m_position(position)
{
}
typedef KoMarker* PointerType;
PointerType getProperty(KoShape *shape) const {
KoPathShape *pathShape = dynamic_cast<KoPathShape*>(shape);
return pathShape ? pathShape->marker(m_position) : 0;
}
bool compareTo(PointerType p1, PointerType p2) const {
if ((!p1 || !p2) && p1 != p2) return false;
if (!p1 && p1 == p2) return true;
return p1 == p2 || *p1 == *p2;
}
KoFlake::MarkerPosition m_position;
};
void KoStrokeConfigWidget::selectionChanged()
{
+
KoSelection *selection = d->canvas->selectedShapesProxy()->selection();
if (!selection) return;
+
QList<KoShape*> shapes = selection->selectedEditableShapes();
KoShape *shape = !shapes.isEmpty() ? shapes.first() : 0;
+
const KoShapeStrokeSP stroke = shape ? qSharedPointerDynamicCast<KoShapeStroke>(shape->stroke()) : KoShapeStrokeSP();
// setUnit uses blockChildSignals() so take care not to use it inside the block
setUnit(d->canvas->unit(), shape);
blockChildSignals(true);
// line width
if (stroke && KoFlake::compareShapePropertiesEqual<CheckShapeStrokeWidthPolicy>(shapes)) {
- d->lineWidth->changeValue(stroke->lineWidth());
+ d->ui->lineWidth->changeValue(stroke->lineWidth());
} else {
- d->lineWidth->changeValue(0);
+ d->ui->lineWidth->changeValue(0);
}
+
// caps & joins
if (stroke && KoFlake::compareShapePropertiesEqual<CheckShapeStrokeCapJoinPolicy>(shapes)) {
Qt::PenCapStyle capStyle = stroke->capStyle() >= 0 ? stroke->capStyle() : Qt::FlatCap;
Qt::PenJoinStyle joinStyle = stroke->joinStyle() >= 0 ? stroke->joinStyle() : Qt::MiterJoin;
{
QAbstractButton *button = d->capNJoinMenu->capGroup->button(capStyle);
KIS_SAFE_ASSERT_RECOVER_RETURN(button);
button->setChecked(true);
}
{
QAbstractButton *button = d->capNJoinMenu->joinGroup->button(joinStyle);
KIS_SAFE_ASSERT_RECOVER_RETURN(button);
button->setChecked(true);
}
d->capNJoinMenu->miterLimit->changeValue(stroke->miterLimit());
d->capNJoinMenu->miterLimit->setEnabled(joinStyle == Qt::MiterJoin);
} else {
d->capNJoinMenu->capGroup->button(Qt::FlatCap)->setChecked(true);
d->capNJoinMenu->joinGroup->button(Qt::MiterJoin)->setChecked(true);
d->capNJoinMenu->miterLimit->changeValue(0.0);
d->capNJoinMenu->miterLimit->setEnabled(true);
}
+
// dashes style
if (stroke && KoFlake::compareShapePropertiesEqual<CheckShapeStrokeDashesPolicy>(shapes)) {
- d->lineStyle->setLineStyle(stroke->lineStyle(), stroke->lineDashes());
+ d->ui->lineStyle->setLineStyle(stroke->lineStyle(), stroke->lineDashes());
} else {
- d->lineStyle->setLineStyle(Qt::SolidLine, QVector<qreal>());
+ d->ui->lineStyle->setLineStyle(Qt::SolidLine, QVector<qreal>());
}
// markers
KoPathShape *pathShape = dynamic_cast<KoPathShape *>(shape);
if (pathShape) {
if (KoFlake::compareShapePropertiesEqual(shapes, CheckShapeMarkerPolicy(KoFlake::StartMarker))) {
d->startMarkerSelector->setMarker(pathShape->marker(KoFlake::StartMarker));
}
if (KoFlake::compareShapePropertiesEqual(shapes, CheckShapeMarkerPolicy(KoFlake::MidMarker))) {
d->midMarkerSelector->setMarker(pathShape->marker(KoFlake::MidMarker));
}
if (KoFlake::compareShapePropertiesEqual(shapes, CheckShapeMarkerPolicy(KoFlake::EndMarker))) {
d->endMarkerSelector->setMarker(pathShape->marker(KoFlake::EndMarker));
}
}
+ const bool lineOptionsVisible = d->fillConfigWidget->selectedFillIndex() == 0 ? false : true;
+
+ // This switch statement is to help the tab widget "pages" to be closer to the correct size
+ // if we don't do this the internal widgets get rendered, then the tab page has to get resized to
+ // fill up the space, then the internal widgets have to resize yet again...causing flicker
+ switch(d->fillConfigWidget->selectedFillIndex()) {
+ case 0: // no fill
+ this->setMinimumHeight(130);
+ break;
+ case 1: // solid fill
+ this->setMinimumHeight(200);
+ break;
+ case 2: // gradient fill
+ this->setMinimumHeight(350);
+ case 3: // pattern fill
+ break;
+ }
+
+
+ d->ui->thicknessLineBreak->setVisible(lineOptionsVisible);
+ d->ui->lineWidth->setVisible(lineOptionsVisible);
+ d->ui->capNJoinButton->setVisible(lineOptionsVisible);
+ d->ui->lineStyle->setVisible(lineOptionsVisible);
+ d->startMarkerSelector->setVisible(lineOptionsVisible);
+ d->midMarkerSelector->setVisible(lineOptionsVisible);
+ d->endMarkerSelector->setVisible(lineOptionsVisible);
+ d->ui->thicknessLabel->setVisible(lineOptionsVisible);
+ d->ui->strokeStyleLabel->setVisible(lineOptionsVisible);
+
+
+
blockChildSignals(false);
updateStyleControlsAvailability(!shapes.isEmpty());
+
}
void KoStrokeConfigWidget::canvasResourceChanged(int key, const QVariant &value)
{
switch (key) {
case KoCanvasResourceManager::Unit:
// we request the whole selection to reload because the
// unit of the stroke width depends on the selected shape
selectionChanged();
break;
case KisCanvasResourceProvider::Size:
if (d->noSelectionTrackingMode) {
- d->lineWidth->changeValue(d->canvas->unit().fromUserValue(value.toReal()));
+ d->ui->lineWidth->changeValue(d->canvas->unit().fromUserValue(value.toReal()));
}
break;
}
}
void KoStrokeConfigWidget::loadCurrentStrokeFillFromResourceServer()
{
if (d->canvas) {
const QVariant value = d->canvas->resourceManager()->resource(KisCanvasResourceProvider::Size);
canvasResourceChanged(KisCanvasResourceProvider::Size, value);
updateStyleControlsAvailability(true);
emit sigStrokeChanged();
}
}
diff --git a/libs/ui/widgets/KoStrokeConfigWidget.h b/libs/ui/widgets/KoStrokeConfigWidget.h
index 6384b52a6a..f41e68dbf5 100644
--- a/libs/ui/widgets/KoStrokeConfigWidget.h
+++ b/libs/ui/widgets/KoStrokeConfigWidget.h
@@ -1,114 +1,118 @@
/* This file is part of the KDE project
* Made by Tomislav Lukman (tomislav.lukman@ck.tel.hr)
* Copyright (C) 2002 Tomislav Lukman <tomislav.lukman@ck.t-com.hr>
* Copyright (C) 2002 Rob Buis <buis@kde.org>
* Copyright (C) 2004 Laurent Montel <montel@kde.org>
* Copyright (C) 2005-2006 Tim Beaulen <tbscope@gmail.com>
* Copyright (C) 2005 Inge Wallin <inge@lysator.liu.se>
* Copyright (C) 2005, 2011 Thomas Zander <zander@kde.org>
* Copyright (C) 2005-2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2006 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2011 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STROKECONFIGWIDGET_H
#define STROKECONFIGWIDGET_H
#include "kritaui_export.h"
#include <QWidget>
+#include <QLabel>
#include <KoFlakeTypes.h>
#include <KoFlake.h>
+
class KoUnit;
class KoShapeStrokeModel;
class KoShapeStroke;
class KoMarker;
class KoCanvasBase;
class KoShapeStroke;
-
class KisSpinBoxUnitManager;
/// A widget for configuring the stroke of a shape
class KRITAUI_EXPORT KoStrokeConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit KoStrokeConfigWidget(KoCanvasBase *canvas, QWidget *parent);
- ~KoStrokeConfigWidget();
+ ~KoStrokeConfigWidget() override;
void setNoSelectionTrackingMode(bool value);
// Getters
Qt::PenStyle lineStyle() const;
QVector<qreal> lineDashes() const;
qreal lineWidth() const;
QColor color() const;
qreal miterLimit() const;
KoMarker *startMarker() const;
KoMarker *endMarker() const;
Qt::PenCapStyle capStyle() const;
Qt::PenJoinStyle joinStyle() const;
+ QLabel *thicknessLabel;
+ QLabel *strokeStyleLabel;
+ QFrame* separatorLine;
/**
* Creates KoShapeStroke object filled with the options
* configured by the widget. The caller is in charge of
* deletion of the returned object
*/
KoShapeStrokeSP createShapeStroke();
void setActive(bool active);
void updateStyleControlsAvailability(bool enabled);
void setUnitManagers(KisSpinBoxUnitManager* managerLineWidth, KisSpinBoxUnitManager* managerMitterLimit);
void activate();
void deactivate();
private Q_SLOTS:
void updateMarkers(const QList<KoMarker*> &markers);
void canvasResourceChanged(int key, const QVariant &value);
/// selection has changed
void selectionChanged();
/// apply line changes to the selected shapes
void applyDashStyleChanges();
void applyLineWidthChanges();
void applyJoinCapChanges();
/// apply marker changes to the selected shape
void applyMarkerChanges(int rawPosition);
Q_SIGNALS:
void sigStrokeChanged();
private:
void setUnit(const KoUnit &unit, KoShape *representativeShape);
void blockChildSignals(bool block);
void loadCurrentStrokeFillFromResourceServer();
private:
class Private;
Private * const d;
};
#endif // SHADOWCONFIGWIDGET_H
diff --git a/libs/ui/widgets/KoStrokeConfigWidget.ui b/libs/ui/widgets/KoStrokeConfigWidget.ui
new file mode 100644
index 0000000000..e94a0109d6
--- /dev/null
+++ b/libs/ui/widgets/KoStrokeConfigWidget.ui
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>KoStrokeConfigWidget</class>
+ <widget class="QWidget" name="KoStrokeConfigWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>226</width>
+ <height>100</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="fillConfigWidgetLayout"/>
+ </item>
+ <item>
+ <widget class="Line" name="thicknessLineBreak">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="thicknessLayout">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="thicknessLabel">
+ <property name="text">
+ <string>Thickness:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KisDoubleParseUnitSpinBox" name="lineWidth" native="true"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="capNJoinButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="lineStyleLayout">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="strokeStyleLabel">
+ <property name="text">
+ <string>Line Style:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KoLineStyleSelector" name="lineStyle" native="true"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="markerLayout">
+ <property name="leftMargin">
+ <number>9</number>
+ </property>
+ <property name="rightMargin">
+ <number>9</number>
+ </property>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KisDoubleParseUnitSpinBox</class>
+ <extends>QWidget</extends>
+ <header>kis_double_parse_unit_spin_box.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KoLineStyleSelector</class>
+ <extends>QWidget</extends>
+ <header>KoLineStyleSelector.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/libs/ui/widgets/kis_advanced_color_space_selector.cc b/libs/ui/widgets/kis_advanced_color_space_selector.cc
index dee04ed433..1c30cad434 100644
--- a/libs/ui/widgets/kis_advanced_color_space_selector.cc
+++ b/libs/ui/widgets/kis_advanced_color_space_selector.cc
@@ -1,796 +1,793 @@
/*
* Copyright (C) 2007 Cyrille Berger <cberger@cberger.net>
* Copyright (C) 2011 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_advanced_color_space_selector.h"
#include <KoFileDialog.h>
#include <KoColorProfile.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceEngine.h>
#include <KoColorModelStandardIds.h>
#include <KoID.h>
#include <KoConfig.h>
#include <kis_icon.h>
#include <QDesktopServices>
#include <QTextBrowser>
#include <QScrollBar>
#include <KoResourcePaths.h>
#include <QUrl>
#include "ui_wdgcolorspaceselectoradvanced.h"
#include <kis_debug.h>
struct KisAdvancedColorSpaceSelector::Private {
Ui_WdgColorSpaceSelectorAdvanced* colorSpaceSelector;
QString knsrcFile;
};
KisAdvancedColorSpaceSelector::KisAdvancedColorSpaceSelector(QWidget* parent, const QString &caption)
: QDialog(parent)
, d(new Private)
{
setWindowTitle(caption);
d->colorSpaceSelector = new Ui_WdgColorSpaceSelectorAdvanced;
d->colorSpaceSelector->setupUi(this);
d->colorSpaceSelector->cmbColorModels->setIDList(KoColorSpaceRegistry::instance()->colorModelsList(KoColorSpaceRegistry::OnlyUserVisible));
fillCmbDepths(d->colorSpaceSelector->cmbColorModels->currentItem());
d->colorSpaceSelector->bnInstallProfile->setIcon(KisIconUtils::loadIcon("document-open"));
d->colorSpaceSelector->bnInstallProfile->setToolTip( i18n("Open Color Profile") );
connect(d->colorSpaceSelector->cmbColorModels, SIGNAL(activated(const KoID &)),
this, SLOT(fillCmbDepths(const KoID &)));
connect(d->colorSpaceSelector->cmbColorDepth, SIGNAL(activated(const KoID &)),
this, SLOT(fillLstProfiles()));
connect(d->colorSpaceSelector->cmbColorModels, SIGNAL(activated(const KoID &)),
this, SLOT(fillLstProfiles()));
connect(d->colorSpaceSelector->lstProfile, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
this, SLOT(colorSpaceChanged()));
connect(this, SIGNAL(selectionChanged(bool)),
this, SLOT(fillDescription()));
connect(this, SIGNAL(selectionChanged(bool)), d->colorSpaceSelector->TongueWidget, SLOT(repaint()));
connect(this, SIGNAL(selectionChanged(bool)), d->colorSpaceSelector->TRCwidget, SLOT(repaint()));
connect(d->colorSpaceSelector->bnInstallProfile, SIGNAL(clicked()), this, SLOT(installProfile()));
connect(d->colorSpaceSelector->bnOK, SIGNAL(accepted()), this, SLOT(accept()));
connect(d->colorSpaceSelector->bnOK, SIGNAL(rejected()), this, SLOT(reject()));
fillLstProfiles();
}
KisAdvancedColorSpaceSelector::~KisAdvancedColorSpaceSelector()
{
delete d->colorSpaceSelector;
delete d;
}
void KisAdvancedColorSpaceSelector::fillLstProfiles()
{
d->colorSpaceSelector->lstProfile->blockSignals(true);
- QString s = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
+ const QString defaultProfileName = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
d->colorSpaceSelector->lstProfile->clear();
- const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s);
- if (csf == 0) return;//TODO: make this give better feedback.
-
- QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
+ QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId);
QStringList profileNames;
Q_FOREACH (const KoColorProfile *profile, profileList) {
profileNames.append(profile->name());
}
qSort(profileNames);
QListWidgetItem *defaultProfile = new QListWidgetItem;
- defaultProfile->setText(csf->defaultProfile() + " " + i18nc("This is appended to the color profile which is the default for the given colorspace and bit-depth","(Default)"));
+ defaultProfile->setText(defaultProfileName + " " + i18nc("This is appended to the color profile which is the default for the given colorspace and bit-depth","(Default)"));
Q_FOREACH (QString stringName, profileNames) {
- if (stringName==csf->defaultProfile()) {
+ if (stringName == defaultProfileName) {
d->colorSpaceSelector->lstProfile->addItem(defaultProfile);
} else {
d->colorSpaceSelector->lstProfile->addItem(stringName);
}
}
d->colorSpaceSelector->lstProfile->setCurrentItem(defaultProfile);
d->colorSpaceSelector->lstProfile->blockSignals(false);
colorSpaceChanged();
}
void KisAdvancedColorSpaceSelector::fillCmbDepths(const KoID& id)
{
KoID activeDepth = d->colorSpaceSelector->cmbColorDepth->currentItem();
d->colorSpaceSelector->cmbColorDepth->clear();
QList<KoID> depths = KoColorSpaceRegistry::instance()->colorDepthList(id, KoColorSpaceRegistry::OnlyUserVisible);
QList<KoID> sortedDepths;
if (depths.contains(Integer8BitsColorDepthID)) {
sortedDepths << Integer8BitsColorDepthID;
}
if (depths.contains(Integer16BitsColorDepthID)) {
sortedDepths << Integer16BitsColorDepthID;
}
if (depths.contains(Float16BitsColorDepthID)) {
sortedDepths << Float16BitsColorDepthID;
}
if (depths.contains(Float32BitsColorDepthID)) {
sortedDepths << Float32BitsColorDepthID;
}
if (depths.contains(Float64BitsColorDepthID)) {
sortedDepths << Float64BitsColorDepthID;
}
d->colorSpaceSelector->cmbColorDepth->setIDList(sortedDepths);
if (sortedDepths.contains(activeDepth)) {
d->colorSpaceSelector->cmbColorDepth->setCurrent(activeDepth);
}
}
void KisAdvancedColorSpaceSelector::fillDescription()
{
QString notApplicable = i18nc("Not Applicable, used where there's no colorants or gamma curve found","N/A");
QString notApplicableTooltip = i18nc("@info:tooltip","This profile has no colorants.");
QString profileName = i18nc("Shows up instead of the name when there's no profile","No Profile Found");
QString whatIsColorant = i18n("Colorant in d50-adapted xyY.");
//set colorants
- QString s = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
- const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s);
- if (csf == 0) return;
- QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
- if (profileList.isEmpty()==false) {
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
+ QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId);
+
+ if (!profileList.isEmpty()) {
profileName = currentColorSpace()->profile()->name();
if (currentColorSpace()->profile()->hasColorants()){
QVector <double> colorants = currentColorSpace()->profile()->getColorantsxyY();
QVector <double> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
//QString text = currentColorSpace()->profile()->info() + " =" +
d->colorSpaceSelector->lblXYZ_W->setText(nameWhitePoint(whitepoint));
d->colorSpaceSelector->lblXYZ_W->setToolTip(QString::number(whitepoint[0], 'f', 4) + ", " + QString::number(whitepoint[1], 'f', 4) + ", " + QString::number(whitepoint[2], 'f', 4));
d->colorSpaceSelector->TongueWidget->setToolTip("<html><head/><body><table><tr><th colspan='4'>"+i18nc("@info:tooltip","This profile has the following xyY colorants:")+"</th></tr><tr><td>"+
i18n("Red:") +"</td><td>"+QString::number(colorants[0], 'f', 4) + "</td><td>" + QString::number(colorants[1], 'f', 4) + "</td><td>" + QString::number(colorants[2], 'f', 4)+"</td></tr><tr><td>"+
i18n("Green:")+"</td><td>"+QString::number(colorants[3], 'f', 4) + "</td><td>" + QString::number(colorants[4], 'f', 4) + "</td><td>" + QString::number(colorants[5], 'f', 4)+"</th></tr><tr><td>"+
i18n("Blue:") +"</td><td>"+QString::number(colorants[6], 'f', 4) + "</td><td>" + QString::number(colorants[7], 'f', 4) + "</td><td>" + QString::number(colorants[8], 'f', 4)+"</th></tr></table></body></html>");
} else {
QVector <double> whitepoint2 = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->lblXYZ_W->setText(nameWhitePoint(whitepoint2));
d->colorSpaceSelector->lblXYZ_W->setToolTip(QString::number(whitepoint2[0], 'f', 4) + ", " + QString::number(whitepoint2[1], 'f', 4) + ", " + QString::number(whitepoint2[2], 'f', 4));
d->colorSpaceSelector->TongueWidget->setToolTip(notApplicableTooltip);
}
} else {
d->colorSpaceSelector->lblXYZ_W->setText(notApplicable);
d->colorSpaceSelector->lblXYZ_W->setToolTip(notApplicableTooltip);
d->colorSpaceSelector->TongueWidget->setToolTip(notApplicableTooltip);
}
//set TRC
QVector <double> estimatedTRC(3);
QString estimatedGamma = i18nc("Estimated Gamma indicates how the TRC (Tone Response Curve or Tone Reproduction Curve) is bent. A Gamma of 1.0 means linear.", "<b>Estimated Gamma</b>: ");
QString estimatedsRGB = i18nc("This is for special Gamma types that LCMS cannot differentiate between", "<b>Estimated Gamma</b>: sRGB, L* or rec709 TRC");
QString whatissRGB = i18nc("@info:tooltip","The Tone Response Curve of this color space is either sRGB, L* or rec709 TRC.");
QString currentModelStr = d->colorSpaceSelector->cmbColorModels->currentItem().id();
if (profileList.isEmpty()) {
d->colorSpaceSelector->TongueWidget->setProfileDataAvailable(false);
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
else if (currentModelStr == "RGBA") {
QVector <qreal> colorants = currentColorSpace()->profile()->getColorantsxyY();
QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
if (currentColorSpace()->profile()->hasColorants()){
d->colorSpaceSelector->TongueWidget->setRGBData(whitepoint, colorants);
} else {
colorants.fill(0.0);
d->colorSpaceSelector->TongueWidget->setRGBData(whitepoint, colorants);
}
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
estimatedTRC = currentColorSpace()->profile()->getEstimatedTRC();
QString estimatedCurve = " Estimated curve: ";
QPolygonF redcurve;
QPolygonF greencurve;
QPolygonF bluecurve;
if (currentColorSpace()->profile()->hasTRC()){
for (int i=0; i<=10; i++) {
QVector <qreal> linear(3);
linear.fill(i*0.1);
currentColorSpace()->profile()->linearizeFloatValue(linear);
estimatedCurve = estimatedCurve + ", " + QString::number(linear[0]);
QPointF tonepoint(linear[0],i*0.1);
redcurve<<tonepoint;
tonepoint.setX(linear[1]);
greencurve<<tonepoint;
tonepoint.setX(linear[2]);
bluecurve<<tonepoint;
}
d->colorSpaceSelector->TRCwidget->setRGBCurve(redcurve, greencurve, bluecurve);
} else {
QPolygonF curve = currentColorSpace()->estimatedTRCXYY();
redcurve << curve.at(0) << curve.at(1) << curve.at(2) << curve.at(3) << curve.at(4);
greencurve << curve.at(5) << curve.at(6) << curve.at(7) << curve.at(8) << curve.at(9);
bluecurve << curve.at(10) << curve.at(11) << curve.at(12) << curve.at(13) << curve.at(14);
d->colorSpaceSelector->TRCwidget->setRGBCurve(redcurve, greencurve, bluecurve);
}
if (estimatedTRC[0] == -1) {
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+whatissRGB+"<br />"+estimatedCurve+"</body></html>");
} else {
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+estimatedGamma + QString::number(estimatedTRC[0]) + "," + QString::number(estimatedTRC[1]) + "," + QString::number(estimatedTRC[2])+"<br />"+estimatedCurve+"</body></html>");
}
}
else if (currentModelStr == "GRAYA") {
QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setGrayData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
estimatedTRC = currentColorSpace()->profile()->getEstimatedTRC();
QString estimatedCurve = " Estimated curve: ";
QPolygonF tonecurve;
if (currentColorSpace()->profile()->hasTRC()){
for (int i=0; i<=10; i++) {
QVector <qreal> linear(3);
linear.fill(i*0.1);
currentColorSpace()->profile()->linearizeFloatValue(linear);
estimatedCurve = estimatedCurve + ", " + QString::number(linear[0]);
QPointF tonepoint(linear[0],i*0.1);
tonecurve<<tonepoint;
}
} else {
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
d->colorSpaceSelector->TRCwidget->setGreyscaleCurve(tonecurve);
if (estimatedTRC[0] == -1) {
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+whatissRGB+"<br />"+estimatedCurve+"</body></html>");
} else {
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+estimatedGamma + QString::number(estimatedTRC[0])+"<br />"+estimatedCurve+"</body></html>");
}
}
else if (currentModelStr == "CMYKA") {
QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setCMYKData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
QString estimatedCurve = " Estimated curve: ";
QPolygonF tonecurve;
QPolygonF cyancurve;
QPolygonF magentacurve;
QPolygonF yellowcurve;
if (currentColorSpace()->profile()->hasTRC()){
for (int i=0; i<=10; i++) {
QVector <qreal> linear(3);
linear.fill(i*0.1);
currentColorSpace()->profile()->linearizeFloatValue(linear);
estimatedCurve = estimatedCurve + ", " + QString::number(linear[0]);
QPointF tonepoint(linear[0],i*0.1);
tonecurve<<tonepoint;
}
d->colorSpaceSelector->TRCwidget->setGreyscaleCurve(tonecurve);
} else {
QPolygonF curve = currentColorSpace()->estimatedTRCXYY();
cyancurve << curve.at(0) << curve.at(1) << curve.at(2) << curve.at(3) << curve.at(4);
magentacurve << curve.at(5) << curve.at(6) << curve.at(7) << curve.at(8) << curve.at(9);
yellowcurve << curve.at(10) << curve.at(11) << curve.at(12) << curve.at(13) << curve.at(14);
tonecurve << curve.at(15) << curve.at(16) << curve.at(17) << curve.at(18) << curve.at(19);
d->colorSpaceSelector->TRCwidget->setCMYKCurve(cyancurve, magentacurve, yellowcurve, tonecurve);
}
d->colorSpaceSelector->TRCwidget->setToolTip(i18nc("@info:tooltip","Estimated Gamma cannot be retrieved for CMYK."));
}
else if (currentModelStr == "XYZA") {
QString estimatedCurve = " Estimated curve: ";
estimatedTRC = currentColorSpace()->profile()->getEstimatedTRC();
QPolygonF tonecurve;
if (currentColorSpace()->profile()->hasTRC()){
for (int i=0; i<=10; i++) {
QVector <qreal> linear(3);
linear.fill(i*0.1);
currentColorSpace()->profile()->linearizeFloatValue(linear);
estimatedCurve = estimatedCurve + ", " + QString::number(linear[0]);
QPointF tonepoint(linear[0],i*0.1);
tonecurve<<tonepoint;
}
d->colorSpaceSelector->TRCwidget->setGreyscaleCurve(tonecurve);
} else {
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setXYZData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+estimatedGamma + QString::number(estimatedTRC[0])+"< br />"+estimatedCurve+"</body></html>");
}
else if (currentModelStr == "LABA") {
estimatedTRC = currentColorSpace()->profile()->getEstimatedTRC();
QString estimatedCurve = " Estimated curve: ";
QPolygonF tonecurve;
if (currentColorSpace()->profile()->hasTRC()){
for (int i=0; i<=10; i++) {
QVector <qreal> linear(3);
linear.fill(i*0.1);
currentColorSpace()->profile()->linearizeFloatValue(linear);
estimatedCurve = estimatedCurve + ", " + QString::number(linear[0]);
QPointF tonepoint(linear[0],i*0.1);
tonecurve<<tonepoint;
}
d->colorSpaceSelector->TRCwidget->setGreyscaleCurve(tonecurve);
} else {
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setLABData(whitepoint);
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
d->colorSpaceSelector->TRCwidget->setToolTip("<html><head/><body>"+i18nc("@info:tooltip","This is assumed to be the L * TRC. ")+"<br />"+estimatedCurve+"</body></html>");
}
else if (currentModelStr == "YCbCrA") {
QVector <qreal> whitepoint = currentColorSpace()->profile()->getWhitePointxyY();
d->colorSpaceSelector->TongueWidget->setYCbCrData(whitepoint);
QString estimatedCurve = " Estimated curve: ";
QPolygonF tonecurve;
if (currentColorSpace()->profile()->hasTRC()){
for (int i=0; i<=10; i++) {
QVector <qreal> linear(3);
linear.fill(i*0.1);
currentColorSpace()->profile()->linearizeFloatValue(linear);
estimatedCurve = estimatedCurve + ", " + QString::number(linear[0]);
QPointF tonepoint(linear[0],i*0.1);
tonecurve<<tonepoint;
}
d->colorSpaceSelector->TRCwidget->setGreyscaleCurve(tonecurve);
} else {
d->colorSpaceSelector->TRCwidget->setProfileDataAvailable(false);
}
d->colorSpaceSelector->TongueWidget->setGamut(currentColorSpace()->gamutXYY());
d->colorSpaceSelector->TRCwidget->setToolTip(i18nc("@info:tooltip","Estimated Gamma cannot be retrieved for YCrCb."));
}
d->colorSpaceSelector->textProfileDescription->clear();
if (profileList.isEmpty()==false) {
d->colorSpaceSelector->textProfileDescription->append("<h3>"+i18nc("About <Profilename>","About ") + currentColorSpace()->name() + "/" + profileName + "</h3>");
d->colorSpaceSelector->textProfileDescription->append("<p>"+ i18nc("ICC profile version","ICC Version: ") + QString::number(currentColorSpace()->profile()->version()) + "</p>");
//d->colorSpaceSelector->textProfileDescription->append("<p>"+ i18nc("Who made the profile?","Manufacturer: ") + currentColorSpace()->profile()->manufacturer() + "</p>"); //This would work if people actually wrote the manufacturer into the manufacturer fiedl...
d->colorSpaceSelector->textProfileDescription->append("<p>"+ i18nc("What is the copyright? These are from embedded strings from the icc profile, so they default to english.","Copyright: ") + currentColorSpace()->profile()->copyright() + "</p>");
} else {
d->colorSpaceSelector->textProfileDescription->append("<h3>" + profileName + "</h3>");
}
if (currentModelStr == "RGBA") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("If the selected model is RGB",
"<b><a href=\"https://en.wikipedia.org/wiki/RGB_color_space\">RGB (Red, Green, Blue)</a></b>, is the color model used by screens and other light-based media.<br/>"
"RGB is an additive color model: adding colors together makes them brighter. This color "
"model is the most extensive of all color models, and is recommended as a model for painting,"
"that you can later convert to other spaces. RGB is also the recommended colorspace for HDR editing.")+"</p>");
} else if (currentModelStr == "CMYKA") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("If the selected model is CMYK",
"<b><a href=\"https://en.wikipedia.org/wiki/CMYK_color_model\">CMYK (Cyan, Magenta, Yellow, Key)</a></b>, "
"is the model used by printers and other ink-based media.<br/>"
"CMYK is a subtractive model, meaning that adding colors together will turn them darker. Because of CMYK "
"profiles being very specific per printer, it is recommended to work in RGB space, and then later convert "
"to a CMYK profile, preferably one delivered by your printer. <br/>"
"CMYK is <b>not</b> recommended for painting."
"Unfortunately, Krita cannot retrieve colorants or the TRC for this space.")+"</p>");
} else if (currentModelStr == "XYZA") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("If the selected model is XYZ",
"<b><a href=\"https://en.wikipedia.org/wiki/CIE_1931_color_space\">CIE XYZ</a></b>"
"is the space determined by the CIE as the space that encompasses all other colors, and used to "
"convert colors between profiles. XYZ is an additive color model, meaning that adding colors together "
"makes them brighter. XYZ is <b>not</b> recommended for painting, but can be useful to encode in. The Tone Response "
"Curve is assumed to be linear.")+"</p>");
} else if (currentModelStr == "GRAYA") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("If the selected model is Grayscale",
"<b><a href=\"https://en.wikipedia.org/wiki/Grayscale\">Grayscale</a></b> only allows for "
"gray values and transparent values. Grayscale images use half "
"the memory and disk space compared to an RGB image of the same bit-depth.<br/>"
"Grayscale is useful for inking and greyscale images. In "
"Krita, you can mix Grayscale and RGB layers in the same image.")+"</p>");
} else if (currentModelStr == "LABA") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("If the selected model is LAB",
"<b><a href=\"https://en.wikipedia.org/wiki/Lab_color_space\">L*a*b</a></b>. <b>L<b> stands for Lightness, "
"the <b>a</b> and <b>b</b> components represent color channels.<br/>"
"L*a*b is a special model for color correction. It is based on human perception, meaning that it "
"tries to encode the difference in lightness, red-green balance and yellow-blue balance. "
"This makes it useful for color correction, but the vast majority of color maths in the blending "
"modes do <b>not</b> work as expected here.<br/>"
"Similarly, Krita does not support HDR in LAB, meaning that HDR images converted to LAB lose color "
"information. This colorspace is <b>not</b> recommended for painting, nor for export, "
"but best as a space to do post-processing in. The TRC is assumed to be the L* TRC.")+"</p>");
} else if (currentModelStr == "YCbCrA") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("If the selected model is YCbCr",
"<b><a href=\"https://en.wikipedia.org/wiki/YCbCr\">YCbCr (Luma, Blue Chroma, Red Chroma)</a></b>, is a "
"model designed for video encoding. It is based on human perception, meaning that it tries to "
"encode the difference in lightness, red-green balance and yellow-blue balance. Chroma in "
"this case is then a word indicating a special type of saturation, in these cases the saturation "
"of Red and Blue, of which the desaturated equivalents are Green and Yellow respectively. It "
"is available to open up certain images correctly, but Krita does not currently ship a profile for "
"this due to lack of open source ICC profiles for YCrCb.")+"</p>");
}
QString currentDepthStr = d->colorSpaceSelector->cmbColorDepth->currentItem().id();
if (currentDepthStr == "U8") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("When the selected Bitdepth is 8",
"<b>8 bit integer</b>: The default amount of colors per channel. Each channel will have 256 values available, "
"leading to a total amount of 256*amount of channels. Recommended to use for images intended for the web, "
"or otherwise simple images.")+"</p>");
}
else if (currentDepthStr == "U16") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("When the selected Bitdepth is 16",
"<b>16 bit integer</b>: Also known as 'deep color'. 16 bit is ideal for editing images with a linear TRC, large "
"color space, or just when you need more precise color blending. This does take twice as much space on "
"the RAM and hard-drive than any given 8 bit image of the same properties, and for some devices it "
"takes much more processing power. We recommend watching the RAM usage of the file carefully, or "
"otherwise use 8 bit if your computer slows down. Take care to disable conversion optimization "
"when converting from 16 bit/channel to 8 bit/channel.")+"</p>");
}
else if (currentDepthStr == "F16") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("When the selected Bitdepth is 16 bit float",
"<b>16 bit floating point</b>: Also known as 'Half Floating Point', and the standard in VFX industry images. "
"16 bit float is ideal for editing images with a linear Tone Response Curve, large color space, or just when you need "
"more precise color blending. It being floating point is an absolute requirement for Scene Referred "
"(HDR) images. This does take twice as much space on the RAM and hard-drive than any given 8 bit image "
"of the same properties, and for some devices it takes much more processing power. We recommend watching "
"the RAM usage of the file carefully, or otherwise use 8 bit if your computer slows down.")+"</p>");
}
else if (currentDepthStr == "F32") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("When the selected Bitdepth is 32bit float",
"<b>32 bit float point</b>: Also known as 'Full Floating Point'. 32 bit float is ideal for editing images "
"with a linear TRC, large color space, or just when you need more precise color blending. It being "
"floating point is an absolute requirement for Scene Referred (HDR) images. This does take four times "
"as much space on the RAM and hard-drive than any given 8 bit image of the same properties, and for "
"some devices it takes much more processing power. We recommend watching the RAM usage of the file "
"carefully, or otherwise use 8 bit if your computer slows down.")+"</p>");
}
else if (currentDepthStr == "F64") {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("When the selected Bitdepth is 64bit float, but this isn't actually available in Krita at the moment.",\
"<b>64 bit float point</b>: 64 bit float is as precise as it gets in current technology, and this depth is used "
"most of the time for images that are generated or used as an input for software. It being floating point "
"is an absolute requirement for Scene Referred (HDR) images. This does take eight times as much space on "
"the RAM and hard-drive than any given 8 bit image of the same properties, and for some devices it takes "
"much more processing power. We recommend watching the RAM usage of the file carefully, or otherwise use "
"8 bit if your computer slows down.")+"</p>");
}
if (profileList.isEmpty()==false) {
QString possibleConversionIntents = "<p>"+i18n("The following conversion intents are possible: ")+"<ul>";
if (currentColorSpace()->profile()->supportsPerceptual()){
possibleConversionIntents += "<li>"+i18n("Perceptual")+"</li>";
}
if (currentColorSpace()->profile()->supportsRelative()){
possibleConversionIntents += "<li>"+i18n("Relative Colorimetric")+"</li>";
}
if (currentColorSpace()->profile()->supportsAbsolute()){
possibleConversionIntents += "<li>"+i18n("Absolute Colorimetric")+"</li>";
}
if (currentColorSpace()->profile()->supportsSaturation()){
possibleConversionIntents += "<li>"+i18n("Saturation")+"</li>";
}
possibleConversionIntents += "</ul></ul></p>";
d->colorSpaceSelector->textProfileDescription->append(possibleConversionIntents);
}
if (profileName.contains("-elle-")) {
d->colorSpaceSelector->textProfileDescription->append("<p>"+i18nc("These are Elle Stone's notes on her profiles that we ship.",
"<p><b>Extra notes on profiles by Elle Stone:</b></p>"
"<p><i>Krita comes with a number of high quality profiles created by "
"<a href=\"http://ninedegreesbelow.com\">Elle Stone</a>. This is a summary. Please check "
"<a href=\"http://ninedegreesbelow.com/photography/lcms-make-icc-profiles.html\">the full documentation</a> as well.</i></p>"));
if (profileName.contains("ACES-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>Quoting Wikipedia, 'Academy Color Encoding System (ACES) is a color image "
"encoding system proposed by the Academy of Motion Picture Arts and Sciences that will allow for "
"a fully encompassing color accurate workflow, with 'seamless interchange of high quality motion "
"picture images regardless of source'.</p>"));
}
if (profileName.contains("ACEScg-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>The ACEScg color space is smaller than the ACES color space, but large enough to contain the 'Rec-2020 gamut "
"and the DCI-P3 gamut', unlike the ACES color space it has no negative values and contains only few colors "
"that fall just barely outside the area of real colors humans can see</p>"));
}
if (profileName.contains("ClayRGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>To avoid possible copyright infringement issues, I used 'ClayRGB' (following ArgyllCMS) as the base name "
"for these profiles. As used below, 'Compatible with Adobe RGB 1998' is terminology suggested in the preamble "
"to the AdobeRGB 1998 color space specifications.</p><p>"
"The Adobe RGB 1998 color gamut covers a higher "
"percentage of real-world cyans, greens, and yellow-greens than sRGB, but still doesn't include all printable "
"cyans, greens, yellow-greens, especially when printing using today's high-end, wider gamut, ink jet printers. "
"BetaRGB (not included in the profile pack) and Rec.2020 are better matches for the color gamuts of today's "
"wide gamut printers.</p><p>"
"The Adobe RGB 1998 color gamut is a reasonable approximation to some of today's "
"high-end wide gamut monitors.</p>"));
}
if (profileName.contains("AllColorsRGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>This profile's color gamut is roughly the same size and shape as the ACES color space gamut, "
"and like the ACES color space, AllColorsRGB holds all possible real colors. But AllColorsRGB "
"actually has a slightly larger color gamut (to capture some fringe colors that barely qualify "
"as real when viewed by the standard observer) and uses the D50 white point.</p><p>"
"Just like the ACES color space, AllColorsRGB holds a high percentage of imaginary colors. See the Completely "
"<a href=\"http://ninedegreesbelow.com/photography/xyz-rgb.html\">"
"Painless Programmer's Guide to XYZ, RGB, ICC, xyY, and TRCs</a> for more information about imaginary "
"colors.</p><p>"
"There is no particular reason why anyone would want to use this profile "
"for editing, unless one needs to make sure your color space really does hold all "
"possible real colors.</p>"));
}
if (profileName.contains("CIERGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>This profile is included mostly for its historical significance. "
"It's the color space that was used in the original color matching experiments "
"that led to the creation of the XYZ reference color space.</p><p>"
"The ASTM E white point "
"is probably the right E white point to use when making the CIERGB color space profile. "
"It's not clear to me what the correct CIERGB primaries really are. "
"Lindbloom gives one set. The LCMS version 1 tutorial gives a different set. "
"Experts in the field contend that the real primaries "
"should be calculated from the spectral wavelengths, so I did.</p>"));
}
if (profileName.contains("IdentityRGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>The IdentityRGB working space is included in the profile pack because it's a mathematically "
"obvious way to include all possible visible colors, though it has a higher percentage of "
"imaginary colors than the ACES and AllColorsRGB color spaces. I cannot think of any reason "
"why you'd ever want to actually edit images in the IdentityRGB working space.</p>"));
}
if (profileName.contains("LargeRGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>To avoid possible copyright infringement issues, I used 'LargeRGB' (following RawTherapee) "
"as the base name for these profiles.<p>"
"Kodak designed the RIMM/ROMM (ProPhotoRGB) color "
"gamut to include all printable and most real world colors. It includes some imaginary colors "
"and excludes some of the real world blues and violet blues that can be captured by digital "
"cameras. It also excludes some very saturated 'camera-captured' yellows as interpreted by "
"some (and probably many) camera matrix input profiles.<p>"
"The ProPhotoRGB primaries are "
"hard-coded into Adobe products such as Lightroom and the Dng-DCP camera 'profiles'. However, "
"other than being large enough to hold a lot of colors, ProPhotoRGB has no particular merit "
"as an RGB working space. Personally and for most editing purposes, I recommend BetaRGB, Rec2020, "
"or the ACEScg profiles ProPhotoRGB.</p>"));
}
if (profileName.contains("Rec2020-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>Rec.2020 is the up-and-coming replacement for the thoroughly outdated sRGB color space. As of "
"June 2015, very few (if any) display devices (and certainly no affordable display devices) can "
"display all of Rec.2020. However, display technology is closing in on Rec.2020, movies are "
"already being made for Rec.2020, and various cameras offer support for Rec.2020. And in the "
"digital darkroom Rec.2020 is much more suitable as a general RGB working space than the "
"exceedingly small sRGB color space.</p>"));
}
if (profileName.contains("sRGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>Hewlett-Packard and Microsoft designed sRGB to match the color gamut of consumer-grade CRTs "
"from the 1990s. sRGB is the standard color space for the world wide web and is still the best "
"choice for exporting images to the internet.</p><p>"
"The sRGB color gamut was a good match to "
"calibrated decent quality CRTs. But sRGB is not a good match to many consumer-grade LCD monitors, "
"which often cannot display the more saturated sRGB blues and magentas (the good news: as technology "
"progresses, wider gamuts are trickling down to consumer grade monitors).</p><p>"
"Printer color gamuts can easily exceed the sRGB color gamut in cyans, greens, and yellow-greens. Colors from interpolated "
"camera raw files also often exceed the sRGB color gamut.</p><p>"
"As a very relevant aside, using perceptual "
"intent when converting to sRGB does not magically makes otherwise out of gamut colors fit inside the "
"sRGB color gamut! The standard sRGB color space (along with all the other the RGB profiles provided "
"in my profile pack) is a matrix profile, and matrix profiles don't have perceptual intent tables.</p>"));
}
if (profileName.contains("WideRGB-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>To avoid possible copyright infringement issues, I used 'WideRGB' as the base name for these profiles.</p><p>"
"WideGamutRGB was designed by Adobe to be a wide gamut color space that uses spectral colors "
"as its primaries. Pascale's primary values produce a profile that matches old V2 Widegamut profiles "
"from Adobe and Canon. It is an interesting color space, but shortly after its introduction, Adobe "
"switched their emphasis to the ProPhotoRGB color space.</p>"));
}
if (profileName.contains("Gray-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>These profiles are for use with RGB images that have been converted to monotone gray (black and white). "
"The main reason to convert from RGB to Gray is to save the file space needed to encode the image. "
"Google places a premium on fast-loading web pages, and images are one of the slower-loading elements "
"of a web page. So converting black and white images to Grayscale images does save some kilobytes. "
" For grayscale images uploaded to the internet, convert the image to the V2 Gray profile with the sRGB TRC.</p>"));
}
if (profileName.contains("-g10")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>The profiles that end in '-g10.icc' are linear gamma (gamma=1.0, 'linear light', etc) profiles and "
"should only be used when editing at high bit depths (16-bit floating point, 16-bit integer, 32-bit "
"floating point, 32-bit integer). Many editing operations produce better results in linear gamma color "
"spaces.</p>"));
}
if (profileName.contains("-labl")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>The profiles that end in '-labl.icc' have perceptually uniform TRCs. A few editing operations really "
"should be done on perceptually uniform RGB. Make sure you use the V4 versions for editing high bit depth "
"images.</p>"));
}
if (profileName.contains("-srgbtrc") || profileName.contains("-g22") || profileName.contains("-g18") || profileName.contains("-bt709")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>The profiles that end in '-srgbtrc.icc', '-g22.icc', and '-bt709.icc' have approximately but not exactly "
"perceptually uniform TRCs. ProPhotoRGB's gamma=1.8 TRC is not quite as close to being perceptually uniform.</p>"));
}
if (d->colorSpaceSelector->cmbColorDepth->currentItem().id()=="U8") {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>When editing 8-bit images, you should use a profile with a small color gamut and an approximately or "
"exactly perceptually uniform TRC. Of the profiles supplied in my profile pack, only the sRGB and AdobeRGB1998 "
"(ClayRGB) color spaces are small enough for 8-bit editing. Even with the AdobeRGB1998 color space you need to "
"be careful to not cause posterization. And of course you cannot use the linear gamma versions of these profiles "
"for 8-bit editing.</p>"));
}
if (profileName.contains("-V4-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>Use V4 profiles for editing images using high bit depth image editors that use LCMS as the Color Management Module. "
"This includes Krita, digiKam/showFoto, and GIMP 2.9.</p>"));
}
if (profileName.contains("-V2-")) {
d->colorSpaceSelector->textProfileDescription->append(i18nc("From Elle's notes.",
"<p>Use V2 profiles for exporting finished images to be uploaded to the web or for use with imaging software that "
"cannot read V4 profiles.</p>"));
}
}
d->colorSpaceSelector->textProfileDescription->moveCursor(QTextCursor::Start);
}
QString KisAdvancedColorSpaceSelector::nameWhitePoint(QVector <double> whitePoint) {
QString name=(QString::number(whitePoint[0]) + ", " + QString::number(whitePoint[1], 'f', 4));
//A (0.451170, 0.40594) (2856K)(tungsten)
if ((whitePoint[0]>0.451170-0.005 && whitePoint[0]<0.451170 + 0.005) &&
(whitePoint[1]>0.40594-0.005 && whitePoint[1]<0.40594 + 0.005)){
name="A";
return name;
}
//B (0.34980, 0.35270) (4874K) (Direct Sunlight at noon)(obsolete)
//C (0.31039, 0.31905) (6774K) (avarage/north sky daylight)(obsolete)
//D50 (0.34773, 0.35952) (5003K) (Horizon Light, default color of white paper, ICC profile standard illuminant)
if ((whitePoint[0]>0.34773-0.005 && whitePoint[0]<0.34773 + 0.005) &&
(whitePoint[1]>0.35952-0.005 && whitePoint[1]<0.35952 + 0.005)){
name="D50";
return name;
}
//D55 (0.33411, 0.34877) (5503K) (Mid-morning / Mid-afternoon Daylight)
if ((whitePoint[0]>0.33411-0.001 && whitePoint[0]<0.33411 + 0.001) &&
(whitePoint[1]>0.34877-0.005 && whitePoint[1]<0.34877 + 0.005)){
name="D55";
return name;
}
//D60 (0.3217, 0.3378) (~6000K) (ACES colorspace default)
if ((whitePoint[0]>0.3217-0.001 && whitePoint[0]<0.3217 + 0.001) &&
(whitePoint[1]>0.3378-0.005 && whitePoint[1]<0.3378 + 0.005)){
name="D60";
return name;
}
//D65 (0.31382, 0.33100) (6504K) (Noon Daylight, default for computer and tv screens, sRGB default)
//Elle's are old school with 0.3127 and 0.3289
if ((whitePoint[0]>0.31382-0.002 && whitePoint[0]<0.31382 + 0.002) &&
(whitePoint[1]>0.33100-0.005 && whitePoint[1]<0.33100 + 0.002)){
name="D65";
return name;
}
//D75 (0.29968, 0.31740) (7504K) (North sky Daylight)
if ((whitePoint[0]>0.29968-0.001 && whitePoint[0]<0.29968 + 0.001) &&
(whitePoint[1]>0.31740-0.005 && whitePoint[1]<0.31740 + 0.005)){
name="D75";
return name;
}
//E (1/3, 1/3) (5454K) (Equal Energy. CIERGB default)
if ((whitePoint[0]>(1.0/3.0)-0.001 && whitePoint[0]<(1.0/3.0) + 0.001) &&
(whitePoint[1]>(1.0/3.0)-0.001 && whitePoint[1]<(1.0/3.0) + 0.001)){
name="E";
return name;
}
//The F series seems to sorta overlap with the D series, so I'll just leave them in comment here.//
//F1 (0.31811, 0.33559) (6430K) (Daylight Fluorescent)
//F2 (0.37925, 0.36733) (4230K) (Cool White Fluorescent)
//F3 (0.41761, 0.38324) (3450K) (White Florescent)
//F4 (0.44920, 0.39074) (2940K) (Warm White Fluorescent)
//F5 (0.31975, 0.34246) (6350K) (Daylight Fluorescent)
//F6 (0.38660, 0.37847) (4150K) (Lite White Fluorescent)
//F7 (0.31569, 0.32960) (6500K) (D65 simulator, Daylight simulator)
//F8 (0.34902, 0.35939) (5000K) (D50 simulator)
//F9 (0.37829, 0.37045) (4150K) (Cool White Deluxe Fluorescent)
//F10 (0.35090, 0.35444) (5000K) (Philips TL85, Ultralume 50)
//F11 (0.38541, 0.37123) (4000K) (Philips TL84, Ultralume 40)
//F12 (0.44256, 0.39717) (3000K) (Philips TL83, Ultralume 30)
return name;
}
const KoColorSpace* KisAdvancedColorSpaceSelector::currentColorSpace()
{
QString check = "";
if (d->colorSpaceSelector->lstProfile->currentItem()) {
check = d->colorSpaceSelector->lstProfile->currentItem()->text();
} else if (d->colorSpaceSelector->lstProfile->item(0)) {
check = d->colorSpaceSelector->lstProfile->item(0)->text();
}
return KoColorSpaceRegistry::instance()->colorSpace(d->colorSpaceSelector->cmbColorModels->currentItem().id(),
d->colorSpaceSelector->cmbColorDepth->currentItem().id(),
check);
}
void KisAdvancedColorSpaceSelector::setCurrentColorModel(const KoID& id)
{
d->colorSpaceSelector->cmbColorModels->setCurrent(id);
fillLstProfiles();
fillCmbDepths(id);
}
void KisAdvancedColorSpaceSelector::setCurrentColorDepth(const KoID& id)
{
d->colorSpaceSelector->cmbColorDepth->setCurrent(id);
fillLstProfiles();
}
void KisAdvancedColorSpaceSelector::setCurrentProfile(const QString& name)
{
QList<QListWidgetItem *> Items= d->colorSpaceSelector->lstProfile->findItems(name, Qt::MatchStartsWith);
d->colorSpaceSelector->lstProfile->setCurrentItem(Items.at(0));
}
void KisAdvancedColorSpaceSelector::setCurrentColorSpace(const KoColorSpace* colorSpace)
{
if (!colorSpace) {
return;
}
setCurrentColorModel(colorSpace->colorModelId());
setCurrentColorDepth(colorSpace->colorDepthId());
setCurrentProfile(colorSpace->profile()->name());
}
void KisAdvancedColorSpaceSelector::colorSpaceChanged()
{
bool valid = d->colorSpaceSelector->lstProfile->count() != 0;
emit(selectionChanged(valid));
if (valid) {
emit colorSpaceChanged(currentColorSpace());
}
}
void KisAdvancedColorSpaceSelector::installProfile()
{
KoFileDialog dialog(this, KoFileDialog::OpenFiles, "OpenDocumentICC");
dialog.setCaption(i18n("Install Color Profiles"));
dialog.setDefaultDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
dialog.setMimeTypeFilters(QStringList() << "application/vnd.iccprofile", "application/vnd.iccprofile");
QStringList profileNames = dialog.filenames();
KoColorSpaceEngine *iccEngine = KoColorSpaceEngineRegistry::instance()->get("icc");
Q_ASSERT(iccEngine);
QString saveLocation = KoResourcePaths::saveLocation("icc_profiles");
Q_FOREACH (const QString &profileName, profileNames) {
QUrl file(profileName);
if (!QFile::copy(profileName, saveLocation + file.fileName())) {
dbgKrita << "Could not install profile!";
return;
}
iccEngine->addProfile(saveLocation + file.fileName());
}
fillLstProfiles();
}
diff --git a/libs/ui/widgets/kis_advanced_color_space_selector.h b/libs/ui/widgets/kis_advanced_color_space_selector.h
index a457385b66..0cad4dd6fe 100644
--- a/libs/ui/widgets/kis_advanced_color_space_selector.h
+++ b/libs/ui/widgets/kis_advanced_color_space_selector.h
@@ -1,63 +1,63 @@
/*
* Copyright (C) 2007 Cyrille Berger <cberger@cberger.net>
* Copyright (C) 2011 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ADVANCED_COLOR_SPACE_SELECTOR_H_
#define _KIS_ADVANCED_COLOR_SPACE_SELECTOR_H_
#include <QWidget>
#include <QDialog>
#include "kritaui_export.h"
#include "ui_wdgcolorspaceselectoradvanced.h"
class KoID;
class KoColorSpace;
/* Use KisColorSpaceSelector instead of directly using this one*/
class KRITAUI_EXPORT KisAdvancedColorSpaceSelector : public QDialog
{
Q_OBJECT
public:
KisAdvancedColorSpaceSelector(QWidget* parent, const QString &caption);
- ~KisAdvancedColorSpaceSelector();
+ ~KisAdvancedColorSpaceSelector() override;
const KoColorSpace* currentColorSpace();
void setCurrentColorModel(const KoID& id);
void setCurrentColorDepth(const KoID& id);
void setCurrentProfile(const QString& name);
void setCurrentColorSpace(const KoColorSpace* colorSpace);
Q_SIGNALS:
void selectionChanged(bool valid);
void colorSpaceChanged(const KoColorSpace*);
private Q_SLOTS:
void fillCmbDepths(const KoID& idd);
void fillLstProfiles();
void fillDescription();
QString nameWhitePoint(QVector <double> whitePoint);
void colorSpaceChanged();
void installProfile();
private:
struct Private;
Private * const d;
};
#endif
diff --git a/libs/ui/widgets/kis_categorized_list_view.h b/libs/ui/widgets/kis_categorized_list_view.h
index 06f2c4910e..4c71591774 100644
--- a/libs/ui/widgets/kis_categorized_list_view.h
+++ b/libs/ui/widgets/kis_categorized_list_view.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CATEGORIZED_LIST_VIEW_H_
#define KIS_CATEGORIZED_LIST_VIEW_H_
#include <kritaui_export.h>
#include <QListView>
#include <QListWidget>
class KRITAUI_EXPORT KisCategorizedListView: public QListView
{
Q_OBJECT
public:
KisCategorizedListView(bool useCheckBoxHack=false, QWidget* parent=0);
- virtual ~KisCategorizedListView();
- virtual void setModel(QAbstractItemModel* model);
+ ~KisCategorizedListView() override;
+ void setModel(QAbstractItemModel* model) override;
- QSize sizeHint() const;
+ QSize sizeHint() const override;
Q_SIGNALS:
void sigCategoryToggled(const QModelIndex& index, bool toggled);
void sigEntryChecked(const QModelIndex& index);
void rightClickedMenuDropSettingsTriggered();
void rightClickedMenuSaveSettingsTriggered();
protected Q_SLOTS:
void slotIndexChanged(const QModelIndex& index);
- virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int> &roles = QVector<int>());
- virtual void rowsInserted(const QModelIndex& parent, int start, int end);
- virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
+ void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int> &roles = QVector<int>()) override;
+ void rowsInserted(const QModelIndex& parent, int start, int end) override;
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
private:
void updateRows(int begin, int end);
private:
bool m_useCheckBoxHack;
};
#endif // KIS_CATEGORIZED_LIST_VIEW_H_
diff --git a/libs/ui/widgets/kis_cie_tongue_widget.cpp b/libs/ui/widgets/kis_cie_tongue_widget.cpp
index 9afa11441f..b255f47489 100644
--- a/libs/ui/widgets/kis_cie_tongue_widget.cpp
+++ b/libs/ui/widgets/kis_cie_tongue_widget.cpp
@@ -1,737 +1,735 @@
/*
* Copyright (C) 2015 by Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* Based on the Digikam CIE Tongue widget
* Copyright (C) 2006-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* Any source code are inspired from lprof project and
* Copyright (C) 1998-2001 Marti Maria
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
The following table gives the CIE color matching functions
\f$\bar{x}(\lambda)\f$, \f$\bar{y}(\lambda)\f$, and
\f$\bar{z}(\lambda)\f$, for wavelengths \f$\lambda\f$ at 5 nanometer
increments from 380 nm through 780 nm. This table is used in conjunction
with Planck's law for the energy spectrum of a black body at a given
temperature to plot the black body curve on the CIE chart.
The following table gives the spectral chromaticity co-ordinates
\f$x(\lambda)\f$ and \f$y(\lambda)\f$ for wavelengths in 5 nanometer
increments from 380 nm through 780 nm. These coordinates represent the
position in the CIE x-y space of pure spectral colors of the given
wavelength, and thus define the outline of the CIE "tongue" diagram.
*/
#include <QPointF>
#include <QPainter>
#include <QFile>
#include <QTimer>
#include <QPaintEvent>
#include <QImage>
#include <cmath>
#include <klocalizedstring.h>
#include <kpixmapsequence.h>
#include <kis_icon.h>
#include <KoColorSpaceRegistry.h>
#include "kis_cie_tongue_widget.h"
static const double spectral_chromaticity[81][3] =
{
{ 0.1741, 0.0050 }, // 380 nm
{ 0.1740, 0.0050 },
{ 0.1738, 0.0049 },
{ 0.1736, 0.0049 },
{ 0.1733, 0.0048 },
{ 0.1730, 0.0048 },
{ 0.1726, 0.0048 },
{ 0.1721, 0.0048 },
{ 0.1714, 0.0051 },
{ 0.1703, 0.0058 },
{ 0.1689, 0.0069 },
{ 0.1669, 0.0086 },
{ 0.1644, 0.0109 },
{ 0.1611, 0.0138 },
{ 0.1566, 0.0177 },
{ 0.1510, 0.0227 },
{ 0.1440, 0.0297 },
{ 0.1355, 0.0399 },
{ 0.1241, 0.0578 },
{ 0.1096, 0.0868 },
{ 0.0913, 0.1327 },
{ 0.0687, 0.2007 },
{ 0.0454, 0.2950 },
{ 0.0235, 0.4127 },
{ 0.0082, 0.5384 },
{ 0.0039, 0.6548 },
{ 0.0139, 0.7502 },
{ 0.0389, 0.8120 },
{ 0.0743, 0.8338 },
{ 0.1142, 0.8262 },
{ 0.1547, 0.8059 },
{ 0.1929, 0.7816 },
{ 0.2296, 0.7543 },
{ 0.2658, 0.7243 },
{ 0.3016, 0.6923 },
{ 0.3373, 0.6589 },
{ 0.3731, 0.6245 },
{ 0.4087, 0.5896 },
{ 0.4441, 0.5547 },
{ 0.4788, 0.5202 },
{ 0.5125, 0.4866 },
{ 0.5448, 0.4544 },
{ 0.5752, 0.4242 },
{ 0.6029, 0.3965 },
{ 0.6270, 0.3725 },
{ 0.6482, 0.3514 },
{ 0.6658, 0.3340 },
{ 0.6801, 0.3197 },
{ 0.6915, 0.3083 },
{ 0.7006, 0.2993 },
{ 0.7079, 0.2920 },
{ 0.7140, 0.2859 },
{ 0.7190, 0.2809 },
{ 0.7230, 0.2770 },
{ 0.7260, 0.2740 },
{ 0.7283, 0.2717 },
{ 0.7300, 0.2700 },
{ 0.7311, 0.2689 },
{ 0.7320, 0.2680 },
{ 0.7327, 0.2673 },
{ 0.7334, 0.2666 },
{ 0.7340, 0.2660 },
{ 0.7344, 0.2656 },
{ 0.7346, 0.2654 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 },
{ 0.7347, 0.2653 } // 780 nm
};
class Q_DECL_HIDDEN KisCIETongueWidget::Private
{
public:
Private() :
profileDataAvailable(false),
needUpdatePixmap(false),
cieTongueNeedsUpdate(true),
uncalibratedColor(false),
xBias(0),
yBias(0),
pxcols(0),
pxrows(0),
progressCount(0),
gridside(0),
progressTimer(0),
Primaries(9),
whitePoint(3)
{
progressPix = KPixmapSequence("process-working", KisIconUtils::SizeSmallMedium);
}
bool profileDataAvailable;
bool needUpdatePixmap;
bool cieTongueNeedsUpdate;
bool uncalibratedColor;
int xBias;
int yBias;
int pxcols;
int pxrows;
int progressCount; // Position of animation during loading/calculation.
double gridside;
QPainter painter;
QTimer* progressTimer;
QPixmap pixmap;
QPixmap cietongue;
QPixmap gamutMap;
KPixmapSequence progressPix;
QVector <double> Primaries;
QVector <double> whitePoint;
QPolygonF gamut;
model colorModel;
};
KisCIETongueWidget::KisCIETongueWidget(QWidget *parent) :
QWidget(parent), d(new Private)
{
d->progressTimer = new QTimer(this);
setAttribute(Qt::WA_DeleteOnClose);
d->Primaries.resize(9);
d->Primaries.fill(0.0);
d->whitePoint.resize(3);
d->whitePoint<<0.34773<<0.35952<<1.0;
d->gamut = QPolygonF();
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
}
KisCIETongueWidget::~KisCIETongueWidget()
{
delete d;
}
int KisCIETongueWidget::grids(double val) const
{
return (int) floor(val * d->gridside + 0.5);
}
void KisCIETongueWidget::setProfileData(QVector <double> p, QVector <double> w, bool profileData)
{
d->profileDataAvailable = profileData;
if (profileData){
d->Primaries= p;
d->whitePoint = w;
d->needUpdatePixmap = true;
} else {
return;
}
}
void KisCIETongueWidget::setGamut(QPolygonF gamut)
{
d->gamut=gamut;
}
void KisCIETongueWidget::setRGBData(QVector <double> whitepoint, QVector <double> colorants)
{
if (colorants.size()==9){
d->Primaries= colorants;
d->whitePoint = whitepoint;
d->needUpdatePixmap = true;
d->colorModel = KisCIETongueWidget::RGBA;
d->profileDataAvailable = true;
} else {
return;
}
}
void KisCIETongueWidget::setCMYKData(QVector <double> whitepoint)
{
if (whitepoint.size()==3){
//d->Primaries= colorants;
d->whitePoint = whitepoint;
d->needUpdatePixmap = true;
d->colorModel = KisCIETongueWidget::CMYKA;
d->profileDataAvailable = true;
} else {
return;
}
}
void KisCIETongueWidget::setXYZData(QVector <double> whitepoint)
{
if (whitepoint.size()==3){
d->whitePoint = whitepoint;
d->needUpdatePixmap = true;
d->colorModel = KisCIETongueWidget::XYZA;
d->profileDataAvailable = true;
} else {
return;
}
}
void KisCIETongueWidget::setGrayData(QVector <double> whitepoint)
{
if (whitepoint.size()==3){
d->whitePoint = whitepoint;
d->needUpdatePixmap = true;
d->colorModel = KisCIETongueWidget::GRAYA;
d->profileDataAvailable = true;
} else {
return;
}
}
void KisCIETongueWidget::setLABData(QVector <double> whitepoint)
{
if (whitepoint.size()==3){
d->whitePoint = whitepoint;
d->needUpdatePixmap = true;
d->colorModel = KisCIETongueWidget::LABA;
d->profileDataAvailable = true;
} else {
return;
}
}
void KisCIETongueWidget::setYCbCrData(QVector <double> whitepoint)
{
if (whitepoint.size()==3){
d->whitePoint = whitepoint;
d->needUpdatePixmap = true;
d->colorModel = KisCIETongueWidget::YCbCrA;
d->profileDataAvailable = true;
} else {
return;
}
}
void KisCIETongueWidget::setProfileDataAvailable(bool dataAvailable)
{
d->profileDataAvailable = dataAvailable;
}
void KisCIETongueWidget::mapPoint(int& icx, int& icy, QPointF xy)
{
icx = (int) floor((xy.x() * (d->pxcols - 1)) + .5);
icy = (int) floor(((d->pxrows - 1) - xy.y() * (d->pxrows - 1)) + .5);
}
void KisCIETongueWidget::biasedLine(int x1, int y1, int x2, int y2)
{
d->painter.drawLine(x1 + d->xBias, y1, x2 + d->xBias, y2);
}
void KisCIETongueWidget::biasedText(int x, int y, const QString& txt)
{
d->painter.drawText(QPoint(d->xBias + x, y), txt);
}
QRgb KisCIETongueWidget::colorByCoord(double x, double y)
{
// Get xyz components scaled from coordinates
double cx = ((double) x) / (d->pxcols - 1);
double cy = 1.0 - ((double) y) / (d->pxrows - 1);
double cz = 1.0 - cx - cy;
// Project xyz to XYZ space. Note that in this
// particular case we are substituting XYZ with xyz
//Need to use KoColor here.
- QString space = KoColorSpaceRegistry::instance()->colorSpaceId("XYZA", "U8");
- QString profile = KoColorSpaceRegistry::instance()->colorSpaceFactory(space)->defaultProfile();
- const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "U8", profile);
+ const KoColorSpace* xyzColorSpace = KoColorSpaceRegistry::instance()->colorSpace("XYZA", "U8");
quint8 data[4];
data[0]= cx*255;
data[1]= cy*255;
data[2]= cz*255;
data[3]= 1.0*255;
KoColor colXYZ(data, xyzColorSpace);
QColor colRGB = colXYZ.toQColor();
return qRgb(colRGB.red(), colRGB.green(), colRGB.blue());
}
void KisCIETongueWidget::outlineTongue()
{
int lx=0, ly=0;
int fx=0, fy=0;
for (int x = 380; x <= 700; x += 5)
{
int ix = (x - 380) / 5;
QPointF * p = new QPointF(spectral_chromaticity[ix][0], spectral_chromaticity[ix][1]);
int icx, icy;
mapPoint(icx, icy, * p);
if (x > 380)
{
biasedLine(lx, ly, icx, icy);
}
else
{
fx = icx;
fy = icy;
}
lx = icx;
ly = icy;
}
biasedLine(lx, ly, fx, fy);
}
void KisCIETongueWidget::fillTongue()
{
QImage Img = d->cietongue.toImage();
int x;
for (int y = 0; y < d->pxrows; ++y)
{
int xe = 0;
// Find horizontal extents of tongue on this line.
for (x = 0; x < d->pxcols; ++x)
{
if (QColor(Img.pixel(x + d->xBias, y)) != QColor(Qt::black))
{
for (xe = d->pxcols - 1; xe >= x; --xe)
{
if (QColor(Img.pixel(xe + d->xBias, y)) != QColor(Qt::black))
{
break;
}
}
break;
}
}
if (x < d->pxcols)
{
for ( ; x <= xe; ++x)
{
QRgb Color = colorByCoord(x, y);
Img.setPixel(x + d->xBias, y, Color);
}
}
}
d->cietongue = QPixmap::fromImage(Img, Qt::AvoidDither);
}
void KisCIETongueWidget::drawTongueAxis()
{
QFont font;
font.setPointSize(6);
d->painter.setFont(font);
d->painter.setPen(qRgb(255, 255, 255));
biasedLine(0, 0, 0, d->pxrows - 1);
biasedLine(0, d->pxrows-1, d->pxcols-1, d->pxrows - 1);
for (int y = 1; y <= 9; y += 1)
{
QString s;
int xstart = (y * (d->pxcols - 1)) / 10;
int ystart = (y * (d->pxrows - 1)) / 10;
s.sprintf("0.%d", y);
biasedLine(xstart, d->pxrows - grids(1), xstart, d->pxrows - grids(4));
biasedText(xstart - grids(11), d->pxrows + grids(15), s);
s.sprintf("0.%d", 10 - y);
biasedLine(0, ystart, grids(3), ystart);
biasedText(grids(-25), ystart + grids(5), s);
}
}
void KisCIETongueWidget::drawTongueGrid()
{
d->painter.setPen(qRgb(128, 128, 128));
d->painter.setOpacity(0.5);
for (int y = 1; y <= 9; y += 1)
{
int xstart = (y * (d->pxcols - 1)) / 10;
int ystart = (y * (d->pxrows - 1)) / 10;
biasedLine(xstart, grids(4), xstart, d->pxrows - grids(4) - 1);
biasedLine(grids(7), ystart, d->pxcols-1-grids(7), ystart);
}
d->painter.setOpacity(1.0);
}
void KisCIETongueWidget::drawLabels()
{
QFont font;
font.setPointSize(5);
d->painter.setFont(font);
for (int x = 450; x <= 650; x += (x > 470 && x < 600) ? 5 : 10)
{
QString wl;
int bx = 0, by = 0, tx, ty;
if (x < 520)
{
bx = grids(-22);
by = grids(2);
}
else if (x < 535)
{
bx = grids(-8);
by = grids(-6);
}
else
{
bx = grids(4);
}
int ix = (x - 380) / 5;
QPointF * p = new QPointF(spectral_chromaticity[ix][0],
spectral_chromaticity[ix][1]);
int icx, icy;
mapPoint(icx, icy, * p);
tx = icx + ((x < 520) ? grids(-2) : ((x >= 535) ? grids(2) : 0));
ty = icy + ((x < 520) ? 0 : ((x >= 535) ? grids(-1) : grids(-2)));
d->painter.setPen(qRgb(255, 255, 255));
biasedLine(icx, icy, tx, ty);
QRgb Color = colorByCoord(icx, icy);
d->painter.setPen(Color);
wl.sprintf("%d", x);
biasedText(icx+bx, icy+by, wl);
}
}
void KisCIETongueWidget::drawSmallElipse(QPointF xy, int r, int g, int b, int sz)
{
int icx, icy;
mapPoint(icx, icy, xy);
d->painter.save();
d->painter.setRenderHint(QPainter::Antialiasing);
d->painter.setPen(qRgb(r, g, b));
d->painter.drawEllipse(icx + d->xBias- sz/2, icy-sz/2, sz, sz);
d->painter.setPen(qRgb(r/2, g/2, b/2));
int sz2 = sz-2;
d->painter.drawEllipse(icx + d->xBias- sz2/2, icy-sz2/2, sz2, sz2);
d->painter.restore();
}
void KisCIETongueWidget::drawColorantTriangle()
{
d->painter.save();
d->painter.setPen(qRgb(80, 80, 80));
d->painter.setRenderHint(QPainter::Antialiasing);
if (d->colorModel ==KisCIETongueWidget::RGBA) {
drawSmallElipse((QPointF(d->Primaries[0],d->Primaries[1])), 255, 128, 128, 6);
drawSmallElipse((QPointF(d->Primaries[3],d->Primaries[4])), 128, 255, 128, 6);
drawSmallElipse((QPointF(d->Primaries[6],d->Primaries[7])), 128, 128, 255, 6);
int x1, y1, x2, y2, x3, y3;
mapPoint(x1, y1, (QPointF(d->Primaries[0],d->Primaries[1])) );
mapPoint(x2, y2, (QPointF(d->Primaries[3],d->Primaries[4])) );
mapPoint(x3, y3, (QPointF(d->Primaries[6],d->Primaries[7])) );
biasedLine(x1, y1, x2, y2);
biasedLine(x2, y2, x3, y3);
biasedLine(x3, y3, x1, y1);
} /*else if (d->colorModel ==CMYK){
for (i=0; i<d->Primaries.size();i+++){
drawSmallElipse((QPointF(d->Primaries[0],d->Primaries[1])), 160, 160, 160, 6);//greyscale for now
//int x1, y1, x2, y2;
//mapPoint(x1, y1, (QPointF(d->Primaries[i],d->Primaries[i+1])) );
//mapPoint(x2, y2, (QPointF(d->Primaries[i+3],d->Primaries[i+4])) );
//biasedLine(x1, y1, x2, y2);
}
}
*/
d->painter.restore();
}
void KisCIETongueWidget::drawWhitePoint()
{
drawSmallElipse(QPointF (d->whitePoint[0],d->whitePoint[1]), 255, 255, 255, 8);
}
void KisCIETongueWidget::drawGamut()
{
d->gamutMap=QPixmap(size());
d->gamutMap.fill(Qt::black);
QPainter gamutPaint;
gamutPaint.begin(&d->gamutMap);
QPainterPath path;
//gamutPaint.setCompositionMode(QPainter::CompositionMode_Clear);
gamutPaint.setRenderHint(QPainter::Antialiasing);
path.setFillRule(Qt::WindingFill);
gamutPaint.setBrush(Qt::white);
gamutPaint.setPen(Qt::white);
int x, y = 0;
if (!d->gamut.empty()) {
gamutPaint.setOpacity(0.5);
if (d->colorModel == KisCIETongueWidget::RGBA) {
mapPoint(x, y, (QPointF(d->Primaries[0],d->Primaries[1])) );
path.moveTo(QPointF(x + d->xBias,y));
mapPoint(x, y, (QPointF(d->Primaries[3],d->Primaries[4])) );
path.lineTo(QPointF(x + d->xBias,y));
mapPoint(x, y, (QPointF(d->Primaries[6],d->Primaries[7])) );
path.lineTo(QPointF(x + d->xBias,y));
mapPoint(x, y, (QPointF(d->Primaries[0],d->Primaries[1])) );
path.lineTo(QPointF(x + d->xBias,y));
}
gamutPaint.drawPath(path);
gamutPaint.setOpacity(1.0);
foreach (QPointF Point, d->gamut) {
mapPoint(x, y, Point);
gamutPaint.drawEllipse(x + d->xBias- 2, y-2, 4, 4);
//Point.setX(x);
//Point.setY(y);
//path.lineTo(Point);
}
}
gamutPaint.end();
d->painter.save();
d->painter.setOpacity(0.5);
d->painter.setCompositionMode(QPainter::CompositionMode_Multiply);
QRect area(d->xBias, 0, d->pxcols, d->pxrows);
d->painter.drawPixmap(area,d->gamutMap, area);
d->painter.setOpacity(1.0);
d->painter.restore();
}
void KisCIETongueWidget::updatePixmap()
{
d->needUpdatePixmap = false;
d->pixmap = QPixmap(size());
if (d->cieTongueNeedsUpdate){
// Draw the CIE tongue curve. I don't see why we need to redraw it every time the whitepoint and such changes so we cache it.
d->cieTongueNeedsUpdate = false;
d->cietongue = QPixmap(size());
d->cietongue.fill(Qt::black);
d->painter.begin(&d->cietongue);
int pixcols = d->pixmap.width();
int pixrows = d->pixmap.height();
d->gridside = (qMin(pixcols, pixrows)) / 512.0;
d->xBias = grids(32);
d->yBias = grids(20);
d->pxcols = pixcols - d->xBias;
d->pxrows = pixrows - d->yBias;
d->painter.setBackground(QBrush(qRgb(0, 0, 0)));
d->painter.setPen(qRgb(255, 255, 255));
outlineTongue();
d->painter.end();
fillTongue();
d->painter.begin(&d->cietongue);
drawTongueAxis();
drawLabels();
drawTongueGrid();
d->painter.end();
}
d->pixmap = d->cietongue;
d->painter.begin(&d->pixmap);
//draw whitepoint and colorants
if (d->whitePoint[2] > 0.0)
{
drawWhitePoint();
}
if (d->Primaries[2] != 0.0)
{
drawColorantTriangle();
}
drawGamut();
d->painter.end();
}
void KisCIETongueWidget::paintEvent(QPaintEvent*)
{
QPainter p(this);
// Widget is disable : drawing grayed frame.
if ( !isEnabled() )
{
p.fillRect(0, 0, width(), height(),
palette().color(QPalette::Disabled, QPalette::Background));
QPen pen(palette().color(QPalette::Disabled, QPalette::Foreground));
pen.setStyle(Qt::SolidLine);
pen.setWidth(1);
p.setPen(pen);
p.drawRect(0, 0, width(), height());
return;
}
// No profile data to show, or RAW file
if (!d->profileDataAvailable)
{
p.fillRect(0, 0, width(), height(), palette().color(QPalette::Active, QPalette::Background));
QPen pen(palette().color(QPalette::Active, QPalette::Text));
pen.setStyle(Qt::SolidLine);
pen.setWidth(1);
p.setPen(pen);
p.drawRect(0, 0, width(), height());
if (d->uncalibratedColor)
{
p.drawText(0, 0, width(), height(), Qt::AlignCenter,
i18n("Uncalibrated color space"));
}
else
{
p.setPen(Qt::red);
p.drawText(0, 0, width(), height(), Qt::AlignCenter,
i18n("No profile available..."));
}
return;
}
// Create CIE tongue if needed
if (d->needUpdatePixmap)
{
updatePixmap();
}
// draw prerendered tongue
p.drawPixmap(0, 0, d->pixmap);
}
void KisCIETongueWidget::resizeEvent(QResizeEvent* event)
{
Q_UNUSED(event);
setMinimumHeight(width());
setMaximumHeight(width());
d->needUpdatePixmap = true;
d->cieTongueNeedsUpdate = true;
}
void KisCIETongueWidget::slotProgressTimerDone()
{
update();
d->progressTimer->start(200);
}
diff --git a/libs/ui/widgets/kis_cie_tongue_widget.h b/libs/ui/widgets/kis_cie_tongue_widget.h
index 8822793348..7b41a63e48 100644
--- a/libs/ui/widgets/kis_cie_tongue_widget.h
+++ b/libs/ui/widgets/kis_cie_tongue_widget.h
@@ -1,106 +1,106 @@
/*
* Copyright (C) 2015 by Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* Based on the Digikam CIE Tongue widget
* Copyright (C) 2006-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* Any source code are inspired from lprof project and
* Copyright (C) 1998-2001 Marti Maria
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef KIS_CIETONGUEWIDGET_H
#define KIS_CIETONGUEWIDGET_H
// Qt includes
#include <QWidget>
#include <QColor>
#include <QPaintEvent>
// KDE includes
#include <KoColor.h>
#include <KoColorSpace.h>
#include <kritaui_export.h>
class KRITAUI_EXPORT KisCIETongueWidget : public QWidget
{
Q_OBJECT
public:
KisCIETongueWidget(QWidget *parent=0);
- ~KisCIETongueWidget();
+ ~KisCIETongueWidget() override;
//this expects a qvector <double> (9), qvector <double> (3) and whether or not there's profile data?;
void setProfileData(QVector <double> p, QVector <double> w, bool profileData = false);
void setGamut(QPolygonF gamut);
void setRGBData(QVector <double> whitepoint, QVector <double> colorants);
void setCMYKData(QVector <double> whitepoint);
void setXYZData(QVector <double> whitepoint);
void setGrayData(QVector <double> whitepoint);
void setLABData(QVector <double> whitepoint);
void setYCbCrData(QVector <double> whitepoint);
void setProfileDataAvailable(bool dataAvailable);
void loadingStarted();
void loadingFailed();
void uncalibratedColor();
enum model {RGBA, CMYKA, XYZA, LABA, GRAYA, YCbCrA};
protected:
int grids(double val) const;
void outlineTongue();
void fillTongue();
void drawTongueAxis();
void drawTongueGrid();
void drawLabels();
QRgb colorByCoord(double x, double y);
void drawSmallElipse(QPointF xy, int r, int g, int b, int sz);
- void resizeEvent(QResizeEvent* event);
- void paintEvent(QPaintEvent*);
+ void resizeEvent(QResizeEvent* event) override;
+ void paintEvent(QPaintEvent*) override;
private:
void drawColorantTriangle();
void drawGamut();
void drawWhitePoint();
void drawPatches();
void updatePixmap();
void mapPoint(int& icx, int& icy, QPointF xy);
void biasedLine(int x1, int y1, int x2, int y2);
void biasedText(int x, int y, const QString& txt);
private Q_SLOTS:
void slotProgressTimerDone();
private :
class Private;
Private* const d;
};
#endif /* KISCIETONGUEWIDGET_H */
diff --git a/libs/ui/widgets/kis_cmb_composite.cc b/libs/ui/widgets/kis_cmb_composite.cc
index a467a6e0b6..eae6887832 100644
--- a/libs/ui/widgets/kis_cmb_composite.cc
+++ b/libs/ui/widgets/kis_cmb_composite.cc
@@ -1,469 +1,481 @@
/*
* kis_cmb_composite.cc - part of KImageShop/Krayon/Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_cmb_composite.h"
#include <KoCompositeOp.h>
#include <KoCompositeOpRegistry.h>
#include "kis_composite_ops_model.h"
#include "kis_categorized_item_delegate.h"
#include <kis_action.h>
//////////////////////////////////////////////////////////////////////////////////////////
// ---- KisCompositeOpListWidget ------------------------------------------------------ //
KisCompositeOpListWidget::KisCompositeOpListWidget(QWidget* parent):
KisCategorizedListView(false, parent),
m_model(new KisSortedCompositeOpListModel(this))
{
setModel(m_model);
setItemDelegate(new KisCategorizedItemDelegate(this));
}
KisCompositeOpListWidget::~KisCompositeOpListWidget()
{
}
KoID KisCompositeOpListWidget::selectedCompositeOp() const {
KoID op;
if (m_model->entryAt(op, currentIndex())) {
return op;
}
return KoCompositeOpRegistry::instance().getDefaultCompositeOp();
}
//////////////////////////////////////////////////////////////////////////////////////////
// ---- KisCompositeOpComboBox -------------------------------------------------------- //
KisCompositeOpComboBox::KisCompositeOpComboBox(QWidget* parent):
QComboBox(parent),
m_model(new KisSortedCompositeOpListModel(this)),
m_allowToHidePopup(true)
{
m_view = new KisCategorizedListView(true);
setMaxVisibleItems(100);
setSizeAdjustPolicy(AdjustToContents);
m_view->setResizeMode(QListView::Adjust);
setToolTip(i18n("Blending Mode"));
setModel(m_model);
setView(m_view);
setItemDelegate(new KisCategorizedItemDelegate(this));
connect(m_view, SIGNAL(sigCategoryToggled(const QModelIndex&, bool)), SLOT(slotCategoryToggled(const QModelIndex&, bool)));
connect(m_view, SIGNAL(sigEntryChecked(const QModelIndex&)), SLOT(slotEntryChecked(const QModelIndex&)));
selectCompositeOp(KoCompositeOpRegistry::instance().getDefaultCompositeOp());
KisAction *action = 0;
// // Cycle through blending modes
// // Shift + + (plus) or – (minus)
// KisAction *action = new KisAction(i18n("Next Blending Mode"), this);
// action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_Plus));
// connect(action, SIGNAL(triggered()), SLOT(slotNextBlendingMode()));
// m_actions << action;
// action = new KisAction(i18n("Previous Blending Mode"), this);
// action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_Minus));
// connect(action, SIGNAL(triggered()), SLOT(slotPreviousBlendingMode()));
// m_actions << action;
// Normal
// Shift + Alt + N
action = new KisAction(i18n("Select Normal Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_N));
connect(action, SIGNAL(triggered()), SLOT(slotNormal()));
m_actions << action;
// Dissolve
// Shift + Alt + I
action = new KisAction(i18n("Select Dissolve Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_I));
connect(action, SIGNAL(triggered()), SLOT(slotDissolve()));
m_actions << action;
// Behind (Brush tool only)
// Shift + Alt + Q
action = new KisAction(i18n("Select Behind Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_Q));
connect(action, SIGNAL(triggered()), SLOT(slotBehind()));
m_actions << action;
// Clear (Brush tool only)
// Shift + Alt + R
action = new KisAction(i18n("Select Clear Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_R));
connect(action, SIGNAL(triggered()), SLOT(slotClear()));
m_actions << action;
// Darken
// Shift + Alt + K
action = new KisAction(i18n("Select Darken Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_K));
connect(action, SIGNAL(triggered()), SLOT(slotDarken()));
m_actions << action;
// Multiply
// Shift + Alt + M
action = new KisAction(i18n("Select Multiply Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_M));
connect(action, SIGNAL(triggered()), SLOT(slotMultiply()));
m_actions << action;
// Color Burn
// Shift + Alt + B
action = new KisAction(i18n("Select Color Burn Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_B));
connect(action, SIGNAL(triggered()), SLOT(slotColorBurn()));
m_actions << action;
// Linear Burn
// Shift + Alt + A
action = new KisAction(i18n("Select Linear Burn Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_A));
connect(action, SIGNAL(triggered()), SLOT(slotLinearBurn()));
m_actions << action;
// Lighten
// Shift + Alt + G
action = new KisAction(i18n("Select Lighten Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_G));
connect(action, SIGNAL(triggered()), SLOT(slotLighten()));
m_actions << action;
// Screen
// Shift + Alt + S
action = new KisAction(i18n("Select Screen Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_S));
connect(action, SIGNAL(triggered()), SLOT(slotScreen()));
m_actions << action;
// Color Dodge
// Shift + Alt + D
action = new KisAction(i18n("Select Color Dodge Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_D));
connect(action, SIGNAL(triggered()), SLOT(slotColorDodge()));
m_actions << action;
// Linear Dodge
// Shift + Alt + W
action = new KisAction(i18n("Select Linear Dodge Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_W));
connect(action, SIGNAL(triggered()), SLOT(slotLinearDodge()));
m_actions << action;
// Overlay
// Shift + Alt + O
action = new KisAction(i18n("Select Overlay Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_O));
connect(action, SIGNAL(triggered()), SLOT(slotOverlay()));
m_actions << action;
+ // Hard Overlay
+ // Shift + Alt + P
+ action = new KisAction(i18n("Select Hard Overlay Blending Mode"), this);
+ action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_P));
+ connect(action, SIGNAL(triggered()), SLOT(slotHardOverlay()));
+ m_actions << action;
+
// Soft Light
// Shift + Alt + F
action = new KisAction(i18n("Select Soft Light Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_F));
connect(action, SIGNAL(triggered()), SLOT(slotSoftLight()));
m_actions << action;
// Hard Light
// Shift + Alt + H
action = new KisAction(i18n("Select Hard Light Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_H));
connect(action, SIGNAL(triggered()), SLOT(slotHardLight()));
m_actions << action;
// Vivid Light
// Shift + Alt + V
action = new KisAction(i18n("Select Vivid Light Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_V));
connect(action, SIGNAL(triggered()), SLOT(slotVividLight()));
m_actions << action;
// Linear Light
// Shift + Alt + J
action = new KisAction(i18n("Select Linear Light Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_J));
connect(action, SIGNAL(triggered()), SLOT(slotLinearLight()));
m_actions << action;
// Pin Light
// Shift + Alt + Z
action = new KisAction(i18n("Select Pin Light Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_Z));
connect(action, SIGNAL(triggered()), SLOT(slotPinLight()));
m_actions << action;
// Hard Mix
// Shift + Alt + L
action = new KisAction(i18n("Select Hard Mix Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_L));
connect(action, SIGNAL(triggered()), SLOT(slotHardMix()));
m_actions << action;
// Difference
// Shift + Alt + E
action = new KisAction(i18n("Select Difference Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_E));
connect(action, SIGNAL(triggered()), SLOT(slotDifference()));
m_actions << action;
// Exclusion
// Shift + Alt + X
action = new KisAction(i18n("Select Exclusion Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_X));
connect(action, SIGNAL(triggered()), SLOT(slotExclusion()));
m_actions << action;
// Hue
// Shift + Alt + U
action = new KisAction(i18n("Select Hue Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_U));
connect(action, SIGNAL(triggered()), SLOT(slotHue()));
m_actions << action;
// Saturation
// Shift + Alt + T
action = new KisAction(i18n("Select Saturation Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_T));
connect(action, SIGNAL(triggered()), SLOT(slotSaturation()));
m_actions << action;
// Color
// Shift + Alt + C
action = new KisAction(i18n("Select Color Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_C));
connect(action, SIGNAL(triggered()), SLOT(slotColor()));
m_actions << action;
// Luminosity
// Shift + Alt + Y
action = new KisAction(i18n("Select Luminosity Blending Mode"), this);
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::ALT + Qt::Key_Y));
connect(action, SIGNAL(triggered()), SLOT(slotLuminosity()));
m_actions << action;
}
KisCompositeOpComboBox::~KisCompositeOpComboBox()
{
delete m_view;
}
void KisCompositeOpComboBox::validate(const KoColorSpace *cs) {
m_model->validate(cs);
}
void KisCompositeOpComboBox::selectCompositeOp(const KoID &op) {
QModelIndex index = m_model->indexOf(op);
setCurrentIndex(index.row());
}
KoID KisCompositeOpComboBox::selectedCompositeOp() const {
KoID op;
if (m_model->entryAt(op, m_model->index(currentIndex(), 0))) {
return op;
}
return KoCompositeOpRegistry::instance().getDefaultCompositeOp();
}
QList<KisAction *> KisCompositeOpComboBox::blendmodeActions() const
{
return m_actions;
}
void KisCompositeOpComboBox::slotCategoryToggled(const QModelIndex& index, bool toggled)
{
Q_UNUSED(index);
Q_UNUSED(toggled);
//NOTE: this will (should) fit the size of the
// popup widget to the view
// don't know if this is expected behaviour
// on all supported platforms.
// Thre is nothing written about this in the docs.
showPopup();
}
void KisCompositeOpComboBox::slotEntryChecked(const QModelIndex& index)
{
Q_UNUSED(index);
m_allowToHidePopup = false;
}
void KisCompositeOpComboBox::hidePopup()
{
if (m_allowToHidePopup) {
QComboBox::hidePopup();
}
else {
QComboBox::showPopup();
}
m_allowToHidePopup = true;
}
void KisCompositeOpComboBox::slotNextBlendingMode()
{
if (currentIndex() < count()) {
setCurrentIndex(currentIndex() + 1);
}
}
void KisCompositeOpComboBox::slotPreviousBlendingMode()
{
if (currentIndex() > 0) {
setCurrentIndex(currentIndex() - 1);
}
}
void KisCompositeOpComboBox::slotNormal()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_OVER));
}
void KisCompositeOpComboBox::slotDissolve()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_DISSOLVE));
}
void KisCompositeOpComboBox::slotBehind()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_BEHIND));
}
void KisCompositeOpComboBox::slotClear()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_CLEAR));
}
void KisCompositeOpComboBox::slotDarken()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_DARKEN));
}
void KisCompositeOpComboBox::slotMultiply()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_MULT));
}
void KisCompositeOpComboBox::slotColorBurn()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_BURN));
}
void KisCompositeOpComboBox::slotLinearBurn()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_LINEAR_BURN));
}
void KisCompositeOpComboBox::slotLighten()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_LIGHTEN));
}
void KisCompositeOpComboBox::slotScreen()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_SCREEN));
}
void KisCompositeOpComboBox::slotColorDodge()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_DODGE));
}
void KisCompositeOpComboBox::slotLinearDodge()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_LINEAR_DODGE));
}
void KisCompositeOpComboBox::slotOverlay()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_OVERLAY));
}
+void KisCompositeOpComboBox::slotHardOverlay()
+{
+ selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_HARD_OVERLAY));
+}
+
void KisCompositeOpComboBox::slotSoftLight()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_SOFT_LIGHT_PHOTOSHOP));
}
void KisCompositeOpComboBox::slotHardLight()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_HARD_LIGHT));
}
void KisCompositeOpComboBox::slotVividLight()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_VIVID_LIGHT));
}
void KisCompositeOpComboBox::slotLinearLight()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_LINEAR_LIGHT));
}
void KisCompositeOpComboBox::slotPinLight()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_PIN_LIGHT));
}
void KisCompositeOpComboBox::slotHardMix()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_HARD_MIX));
}
void KisCompositeOpComboBox::slotDifference()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_DIFF));
}
void KisCompositeOpComboBox::slotExclusion()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_EXCLUSION));
}
void KisCompositeOpComboBox::slotHue()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_HUE));
}
void KisCompositeOpComboBox::slotSaturation()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_SATURATION));
}
void KisCompositeOpComboBox::slotColor()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_COLOR));
}
void KisCompositeOpComboBox::slotLuminosity()
{
selectCompositeOp(KoCompositeOpRegistry::instance().getKoID(COMPOSITE_LUMINIZE));
}
diff --git a/libs/ui/widgets/kis_cmb_composite.h b/libs/ui/widgets/kis_cmb_composite.h
index c794ce46b2..eee12be527 100644
--- a/libs/ui/widgets/kis_cmb_composite.h
+++ b/libs/ui/widgets/kis_cmb_composite.h
@@ -1,103 +1,104 @@
/*
* widgets/kis_cmb_composite.h - part of KImageShop/Krayon/Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COMPOSITEOP_WIDGETS_H_
#define KIS_COMPOSITEOP_WIDGETS_H_
#include <QComboBox>
#include <kritaui_export.h>
#include "kis_categorized_list_view.h"
class KoID;
class KoColorSpace;
class KisSortedCompositeOpListModel;
class KisAction;
class KRITAUI_EXPORT KisCompositeOpListWidget: public KisCategorizedListView
{
public:
KisCompositeOpListWidget(QWidget* parent=0);
- ~KisCompositeOpListWidget();
+ ~KisCompositeOpListWidget() override;
KoID selectedCompositeOp() const;
private:
KisSortedCompositeOpListModel *m_model;
};
class KRITAUI_EXPORT KisCompositeOpComboBox: public QComboBox
{
Q_OBJECT
public:
KisCompositeOpComboBox(QWidget* parent=0);
- ~KisCompositeOpComboBox();
+ ~KisCompositeOpComboBox() override;
- virtual void hidePopup();
+ void hidePopup() override;
void validate(const KoColorSpace *cs);
void selectCompositeOp(const KoID &op);
KoID selectedCompositeOp() const;
QList<KisAction *> blendmodeActions() const;
private Q_SLOTS:
void slotCategoryToggled(const QModelIndex& index, bool toggled);
void slotEntryChecked(const QModelIndex& index);
void slotNextBlendingMode();
void slotPreviousBlendingMode();
void slotNormal();
void slotDissolve();
void slotBehind();
void slotClear();
void slotDarken();
void slotMultiply();
void slotColorBurn();
void slotLinearBurn();
void slotLighten();
void slotScreen();
void slotColorDodge();
void slotLinearDodge();
void slotOverlay();
+ void slotHardOverlay();
void slotSoftLight();
void slotHardLight();
void slotVividLight();
void slotLinearLight();
void slotPinLight();
void slotHardMix();
void slotDifference();
void slotExclusion();
void slotHue();
void slotSaturation();
void slotColor();
void slotLuminosity();
private:
KisSortedCompositeOpListModel *m_model;
KisCategorizedListView *m_view;
bool m_allowToHidePopup;
QList<KisAction *> m_actions;
};
#endif // KIS_COMPOSITEOP_WIDGETS_H_
diff --git a/libs/ui/widgets/kis_cmb_gradient.h b/libs/ui/widgets/kis_cmb_gradient.h
index 58978a827f..8bf5bf618a 100644
--- a/libs/ui/widgets/kis_cmb_gradient.h
+++ b/libs/ui/widgets/kis_cmb_gradient.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CMB_GRADIENT_H
#define KIS_CMB_GRADIENT_H
#include <kis_popup_button.h>
class KoResource;
class KisGradientChooser;
class KoAbstractGradient;
/**
* @brief The KisCmbGradient class allows the user to select a gradient.
*/
class KisCmbGradient : public KisPopupButton
{
Q_OBJECT
public:
explicit KisCmbGradient(QWidget *parent = 0);
void setGradient(KoAbstractGradient *gradient);
KoAbstractGradient *gradient() const;
- QSize sizeHint() const;
+ QSize sizeHint() const override;
protected:
- void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
Q_SIGNALS:
void gradientChanged(KoAbstractGradient*);
private Q_SLOTS:
void gradientSelected(KoResource *resource);
private:
KisGradientChooser *m_gradientChooser;
};
#endif // KIS_CMB_GRADIENT_H
diff --git a/libs/ui/widgets/kis_cmb_idlist.h b/libs/ui/widgets/kis_cmb_idlist.h
index 746f18814a..6869c72270 100644
--- a/libs/ui/widgets/kis_cmb_idlist.h
+++ b/libs/ui/widgets/kis_cmb_idlist.h
@@ -1,67 +1,67 @@
/*
* kis_cmb_imagetype.h - part of KImageShop/Krayon/Krita
*
* Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CMB_IDLIST_H_
#define KIS_CMB_IDLIST_H_
#include <QComboBox>
#include <KoID.h>
#include <kritaui_export.h>
/**
* A combobox that is associated with a list of KoID's. The
* descriptive (i18n'ed) text is displayed, but the various
* signals return a KoID.
*/
class KRITAUI_EXPORT KisCmbIDList: public QComboBox
{
Q_OBJECT
public:
KisCmbIDList(QWidget * parent = 0, const char * name = 0);
- virtual ~KisCmbIDList();
+ ~KisCmbIDList() override;
public:
/**
* @brief setIDList clears the combobox and sorts
* the given list by user-visible name and then adds
* the items to the combobox
* @param list the (unsorted) list of KoID's
*/
void setIDList(const QList<KoID> & list);
void setCurrent(const KoID id);
void setCurrent(const QString & s);
KoID currentItem() const;
Q_SIGNALS:
void activated(const KoID &);
void highlighted(const KoID &);
private Q_SLOTS:
void slotIDActivated(int i);
void slotIDHighlighted(int i);
private:
QList<KoID> m_list;
};
#endif
diff --git a/libs/ui/widgets/kis_color_button.h b/libs/ui/widgets/kis_color_button.h
index b5df4051d5..fcb24a3153 100644
--- a/libs/ui/widgets/kis_color_button.h
+++ b/libs/ui/widgets/kis_color_button.h
@@ -1,129 +1,129 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
* This file is forked from the KF5 KColorButton
Copyright (C) 1997 Martin Jones (mjones@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KisColorButton_H
#define KisColorButton_H
#include <kritaui_export.h>
#include <KoColor.h>
#include <QPushButton>
class KisColorButtonPrivate;
/**
* @short A pushbutton to display or allow user selection of a color.
*
* This widget can be used to display or allow user selection of a color.
*
* @see QColorDialog
*
* \image html KisColorButton.png "KDE Color Button"
*/
class KRITAUI_EXPORT KisColorButton : public QPushButton
{
Q_OBJECT
/**
* QtCreator treats KoColor as a QColor in incorrect way, so just disable using them in QtCreator
* https://bugs.kde.org/show_bug.cgi?id=368483
*/
Q_PROPERTY(KoColor color READ color WRITE setColor NOTIFY changed USER true DESIGNABLE false)
Q_PROPERTY(KoColor defaultColor READ defaultColor WRITE setDefaultColor DESIGNABLE false)
Q_PROPERTY(bool alphaChannelEnabled READ isAlphaChannelEnabled WRITE setAlphaChannelEnabled)
public:
/**
* Creates a color button.
*/
explicit KisColorButton(QWidget *parent = 0);
/**
* Creates a color button with an initial color @p c.
*/
explicit KisColorButton(const KoColor &c, QWidget *parent = 0);
/**
* Creates a color button with an initial color @p c and default color @p defaultColor.
*/
KisColorButton(const KoColor &c, const KoColor &defaultColor, QWidget *parent = 0);
- virtual ~KisColorButton();
+ ~KisColorButton() override;
/**
* Returns the currently chosen color.
*/
KoColor color() const;
/**
* Sets the current color to @p c.
*/
void setColor(const KoColor &c);
/**
* When set to true, allow the user to change the alpha component
* of the color. The default value is false.
* @since 4.5
*/
void setAlphaChannelEnabled(bool alpha);
/**
* Returns true if the user is allowed to change the alpha component.
* @since 4.5
*/
bool isAlphaChannelEnabled() const;
/**
* Returns the default color or an invalid color
* if no default color is set.
*/
KoColor defaultColor() const;
/**
* Sets the default color to @p c.
*/
void setDefaultColor(const KoColor &c);
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
Q_SIGNALS:
/**
* Emitted when the color of the widget
* is changed, either with setColor() or via user selection.
*/
void changed(const KoColor &newColor);
protected:
void paintEvent(QPaintEvent *pe) override;
void dragEnterEvent(QDragEnterEvent *) override;
void dropEvent(QDropEvent *) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
private:
class KisColorButtonPrivate;
KisColorButtonPrivate *const d;
Q_PRIVATE_SLOT(d, void _k_chooseColor())
Q_PRIVATE_SLOT(d, void _k_colorChosen())
};
#endif
diff --git a/libs/ui/widgets/kis_color_filter_combo.h b/libs/ui/widgets/kis_color_filter_combo.h
index ac8acac9e8..abe3c826f1 100644
--- a/libs/ui/widgets/kis_color_filter_combo.h
+++ b/libs/ui/widgets/kis_color_filter_combo.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLOR_FILTER_COMBO_H
#define __KIS_COLOR_FILTER_COMBO_H
#include <QScopedPointer>
#include <QComboBox>
#include "kritaui_export.h"
#include "kis_types.h"
class ComboEventFilter;
class KRITAUI_EXPORT KisColorFilterCombo : public QComboBox
{
Q_OBJECT
public:
KisColorFilterCombo(QWidget *parent);
- ~KisColorFilterCombo();
+ ~KisColorFilterCombo() override;
void updateAvailableLabels(KisNodeSP rootNode);
void updateAvailableLabels(const QSet<int> &labels);
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
QList<int> selectedColors() const;
Q_SIGNALS:
void selectedColorsChanged();
private:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
QList<ComboEventFilter *> m_eventFilters;
};
#endif /* __KIS_COLOR_FILTER_COMBO_H */
diff --git a/libs/ui/widgets/kis_color_input.h b/libs/ui/widgets/kis_color_input.h
index 412b500c6a..d26f8b55c1 100644
--- a/libs/ui/widgets/kis_color_input.h
+++ b/libs/ui/widgets/kis_color_input.h
@@ -1,99 +1,99 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_INPUT_H_
#define _KIS_COLOR_INPUT_H_
#include <QWidget>
class KoChannelInfo;
class KoColor;
class QWidget;
class QSpinBox;
class QDoubleSpinBox;
class KisIntParseSpinBox;
class KisDoubleParseSpinBox;
class KoColorSlider;
class QLineEdit;
#include <KoColorDisplayRendererInterface.h>
#include "kritaui_export.h"
class KRITAUI_EXPORT KisColorInput : public QWidget
{
Q_OBJECT
public:
KisColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
protected:
void init();
virtual QWidget* createInput() = 0;
Q_SIGNALS:
void updated();
protected:
const KoChannelInfo* m_channelInfo;
KoColor* m_color;
KoColorSlider* m_colorSlider;
KoColorDisplayRendererInterface *m_displayRenderer;
};
class KRITAUI_EXPORT KisIntegerColorInput : public KisColorInput
{
Q_OBJECT
public:
KisIntegerColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
protected:
- virtual QWidget* createInput();
+ QWidget* createInput() override;
public Q_SLOTS:
void setValue(int);
void update();
private:
KisIntParseSpinBox* m_intNumInput;
};
class KRITAUI_EXPORT KisFloatColorInput : public KisColorInput
{
Q_OBJECT
public:
KisFloatColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
protected:
- virtual QWidget* createInput();
+ QWidget* createInput() override;
public Q_SLOTS:
void setValue(double);
void sliderChanged(int);
void update();
private:
KisDoubleParseSpinBox* m_dblNumInput;
qreal m_minValue;
qreal m_maxValue;
};
class KRITAUI_EXPORT KisHexColorInput : public KisColorInput
{
Q_OBJECT
public:
KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
protected:
- virtual QWidget* createInput();
+ QWidget* createInput() override;
public Q_SLOTS:
void setValue();
void update();
private:
QLineEdit* m_hexInput;
};
#endif
diff --git a/libs/ui/widgets/kis_color_label_selector_widget.h b/libs/ui/widgets/kis_color_label_selector_widget.h
index 7c7456a68c..4acbb55234 100644
--- a/libs/ui/widgets/kis_color_label_selector_widget.h
+++ b/libs/ui/widgets/kis_color_label_selector_widget.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLOR_LABEL_SELECTOR_WIDGET_H
#define __KIS_COLOR_LABEL_SELECTOR_WIDGET_H
#include <QScopedPointer>
#include <QWidget>
#include "kritaui_export.h"
class KRITAUI_EXPORT KisColorLabelSelectorWidget : public QWidget
{
Q_OBJECT
public:
KisColorLabelSelectorWidget(QWidget *parent);
- ~KisColorLabelSelectorWidget();
+ ~KisColorLabelSelectorWidget() override;
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
int currentIndex() const;
public Q_SLOTS:
void setCurrentIndex(int index);
Q_SIGNALS:
void currentIndexChanged(int index);
protected:
- void resizeEvent(QResizeEvent *e);
- void paintEvent(QPaintEvent *e);
- void keyPressEvent(QKeyEvent *e);
- void mousePressEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void leaveEvent(QEvent *e);
+ void resizeEvent(QResizeEvent *e) override;
+ void paintEvent(QPaintEvent *e) override;
+ void keyPressEvent(QKeyEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void leaveEvent(QEvent *e) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_COLOR_LABEL_SELECTOR_WIDGET_H */
diff --git a/libs/ui/widgets/kis_color_space_selector.cc b/libs/ui/widgets/kis_color_space_selector.cc
index 0896d42ebd..870c115705 100644
--- a/libs/ui/widgets/kis_color_space_selector.cc
+++ b/libs/ui/widgets/kis_color_space_selector.cc
@@ -1,275 +1,274 @@
/*
* Copyright (C) 2007 Cyrille Berger <cberger@cberger.net>
* Copyright (C) 2011 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_color_space_selector.h"
#include "kis_advanced_color_space_selector.h"
#include <QUrl>
#include <KoFileDialog.h>
#include <KoColorProfile.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceEngine.h>
#include <KoID.h>
#include <KoConfig.h>
#include <kis_icon.h>
#include <QDesktopServices>
#include <KoResourcePaths.h>
#include <kis_debug.h>
#include "ui_wdgcolorspaceselector.h"
struct KisColorSpaceSelector::Private {
Ui_WdgColorSpaceSelector* colorSpaceSelector;
QString knsrcFile;
bool profileValid;
QString defaultsuffix;
};
KisColorSpaceSelector::KisColorSpaceSelector(QWidget* parent) : QWidget(parent), m_advancedSelector(0), d(new Private)
{
setObjectName("KisColorSpaceSelector");
d->colorSpaceSelector = new Ui_WdgColorSpaceSelector;
d->colorSpaceSelector->setupUi(this);
d->colorSpaceSelector->cmbColorModels->setIDList(KoColorSpaceRegistry::instance()->colorModelsList(KoColorSpaceRegistry::OnlyUserVisible));
fillCmbDepths(d->colorSpaceSelector->cmbColorModels->currentItem());
d->colorSpaceSelector->bnInstallProfile->setIcon(KisIconUtils::loadIcon("document-open"));
d->colorSpaceSelector->bnInstallProfile->setToolTip( i18n("Open Color Profile") );
connect(d->colorSpaceSelector->cmbColorModels, SIGNAL(activated(const KoID &)),
this, SLOT(fillCmbDepths(const KoID &)));
connect(d->colorSpaceSelector->cmbColorDepth, SIGNAL(activated(const KoID &)),
this, SLOT(fillCmbProfiles()));
connect(d->colorSpaceSelector->cmbColorModels, SIGNAL(activated(const KoID &)),
this, SLOT(fillCmbProfiles()));
connect(d->colorSpaceSelector->cmbProfile, SIGNAL(activated(const QString &)),
this, SLOT(colorSpaceChanged()));
connect(d->colorSpaceSelector->bnInstallProfile, SIGNAL(clicked()),
this, SLOT(installProfile()));
d->defaultsuffix = " "+i18nc("This is appended to the color profile which is the default for the given colorspace and bit-depth","(Default)");
connect(d->colorSpaceSelector->bnAdvanced, SIGNAL(clicked()), this, SLOT(slotOpenAdvancedSelector()));
fillCmbProfiles();
}
KisColorSpaceSelector::~KisColorSpaceSelector()
{
delete d->colorSpaceSelector;
delete d;
}
void KisColorSpaceSelector::fillCmbProfiles()
{
- QString s = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
- d->colorSpaceSelector->cmbProfile->clear();
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(d->colorSpaceSelector->cmbColorModels->currentItem(), d->colorSpaceSelector->cmbColorDepth->currentItem());
+ const QString defaultProfileName = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
- const KoColorSpaceFactory * csf = KoColorSpaceRegistry::instance()->colorSpaceFactory(s);
- if (csf == 0) return;
+ d->colorSpaceSelector->cmbProfile->clear();
- QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(csf);
+ QList<const KoColorProfile *> profileList = KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId);
QStringList profileNames;
Q_FOREACH (const KoColorProfile *profile, profileList) {
profileNames.append(profile->name());
}
qSort(profileNames);
Q_FOREACH (QString stringName, profileNames) {
- if (stringName==csf->defaultProfile()) {
- d->colorSpaceSelector->cmbProfile->addSqueezedItem(stringName+d->defaultsuffix);
+ if (stringName == defaultProfileName) {
+ d->colorSpaceSelector->cmbProfile->addSqueezedItem(stringName + d->defaultsuffix);
} else {
d->colorSpaceSelector->cmbProfile->addSqueezedItem(stringName);
}
}
- d->colorSpaceSelector->cmbProfile->setCurrent(csf->defaultProfile()+d->defaultsuffix);
+ d->colorSpaceSelector->cmbProfile->setCurrent(defaultProfileName + d->defaultsuffix);
colorSpaceChanged();
}
void KisColorSpaceSelector::fillCmbDepths(const KoID& id)
{
KoID activeDepth = d->colorSpaceSelector->cmbColorDepth->currentItem();
d->colorSpaceSelector->cmbColorDepth->clear();
QList<KoID> depths = KoColorSpaceRegistry::instance()->colorDepthList(id, KoColorSpaceRegistry::OnlyUserVisible);
// order the depth by name
qSort(depths.begin(), depths.end(), sortBitDepthsComparer);
d->colorSpaceSelector->cmbColorDepth->setIDList(depths);
if (depths.contains(activeDepth)) {
d->colorSpaceSelector->cmbColorDepth->setCurrent(activeDepth);
}
}
bool KisColorSpaceSelector::sortBitDepthsComparer(KoID depthOne, KoID depthTwo) {
// to order these right, we need to first order by bit depth, then by if it is floating or not
QString bitDepthOne = depthOne.name().split(" ")[0];
QString bitDepthTwo = depthTwo.name().split(" ")[0];
if (bitDepthOne.toInt() > bitDepthTwo.toInt()) {
return false;
}
if (bitDepthOne.toInt() == bitDepthTwo.toInt()) {
// bit depth number is the same, so now we need to compare if it is a floating type or not
// the second value [1], just says 'bits', so that is why we look for [2] which has the float word
QString bitDepthOneType = "";
QString bitDepthTwoType = "";
if (depthOne.name().split(" ").length() > 2) {
bitDepthOneType = depthOne.name().split(" ")[2];
}
if (depthTwo.name().split(" ").length() > 2) {
bitDepthTwoType = depthTwo.name().split(" ")[2];
}
if (bitDepthOneType.length() > bitDepthTwoType.length()) {
return false;
}
}
return true;
}
const KoColorSpace* KisColorSpaceSelector::currentColorSpace()
{
QString profilenamestring = d->colorSpaceSelector->cmbProfile->itemHighlighted();
if (profilenamestring.contains(d->defaultsuffix)) {
profilenamestring.remove(d->defaultsuffix);
return KoColorSpaceRegistry::instance()->colorSpace(
d->colorSpaceSelector->cmbColorModels->currentItem().id(),
d->colorSpaceSelector->cmbColorDepth->currentItem().id(),
profilenamestring);
} else {
return KoColorSpaceRegistry::instance()->colorSpace(
d->colorSpaceSelector->cmbColorModels->currentItem().id(),
d->colorSpaceSelector->cmbColorDepth->currentItem().id(),
profilenamestring);
}
}
void KisColorSpaceSelector::setCurrentColorModel(const KoID& id)
{
d->colorSpaceSelector->cmbColorModels->setCurrent(id);
fillCmbDepths(id);
}
void KisColorSpaceSelector::setCurrentColorDepth(const KoID& id)
{
d->colorSpaceSelector->cmbColorDepth->setCurrent(id);
fillCmbProfiles();
}
void KisColorSpaceSelector::setCurrentProfile(const QString& name)
{
d->colorSpaceSelector->cmbProfile->setCurrent(name);
}
void KisColorSpaceSelector::setCurrentColorSpace(const KoColorSpace* colorSpace)
{
if (!colorSpace) {
return;
}
setCurrentColorModel(colorSpace->colorModelId());
setCurrentColorDepth(colorSpace->colorDepthId());
setCurrentProfile(colorSpace->profile()->name());
}
void KisColorSpaceSelector::showColorBrowserButton(bool showButton) {
d->colorSpaceSelector->bnAdvanced->setVisible(showButton);
}
void KisColorSpaceSelector::colorSpaceChanged()
{
bool valid = d->colorSpaceSelector->cmbProfile->count() != 0;
d->profileValid = valid;
emit(selectionChanged(valid));
if(valid) {
emit colorSpaceChanged(currentColorSpace());
QString text = currentColorSpace()->profile()->name();
}
}
void KisColorSpaceSelector::installProfile()
{
QStringList mime;
KoFileDialog dialog(this, KoFileDialog::OpenFiles, "OpenDocumentICC");
dialog.setCaption(i18n("Install Color Profiles"));
dialog.setDefaultDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
dialog.setMimeTypeFilters(QStringList() << "application/vnd.iccprofile", "application/vnd.iccprofile");
QStringList profileNames = dialog.filenames();
KoColorSpaceEngine *iccEngine = KoColorSpaceEngineRegistry::instance()->get("icc");
Q_ASSERT(iccEngine);
QString saveLocation = KoResourcePaths::saveLocation("icc_profiles");
Q_FOREACH (const QString &profileName, profileNames) {
QUrl file(profileName);
if (!QFile::copy(profileName, saveLocation + file.fileName())) {
dbgKrita << "Could not install profile!";
return;
}
iccEngine->addProfile(saveLocation + file.fileName());
}
fillCmbProfiles();
}
void KisColorSpaceSelector::slotOpenAdvancedSelector()
{
if (!m_advancedSelector) {
m_advancedSelector = new KisAdvancedColorSpaceSelector(this, "Select a Colorspace");
m_advancedSelector->setModal(true);
if (currentColorSpace()) {
m_advancedSelector->setCurrentColorSpace(currentColorSpace());
}
connect(m_advancedSelector, SIGNAL(selectionChanged(bool)), this, SLOT(slotProfileValid(bool)) );
}
QDialog::DialogCode result = (QDialog::DialogCode)m_advancedSelector->exec();
if (result) {
if (d->profileValid==true) {
setCurrentColorSpace(m_advancedSelector->currentColorSpace());
}
}
}
void KisColorSpaceSelector::slotProfileValid(bool valid)
{
d->profileValid = valid;
}
diff --git a/libs/ui/widgets/kis_color_space_selector.h b/libs/ui/widgets/kis_color_space_selector.h
index 2459b5a447..3034fe2a91 100644
--- a/libs/ui/widgets/kis_color_space_selector.h
+++ b/libs/ui/widgets/kis_color_space_selector.h
@@ -1,66 +1,66 @@
/*
* Copyright (C) 2007 Cyrille Berger <cberger@cberger.net>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_SPACE_SELECTOR_H_
#define _KIS_COLOR_SPACE_SELECTOR_H_
#include <QWidget>
#include <kritaui_export.h>
class KoID;
class KoColorSpace;
class KisAdvancedColorSpaceSelector;
class KRITAUI_EXPORT KisColorSpaceSelector : public QWidget
{
Q_OBJECT
public:
KisColorSpaceSelector(QWidget* parent);
- ~KisColorSpaceSelector();
+ ~KisColorSpaceSelector() override;
const KoColorSpace* currentColorSpace();
void setCurrentColorModel(const KoID& id);
void setCurrentColorDepth(const KoID& id);
void setCurrentProfile(const QString& name);
void setCurrentColorSpace(const KoColorSpace* colorSpace);
void showColorBrowserButton(bool showButton);
Q_SIGNALS:
/**
* This signal is emitted when a new color space is selected.
* @param valid indicates if the color space can be used
*/
void selectionChanged(bool valid);
/// This signal is emitted, when a new color space is selected, that can be used (eg is valid)
void colorSpaceChanged(const KoColorSpace*);
private Q_SLOTS:
void fillCmbDepths(const KoID& idd);
void fillCmbProfiles();
void colorSpaceChanged();
void installProfile();
void slotOpenAdvancedSelector();
void slotProfileValid(bool valid);
private:
struct Private;
KisAdvancedColorSpaceSelector *m_advancedSelector;
static bool sortBitDepthsComparer(KoID depthOne, KoID depthTwo);
Private * const d;
};
#endif
diff --git a/libs/ui/widgets/kis_curve_widget.h b/libs/ui/widgets/kis_curve_widget.h
index 9c1776f6ea..a03225540e 100644
--- a/libs/ui/widgets/kis_curve_widget.h
+++ b/libs/ui/widgets/kis_curve_widget.h
@@ -1,160 +1,160 @@
/*
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2009 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVE_WIDGET_H
#define KIS_CURVE_WIDGET_H
// Qt includes.
#include <QWidget>
#include <QColor>
#include <QPointF>
#include <QPixmap>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QEvent>
#include <QPaintEvent>
#include <QList>
#include <kritaui_export.h>
class QSpinBox;
class KisCubicCurve;
/**
* KisCurveWidget is a widget that shows a single curve that can be edited
* by the user. The user can grab the curve and move it; this creates
* a new control point. Control points can be deleted by selecting a point
* and pressing the delete key.
*
* (From: http://techbase.kde.org/Projects/Widgets_and_Classes#KisCurveWidget)
* KisCurveWidget allows editing of spline based y=f(x) curves. Handy for cases
* where you want the user to control such things as tablet pressure
* response, color transformations, acceleration by time, aeroplane lift
*by angle of attack.
*/
class KRITAUI_EXPORT KisCurveWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(bool pointSelected READ pointSelected NOTIFY pointSelectedChanged);
public:
friend class CurveEditorItem;
/**
* Create a new curve widget with a default curve, that is a straight
* line from bottom-left to top-right.
*/
KisCurveWidget(QWidget *parent = 0, Qt::WFlags f = 0);
- virtual ~KisCurveWidget();
+ ~KisCurveWidget() override;
/**
* Reset the curve to the default shape
*/
void reset(void);
/**
* Enable the guide and set the guide color to the specified color.
*
* XXX: it seems that the guide feature isn't actually implemented yet?
*/
void setCurveGuide(const QColor & color);
/**
* Set a background pixmap. The background pixmap will be drawn under
* the grid and the curve.
*
* XXX: or is the pixmap what is drawn to the left and bottom of the curve
* itself?
*/
void setPixmap(const QPixmap & pix);
QPixmap getPixmap();
void setBasePixmap(const QPixmap & pix);
QPixmap getBasePixmap();
/**
* Whether or not there is a point selected
* This does NOT include the first and last points
*/
bool pointSelected() const;
Q_SIGNALS:
/**
* Emitted whenever a control point has changed position.
*/
void modified(void);
/**
* Emitted whenever the status of whether a control point is selected or not changes
*/
void pointSelectedChanged();
protected Q_SLOTS:
void inOutChanged(int);
protected:
- void keyPressEvent(QKeyEvent *);
- void paintEvent(QPaintEvent *);
- void mousePressEvent(QMouseEvent * e);
- void mouseReleaseEvent(QMouseEvent * e);
- void mouseMoveEvent(QMouseEvent * e);
- void leaveEvent(QEvent *);
- void resizeEvent(QResizeEvent *e);
+ void keyPressEvent(QKeyEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent(QMouseEvent * e) override;
+ void mouseReleaseEvent(QMouseEvent * e) override;
+ void mouseMoveEvent(QMouseEvent * e) override;
+ void leaveEvent(QEvent *) override;
+ void resizeEvent(QResizeEvent *e) override;
public:
/**
* @return get a list with all defined points. If you want to know what the
* y value for a given x is on the curve defined by these points, use getCurveValue().
* @see getCurveValue
*/
KisCubicCurve curve();
/**
* Replace the current curve with a curve specified by the curve defined by the control
* points in @param inlist.
*/
void setCurve(KisCubicCurve inlist);
/**
* Connect/disconnect external spinboxes to the curve
* @min/@max - is the range for their values
*/
void setupInOutControls(QSpinBox *in, QSpinBox *out, int min, int max);
void dropInOutControls();
/**
* Handy function that creates new point in the middle
* of the curve and sets focus on the m_intIn field,
* so the user can move this point anywhere in a moment
*/
void addPointInTheMiddle();
private:
class Private;
Private * const d;
};
#endif /* KIS_CURVE_WIDGET_H */
diff --git a/libs/ui/widgets/kis_custom_image_widget.h b/libs/ui/widgets/kis_custom_image_widget.h
index ea5e43735a..48d7167756 100644
--- a/libs/ui/widgets/kis_custom_image_widget.h
+++ b/libs/ui/widgets/kis_custom_image_widget.h
@@ -1,100 +1,100 @@
/* This file is part of the Calligra project
* Copyright (C) 2005 Thomas Zander <zander@kde.org>
* Copyright (C) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CUSTOM_IMAGE_WIDGET_H
#define KIS_CUSTOM_IMAGE_WIDGET_H
#include "kis_global.h"
#include "KoUnit.h"
#include "kis_properties_configuration.h"
#include "KisOpenPane.h"
#include <ui_wdgnewimage.h>
class KisDocument;
class KisDocument;
enum CustomImageWidgetType { CUSTOM_DOCUMENT, NEW_IMG_FROM_CB };
class WdgNewImage : public QWidget, public Ui::WdgNewImage
{
Q_OBJECT
public:
WdgNewImage(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
};
/**
* The 'Custom Document' widget in the Krita startup widget.
* This class embeds the image size and colorspace to allow the user to select the image properties
* for a new empty image document.
*/
class KisCustomImageWidget : public WdgNewImage
{
Q_OBJECT
public:
/**
* Constructor. Please note that this class is being used/created by KisDoc.
* @param parent the parent widget
* @param doc the document that wants to be altered
*/
KisCustomImageWidget(QWidget *parent, qint32 defWidth, qint32 defHeight, double resolution, const QString & defColorModel, const QString & defColorDepth, const QString & defColorProfile, const QString & imageName);
- virtual ~KisCustomImageWidget();
+ ~KisCustomImageWidget() override;
private Q_SLOTS:
void widthUnitChanged(int index);
void widthChanged(double value);
void heightUnitChanged(int index);
void heightChanged(double value);
void resolutionChanged(double value);
void clipboardDataChanged();
void predefinedClicked(int index);
void saveAsPredefined();
void setLandscape();
void setPortrait();
void switchWidthHeight();
void createImage();
void switchPortraitLandscape();
protected:
KisDocument *createNewImage();
/// Set the number of layers that will be created
void setNumberOfLayers(int layers);
KisOpenPane *m_openPane;
private:
double m_width, m_height;
quint8 backgroundOpacity() const;
void setBackgroundOpacity(quint8 value);
void fillPredefined();
- void showEvent(QShowEvent *);
+ void showEvent(QShowEvent *) override;
KoUnit m_widthUnit, m_heightUnit;
QList<KisPropertiesConfigurationSP> m_predefined;
};
#endif
diff --git a/libs/ui/widgets/kis_double_widget.h b/libs/ui/widgets/kis_double_widget.h
index c7001e8ea6..2c972df9dd 100644
--- a/libs/ui/widgets/kis_double_widget.h
+++ b/libs/ui/widgets/kis_double_widget.h
@@ -1,78 +1,78 @@
/*
* widgets/kis_double_widget.h - part of Krita
*
* Copyright (c) 1999 Carsten Pfeiffer <pfeiffer@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DOUBLE_WIDGET_H
#define KIS_DOUBLE_WIDGET_H
#include <QWidget>
#include <QSlider>
#include <kritaui_export.h>
class QHBoxLayout;
class QDoubleSpinBox;
class KisDoubleParseSpinBox;
class KRITAUI_EXPORT KisDoubleWidget : public QWidget
{
Q_OBJECT
public:
KisDoubleWidget(QWidget* parent = 0, const char* name = 0);
KisDoubleWidget(double min, double max, QWidget* parent = 0, const char* name = 0);
- ~KisDoubleWidget();
+ ~KisDoubleWidget() override;
double value() const;
void setRange(double min, double max);
void setTickPosition(QSlider::TickPosition tickPosition);
void setTickInterval(double tickInterval);
double tickInterval() const;
void setPrecision(int precision);
void setSingleStep(double step);
void setPageStep(double step);
void setTracking(bool tracking);
bool hasTracking() const;
Q_SIGNALS:
void valueChanged(double);
void sliderPressed();
void sliderReleased();
public Q_SLOTS:
void setValue(double value);
protected Q_SLOTS:
void setSliderValue(double);
void sliderValueChanged(int);
private:
void init(double min, double max);
protected:
QHBoxLayout* m_layout;
QSlider* m_slider;
KisDoubleParseSpinBox *m_spinBox;
};
#endif // KIS_DOUBLE_WIDGET_H
diff --git a/libs/ui/widgets/kis_elided_label.h b/libs/ui/widgets/kis_elided_label.h
index bf6cd727c6..48b50c3b34 100644
--- a/libs/ui/widgets/kis_elided_label.h
+++ b/libs/ui/widgets/kis_elided_label.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ELIDED_LABEL_H
#define __KIS_ELIDED_LABEL_H
#include <QScopedPointer>
#include <QLabel>
#include "kritaui_export.h"
/**
* A special QLabel subclass that makes the text elidable.
*
* Please use setLongText() instead of setText(). The latter one will
* not work!
*/
class KRITAUI_EXPORT KisElidedLabel : public QLabel
{
public:
KisElidedLabel(const QString &text, Qt::TextElideMode mode, QWidget *parent = 0);
- ~KisElidedLabel();
+ ~KisElidedLabel() override;
void setLongText(const QString &text);
protected:
- void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
private:
void updateText();
using QLabel::setText;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_ELIDED_LABEL_H */
diff --git a/libs/ui/widgets/kis_filter_selector_widget.h b/libs/ui/widgets/kis_filter_selector_widget.h
index 2deec1ba4c..a7ee794106 100644
--- a/libs/ui/widgets/kis_filter_selector_widget.h
+++ b/libs/ui/widgets/kis_filter_selector_widget.h
@@ -1,142 +1,142 @@
/*
* Copyright (c) 2007-2008 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_FILTER_SELECTOR_WIDGET_H_
#define _KIS_FILTER_SELECTOR_WIDGET_H_
#include <QWidget>
#include <QTreeView>
#include <QHeaderView>
#include <kis_debug.h>
#include <QResizeEvent>
#include <QSize>
#include <kis_types.h>
class QModelIndex;
class KisFilterConfiguration;
class KisViewManager;
class QAbstractItemModel;
class QHideEvent;
class QShowEvent;
/**
* XXX
*/
class KisFilterSelectorWidget : public QWidget
{
Q_OBJECT
public:
KisFilterSelectorWidget(QWidget* parent);
- ~KisFilterSelectorWidget();
+ ~KisFilterSelectorWidget() override;
void setFilter(KisFilterSP f);
void setView(KisViewManager *view);
void setPaintDevice(bool showAll, KisPaintDeviceSP);
KisFilterConfigurationSP configuration();
bool isFilterGalleryVisible() const;
KisFilterSP currentFilter() const;
public Q_SLOTS:
- void setVisible(bool visible);
+ void setVisible(bool visible) override;
void showFilterGallery(bool visible);
protected Q_SLOTS:
void slotBookmarkedFilterConfigurationSelected(int);
void setFilterIndex(const QModelIndex&);
void editConfigurations();
void update();
Q_SIGNALS:
void configurationChanged();
void sigFilterGalleryToggled(bool visible);
void sigSizeChanged();
private:
struct Private;
Private* const d;
};
class KisFilterTree: public QTreeView
{
Q_OBJECT
public:
KisFilterTree(QWidget *parent) : QTreeView(parent) {
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(update_scroll_area(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(update_scroll_area(QModelIndex)));
}
void setFilterModel(QAbstractItemModel * model);
void activateFilter(QModelIndex idx);
- QSize minimumSizeHint() const
+ QSize minimumSizeHint() const override
{
return QSize(200, QTreeView::sizeHint().height());
}
- QSize sizeHint() const
+ QSize sizeHint() const override
{
return QSize(header()->width(), QTreeView::sizeHint().height());
}
- void setModel(QAbstractItemModel *model)
+ void setModel(QAbstractItemModel *model) override
{
QTreeView::setModel(model);
if (header()->visualIndex(0) != -1) {
header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
}
}
protected:
- void resizeEvent(QResizeEvent *event)
+ void resizeEvent(QResizeEvent *event) override
{
if (event->size().width() > 10) {
setModel(m_model);
}
else {
setModel(0);
}
QTreeView::resizeEvent(event);
}
- void showEvent(QShowEvent * event)
+ void showEvent(QShowEvent * event) override
{
setModel(m_model);
QTreeView::showEvent(event);
}
- void hideEvent(QHideEvent * event)
+ void hideEvent(QHideEvent * event) override
{
setModel(0);
QTreeView::hideEvent(event);
}
private Q_SLOTS:
void update_scroll_area(const QModelIndex& i)
{
resizeColumnToContents(i.column());
}
private:
QAbstractItemModel *m_model;
};
#endif
diff --git a/libs/ui/widgets/kis_floating_message.h b/libs/ui/widgets/kis_floating_message.h
index 472dd24409..7c961ed076 100644
--- a/libs/ui/widgets/kis_floating_message.h
+++ b/libs/ui/widgets/kis_floating_message.h
@@ -1,94 +1,94 @@
/*
* This file is part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2012 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Christian Muehlhaeuser <chris@chris.de>
* Copyright (c) 2004-2006 Seb Ruiz <ruiz@kde.org>
* Copyright (c) 2004,2005 Max Howell <max.howell@methylblue.com>
* Copyright (c) 2005 Gabor Lehel <illissius@gmail.com>
* Copyright (c) 2008,2009 Mark Kretschmann <kretschmann@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FLOATING_MESSAGE_H
#define KIS_FLOATING_MESSAGE_H
#include <QWidget>
#include <QString>
#include <QImage>
#include <QTimer>
#include <QTimeLine>
#include <kritaui_export.h>
/**
* @brief The KisFloatingMessage class shows the given message in a semi-transparent
* bubble that doesn' take focus and slowly fades away.
*
* Heavily based on Amarok's Osd.cpp
*/
class KRITAUI_EXPORT KisFloatingMessage : public QWidget
{
Q_OBJECT
public:
enum Priority {
High = 0,
Medium,
Low
};
explicit KisFloatingMessage(const QString &message, QWidget *parent, bool showOverParent, int timeout,
Priority priority, int alignment = Qt::AlignCenter | Qt::TextWordWrap);
/// Show message above parent widget instead of screen
void setShowOverParent(bool show);
void setIcon(const QIcon& icon);
void tryOverrideMessage(const QString message,
const QIcon& icon,
int timeout,
KisFloatingMessage::Priority priority,
int alignment = Qt::AlignCenter | Qt::TextWordWrap);
protected:
- void paintEvent(QPaintEvent *e);
+ void paintEvent(QPaintEvent *e) override;
public Q_SLOTS:
void showMessage();
void removeMessage();
private Q_SLOTS:
void startFade();
void updateOpacity(int value);
private:
QRect determineMetrics(const int M);
QString m_message;
QImage m_icon;
QPixmap m_scaledIcon;
QTimer m_timer;
int m_m;
QTimeLine m_fadeTimeLine;
bool m_showOverParent;
int m_timeout;
Priority m_priority;
int m_alignment;
};
#endif // KIS_FLOATING_MESSAGE_H
diff --git a/libs/ui/widgets/kis_gradient_chooser.h b/libs/ui/widgets/kis_gradient_chooser.h
index 3a58fe3673..abef847054 100644
--- a/libs/ui/widgets/kis_gradient_chooser.h
+++ b/libs/ui/widgets/kis_gradient_chooser.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRADIENT_CHOOSER_H_
#define KIS_GRADIENT_CHOOSER_H_
#include <KoDialog.h>
#include <QFrame>
#include <kritaui_export.h>
class KoAbstractGradient;
class KoStopGradient;
class KisViewManager;
class QLabel;
class QPushButton;
class KisAutogradient;
class KoResource;
class KoResourceItemChooser;
class KisCustomGradientDialog : public KoDialog
{
Q_OBJECT
public:
KisCustomGradientDialog(KoAbstractGradient* gradient, QWidget * parent, const char *name);
private:
QWidget * m_page;
};
class KRITAUI_EXPORT KisGradientChooser : public QFrame
{
Q_OBJECT
public:
KisGradientChooser(QWidget *parent = 0, const char *name = 0);
- virtual ~KisGradientChooser();
+ ~KisGradientChooser() override;
/// Gets the currently selected resource
/// @returns the selected resource, 0 is no resource is selected
KoResource *currentResource();
void setCurrentResource(KoResource *resource);
void setCurrentItem(int row, int column);
Q_SIGNALS:
/// Emitted when a resource was selected
void resourceSelected(KoResource * resource);
private Q_SLOTS:
virtual void update(KoResource * resource);
void addStopGradient();
void addSegmentedGradient();
void editGradient();
private:
void addGradient(KoAbstractGradient* gradient);
private:
QLabel *m_lbName;
KoResourceItemChooser * m_itemChooser;
QPushButton* m_editGradient;
};
#endif // KIS_GRADIENT_CHOOSER_H_
diff --git a/libs/ui/widgets/kis_gradient_slider.h b/libs/ui/widgets/kis_gradient_slider.h
index 97295fb684..97a09e828c 100644
--- a/libs/ui/widgets/kis_gradient_slider.h
+++ b/libs/ui/widgets/kis_gradient_slider.h
@@ -1,98 +1,98 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRADIENT_SLIDER_H
#define KIS_GRADIENT_SLIDER_H
// Qt includes.
#include <QWidget>
#include <QColor>
#include <QList>
#include <QPair>
#include <kritaui_export.h>
class KRITAUI_EXPORT KisGradientSlider : public QWidget
{
Q_OBJECT
typedef enum {
BlackCursor,
GammaCursor,
WhiteCursor,
None
} eCursor;
public:
KisGradientSlider(QWidget *parent = 0);
- virtual ~KisGradientSlider();
+ ~KisGradientSlider() override;
int black() const;
int white() const;
public Q_SLOTS:
void slotModifyBlack(int);
void slotModifyWhite(int);
void slotModifyGamma(double);
Q_SIGNALS:
void sigModifiedBlack(int);
void sigModifiedWhite(int);
void sigModifiedGamma(double);
protected:
- void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
- void mousePressEvent(QMouseEvent * e);
- void mouseReleaseEvent(QMouseEvent * e);
- void mouseMoveEvent(QMouseEvent * e);
+ void paintEvent(QPaintEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void mousePressEvent(QMouseEvent * e) override;
+ void mouseReleaseEvent(QMouseEvent * e) override;
+ void mouseMoveEvent(QMouseEvent * e) override;
private:
void calculateCursorPositions();
unsigned int calculateGammaCursor();
public:
void enableGamma(bool b);
double getGamma(void);
void enableWhite(bool b);
private:
int m_leftmost;
int m_rightmost;
eCursor m_grabCursor;
double m_scalingFactor;
int m_blackCursor;
int m_whiteCursor;
int m_gammaCursor;
int m_black;
int m_white;
double m_gamma;
bool m_gammaEnabled;
bool m_whiteEnabled;
bool m_feedback;
};
#endif /* KIS_GRADIENT_SLIDER_H */
diff --git a/libs/ui/widgets/kis_gradient_slider_widget.h b/libs/ui/widgets/kis_gradient_slider_widget.h
index 105b4fa64e..e8b5b9aa11 100644
--- a/libs/ui/widgets/kis_gradient_slider_widget.h
+++ b/libs/ui/widgets/kis_gradient_slider_widget.h
@@ -1,86 +1,86 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
* 2004 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_GRADIENT_SLIDER_WIDGET_H_
#define _KIS_GRADIENT_SLIDER_WIDGET_H_
#include <QWidget>
#include <QMouseEvent>
#include <QPaintEvent>
class QAction;
class QMenu;
class KoGradientSegment;
class KoSegmentGradient;
class KisGradientSliderWidget : public QWidget
{
Q_OBJECT
public:
KisGradientSliderWidget(QWidget *parent = 0, const char* name = 0, Qt::WFlags f = 0);
public:
- virtual void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
void setGradientResource(KoSegmentGradient* agr);
KoGradientSegment* selectedSegment() {
return m_selectedSegment;
}
Q_SIGNALS:
void sigSelectedSegment(KoGradientSegment*);
void sigChangedSegment(KoGradientSegment*);
protected:
- virtual void mousePressEvent(QMouseEvent * e);
- virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void mouseMoveEvent(QMouseEvent * e);
- virtual void contextMenuEvent(QContextMenuEvent * e);
+ void mousePressEvent(QMouseEvent * e) override;
+ void mouseReleaseEvent(QMouseEvent * e) override;
+ void mouseMoveEvent(QMouseEvent * e) override;
+ void contextMenuEvent(QContextMenuEvent * e) override;
private Q_SLOTS:
void slotSplitSegment();
void slotDuplicateSegment();
void slotMirrorSegment();
void slotRemoveSegment();
private:
enum {
NO_DRAG,
LEFT_DRAG,
RIGHT_DRAG,
MIDDLE_DRAG
};
enum {
SPLIT_SEGMENT,
DUPLICATE_SEGMENT,
MIRROR_SEGMENT,
REMOVE_SEGMENT
};
KoSegmentGradient* m_autogradientResource;
KoGradientSegment* m_currentSegment;
KoGradientSegment* m_selectedSegment;
QMenu* m_segmentMenu;
int m_drag;
QAction *m_removeSegmentAction;
};
#endif
diff --git a/libs/ui/widgets/kis_iconwidget.h b/libs/ui/widgets/kis_iconwidget.h
index 480c3f51cd..2e1f2732c1 100644
--- a/libs/ui/widgets/kis_iconwidget.h
+++ b/libs/ui/widgets/kis_iconwidget.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2000 Matthias Elter <elter@kde.org>
* Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ICONWIDGET_H_
#define KIS_ICONWIDGET_H_
#include <widgets/kis_popup_button.h>
class KoResource;
class KoAbstractResourceServerAdapter;
/**
* The icon widget is used in the control box where the current color and brush
* are shown.
*/
class KisIconWidget : public KisPopupButton
{
Q_OBJECT
public:
KisIconWidget(QWidget *parent = 0, const char *name = 0);
/**
* Set an resource server adapter that the widget will observe.
*/
void setResourceAdapter(QSharedPointer<KoAbstractResourceServerAdapter> adapter);
public Q_SLOTS:
void slotSetItem(KoResource * resource);
void slotAdapterResourceChanged(KoResource * resource);
void slotAdapterResourceRemoved(KoResource * resource);
protected:
- virtual void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
private:
KoResource *m_resource;
QSharedPointer<KoAbstractResourceServerAdapter> m_adapter;
};
#endif // KIS_ICONWIDGET_H_
diff --git a/libs/ui/widgets/kis_image_from_clipboard_widget.h b/libs/ui/widgets/kis_image_from_clipboard_widget.h
index 44c228529e..c0fa76975f 100644
--- a/libs/ui/widgets/kis_image_from_clipboard_widget.h
+++ b/libs/ui/widgets/kis_image_from_clipboard_widget.h
@@ -1,53 +1,53 @@
/* This file is part of the Calligra project
* Copyright (C) 2005 Thomas Zander <zander@kde.org>
* Copyright (C) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_IMAGE_FROM_CLIPBOARD_WIDGET_H
#define KIS_IMAGE_FROM_CLIPBOARD_WIDGET_H
#include "kis_global.h"
#include "kis_properties_configuration.h"
#include "kis_custom_image_widget.h"
#include <QPointer>
/**
* The 'New image from clipboard' widget in the Krita startup widget.
* This class is an exstension of the KisCustomImageWidget("Custom document" widget"
*/
class KisImageFromClipboard : public KisCustomImageWidget
{
Q_OBJECT
public:
/**
* Constructor. Please note that this class is being used/created by KisDoc.
* @param parent the parent widget
* @param doc the document that wants to be altered
*/
KisImageFromClipboard(QWidget *parent, qint32 defWidth, qint32 defHeight, double resolution, const QString & defColorModel, const QString & defColorDepth, const QString & defColorProfile, const QString & imageName);
- virtual ~KisImageFromClipboard();
+ ~KisImageFromClipboard() override;
private Q_SLOTS:
void createImage();
void clipboardDataChanged();
private:
void createClipboardPreview();
};
#endif
diff --git a/libs/ui/widgets/kis_lod_availability_widget.h b/libs/ui/widgets/kis_lod_availability_widget.h
index 1e819c712d..674539d3ca 100644
--- a/libs/ui/widgets/kis_lod_availability_widget.h
+++ b/libs/ui/widgets/kis_lod_availability_widget.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LOD_AVAILABILITY_WIDGET_H
#define __KIS_LOD_AVAILABILITY_WIDGET_H
#include <QWidget>
#include <QScopedPointer>
#include <brushengine/kis_paintop_lod_limitations.h>
class KoCanvasResourceManager;
class KisLodAvailabilityWidget : public QWidget
{
Q_OBJECT
public:
KisLodAvailabilityWidget(QWidget *parent);
- ~KisLodAvailabilityWidget();
+ ~KisLodAvailabilityWidget() override;
void setCanvasResourceManager(KoCanvasResourceManager *resourceManager);
void setLimitations(const KisPaintopLodLimitations &l);
public Q_SLOTS:
void slotUserChangedLodAvailability(bool value);
Q_SIGNALS:
void sigUserChangedLodAvailability(bool value);
private Q_SLOTS:
void showLodToolTip();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_LOD_AVAILABILITY_WIDGET_H */
diff --git a/libs/ui/widgets/kis_meta_data_merge_strategy_chooser_widget.h b/libs/ui/widgets/kis_meta_data_merge_strategy_chooser_widget.h
index c647b1cb39..e4c4cc5141 100644
--- a/libs/ui/widgets/kis_meta_data_merge_strategy_chooser_widget.h
+++ b/libs/ui/widgets/kis_meta_data_merge_strategy_chooser_widget.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Boudewijn Rempot <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_META_DATA_MERGE_STRATEGY_CHOOSER_WIDGET_H_
#define _KIS_META_DATA_MERGE_STRATEGY_CHOOSER_WIDGET_H_
#include <QWidget>
namespace KisMetaData
{
class MergeStrategy;
}
/**
* This widget allows to select a meta data merge strategy.
*/
class KisMetaDataMergeStrategyChooserWidget : public QWidget
{
Q_OBJECT
public:
/**
* Creates a widget to select a merge strategy.
*/
KisMetaDataMergeStrategyChooserWidget(QWidget* parent);
- ~KisMetaDataMergeStrategyChooserWidget();
+ ~KisMetaDataMergeStrategyChooserWidget() override;
const KisMetaData::MergeStrategy* currentStrategy();
/**
* Show a dialog which embed that widget, and have an Ok and Cancel button.
* @return 0 if no merge strategy was selected, or the selected merge strategy
*/
static const KisMetaData::MergeStrategy* showDialog(QWidget* parent);
private Q_SLOTS:
void setCurrentDescription(int index);
private:
const KisMetaData::MergeStrategy* mergeStrategy(int index);
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/widgets/kis_multi_bool_filter_widget.h b/libs/ui/widgets/kis_multi_bool_filter_widget.h
index 4d00e7021b..8852934e03 100644
--- a/libs/ui/widgets/kis_multi_bool_filter_widget.h
+++ b/libs/ui/widgets/kis_multi_bool_filter_widget.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2005 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MULTI_BOOL_FILTER_WIDGET_H_
#define _KIS_MULTI_BOOL_FILTER_WIDGET_H_
#include <vector>
#include <QCheckBox>
#include <QVector>
#include "kritaui_export.h"
#include <kis_config_widget.h>
class KisPropertiesConfiguration;
struct KisBoolWidgetParam {
KRITAUI_EXPORT KisBoolWidgetParam(bool ninitvalue, const QString & label, const QString & name);
bool initvalue;
QString label;
QString name;
};
typedef std::vector<KisBoolWidgetParam> vKisBoolWidgetParam;
class KRITAUI_EXPORT KisMultiBoolFilterWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisMultiBoolFilterWidget(const QString & filterid, QWidget * parent, const QString & caption, vKisBoolWidgetParam iwparam);
- virtual void setConfiguration(const KisPropertiesConfigurationSP cfg);
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
- virtual KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
inline qint32 nbValues() const {
return m_boolWidgets.count();
}
inline bool valueAt(qint32 i) const {
return m_boolWidgets[i]->isChecked();
}
private:
QVector<QCheckBox*> m_boolWidgets;
QString m_filterid;
};
#endif
diff --git a/libs/ui/widgets/kis_multi_double_filter_widget.h b/libs/ui/widgets/kis_multi_double_filter_widget.h
index 199bf8f2f2..18d84eee82 100644
--- a/libs/ui/widgets/kis_multi_double_filter_widget.h
+++ b/libs/ui/widgets/kis_multi_double_filter_widget.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MULTI_DOUBLE_FILTER_WIDGET_H_
#define _KIS_MULTI_DOUBLE_FILTER_WIDGET_H_
#include <vector>
#include <QDoubleSpinBox>
#include <kis_config_widget.h>
#include "kritaui_export.h"
#include "kis_double_parse_spin_box.h"
class KisDelayedActionDoubleInput : public KisDoubleParseSpinBox
{
Q_OBJECT
public:
KisDelayedActionDoubleInput(QWidget * parent, const QString & name);
void cancelDelayedSignal();
private Q_SLOTS:
void slotValueChanged();
void slotTimeToUpdate();
Q_SIGNALS:
void valueChangedDelayed(double value);
private:
QTimer * m_timer;
};
struct KRITAUI_EXPORT KisDoubleWidgetParam {
KisDoubleWidgetParam(double nmin, double nmax, double ninitvalue, const QString & label, const QString & nname);
double min;
double max;
double initvalue;
QString label;
QString name;
};
typedef std::vector<KisDoubleWidgetParam> vKisDoubleWidgetParam;
class KRITAUI_EXPORT KisMultiDoubleFilterWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisMultiDoubleFilterWidget(const QString & filterid, QWidget * parent, const QString & caption, vKisDoubleWidgetParam dwparam);
- virtual void setConfiguration(const KisPropertiesConfigurationSP cfg);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
+ KisPropertiesConfigurationSP configuration() const override;
public:
inline qint32 nbValues() const {
return m_nbdoubleWidgets;
}
inline double valueAt(qint32 i) {
return m_doubleWidgets[i]->value();
}
private:
KisDelayedActionDoubleInput** m_doubleWidgets;
qint32 m_nbdoubleWidgets;
QString m_filterid;
};
#endif
diff --git a/libs/ui/widgets/kis_multi_integer_filter_widget.h b/libs/ui/widgets/kis_multi_integer_filter_widget.h
index aecf14a432..0668f948a3 100644
--- a/libs/ui/widgets/kis_multi_integer_filter_widget.h
+++ b/libs/ui/widgets/kis_multi_integer_filter_widget.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MULTI_INTEGER_FILTER_WIDGET_H_
#define _KIS_MULTI_INTEGER_FILTER_WIDGET_H_
#include <kis_config_widget.h>
#include "kritaui_export.h"
#include <kis_debug.h>
#include <QVector>
#include <QSpinBox>
#include "kis_int_parse_spin_box.h"
#include <vector>
class KisDelayedActionIntegerInput : public KisIntParseSpinBox
{
Q_OBJECT
public:
KisDelayedActionIntegerInput(QWidget * parent, const QString & name);
void cancelDelayedSignal();
private Q_SLOTS:
void slotValueChanged();
void slotTimeToUpdate();
Q_SIGNALS:
void valueChangedDelayed(int value);
private:
QTimer * m_timer;
};
struct KRITAUI_EXPORT KisIntegerWidgetParam {
KisIntegerWidgetParam(qint32 nmin, qint32 nmax, qint32 ninitvalue, const QString& label, const QString& nname);
qint32 min;
qint32 max;
qint32 initvalue;
QString label;
QString name;
};
typedef std::vector<KisIntegerWidgetParam> vKisIntegerWidgetParam;
class KRITAUI_EXPORT KisMultiIntegerFilterWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisMultiIntegerFilterWidget(const QString& filterid, QWidget* parent, const QString& caption, vKisIntegerWidgetParam iwparam);
- ~KisMultiIntegerFilterWidget();
+ ~KisMultiIntegerFilterWidget() override;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
qint32 nbValues() const;
qint32 valueAt(qint32 i);
QVector<KisDelayedActionIntegerInput*> m_integerWidgets;
QString m_filterid;
KisPropertiesConfigurationSP m_config;
};
#endif
diff --git a/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h b/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h
index 5450bcb9fa..870fd2fb9a 100644
--- a/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h
+++ b/libs/ui/widgets/kis_multipliers_double_slider_spinbox.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MULTIPLIERS_DOUBLE_SLIDER_SPINBOX_H_
#define _KIS_MULTIPLIERS_DOUBLE_SLIDER_SPINBOX_H_
#include <QWidget>
#include <kritaui_export.h>
/**
* This class add a combobox to a \ref KisDoubleSliderSpinBox which
* allows to define a multiplier to let the user change the range.
*/
class KRITAUI_EXPORT KisMultipliersDoubleSliderSpinBox : public QWidget {
Q_OBJECT
public:
KisMultipliersDoubleSliderSpinBox(QWidget* _parent = 0);
- ~KisMultipliersDoubleSliderSpinBox();
+ ~KisMultipliersDoubleSliderSpinBox() override;
void addMultiplier(double v);
/**
* Set the range for the 1.0 multiplier
*/
void setRange(qreal minimum, qreal maximum, int decimals = 0);
///Get the value, don't use value()
qreal value();
///Set the value, don't use setValue()
void setValue(qreal value);
void setExponentRatio(qreal dbl);
Q_SIGNALS:
void valueChanged(qreal value);
private:
Q_PRIVATE_SLOT(d, void updateRange())
struct Private;
Private* const d;
};
#endif
diff --git a/libs/ui/widgets/kis_paintop_list_widget.h b/libs/ui/widgets/kis_paintop_list_widget.h
index 364d80d31b..a31f5b75a2 100644
--- a/libs/ui/widgets/kis_paintop_list_widget.h
+++ b/libs/ui/widgets/kis_paintop_list_widget.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_LIST_WIDGET_H_
#define KIS_PAINTOP_LIST_WIDGET_H_
#include <kritaui_export.h>
#include "kis_categorized_list_view.h"
class KisPaintOpFactory;
class KisSortedPaintOpListModel;
/**
* A ListBox filled with the paintops
*/
//*
class KRITAUI_EXPORT KisPaintOpListWidget: public KisCategorizedListView
{
Q_OBJECT
public:
KisPaintOpListWidget(QWidget* parent=0, const char* name=0);
- ~KisPaintOpListWidget();
+ ~KisPaintOpListWidget() override;
QString currentItem() const;
void setPaintOpList(const QList<KisPaintOpFactory*>& list);
void setCurrent(const KisPaintOpFactory* op);
void setCurrent(const QString & paintOpId);
Q_SIGNALS:
void activated(const QString&);
private Q_SLOTS:
void slotOpActivated(const QModelIndex& index);
protected:
QString itemAt(int idx) const;
private:
KisSortedPaintOpListModel *m_model;
};
#endif // KIS_PAINTOP_LIST_WIDGET_H_
diff --git a/libs/ui/widgets/kis_paintop_presets_chooser_popup.h b/libs/ui/widgets/kis_paintop_presets_chooser_popup.h
index bc6ff1d79f..b311d69973 100644
--- a/libs/ui/widgets/kis_paintop_presets_chooser_popup.h
+++ b/libs/ui/widgets/kis_paintop_presets_chooser_popup.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_PRESETS_CHOOSER_POPUP_H
#define KIS_PAINTOP_PRESETS_CHOOSER_POPUP_H
#include <QWidget>
#include <KoID.h>
#include <kritaui_export.h>
#include <brushengine/kis_paintop_preset.h>
class KoResource;
class KRITAUI_EXPORT KisPaintOpPresetsChooserPopup : public QWidget
{
Q_OBJECT
public:
KisPaintOpPresetsChooserPopup(QWidget * parent = 0);
- virtual ~KisPaintOpPresetsChooserPopup();
+ ~KisPaintOpPresetsChooserPopup() override;
void showButtons(bool show);
void updateViewSettings();
public Q_SLOTS:
void canvasResourceChanged(KisPaintOpPresetSP preset );
Q_SIGNALS:
void resourceSelected( KoResource * resource);
void resourceClicked( KoResource * resource);
private Q_SLOTS:
void slotThumbnailMode();
void slotDetailMode();
- virtual void paintEvent(QPaintEvent* );
+ void paintEvent(QPaintEvent* ) override;
private:
struct Private;
Private * const m_d;
};
#endif // KIS_PAINTOP_PRESETS_CHOOSER_POPUP_H
diff --git a/libs/ui/widgets/kis_paintop_presets_popup.h b/libs/ui/widgets/kis_paintop_presets_popup.h
index 02f6d50033..98078c2e9a 100644
--- a/libs/ui/widgets/kis_paintop_presets_popup.h
+++ b/libs/ui/widgets/kis_paintop_presets_popup.h
@@ -1,125 +1,125 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
* Copyright (C) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINTOP_PRESETS_POPUP_H
#define KIS_PAINTOP_PRESETS_POPUP_H
#include <QWidget>
#include <QList>
#include <KoID.h>
#include <kis_types.h>
#include <brushengine/kis_paintop_factory.h>
#include "../kis_paint_ops_model.h"
class QString;
class KisCanvasResourceProvider;
class KoResource;
/**
* Popup widget for presets with built-in functionality
* for adding and removing presets.
*/
class KisPaintOpPresetsPopup : public QWidget
{
Q_OBJECT
public:
KisPaintOpPresetsPopup(KisCanvasResourceProvider * resourceProvider, QWidget * parent = 0);
- ~KisPaintOpPresetsPopup();
+ ~KisPaintOpPresetsPopup() override;
void setPaintOpSettingsWidget(QWidget * widget);
/**
* @return the name entered in the preset name lineedit
*/
QString getPresetName() const;
///Image for preset preview
///@return image cut out from the scratchpad
QImage cutOutOverlay();
void setPaintOpList(const QList<KisPaintOpFactory*>& list);
void setCurrentPaintOpId(const QString & paintOpId);
/// returns the internal ID for the paint op (brush engine)
QString currentPaintOpId();
///fill the cutoutOverlay rect with the cotent of an image, used to get the image back when selecting a preset
///@param image image that will be used, should be image of an existing preset resource
void setPresetImage(const QImage& image);
- virtual void resizeEvent(QResizeEvent* );
+ void resizeEvent(QResizeEvent* ) override;
bool detached() const;
void updateViewSettings();
void currentPresetChanged(KisPaintOpPresetSP preset);
protected:
- void contextMenuEvent(QContextMenuEvent *);
- void hideEvent(QHideEvent *);
- void showEvent(QShowEvent *);
+ void contextMenuEvent(QContextMenuEvent *) override;
+ void hideEvent(QHideEvent *) override;
+ void showEvent(QShowEvent *) override;
public Q_SLOTS:
void slotWatchPresetNameLineEdit();
void switchDetached(bool show = true);
void hideScratchPad();
void showScratchPad();
void resourceSelected(KoResource* resource);
void updateThemedIcons();
void slotUpdateLodAvailability();
Q_SIGNALS:
void savePresetClicked();
void defaultPresetClicked();
void paintopActivated(const QString& presetName);
void signalResourceSelected(KoResource* resource);
void reloadPresetClicked();
void dirtyPresetToggled(bool value);
void eraserBrushSizeToggled(bool value);
void eraserBrushOpacityToggled(bool value);
void sizeChanged();
void brushEditorShown();
private Q_SLOTS:
void slotSwitchScratchpad(bool visible);
void slotResourceChanged(int key, const QVariant &value);
void slotLodAvailabilityChanged(bool value);
void slotSwitchShowEditor(bool visible);
void slotUpdatePaintOpFilter();
void slotSwitchShowPresets(bool visible);
private:
struct Private;
Private * const m_d;
QString current_paintOpId;
QList<KisPaintOpInfo> sortedBrushEnginesList;
};
#endif
diff --git a/libs/ui/widgets/kis_pattern_chooser.h b/libs/ui/widgets/kis_pattern_chooser.h
index 61da1cd6f8..637addc7fa 100644
--- a/libs/ui/widgets/kis_pattern_chooser.h
+++ b/libs/ui/widgets/kis_pattern_chooser.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PATTERN_CHOOSER_H_
#define KIS_PATTERN_CHOOSER_H_
#include <QFrame>
#include <kritaui_export.h>
class QLabel;
class KoResourceItemChooser;
class KoResource;
class KRITAUI_EXPORT KisPatternChooser : public QFrame
{
Q_OBJECT
public:
KisPatternChooser(QWidget *parent = 0);
- virtual ~KisPatternChooser();
+ ~KisPatternChooser() override;
/// Gets the currently selected resource
/// @returns the selected resource, 0 is no resource is selected
KoResource *currentResource();
void setCurrentPattern(KoResource *resource);
void setCurrentItem(int row, int column);
void setGrayscalePreview(bool grayscale);
/// determines whether the preview right or below the splitter
void setPreviewOrientation(Qt::Orientation orientation);
Q_SIGNALS:
/// Emitted when a resource was selected
void resourceSelected(KoResource *resource);
void updateItemSize();
private Q_SLOTS:
void update(KoResource *resource);
private:
QLabel *m_lbName;
KoResourceItemChooser *m_itemChooser;
};
#endif // KIS_PATTERN_CHOOSER_H_
diff --git a/libs/ui/widgets/kis_popup_button.h b/libs/ui/widgets/kis_popup_button.h
index 74887572cc..22e44809a7 100644
--- a/libs/ui/widgets/kis_popup_button.h
+++ b/libs/ui/widgets/kis_popup_button.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_POPUP_BUTTON_H_
#define _KIS_POPUP_BUTTON_H_
#include <QPushButton>
#include <kritaui_export.h>
/**
* This class is a convenience class for a button that
* when clicked displays a popup widget.
*/
class KRITAUI_EXPORT KisPopupButton : public QPushButton
{
Q_OBJECT
public:
KisPopupButton(QWidget* parent);
- ~KisPopupButton();
+ ~KisPopupButton() override;
/**
* Set the popup widget, the KisPopupButton becomes
* the owner and parent of the widget.
*/
void setPopupWidget(QWidget* widget);
/**
* This function allow to force the popup to be visible.
* @param v set to true to force the popup to be visible, set to false
* to allow the popup to be hidden
*/
void setAlwaysVisible(bool v);
/**
* Set the width of the popup widget.
* @return new width of the popup widget
*/
void setPopupWidgetWidth(int w);
public Q_SLOTS:
void showPopupWidget();
void hidePopupWidget();
void adjustPosition();
protected:
- void paintEvent(QPaintEvent* event);
+ void paintEvent(QPaintEvent* event) override;
void paintPopupArrow();
private:
struct Private;
Private* const m_d;
};
#endif
diff --git a/libs/ui/widgets/kis_preset_chooser.h b/libs/ui/widgets/kis_preset_chooser.h
index bf273c6af0..f41dc9f2ad 100644
--- a/libs/ui/widgets/kis_preset_chooser.h
+++ b/libs/ui/widgets/kis_preset_chooser.h
@@ -1,93 +1,93 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ITEM_CHOOSER_H_
#define KIS_ITEM_CHOOSER_H_
#include <QWidget>
#include <kritaui_export.h>
#include <KoID.h>
class KoAbstractResourceServerAdapter;
class KisPresetDelegate;
class KoResourceItemChooser;
class KoResource;
/**
* A special type of item chooser that can contain extra widgets that show
* more information about the currently selected item. Reimplement update()
* to extract that information and fill the appropriate widgets.
*/
class KRITAUI_EXPORT KisPresetChooser : public QWidget
{
Q_OBJECT
public:
KisPresetChooser(QWidget *parent = 0, const char *name = 0);
- virtual ~KisPresetChooser();
+ ~KisPresetChooser() override;
enum ViewMode{
THUMBNAIL, /// Shows thumbnails
DETAIL, /// Shows thumbsnails with text next to it
STRIP /// Shows thumbnails arranged in a single row
};
/// Sets a list of resources in the paintop list, when ever user press enter in the linedit of paintop_presets_popup Class
void setViewMode(ViewMode mode);
void showButtons(bool show);
void setCurrentResource(KoResource *resource);
KoResource* currentResource() const;
/// Sets the visibility of tagging klineEdits
void showTaggingBar(bool show);
KoResourceItemChooser *itemChooser();
void setPresetFilter(const QString& paintOpId);
/// get the base size for the icons. Used by the slider in the view options
int iconSize();
Q_SIGNALS:
void resourceSelected(KoResource *resource);
void resourceClicked(KoResource *resource);
public Q_SLOTS:
void updateViewSettings();
/// sets the icon size. Used by slider in view menu
void setIconSize(int newSize);
/// saves the icon size for the presets. called by the horizontal slider release event.
void saveIconSize();
private Q_SLOTS:
void notifyConfigChanged();
protected:
- virtual void resizeEvent(QResizeEvent* event);
+ void resizeEvent(QResizeEvent* event) override;
private:
KoResourceItemChooser *m_chooser;
KisPresetDelegate* m_delegate;
ViewMode m_mode;
QSharedPointer<KoAbstractResourceServerAdapter> m_adapter;
};
#endif // KIS_ITEM_CHOOSER_H_
diff --git a/libs/ui/widgets/kis_preset_selector_strip.h b/libs/ui/widgets/kis_preset_selector_strip.h
index 92a5aa8bd0..3be00ef3a7 100644
--- a/libs/ui/widgets/kis_preset_selector_strip.h
+++ b/libs/ui/widgets/kis_preset_selector_strip.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESET_SELECTOR_STRIP_H
#define KIS_PRESET_SELECTOR_STRIP_H
#include <QWidget>
#include "ui_wdgpresetselectorstrip.h"
class KoResourceItemView;
/**
*
* KisPresetSelectorStrip is a composite widget around KisPresetChooser. It provides
* a strip of icons with two scroll buttons at the sides and a small delete button
* that appears when a user selects a preset icon.
*
* KisPresetSelectorStrip makes it possible to quickly select and modify presets.
*
* Note that KisPresetSelectorStrip uses the QObject tree to access properties of the contained
* classes, and uses heuristics to approximate pixel offsets, times, and other
* properties that cannot be accessed through the QObject tree.
*
*/
class KisPresetSelectorStrip : public QWidget, public Ui::WdgPresetSelectorStrip
{
Q_OBJECT
public:
KisPresetSelectorStrip(QWidget *parent);
- virtual ~KisPresetSelectorStrip();
+ ~KisPresetSelectorStrip() override;
void setPresetFilter(const QString& paintOpId);
int iconSize();
void setIconSize(int size);
public Q_SLOTS:
/// saving the icon base size. This affects all preset selectors
/// outside UI elements adjusting icon size
void slotSetIconSize(int size);
/// saves the icon size to the config file
/// when UI element is released, it is ok to save icon size to config
void slotSaveIconSize();
private Q_SLOTS:
/// Scrolls the strip's item view to the left
void on_leftScrollBtn_pressed();
/// Scrolls the strip's item view to the right
void on_rightScrollBtn_pressed();
/// Changes the preset list view type
void slotThumbnailMode();
void slotDetailMode();
private:
/**
* This is a workaround to access members of KisPresetChooser using the QObject tree
* instead of class methods
*/
KoResourceItemView* m_resourceItemView;
QString m_currentPaintopID;
};
#endif // KIS_PRESET_SELECTOR_STRIP_H
diff --git a/libs/ui/widgets/kis_progress_widget.h b/libs/ui/widgets/kis_progress_widget.h
index 9ac24246ab..9a9daa90c5 100644
--- a/libs/ui/widgets/kis_progress_widget.h
+++ b/libs/ui/widgets/kis_progress_widget.h
@@ -1,78 +1,78 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* 2004 Adrian Page <adrian@pagenet.plus.com>
* 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISPROGRESSWIDGET_H
#define KISPROGRESSWIDGET_H
#include <QWidget>
#include <QList>
#include <kis_progress_updater.h>
#include "kritaui_export.h"
class KoProgressUpdater;
class QToolButton;
class KoProgressBar;
/**
* KisProgressWidget combines a KoProgressBar with a button
* that can be pressed to cancel the current action.
*/
class KRITAUI_EXPORT KisProgressWidget : public QWidget, public KisProgressInterface
{
Q_OBJECT
public:
KisProgressWidget(QWidget* parent = 0);
- virtual ~KisProgressWidget();
+ ~KisProgressWidget() override;
public:
KoProgressProxy* progressProxy();
/**
* create a new KoProgressUpdater instance that is
* linked to this progress bar.
*
* Note: it is _your_ duty to call deleteLater on the
* koprogressupdater when you are done!
*/
- void detachUpdater(KoProgressUpdater* updater);
- void attachUpdater(KoProgressUpdater* updater);
+ void detachUpdater(KoProgressUpdater* updater) override;
+ void attachUpdater(KoProgressUpdater* updater) override;
public Q_SLOTS:
void cancel();
void correctVisibility(int progressValue);
Q_SIGNALS:
void sigCancellationRequested();
private:
QToolButton* m_cancelButton;
KoProgressBar* m_progressBar;
QList<KoProgressUpdater*> m_activeUpdaters;
};
#endif // KISPROGRESSWIDGET_H
diff --git a/libs/ui/widgets/kis_scratch_pad.h b/libs/ui/widgets/kis_scratch_pad.h
index 7bb8f6dd94..3bced1f676 100644
--- a/libs/ui/widgets/kis_scratch_pad.h
+++ b/libs/ui/widgets/kis_scratch_pad.h
@@ -1,171 +1,171 @@
/* This file is part of the KDE project
* Copyright 2010 (C) Boudewijn Rempt <boud@valdyas.org>
* Copyright 2011 (C) Dmitry Kazakov <dimula73@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SCRATCH_PAD_H
#define KIS_SCRATCH_PAD_H
#include <QImage>
#include <QWidget>
#include <QRect>
#include <KoColor.h>
#include <brushengine/kis_paintop_preset.h>
#include <kis_types.h>
#include <kritaui_export.h>
class QColor;
class KoColorProfile;
class KoPointerEvent;
class KisCanvasResourceProvider;
class KisUpdateScheduler;
class KisUndoStore;
class KisPostExecutionUndoAdapter;
class KisScratchPadEventFilter;
class KisPaintingInformationBuilder;
class KisToolFreehandHelper;
class KisNodeGraphListener;
/**
* A scratchpad is a painting canvas with only one zoomlevel and based on
* a paint layer, not on a KisImage. It can have a blank, tiled background or
* a gradient background.
*/
class KRITAUI_EXPORT KisScratchPad : public QWidget
{
Q_OBJECT
public:
void setupScratchPad(KisCanvasResourceProvider* resourceProvider,
const QColor &defaultColor);
KisScratchPad(QWidget *parent = 0);
- virtual ~KisScratchPad();
+ ~KisScratchPad() override;
/// set the specified rect as the area taken for @see cutoutOverlay
void setCutoutOverlayRect(const QRect&rc);
/// return the contents of the area under the cutoutOverlay rect
QImage cutoutOverlay() const;
// A callback for our own node graph listener
void imageUpdated(const QRect &rect);
// A callback for scratch pad default bounds
QRect imageBounds() const;
// Called by the event filter
void pointerPress(KoPointerEvent *event);
void pointerRelease(KoPointerEvent *event);
void pointerMove(KoPointerEvent *event);
public Q_SLOTS:
void fillDefault();
void fillGradient();
void fillBackground();
void fillLayer();
/**
* Set the icon of the current preset
*/
void setPresetImage(const QImage& image);
/**
* Paint the icon of the current preset inside the
* cutout overlay
*
* \see setPresetImage
*/
void paintPresetImage();
private Q_SLOTS:
void setOnScreenResolution(qreal scaleX, qreal scaleY);
void setDisplayProfile(const KoColorProfile* colorProfile);
void slotUpdateCanvas(const QRect &rect);
Q_SIGNALS:
void colorSelected(const KoColor& color);
void sigUpdateCanvas(const QRect &rect);
protected:
- virtual void paintEvent ( QPaintEvent * event );
+ void paintEvent ( QPaintEvent * event ) override;
private:
void beginStroke(KoPointerEvent *event);
void doStroke(KoPointerEvent *event);
void endStroke(KoPointerEvent *event);
void beginPan(KoPointerEvent *event);
void doPan(KoPointerEvent *event);
void endPan(KoPointerEvent *event);
void pick(KoPointerEvent *event);
void updateTransformations();
QTransform documentToWidget() const;
QTransform widgetToDocument() const;
private:
enum Mode {
PAINTING,
HOVERING,
PANNING,
PICKING
};
Mode modeFromButton(Qt::MouseButton button) const;
private:
KoColor m_defaultColor;
Mode m_toolMode;
KisPaintLayerSP m_paintLayer;
const KoColorProfile* m_displayProfile;
QCursor m_cursor;
QRect m_cutoutOverlay;
QBrush m_checkBrush;
KisCanvasResourceProvider* m_resourceProvider;
KisUpdateScheduler *m_updateScheduler;
KisUndoStore *m_undoStore;
KisPostExecutionUndoAdapter *m_undoAdapter;
KisNodeGraphListener *m_nodeListener;
KisScratchPadEventFilter *m_eventFilter;
KisToolFreehandHelper *m_helper;
KisPaintingInformationBuilder *m_infoBuilder;
QTransform m_scaleTransform;
QTransform m_translateTransform;
QPointF m_panDocPoint;
int m_scaleBorderWidth;
QImage m_presetImage;
};
#endif // KIS_SCRATCH_PAD_H
diff --git a/libs/ui/widgets/kis_scratch_pad_event_filter.h b/libs/ui/widgets/kis_scratch_pad_event_filter.h
index 257cb7382c..73e450d96d 100644
--- a/libs/ui/widgets/kis_scratch_pad_event_filter.h
+++ b/libs/ui/widgets/kis_scratch_pad_event_filter.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SCRATCH_PAD_EVENT_FILTER_H
#define __KIS_SCRATCH_PAD_EVENT_FILTER_H
#include <QObject>
#include <QTransform>
#include <KoPointerEvent.h>
class QWidget;
class KisScratchPad;
class KisScratchPadEventFilter : public QObject
{
Q_OBJECT
public:
KisScratchPadEventFilter(QWidget *parent);
void setWidgetToDocumentTransform(const QTransform &transform);
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
private:
inline QWidget* parentWidget();
inline KoPointerEvent* createMouseEvent(QEvent *event);
inline KoPointerEvent* createTabletEvent(QEvent *event);
private:
QTransform m_widgetToDocument;
bool m_tabletPressed;
KisScratchPad *m_scratchPad;
};
#endif /* __KIS_SCRATCH_PAD_EVENT_FILTER_H */
diff --git a/libs/ui/widgets/kis_screen_color_picker.h b/libs/ui/widgets/kis_screen_color_picker.h
index d9e9de48a9..c347e95297 100644
--- a/libs/ui/widgets/kis_screen_color_picker.h
+++ b/libs/ui/widgets/kis_screen_color_picker.h
@@ -1,78 +1,78 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSCREENCOLORPICKER_H
#define KISSCREENCOLORPICKER_H
#include <QScopedPointer>
#include <QEvent>
#include <QMouseEvent>
#include "KoColor.h"
#include "kritaui_export.h"
/**
* @brief The KisScreenColorPicker class
* Based on the original QColorDialog's screen color picker, this class provides a button
* that can be used to activate a colorpicker that can pick from anywhere on the screen.
*/
class KRITAUI_EXPORT KisScreenColorPicker : public QWidget
{
Q_OBJECT
public:
explicit KisScreenColorPicker(QWidget *parent = 0);
- ~KisScreenColorPicker();
+ ~KisScreenColorPicker() override;
KoColor currentColor();
bool handleColorPickingMouseMove(QMouseEvent *e);
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
bool handleColorPickingKeyPress(QKeyEvent *e);
Q_SIGNALS:
void sigNewColorPicked(KoColor c);
void sigPleaseDisableEverything(bool disable);
public Q_SLOTS:
void pickScreenColor();
private Q_SLOTS:
void updateColorPicking();
protected:
void changeEvent(QEvent *event) override;
private:
struct Private; //The private struct
const QScopedPointer<Private> m_d; //the private pointer
void setCurrentColor(KoColor c);
KoColor grabScreenColor(const QPoint &p);
void updateColorLabelText(const QPoint &globalPos);
void releaseColorPicking();
void continueUpdateColorPicking(const QPoint &globalPos);
};
class KisScreenColorPickingEventFilter : public QObject {
public:
explicit KisScreenColorPickingEventFilter(KisScreenColorPicker *w, QObject *parent = 0);
bool eventFilter(QObject *, QEvent *event) override;
private:
KisScreenColorPicker *m_w;
};
#endif // KISSCREENCOLORPICKER_H
diff --git a/libs/ui/widgets/kis_selection_options.h b/libs/ui/widgets/kis_selection_options.h
index f6d66a52e9..db8d780088 100644
--- a/libs/ui/widgets/kis_selection_options.h
+++ b/libs/ui/widgets/kis_selection_options.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SELECTION_OPTIONS_H__
#define __KIS_SELECTION_OPTIONS_H__
#include <QWidget>
#include "kritaui_export.h"
#include "ui_wdgselectionoptions.h"
class KisCanvas2;
class QButtonGroup;
class WdgSelectionOptions : public QWidget, public Ui::WdgSelectionOptions
{
Q_OBJECT
public:
WdgSelectionOptions(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
*/
class KRITAUI_EXPORT KisSelectionOptions : public QWidget
{
Q_OBJECT
public:
KisSelectionOptions(KisCanvas2 * subject);
- virtual ~KisSelectionOptions();
+ ~KisSelectionOptions() override;
int action();
bool antiAliasSelection();
void disableAntiAliasSelectionOption();
void disableSelectionModeOption();
void setAction(int);
void setMode(int);
Q_SIGNALS:
void actionChanged(int);
void modeChanged(int);
private Q_SLOTS:
void hideActionsForSelectionMode(int mode);
private:
WdgSelectionOptions * m_page;
QButtonGroup* m_mode;
QButtonGroup* m_action;
};
#endif
diff --git a/libs/ui/widgets/kis_size_group.h b/libs/ui/widgets/kis_size_group.h
index ca3acdb958..346f3b03ac 100644
--- a/libs/ui/widgets/kis_size_group.h
+++ b/libs/ui/widgets/kis_size_group.h
@@ -1,102 +1,102 @@
/*
* Copyright (C) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISSIZEGROUP_H
#define KISSIZEGROUP_H
#include <QObject>
#include "kritaui_export.h"
class QWidget;
class KisSizeGroupPrivate;
/**
* KisSizeGroup provides a mechanism to group widgets together so they all
* request the same amount of space. Also, the widgets will share the same
* amount of minimum space. The mode of KisSizeGroup determines the direction of
* the space that are affected by the size group.
*
* All widgets inside of KisSizeGroup will use the same size hint value, computed
* as the maximum of all of his size hint values. The same value is used for the
* minimum size of all widgets. When KisSizeGroup ignore hidden widgets, the
* size of widgets that are not visible don't count in the computation of the
* current size value. When one of these widgets becomes visible again, a new
* size value is computed and applied to all visible widgets.
*
* KisSizeGroup cannot share the same widget with other size groups, so one
* widget can be in one, and only one, KisSizeGroup at time.
*
* NOTE: Added widgets in size groups must be laid out inside of a valid
* layout. The current implementation sopports widgets laid out inside of
* QGridLayout, QFormLayout and QBoxLayout. If the parent widget layout is not
* one of them, then the group size will not affect the widget size.
*/
class KRITAUI_EXPORT KisSizeGroup : public QObject
{
Q_OBJECT
public:
/**
* Determines the direction in which the size group affects the requested
* and minimum sizes of his component widgets.
*/
enum mode
{
KIS_SIZE_GROUP_NONE = 0, //! group has no effect
KIS_SIZE_GROUP_HORIZONTAL = 1 << 0, //! group affects horizontal size
KIS_SIZE_GROUP_VERTICAL = 1 << 1, //! group affects vertical size
KIS_SIZE_GROUP_BOTH = (KIS_SIZE_GROUP_HORIZONTAL | KIS_SIZE_GROUP_VERTICAL)//! group affects horizontal and vertical size
};
/**
* Creates a new size group.
*
* By default, the mode of the size group is KIS_SIZE_GROUP_HORIZONTAL and
* the group will not ignore hidden widgets.
*/
explicit KisSizeGroup(QObject* parent = 0,
KisSizeGroup::mode mode = KisSizeGroup::KIS_SIZE_GROUP_HORIZONTAL,
bool ignoreHidden = false);
- ~KisSizeGroup();
+ ~KisSizeGroup() override;
/// Changes the group size mode.
void setMode(KisSizeGroup::mode mode);
/// Returns the current mode of the group size.
KisSizeGroup::mode getMode() const;
/// Sets whether the group will ignore not visible widgets
void setIgnoreHidden(bool ignoreHidden);
/// Returns whether the group ignores not visible widgets
bool isIgnoreHidden() const;
/// Adds a new widget to the group.
/// WARNING: adding the same widget to multiple size groups is not supported!
void addWidget(QWidget *widget);
/// Removes a widget from the size group.
void removeWidget(QWidget *widget);
private:
KisSizeGroupPrivate* const d;
};
#endif // KISSIZEGROUP_H
diff --git a/libs/ui/widgets/kis_size_group_p.h b/libs/ui/widgets/kis_size_group_p.h
index 84ba74dcbe..09512c086d 100644
--- a/libs/ui/widgets/kis_size_group_p.h
+++ b/libs/ui/widgets/kis_size_group_p.h
@@ -1,99 +1,99 @@
/*
* Copyright (C) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISSIZEGROUPPRIVATE_H
#define KISSIZEGROUPPRIVATE_H
#include <QObject>
#include <QWidgetItem>
#include <QList>
#include <QSize>
#include "kis_size_group.h"
class QWidget;
class QEvent;
class QTimer;
class GroupItem;
class KisSizeGroupPrivate : public QObject
{
Q_OBJECT
public:
KisSizeGroupPrivate(KisSizeGroup *q_ptr, KisSizeGroup::mode mode, bool ignoreHidden);
void addWidget(QWidget *widget);
void removeWidget(QWidget *widget);
/// Schedules an update of all widgets size
void scheduleSizeUpdate();
/// Returns the size hint for the widgets contained in the size group.
const QSize getSizeHint() const { return m_sizeHint; }
private Q_SLOTS:
void updateSize();
public:
KisSizeGroup* q;
KisSizeGroup::mode m_mode;
bool m_ignoreHidden;
private:
QTimer* m_updateTimer; // used to filter multiple calls to scheduleSizeUpdate() into one single updateSize()
QList<GroupItem*> m_groupItems;
QSize m_sizeHint;
};
class GroupItem : public QObject, public QWidgetItem
{
Q_OBJECT
public:
explicit GroupItem(QWidget* widget);
- ~GroupItem() {}
+ ~GroupItem() override {}
void setSize(const QSize &size) { m_size = size; }
int getWidth() const { return m_size.width(); }
void setWidth(int width) { m_size.setWidth(width); }
int getHeight() const { return m_size.height(); }
void setHeight(int height) { m_size.setHeight(height); }
bool hidden() const { return m_hidden; }
KisSizeGroupPrivate* getGroup() { return m_group; }
void setGroup(KisSizeGroupPrivate* group) { m_group = group; }
- QSize sizeHint() const;
- QSize minimumSize() const;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
- bool eventFilter(QObject*, QEvent *event);
+ bool eventFilter(QObject*, QEvent *event) override;
private:
bool m_hidden;
QSize m_size;
KisSizeGroupPrivate* m_group;
};
#endif // KISSIZEGROUPPRIVATE_H
diff --git a/libs/ui/widgets/kis_slider_spin_box.h b/libs/ui/widgets/kis_slider_spin_box.h
index 448fa0bc32..eaaa1b54b8 100644
--- a/libs/ui/widgets/kis_slider_spin_box.h
+++ b/libs/ui/widgets/kis_slider_spin_box.h
@@ -1,179 +1,179 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Justin Noel <justin@ics.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISSLIDERSPINBOX_H
#define KISSLIDERSPINBOX_H
#include <QAbstractSpinBox>
#include <QStyleOptionSpinBox>
#include <QStyleOptionProgressBar>
#include <kritaui_export.h>
class KisAbstractSliderSpinBoxPrivate;
class KisSliderSpinBoxPrivate;
class KisDoubleSliderSpinBoxPrivate;
/**
* XXX: when inactive, also show the progress bar part as inactive!
*/
class KRITAUI_EXPORT KisAbstractSliderSpinBox : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(KisAbstractSliderSpinBox)
Q_DECLARE_PRIVATE(KisAbstractSliderSpinBox)
protected:
explicit KisAbstractSliderSpinBox(QWidget* parent, KisAbstractSliderSpinBoxPrivate*);
public:
- virtual ~KisAbstractSliderSpinBox();
+ ~KisAbstractSliderSpinBox() override;
void showEdit();
void hideEdit();
void setPrefix(const QString& prefix);
void setSuffix(const QString& suffix);
void setExponentRatio(qreal dbl);
/**
* If set to block, it informs inheriting classes that they shouldn't emit signals
* if the update comes from a mouse dragging the slider.
* Set this to true when dragging the slider and updates during the drag are not needed.
*/
void setBlockUpdateSignalOnDrag(bool block);
- virtual QSize sizeHint() const;
- virtual QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
virtual QSize minimumSize() const;
bool isDragging() const;
protected:
- virtual void paintEvent(QPaintEvent* e);
- virtual void mousePressEvent(QMouseEvent* e);
- virtual void mouseReleaseEvent(QMouseEvent* e);
- virtual void mouseMoveEvent(QMouseEvent* e);
- virtual void keyPressEvent(QKeyEvent* e);
- virtual void wheelEvent(QWheelEvent *);
+ void paintEvent(QPaintEvent* e) override;
+ void mousePressEvent(QMouseEvent* e) override;
+ void mouseReleaseEvent(QMouseEvent* e) override;
+ void mouseMoveEvent(QMouseEvent* e) override;
+ void keyPressEvent(QKeyEvent* e) override;
+ void wheelEvent(QWheelEvent *) override;
- virtual bool eventFilter(QObject* recv, QEvent* e);
+ bool eventFilter(QObject* recv, QEvent* e) override;
QStyleOptionSpinBox spinBoxOptions() const;
QStyleOptionProgressBar progressBarOptions() const;
QRect progressRect(const QStyleOptionSpinBox& spinBoxOptions) const;
QRect upButtonRect(const QStyleOptionSpinBox& spinBoxOptions) const;
QRect downButtonRect(const QStyleOptionSpinBox& spinBoxOptions) const;
int valueForX(int x, Qt::KeyboardModifiers modifiers = Qt::NoModifier) const;
void commitEnteredValue();
virtual QString valueString() const = 0;
/**
* Sets the slider internal value. Inheriting classes should respect blockUpdateSignal
* so that, in specific cases, we have a performance improvement. See setIgnoreMouseMoveEvents.
*/
virtual void setInternalValue(int value, bool blockUpdateSignal) = 0;
protected Q_SLOTS:
- void contextMenuEvent(QContextMenuEvent * event);
+ void contextMenuEvent(QContextMenuEvent * event) override;
void editLostFocus();
protected:
KisAbstractSliderSpinBoxPrivate* const d_ptr;
// QWidget interface
protected:
- virtual void changeEvent(QEvent *e);
+ void changeEvent(QEvent *e) override;
void paint(QPainter& painter);
void paintFusion(QPainter& painter);
void paintPlastique(QPainter& painter);
void paintBreeze(QPainter& painter);
private:
void setInternalValue(int value);
};
class KRITAUI_EXPORT KisSliderSpinBox : public KisAbstractSliderSpinBox
{
Q_OBJECT
Q_DECLARE_PRIVATE(KisSliderSpinBox)
Q_PROPERTY( int minimum READ minimum WRITE setMinimum )
Q_PROPERTY( int maximum READ maximum WRITE setMaximum )
public:
KisSliderSpinBox(QWidget* parent = 0);
- ~KisSliderSpinBox();
+ ~KisSliderSpinBox() override;
void setRange(int minimum, int maximum);
int minimum() const;
void setMinimum(int minimum);
int maximum() const;
void setMaximum(int maximum);
int fastSliderStep() const;
void setFastSliderStep(int step);
///Get the value, don't use value()
int value();
void setSingleStep(int value);
void setPageStep(int value);
public Q_SLOTS:
///Set the value, don't use setValue()
void setValue(int value);
protected:
- virtual QString valueString() const;
- virtual void setInternalValue(int value, bool blockUpdateSignal);
+ QString valueString() const override;
+ void setInternalValue(int value, bool blockUpdateSignal) override;
Q_SIGNALS:
void valueChanged(int value);
};
class KRITAUI_EXPORT KisDoubleSliderSpinBox : public KisAbstractSliderSpinBox
{
Q_OBJECT
Q_DECLARE_PRIVATE(KisDoubleSliderSpinBox)
public:
KisDoubleSliderSpinBox(QWidget* parent = 0);
- ~KisDoubleSliderSpinBox();
+ ~KisDoubleSliderSpinBox() override;
void setRange(qreal minimum, qreal maximum, int decimals = 0);
qreal minimum() const;
void setMinimum(qreal minimum);
qreal maximum() const;
void setMaximum(qreal maximum);
qreal fastSliderStep() const;
void setFastSliderStep(qreal step);
qreal value();
void setSingleStep(qreal value);
public Q_SLOTS:
void setValue(qreal value);
protected:
- virtual QString valueString() const;
- virtual void setInternalValue(int value, bool blockUpdateSignal);
+ QString valueString() const override;
+ void setInternalValue(int value, bool blockUpdateSignal) override;
Q_SIGNALS:
void valueChanged(qreal value);
};
#endif //kISSLIDERSPINBOX_H
diff --git a/libs/ui/widgets/kis_spinbox_color_selector.h b/libs/ui/widgets/kis_spinbox_color_selector.h
index 7c3106f485..772f4fe882 100644
--- a/libs/ui/widgets/kis_spinbox_color_selector.h
+++ b/libs/ui/widgets/kis_spinbox_color_selector.h
@@ -1,59 +1,59 @@
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSPINBOXCOLORSELECTOR_H
#define KISSPINBOXCOLORSELECTOR_H
#include <QWidget>
#include "kritaui_export.h"
#include <QScopedPointer>
#include "KoColor.h"
#include "KoColorSpace.h"
/**
* @brief The KisSpinboxColorSelector class
* This will give a widget with spinboxes depending on the color space
* Take responsibility for changing the color space.
*/
class KRITAUI_EXPORT KisSpinboxColorSelector : public QWidget
{
Q_OBJECT
public:
explicit KisSpinboxColorSelector(QWidget *parent);
- ~KisSpinboxColorSelector();
+ ~KisSpinboxColorSelector() override;
void chooseAlpha(bool chooseAlpha);
Q_SIGNALS:
void sigNewColor(KoColor color);
public Q_SLOTS:
void slotSetColorSpace(const KoColorSpace *cs);
void slotSetColor(KoColor color);
private Q_SLOTS:
void slotUpdateFromSpinBoxes();
private:
struct Private;
const QScopedPointer<Private> m_d;
void createColorFromSpinboxValues();
void updateSpinboxesWithNewValues();
};
#endif // KISSPINBOXCOLORSELECTOR_H
diff --git a/libs/ui/widgets/kis_stopgradient_slider_widget.h b/libs/ui/widgets/kis_stopgradient_slider_widget.h
index f1ebd96a49..b7d5c91f87 100644
--- a/libs/ui/widgets/kis_stopgradient_slider_widget.h
+++ b/libs/ui/widgets/kis_stopgradient_slider_widget.h
@@ -1,82 +1,82 @@
/*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
* 2016 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_STOP_GRADIENT_SLIDER_WIDGET_H_
#define _KIS_STOP_GRADIENT_SLIDER_WIDGET_H_
#include <QWidget>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QScopedPointer>
#include <resources/KoStopGradient.h>
class KisStopGradientSliderWidget : public QWidget
{
Q_OBJECT
public:
KisStopGradientSliderWidget(QWidget *parent = 0, Qt::WFlags f = 0);
public:
- virtual void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
void setGradientResource(KoStopGradient* gradient);
int selectedStop();
void setSelectedStop(int selected);
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
Q_SIGNALS:
void sigSelectedStop(int stop);
protected:
- virtual void mousePressEvent(QMouseEvent * e);
- virtual void mouseReleaseEvent(QMouseEvent * e);
- virtual void mouseMoveEvent(QMouseEvent * e);
+ void mousePressEvent(QMouseEvent * e) override;
+ void mouseReleaseEvent(QMouseEvent * e) override;
+ void mouseMoveEvent(QMouseEvent * e) override;
private Q_SLOTS:
void updateHandleSize();
private:
void insertStop(double t);
QRect sliderRect() const;
QRect gradientStripeRect() const;
QRect handlesStipeRect() const;
QRegion allowedClickRegion(int tolerance) const;
void updateCursor(const QPoint &pos);
void paintHandle(qreal position, const QColor &color, bool isSelected, QPainter *painter);
int handleClickTolerance() const;
int minimalHeight() const;
private:
QScopedPointer<KoStopGradient> m_defaultGradient;
KoStopGradient* m_gradient;
int m_selectedStop;
KoGradientStop m_removedStop;
bool m_drag;
QSize m_handleSize;
};
#endif
diff --git a/libs/ui/widgets/kis_tone_curve_widget.h b/libs/ui/widgets/kis_tone_curve_widget.h
index 25fa811580..d0d657c4ae 100644
--- a/libs/ui/widgets/kis_tone_curve_widget.h
+++ b/libs/ui/widgets/kis_tone_curve_widget.h
@@ -1,67 +1,67 @@
/*
* Copyright (C) 2015 by Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* Based on the Digikam CIE Tongue widget
* Copyright (C) 2006-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* Any source code are inspired from lprof project and
* Copyright (C) 1998-2001 Marti Maria
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#ifndef KIS_TONECURVEWIDGET_H
#define KIS_TONECURVEWIDGET_H
#include <QWidget>
#include <QColor>
#include <QPaintEvent>
#include <kritaui_export.h>
class KRITAUI_EXPORT KisToneCurveWidget : public QWidget
{
Q_OBJECT
public:
KisToneCurveWidget(QWidget *parent=0);
- ~KisToneCurveWidget();
+ ~KisToneCurveWidget() override;
void setGreyscaleCurve(QPolygonF poly);
void setRGBCurve(QPolygonF red, QPolygonF green, QPolygonF blue);
void setCMYKCurve(QPolygonF cyan, QPolygonF magenta, QPolygonF yellow, QPolygonF key);
void setProfileDataAvailable(bool dataAvailable);
protected:
int grids(double val) const;
void drawGrid();
- void resizeEvent(QResizeEvent* event);
- void paintEvent(QPaintEvent*);
+ void resizeEvent(QResizeEvent* event) override;
+ void paintEvent(QPaintEvent*) override;
private:
void updatePixmap();
void mapPoint(QPointF & xy);
void biasedLine(int x1, int y1, int x2, int y2);
void biasedText(int x, int y, const QString& txt);
private :
class Private;
Private* const d;
};
#endif /* KISTONECURVEWIDGET_H */
\ No newline at end of file
diff --git a/libs/ui/widgets/kis_tool_button.h b/libs/ui/widgets/kis_tool_button.h
index 2d8f8fafc0..e7c7f9997a 100644
--- a/libs/ui/widgets/kis_tool_button.h
+++ b/libs/ui/widgets/kis_tool_button.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_BUTTON_H
#define KIS_TOOL_BUTTON_H
#include <QToolButton>
#include <kritaui_export.h>
/** This class exists to work around a bug in QToolButton when in
* MenuPopupButton mode. The correct (mouse) behavior is to display
* the menu with the first click, and let the user choose an item with
* the next click. The buggy behavior presented by the tablet is to
* present the menu and immediately select an item when the user
* performs a stylus tip click. This workaround solves this.
*/
class KRITAUI_EXPORT KisToolButton : public QToolButton
{
Q_OBJECT
public:
explicit KisToolButton(QWidget *parent = 0);
protected:
- virtual void mousePressEvent(QMouseEvent *e);
- virtual void mouseReleaseEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
private:
bool m_tabletContact;
};
#endif // KIS_TOOL_BUTTON_H
diff --git a/libs/ui/widgets/kis_tool_options_popup.h b/libs/ui/widgets/kis_tool_options_popup.h
index 6053719076..c75bb275ff 100644
--- a/libs/ui/widgets/kis_tool_options_popup.h
+++ b/libs/ui/widgets/kis_tool_options_popup.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_OPTIONS_POPUP_H
#define KIS_TOOL_OPTIONS_POPUP_H
#include <QWidget>
#include <QPointer>
class KisToolOptionsPopup : public QWidget
{
Q_OBJECT
public:
explicit KisToolOptionsPopup(QWidget *parent = 0);
- virtual ~KisToolOptionsPopup();
+ ~KisToolOptionsPopup() override;
bool detached() const;
void newOptionWidgets(const QList<QPointer<QWidget> > &optionWidgetList);
Q_SIGNALS:
public Q_SLOTS:
void switchDetached(bool show = true);
protected:
- void contextMenuEvent(QContextMenuEvent *);
- void hideEvent(QHideEvent *);
- void showEvent(QShowEvent *);
+ void contextMenuEvent(QContextMenuEvent *) override;
+ void hideEvent(QHideEvent *) override;
+ void showEvent(QShowEvent *) override;
private:
struct Private;
Private *const d;
};
#endif // KIS_TOOL_OPTIONS_POPUP_H
diff --git a/libs/ui/widgets/kis_wdg_generator.h b/libs/ui/widgets/kis_wdg_generator.h
index a81afd2c68..06c83517b1 100644
--- a/libs/ui/widgets/kis_wdg_generator.h
+++ b/libs/ui/widgets/kis_wdg_generator.h
@@ -1,65 +1,65 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_GENERATOR_H
#define KIS_WDG_GENERATOR_H
#include <QWidget>
#include <kis_types.h>
class KisFilterConfiguration;
class KisViewManager;
/**
* A widget that allows users to select a generator and
* create a config object for it.
*
* XXX: make use of bookmarked configuration things, like
* in the filter widget.
*/
class KisWdgGenerator : public QWidget
{
Q_OBJECT
public:
KisWdgGenerator(QWidget * parent);
KisWdgGenerator(QWidget * parent, KisPaintDeviceSP dev);
- ~KisWdgGenerator();
+ ~KisWdgGenerator() override;
void initialize(KisViewManager *view);
void setConfiguration(const KisFilterConfigurationSP config);
KisFilterConfigurationSP configuration();
private Q_SLOTS:
void slotGeneratorActivated(int);
private:
struct Private;
Private * const d;
};
#endif
diff --git a/libs/ui/widgets/kis_widget_chooser.h b/libs/ui/widgets/kis_widget_chooser.h
index 12e03629b1..0c36c4016b 100644
--- a/libs/ui/widgets/kis_widget_chooser.h
+++ b/libs/ui/widgets/kis_widget_chooser.h
@@ -1,106 +1,106 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef H_KIS_WIDGET_CHOOSER_H_
#define H_KIS_WIDGET_CHOOSER_H_
#include <kritaui_export.h>
#include <QList>
#include <QIcon>
#include <QFrame>
class QToolButton;
class QLabel;
class QButtonGroup;
class KRITAUI_EXPORT KisWidgetChooser: public QFrame
{
Q_OBJECT
struct Data
{
Data(const QString& ID):
id(ID), widget(0), label(0), choosen(false) { }
Data(const Data& d):
id(d.id), widget(d.widget), label(d.label), choosen(d.choosen) { }
Data(const QString& ID, QWidget* w, QLabel* l):
id(ID), widget(w), label(l), choosen(false) { }
friend bool operator == (const Data& a, const Data& b) {
return a.id == b.id;
}
QString id;
QWidget* widget;
QLabel* label;
bool choosen;
};
typedef QList<Data>::iterator Iterator;
typedef QList<Data>::const_iterator ConstIterator;
public:
KisWidgetChooser(int id, QWidget* parent=0);
- ~KisWidgetChooser();
+ ~KisWidgetChooser() override;
QWidget* chooseWidget(const QString& id);
void addWidget(const QString& id, const QString& label, QWidget* widget);
QWidget* getWidget(const QString& id) const;
template<class TWidget>
TWidget* addWidget(const QString& id, const QString& label = "") {
TWidget* widget = new TWidget();
addWidget(id, label, widget);
return widget;
}
template<class TWidget>
TWidget* getWidget(const QString& id) const {
return dynamic_cast<TWidget*>(getWidget(id));
}
public Q_SLOTS:
void showPopupWidget();
void updateThemedIcons();
private:
void removeWidget(const QString& id);
QLayout* createPopupLayout();
QLayout* createLayout();
void updateArrowIcon();
protected Q_SLOTS:
void slotButtonPressed();
void slotWidgetChoosen(int index);
// QWidget interface
protected:
- virtual void changeEvent(QEvent *e);
+ void changeEvent(QEvent *e) override;
private:
int m_chooserid;
QIcon m_acceptIcon;
QToolButton* m_arrowButton;
QButtonGroup* m_buttons;
QFrame* m_popup;
QString m_choosenID;
QList<Data> m_widgets;
};
#endif // H_KIS_WIDGET_CHOOSER_H_
diff --git a/libs/ui/widgets/kis_workspace_chooser.h b/libs/ui/widgets/kis_workspace_chooser.h
index ca4a3fbd8a..3582b13d2a 100644
--- a/libs/ui/widgets/kis_workspace_chooser.h
+++ b/libs/ui/widgets/kis_workspace_chooser.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WORKSPACE_CHOOSER_H
#define KIS_WORKSPACE_CHOOSER_H
#include <QWidget>
class QLineEdit;
class KoResourceItemChooser;
class KisViewManager;
class KoResource;
class KisWorkspaceChooser : public QWidget
{
Q_OBJECT
public:
KisWorkspaceChooser(KisViewManager * view, QWidget* parent = 0);
- virtual ~KisWorkspaceChooser();
+ ~KisWorkspaceChooser() override;
private Q_SLOTS:
void slotSave();
void resourceSelected( KoResource * resource );
private:
KoResourceItemChooser * m_itemChooser;
KisViewManager* m_view;
QLineEdit* m_nameEdit;
};
#endif // KIS_WORKSPACE_CHOOSER_H
diff --git a/libs/ui/widgets/squeezedcombobox.h b/libs/ui/widgets/squeezedcombobox.h
index 205c0bf0a9..20df604548 100644
--- a/libs/ui/widgets/squeezedcombobox.h
+++ b/libs/ui/widgets/squeezedcombobox.h
@@ -1,135 +1,135 @@
/* ============================================================
* Author: Tom Albers <tomalbers@kde.nl>
* Date : 2005-01-01
* Description :
*
* Copyright 2005 by Tom Albers <tomalbers@kde.nl>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
/** @file widgets/squeezedcombobox.h */
#ifndef SQUEEZEDCOMBOBOX_H
#define SQUEEZEDCOMBOBOX_H
class QTimer;
class QResizeEvent;
class QWidget;
// Qt includes.
#include <QComboBox>
#include <QWidget>
#include <kritaui_export.h>
/** @class SqueezedComboBox
*
* This widget is a QComboBox, but then a little bit
* different. It only shows the right part of the items
* depending on de size of the widget. When it is not
* possible to show the complete item, it will be shortened
* and "..." will be prepended.
*
* @image html squeezedcombobox.png "This is how it looks"
* @author Tom Albers
*/
class KRITAUI_EXPORT SqueezedComboBox : public QComboBox
{
Q_OBJECT
public:
/**
* Constructor
* @param parent parent widget
* @param name name to give to the widget
*/
SqueezedComboBox(QWidget *parent = 0, const char *name = 0);
/**
* destructor
*/
- virtual ~SqueezedComboBox();
+ ~SqueezedComboBox() override;
/**
*
* Returns true if the combobox contains the original (not-squeezed)
* version of text.
* @param text the original (not-squeezed) text to check for
*/
bool contains(const QString & text) const;
/**
*
* Returns index of a orinal text, -1 if the text isn't found
* @param text the original (not-squeezed) text to search for
*/
qint32 findOriginalText(const QString & text) const;
/**
* This inserts a item to the list. See QComboBox::insertItem()
* for detaills. Please do not use QComboBox::insertItem() to this
* widget, as that will fail.
* @param newItem the original (long version) of the item which needs
* to be added to the combobox
* @param index the position in the widget.
*/
void insertSqueezedItem(const QString& newItem, int index, QVariant userData = QVariant());
/**
* Append an item.
* @param newItem the original (long version) of the item which needs
* to be added to the combobox
*/
void addSqueezedItem(const QString& newItem, QVariant userData = QVariant());
/**
* Set the current item to the one matching the given text.
*
* @param itemText the original (long version) of the item text
*/
void setCurrent(const QString& itemText);
/**
* This method returns the full text (not squeezed) of the currently
* highlighted item.
* @return full text of the highlighted item
*/
QString itemHighlighted();
/**
* Sets the sizeHint() of this widget.
*/
- virtual QSize sizeHint() const;
+ QSize sizeHint() const override;
private Q_SLOTS:
void slotTimeOut();
private:
- void resizeEvent(QResizeEvent *);
+ void resizeEvent(QResizeEvent *) override;
QString squeezeText(const QString& original);
// Prevent these from being used.
void setCurrentText(const QString& itemText);
void insertItem(const QString &text);
void insertItem(qint32 index, const QString &text);
void addItem(const QString &text);
QMap<int, QString> m_originalItems;
QTimer* m_timer;
};
#endif // SQUEEZEDCOMBOBOX_H
diff --git a/libs/vectorimage/libemf/EmfOutputDebugStrategy.h b/libs/vectorimage/libemf/EmfOutputDebugStrategy.h
index f730a07442..6b21f6a4ff 100644
--- a/libs/vectorimage/libemf/EmfOutputDebugStrategy.h
+++ b/libs/vectorimage/libemf/EmfOutputDebugStrategy.h
@@ -1,123 +1,123 @@
/*
Copyright 2008 Brad Hards <bradh@frogmouth.net>
Copyright 2009 Inge Wallin <inge@lysator.liu.se>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EMFOUTPUTDEBUGSTRATEGY_H
#define EMFOUTPUTDEBUGSTRATEGY_H
#include "kritavectorimage_export.h"
#include <QList>
#include <QPainter>
#include <QRect> // also provides QSize, QPoint
#include <QString>
#include <QVariant>
#include "EmfEnums.h"
#include "EmfHeader.h"
#include "EmfRecords.h"
#include "EmfOutput.h"
/**
\file
Contains definitions for an EMF debug output strategy
*/
/**
Namespace for Enhanced Metafile (EMF) classes
*/
namespace Libemf
{
/**
Debug (text dump) output strategy for EMF Parser
*/
class KRITAVECTORIMAGE_EXPORT OutputDebugStrategy : public AbstractOutput
{
public:
OutputDebugStrategy();
- ~OutputDebugStrategy();
+ ~OutputDebugStrategy() override;
- void init( const Header *header );
- void cleanup( const Header *header );
- void eof();
+ void init( const Header *header ) override;
+ void cleanup( const Header *header ) override;
+ void eof() override;
void createPen( quint32 ihPen, quint32 penStyle, quint32 x, quint32 y,
- quint8 red, quint8 green, quint8 blue, quint8 reserved );
+ quint8 red, quint8 green, quint8 blue, quint8 reserved ) override;
void createBrushIndirect( quint32 ihBrush, quint32 BrushStyle, quint8 red,
quint8 green, quint8 blue, quint8 reserved,
- quint32 BrushHatch );
- void createMonoBrush( quint32 ihBrush, Bitmap *bitmap );
- void selectObject( const quint32 ihObject );
- void deleteObject( const quint32 ihObject );
- void arc( const QRect &box, const QPoint &start, const QPoint &end );
- void chord( const QRect &box, const QPoint &start, const QPoint &end );
- void pie( const QRect &box, const QPoint &start, const QPoint &end );
- void ellipse( const QRect &box );
- void rectangle( const QRect &box );
- void setMapMode( const quint32 mapMode );
- void setMetaRgn();
- void setWindowOrgEx( const QPoint &origin );
- void setWindowExtEx( const QSize &size );
- void setViewportOrgEx( const QPoint &origin );
- void setViewportExtEx( const QSize &size );
- void beginPath();
- void closeFigure();
- void endPath();
- void setBkMode( const quint32 backgroundMode );
- void setPolyFillMode( const quint32 polyFillMode );
- void setLayout( const quint32 layoutMode );
- void extCreateFontIndirectW( const ExtCreateFontIndirectWRecord &extCreateFontIndirectW );
- void setTextAlign( const quint32 textAlignMode );
+ quint32 BrushHatch ) override;
+ void createMonoBrush( quint32 ihBrush, Bitmap *bitmap ) override;
+ void selectObject( const quint32 ihObject ) override;
+ void deleteObject( const quint32 ihObject ) override;
+ void arc( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void chord( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void pie( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void ellipse( const QRect &box ) override;
+ void rectangle( const QRect &box ) override;
+ void setMapMode( const quint32 mapMode ) override;
+ void setMetaRgn() override;
+ void setWindowOrgEx( const QPoint &origin ) override;
+ void setWindowExtEx( const QSize &size ) override;
+ void setViewportOrgEx( const QPoint &origin ) override;
+ void setViewportExtEx( const QSize &size ) override;
+ void beginPath() override;
+ void closeFigure() override;
+ void endPath() override;
+ void setBkMode( const quint32 backgroundMode ) override;
+ void setPolyFillMode( const quint32 polyFillMode ) override;
+ void setLayout( const quint32 layoutMode ) override;
+ void extCreateFontIndirectW( const ExtCreateFontIndirectWRecord &extCreateFontIndirectW ) override;
+ void setTextAlign( const quint32 textAlignMode ) override;
void setTextColor( const quint8 red, const quint8 green, const quint8 blue,
- const quint8 reserved );
+ const quint8 reserved ) override;
void setBkColor( const quint8 red, const quint8 green, const quint8 blue,
- const quint8 reserved );
- void setPixelV( QPoint &point, quint8 red, quint8 green, quint8 blue, quint8 reserved );
+ const quint8 reserved ) override;
+ void setPixelV( QPoint &point, quint8 red, quint8 green, quint8 blue, quint8 reserved ) override;
void modifyWorldTransform( quint32 mode, float M11, float M12,
- float M21, float M22, float Dx, float Dy );
+ float M21, float M22, float Dx, float Dy ) override;
void setWorldTransform( float M11, float M12, float M21,
- float M22, float Dx, float Dy );
- void extTextOut( const QRect &bounds, const EmrTextObject &textObject );
- void moveToEx( const qint32 x, const qint32 y );
- void saveDC();
- void restoreDC( const qint32 savedDC );
- void lineTo( const QPoint &finishPoint );
- void arcTo( const QRect &box, const QPoint &start, const QPoint &end );
- void polygon16( const QRect &bounds, const QList<QPoint> points );
- void polyLine( const QRect &bounds, const QList<QPoint> points );
- void polyLine16( const QRect &bounds, const QList<QPoint> points );
- void polyPolygon16( const QRect &bounds, const QList< QVector< QPoint > > &points );
- void polyPolyLine16( const QRect &bounds, const QList< QVector< QPoint > > &points );
- void polyLineTo16( const QRect &bounds, const QList<QPoint> points );
- void polyBezier16( const QRect &bounds, const QList<QPoint> points );
- void polyBezierTo16( const QRect &bounds, const QList<QPoint> points );
- void fillPath( const QRect &bounds );
- void strokeAndFillPath( const QRect &bounds );
- void strokePath( const QRect &bounds );
- void setClipPath( const quint32 regionMode );
- void bitBlt( BitBltRecord &bitBltRecord );
- void setStretchBltMode( const quint32 stretchMode );
- void stretchDiBits( StretchDiBitsRecord &stretchDiBitsRecord );
+ float M22, float Dx, float Dy ) override;
+ void extTextOut( const QRect &bounds, const EmrTextObject &textObject ) override;
+ void moveToEx( const qint32 x, const qint32 y ) override;
+ void saveDC() override;
+ void restoreDC( const qint32 savedDC ) override;
+ void lineTo( const QPoint &finishPoint ) override;
+ void arcTo( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void polygon16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyLine( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyLine16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyPolygon16( const QRect &bounds, const QList< QVector< QPoint > > &points ) override;
+ void polyPolyLine16( const QRect &bounds, const QList< QVector< QPoint > > &points ) override;
+ void polyLineTo16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyBezier16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyBezierTo16( const QRect &bounds, const QList<QPoint> points ) override;
+ void fillPath( const QRect &bounds ) override;
+ void strokeAndFillPath( const QRect &bounds ) override;
+ void strokePath( const QRect &bounds ) override;
+ void setClipPath( const quint32 regionMode ) override;
+ void bitBlt( BitBltRecord &bitBltRecord ) override;
+ void setStretchBltMode( const quint32 stretchMode ) override;
+ void stretchDiBits( StretchDiBitsRecord &stretchDiBitsRecord ) override;
};
}
#endif
diff --git a/libs/vectorimage/libemf/EmfOutputPainterStrategy.h b/libs/vectorimage/libemf/EmfOutputPainterStrategy.h
index 0cbf5d55d1..bb2a1f9618 100644
--- a/libs/vectorimage/libemf/EmfOutputPainterStrategy.h
+++ b/libs/vectorimage/libemf/EmfOutputPainterStrategy.h
@@ -1,253 +1,253 @@
/*
Copyright 2008 Brad Hards <bradh@frogmouth.net>
Copyright 2009 - 2010 Inge Wallin <inge@lysator.liu.se>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EMFOUTPUTPAINTERSTRATEGY_H
#define EMFOUTPUTPAINTERSTRATEGY_H
#include "kritavectorimage_export.h"
#include <QList>
#include <QPainter>
#include <QRect> // also provides QSize, QPoint
#include <QString>
#include <QVariant>
#include "EmfEnums.h"
#include "EmfHeader.h"
#include "EmfRecords.h"
#include "EmfOutput.h"
/**
\file
Primary definitions for EMF output strategies
*/
/**
Namespace for Enhanced Metafile (EMF) classes
*/
namespace Libemf
{
class EmrTextObject;
/**
QPainter based output strategy for EMF Parser.
This class allows rendering of an EMF file to a QPixmap or any other QPaintDevice.
*/
class KRITAVECTORIMAGE_EXPORT OutputPainterStrategy : public AbstractOutput
{
public:
/**
Constructor.
This will probably need to take an enum to say what sort of output
we want.
*/
OutputPainterStrategy();
OutputPainterStrategy( QPainter &painter, QSize &size,
bool keepAspectRatio = false );
- ~OutputPainterStrategy();
+ ~OutputPainterStrategy() override;
- void init( const Header *header );
- void cleanup( const Header *header );
- void eof();
+ void init( const Header *header ) override;
+ void cleanup( const Header *header ) override;
+ void eof() override;
/**
The image that has been rendered to.
*/
QImage *image();
void createPen( quint32 ihPen, quint32 penStyle, quint32 x, quint32 y,
- quint8 red, quint8 green, quint8 blue, quint8 reserved );
+ quint8 red, quint8 green, quint8 blue, quint8 reserved ) override;
void createBrushIndirect( quint32 ihBrush, quint32 BrushStyle, quint8 red,
quint8 green, quint8 blue, quint8 reserved,
- quint32 BrushHatch );
- void createMonoBrush( quint32 ihBrush, Bitmap *bitmap );
- void selectObject( const quint32 ihObject );
- void deleteObject( const quint32 ihObject );
- void arc( const QRect &box, const QPoint &start, const QPoint &end );
- void chord( const QRect &box, const QPoint &start, const QPoint &end );
- void pie( const QRect &box, const QPoint &start, const QPoint &end );
- void ellipse( const QRect &box );
- void rectangle( const QRect &box );
- void setMapMode( const quint32 mapMode );
- void setMetaRgn();
- void setWindowOrgEx( const QPoint &origin );
- void setWindowExtEx( const QSize &size );
- void setViewportOrgEx( const QPoint &origin );
- void setViewportExtEx( const QSize &size );
- void beginPath();
- void closeFigure();
- void endPath();
- void setBkMode( const quint32 backgroundMode );
- void setPolyFillMode( const quint32 polyFillMode );
- void setLayout( const quint32 layoutMode );
- void extCreateFontIndirectW( const ExtCreateFontIndirectWRecord &extCreateFontIndirectW );
- void setTextAlign( const quint32 textAlignMode );
+ quint32 BrushHatch ) override;
+ void createMonoBrush( quint32 ihBrush, Bitmap *bitmap ) override;
+ void selectObject( const quint32 ihObject ) override;
+ void deleteObject( const quint32 ihObject ) override;
+ void arc( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void chord( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void pie( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void ellipse( const QRect &box ) override;
+ void rectangle( const QRect &box ) override;
+ void setMapMode( const quint32 mapMode ) override;
+ void setMetaRgn() override;
+ void setWindowOrgEx( const QPoint &origin ) override;
+ void setWindowExtEx( const QSize &size ) override;
+ void setViewportOrgEx( const QPoint &origin ) override;
+ void setViewportExtEx( const QSize &size ) override;
+ void beginPath() override;
+ void closeFigure() override;
+ void endPath() override;
+ void setBkMode( const quint32 backgroundMode ) override;
+ void setPolyFillMode( const quint32 polyFillMode ) override;
+ void setLayout( const quint32 layoutMode ) override;
+ void extCreateFontIndirectW( const ExtCreateFontIndirectWRecord &extCreateFontIndirectW ) override;
+ void setTextAlign( const quint32 textAlignMode ) override;
void setTextColor( const quint8 red, const quint8 green, const quint8 blue,
- const quint8 reserved );
+ const quint8 reserved ) override;
void setBkColor( const quint8 red, const quint8 green, const quint8 blue,
- const quint8 reserved );
- void setPixelV( QPoint &point, quint8 red, quint8 green, quint8 blue, quint8 reserved );
+ const quint8 reserved ) override;
+ void setPixelV( QPoint &point, quint8 red, quint8 green, quint8 blue, quint8 reserved ) override;
void modifyWorldTransform( quint32 mode, float M11, float M12,
- float M21, float M22, float Dx, float Dy );
+ float M21, float M22, float Dx, float Dy ) override;
void setWorldTransform( float M11, float M12, float M21,
- float M22, float Dx, float Dy );
- void extTextOut( const QRect &bounds, const EmrTextObject &textObject );
- void moveToEx( const qint32 x, const qint32 y );
- void saveDC();
- void restoreDC( const qint32 savedDC );
- void lineTo( const QPoint &finishPoint );
- void arcTo( const QRect &box, const QPoint &start, const QPoint &end );
- void polygon16( const QRect &bounds, const QList<QPoint> points );
- void polyLine16( const QRect &bounds, const QList<QPoint> points );
- void polyPolygon16( const QRect &bounds, const QList< QVector< QPoint > > &points );
- void polyPolyLine16( const QRect &bounds, const QList< QVector< QPoint > > &points );
- void polyLine( const QRect &bounds, const QList<QPoint> points );
- void polyLineTo16( const QRect &bounds, const QList<QPoint> points );
- void polyBezier16( const QRect &bounds, const QList<QPoint> points );
- void polyBezierTo16( const QRect &bounds, const QList<QPoint> points );
- void fillPath( const QRect &bounds );
- void strokeAndFillPath( const QRect &bounds );
- void strokePath( const QRect &bounds );
- void setClipPath( const quint32 regionMode );
- void bitBlt( BitBltRecord &bitBltRecord );
- void setStretchBltMode( const quint32 stretchMode );
- void stretchDiBits( StretchDiBitsRecord &stretchDiBitsRecord );
+ float M22, float Dx, float Dy ) override;
+ void extTextOut( const QRect &bounds, const EmrTextObject &textObject ) override;
+ void moveToEx( const qint32 x, const qint32 y ) override;
+ void saveDC() override;
+ void restoreDC( const qint32 savedDC ) override;
+ void lineTo( const QPoint &finishPoint ) override;
+ void arcTo( const QRect &box, const QPoint &start, const QPoint &end ) override;
+ void polygon16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyLine16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyPolygon16( const QRect &bounds, const QList< QVector< QPoint > > &points ) override;
+ void polyPolyLine16( const QRect &bounds, const QList< QVector< QPoint > > &points ) override;
+ void polyLine( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyLineTo16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyBezier16( const QRect &bounds, const QList<QPoint> points ) override;
+ void polyBezierTo16( const QRect &bounds, const QList<QPoint> points ) override;
+ void fillPath( const QRect &bounds ) override;
+ void strokeAndFillPath( const QRect &bounds ) override;
+ void strokePath( const QRect &bounds ) override;
+ void setClipPath( const quint32 regionMode ) override;
+ void bitBlt( BitBltRecord &bitBltRecord ) override;
+ void setStretchBltMode( const quint32 stretchMode ) override;
+ void stretchDiBits( StretchDiBitsRecord &stretchDiBitsRecord ) override;
private:
void printPainterTransform(const char *leadText);
/// For debugging purposes: Draw the boundary box.
void paintBounds(const Header *header);
/// Recalculate the world transform and then apply it to the painter
/// This must be called at the end of every function that changes the transform.
void recalculateWorldTransform();
/**
Select a stock object.
See [MS-EMF] Section 2.1.31.
\param ihObject the stock object value
*/
void selectStockObject( const quint32 ihObject );
/**
Helper routine to convert the EMF angle (centrepoint + radial endpoint) into
the Qt format (in degress - may need to multiply by 16 for some purposes)
*/
qreal angleFromArc( const QPoint &centrePoint, const QPoint &radialPoint );
/**
Calculate the angular difference (span) between two angles
This should always be positive.
*/
qreal angularSpan( const qreal startAngle, const qreal endAngle );
/**
Convert the EMF font weight scale (0..1000) to Qt equivalent.
This is a bit rough - the EMF spec only says 400 is normal, and
700 is bold.
*/
int convertFontWeight( quint32 emfWeight );
Header *m_header; // Save to be able to retain scaling.
int m_painterSaves; // The number of times that save() was called.
QSize m_outputSize;
bool m_keepAspectRatio;
QMap<quint32, QVariant> m_objectTable;
QPainterPath *m_path;
bool m_currentlyBuildingPath;
QPainter *m_painter;
QTransform m_worldTransform; // The transform inside the EMF.
QTransform m_outputTransform; // The transform that the painter already had
qreal m_outputScale;
// Everything that has to do with window and viewport calculation
QPoint m_windowOrg;
QSize m_windowExt;
QPoint m_viewportOrg;
QSize m_viewportExt;
bool m_windowExtIsSet;
bool m_viewportExtIsSet;
bool m_windowViewportIsSet;
#if 0
// This matrix is needed because the window / viewport calculation
// is not the last one in the chain. After that one comes the
// transform that the painter already has when the painting
// starts, and that one has to be saved and reapplied again after
// the window / viewport calculation is redone.
QTransform m_outputTransform;
#endif
// ----------------------------------------------------------------
// The playback device context
// The Playback Device Context (PDC) contains the following:
// - bitmap
// - brush (part of the painter)
// - palette
// - font (part of the painter)
// - pen (part of the painter)
// - region
// - drawing mode
// - mapping mode
// FIXME: what more? textalign? textpen?
/**
The current text pen
*/
QPen m_textPen;
/**
The current fill rule
*/
enum Qt::FillRule m_fillRule;
/**
The current map mode
*/
MapMode m_mapMode;
/**
The current text alignment mode
*/
quint32 m_textAlignMode;
/**
The current coordinates
*/
QPoint m_currentCoords;
};
}
#endif
diff --git a/libs/vectorimage/libsvm/SvmPainterBackend.h b/libs/vectorimage/libsvm/SvmPainterBackend.h
index 7e4fc6987e..fc89b0b7d7 100644
--- a/libs/vectorimage/libsvm/SvmPainterBackend.h
+++ b/libs/vectorimage/libsvm/SvmPainterBackend.h
@@ -1,116 +1,116 @@
/*
Copyright 2009 Inge Wallin <inge@lysator.liu.se>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SVMPAINTERBACKEND_H
#define SVMPAINTERBACKEND_H
#include "SvmAbstractBackend.h"
#include "kritavectorimage_export.h"
#include <QSize>
#include <QTransform>
#include "SvmEnums.h"
#include "SvmStructs.h"
#include "SvmGraphicsContext.h"
class QRect;
class QPolygon;
class QPainter;
/**
\file
Primary definitions for SVM output backend
*/
/**
Namespace for StarView Metafile (SVM) classes
*/
namespace Libsvm
{
/**
Painter output strategy for SVM Parser
*/
class KRITAVECTORIMAGE_EXPORT SvmPainterBackend : public SvmAbstractBackend
{
public:
SvmPainterBackend(QPainter *painter, const QSize &outputSize);
- virtual ~SvmPainterBackend();
+ ~SvmPainterBackend() override;
/**
Initialisation routine
\param header the SVM Header record
*/
- virtual void init(const SvmHeader &header);
+ void init(const SvmHeader &header) override;
/**
Cleanup routine
This function is called when the painting is done. Any
initializations that are done in init() can be undone here if
necessary.
*/
- virtual void cleanup();
+ void cleanup() override;
/**
Close-out routine
*/
- virtual void eof();
+ void eof() override;
- virtual void rect( SvmGraphicsContext &context, const QRect &rect );
+ void rect( SvmGraphicsContext &context, const QRect &rect ) override;
/**
Handler META_POLYLINE_ACTION
This action type specifies how to output a multi-segment line
(unfilled polyline).
\param context the graphics context to be used when drawing the polyline
\param polygon the sequence of points that describe the line
\note the line is not meant to be closed (i.e. do not connect
the last point to the first point) or filled.
*/
- virtual void polyLine(SvmGraphicsContext &context, const QPolygon &polyline);
+ void polyLine(SvmGraphicsContext &context, const QPolygon &polyline) override;
- virtual void polygon(SvmGraphicsContext &context, const QPolygon &polygon);
+ void polygon(SvmGraphicsContext &context, const QPolygon &polygon) override;
- virtual void polyPolygon(SvmGraphicsContext &context, const QList<QPolygon> &polyPolygon);
+ void polyPolygon(SvmGraphicsContext &context, const QList<QPolygon> &polyPolygon) override;
- virtual void textArray(SvmGraphicsContext &context,
+ void textArray(SvmGraphicsContext &context,
const QPoint &point, const QString &string,
quint16 startIndex, quint16 len,
- quint32 dxArrayLen, qint32 *dxArray);
+ quint32 dxArrayLen, qint32 *dxArray) override;
private:
void updateFromGraphicscontext(SvmGraphicsContext &context);
private:
QPainter *m_painter;
QSize m_outputSize;
QTransform m_outputTransform;
};
}
#endif
diff --git a/libs/vectorimage/libwmf/WmfPainterBackend.h b/libs/vectorimage/libwmf/WmfPainterBackend.h
index 2b3553ab6d..8f23769a38 100644
--- a/libs/vectorimage/libwmf/WmfPainterBackend.h
+++ b/libs/vectorimage/libwmf/WmfPainterBackend.h
@@ -1,156 +1,156 @@
/* This file is part of the KDE libraries
*
* Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
* 2009-2011 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _WMFPAINTERBACKEND_H_
#define _WMFPAINTERBACKEND_H_
#include "kritavectorimage_export.h"
#include "WmfAbstractBackend.h"
#include <QPainter>
#include <QTransform>
class QPolygon;
/**
Namespace for Windows Metafile (WMF) classes
*/
namespace Libwmf
{
class WmfDeviceContext;
/**
* WmfPainterBackend inherits the abstract class WmfAbstractbackend
* and redirects WMF actions onto a QPaintDevice.
* Uses relative or absolute coordinate.
*
* how to use:
* <pre>
* QPixmap pix(100, 100);
* QPainter painter(pix);
* WmfPainterBackend wmf(painter, pix.size());
* if (wmf.load("/home/test.wmf" )) {
* wmf.play(pix);
* }
* paint.drawPixmap(0, 0, pix);
* </pre>
*
*/
class KRITAVECTORIMAGE_EXPORT WmfPainterBackend : public WmfAbstractBackend
{
public:
WmfPainterBackend(QPainter *painter, const QSizeF &outputSize);
- ~WmfPainterBackend();
+ ~WmfPainterBackend() override;
using WmfAbstractBackend::play;
/**
* Play a WMF file on a QPaintDevice. Return true on success.
*/
//bool play(QPaintDevice& target);
//bool play(QPainter &painter);
- bool play();
+ bool play() override;
private:
// -------------------------------------------------------------------------
// A virtual QPainter
- bool begin(const QRect &boundingBox);
- bool end();
- void save();
- void restore();
+ bool begin(const QRect &boundingBox) override;
+ bool end() override;
+ void save() override;
+ void restore() override;
/// Recalculate the world transform and then apply it to the painter
/// This must be called at the end of every function that changes the transform.
void recalculateWorldTransform();
// Drawing attributes/modes
- void setCompositionMode(QPainter::CompositionMode mode);
+ void setCompositionMode(QPainter::CompositionMode mode) override;
/**
* Change logical Coordinate
* some wmf files call those functions several times in the middle of a drawing
* others wmf files doesn't call setWindow* at all
* negative width and height are possible
*/
- void setWindowOrg(int left, int top);
- void setWindowExt(int width, int height);
- void setViewportOrg(int left, int top);
- void setViewportExt(int width, int height);
+ void setWindowOrg(int left, int top) override;
+ void setWindowExt(int width, int height) override;
+ void setViewportOrg(int left, int top) override;
+ void setViewportExt(int width, int height) override;
// Graphics drawing functions
- void setPixel(WmfDeviceContext &context, int x, int y, QColor color);
- void lineTo(WmfDeviceContext &context, int x, int y);
- void drawRect(WmfDeviceContext &context, int x, int y, int w, int h);
- void drawRoundRect(WmfDeviceContext &context, int x, int y, int w, int h, int = 25, int = 25);
- void drawEllipse(WmfDeviceContext &context, int x, int y, int w, int h);
- void drawArc(WmfDeviceContext &context, int x, int y, int w, int h, int a, int alen);
- void drawPie(WmfDeviceContext &context, int x, int y, int w, int h, int a, int alen);
- void drawChord(WmfDeviceContext &context, int x, int y, int w, int h, int a, int alen);
- void drawPolyline(WmfDeviceContext &context, const QPolygon& pa);
- void drawPolygon(WmfDeviceContext &context, const QPolygon& pa);
+ void setPixel(WmfDeviceContext &context, int x, int y, QColor color) override;
+ void lineTo(WmfDeviceContext &context, int x, int y) override;
+ void drawRect(WmfDeviceContext &context, int x, int y, int w, int h) override;
+ void drawRoundRect(WmfDeviceContext &context, int x, int y, int w, int h, int = 25, int = 25) override;
+ void drawEllipse(WmfDeviceContext &context, int x, int y, int w, int h) override;
+ void drawArc(WmfDeviceContext &context, int x, int y, int w, int h, int a, int alen) override;
+ void drawPie(WmfDeviceContext &context, int x, int y, int w, int h, int a, int alen) override;
+ void drawChord(WmfDeviceContext &context, int x, int y, int w, int h, int a, int alen) override;
+ void drawPolyline(WmfDeviceContext &context, const QPolygon& pa) override;
+ void drawPolygon(WmfDeviceContext &context, const QPolygon& pa) override;
/**
* drawPolyPolygon draw the XOR of a list of polygons
* listPa : list of polygons
*/
- void drawPolyPolygon(WmfDeviceContext &context, QList<QPolygon>& listPa);
+ void drawPolyPolygon(WmfDeviceContext &context, QList<QPolygon>& listPa) override;
void drawImage(WmfDeviceContext &context, int x, int y, const QImage &,
- int sx = 0, int sy = 0, int sw = -1, int sh = -1);
+ int sx = 0, int sy = 0, int sw = -1, int sh = -1) override;
void patBlt(WmfDeviceContext &context, int x, int y, int width, int height,
- quint32 rasterOperation);
+ quint32 rasterOperation) override;
// Text drawing functions
// rotation = the degrees of rotation in counterclockwise
// not yet implemented in KWinMetaFile
- void drawText(WmfDeviceContext &context, int x, int y, const QString &s);
+ void drawText(WmfDeviceContext &context, int x, int y, const QString &s) override;
// matrix transformation : only used in some bitmap manipulation
- void setMatrix(WmfDeviceContext &context, const QMatrix &, bool combine = false);
+ void setMatrix(WmfDeviceContext &context, const QMatrix &, bool combine = false) override;
private:
void updateFromDeviceContext(WmfDeviceContext &context);
protected:
bool mIsInternalPainter; // True if the painter wasn't externally provided.
QPainter *mPainter;
QSizeF mOutputSize;
QPaintDevice *mTarget;
bool mRelativeCoord;
//QPoint mLastPos;
// Everything that has to do with window and viewport calculation
QPoint mWindowOrg;
QSize mWindowExt;
QPoint mViewportOrg;
QSize mViewportExt;
bool mWindowExtIsSet;
bool mViewportExtIsSet;
QTransform mOutputTransform;
QTransform mWorldTransform;
int mSaveCount; //number of times Save() was called without Restore()
};
}
#endif
diff --git a/libs/vectorimage/libwmf/WmfStack.h b/libs/vectorimage/libwmf/WmfStack.h
index d9e59bc141..01f4be5796 100644
--- a/libs/vectorimage/libwmf/WmfStack.h
+++ b/libs/vectorimage/libwmf/WmfStack.h
@@ -1,84 +1,84 @@
/* This file is part of the KDE libraries
Copyright (c) 1998 Stefan Taferner
2001/2003 thierry lorthiois (lorthioist@wanadoo.fr)
2011 Inge Wallin (inge@lysator.liu.se)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _WMFSTACK_H_
#define _WMFSTACK_H_
#include <QPen>
#include <QColor>
#include <QFont>
#include <QBrush>
#include <QImage>
/**
Namespace for Windows Metafile (WMF) classes
*/
namespace Libwmf
{
class WmfAbstractBackend;
class WmfDeviceContext;
/**
* WMF file allows manipulation on a stack of object.
* It's possible to create, delete or select an object.
*/
class KoWmfHandle
{
public:
virtual ~KoWmfHandle() {}
virtual void apply(WmfDeviceContext *) = 0;
};
class KoWmfBrushHandle: public KoWmfHandle
{
public:
- virtual void apply(WmfDeviceContext *);
+ void apply(WmfDeviceContext *) override;
QBrush brush;
};
class KoWmfPenHandle: public KoWmfHandle
{
public:
- virtual void apply(WmfDeviceContext *);
+ void apply(WmfDeviceContext *) override;
QPen pen;
};
class KoWmfPatternBrushHandle: public KoWmfHandle
{
public:
- virtual void apply(WmfDeviceContext *);
+ void apply(WmfDeviceContext *) override;
QBrush brush;
QImage image;
};
class KoWmfFontHandle: public KoWmfHandle
{
public:
- virtual void apply(WmfDeviceContext *);
+ void apply(WmfDeviceContext *) override;
QFont font;
int escapement;
int orientation;
int height; // Can be negative. In 'font' above, we store the absolute value.
};
}
#endif
diff --git a/libs/widgets/KisColorSelectorInterface.h b/libs/widgets/KisColorSelectorInterface.h
index f393c7feb5..993196c15b 100644
--- a/libs/widgets/KisColorSelectorInterface.h
+++ b/libs/widgets/KisColorSelectorInterface.h
@@ -1,56 +1,56 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISCOLORSELECTORINTERFACE_H
#define KISCOLORSELECTORINTERFACE_H
#include "kritawidgets_export.h"
#include <QWidget>
#include <KoColor.h>
class KoColorDisplayRendererInterface;
class KRITAWIDGETS_EXPORT KisColorSelectorInterface : public QWidget {
Q_OBJECT
public:
KisColorSelectorInterface(QWidget *parent = 0)
: QWidget(parent)
{}
- virtual ~KisColorSelectorInterface() {}
+ ~KisColorSelectorInterface() override {}
virtual void setConfig(bool forceCircular, bool forceSelfUpdate)
{
Q_UNUSED(forceCircular);
Q_UNUSED(forceSelfUpdate);
}
virtual void setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer)
{
Q_UNUSED(displayRenderer);
}
virtual KoColor getCurrentColor() const = 0;
Q_SIGNALS:
void sigNewColor(const KoColor &c);
public Q_SLOTS:
virtual void slotSetColor(const KoColor &c) = 0;
};
#endif // KISCOLORSELECTORINTERFACE_H
diff --git a/libs/widgets/KoAnchorSelectionWidget.h b/libs/widgets/KoAnchorSelectionWidget.h
index f7e83afb76..0370ef92fb 100644
--- a/libs/widgets/KoAnchorSelectionWidget.h
+++ b/libs/widgets/KoAnchorSelectionWidget.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KOANCHORSELECTIONWIDGET_H
#define KOANCHORSELECTIONWIDGET_H
#include <QWidget>
#include <KoFlake.h>
#include "kritawidgets_export.h"
class KRITAWIDGETS_EXPORT KoAnchorSelectionWidget : public QWidget
{
Q_OBJECT
public:
explicit KoAnchorSelectionWidget(QWidget *parent = 0);
- ~KoAnchorSelectionWidget();
+ ~KoAnchorSelectionWidget() override;
KoFlake::AnchorPosition value() const;
QPointF value(const QRectF rect, bool *valid) const;
void setValue(KoFlake::AnchorPosition value);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
Q_SIGNALS:
void valueChanged(KoFlake::AnchorPosition id);
public Q_SLOTS:
void slotGroupClicked(int id);
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif // KOANCHORSELECTIONWIDGET_H
diff --git a/libs/widgets/KoAspectButton.h b/libs/widgets/KoAspectButton.h
index 2ee0a67d05..0b51682e6d 100644
--- a/libs/widgets/KoAspectButton.h
+++ b/libs/widgets/KoAspectButton.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOASPECTBUTTON_H
#define KOASPECTBUTTON_H
#include <QAbstractButton>
#include "kritawidgets_export.h"
/**
* This button gives a visual indication of weather the 'aspect ratio' is locked.
* Typically you would use this alongside 2 spinboxes with a value like a width and height.
*/
class KRITAWIDGETS_EXPORT KoAspectButton : public QAbstractButton {
Q_OBJECT
public:
/// constructor
explicit KoAspectButton(QWidget *parent);
- virtual ~KoAspectButton();
+ ~KoAspectButton() override;
/// Returns of keeping aspect ratio is on or off
bool keepAspectRatio() const;
public Q_SLOTS:
/**
* Set the visual indicator to be locked or not.
* This also emits the keepAspectRatioChanged if the value has changed.
* @param keep if true, lock the aspect ratio.
*/
void setKeepAspectRatio(bool keep);
Q_SIGNALS:
/**
* This signal is emitted every time the button changes value, either by user interaction or
* by programetically setting it.
*/
void keepAspectRatioChanged(bool keep);
protected:
/// reimplemented
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void paintEvent (QPaintEvent *);
- virtual QSize sizeHint () const;
- void keyReleaseEvent (QKeyEvent *e);
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void paintEvent (QPaintEvent *) override;
+ QSize sizeHint () const override;
+ void keyReleaseEvent (QKeyEvent *e) override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/widgets/KoColorPatch.h b/libs/widgets/KoColorPatch.h
index fd3ead420f..096b6d257a 100644
--- a/libs/widgets/KoColorPatch.h
+++ b/libs/widgets/KoColorPatch.h
@@ -1,81 +1,81 @@
/**
* Copyright (c) 2006 C. Boemann (cbo@boemann.dk)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORPATCH_H
#define KOCOLORPATCH_H
#include <QFrame>
#include <KoColor.h>
#include "kritawidgets_export.h"
#include <KoColorDisplayRendererInterface.h>
/**
* The small widget showing the selected color
*/
class KRITAWIDGETS_EXPORT KoColorPatch : public QFrame
{
Q_OBJECT
public:
explicit KoColorPatch( QWidget *parent );
- virtual ~KoColorPatch();
+ ~KoColorPatch() override;
/**
* Set the color of this color patch
* @param c the new color
*/
void setColor( const KoColor &c );
/**
* @brief setDisplayRenderer
* Set the display renderer of this object.
* @param displayRenderer
*/
void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer);
/**
* @brief getColorFromDisplayRenderer
* Get QColor from the display renderers
* @param c
*/
QColor getColorFromDisplayRenderer(KoColor c);
/**
* @return current color shown by this patch
*/
KoColor color() const;
protected:
- virtual void mousePressEvent(QMouseEvent *e ); ///< reimplemented from QFrame
- virtual void paintEvent(QPaintEvent *e); ///< reimplemented from QFrame
- virtual QSize sizeHint() const; ///< reimplemented from QFrame
+ void mousePressEvent(QMouseEvent *e ) override; ///< reimplemented from QFrame
+ void paintEvent(QPaintEvent *e) override; ///< reimplemented from QFrame
+ QSize sizeHint() const override; ///< reimplemented from QFrame
Q_SIGNALS:
/**
* Emitted when the mouse is released.
* @param widget a pointer to this widget
*/
void triggered(KoColorPatch *widget);
private:
KoColor m_color;
const KoColorDisplayRendererInterface *m_displayRenderer;
};
#endif
diff --git a/libs/widgets/KoColorPopupAction.h b/libs/widgets/KoColorPopupAction.h
index 7bdf217e17..f4a8832c92 100644
--- a/libs/widgets/KoColorPopupAction.h
+++ b/libs/widgets/KoColorPopupAction.h
@@ -1,89 +1,89 @@
/* This file is part of the KDE project
* Copyright (c) 2007 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2007 Fredy Yanardi <fyanardi@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORPOPUPACTION_H
#define KOCOLORPOPUPACTION_H
#include <QAction>
#include "kritawidgets_export.h"
class KoColor;
/**
* KoColorPopupAction makes use of KoColorSetWidget to show a widget for for choosing a color (colormanaged via pigment).
* @see KoColorPopupAction
*/
class KRITAWIDGETS_EXPORT KoColorPopupAction : public QAction
{
Q_OBJECT
public:
/**
* Constructs a KoColorPopupAction with the specified parent.
*
* @param parent The parent for this action.
*/
explicit KoColorPopupAction(QObject *parent = 0);
/**
* Destructor
*/
- virtual ~KoColorPopupAction();
+ ~KoColorPopupAction() override;
public Q_SLOTS:
/// Sets a new color to be displayed
void setCurrentColor( const QColor &color );
/// Sets a new color to be displayed
void setCurrentColor( const KoColor &color );
/// Returns the current color
QColor currentColor() const;
/// Returns the current color as a KoColor
KoColor currentKoColor() const;
/// update the icon - only needed if you resize the iconsize in the widget that shows the action
void updateIcon();
Q_SIGNALS:
/**
* Emitted every time the color changes (by calling setColor() or
* by user interaction.
* @param color the new color
*/
void colorChanged(const KoColor &color);
private Q_SLOTS:
void emitColorChanged();
void colorWasSelected(const KoColor &color, bool final);
void colorWasEdited( const QColor &color );
void opacityWasChanged( int opacity );
void slotTriggered(bool);
private:
class KoColorPopupActionPrivate;
KoColorPopupActionPrivate * const d;
};
#endif
diff --git a/libs/widgets/KoColorPopupButton.h b/libs/widgets/KoColorPopupButton.h
index bb08d58f71..00ec0c81c1 100644
--- a/libs/widgets/KoColorPopupButton.h
+++ b/libs/widgets/KoColorPopupButton.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (c) 2013 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORPOPUPBUTTON_H_
#define KOCOLORPOPUPBUTTON_H_
#include <QToolButton>
#include "kritawidgets_export.h"
/**
* @short A widget for
*
*/
class KRITAWIDGETS_EXPORT KoColorPopupButton: public QToolButton
{
Q_OBJECT
public:
/**
* Constructor for the widget, where value is set to 0
*
* @param parent parent QWidget
*/
explicit KoColorPopupButton(QWidget *parent=0);
/**
* Destructor
*/
- virtual ~KoColorPopupButton();
+ ~KoColorPopupButton() override;
- QSize sizeHint() const;
+ QSize sizeHint() const override;
Q_SIGNALS:
/// Emitted when a resource was selected
void iconSizeChanged();
protected:
- virtual void resizeEvent(QResizeEvent *); ///< reimplemented from QToolButton
+ void resizeEvent(QResizeEvent *) override; ///< reimplemented from QToolButton
};
#endif
diff --git a/libs/widgets/KoColorSetWidget.h b/libs/widgets/KoColorSetWidget.h
index 6a26963fda..da8b82b05f 100644
--- a/libs/widgets/KoColorSetWidget.h
+++ b/libs/widgets/KoColorSetWidget.h
@@ -1,107 +1,107 @@
/* This file is part of the KDE project
Copyright (c) 2007 C. Boemann <cbo@boemann.dk>
Copyright (c) 2007 Fredy Yanardi <fyanardi@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORSETWIDGET_H_
#define KOCOLORSETWIDGET_H_
#include <QWidgetAction>
#include <QFrame>
#include "kritawidgets_export.h"
#include <KoColorDisplayRendererInterface.h>
class KoColor;
class KoColorSet;
/**
* @short A colormanaged widget for choosing a color from a colorset
*
* KoColorSetWidget is a widget for choosing a color (colormanaged via pigment). It shows a color
* set plus optionally a checkbox to filter away bad matching colors.
*/
class KRITAWIDGETS_EXPORT KoColorSetWidget : public QFrame
{
Q_OBJECT
public:
/**
* Constructor for the widget, where color is initially blackpoint of sRGB
*
* @param parent parent QWidget
*/
explicit KoColorSetWidget(QWidget *parent=0);
/**
* Destructor
*/
- virtual ~KoColorSetWidget();
+ ~KoColorSetWidget() override;
/**
* Sets the color set that this widget shows.
* @param colorSet pointer to the color set
*/
void setColorSet(KoColorSet *colorSet);
/**
* @brief setDisplayRenderer
* Set the display renderer of this object.
* @param displayRenderer
*/
void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer);
/**
* Gets the current color set
* @returns current color set,, 0 if none set
*/
KoColorSet* colorSet();
protected:
- virtual void resizeEvent(QResizeEvent *event); ///< reimplemented from QFrame
+ void resizeEvent(QResizeEvent *event) override; ///< reimplemented from QFrame
Q_SIGNALS:
/**
* Emitted every time the color changes (by calling setColor() or
* by user interaction.
* @param color the new color
* @param final if the value is final (ie not produced by the pointer moving over around)
*/
void colorChanged(const KoColor &color, bool final);
/**
* Emitted every time the size of this widget changes because of new colorset with
* different number of colors is loaded. This is useful for KoColorSetAction to update
* correct size of the menu showing this widget.
* @param size the new size
*/
void widgetSizeChanged(const QSize &size);
private:
Q_PRIVATE_SLOT(d, void colorTriggered(KoColorPatch *))
Q_PRIVATE_SLOT(d, void addRemoveColors())
Q_PRIVATE_SLOT(d, void setColorFromString(QString s))
class KoColorSetWidgetPrivate;
KoColorSetWidgetPrivate * const d;
};
#endif
diff --git a/libs/widgets/KoColorSlider.h b/libs/widgets/KoColorSlider.h
index 2362d33037..b19d184de5 100644
--- a/libs/widgets/KoColorSlider.h
+++ b/libs/widgets/KoColorSlider.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
Copyright (C) 2006 Sven Langkamp <sven.langkamp@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_COLORSLIDER_H
#define KO_COLORSLIDER_H
#include <kselector.h>
#include "kritawidgets_export.h"
#include "KoColorDisplayRendererInterface.h"
class KoColor;
class KRITAWIDGETS_EXPORT KoColorSlider : public KSelector
{
Q_OBJECT
public:
explicit KoColorSlider(QWidget *parent = 0, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
explicit KoColorSlider(Qt::Orientation orientation, QWidget *parent = 0, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
- virtual ~KoColorSlider();
+ ~KoColorSlider() override;
public:
void setColors( const KoColor& minColor, const KoColor& maxColor);
/**
* Return the current color
*/
KoColor currentColor() const;
protected:
- virtual void drawContents( QPainter* );
- virtual void drawArrow(QPainter *painter, const QPoint &pos);
+ void drawContents( QPainter* ) override;
+ void drawArrow(QPainter *painter, const QPoint &pos) override;
protected:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/widgets/KoConfigAuthorPage.h b/libs/widgets/KoConfigAuthorPage.h
index 591a47728a..154e5eb2a4 100644
--- a/libs/widgets/KoConfigAuthorPage.h
+++ b/libs/widgets/KoConfigAuthorPage.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCONFIGAUTHORPAGE_H
#define KOCONFIGAUTHORPAGE_H
#include <QWidget>
#include "kritawidgets_export.h"
class KRITAWIDGETS_EXPORT KoConfigAuthorPage : public QWidget
{
Q_OBJECT
public:
KoConfigAuthorPage();
- ~KoConfigAuthorPage();
+ ~KoConfigAuthorPage() override;
void apply();
private Q_SLOTS:
void profileChanged(int i);
void addUser();
void deleteUser();
private:
class Private;
Private * const d;
};
#endif // KOCONFIGAUTHORPAGE_H
diff --git a/libs/widgets/KoDialog.h b/libs/widgets/KoDialog.h
index 2040fd89cf..06b98fe5c6 100644
--- a/libs/widgets/KoDialog.h
+++ b/libs/widgets/KoDialog.h
@@ -1,835 +1,835 @@
/* This file is part of the KDE Libraries
* Copyright (C) 1998 Thomas Tanghus (tanghus@earthling.net)
* Additions 1999-2000 by Espen Sand (espen@kde.org)
* and Holger Freyther <freyther@kde.org>
* 2005-2009 Olivier Goffart <ogoffart @ kde.org>
* 2006 Tobias Koenig <tokoe@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KODIALOG_H
#define KODIALOG_H
class QPushButton;
class QMenu;
class KoDialogPrivate;
#include <kritawidgets_export.h>
#include <kconfiggroup.h>
#include <kguiitem.h>
#include <QDialog>
/**
* @short A dialog base class with standard buttons and predefined layouts.
*
* Provides basic functionality needed by nearly all dialogs.
*
* It offers the standard action buttons you'd expect to find in a
* dialog as well as the capability to define at most three configurable
* buttons. You can define a main widget that contains your specific
* dialog layout
*
* The class takes care of the geometry management. You only need to define
* a minimum size for the widget you want to use as the main widget.
*
* By default, the dialog is non-modal.
*
* <b>Standard buttons (action buttons):</b>\n
*
* You select which buttons should be displayed, but you do not choose the
* order in which they are displayed. This ensures a standard interface in
* KDE. The button order can be changed, but this ability is only available
* for a central KDE control tool. The following buttons are available:
* OK, Cancel/Close, Apply/Try, Default, Help and three user definable
* buttons: User1, User2 and User3. You must specify the text of the UserN
* buttons. Each button emit a signal, so you can choose to connect that signal.
*
* The default action of the Help button will open the help system if you have
* provided a path to the help text.
* The default action of Ok and Cancel will run QDialog::accept() and QDialog::reject(),
* which you can override by reimplementing slotButtonClicked(). The default
* action of the Close button will close the dialog.
*
* Note that the KoDialog will animate a button press
* when the user presses Escape. The button that is enabled is either Cancel,
* Close or the button that is defined by setEscapeButton().
* Your custom dialog code should reimplement the keyPressEvent and
* animate the cancel button so that the dialog behaves like regular
* dialogs.
*
* <b>Layout:</b>\n
*
* The dialog consists of a help area on top (becomes visible if you define
* a help path and use enableLinkedHelp()), the main area which is
* the built-in dialog face or your own widget in the middle and by default
* a button box at the bottom. The button box can also be placed at the
* right edge (to the right of the main widget). Use
* setButtonsOrientation() to control this behavior. A separator
* can be placed above the button box (or to the left when the button box
* is at the right edge).
*
* <b>Standard compliance:</b>\n
*
* The marginHint() and spacingHint() sizes shall be used
* whenever you lay out the interior of a dialog. One special note. If
* you make your own action buttons (OK, Cancel etc), the space
* between the buttons shall be spacingHint(), whereas the space
* above, below, to the right and to the left shall be marginHint().
* If you add a separator line above the buttons, there shall be a
* marginHint() between the buttons and the separator and a
* marginHint() above the separator as well.
*
* <b>Example:</b>\n
*
* \code
* KoDialog *dialog = new KoDialog( this );
* dialog->setCaption( "My title" );
* dialog->setButtons( KoDialog::Ok | KoDialog::Cancel | KoDialog::Apply );
*
* FooWidget *widget = new FooWidget( dialog );
* dialog->setMainWidget( widget );
* connect( dialog, SIGNAL( applyClicked() ), widget, SLOT( save() ) );
* connect( dialog, SIGNAL( okClicked() ), widget, SLOT( save() ) );
* connect( widget, SIGNAL( changed( bool ) ), dialog, SLOT( enableButtonApply( bool ) ) );
*
* dialog->enableButtonApply( false );
* dialog->show();
* \endcode
*
* \image html kdialog.png "KDE Dialog example"
*
* This class can be used in many ways. Note that most KDE ui widgets
* and many of KDE core applications use the KoDialog so for more
* inspiration you should study the code for these.
*
*
* @see KPageDialog
* @author Thomas Tanghus <tanghus@earthling.net>
* @author Espen Sand <espensa@online.no>
* @author Mirko Boehm <mirko@kde.org>
* @author Olivier Goffart <ogoffart at kde.org>
* @author Tobias Koenig <tokoe@kde.org>
*/
class KRITAWIDGETS_EXPORT KoDialog : public QDialog //krazy:exclude=qclasses
{
Q_OBJECT
Q_ENUMS(ButtonCode)
Q_DECLARE_PRIVATE(KoDialog)
public:
enum ButtonCode {
None = 0x00000000,
Help = 0x00000001, ///< Show Help button. (this button will run the help set with setHelp)
Default = 0x00000002, ///< Show Default button.
Ok = 0x00000004, ///< Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)
Apply = 0x00000008, ///< Show Apply button.
Try = 0x00000010, ///< Show Try button.
Cancel = 0x00000020, ///< Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)
Close = 0x00000040, ///< Show Close-button. (this button closes the dialog)
No = 0x00000080, ///< Show No button. (this button closes the dialog and sets the result to KoDialog::No)
Yes = 0x00000100, ///< Show Yes button. (this button closes the dialog and sets the result to KoDialog::Yes)
Reset = 0x00000200, ///< Show Reset button
Details = 0x00000400, ///< Show Details button. (this button will show the detail widget set with setDetailsWidget)
User1 = 0x00001000, ///< Show User defined button 1.
User2 = 0x00002000, ///< Show User defined button 2.
User3 = 0x00004000, ///< Show User defined button 3.
NoDefault = 0x00008000 ///< Used when specifying a default button; indicates that no button should be marked by default.
};
// TODO KDE5: remove NoDefault and use the value None instead
Q_DECLARE_FLAGS(ButtonCodes, ButtonCode)
enum ButtonPopupMode {
InstantPopup = 0,
DelayedPopup = 1
};
Q_DECLARE_FLAGS(ButtonPopupModes, ButtonPopupMode)
public:
/**
* Creates a dialog.
*
* @param parent The parent of the dialog.
* @param flags The widget flags passed to the QDialog constructor
*/
explicit KoDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0);
/**
* Destroys the dialog.
*/
- ~KoDialog();
+ ~KoDialog() override;
/**
* Creates (or recreates) the button box and all the buttons in it.
*
* Note that some combinations are not possible. That means, you can't
* have the following pairs of buttons in a dialog:
* - Default and Details
* - Cancel and Close
* - Ok and Try
*
* This will reset all default KGuiItem of all button.
*
* @param buttonMask Specifies what buttons will be made.
*
* @deprecated Since 5.0 use QDialogButtonBox
*/
void setButtons(ButtonCodes buttonMask);
/**
* Sets the orientation of the button box.
*
* It can be @p Vertical or @p Horizontal. If @p Horizontal
* (default), the button box is positioned at the bottom of the
* dialog. If @p Vertical it will be placed at the right edge of the
* dialog.
*
* @param orientation The button box orientation.
*/
void setButtonsOrientation(Qt::Orientation orientation);
/**
* Sets the button that will be activated when the Escape key
* is pressed.
*
* By default, the Escape key is mapped to either the Cancel or the Close button
* if one of these buttons are defined. The user expects that Escape will
* cancel an operation so use this function with caution.
*
* @param id The button code.
*/
void setEscapeButton(ButtonCode id);
/**
* Sets the button that will be activated when the Enter key
* is pressed.
*
* By default, this is the Ok button if it is present
*
* @param id The button code.
*/
void setDefaultButton(ButtonCode id);
/**
* Returns the button code of the default button,
* or NoDefault if there is no default button.
*/
ButtonCode defaultButton() const;
/**
* Hide or display the a separator line drawn between the action
* buttons an the main widget.
*/
void showButtonSeparator(bool state);
/**
* Hide or display a general action button.
*
* Only buttons that have
* been created in the constructor can be displayed. This method will
* not create a new button.
*
* @param id Button identifier.
* @param state true display the button(s).
*/
void showButton(ButtonCode id, bool state);
/**
* Sets the text of any button.
*
* @param id The button identifier.
* @param text Button text.
*/
void setButtonText(ButtonCode id, const QString &text);
/**
* Returns the text of any button.
*/
QString buttonText(ButtonCode id) const;
/**
* Sets the icon of any button.
*
* @param id The button identifier.
* @param icon Button icon.
*/
void setButtonIcon(ButtonCode id, const QIcon &icon);
/**
* Returns the icon of any button.
*/
QIcon buttonIcon(ButtonCode id) const;
/**
* Sets the tooltip text of any button.
*
* @param id The button identifier.
* @param text Button text.
*/
void setButtonToolTip(ButtonCode id, const QString &text);
/**
* Returns the tooltip of any button.
*/
QString buttonToolTip(ButtonCode id) const;
/**
* Sets the "What's this?" text of any button.
*
* @param id The button identifier.
* @param text Button text.
*/
void setButtonWhatsThis(ButtonCode id, const QString &text);
/**
* Returns the "What's this?" text of any button.
*/
QString buttonWhatsThis(ButtonCode id) const;
/**
* Sets the KGuiItem directly for the button instead of using 3 methods to
* set the text, tooltip and whatsthis strings. This also allows to set an
* icon for the button which is otherwise not possible for the extra
* buttons beside Ok, Cancel and Apply.
*
* @param id The button identifier.
* @param item The KGuiItem for the button.
*/
void setButtonGuiItem(ButtonCode id, const KGuiItem &item);
/**
* Sets the focus to the button of the passed @p id.
*/
void setButtonFocus(ButtonCode id);
/**
* Convenience method. Sets the initial dialog size.
*
* This method should only be called right before show() or exec().
* The initial size will be ignored if smaller than
* the dialog's minimum size.
*
* @param size Startup size.
*/
void setInitialSize(const QSize &size);
/**
* Convenience method. Add a size to the default minimum size of a
* dialog.
*
* This method should only be called right before show() or exec().
*
* @param size Size added to minimum size.
*/
void incrementInitialSize(const QSize &size);
/**
* Returns the help link text.
*
* If no text has been defined,
* "Get help..." (internationalized) is returned.
*
* @return The help link text.
*
* @see enableLinkedHelp()
* @see setHelpLinkText()
* @see setHelp()
*/
QString helpLinkText() const;
/**
* Returns whether any button is enabled.
*/
bool isButtonEnabled(ButtonCode id) const;
/**
* Returns the button that corresponds to the @p id.
*
* Normally you should not use this function.
* @em Never delete the object returned by this function.
* See also enableButton(), showButton(), setButtonGuiItem().
*
* @param id Identifier of the button.
* @return The button or 0 if the button does not exist.
*/
QPushButton *button(ButtonCode id) const;
/**
* Returns the number of pixels that should be used between a
* dialog edge and the outermost widget(s) according to the KDE standard.
*
* @deprecated Use the style's pixelMetric() function to query individual margins.
* Different platforms may use different values for the four margins.
*/
static int marginHint();
/**
* Returns the number of pixels that should be used between
* widgets inside a dialog according to the KDE standard.
*
* @deprecated Use the style's layoutSpacing() function to query individual spacings.
* Different platforms may use different values depending on widget types and pairs.
*/
static int spacingHint();
/**
* Returns the number of pixels that should be used to visually
* separate groups of related options in a dialog according to
* the KDE standard.
* @since 4.2
*/
static int groupSpacingHint();
/**
* @enum StandardCaptionFlag
* Used to specify how to construct a window caption
*
* @value AppName Indicates that the method shall include
* the application name when making the caption string.
* @value Modified Causes a 'modified' sign will be included in the
* returned string. This is useful when indicating that a file is
* modified, i.e., it contains data that has not been saved.
* @value HIGCompliant The base minimum flags required to align a
* caption with the KDE Human Interface Guidelines
*/
enum CaptionFlag {
NoCaptionFlags = 0,
AppNameCaption = 1,
ModifiedCaption = 2,
HIGCompliantCaption = AppNameCaption
};
Q_DECLARE_FLAGS(CaptionFlags, CaptionFlag)
/**
* Builds a caption that contains the application name along with the
* userCaption using a standard layout.
*
* To make a compliant caption for your window, simply do:
* @p setWindowTitle(KoDialog::makeStandardCaption(yourCaption));
*
* To ensure that the caption is appropriate to the desktop in which the
* application is running, pass in a pointer to the window the caption will
* be applied to.
*
* If using a KoDialog or KMainWindow subclass, call setCaption instead and
* an appropraite standard caption will be created for you
*
* @param userCaption The caption string you want to display in the
* window caption area. Do not include the application name!
* @param window a pointer to the window this application will apply to
* @param flags
* @return the created caption
*/
static QString makeStandardCaption(const QString &userCaption,
QWidget *window = 0,
CaptionFlags flags = HIGCompliantCaption);
/**
* Resize every layout manager used in @p widget and its nested children.
*
* @param widget The widget used.
* @param margin The new layout margin.
* @param spacing The new layout spacing.
*
* @deprecated Use QLayout functions where necessary. Setting margin and spacing
* values recursively for all children prevents QLayout from creating platform native
* layouts.
*/
static void resizeLayout(QWidget *widget, int margin, int spacing);
/**
* Resize every layout associated with @p lay and its children.
*
* @param lay layout to be resized
* @param margin The new layout margin
* @param spacing The new layout spacing
*
* @deprecated Use QLayout functions where necessary. Setting margin and spacing
* values recursively for all children prevents QLayout from creating platform native
* layouts.
*/
static void resizeLayout(QLayout *lay, int margin, int spacing);
/**
* Centers @p widget on the desktop, taking multi-head setups into
* account. If @p screen is -1, @p widget will be centered on its
* current screen (if it was shown already) or on the primary screen.
* If @p screen is -3, @p widget will be centered on the screen that
* currently contains the mouse pointer.
* @p screen will be ignored if a merged display (like Xinerama) is not
* in use, or merged display placement is not enabled in kdeglobals.
*/
static void centerOnScreen(QWidget *widget, int screen = -1);
/**
* Places @p widget so that it doesn't cover a certain @p area of the screen.
* This is typically used by the "find dialog" so that the match it finds can
* be read.
* For @p screen, see centerOnScreen
* @return true on success (widget doesn't cover area anymore, or never did),
* false on failure (not enough space found)
*/
static bool avoidArea(QWidget *widget, const QRect &area, int screen = -1);
/**
* Sets the main widget of the dialog.
*/
void setMainWidget(QWidget *widget);
/**
* @return The current main widget. Will create a QWidget as the mainWidget
* if none was set before. This way you can write
* \code
* ui.setupUi(mainWidget());
* \endcode
* when using designer.
*/
QWidget *mainWidget();
/**
* Reimplemented from QDialog.
*/
QSize sizeHint() const override;
/**
* Reimplemented from QDialog.
*/
QSize minimumSizeHint() const override;
public Q_SLOTS:
/**
* Make a KDE compliant caption.
*
* @param caption Your caption. Do @p not include the application name
* in this string. It will be added automatically according to the KDE
* standard.
*
* @deprecated Since 5.0 use QWidget::setWindowTitle
*/
virtual void setCaption(const QString &caption);
/**
* Makes a KDE compliant caption.
*
* @param caption Your caption. @em Do @em not include the application name
* in this string. It will be added automatically according to the KDE
* standard.
* @param modified Specify whether the document is modified. This displays
* an additional sign in the title bar, usually "**".
*
* @deprecated Since 5.0 use QWidget::setWindowTitle and QWidget::setWindowModified.
*/
virtual void setCaption(const QString &caption, bool modified);
/**
* Make a plain caption without any modifications.
*
* @param caption Your caption. This is the string that will be
* displayed in the window title.
*/
virtual void setPlainCaption(const QString &caption);
/**
* Enable or disable (gray out) a general action button.
*
* @param id Button identifier.
* @param state @p true enables the button(s).
*/
void enableButton(ButtonCode id, bool state);
/**
* Enable or disable (gray out) the OK button.
*
* @param state @p true enables the button.
*/
void enableButtonOk(bool state);
/**
* Enable or disable (gray out) the Apply button.
*
* @param state true enables the button.
*/
void enableButtonApply(bool state);
/**
* Enable or disable (gray out) the Cancel button.
*
* @param state true enables the button.
*/
void enableButtonCancel(bool state);
/**
* Display or hide the help link area on the top of the dialog.
*
* @param state @p true will display the area.
*
* @see helpLinkText()
* @see setHelpLinkText()
* @see setHelp()
*/
void enableLinkedHelp(bool state);
/**
* Sets the text that is shown as the linked text.
*
* If text is empty,
* the text "Get help..." (internationalized) is used instead.
*
* @param text The link text.
*
* @see helpLinkText()
* @see enableLinkedHelp()
* @see setHelp()
*/
void setHelpLinkText(const QString &text);
/**
* Sets the help path and topic.
*
* @param anchor Defined anchor in your docbook sources
* @param appname Defines the appname the help belongs to
* If empty it's the current one
*
* @note The help button works differently for the class
* KCMultiDialog, so it does not make sense to call this
* function for Dialogs of that type. See
* KCMultiDialog::slotHelp() for more information.
*/
void setHelp(const QString &anchor, const QString &appname = QString());
/**
* Returns the status of the Details button.
*/
bool isDetailsWidgetVisible() const;
/**
* Sets the status of the Details button.
*/
void setDetailsWidgetVisible(bool visible);
/**
* Sets the widget that gets shown when "Details" is enabled.
*
* The dialog takes over ownership of the widget.
* Any previously set widget gets deleted.
*/
void setDetailsWidget(QWidget *detailsWidget);
/**
* Destruct the dialog delayed.
*
* You can call this function from slots like closeClicked() and hidden().
* You should not use the dialog any more after calling this function.
* @deprecated use hide()+deleteLater()
*/
void delayedDestruct();
Q_SIGNALS:
/**
* Emitted when the margin size and/or spacing size
* have changed.
*
* Use marginHint() and spacingHint() in your slot
* to get the new values.
*
* @deprecated This signal is not emitted. Listen to QEvent::StyleChange events instead.
*/
void layoutHintChanged();
/**
* The Help button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void helpClicked();
/**
* The Default button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void defaultClicked();
/**
* The Reset button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void resetClicked();
/**
* The User3 button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void user3Clicked();
/**
* The User2 button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void user2Clicked();
/**
* The User1 button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void user1Clicked();
/**
* The Apply button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void applyClicked();
/**
* The Try button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void tryClicked();
/**
* The OK button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void okClicked();
/**
* The Yes button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void yesClicked();
/**
* The No button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void noClicked();
/**
* The Cancel button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void cancelClicked();
/**
* The Close button was pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
*/
void closeClicked();
/**
* A button has been pressed. This signal is only emitted if
* slotButtonClicked() is not replaced
* @param button is the code of the pressed button.
*/
void buttonClicked(KoDialog::ButtonCode button);
/**
* The dialog is about to be hidden.
*
* A dialog is hidden after a user clicks a button that ends
* the dialog or when the user switches to another desktop or
* minimizes the dialog.
*/
void hidden();
/**
* The dialog has finished.
*
* A dialog emits finished after a user clicks a button that ends
* the dialog.
*
* This signal is also emitted when you call hide()
*
* If you have stored a pointer to the
* dialog do @em not try to delete the pointer in the slot that is
* connected to this signal.
*
* You should use deleteLater() instead.
*/
void finished();
/**
* The detailsWidget is about to get shown. This is your last chance
* to call setDetailsWidget if you haven't done so yet.
*/
void aboutToShowDetails();
protected:
/**
* Emits the #hidden signal. You can connect to that signal to
* detect when a dialog has been closed.
*/
void hideEvent(QHideEvent *) override;
/**
* Detects when a dialog is being closed from the window manager
* controls. If the Cancel or Close button is present then the button
* is activated. Otherwise standard QDialog behavior
* will take place.
*/
void closeEvent(QCloseEvent *e) override;
/**
* @internal
*/
void keyPressEvent(QKeyEvent *) override;
protected Q_SLOTS:
/**
* Activated when the button @p button is clicked
*
* Sample that shows how to catch and handle button clicks within
* an own dialog;
* @code
* class MyDialog : public KoDialog {
* protected Q_SLOTS:
* virtual void slotButtonClicked(int button) {
* if (button == KoDialog::Ok)
* accept();
* else
* KoDialog::slotButtonClicked(button);
* }
* }
* @endcode
*
* @param button is the type @a KoDialog::ButtonCode
*
* @deprecated since 5.0 use QDialogButtonBox and connect to the clicked signal
*/
virtual void slotButtonClicked(int button);
/**
* Updates the margins and spacings.
*
* @deprecated KoDialog respects the style's margins and spacings automatically. Calling
* this function has no effect.
*/
void updateGeometry();
private:
KoDialog(KoDialogPrivate &dd, QWidget *parent, Qt::WindowFlags flags = 0);
KoDialogPrivate *const d_ptr;
private:
Q_DISABLE_COPY(KoDialog)
Q_PRIVATE_SLOT(d_ptr, void queuedLayoutUpdate())
Q_PRIVATE_SLOT(d_ptr, void helpLinkClicked())
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KoDialog::ButtonCodes)
Q_DECLARE_OPERATORS_FOR_FLAGS(KoDialog::CaptionFlags)
#endif // KODIALOG_H
diff --git a/libs/widgets/KoDockWidgetTitleBar.h b/libs/widgets/KoDockWidgetTitleBar.h
index f2eb4b4ab4..00199ec082 100644
--- a/libs/widgets/KoDockWidgetTitleBar.h
+++ b/libs/widgets/KoDockWidgetTitleBar.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE project
Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KODOCKWIDGETTITLEBAR_H_
#define KODOCKWIDGETTITLEBAR_H_
#include "kritawidgets_export.h"
#include <QDockWidget>
/**
* @short A custom title bar for dock widgets.
*
* Allow customization such as collapsable, or hidding text.
*
* @see KoDockWidgetTitleBarButton
*/
class KRITAWIDGETS_EXPORT KoDockWidgetTitleBar : public QWidget
{
Q_OBJECT
public:
explicit KoDockWidgetTitleBar(QDockWidget *dockWidget);
- virtual ~KoDockWidgetTitleBar();
+ ~KoDockWidgetTitleBar() override;
- virtual QSize minimumSizeHint() const; ///< reimplemented from QWidget
- virtual QSize sizeHint() const; ///< reimplemented from QWidget
+ QSize minimumSizeHint() const override; ///< reimplemented from QWidget
+ QSize sizeHint() const override; ///< reimplemented from QWidget
enum TextVisibilityMode {TextCanBeInvisible, FullTextAlwaysVisible};
/// Define whether the minimal width should ensure that the full text is visible.
/// textVisibilityMode is FullTextAlwaysVisible by default
void setTextVisibilityMode(TextVisibilityMode textVisibilityMode);
void updateIcons();
public Q_SLOTS:
void setCollapsed(bool collapsed);
void setLocked(bool locked);
void setCollapsable(bool collapsable);
protected:
- virtual void paintEvent(QPaintEvent* event); ///< reimplemented from QWidget
- virtual void resizeEvent(QResizeEvent* event); ///< reimplemented from QWidget
+ void paintEvent(QPaintEvent* event) override; ///< reimplemented from QWidget
+ void resizeEvent(QResizeEvent* event) override; ///< reimplemented from QWidget
private:
Q_PRIVATE_SLOT(d, void toggleFloating())
Q_PRIVATE_SLOT(d, void toggleCollapsed())
Q_PRIVATE_SLOT(d, void topLevelChanged(bool topLevel))
Q_PRIVATE_SLOT(d, void featuresChanged(QDockWidget::DockWidgetFeatures))
class Private;
Private * const d;
};
#endif // KODOCKWIDGETTITLEBAR_H_
diff --git a/libs/widgets/KoDockWidgetTitleBarButton.h b/libs/widgets/KoDockWidgetTitleBarButton.h
index 370f7af6c1..19753277ec 100644
--- a/libs/widgets/KoDockWidgetTitleBarButton.h
+++ b/libs/widgets/KoDockWidgetTitleBarButton.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
Copyright (c) 2007 Marijn Kruisselbrink <mkruisselbrink@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KODOCKWIDGETTITLEBARBUTTON_H_
#define KODOCKWIDGETTITLEBARBUTTON_H_
#include "kritawidgets_export.h"
#include <QAbstractButton>
class QEvent;
class QPaintEvent;
/**
* @short A custom title bar button for dock widgets.
*
* Used in KoDockWidgetTitleBar but can be also used for similar
* purposes inside other parents.
*/
class KRITAWIDGETS_EXPORT KoDockWidgetTitleBarButton : public QAbstractButton
{
Q_OBJECT
public:
explicit KoDockWidgetTitleBarButton(QWidget *parent = 0);
- ~KoDockWidgetTitleBarButton();
+ ~KoDockWidgetTitleBarButton() override;
- QSize sizeHint() const; ///< reimplemented from QWidget
- QSize minimumSizeHint() const; ///< reimplemented from QWidget
+ QSize sizeHint() const override; ///< reimplemented from QWidget
+ QSize minimumSizeHint() const override; ///< reimplemented from QWidget
protected:
- virtual void enterEvent(QEvent *event);
- virtual void leaveEvent(QEvent *event);
- virtual void paintEvent(QPaintEvent *event);
+ void enterEvent(QEvent *event) override;
+ void leaveEvent(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private:
class Private;
Private * const d;
};
#endif // KODOCKWIDGETTITLEBARBUTTON_H_
diff --git a/libs/widgets/KoDocumentInfoDlg.h b/libs/widgets/KoDocumentInfoDlg.h
index 578625ecb9..10d626a645 100644
--- a/libs/widgets/KoDocumentInfoDlg.h
+++ b/libs/widgets/KoDocumentInfoDlg.h
@@ -1,102 +1,102 @@
/* This file is part of the KDE project
Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
2006 Martin Pfeiffer <hubipete@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __koDocumentInfoDlg_h__
#define __koDocumentInfoDlg_h__
#include <kpagedialog.h>
class KoDocumentInfo;
class KPageWidgetItem;
class KoPageWidgetItem;
#include "kritawidgets_export.h"
/**
* @short The dialog that shows information about the document
* @author Simon Hausmann <hausmann@kde.org>
* @author Martin Pfeiffer <hubipete@gmx.net>
* @see KoDocumentInfo
*
* This dialog is invoked by KoMainWindow and shows the content
* of the given KoDocumentInfo class. It consists of several pages,
* one showing general information about the document and an other
* showing information about the author.
* This dialog implements only things that are stored in the OASIS
* meta.xml file and therefore available through the KoDocumentInfo
* class.
* The widgets shown in the tabs are koDocumentInfoAboutWidget and
* koDocumentInfoAuthorWidget. This class here is derived from
* KPageDialog and uses the face type Tabbed.
*/
class KRITAWIDGETS_EXPORT KoDocumentInfoDlg : public KPageDialog
{
Q_OBJECT
public:
/**
* The constructor
* @param parent a pointer to the parent widget
* @param docInfo a pointer to the shown KoDocumentInfo
*/
KoDocumentInfoDlg(QWidget *parent, KoDocumentInfo* docInfo);
/** The destructor */
- virtual ~KoDocumentInfoDlg();
+ ~KoDocumentInfoDlg() override;
QList<KPageWidgetItem*> pages() const;
/** Returns true if the document was saved when the dialog was closed */
bool isDocumentSaved();
/** Sets all fields to read-only mode. Used by the property dialog. */
void setReadOnly(bool ro);
void addPageItem(KoPageWidgetItem *item);
public Q_SLOTS: // QDialog API
- void accept();
+ void accept() override;
protected: // QWidget API
- void hideEvent(QHideEvent * event);
+ void hideEvent(QHideEvent * event) override;
private Q_SLOTS:
/** Connected with clicked() from pbReset - Reset parts of the metadata */
void slotResetMetaData();
Q_SIGNALS:
void saveRequested();
private:
/** Sets up the aboutWidget and fills the widgets with content */
void initAboutTab();
/** Sets up the authorWidget and fills the widgets with content */
void initAuthorTab();
/** Saves the changed data back to the KoDocumentInfo class */
void saveAboutData();
void updateEditingTime();
class KoDocumentInfoDlgPrivate;
KoDocumentInfoDlgPrivate * const d;
};
#endif
diff --git a/libs/widgets/KoEditColorSetDialog.h b/libs/widgets/KoEditColorSetDialog.h
index a2a8d04377..dcbd164cca 100644
--- a/libs/widgets/KoEditColorSetDialog.h
+++ b/libs/widgets/KoEditColorSetDialog.h
@@ -1,105 +1,105 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Fredy Yanardi <fyanardi@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOEDITCOLORSET_H
#define KOEDITCOLORSET_H
#include <ui_KoEditColorSet.h>
#include <KoDialog.h>
#include "kritawidgets_export.h"
class QGridLayout;
class QScrollArea;
class KoColorPatch;
class KoColorSet;
class KoEditColorSetWidget : public QWidget
{
Q_OBJECT
public:
KoEditColorSetWidget(const QList<KoColorSet *> &palettes, const QString &activePalette, QWidget *parent = 0);
- virtual ~KoEditColorSetWidget();
+ ~KoEditColorSetWidget() override;
/**
* Return the active color set. The caller takes ownership of that color set.
*/
KoColorSet *activeColorSet();
private Q_SLOTS:
void setActiveColorSet(int index);
void setTextLabel(KoColorPatch *patch);
void addColor();
void removeColor();
void open();
void save();
private:
Ui::KoEditColorSet widget;
QList<KoColorSet *> m_colorSets;
QGridLayout *m_gridLayout;
QScrollArea *m_scrollArea;
KoColorSet *m_activeColorSet;
KoColorPatch *m_activePatch;
uint m_initialColorSetCount;
bool m_activeColorSetRequested;
};
/**
* A dialog for editing palettes/color sets in an application. Example use of this dialog is in text color toolbar,
* the toolbar brings a set of colors from one palette, and a button brings this dialog for editing palettes.
* This dialog is able to:
* - Set active palette from a combobox
* - Add/remove color from a palette
* - Open new palette from a gimp palette file (.gpl)
* - Save changes to the file
* @see KoColorSetWidget
*/
class KRITAWIDGETS_EXPORT KoEditColorSetDialog : public KoDialog
{
Q_OBJECT
public:
/**
* Constructs a KoEditColorSetDialog.
* @param palettes all availabe palettes that are going to be edited.
* @param activePalette name of the palette which will be activated after this dialog is shown.
* @param parent the parent widget
*/
KoEditColorSetDialog(const QList<KoColorSet *> &palettes, const QString &activePalette, QWidget *parent = 0);
/**
* Returns the last active color set.
* The caller takes ownership of that color set.
* @return the last active KoColorSet in the dialog before the user press OK
*/
KoColorSet *activeColorSet();
/**
* Destructor
*/
- virtual ~KoEditColorSetDialog();
+ ~KoEditColorSetDialog() override;
private:
KoEditColorSetWidget *ui;
};
#endif
diff --git a/libs/widgets/KoGenericRegistryModel.h b/libs/widgets/KoGenericRegistryModel.h
index 5934068317..a7d5c99c68 100644
--- a/libs/widgets/KoGenericRegistryModel.h
+++ b/libs/widgets/KoGenericRegistryModel.h
@@ -1,100 +1,100 @@
/* This file is part of the KDE project
*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_GENERIC_REGISTRY_MODEL_H_
#define _KO_GENERIC_REGISTRY_MODEL_H_
#include <QAbstractListModel>
#include "KoGenericRegistry.h"
/**
* This is a model that you can use to display the content of a registry.
*
* @param T is the type of the data in the registry
*/
template<typename T>
class KoGenericRegistryModel : public QAbstractListModel
{
public:
KoGenericRegistryModel(KoGenericRegistry<T>* registry);
- virtual ~KoGenericRegistryModel();
+ ~KoGenericRegistryModel() override;
public:
/**
* @return the number of elements in the registry
*/
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
/**
* When role == Qt::DisplayRole, this function will return the name of the
* element.
*/
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/**
* @return the element at the given index
*/
T get(const QModelIndex &index) const;
private:
KoGenericRegistry<T>* m_registry;
};
// -- Implementation --
template<typename T>
KoGenericRegistryModel<T>::KoGenericRegistryModel(KoGenericRegistry<T>* registry) : m_registry(registry)
{
}
template<typename T>
KoGenericRegistryModel<T>::~KoGenericRegistryModel()
{
}
template<typename T>
int KoGenericRegistryModel<T>::rowCount(const QModelIndex &/*parent*/) const
{
return m_registry->keys().size();
}
template<typename T>
QVariant KoGenericRegistryModel<T>::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
return QVariant();
}
if (role == Qt::DisplayRole || role == Qt::EditRole) {
return QVariant(get(index)->name());
}
return QVariant();
}
template<typename T>
T KoGenericRegistryModel<T>::get(const QModelIndex &index) const
{
return m_registry->get(m_registry->keys()[index.row()]);
}
#endif
diff --git a/libs/widgets/KoGradientEditWidget.h b/libs/widgets/KoGradientEditWidget.h
index 1ac5a51edc..4b856c6aa9 100644
--- a/libs/widgets/KoGradientEditWidget.h
+++ b/libs/widgets/KoGradientEditWidget.h
@@ -1,133 +1,133 @@
/* This file is part of the KDE project
Copyright (C) 2001-2002 Beno�t Vautrin <benoit.vautrin@free.fr>
Copyright (C) 2002 Rob Buis <buis@kde.org>
Copyright (C) 2006-2008 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_GRADIENT_EDIT_WIDGET_H
#define KO_GRADIENT_EDIT_WIDGET_H
#include <kritawidgets_export.h>
#include <KoCheckerBoardPainter.h>
#include <QWidget>
class KoSliderCombo;
class QComboBox;
class QDoubleSpinBox;
class KoColorPopupAction;
class QToolButton;
class QPushButton;
/**
* A tab widget for managing gradients.
*
* It has one tab to edit a selected gradients type, spread method and color stops.
* Another tab contains a list with predefined gradients to choose from.
*/
class KRITAWIDGETS_EXPORT KoGradientEditWidget : public QWidget
{
Q_OBJECT
public:
enum GradientTarget {
StrokeGradient,
FillGradient
};
/**
* Creates a new gradient tab widget with the given parent.
* @param parent the widgets parent
*/
explicit KoGradientEditWidget(QWidget* parent = 0L);
/// Destroys the widget
- virtual ~KoGradientEditWidget();
+ ~KoGradientEditWidget() override;
/**
* Sets a new gradient to edit.
* @param gradient the gradient to edit
*/
void setGradient(const QGradient & gradient);
/// Returns the gradient target (fill/stroke)
GradientTarget target();
/// Sets a new gradient target
void setTarget(GradientTarget target);
/// Returns the gradient opacity
qreal opacity() const;
/// Sets the gradients opacity to @p opacity
void setOpacity(qreal opacity);
/// Sets the index of the stop to edit
void setStopIndex(int index);
/// Returns the gradient spread
QGradient::Spread spread() const;
/// Sets the gradient spread
void setSpread(QGradient::Spread spread);
/// Returns the gradient type
QGradient::Type type() const;
/// Sets the gradient type
void setType(QGradient::Type type);
/// Returns the gradient stops
QGradientStops stops() const;
/// Sets the gradient stops
void setStops(const QGradientStops &stops);
Q_SIGNALS:
/// Is emitted a soon as the gradient changes
void changed();
protected Q_SLOTS:
void combosChange(int);
void addGradientToPredefs();
void opacityChanged(qreal value, bool final);
void stopChanged();
protected:
void setupUI();
void updateUI();
void updatePredefGradients();
void setupConnections();
void blockChildSignals(bool block);
private:
QComboBox *m_gradientTarget;
QComboBox *m_gradientRepeat;
QComboBox *m_gradientType;
QPushButton *m_addToPredefs;
KoSliderCombo *m_opacity;
QDoubleSpinBox *m_stopPosition;
QToolButton *m_stopColor;
qreal m_gradOpacity; ///< the gradient opacity
int m_stopIndex; ///< the index of the selected gradient stop
KoCheckerBoardPainter m_checkerPainter;
QGradient::Type m_type;
QGradient::Spread m_spread;
QGradientStops m_stops;
KoColorPopupAction *m_actionStopColor;
};
#endif // KARBONGRADIENTEDITWIDGET_H
diff --git a/libs/widgets/KoIconToolTip.h b/libs/widgets/KoIconToolTip.h
index ccfb4d33ff..35735f058a 100644
--- a/libs/widgets/KoIconToolTip.h
+++ b/libs/widgets/KoIconToolTip.h
@@ -1,42 +1,42 @@
/* This file is part of the KDE project
Copyright (c) 1999 Carsten Pfeiffer (pfeiffer@kde.org)
Copyright (c) 2002 Igor Jansen (rm@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOICONTOOLTIP_H
#define KOICONTOOLTIP_H
#include "KoItemToolTip.h"
#include "kritawidgets_export.h"
class KRITAWIDGETS_EXPORT KoIconToolTip: public KoItemToolTip
{
public:
KoIconToolTip();
- virtual ~KoIconToolTip();
+ ~KoIconToolTip() override;
protected:
- virtual QTextDocument *createDocument( const QModelIndex &index );
+ QTextDocument *createDocument( const QModelIndex &index ) override;
private:
typedef KoItemToolTip super;
};
#endif // KOICONTOOLTIP_H
diff --git a/libs/widgets/KoItemToolTip.h b/libs/widgets/KoItemToolTip.h
index c42c2e1376..6c242d35fc 100644
--- a/libs/widgets/KoItemToolTip.h
+++ b/libs/widgets/KoItemToolTip.h
@@ -1,86 +1,86 @@
/*
Copyright (c) 2006 Gábor Lehel <illissius@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KO_ITEM_TOOLTIP_H
#define KO_ITEM_TOOLTIP_H
#include <QFrame>
#include "kritawidgets_export.h"
class QStyleOptionViewItem;
class QModelIndex;
class QTextDocument;
/**
* Base class for tooltips that can show extensive information about
* the contents of the data pointed to by something that contains a
* QModelIndex. Subclasses need to use this data to create a
* QTextDocument that is formatted to provide the complete tooltip.
*
* (KoItemToolTip is currently used in kopainter/KoResourceChooser)
*/
class KRITAWIDGETS_EXPORT KoItemToolTip : public QFrame
{
Q_OBJECT
public:
KoItemToolTip();
- virtual ~KoItemToolTip();
+ ~KoItemToolTip() override;
void showTip(QWidget *widget, const QPoint &pos, const QStyleOptionViewItem &option, const QModelIndex &index);
protected:
/**
* Re-implement this to provide the actual tooltip contents.
* For instance:
* @code
* QTextDocument *doc = new QTextDocument(this);
*
* QImage thumb = index.data(KoResourceModel::LargeThumbnailRole).value<QImage>();
* doc->addResource(QTextDocument::ImageResource, QUrl("data:thumbnail"), thumb);
*
* QString name = index.data(Qt::DisplayRole).toString();
*
* const QString image = QString("<img src=\"data:thumbnail\">");
* const QString body = QString("<h3 align=\"center\">%1</h3>").arg(name) + image;
* const QString html = QString("<html><body>%1</body></html>").arg(body);
*
* doc->setHtml(html);
* doc->setTextWidth(qMin(doc->size().width(), 500.0));
*
* return doc;
* @endcode
*/
virtual QTextDocument *createDocument(const QModelIndex &index) = 0;
private:
class Private;
Private* const d;
void updatePosition(QWidget *widget, const QPoint &pos, const QStyleOptionViewItem &option);
public:
- virtual QSize sizeHint() const;
+ QSize sizeHint() const override;
protected:
- virtual void paintEvent(QPaintEvent *e);
- virtual void timerEvent(QTimerEvent *e);
- virtual bool eventFilter(QObject *object, QEvent *event);
+ void paintEvent(QPaintEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
+ bool eventFilter(QObject *object, QEvent *event) override;
};
#endif
diff --git a/libs/widgets/KoLineStyleItemDelegate_p.h b/libs/widgets/KoLineStyleItemDelegate_p.h
index 65683fcdc4..647ef63ade 100644
--- a/libs/widgets/KoLineStyleItemDelegate_p.h
+++ b/libs/widgets/KoLineStyleItemDelegate_p.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOLINESTYLEITEMDELEGATE_H
#define KOLINESTYLEITEMDELEGATE_H
#include <QAbstractItemDelegate>
/// The line style item delegate for rendering the styles
class KoLineStyleItemDelegate : public QAbstractItemDelegate
{
public:
explicit KoLineStyleItemDelegate(QObject *parent = 0);
- ~KoLineStyleItemDelegate() {}
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ ~KoLineStyleItemDelegate() override {}
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};
#endif
diff --git a/libs/widgets/KoLineStyleModel_p.h b/libs/widgets/KoLineStyleModel_p.h
index 5920c9118f..7a6b7acdd5 100644
--- a/libs/widgets/KoLineStyleModel_p.h
+++ b/libs/widgets/KoLineStyleModel_p.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOLINESTYLEMODEL_H
#define KOLINESTYLEMODEL_H
#include <QAbstractListModel>
#include <QVector>
/// The line style model managing the style data
class KoLineStyleModel : public QAbstractListModel
{
public:
explicit KoLineStyleModel(QObject *parent = 0);
- virtual ~KoLineStyleModel() {}
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ ~KoLineStyleModel() override {}
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/// adds the given style to the model
bool addCustomStyle(const QVector<qreal> &style);
/// selects the given style
int setLineStyle(Qt::PenStyle style, const QVector<qreal> &dashes);
private:
QList<QVector<qreal> > m_styles; ///< the added styles
QVector<qreal> m_tempStyle; ///< a temporary added style
bool m_hasTempStyle; ///< state of the temporary style
};
#endif
diff --git a/libs/widgets/KoLineStyleSelector.h b/libs/widgets/KoLineStyleSelector.h
index 3110d1db9f..ca5d8520e2 100644
--- a/libs/widgets/KoLineStyleSelector.h
+++ b/libs/widgets/KoLineStyleSelector.h
@@ -1,70 +1,70 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOLINESTYLESELECTOR_H_
#define _KOLINESTYLESELECTOR_H_
#include "kritawidgets_export.h"
#include <QComboBox>
/**
* A custom combobox widget for selecting line styles.
*/
class KRITAWIDGETS_EXPORT KoLineStyleSelector : public QComboBox
{
Q_OBJECT
public:
explicit KoLineStyleSelector(QWidget *parent = 0);
- virtual ~KoLineStyleSelector();
+ ~KoLineStyleSelector() override;
/**
* Adds a new line style to the combobox.
*
* If the style already exists, it is not added to the selector.
*
* @param style the line style to add
* @return true if style is unique among the existing styles and was added, else false
*/
bool addCustomStyle(const QVector<qreal> &style);
/**
* Selects the specified style.
*
* If the style was already added it gets selected. If the style was not added already
* it gets temporary added and selected.
*
* @param style the style to display
* @param dashes the dashes of the style if style == Qt::CustomDashLine
*/
void setLineStyle(Qt::PenStyle style, const QVector<qreal> &dashes = QVector<qreal>());
/// Returns the current line style
Qt::PenStyle lineStyle() const;
/// Returns the dashes of the current line style
QVector<qreal> lineDashes() const;
protected:
- void paintEvent(QPaintEvent *pe);
+ void paintEvent(QPaintEvent *pe) override;
private:
class Private;
Private * const d;
};
#endif // _KOLINESTYLESELECTOR_H_
diff --git a/libs/widgets/KoMarkerItemDelegate.h b/libs/widgets/KoMarkerItemDelegate.h
index 717758097b..f6506072e9 100644
--- a/libs/widgets/KoMarkerItemDelegate.h
+++ b/libs/widgets/KoMarkerItemDelegate.h
@@ -1,44 +1,44 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOMARKERITEMDELEGATE_H
#define KOMARKERITEMDELEGATE_H
// Calligra
#include <KoFlake.h>
// Qt
#include <QAbstractItemDelegate>
class KoMarker;
class KoMarkerItemDelegate : public QAbstractItemDelegate
{
public:
explicit KoMarkerItemDelegate(KoFlake::MarkerPosition position, QObject *parent = 0);
- virtual ~KoMarkerItemDelegate();
+ ~KoMarkerItemDelegate() override;
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex &index) const override;
static void drawMarkerPreview(QPainter *painter, const QRect &rect, const QPen &pen, KoMarker *marker, KoFlake::MarkerPosition position);
private:
KoFlake::MarkerPosition m_position;
};
#endif /* KOMARKERITEMDELEGATE_H */
diff --git a/libs/widgets/KoMarkerModel.h b/libs/widgets/KoMarkerModel.h
index 46982e2608..749e8f4ea5 100644
--- a/libs/widgets/KoMarkerModel.h
+++ b/libs/widgets/KoMarkerModel.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOMARKERMODEL_H
#define KOMARKERMODEL_H
#include <KoFlake.h>
#include <QAbstractListModel>
#include <QExplicitlySharedDataPointer>
class KoMarker;
class KoMarkerModel : public QAbstractListModel
{
public:
KoMarkerModel(const QList<KoMarker*> markers, KoFlake::MarkerPosition position, QObject *parent = 0);
- virtual ~KoMarkerModel();
+ ~KoMarkerModel() override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int markerIndex(KoMarker *marker) const;
// returns index of the newly added temporary marker
int addTemporaryMarker(KoMarker *marker);
// removes a temporary marker added by \ref addTemporaryMarker
void removeTemporaryMarker();
int temporaryMarkerPosition() const;
QVariant marker(int index, int role = Qt::UserRole) const;
KoFlake::MarkerPosition position() const;
private:
QList<QExplicitlySharedDataPointer<KoMarker>> m_markers;
KoFlake::MarkerPosition m_markerPosition;
int m_temporaryMarkerPosition;
};
#endif /* KOMARKERMODEL_H */
diff --git a/libs/widgets/KoMarkerSelector.h b/libs/widgets/KoMarkerSelector.h
index b10127e986..fa8df60ac5 100644
--- a/libs/widgets/KoMarkerSelector.h
+++ b/libs/widgets/KoMarkerSelector.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOMARKERSELECTOR_H
#define KOMARKERSELECTOR_H
#include "kritawidgets_export.h"
#include <KoFlake.h>
#include <QComboBox>
class KoMarker;
class KRITAWIDGETS_EXPORT KoMarkerSelector : public QComboBox
{
Q_OBJECT
public:
explicit KoMarkerSelector(KoFlake::MarkerPosition position, QWidget *parent = 0);
- virtual ~KoMarkerSelector();
+ ~KoMarkerSelector() override;
// set the current marker style
void setMarker(KoMarker *marker);
// return the current marker style
KoMarker *marker() const;
/// reimplement
QVariant itemData(int index, int role = Qt::UserRole) const;
/**
* Set the available markers in the document.
*/
void updateMarkers(const QList<KoMarker*> markers);
protected:
- void paintEvent(QPaintEvent *pe);
+ void paintEvent(QPaintEvent *pe) override;
private:
class Private;
Private * const d;
};
#endif /* KOMARKERSELECTOR_H */
diff --git a/libs/widgets/KoPageLayoutDialog.h b/libs/widgets/KoPageLayoutDialog.h
index 6e7c486f47..7276f6a941 100644
--- a/libs/widgets/KoPageLayoutDialog.h
+++ b/libs/widgets/KoPageLayoutDialog.h
@@ -1,63 +1,63 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_PAGE_LAYOUT_DIALOG
#define KO_PAGE_LAYOUT_DIALOG
#include "kritawidgets_export.h"
#include <kpagedialog.h>
#include <KoUnit.h>
struct KoPageLayout;
/// A dialog to show the settings for one page and apply them afterwards.
class KRITAWIDGETS_EXPORT KoPageLayoutDialog : public KPageDialog
{
Q_OBJECT
public:
explicit KoPageLayoutDialog(QWidget *parent, const KoPageLayout &layout);
- ~KoPageLayoutDialog();
+ ~KoPageLayoutDialog() override;
void showTextDirection(bool on);
void showPageSpread(bool on);
void setPageSpread(bool pageSpread);
KoPageLayout pageLayout() const;
bool applyToDocument() const;
void showApplyToDocument(bool on);
void showUnitchooser(bool on);
void setUnit(const KoUnit &unit);
Q_SIGNALS:
void unitChanged(const KoUnit &unit);
public Q_SLOTS:
void setPageLayout(const KoPageLayout &layout);
protected Q_SLOTS:
- void accept();
- void reject();
+ void accept() override;
+ void reject() override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/widgets/KoPageLayoutWidget.h b/libs/widgets/KoPageLayoutWidget.h
index 229484a938..5362fa9dd7 100644
--- a/libs/widgets/KoPageLayoutWidget.h
+++ b/libs/widgets/KoPageLayoutWidget.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
* Copyright (C) 2007, 2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_PAGE_LAYOUT_WIDGET
#define KO_PAGE_LAYOUT_WIDGET
#include "kritawidgets_export.h"
#include <KoPageLayout.h>
#include <QWidget>
class KoUnit;
/// the widget that shows the size/margins and other page settings.
class KRITAWIDGETS_EXPORT KoPageLayoutWidget : public QWidget
{
Q_OBJECT
public:
KoPageLayoutWidget(QWidget *parent, const KoPageLayout &layout);
- ~KoPageLayoutWidget();
+ ~KoPageLayoutWidget() override;
KoPageLayout pageLayout() const;
void setUnit(const KoUnit &unit);
void showUnitchooser(bool on);
void showPageSpread(bool on);
void showPageStyles(bool on);
void setPageStyles(const QStringList &styles);
QString currentPageStyle() const;
void setPageSpread(bool pageSpread);
void showTextDirection(bool on);
Q_SIGNALS:
void layoutChanged(const KoPageLayout &layout);
void unitChanged(const KoUnit &unit);
public Q_SLOTS:
void setPageLayout(const KoPageLayout &layout);
void setTextAreaAvailable(bool available);
private Q_SLOTS:
void sizeChanged(int row);
void unitChanged(int row);
void facingPagesChanged();
void optionsChanged();
void marginsChanged();
void orientationChanged();
void setApplyToDocument(bool apply);
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/widgets/KoPagePreviewWidget.h b/libs/widgets/KoPagePreviewWidget.h
index e8053fb938..91cc3380ec 100644
--- a/libs/widgets/KoPagePreviewWidget.h
+++ b/libs/widgets/KoPagePreviewWidget.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2006 Gary Cramblitt <garycramblitt@comcast.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_PAGE_PREVIEW_WIDGET
#define KO_PAGE_PREVIEW_WIDGET
#include "kritawidgets_export.h"
#include <QWidget>
// Needed for building on Windows (cannot use forward declarations)
#include <KoPageLayout.h>
#include <KoColumns.h>
/// A widget to preview the KoPageLayout and KoColumns data structures.
class KRITAWIDGETS_EXPORT KoPagePreviewWidget : public QWidget {
Q_OBJECT
public:
explicit KoPagePreviewWidget(QWidget *parent = 0);
- ~KoPagePreviewWidget();
+ ~KoPagePreviewWidget() override;
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
public Q_SLOTS:
void setPageLayout(const KoPageLayout &layout);
void setColumns(const KoColumns &columns);
private:
void drawPage(QPainter &painter, qreal zoom, const QRect &dimensions, bool left);
private:
class Private;
Private * const d;
};
#endif
diff --git a/libs/widgets/KoResourceItemChooser.h b/libs/widgets/KoResourceItemChooser.h
index c9f3151edd..930f974056 100644
--- a/libs/widgets/KoResourceItemChooser.h
+++ b/libs/widgets/KoResourceItemChooser.h
@@ -1,153 +1,153 @@
/* This file is part of the KDE project
Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
Copyright (c) 2010 Boudewijn Rempt <boud@valdyas.org>
Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_RESOURCE_ITEM_CHOOSER
#define KO_RESOURCE_ITEM_CHOOSER
#include <QWidget>
#include "kritawidgets_export.h"
class QModelIndex;
class QAbstractProxyModel;
class QAbstractItemDelegate;
class QAbstractButton;
class QToolButton;
class KoAbstractResourceServerAdapter;
class KoResourceItemView;
class KoResource;
/**
* A widget that contains a KoResourceChooser as well
* as an import/export button
*/
class KRITAWIDGETS_EXPORT KoResourceItemChooser : public QWidget
{
Q_OBJECT
public:
enum Buttons { Button_Import, Button_Remove };
/// \p usePreview shows the aside preview with the resource's image
explicit KoResourceItemChooser(QSharedPointer<KoAbstractResourceServerAdapter> resourceAdapter, QWidget *parent = 0, bool usePreview = false);
- ~KoResourceItemChooser();
+ ~KoResourceItemChooser() override;
/// Sets number of columns in the view and causes the number of rows to be calculated accordingly
void setColumnCount(int columnCount);
/// Sets number of rows in the view and causes the number of columns to be calculated accordingly
void setRowCount(int rowCount);
/// Sets the height of the view rows
void setRowHeight(int rowHeight);
/// Sets the width of the view columns
void setColumnWidth(int columnWidth);
/// Sets a custom delegate for the view
void setItemDelegate(QAbstractItemDelegate *delegate);
/// Gets the currently selected resource
/// @returns the selected resource, 0 is no resource is selected
KoResource *currentResource() const;
/// Sets the item representing the resource as selected
void setCurrentResource(KoResource *resource);
/**
* Sets the selected resource, does nothing if there is no valid item
* @param row row of the item
* @param column column of the item
*/
void setCurrentItem(int row, int column);
void showButtons(bool show);
void addCustomButton(QAbstractButton *button, int cell);
/// determines whether the preview right or below the splitter
void setPreviewOrientation(Qt::Orientation orientation);
/// determines whether the preview should tile the resource's image or not
void setPreviewTiled(bool tiled);
/// shows the preview converted to grayscale
void setGrayscalePreview(bool grayscale);
/// sets the visibilty of tagging KlineEdits.
void showTaggingBar(bool show);
///Set a proxy model with will be used to filter the resources
void setProxyModel(QAbstractProxyModel *proxyModel);
QSize viewSize() const;
KoResourceItemView *itemView() const;
void setViewModeButtonVisible(bool visible);
QToolButton *viewModeButton() const;
void setSynced(bool sync);
- virtual bool eventFilter(QObject *object, QEvent *event);
+ bool eventFilter(QObject *object, QEvent *event) override;
Q_SIGNALS:
/// Emitted when a resource was selected
void resourceSelected(KoResource *resource);
/// Emitted when an *already selected* resource is clicked
/// again
void resourceClicked(KoResource *resource);
void splitterMoved();
public Q_SLOTS:
void slotButtonClicked(int button);
private Q_SLOTS:
void activated(const QModelIndex &index);
void clicked(const QModelIndex &index);
void contextMenuRequested(const QPoint &pos);
void baseLengthChanged(int length);
void slotBeforeResourcesLayoutReset(KoResource *activateAfterReset);
void slotAfterResourcesLayoutReset();
void updateView();
protected:
- virtual void showEvent(QShowEvent *event);
+ void showEvent(QShowEvent *event) override;
private:
void updateButtonState();
void updatePreview(KoResource *resource);
- virtual void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
/// Resource for a given model index
/// @returns the resource pointer, 0 is index not valid
KoResource *resourceFromModelIndex(const QModelIndex &index) const;
class Private;
Private *const d;
};
#endif // KO_RESOURCE_ITEM_CHOOSER
diff --git a/libs/widgets/KoResourceItemChooserContextMenu.h b/libs/widgets/KoResourceItemChooserContextMenu.h
index 1c8a6265c5..970a930a6d 100644
--- a/libs/widgets/KoResourceItemChooserContextMenu.h
+++ b/libs/widgets/KoResourceItemChooserContextMenu.h
@@ -1,120 +1,120 @@
/*
* This file is part of the KDE project
* Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* * Boston, MA 02110-1301, USA.
* */
#ifndef KORESOURCEITEMCHOOSERCONTEXTMENU_H
#define KORESOURCEITEMCHOOSERCONTEXTMENU_H
#include <QMenu>
#include <QWidgetAction>
#include <QLabel>
#include <qlineedit.h>
class QLineEdit;
class KoResource;
class ContextMenuExistingTagAction : public QAction
{
Q_OBJECT
public:
explicit ContextMenuExistingTagAction( KoResource * resource, QString tag, QObject* parent = 0);
- ~ContextMenuExistingTagAction();
+ ~ContextMenuExistingTagAction() override;
Q_SIGNALS:
void triggered(KoResource * resource, QString tag);
protected Q_SLOTS:
void onTriggered();
private:
KoResource * m_resource;
QString m_tag;
};
/*!
* A line edit QWidgetAction.
* Default behavior: Closes its parent upon triggering.
*/
class KoLineEditAction : public QWidgetAction
{
Q_OBJECT
public:
explicit KoLineEditAction(QObject* parent);
- virtual ~KoLineEditAction();
+ ~KoLineEditAction() override;
void setIcon(const QIcon &icon);
void closeParentOnTrigger(bool closeParent);
bool closeParentOnTrigger();
void setPlaceholderText(const QString& clickMessage);
void setText(const QString& text);
void setVisible(bool showAction);
Q_SIGNALS:
void triggered(const QString &tag);
protected Q_SLOTS:
void onTriggered();
private:
bool m_closeParentOnTrigger;
QLabel * m_label;
QLineEdit * m_editBox;
};
class NewTagAction : public KoLineEditAction
{
Q_OBJECT
public:
explicit NewTagAction (KoResource* resource, QMenu* parent);
- ~NewTagAction();
+ ~NewTagAction() override;
Q_SIGNALS:
void triggered(KoResource * resource, const QString &tag);
protected Q_SLOTS:
void onTriggered(const QString& tagName);
private:
KoResource * m_resource;
};
class KoResourceItemChooserContextMenu : public QMenu
{
Q_OBJECT
public:
explicit KoResourceItemChooserContextMenu
(
KoResource* resource,
const QStringList& resourceTags,
const QString& currentlySelectedTag,
const QStringList& allTags
);
- virtual ~KoResourceItemChooserContextMenu();
+ ~KoResourceItemChooserContextMenu() override;
Q_SIGNALS:
/// Emitted when a resource should be added to an existing tag.
void resourceTagAdditionRequested(KoResource* resource, const QString& tag);
/// Emitted when a resource should be removed from an existing tag.
void resourceTagRemovalRequested(KoResource* resource, const QString& tag);
/// Emitted when a resource should be added to a new tag, which will need to be created.
void resourceAssignmentToNewTagRequested(KoResource* resource, const QString& tag);
};
#endif // KORESOURCEITEMCHOOSERCONTEXTMENU_H
diff --git a/libs/widgets/KoResourceItemChooserSync.h b/libs/widgets/KoResourceItemChooserSync.h
index c2259d56a3..ca45a4f26d 100644
--- a/libs/widgets/KoResourceItemChooserSync.h
+++ b/libs/widgets/KoResourceItemChooserSync.h
@@ -1,65 +1,65 @@
/* This file is part of the KDE project
Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEITEMCHOOSERSYNC_H
#define KORESOURCEITEMCHOOSERSYNC_H
#include <QObject>
#include <QScopedPointer>
#include "kritawidgets_export.h"
/**
* KoResourceItemChooserSync is a singleton that sync the size of entries in the
* resource item choosers between differnt choosers
* To use the syncing it has to be turned on in the KoResourceItemChooser
*/
class KRITAWIDGETS_EXPORT KoResourceItemChooserSync : public QObject
{
Q_OBJECT
public:
KoResourceItemChooserSync();
- virtual ~KoResourceItemChooserSync();
+ ~KoResourceItemChooserSync() override;
static KoResourceItemChooserSync* instance();
/// Gets the base length
/// @returns the base length of items
int baseLength();
/// Set the base length
/// @param length base length for the items, will be clamped if ouside range
void setBaseLength(int length);
Q_SIGNALS:
/// Signal is emitted when the base length is changed and will trigger and update in
/// the resource item choosers
void baseLenghtChanged(int length);
private:
KoResourceItemChooserSync(const KoResourceItemChooserSync&);
KoResourceItemChooserSync operator=(const KoResourceItemChooserSync&);
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif // KORESOURCEITEMCHOOSERSYNC_H
diff --git a/libs/widgets/KoResourceItemDelegate.h b/libs/widgets/KoResourceItemDelegate.h
index af8a1e5ad3..dc71d36937 100644
--- a/libs/widgets/KoResourceItemDelegate.h
+++ b/libs/widgets/KoResourceItemDelegate.h
@@ -1,40 +1,40 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEITEMDELEGATE_H
#define KORESOURCEITEMDELEGATE_H
#include <QAbstractItemDelegate>
#include "KoCheckerBoardPainter.h"
/// The resource item delegate for rendering the resource preview
class KoResourceItemDelegate : public QAbstractItemDelegate
{
public:
explicit KoResourceItemDelegate(QObject *parent = 0);
- virtual ~KoResourceItemDelegate() {}
+ ~KoResourceItemDelegate() override {}
/// reimplemented
- virtual void paint( QPainter *, const QStyleOptionViewItem &, const QModelIndex & ) const;
+ void paint( QPainter *, const QStyleOptionViewItem &, const QModelIndex & ) const override;
/// reimplemented
- QSize sizeHint ( const QStyleOptionViewItem &, const QModelIndex & ) const;
+ QSize sizeHint ( const QStyleOptionViewItem &, const QModelIndex & ) const override;
private:
KoCheckerBoardPainter m_checkerPainter;
};
#endif // KORESOURCEITEMDELEGATE_H
diff --git a/libs/widgets/KoResourceItemView.h b/libs/widgets/KoResourceItemView.h
index 3ec4763439..e815f92763 100644
--- a/libs/widgets/KoResourceItemView.h
+++ b/libs/widgets/KoResourceItemView.h
@@ -1,64 +1,64 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEITEMVIEW_H
#define KORESOURCEITEMVIEW_H
#include <KoTableView.h>
#include <KoIconToolTip.h>
class QEvent;
class QModelIndex;
/// The resource view
class KoResourceItemView : public KoTableView
{
Q_OBJECT
public:
explicit KoResourceItemView(QWidget *parent = 0);
- virtual ~KoResourceItemView() { disconnect(); }
+ ~KoResourceItemView() override { disconnect(); }
/// reimplemented
- virtual bool viewportEvent(QEvent *event);
+ bool viewportEvent(QEvent *event) override;
Q_SIGNALS:
void currentResourceChanged(const QModelIndex &);
void currentResourceClicked(const QModelIndex &);
void contextMenuRequested(const QPoint &);
protected:
- virtual void contextMenuEvent(QContextMenuEvent *event);
- void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
+ void contextMenuEvent(QContextMenuEvent *event) override;
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
- void mousePressEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event) override;
private Q_SLOTS:
void slotItemClicked(const QModelIndex &index);
private:
KoIconToolTip m_tip;
QModelIndex m_beforeClickIndex;
};
#endif // KORESOURCEITEMVIEW_H
diff --git a/libs/widgets/KoResourceModel.h b/libs/widgets/KoResourceModel.h
index 9abfe1eec5..7dfdc045ea 100644
--- a/libs/widgets/KoResourceModel.h
+++ b/libs/widgets/KoResourceModel.h
@@ -1,110 +1,110 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
* Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEMODEL_H
#define KORESOURCEMODEL_H
#include <QSharedPointer>
#include "KoResourceModelBase.h"
#include "kritawidgets_export.h"
class KoAbstractResourceServerAdapter;
class KoResource;
/// The resource model managing the resource data
class KRITAWIDGETS_EXPORT KoResourceModel : public KoResourceModelBase
{
Q_OBJECT
public:
explicit KoResourceModel(QSharedPointer<KoAbstractResourceServerAdapter> resourceAdapter, QObject * parent = 0);
- virtual ~KoResourceModel();
+ ~KoResourceModel() override;
/// reimplemented
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
/// reimplemented
- virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
+ int columnCount ( const QModelIndex & parent = QModelIndex() ) const override;
/// reimplemented
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/// reimplemented
- virtual QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const;
+ QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const override;
/// Sets the number of columns to display
void setColumnCount( int columnCount );
/// Extensions to Qt::ItemDataRole.
enum ItemDataRole
{
/// A larger thumbnail for displaying in a tooltip. 200x200 or so.
LargeThumbnailRole = 33
};
- QModelIndex indexFromResource(KoResource* resource) const;
+ QModelIndex indexFromResource(KoResource* resource) const override;
/// facade for KoAbstractResourceServerAdapter
QString extensions() const;
void importResourceFile(const QString &filename);
void importResourceFile(const QString &filename, bool fileCreation);
- bool removeResource(KoResource* resource);
+ bool removeResource(KoResource* resource) override;
void removeResourceFile(const QString & filename);
- QStringList assignedTagsList(KoResource *resource) const;
- void addTag(KoResource* resource, const QString& tag);
- void deleteTag( KoResource* resource, const QString& tag);
- QStringList tagNamesList() const;
+ QStringList assignedTagsList(KoResource *resource) const override;
+ void addTag(KoResource* resource, const QString& tag) override;
+ void deleteTag( KoResource* resource, const QString& tag) override;
+ QStringList tagNamesList() const override;
QStringList searchTag(const QString& lineEditText);
- void enableResourceFiltering(bool enable);
- void setCurrentTag(const QString& currentTag);
- void searchTextChanged(const QString& searchString);
- void updateServer();
- int resourcesCount() const;
- QList<KoResource *> currentlyVisibleResources() const;
- QList<KoResource *> serverResources() const;
- void tagCategoryMembersChanged();
- void tagCategoryAdded(const QString& tag);
- void tagCategoryRemoved(const QString& tag);
+ void enableResourceFiltering(bool enable) override;
+ void setCurrentTag(const QString& currentTag) override;
+ void searchTextChanged(const QString& searchString) override;
+ void updateServer() override;
+ int resourcesCount() const override;
+ QList<KoResource *> currentlyVisibleResources() const override;
+ QList<KoResource *> serverResources() const override;
+ void tagCategoryMembersChanged() override;
+ void tagCategoryAdded(const QString& tag) override;
+ void tagCategoryRemoved(const QString& tag) override;
QString serverType() const;
Q_SIGNALS:
/// XXX: not sure if this is the best place for these
void tagBoxEntryModified();
void tagBoxEntryAdded(const QString& tag);
void tagBoxEntryRemoved(const QString& tag);
void beforeResourcesLayoutReset(KoResource *activateAfterReformat);
void afterResourcesLayoutReset();
private:
void doSafeLayoutReset(KoResource *activateAfterReformat);
private Q_SLOTS:
- void resourceAdded(KoResource *resource);
- void resourceRemoved(KoResource *resource);
- void resourceChanged(KoResource *resource);
- void tagBoxEntryWasModified();
- void tagBoxEntryWasAdded(const QString& tag);
- void tagBoxEntryWasRemoved(const QString& tag);
+ void resourceAdded(KoResource *resource) override;
+ void resourceRemoved(KoResource *resource) override;
+ void resourceChanged(KoResource *resource) override;
+ void tagBoxEntryWasModified() override;
+ void tagBoxEntryWasAdded(const QString& tag) override;
+ void tagBoxEntryWasRemoved(const QString& tag) override;
private:
QSharedPointer<KoAbstractResourceServerAdapter> m_resourceAdapter;
int m_columnCount;
QString m_currentTag;
};
#endif // KORESOURCEMODEL_H
diff --git a/libs/widgets/KoResourceModelBase.h b/libs/widgets/KoResourceModelBase.h
index 90a185757f..c859fb55c8 100644
--- a/libs/widgets/KoResourceModelBase.h
+++ b/libs/widgets/KoResourceModelBase.h
@@ -1,71 +1,71 @@
/* This file is part of the KDE project
* Copyright (C) 2014 Victor Lafon <metabolic.ewilan@hotmail.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEMODELBASE_H
#define KORESOURCEMODELBASE_H
#include <QAbstractTableModel>
#include "kritawidgets_export.h"
class KoResource;
/// The resource model managing the resource data
class KRITAWIDGETS_EXPORT KoResourceModelBase : public QAbstractTableModel
{
Q_OBJECT
public:
explicit KoResourceModelBase(QObject * parent = 0 );
- virtual ~KoResourceModelBase();
+ ~KoResourceModelBase() override;
/// reimplemented
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const =0;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override =0;
/// reimplemented
- virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const =0;
+ int columnCount ( const QModelIndex & parent = QModelIndex() ) const override =0;
/// reimplemented
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const =0;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override =0;
/// reimplemented
- virtual QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const =0;
+ QModelIndex index ( int row, int column = 0, const QModelIndex & parent = QModelIndex() ) const override =0;
virtual QModelIndex indexFromResource(KoResource* resource) const =0;
virtual QStringList assignedTagsList(KoResource *resource) const =0;
virtual bool removeResource(KoResource* resource) =0;
virtual void addTag(KoResource* resource, const QString& tag) =0;
virtual void deleteTag(KoResource *resource, const QString &tag) =0;
virtual int resourcesCount() const =0;
virtual QList<KoResource *> currentlyVisibleResources() const =0;
virtual void updateServer() =0;
virtual void enableResourceFiltering(bool enable) =0;
virtual void searchTextChanged(const QString& searchString) =0;
virtual QStringList tagNamesList() const =0;
virtual void setCurrentTag(const QString& currentTag) =0;
virtual QList<KoResource *> serverResources() const =0;
virtual void tagCategoryMembersChanged() =0;
virtual void tagCategoryAdded(const QString& tag) =0;
virtual void tagCategoryRemoved(const QString& tag) =0;
private Q_SLOTS:
virtual void tagBoxEntryWasModified() =0;
virtual void tagBoxEntryWasAdded(const QString& tag) =0;
virtual void tagBoxEntryWasRemoved(const QString& tag) =0;
virtual void resourceAdded(KoResource *resource) =0;
virtual void resourceRemoved(KoResource *resource) =0;
virtual void resourceChanged(KoResource* resource) =0;
};
#endif // KORESOURCEMODELBASE_H
diff --git a/libs/widgets/KoResourcePopupAction.h b/libs/widgets/KoResourcePopupAction.h
index 271f917b97..baa1054bee 100644
--- a/libs/widgets/KoResourcePopupAction.h
+++ b/libs/widgets/KoResourcePopupAction.h
@@ -1,73 +1,73 @@
/* This file is part of the KDE project
* Made by Tomislav Lukman (tomislav.lukman@ck.tel.hr)
* Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCEPOPUPACTION_H
#define KORESOURCEPOPUPACTION_H
#include <QAction>
#include <QSharedPointer>
#include "kritawidgets_export.h"
class KoShapeBackground;
class KoAbstractResourceServerAdapter;
class QModelIndex;
class KoResource;
class KRITAWIDGETS_EXPORT KoResourcePopupAction : public QAction
{
Q_OBJECT
public:
/**
* Constructs a KoResourcePopupAction (gradient or pattern) with the specified parent.
*
* @param parent The parent for this action.
*/
explicit KoResourcePopupAction(QSharedPointer<KoAbstractResourceServerAdapter>gradientResourceAdapter, QObject *parent = 0);
/**
* Destructor
*/
- virtual ~KoResourcePopupAction();
+ ~KoResourcePopupAction() override;
QSharedPointer<KoShapeBackground> currentBackground() const;
void setCurrentBackground(QSharedPointer<KoShapeBackground> background);
void setCurrentResource(KoResource *resource);
KoResource *currentResource() const;
Q_SIGNALS:
/// Emitted when a resource was selected
void resourceSelected(QSharedPointer<KoShapeBackground> background);
public Q_SLOTS:
void updateIcon();
private Q_SLOTS:
void indexChanged(const QModelIndex &modelIndex);
private:
class Private;
Private * const d;
};
#endif /* KORESOURCEPOPUPACTION_H */
diff --git a/libs/widgets/KoResourceSelector.h b/libs/widgets/KoResourceSelector.h
index 701439eff9..64d5c83ce3 100644
--- a/libs/widgets/KoResourceSelector.h
+++ b/libs/widgets/KoResourceSelector.h
@@ -1,94 +1,94 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCESELECTOR_H
#define KORESOURCESELECTOR_H
#include "kritawidgets_export.h"
#include <QComboBox>
class QMouseEvent;
class KoAbstractResourceServerAdapter;
class KoResource;
/**
* A custom combobox widget for selecting resource items like gradients or patterns.
*/
class KRITAWIDGETS_EXPORT KoResourceSelector : public QComboBox
{
Q_OBJECT
public:
enum DisplayMode {
ImageMode, ///< Displays image of resources (default)
TextMode ///< Displays name of resources
};
/**
* Constructs a new resource selector.
* @param parent the parent widget
*/
explicit KoResourceSelector(QWidget *parent = 0);
/**
* Constructs a new resource selector showing the resources of the given resource adapter.
* @param resourceAdapter the resource adapter providing the resources to display
* @param parent the parent widget
*/
explicit KoResourceSelector( QSharedPointer<KoAbstractResourceServerAdapter> resourceAdapter, QWidget * parent = 0 );
/// Destroys the resource selector
- virtual ~KoResourceSelector();
+ ~KoResourceSelector() override;
/// Sets the resource adaptor to get resources from
void setResourceAdapter(QSharedPointer<KoAbstractResourceServerAdapter>resourceAdapter);
/// Sets the display mode
void setDisplayMode(DisplayMode mode);
/// Sets number of columns to display in the popup view
void setColumnCount( int columnCount );
/// Sets the height of the popup view rows
void setRowHeight( int rowHeight );
Q_SIGNALS:
/// Emitted when a resource was selected
void resourceSelected( KoResource * resource );
/// Is emitted when the user has clicked on the current resource
void resourceApplied( KoResource * resource );
protected:
/// reimplemented
- virtual void paintEvent( QPaintEvent * );
+ void paintEvent( QPaintEvent * ) override;
/// reimplemented
- virtual void mousePressEvent( QMouseEvent * );
+ void mousePressEvent( QMouseEvent * ) override;
/// reimplemented
- virtual void mouseMoveEvent( QMouseEvent * event );
+ void mouseMoveEvent( QMouseEvent * event ) override;
private Q_SLOTS:
void indexChanged( int index );
void resourceAdded(KoResource*);
void resourceRemoved(KoResource*);
private:
class Private;
Private * const d;
};
#endif // KORESOURCESELECTOR_H
diff --git a/libs/widgets/KoResourceServer.h b/libs/widgets/KoResourceServer.h
index a003e490a7..f8973c8161 100644
--- a/libs/widgets/KoResourceServer.h
+++ b/libs/widgets/KoResourceServer.h
@@ -1,713 +1,713 @@
/* This file is part of the KDE project
Copyright (c) 1999 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
Copyright (c) 2005 Sven Langkamp <sven.langkamp@gmail.com>
Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KORESOURCESERVER_H
#define KORESOURCESERVER_H
#include <QMutex>
#include <QString>
#include <QStringList>
#include <QList>
#include <QFileInfo>
#include <QDir>
#include <QTemporaryFile>
#include <QDomDocument>
#include "resources/KoResource.h"
#include "KoResourceServerPolicies.h"
#include "KoResourceServerObserver.h"
#include "KoResourceTagStore.h"
#include "KoResourcePaths.h"
#include "kritawidgets_export.h"
#include "WidgetsDebug.h"
class KoResource;
/**
* KoResourceServerBase is the base class of all resource servers
*/
class KRITAWIDGETS_EXPORT KoResourceServerBase {
public:
/**
* Constructs a KoResourceServerBase
* @param resource type, has to be the same as used by KoResourcePaths
* @param extensions the file extensions separate by ':', e.g. "*.kgr:*.svg:*.ggr"
*/
KoResourceServerBase(const QString& type, const QString& extensions)
: m_type(type)
, m_extensions(extensions)
{
}
virtual ~KoResourceServerBase() {}
virtual int resourceCount() const = 0;
virtual void loadResources(QStringList filenames) = 0;
virtual QStringList blackListedFiles() const = 0;
virtual QStringList queryResources(const QString &query) const = 0;
QString type() const { return m_type; }
/**
* File extensions for resources of the server
* @returns the file extensions separated by ':', e.g. "*.kgr:*.svg:*.ggr"
*/
QString extensions() const { return m_extensions; }
QStringList fileNames() const
{
QStringList extensionList = m_extensions.split(':');
QStringList fileNames;
foreach (const QString &extension, extensionList) {
fileNames += KoResourcePaths::findAllResources(type().toLatin1(), extension, KoResourcePaths::Recursive);
}
return fileNames;
}
protected:
friend class KoResourceTagStore;
virtual KoResource *byMd5(const QByteArray &md5) const = 0;
virtual KoResource *byFileName(const QString &fileName) const = 0;
private:
QString m_type;
QString m_extensions;
protected:
QMutex m_loadLock;
};
/**
* KoResourceServer manages the resources of one type. It stores,
* loads and saves the resources. To keep track of changes the server
* can be observed with a KoResourceServerObserver
*
* The \p Policy template parameter defines the way how the lifetime
* of a resource is handled. There are to predefined policies:
*
* o PointerStoragePolicy --- usual pointers with ownership over
* the resource.
* o SharedPointerStoragePolicy --- shared pointers. The server does no
* extra handling for the lifetime of
* the resource.
*
* Use the former for usual resources and the latter for shared pointer based
* ones.
*/
template <class T, class Policy = PointerStoragePolicy<T> >
class KoResourceServer : public KoResourceServerBase
{
public:
typedef typename Policy::PointerType PointerType;
typedef KoResourceServerObserver<T, Policy> ObserverType;
KoResourceServer(const QString& type, const QString& extensions)
: KoResourceServerBase(type, extensions)
{
m_blackListFile = KoResourcePaths::locateLocal("data", type + ".blacklist");
m_blackListFileNames = readBlackListFile();
m_tagStore = new KoResourceTagStore(this);
m_tagStore->loadTags();
}
- virtual ~KoResourceServer()
+ ~KoResourceServer() override
{
if (m_tagStore) {
delete m_tagStore;
}
Q_FOREACH (ObserverType* observer, m_observers) {
observer->unsetResourceServer();
}
Q_FOREACH (PointerType res, m_resources) {
Policy::deleteResource(res);
}
m_resources.clear();
}
- int resourceCount() const {
+ int resourceCount() const override {
return m_resources.size();
}
/**
* Loads a set of resources and adds them to the resource server.
* If a filename appears twice the resource will only be added once. Resources that can't
* be loaded or and invalid aren't added to the server.
* @param filenames list of filenames to be loaded
*/
- void loadResources(QStringList filenames) {
+ void loadResources(QStringList filenames) override {
QStringList uniqueFiles;
while (!filenames.empty()) {
QString front = filenames.first();
filenames.pop_front();
// In the save location, people can use sub-folders... And then they probably want
// to load both versions! See https://bugs.kde.org/show_bug.cgi?id=321361.
QString fname;
if (front.contains(saveLocation())) {
fname = front.split(saveLocation())[1];
}
else {
fname = QFileInfo(front).fileName();
}
// XXX: Don't load resources with the same filename. Actually, we should look inside
// the resource to find out whether they are really the same, but for now this
// will prevent the same brush etc. showing up twice.
if (!uniqueFiles.contains(fname)) {
m_loadLock.lock();
uniqueFiles.append(fname);
QList<PointerType> resources = createResources(front);
Q_FOREACH (PointerType resource, resources) {
Q_CHECK_PTR(resource);
if (resource->load() && resource->valid() && !resource->md5().isEmpty()) {
QByteArray md5 = resource->md5();
m_resourcesByMd5[md5] = resource;
m_resourcesByFilename[resource->shortFilename()] = resource;
if (resource->name().isEmpty()) {
resource->setName(fname);
}
if (m_resourcesByName.contains(resource->name())) {
resource->setName(resource->name() + "(" + resource->shortFilename() + ")");
}
m_resourcesByName[resource->name()] = resource;
notifyResourceAdded(resource);
}
else {
warnWidgets << "Loading resource " << front << "failed";
Policy::deleteResource(resource);
}
}
m_loadLock.unlock();
}
}
m_resources = sortedResources();
Q_FOREACH (ObserverType* observer, m_observers) {
observer->syncTaggedResourceView();
}
debugWidgets << "done loading resources for type " << type();
}
/// Adds an already loaded resource to the server
bool addResource(PointerType resource, bool save = true, bool infront = false) {
if (!resource->valid()) {
warnWidgets << "Tried to add an invalid resource!";
return false;
}
if (save) {
QFileInfo fileInfo(resource->filename());
QDir d(fileInfo.path());
if (!d.exists()) {
d.mkdir(fileInfo.path());
}
if (fileInfo.exists()) {
QString filename = fileInfo.path() + "/" + fileInfo.baseName() + "XXXXXX" + "." + fileInfo.suffix();
debugWidgets << "fileName is " << filename;
QTemporaryFile file(filename);
if (file.open()) {
debugWidgets << "now " << file.fileName();
resource->setFilename(file.fileName());
}
}
if (!resource->save()) {
warnWidgets << "Could not save resource!";
return false;
}
}
Q_ASSERT(!resource->filename().isEmpty() || !resource->name().isEmpty());
if (resource->filename().isEmpty()) {
resource->setFilename(resource->name());
}
else if (resource->name().isEmpty()) {
resource->setName(resource->filename());
}
m_resourcesByFilename[resource->shortFilename()] = resource;
m_resourcesByMd5[resource->md5()] = resource;
m_resourcesByName[resource->name()] = resource;
if (infront) {
m_resources.insert(0, resource);
}
else {
m_resources.append(resource);
}
notifyResourceAdded(resource);
return true;
}
/*Removes a given resource from the blacklist.
*/
bool removeFromBlacklist(PointerType resource) {
if (m_blackListFileNames.contains(resource->filename())) {
m_blackListFileNames.removeAll(resource->filename());
writeBlackListFile();
}
else{
warnWidgets<<"Doesn't contain filename";
return false;
}
//then return true//
return true;
}
/// Remove a resource from Resource Server but not from a file
bool removeResourceFromServer(PointerType resource){
if ( !m_resourcesByFilename.contains( resource->shortFilename() ) ) {
return false;
}
m_resourcesByMd5.remove(resource->md5());
m_resourcesByName.remove(resource->name());
m_resourcesByFilename.remove(resource->shortFilename());
m_resources.removeAt(m_resources.indexOf(resource));
m_tagStore->removeResource(resource);
notifyRemovingResource(resource);
Policy::deleteResource(resource);
return true;
}
/// Remove a resource from the resourceserver and blacklist it
bool removeResourceAndBlacklist(PointerType resource) {
if ( !m_resourcesByFilename.contains( resource->shortFilename() ) ) {
return false;
}
m_resourcesByMd5.remove(resource->md5());
m_resourcesByName.remove(resource->name());
m_resourcesByFilename.remove(resource->shortFilename());
m_resources.removeAt(m_resources.indexOf(resource));
m_tagStore->removeResource(resource);
notifyRemovingResource(resource);
m_blackListFileNames.append(resource->filename());
writeBlackListFile();
Policy::deleteResource(resource);
return true;
}
QList<PointerType> resources() {
m_loadLock.lock();
QList<PointerType> resourceList = m_resources;
Q_FOREACH (PointerType r, m_resourceBlackList) {
resourceList.removeOne(r);
}
m_loadLock.unlock();
return resourceList;
}
/// Returns path where to save user defined and imported resources to
virtual QString saveLocation() {
return KoResourcePaths::saveLocation(type().toLatin1());
}
/**
* Creates a new resource from a given file and adds them to the resource server
* The base implementation does only load one resource per file, override to implement collections
* @param filename file name of the resource file to be imported
* @param fileCreation decides whether to create the file in the saveLocation() directory
*/
virtual bool importResourceFile(const QString & filename , bool fileCreation=true) {
QFileInfo fi(filename);
if (!fi.exists())
return false;
if ( fi.size() == 0)
return false;
PointerType resource = createResource( filename );
resource->load();
if (!resource->valid()) {
warnWidgets << "Import failed! Resource is not valid";
Policy::deleteResource(resource);
return false;
}
if (fileCreation) {
Q_ASSERT(!resource->defaultFileExtension().isEmpty());
Q_ASSERT(!saveLocation().isEmpty());
QString newFilename = saveLocation() + fi.baseName() + resource->defaultFileExtension();
QFileInfo fileInfo(newFilename);
int i = 1;
while (fileInfo.exists()) {
fileInfo.setFile(saveLocation() + fi.baseName() + QString("%1").arg(i) + resource->defaultFileExtension());
i++;
}
resource->setFilename(fileInfo.filePath());
}
if(!addResource(resource)) {
Policy::deleteResource(resource);
}
return true;
}
/// Removes the resource file from the resource server
virtual void removeResourceFile(const QString & filename)
{
QFileInfo fi(filename);
PointerType resource = resourceByFilename(fi.fileName());
if (!resource) {
warnWidgets << "Resource file do not exist ";
return;
}
if (!removeResourceFromServer(resource))
return;
}
/**
* Addes an observer to the server
* @param observer the observer to be added
* @param notifyLoadedResources determines if the observer should be notified about the already loaded resources
*/
void addObserver(ObserverType* observer, bool notifyLoadedResources = true)
{
m_loadLock.lock();
if(observer && !m_observers.contains(observer)) {
m_observers.append(observer);
if(notifyLoadedResources) {
Q_FOREACH (PointerType resource, m_resourcesByFilename) {
observer->resourceAdded(resource);
}
}
}
m_loadLock.unlock();
}
/**
* Removes an observer from the server
* @param observer the observer to be removed
*/
void removeObserver(ObserverType* observer)
{
int index = m_observers.indexOf( observer );
if( index < 0 )
return;
m_observers.removeAt( index );
}
PointerType resourceByFilename(const QString& filename) const
{
if (m_resourcesByFilename.contains(filename)) {
return m_resourcesByFilename[filename];
}
return 0;
}
PointerType resourceByName( const QString& name ) const
{
if (m_resourcesByName.contains(name)) {
return m_resourcesByName[name];
}
return 0;
}
PointerType resourceByMD5(const QByteArray& md5) const
{
return m_resourcesByMd5.value(md5);
}
/**
* Call after changing the content of a resource;
* Notifies the connected views.
*/
void updateResource( PointerType resource )
{
notifyResourceChanged(resource);
}
- QStringList blackListedFiles() const
+ QStringList blackListedFiles() const override
{
return m_blackListFileNames;
}
void removeBlackListedFiles() {
QStringList remainingFiles; // Files that can't be removed e.g. no rights will stay blacklisted
Q_FOREACH (const QString &filename, m_blackListFileNames) {
QFile file( filename );
if( ! file.remove() ) {
remainingFiles.append(filename);
}
}
m_blackListFileNames = remainingFiles;
writeBlackListFile();
}
QStringList tagNamesList() const
{
return m_tagStore->tagNamesList();
}
// don't use these method directly since it doesn't update views!
void addTag( KoResource* resource,const QString& tag)
{
m_tagStore->addTag(resource,tag);
}
// don't use these method directly since it doesn't update views!
void delTag( KoResource* resource,const QString& tag)
{
m_tagStore->delTag(resource, tag);
}
QStringList searchTag(const QString& lineEditText)
{
return m_tagStore->searchTag(lineEditText);
}
void tagCategoryAdded(const QString& tag)
{
m_tagStore->serializeTags();
Q_FOREACH (ObserverType* observer, m_observers) {
observer->syncTagAddition(tag);
}
}
void tagCategoryRemoved(const QString& tag)
{
m_tagStore->delTag(tag);
m_tagStore->serializeTags();
Q_FOREACH (ObserverType* observer, m_observers) {
observer->syncTagRemoval(tag);
}
}
void tagCategoryMembersChanged()
{
m_tagStore->serializeTags();
Q_FOREACH (ObserverType* observer, m_observers) {
observer->syncTaggedResourceView();
}
}
- QStringList queryResources(const QString &query) const
+ QStringList queryResources(const QString &query) const override
{
return m_tagStore->searchTag(query);
}
QStringList assignedTagsList(KoResource* resource) const
{
return m_tagStore->assignedTagsList(resource);
}
/**
* Create one or more resources from a single file. By default one resource is created.
* Overide to create more resources from the file.
* @param filename the filename of the resource or resource collection
*/
virtual QList<PointerType> createResources( const QString & filename )
{
QList<PointerType> createdResources;
createdResources.append(createResource(filename));
return createdResources;
}
virtual PointerType createResource( const QString & filename ) = 0;
/// Return the currently stored resources in alphabetical order, overwrite for customized sorting
virtual QList<PointerType> sortedResources()
{
QMap<QString, PointerType> sortedNames;
Q_FOREACH (const QString &name, m_resourcesByName.keys()) {
sortedNames.insert(name.toLower(), m_resourcesByName[name]);
}
return sortedNames.values();
}
protected:
void notifyResourceAdded(PointerType resource)
{
Q_FOREACH (ObserverType* observer, m_observers) {
observer->resourceAdded(resource);
}
}
void notifyRemovingResource(PointerType resource)
{
Q_FOREACH (ObserverType* observer, m_observers) {
observer->removingResource(resource);
}
}
void notifyResourceChanged(PointerType resource)
{
Q_FOREACH (ObserverType* observer, m_observers) {
observer->resourceChanged(resource);
}
}
/// Reads the xml file and returns the filenames as a list
QStringList readBlackListFile()
{
QStringList filenameList;
QFile f(m_blackListFile);
if (!f.open(QIODevice::ReadOnly)) {
return filenameList;
}
QDomDocument doc;
if (!doc.setContent(&f)) {
warnWidgets << "The file could not be parsed.";
return filenameList;
}
QDomElement root = doc.documentElement();
if (root.tagName() != "resourceFilesList") {
warnWidgets << "The file doesn't seem to be of interest.";
return filenameList;
}
QDomElement file = root.firstChildElement("file");
while (!file.isNull()) {
QDomNode n = file.firstChild();
QDomElement e = n.toElement();
if (e.tagName() == "name") {
filenameList.append((e.text()).replace(QString("~"),QDir::homePath()));
}
file = file.nextSiblingElement("file");
}
return filenameList;
}
/// write the blacklist file entries to an xml file
void writeBlackListFile()
{
QFile f(m_blackListFile);
if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
warnWidgets << "Cannot write meta information to '" << m_blackListFile << "'." << endl;
return;
}
QDomDocument doc;
QDomElement root;
QDomDocument docTemp("m_blackListFile");
doc = docTemp;
doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""));
root = doc.createElement("resourceFilesList");
doc.appendChild(root);
Q_FOREACH (QString filename, m_blackListFileNames) {
QDomElement fileEl = doc.createElement("file");
QDomElement nameEl = doc.createElement("name");
QDomText nameText = doc.createTextNode(filename.replace(QDir::homePath(),QString("~")));
nameEl.appendChild(nameText);
fileEl.appendChild(nameEl);
root.appendChild(fileEl);
}
QTextStream metastream(&f);
metastream << doc.toString();
f.close();
}
protected:
- KoResource* byMd5(const QByteArray &md5) const
+ KoResource* byMd5(const QByteArray &md5) const override
{
return Policy::toResourcePointer(resourceByMD5(md5));
}
- KoResource* byFileName(const QString &fileName) const
+ KoResource* byFileName(const QString &fileName) const override
{
return Policy::toResourcePointer(resourceByFilename(fileName));
}
private:
QHash<QString, PointerType> m_resourcesByName;
QHash<QString, PointerType> m_resourcesByFilename;
QHash<QByteArray, PointerType> m_resourcesByMd5;
QList<PointerType> m_resourceBlackList;
QList<PointerType> m_resources; ///< list of resources in order of addition
QList<ObserverType*> m_observers;
QString m_blackListFile;
QStringList m_blackListFileNames;
KoResourceTagStore* m_tagStore;
};
template <class T, class Policy = PointerStoragePolicy<T> >
class KoResourceServerSimpleConstruction : public KoResourceServer<T, Policy>
{
public:
KoResourceServerSimpleConstruction(const QString& type, const QString& extensions)
: KoResourceServer<T, Policy>(type, extensions)
{
}
-typename KoResourceServer<T, Policy>::PointerType createResource( const QString & filename ) {
+typename KoResourceServer<T, Policy>::PointerType createResource( const QString & filename ) override {
return new T(filename);
}
};
#endif // KORESOURCESERVER_H
diff --git a/libs/widgets/KoResourceServerAdapter.h b/libs/widgets/KoResourceServerAdapter.h
index 32b8a3bc4a..7e04dad842 100644
--- a/libs/widgets/KoResourceServerAdapter.h
+++ b/libs/widgets/KoResourceServerAdapter.h
@@ -1,355 +1,355 @@
/* This file is part of the KDE project
Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KO_RESOURCESERVER_ADAPTER_H_
#define KO_RESOURCESERVER_ADAPTER_H_
#include "KoResourceServer.h"
#include <resources/KoResource.h>
#include <KoResourceFiltering.h>
#include "kritawidgets_export.h"
/// The resource server adapter provides a adapter pattern for a templated resource server
class KRITAWIDGETS_EXPORT KoAbstractResourceServerAdapter : public QObject
{
Q_OBJECT
public:
KoAbstractResourceServerAdapter(QObject *parent = 0);
- virtual ~KoAbstractResourceServerAdapter();
+ ~KoAbstractResourceServerAdapter() override;
virtual void connectToResourceServer() = 0;
virtual QList<KoResource*> resources() = 0;
virtual QList<KoResource*> serverResources() = 0;
virtual bool addResource(KoResource* resource) = 0;
virtual bool removeResource(KoResource* resource) = 0;
virtual void removeResourceFile(const QString & filename) = 0;
virtual void importResourceFile(const QString & filename, bool fileCreation = true) = 0;
virtual QString extensions() const = 0;
virtual void setCurrentTag(const QString& currentTag) = 0;
virtual void enableResourceFiltering(bool tagSearch) = 0;
virtual void updateServer() = 0;
virtual QStringList assignedTagsList(KoResource* resource) = 0;
virtual QStringList tagNamesList() = 0;
virtual void addTag(const QString& tag) = 0;
virtual void addTag(KoResource* resource, const QString& tag) = 0;
virtual void deleteTag(KoResource* resource, const QString& tag) = 0;
virtual void searchTextChanged(const QString& searchString) = 0;
// these call the server.
virtual void tagCategoryMembersChanged() = 0;
virtual void tagCategoryAdded(const QString& tag) = 0;
virtual void tagCategoryRemoved(const QString& tag) = 0;
virtual void setFilterIncludes(const QStringList& filteredNames) = 0;
virtual QStringList searchTag(const QString& lineEditText) = 0;
virtual void configureFilters(int filterType, bool enable) = 0;
virtual QString serverType() const { return QString(); }
virtual void setSortingEnabled(bool value) = 0;
virtual bool sortingEnabled() const = 0;
Q_SIGNALS:
void resourceAdded(KoResource*);
void removingResource(KoResource*);
void resourceChanged(KoResource*);
void tagsWereChanged();
void tagCategoryWasAdded(const QString& tag);
void tagCategoryWasRemoved(const QString& tag);
protected:
void emitResourceAdded(KoResource* resource);
void emitRemovingResource(KoResource* resource);
void emitResourceChanged(KoResource* resource);
void emitTagsWereChanged();
void emitTagCategoryWasAdded(const QString& tag);
void emitTagCategoryWasRemoved(const QString& tag);
};
/**
* The KoResourceServerAdapter provides adapter to a specific resource server
* It provides a resource type independent interface to the server.
*/
template <class T, class Policy = PointerStoragePolicy<T> >
class KoResourceServerAdapter : public KoAbstractResourceServerAdapter, public KoResourceServerObserver<T, Policy>
{
typedef KoResourceServer<T, Policy> ServerType;
typedef typename Policy::PointerType PointerType;
public:
KoResourceServerAdapter(ServerType* resourceServer, QObject *parent = 0)
: KoAbstractResourceServerAdapter(parent)
, m_resourceServer(resourceServer)
, m_sortingEnabled(false)
{
m_changeCounter = 0;
m_oldChangeCounter = 0;
m_enableFiltering = false;
m_resourceFilter.setResourceServer(m_resourceServer);
}
- virtual ~KoResourceServerAdapter()
+ ~KoResourceServerAdapter() override
{
if (m_resourceServer)
m_resourceServer->removeObserver(this);
}
- QString serverType() const
+ QString serverType() const override
{
if (m_resourceServer) {
return m_resourceServer->type();
}
return KoAbstractResourceServerAdapter::serverType();
}
- virtual void unsetResourceServer()
+ void unsetResourceServer() override
{
m_resourceServer = 0;
}
- void connectToResourceServer()
+ void connectToResourceServer() override
{
if (m_resourceServer)
m_resourceServer->addObserver(this);
}
- virtual QList<KoResource*> resources()
+ QList<KoResource*> resources() override
{
if (! m_resourceServer)
return QList<KoResource*>();
bool cacheDirty = serverResourceCacheInvalid();
if (cacheDirty) {
QList<PointerType> serverResources =
m_sortingEnabled ?
m_resourceServer->sortedResources() :
m_resourceServer->resources();
cacheServerResources(serverResources);
}
if (m_enableFiltering) {
if (m_resourceFilter.filtersHaveChanged() || cacheDirty) {
m_filteredResources = m_resourceFilter.filterResources(m_serverResources);
}
return m_filteredResources;
}
return m_serverResources;
}
- bool addResource(KoResource* resource)
+ bool addResource(KoResource* resource) override
{
if (! m_resourceServer)
return false;
T* res = dynamic_cast<T*>(resource);
if (res) {
return m_resourceServer->addResource(res);
}
return false;
}
- bool removeResource(KoResource* resource)
+ bool removeResource(KoResource* resource) override
{
if (! m_resourceServer)
return false;
T* res = dynamic_cast<T*>(resource);
if (res) {
return m_resourceServer->removeResourceAndBlacklist(res);
}
return false;
}
- void importResourceFile(const QString & filename , bool fileCreation = true)
+ void importResourceFile(const QString & filename , bool fileCreation = true) override
{
if (! m_resourceServer)
return;
m_resourceServer->importResourceFile(filename, fileCreation);
}
- void removeResourceFile(const QString & filename)
+ void removeResourceFile(const QString & filename) override
{
if (!m_resourceServer) {
return;
}
m_resourceServer->removeResourceFile(filename);
}
- void resourceAdded(PointerType resource) {
+ void resourceAdded(PointerType resource) override {
serverResourceCacheInvalid(true);
emitResourceAdded(Policy::toResourcePointer(resource));
}
- void removingResource(PointerType resource) {
+ void removingResource(PointerType resource) override {
serverResourceCacheInvalid(true);
emitRemovingResource(Policy::toResourcePointer(resource));
}
- void resourceChanged(PointerType resource) {
+ void resourceChanged(PointerType resource) override {
serverResourceCacheInvalid(true);
emitResourceChanged(Policy::toResourcePointer(resource));
}
void resourceChangedNoCacheInvalidation(PointerType resource) {
emitResourceChanged(Policy::toResourcePointer(resource));
}
- void syncTaggedResourceView() {
+ void syncTaggedResourceView() override {
serverResourceCacheInvalid(true);
m_resourceFilter.rebuildCurrentTagFilenames();
emitTagsWereChanged();
}
- void syncTagAddition(const QString& tag) {
+ void syncTagAddition(const QString& tag) override {
emitTagCategoryWasAdded(tag);
}
- void syncTagRemoval(const QString& tag) {
+ void syncTagRemoval(const QString& tag) override {
emitTagCategoryWasRemoved(tag);
}
- QString extensions() const {
+ QString extensions() const override {
if (! m_resourceServer)
return QString();
return m_resourceServer->extensions();
}
- void setCurrentTag(const QString& resourceFileNames) {
+ void setCurrentTag(const QString& resourceFileNames) override {
serverResourceCacheInvalid(true);
m_resourceFilter.setCurrentTag(resourceFileNames);
}
- void enableResourceFiltering(bool enable) {
+ void enableResourceFiltering(bool enable) override {
m_enableFiltering = enable;
}
- void updateServer() {
+ void updateServer() override {
emitRemovingResource(0);
}
- QStringList assignedTagsList(KoResource* resource) {
+ QStringList assignedTagsList(KoResource* resource) override {
return m_resourceServer->assignedTagsList(resource);
}
- QStringList tagNamesList() {
+ QStringList tagNamesList() override {
return m_resourceServer->tagNamesList();
}
- void addTag(const QString& tag) {
+ void addTag(const QString& tag) override {
m_resourceServer->addTag(0, tag);
}
- void addTag(KoResource* resource, const QString& tag) {
+ void addTag(KoResource* resource, const QString& tag) override {
m_resourceServer->addTag(resource, tag);
}
- void deleteTag(KoResource* resource, const QString& tag) {
+ void deleteTag(KoResource* resource, const QString& tag) override {
m_resourceServer->delTag(resource, tag);
}
- void setFilterIncludes(const QStringList& filteredNames) {
+ void setFilterIncludes(const QStringList& filteredNames) override {
m_resourceFilter.setInclusions(filteredNames);
}
- void searchTextChanged(const QString& searchString) {
+ void searchTextChanged(const QString& searchString) override {
m_resourceFilter.setFilters(searchString);
serverResourceCacheInvalid(true);
}
- QStringList searchTag(const QString& lineEditText) {
+ QStringList searchTag(const QString& lineEditText) override {
return m_resourceServer->searchTag(lineEditText);
}
// called by model to notify server of change
- void tagCategoryMembersChanged() {
+ void tagCategoryMembersChanged() override {
m_resourceServer->tagCategoryMembersChanged();
}
- void tagCategoryAdded(const QString& tag) {
+ void tagCategoryAdded(const QString& tag) override {
m_resourceServer->tagCategoryAdded(tag);
}
- void tagCategoryRemoved(const QString& tag) {
+ void tagCategoryRemoved(const QString& tag) override {
m_resourceServer->tagCategoryRemoved(tag);
}
- virtual QList<KoResource*> serverResources() {
+ QList<KoResource*> serverResources() override {
return m_serverResources;
}
- void configureFilters(int filterType, bool enable){
+ void configureFilters(int filterType, bool enable) override{
m_resourceFilter.configure(filterType,enable);
}
- void setSortingEnabled(bool value) {
+ void setSortingEnabled(bool value) override {
m_sortingEnabled = value;
serverResourceCacheInvalid(true);
}
- bool sortingEnabled() const {
+ bool sortingEnabled() const override {
return m_sortingEnabled;
}
protected:
ServerType* resourceServer() const {
return m_resourceServer;
}
protected:
KoResourceFiltering m_resourceFilter;
private:
bool serverResourceCacheInvalid() const {
return m_changeCounter != m_oldChangeCounter;
}
void serverResourceCacheInvalid(bool yes) {
if (yes) {
++m_changeCounter;
} else {
m_oldChangeCounter = m_changeCounter;
}
}
void cacheServerResources(const QList<PointerType> &serverResources) {
m_serverResources.clear();
Q_FOREACH (PointerType resource, serverResources) {
m_serverResources.append(Policy::toResourcePointer(resource));
}
serverResourceCacheInvalid(false);
}
ServerType* m_resourceServer;
unsigned int m_changeCounter;
unsigned int m_oldChangeCounter;
QList<KoResource*> m_serverResources;
QList<KoResource*> m_filteredResources;
bool m_enableFiltering;
bool m_sortingEnabled;
};
#endif // KO_RESOURCESERVER_ADAPTER_H_
diff --git a/libs/widgets/KoResourceServerProvider.h b/libs/widgets/KoResourceServerProvider.h
index 2078df6b08..54630b8b08 100644
--- a/libs/widgets/KoResourceServerProvider.h
+++ b/libs/widgets/KoResourceServerProvider.h
@@ -1,97 +1,97 @@
/* This file is part of the KDE project
Copyright (c) 1999 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
Copyright (c) 2005 Sven Langkamp <sven.langkamp@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KORESOURCESERVERPROVIDER_H
#define KORESOURCESERVERPROVIDER_H
#include <kritawidgets_export.h>
#include <QThread>
#include <WidgetsDebug.h>
#include "KoResourceServer.h"
#include <resources/KoPattern.h>
#include <resources/KoAbstractGradient.h>
#include <resources/KoColorSet.h>
/**
* KoResourceLoaderThread allows threaded loading of the resources of a resource server
*/
class KRITAWIDGETS_EXPORT KoResourceLoaderThread : public QThread {
Q_OBJECT
public:
/**
* Constructs a KoResourceLoaderThread for a server
* @param server the server the resources will be loaded for
*/
explicit KoResourceLoaderThread(KoResourceServerBase *server);
- ~KoResourceLoaderThread();
+ ~KoResourceLoaderThread() override;
void loadSynchronously();
public Q_SLOTS:
/**
* Checks whether the thread has finished loading and waits
* until it is finished if necessary
*/
void barrier();
protected:
/**
* Overridden from QThread
*/
- void run();
+ void run() override;
private:
KoResourceServerBase * m_server;
QStringList m_fileNames;
};
/**
* Provides default resource servers for gradients, patterns and palettes
*/
class KRITAWIDGETS_EXPORT KoResourceServerProvider : public QObject
{
Q_OBJECT
public:
KoResourceServerProvider();
- virtual ~KoResourceServerProvider();
+ ~KoResourceServerProvider() override;
static KoResourceServerProvider* instance();
KoResourceServer<KoPattern>* patternServer(bool block = true);
KoResourceServer<KoAbstractGradient>* gradientServer(bool block = true);
KoResourceServer<KoColorSet>* paletteServer(bool block = true);
private:
KoResourceServerProvider(const KoResourceServerProvider&);
KoResourceServerProvider operator=(const KoResourceServerProvider&);
private:
struct Private;
Private* const d;
};
#endif // KORESOURCESERVERPROVIDER_H
diff --git a/libs/widgets/KoResourceTaggingManager.h b/libs/widgets/KoResourceTaggingManager.h
index 8d1f62620d..e9c2bf4fcd 100644
--- a/libs/widgets/KoResourceTaggingManager.h
+++ b/libs/widgets/KoResourceTaggingManager.h
@@ -1,93 +1,93 @@
/*
* This file is part of the KDE project
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
* Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORESOURCETAGGINGMANAGER_H
#define KORESOURCETAGGINGMANAGER_H
#include <QObject>
class QWidget;
class QStringList;
class QString;
class QPoint;
class KoTagFilterWidget;
class KoTagChooserWidget;
class KoResourceModel;
class KoResource;
/**
* @brief The KoResourceTaggingManager class is ...
*
* XXX: this needs to be documented!
*/
class KoResourceTaggingManager : public QObject
{
Q_OBJECT
public:
explicit KoResourceTaggingManager(KoResourceModel* model, QWidget* parent);
- ~KoResourceTaggingManager();
+ ~KoResourceTaggingManager() override;
void showTaggingBar(bool show);
QStringList availableTags() const;
void contextMenuRequested(KoResource* currentResource, QPoint pos);
void allowTagModification( bool set );
bool allowTagModification();
KoTagFilterWidget* tagFilterWidget();
KoTagChooserWidget* tagChooserWidget();
Q_SIGNALS:
void updateView();
private Q_SLOTS:
void undeleteTag(const QString& tagToUndelete);
void purgeTagUndeleteList();
void contextCreateNewTag(KoResource* resource, const QString& tag);
void contextCreateNewTag(const QString& tag);
void syncTagBoxEntryRemoval(const QString& tag);
void syncTagBoxEntryAddition(const QString& tag);
void syncTagBoxEntries();
void tagSaveButtonPressed();
void contextRemoveTagFromResource(KoResource* resource, const QString& tag);
void contextAddTagToResource(KoResource* resource, const QString& tag);
void renameTag(const QString &oldName, const QString &newName);
void tagChooserIndexChanged(const QString& lineEditText);
void tagSearchLineEditTextChanged(const QString& lineEditText);
void removeTagFromComboBox(const QString& tag);
private:
void contextMenuRequested(KoResource* resource, const QStringList& resourceTags, const QPoint& pos);
void enableContextMenu(bool enable);
void removeResourceTag(KoResource* resource, const QString& tagName);
void addResourceTag(KoResource* resource, const QString& tagName);
void updateTaggedResourceView();
class Private;
Private* const d;
};
#endif // KORESOURCETAGGINGINTERFACE_H
diff --git a/libs/widgets/KoRuler.h b/libs/widgets/KoRuler.h
index 35e311e640..bc7a3f5a4a 100644
--- a/libs/widgets/KoRuler.h
+++ b/libs/widgets/KoRuler.h
@@ -1,283 +1,283 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
Copyright (C) 2006 Peter Simonsson <peter.simonsson@gmail.com>
Copyright (C) 2007 C. Boemann <cbo@boemann.dk>
Copyright (C) 2007 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef koRuler_h
#define koRuler_h
#include "kritawidgets_export.h"
#include <QWidget>
#include <QTextOption>
class QPaintEvent;
class KoViewConverter;
class KoCanvasBase;
class KoRulerPrivate;
class KoUnit;
/**
* Decorator widget to draw a single ruler around a canvas.
*/
class KRITAWIDGETS_EXPORT KoRuler : public QWidget
{
Q_OBJECT
public:
/**
* Creates a ruler with the orientation @p orientation
* @param parent parent widget
* @param orientation the orientation of the ruler
* @param viewConverter the view converter used to convert from point to pixel
*/
KoRuler(QWidget* parent, Qt::Orientation orientation, const KoViewConverter* viewConverter);
- ~KoRuler();
+ ~KoRuler() override;
/// For paragraphs each tab definition is represented by this struct.
struct Tab {
qreal position; ///< distance in point from the start of the text-shape
QTextOption::TabType type; ///< Determine which type is used.
};
/// The ruler's unit
KoUnit unit() const;
/// The length of the ruler in points (pt)
qreal rulerLength() const;
/// The orientation of the ruler
Qt::Orientation orientation() const;
/// The start indent of the first line
qreal firstLineIndent() const;
/// The start indent of the rest of the lines
qreal paragraphIndent() const;
/// The end indent of all lines
qreal endIndent() const;
/// The tab chooser widget, which you must put into a layout along with the ruler.
/// Returns 0 for vertical rulers,
QWidget *tabChooser();
/**
* set a list of actions that will be shown in a popup should the user right click on this ruler.
* @param popupActionList the list of actions
* @see popupActionList()
*/
void setPopupActionList(const QList<QAction*> &popupActionList);
/**
* Return the actions list.
* @see setPopupActionList()
*/
QList<QAction*> popupActionList() const;
/// reimplemented
- virtual QSize minimumSizeHint() const;
+ QSize minimumSizeHint() const override;
/// reimplemented
- virtual QSize sizeHint() const;
+ QSize sizeHint() const override;
public Q_SLOTS:
/// Set the unit of the ruler
void setUnit(const KoUnit &unit);
/** Set the offset. Use this function to sync the ruler with
* the canvas' position on screen
* @param offset The offset in pixels
*/
void setOffset(int offset);
/// Sets the length of the ruler to @p length in points (pt)
void setRulerLength(qreal length);
/** Set the active range, ie the part of the ruler that is most likely used.
* set to 0, 0 when there is no longer any active range
* @param start the start of the range in pt
* @param end the end of the range in pt
*/
void setActiveRange(qreal start, qreal end);
/** Set the override active range, ie the part of the ruler that is most likely used.
* set to 0, 0 when there is no longer any active range
* The override, means that if set it takes precedence over the normal active range.
* @param start the start of the range in pt
* @param end the end of the range in pt
*/
void setOverrideActiveRange(qreal start, qreal end);
/** Set the state of the ruler so that it shows everything in right to left mode.
* @param isRightToLeft state of right to left mode. Default is false.
*/
void setRightToLeft(bool isRightToLeft);
/** Set if the ruler should show indents as used in textditors.
* Set the indents with setFirstLineIndent(), setParagraphIndent(), setEndIndent() .
* @param show show indents if true. Default is false.
*/
void setShowIndents(bool show);
/** Set the position of the first line start indent relative to the active range.
* If Right To left is set the indent is relative to the right side of the active range .
* @param indent the value relative to the active range.
*/
void setFirstLineIndent(qreal indent);
/** Set the position of the rest of the lines start indent relative to the active range.
* If Right To left is set the indent is relative to the right side of the active range .
* @param indent the value relative to the active range.
*/
void setParagraphIndent(qreal indent);
/** Set the position of the end indent relative to the active range.
* If Right To left is set the indent is relative to the left side of the active range .
* @param indent the value relative to the active range.
*/
void setEndIndent(qreal indent);
/** Set whether the ruler should show the current mouse position.
* Update the position with updateMouseCoordinate().
* @param show show mouse position if true. Default is false.
*/
void setShowMousePosition(bool show);
/**
* \see setShowMousePosition
*/
bool showMousePosition() const;
/** Update the current position of the mouse pointer, repainting if changed.
* The ruler offset will be applied before painting.
* @param coordinate Either the x or y coordinate of the mouse depending
* of the orientation of the ruler.
*/
void updateMouseCoordinate(int coordinate);
/**
* Set whether the ruler should show the selection borders
* @param show show selection borders if true, default is false.
*/
void setShowSelectionBorders(bool show);
/**
* Update the selection borders
* @param first the first selection border in points
* @param second the other selection border in points
*/
void updateSelectionBorders(qreal first, qreal second);
/**
* Set whether the ruler should show tabs
* @param show show selection borders if true, default is false.
*/
void setShowTabs(bool show);
/**
* Set whether the tabs is relative to the paragraph indent
* @param relative tabs are relative to pragraph indent if true, default is false.
*/
void setRelativeTabs(bool relative);
/**
* Update the tabs
* @param tabs a list of tabs that is shown on the ruler
* @param tabDistance the distncte between regular interval tabs
*/
void updateTabs(const QList<Tab> &tabs, qreal tabDistance);
/***
* Return the list of tabs set on this ruler.
*/
QList<Tab> tabs() const;
/**
* Clear all previously set hotspots.
* A hotspot is a position on the ruler that the user can manipulate by dragging.
*/
void clearHotSpots();
/**
* Add or set a hotspot.
* A hotspot is a position on the ruler that the user can manipulate by dragging.
* @param position the new position of the hotspot.
* @param id the unique id for the hotspot. If the id has not been set before, it will be added.
*/
void setHotSpot(qreal position, int id = -1);
/**
* Remove a previously set hotspot, returning true if one is actually returned.
* @param id the unique id for the hotspot.
* A hotspot is a position on the ruler that the user can manipulate by dragging.
*/
bool removeHotSpot(int id);
/**
* Connect the ruler to a guides tool
* This allows the user to drag a guide out of the ruler and get in one smooth operation
* the guide tool to draw and position the guide line.
* @param canvas the canvas that has had the KoToolManager create the tool for previously.
*/
void createGuideToolConnection(KoCanvasBase *canvas);
Q_SIGNALS:
/**
* emitted when any of the indents is moved by the user.
* @param final false until the user releases the mouse. So you can implement live update.
*/
void indentsChanged(bool final);
/**
* Emitted when any of the tabs are moved, deleted or inserted by the user.
* @param originalTabIndex the index in the list of tabs before the user interaction
* started, or -1 if this is a new tab
* @param tab the new tab, or zero when the tab has been removed.
*/
void tabChanged(int originalTabIndex, KoRuler::Tab *tab);
/// emitted when there the user is about to change a tab or hotspot
void aboutToChange();
void hotSpotChanged(int id, qreal newPosition);
/// emitted when the mouse is drag+released outside the ruler
void guideLineCreated(Qt::Orientation orientation, qreal viewPosition);
void guideCreationInProgress(Qt::Orientation orientation, const QPoint &globalPos);
void guideCreationFinished(Qt::Orientation orientation, const QPoint &globalPos);
protected:
/// reimplemented
- virtual void paintEvent(QPaintEvent* event);
+ void paintEvent(QPaintEvent* event) override;
/// reimplemented
- virtual void mousePressEvent(QMouseEvent *ev);
+ void mousePressEvent(QMouseEvent *ev) override;
/// reimplemented
- virtual void mouseReleaseEvent(QMouseEvent *ev);
+ void mouseReleaseEvent(QMouseEvent *ev) override;
/// reimplemented
- virtual void mouseMoveEvent(QMouseEvent *ev);
+ void mouseMoveEvent(QMouseEvent *ev) override;
private:
KoRulerPrivate * const d;
friend class KoRulerPrivate;
};
#endif
diff --git a/libs/widgets/KoRulerController.h b/libs/widgets/KoRulerController.h
index dba703a31d..65191c4f04 100644
--- a/libs/widgets/KoRulerController.h
+++ b/libs/widgets/KoRulerController.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORULERCONTROLLER_H
#define KORULERCONTROLLER_H
#include <QObject>
#include "kritawidgets_export.h"
class KoRuler;
class KoCanvasResourceManager;
/**
* This class combines text options with the KoRuler object.
* Any usage of a horizontal ruler should consider using this class to show the
* text indent and tabs on the ruler, and allow to edit them.
* The code to do this is pretty trivial; just instantiate this class and you can
* forget about it. It'll do what you want.
*/
class KRITAWIDGETS_EXPORT KoRulerController : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
* @param horizontalRuler the ruler to monitor and update.
* Will also be used as QObject parent for memory management purposes.
* @param crp the resource provider for the canvas this ruler and the text tool belong to.
*/
KoRulerController(KoRuler *horizontalRuler, KoCanvasResourceManager *crp);
- ~KoRulerController();
+ ~KoRulerController() override;
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void canvasResourceChanged(int))
Q_PRIVATE_SLOT(d, void indentsChanged())
Q_PRIVATE_SLOT(d, void tabChanged(int, KoRuler::Tab *tab))
Q_PRIVATE_SLOT(d, void tabChangeInitiated())
};
#endif
diff --git a/libs/widgets/KoRuler_p.h b/libs/widgets/KoRuler_p.h
index 1ba8f84cd6..da2f3f3db6 100644
--- a/libs/widgets/KoRuler_p.h
+++ b/libs/widgets/KoRuler_p.h
@@ -1,210 +1,210 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORULER_P_H
#define KORULER_P_H
#include <KoUnit.h>
class RulerTabChooser : public QWidget
{
public:
RulerTabChooser(QWidget *parent) : QWidget(parent), m_type(QTextOption::LeftTab), m_showTabs(false) {}
- virtual ~RulerTabChooser() {}
+ ~RulerTabChooser() override {}
inline QTextOption::TabType type() {return m_type;}
void setShowTabs(bool showTabs) { if (m_showTabs == showTabs) return; m_showTabs = showTabs; update(); }
- void mousePressEvent(QMouseEvent *);
+ void mousePressEvent(QMouseEvent *) override;
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
private:
QTextOption::TabType m_type;
bool m_showTabs :1;
};
class PaintingStrategy
{
public:
/// constructor
PaintingStrategy() {}
/// destructor
virtual ~PaintingStrategy() {}
/**
* Draw the background of the ruler.
* @param ruler the ruler to draw on.
* @param painter the painter we can paint with.
*/
virtual QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter) = 0;
/**
* Draw the indicators for text-tabs.
* @param ruler the ruler to draw on.
* @param painter the painter we can paint with.
*/
virtual void drawTabs(const KoRulerPrivate *ruler, QPainter &painter) = 0;
/**
* Draw the indicators for the measurements which typically are drawn every [unit].
* @param ruler the ruler to draw on.
* @param painter the painter we can paint with.
* @param rectangle
*/
virtual void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle) = 0;
/**
* Draw the indicators for the indents of a text paragraph
* @param ruler the ruler to draw on.
* @param painter the painter we can paint with.
*/
virtual void drawIndents(const KoRulerPrivate *ruler, QPainter &painter) = 0;
/**
*returns the size suggestion for a ruler with this strategy.
*/
virtual QSize sizeHint() = 0;
};
class HorizontalPaintingStrategy : public PaintingStrategy
{
public:
HorizontalPaintingStrategy() : lengthInPixel(1) {}
- virtual QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter);
- virtual void drawTabs(const KoRulerPrivate *ruler, QPainter &painter);
- virtual void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle);
- virtual void drawIndents(const KoRulerPrivate *ruler, QPainter &painter);
- virtual QSize sizeHint();
+ QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter) override;
+ void drawTabs(const KoRulerPrivate *ruler, QPainter &painter) override;
+ void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle) override;
+ void drawIndents(const KoRulerPrivate *ruler, QPainter &painter) override;
+ QSize sizeHint() override;
private:
qreal lengthInPixel;
};
class VerticalPaintingStrategy : public PaintingStrategy
{
public:
VerticalPaintingStrategy() : lengthInPixel(1) {}
- virtual QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter);
- virtual void drawTabs(const KoRulerPrivate *, QPainter &) {}
- virtual void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle);
- virtual void drawIndents(const KoRulerPrivate *, QPainter &) { }
- virtual QSize sizeHint();
+ QRectF drawBackground(const KoRulerPrivate *ruler, QPainter &painter) override;
+ void drawTabs(const KoRulerPrivate *, QPainter &) override {}
+ void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle) override;
+ void drawIndents(const KoRulerPrivate *, QPainter &) override { }
+ QSize sizeHint() override;
private:
qreal lengthInPixel;
};
class HorizontalDistancesPaintingStrategy : public HorizontalPaintingStrategy
{
public:
HorizontalDistancesPaintingStrategy() {}
- virtual void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle);
+ void drawMeasurements(const KoRulerPrivate *ruler, QPainter &painter, const QRectF &rectangle) override;
private:
void drawDistanceLine(const KoRulerPrivate *d, QPainter &painter, const qreal start, const qreal end);
};
class KoRulerPrivate
{
public:
KoRulerPrivate(KoRuler *parent, const KoViewConverter *vc, Qt::Orientation orientation);
~KoRulerPrivate();
void emitTabChanged();
KoUnit unit;
const Qt::Orientation orientation;
const KoViewConverter * const viewConverter;
int offset;
qreal rulerLength;
qreal activeRangeStart;
qreal activeRangeEnd;
qreal activeOverrideRangeStart;
qreal activeOverrideRangeEnd;
int mouseCoordinate;
int showMousePosition;
bool showSelectionBorders;
qreal firstSelectionBorder;
qreal secondSelectionBorder;
bool showIndents;
qreal firstLineIndent;
qreal paragraphIndent;
qreal endIndent;
bool showTabs;
bool relativeTabs;
bool tabMoved; // set to true on first move of a selected tab
QList<KoRuler::Tab> tabs;
int originalIndex; //index of selected tab before we started dragging it.
int currentIndex; //index of selected tab or selected HotSpot - only valid when selected indicates tab or hotspot
KoRuler::Tab deletedTab;
qreal tabDistance;
struct HotSpotData {
qreal position;
int id;
};
QList<HotSpotData> hotspots;
bool rightToLeft;
enum Selection {
None,
Tab,
FirstLineIndent,
ParagraphIndent,
EndIndent,
HotSpot
};
Selection selected;
int selectOffset;
QList<QAction*> popupActions;
RulerTabChooser *tabChooser;
// Cached painting strategies
PaintingStrategy * normalPaintingStrategy;
PaintingStrategy * distancesPaintingStrategy;
// Current painting strategy
PaintingStrategy * paintingStrategy;
KoRuler *ruler;
bool guideCreationStarted;
qreal numberStepForUnit() const;
/// @return The rounding of value to the nearest multiple of stepValue
qreal doSnapping(const qreal value) const;
Selection selectionAtPosition(const QPoint & pos, int *selectOffset = 0);
int hotSpotIndex(const QPoint & pos);
qreal effectiveActiveRangeStart() const;
qreal effectiveActiveRangeEnd() const;
friend class VerticalPaintingStrategy;
friend class HorizontalPaintingStrategy;
};
#endif
diff --git a/libs/widgets/KoShadowConfigWidget.h b/libs/widgets/KoShadowConfigWidget.h
index 3786268ecf..a52588be4a 100644
--- a/libs/widgets/KoShadowConfigWidget.h
+++ b/libs/widgets/KoShadowConfigWidget.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE project
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHADOWCONFIGWIDGET_H
#define KOSHADOWCONFIGWIDGET_H
#include "kritawidgets_export.h"
#include <QWidget>
class KoUnit;
class KoCanvasBase;
class KisSpinBoxUnitManager;
/// A widget for configuring the shadow of a shape
class KRITAWIDGETS_EXPORT KoShadowConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit KoShadowConfigWidget(QWidget *parent);
- ~KoShadowConfigWidget();
+ ~KoShadowConfigWidget() override;
/// Sets the shadow color
void setShadowColor(const QColor &color);
/// Returns the shadow color
QColor shadowColor() const;
/// Sets the shadow offset
void setShadowOffset(const QPointF &offset);
/// Returns the shadow offset
QPointF shadowOffset() const;
/// Sets the shadow blur radius
void setShadowBlur(const qreal &blur);
/// Returns the shadow blur radius
qreal shadowBlur() const;
/// Sets if the shadow is visible
void setShadowVisible(bool visible);
/// Returns if shadow is visible
bool shadowVisible() const;
public Q_SLOTS:
void setUnitManagers(KisSpinBoxUnitManager* managerBlur, KisSpinBoxUnitManager* managerOffset);
void setUnit( const KoUnit &unit );
void setCanvas(KoCanvasBase *canvas);
private Q_SLOTS:
void visibilityChanged();
void applyChanges();
void selectionChanged();
void resourceChanged( int key, const QVariant & res );
private:
class Private;
Private *const d;
};
#endif // KOSHADOWCONFIGWIDGET_H
diff --git a/libs/widgets/KoSliderCombo.h b/libs/widgets/KoSliderCombo.h
index 2bff72fd7b..9111bbf792 100644
--- a/libs/widgets/KoSliderCombo.h
+++ b/libs/widgets/KoSliderCombo.h
@@ -1,141 +1,141 @@
/* This file is part of the KDE project
Copyright (c) 2007 C. Boemann <cbo@boemann.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSLIDERCOMBO_H_
#define KOSLIDERCOMBO_H_
#include <QComboBox>
#include "kritawidgets_export.h"
/**
* @short A widget for qreal values with a popup slider
*
* KoSliderCombo combines a numerical input and a dropdown slider in a way that takes up as
* little screen space as possible.
*
* It allows the user to either enter a floating point value or quickly set the value using a slider
*
* One signal is emitted when the value changes. The signal is even emitted when the slider
* is moving. The second argument of the signal however tells you if the value is final or not. A
* final value is produced by entering a value numerically or by releasing the slider.
*
* The input of the numerical line edit is constrained to numbers and decimal signs.
*/
class KRITAWIDGETS_EXPORT KoSliderCombo : public QComboBox
{
Q_OBJECT
public:
/**
* Constructor for the widget, where value is set to 0
*
* @param parent parent QWidget
*/
explicit KoSliderCombo(QWidget *parent=0);
/**
* Destructor
*/
- virtual ~KoSliderCombo();
+ ~KoSliderCombo() override;
/**
* The precision of values given as the number of digits after the period.
* default is 2
*/
qreal decimals() const;
/**
* The minimum value that can be entered.
* default is 0
*/
qreal minimum() const;
/**
* The maximum value that can be entered.
* default is 100
*/
qreal maximum() const;
/**
* Sets the precision of the entered values.
* @param number the number of digits after the period
*/
void setDecimals(int number);
/**
* Sets the minimum value that can be entered.
* @param min the minimum value
*/
void setMinimum(qreal min);
/**
* Sets the maximum value that can be entered.
* @param max the maximum value
*/
void setMaximum(qreal max);
/**
* The value shown.
*/
qreal value() const;
- virtual QSize minimumSizeHint() const; ///< reimplemented from QComboBox
- virtual QSize sizeHint() const; ///< reimplemented from QComboBox
+ QSize minimumSizeHint() const override; ///< reimplemented from QComboBox
+ QSize sizeHint() const override; ///< reimplemented from QComboBox
public Q_SLOTS:
/**
* Sets the value.
* The value actually set is forced to be within the legal range: minimum <= value <= maximum
* @param value the new value
*/
void setValue(qreal value);
Q_SIGNALS:
/**
* Emitted every time the value changes (by calling setValue() or
* by user interaction).
* @param value the new value
* @param final if the value is final ie not produced during sliding (on slider release it's final)
*/
void valueChanged(qreal value, bool final);
protected:
- virtual void paintEvent(QPaintEvent *); ///< reimplemented from QComboBox
- virtual void hideEvent(QHideEvent *); ///< reimplemented from QComboBox
- virtual void changeEvent(QEvent *e); ///< reimplemented from QComboBox
- virtual void mousePressEvent(QMouseEvent *e); ///< reimplemented from QComboBox
- virtual void keyPressEvent(QKeyEvent *e); ///< reimplemented from QComboBox
- virtual void wheelEvent(QWheelEvent *e); ///< reimplemented from QComboBox
+ void paintEvent(QPaintEvent *) override; ///< reimplemented from QComboBox
+ void hideEvent(QHideEvent *) override; ///< reimplemented from QComboBox
+ void changeEvent(QEvent *e) override; ///< reimplemented from QComboBox
+ void mousePressEvent(QMouseEvent *e) override; ///< reimplemented from QComboBox
+ void keyPressEvent(QKeyEvent *e) override; ///< reimplemented from QComboBox
+ void wheelEvent(QWheelEvent *e) override; ///< reimplemented from QComboBox
private:
Q_PRIVATE_SLOT(d, void sliderValueChanged(int value))
Q_PRIVATE_SLOT(d, void sliderReleased())
Q_PRIVATE_SLOT(d, void lineEditFinished())
class KoSliderComboPrivate;
KoSliderComboPrivate * const d;
};
#endif
diff --git a/libs/widgets/KoSliderCombo_p.h b/libs/widgets/KoSliderCombo_p.h
index 93e010cb46..ffc150b69d 100644
--- a/libs/widgets/KoSliderCombo_p.h
+++ b/libs/widgets/KoSliderCombo_p.h
@@ -1,89 +1,89 @@
/* This file is part of the KDE project
Copyright (c) 2007 C. Boemann <cbo@boemann.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KoSliderCombo_p_h
#define KoSliderCombo_p_h
#include "KoSliderCombo.h"
#include <QTimer>
#include <QApplication>
#include <QSize>
#include <QSlider>
#include <QStyle>
#include <QStylePainter>
#include <QStyleOptionSlider>
#include <QLineEdit>
#include <QValidator>
#include <QHBoxLayout>
#include <QFrame>
#include <QMenu>
#include <QMouseEvent>
#include <QDoubleSpinBox>
#include <QDesktopWidget>
#include <klocalizedstring.h>
#include <WidgetsDebug.h>
class KoSliderComboContainer : public QMenu
{
public:
KoSliderComboContainer(KoSliderCombo *parent) : QMenu(parent ), m_parent(parent) {}
protected:
- virtual void mousePressEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e) override;
private:
KoSliderCombo *m_parent;
};
void KoSliderComboContainer::mousePressEvent(QMouseEvent *e)
{
QStyleOptionComboBox opt;
opt.init(m_parent);
opt.subControls = QStyle::SC_All;
opt.activeSubControls = QStyle::SC_ComboBoxArrow;
QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt,
m_parent->mapFromGlobal(e->globalPos()),
m_parent);
if (sc == QStyle::SC_ComboBoxArrow)
setAttribute(Qt::WA_NoMouseReplay);
QMenu::mousePressEvent(e);
}
class Q_DECL_HIDDEN KoSliderCombo::KoSliderComboPrivate {
public:
KoSliderCombo *thePublic;
QValidator *m_validator;
QTimer m_timer;
KoSliderComboContainer *container;
QSlider *slider;
QStyle::StateFlag arrowState;
qreal minimum;
qreal maximum;
int decimals;
bool firstShowOfSlider;
void showPopup();
void hidePopup();
void sliderValueChanged(int value);
void sliderReleased();
void lineEditFinished();
};
#endif
diff --git a/libs/widgets/KoTableView.h b/libs/widgets/KoTableView.h
index 548045f4cd..4c430494f5 100644
--- a/libs/widgets/KoTableView.h
+++ b/libs/widgets/KoTableView.h
@@ -1,64 +1,64 @@
/*
* Copyright (C) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTABLEVIEW_H
#define KOTABLEVIEW_H
#include <QTableView>
#include "kritawidgets_export.h"
class QEvent;
class QModelIndex;
/**
* @brief The KoTableView class provides a QTableView with fixed columns or rows
*/
class KRITAWIDGETS_EXPORT KoTableView: public QTableView
{
Q_OBJECT
public:
enum ViewMode {
FIXED_COLUMNS, /// The number of columns is fixed
FIXED_ROWS /// The number of rows is fixed
};
explicit KoTableView(QWidget *parent = 0);
- virtual ~KoTableView() {}
+ ~KoTableView() override {}
/** reimplemented
* This will draw a number of rows based on the number of columns if m_viewMode is FIXED_COLUMS
* And it will draw a number of columns based on the number of rows if m_viewMode is FIXED_ROWS
*/
- virtual void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
void setViewMode(ViewMode mode);
void updateView();
Q_SIGNALS:
void sigSizeChanged();
private:
ViewMode m_viewMode;
};
#endif // KOTABLEVIEW_H
diff --git a/libs/widgets/KoTagChooserWidget.h b/libs/widgets/KoTagChooserWidget.h
index f5f704fc18..6ad64c9bb8 100644
--- a/libs/widgets/KoTagChooserWidget.h
+++ b/libs/widgets/KoTagChooserWidget.h
@@ -1,75 +1,75 @@
/*
* This file is part of the KDE project
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
* Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTAGCHOOSERWIDGET_H
#define KOTAGCHOOSERWIDGET_H
#include <QWidget>
#include "kritawidgets_export.h"
class KRITAWIDGETS_EXPORT KoTagChooserWidget : public QWidget
{
Q_OBJECT
public:
explicit KoTagChooserWidget(QWidget* parent);
- virtual ~KoTagChooserWidget();
+ ~KoTagChooserWidget() override;
void setCurrentIndex(int index);
int findIndexOf(QString tagName);
void insertItem(QString tagName);
void insertItemAt(int index, QString tag);
QString currentlySelectedTag();
QStringList allTags();
bool selectedTagIsReadOnly();
void removeItem(QString item);
void addItems(QStringList tagNames);
void addReadOnlyItem(QString tagName);
void clear();
void setUndeletionCandidate(const QString &tag);
void showTagToolButton(bool show);
Q_SIGNALS:
void newTagRequested(const QString &tagname);
void tagDeletionRequested(const QString &tagname);
void tagRenamingRequested(const QString &oldTagname, const QString &newTagname);
void tagUndeletionRequested(const QString &tagname);
void tagUndeletionListPurgeRequested();
void popupMenuAboutToShow();
void tagChosen(const QString &tag);
private Q_SLOTS:
void tagRenamingRequested(const QString &newName);
void tagOptionsContextMenuAboutToShow();
void contextDeleteCurrentTag();
private:
/// pimpl because chooser will most likely get upgraded at some point
class Private;
Private* const d;
};
;
#endif // KOTAGCHOOSERWIDGET_H
diff --git a/libs/widgets/KoTagFilterWidget.h b/libs/widgets/KoTagFilterWidget.h
index eaf5dbfc2b..d161d8f877 100644
--- a/libs/widgets/KoTagFilterWidget.h
+++ b/libs/widgets/KoTagFilterWidget.h
@@ -1,51 +1,51 @@
/*
* This file is part of the KDE project
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
* Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTAGFILTERWIDGET_H
#define KOTAGFILTERWIDGET_H
#include <QWidget>
class KoTagFilterWidget : public QWidget
{
Q_OBJECT
public:
explicit KoTagFilterWidget(QWidget* parent);
- virtual ~KoTagFilterWidget();
+ ~KoTagFilterWidget() override;
void allowSave(bool allow);
void clear();
Q_SIGNALS:
void filterTextChanged(const QString &filterText);
void saveButtonClicked();
private Q_SLOTS:
void onTextChanged(const QString &lineEditText);
void onSaveButtonClicked();
private:
class Private;
Private* const d;
};
#endif // KOTAGFILTERWIDGET_H
diff --git a/libs/widgets/KoTagToolButton.h b/libs/widgets/KoTagToolButton.h
index c93bbb2b74..3dcc903f5b 100644
--- a/libs/widgets/KoTagToolButton.h
+++ b/libs/widgets/KoTagToolButton.h
@@ -1,58 +1,58 @@
/*
* This file is part of the KDE project
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (C) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
* Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
* Copyright (c) 2013 Sascha Suelzer <s.suelzer@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTAGTOOLBUTTON_H
#define KOTAGTOOLBUTTON_H
#include <QWidget>
class KoTagToolButton : public QWidget
{
Q_OBJECT
private:
explicit KoTagToolButton(QWidget* parent = 0);
- virtual ~KoTagToolButton();
+ ~KoTagToolButton() override;
void readOnlyMode(bool activate);
void setUndeletionCandidate(const QString &deletedTagName);
Q_SIGNALS:
void newTagRequested(const QString &tagname);
void renamingOfCurrentTagRequested(const QString &tagname);
void deletionOfCurrentTagRequested();
void undeletionOfTagRequested(const QString &tagname);
void purgingOfTagUndeleteListRequested();
void popupMenuAboutToShow();
private Q_SLOTS:
void onTagUndeleteClicked();
private:
class Private;
Private* const d;
friend class KoTagChooserWidget;
};
#endif // KOTAGTOOLBUTTON_H
diff --git a/libs/widgets/KoToolBoxDocker_p.h b/libs/widgets/KoToolBoxDocker_p.h
index d61caa5a37..a302cda128 100644
--- a/libs/widgets/KoToolBoxDocker_p.h
+++ b/libs/widgets/KoToolBoxDocker_p.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2005-2008 Thomas Zander <zander@kde.org>
* Copyright (c) 2009 Peter Simonsson <peter.simonsson@gmail.com>
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_TOOLBOX_DOCKER_H_
#define _KO_TOOLBOX_DOCKER_H_
#include <KoCanvasObserverBase.h>
#include <QDockWidget>
class KoCanvasBase;
class KoToolBox;
class KoToolBoxDocker : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
explicit KoToolBoxDocker(KoToolBox *toolBox);
/// reimplemented from KoCanvasObserverBase
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
- virtual QString observerName() { return "KoToolBoxDocker"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ QString observerName() override { return "KoToolBoxDocker"; }
protected Q_SLOTS:
void updateToolBoxOrientation(Qt::DockWidgetArea area);
void updateFloating(bool);
private:
KoToolBox *m_toolBox;
};
#endif // _KO_TOOLBOX_DOCKER_H_
diff --git a/libs/widgets/KoToolBoxFactory.h b/libs/widgets/KoToolBoxFactory.h
index 15beb77027..17c5c20f22 100644
--- a/libs/widgets/KoToolBoxFactory.h
+++ b/libs/widgets/KoToolBoxFactory.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2006 Peter Simonsson <peter.simonsson@gmail.com>
* Copyright (c) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTOOLBOXFACTORY_H
#define KOTOOLBOXFACTORY_H
#include <KoDockFactoryBase.h>
#include "kritawidgets_export.h"
#include <QString>
#include <QDockWidget>
/**
* Factory class to create a new KoToolBox that contains the buttons
* to activate tools.
*/
class KRITAWIDGETS_EXPORT KoToolBoxFactory : public KoDockFactoryBase
{
public:
explicit KoToolBoxFactory();
- ~KoToolBoxFactory();
+ ~KoToolBoxFactory() override;
- virtual QString id() const;
- KoDockFactoryBase::DockPosition defaultDockPosition() const;
- QDockWidget* createDockWidget();
- virtual bool isCollapsable() const { return false; }
+ QString id() const override;
+ KoDockFactoryBase::DockPosition defaultDockPosition() const override;
+ QDockWidget* createDockWidget() override;
+ bool isCollapsable() const override { return false; }
};
#endif
diff --git a/libs/widgets/KoToolBoxLayout_p.h b/libs/widgets/KoToolBoxLayout_p.h
index be5dab736f..bb8740e088 100644
--- a/libs/widgets/KoToolBoxLayout_p.h
+++ b/libs/widgets/KoToolBoxLayout_p.h
@@ -1,404 +1,404 @@
/*
* Copyright (c) 2005-2009 Thomas Zander <zander@kde.org>
* Copyright (c) 2009 Peter Simonsson <peter.simonsson@gmail.com>
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_TOOLBOX_LAYOUT_H_
#define _KO_TOOLBOX_LAYOUT_H_
#include <WidgetsDebug.h>
#include <QLayout>
#include <QMap>
#include <QRect>
#include <QAbstractButton>
#include <QDesktopWidget>
#include <QApplication>
#include <QMouseEvent>
class SectionLayout : public QLayout
{
public:
explicit SectionLayout(QWidget *parent)
: QLayout(parent), m_orientation(Qt::Vertical)
{
}
- ~SectionLayout()
+ ~SectionLayout() override
{
qDeleteAll( m_items );
m_items.clear();
}
void addButton(QAbstractButton *button, int priority)
{
addChildWidget(button);
if (m_priorities.values().contains(priority)) {
qWarning() << "Button" << button << "has a conflicting priority";
}
m_priorities.insert(button, priority);
int index = 1;
Q_FOREACH (QWidgetItem *item, m_items) {
if (m_priorities.value(static_cast<QAbstractButton*>(item->widget())) > priority)
break;
index++;
}
m_items.insert(index-1, new QWidgetItem(button));
}
- QSize sizeHint() const
+ QSize sizeHint() const override
{
Q_ASSERT(0);
return QSize();
}
- void addItem(QLayoutItem*) { Q_ASSERT(0); }
+ void addItem(QLayoutItem*) override { Q_ASSERT(0); }
- QLayoutItem* itemAt(int i) const
+ QLayoutItem* itemAt(int i) const override
{
if (m_items.count() <= i)
return 0;
return m_items.at(i);
}
- QLayoutItem* takeAt(int i) { return m_items.takeAt(i); }
+ QLayoutItem* takeAt(int i) override { return m_items.takeAt(i); }
- int count() const { return m_items.count(); }
+ int count() const override { return m_items.count(); }
- void setGeometry (const QRect &rect)
+ void setGeometry (const QRect &rect) override
{
int x = 0;
int y = 0; const QSize &size = buttonSize();
if (m_orientation == Qt::Vertical) {
foreach (QWidgetItem* w, m_items) {
if (w->isEmpty())
continue;
w->widget()->setGeometry(QRect(x, y, size.width(), size.height()));
x += size.width();
if (x + size.width() > rect.width()) {
x = 0;
y += size.height();
}
}
} else {
foreach (QWidgetItem* w, m_items) {
if (w->isEmpty())
continue;
w->widget()->setGeometry(QRect(x, y, size.width(), size.height()));
y += size.height();
if (y + size.height() > rect.height()) {
x += size.width();
y = 0;
}
}
}
}
void setButtonSize(const QSize size)
{
m_buttonSize = size;
}
const QSize &buttonSize() const
{
return m_buttonSize;
}
void setOrientation (Qt::Orientation orientation)
{
m_orientation = orientation;
}
private:
QSize m_buttonSize;
QMap<QAbstractButton*, int> m_priorities;
QList<QWidgetItem*> m_items;
Qt::Orientation m_orientation;
};
class Section : public QWidget
{
public:
enum SeparatorFlag {
SeparatorTop = 0x0001,/* SeparatorBottom = 0x0002, SeparatorRight = 0x0004,*/ SeparatorLeft = 0x0008
};
Q_DECLARE_FLAGS(Separators, SeparatorFlag)
explicit Section(QWidget *parent = 0)
: QWidget(parent),
m_layout(new SectionLayout(this))
{
setLayout(m_layout);
// Re-enable this when we need to debug the section layout again.
// setAutoFillBackground(true);
// static int i = 0;
// switch(i) {
// case 0:
// setStyleSheet("background-color:red");
// break;
// case 1:
// setStyleSheet("background-color:blue");
// break;
// case 2:
// setStyleSheet("background-color:green");
// break;
// case 3:
// setStyleSheet("background-color:yellow");
// break;
// case 4:
// setStyleSheet("background-color:white");
// break;
// case 5:
// setStyleSheet("background-color:gray");
// break;
// case 6:
// setStyleSheet("background-color:lime");
// break;
// case 7:
// setStyleSheet("background-color:silver");
// break;
// case 8:
// setStyleSheet("background-color:purple");
// break;
// default:
// setStyleSheet("background-color:maroon");
// break;
// }
// i++;
}
void addButton(QAbstractButton *button, int priority)
{
m_layout->addButton(button, priority);
}
void setName(const QString &name)
{
setObjectName(name);
m_name = name;
}
QString name() const
{
return m_name;
}
void setButtonSize(QSize size)
{
m_layout->setButtonSize(size);
}
QSize iconSize() const
{
return m_layout->buttonSize();
}
int visibleButtonCount() const
{
int count = 0;
for(int i = m_layout->count()-1; i >= 0; --i) {
if (! static_cast<QWidgetItem*> (m_layout->itemAt(i))->isEmpty())
++count;
}
return count;
}
void setSeparator(Separators separators)
{
m_separators = separators;
}
Separators separators() const
{
return m_separators;
}
void setOrientation (Qt::Orientation orientation)
{
m_layout->setOrientation(orientation);
}
protected:
private:
SectionLayout *m_layout;
QString m_name;
Separators m_separators;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Section::Separators)
class KoToolBoxLayout : public QLayout
{
public:
explicit KoToolBoxLayout(QWidget *parent)
: QLayout(parent), m_orientation(Qt::Vertical), m_currentHeight(0)
{
setSpacing(6);
}
- ~KoToolBoxLayout()
+ ~KoToolBoxLayout() override
{
qDeleteAll( m_sections );
m_sections.clear();
}
- QSize sizeHint() const
+ QSize sizeHint() const override
{
if (m_sections.isEmpty())
return QSize();
QSize oneIcon = static_cast<Section*> (m_sections[0]->widget())->iconSize();
return oneIcon;
}
- QSize minimumSize() const
+ QSize minimumSize() const override
{
QSize s = sizeHint();
if (m_orientation == Qt::Vertical) {
s.setHeight(m_currentHeight);
} else {
s.setWidth(m_currentHeight);
}
return s;
}
void addSection(Section *section)
{
addChildWidget(section);
QList<QWidgetItem*>::iterator iterator = m_sections.begin();
int defaults = 2; // skip the first two as they are the 'main' and 'dynamic' sections.
while (iterator != m_sections.end()) {
if (--defaults < 0 && static_cast<Section*> ((*iterator)->widget())->name() > section->name())
break;
++iterator;
}
m_sections.insert(iterator, new QWidgetItem(section));
}
- void addItem(QLayoutItem*)
+ void addItem(QLayoutItem*) override
{
Q_ASSERT(0); // don't let anything else be added. (code depends on this!)
}
- QLayoutItem* itemAt(int i) const
+ QLayoutItem* itemAt(int i) const override
{
if (m_sections.count() >= i)
return 0;
return m_sections.at(i);
}
- QLayoutItem* takeAt(int i) { return m_sections.takeAt(i); }
+ QLayoutItem* takeAt(int i) override { return m_sections.takeAt(i); }
- int count() const { return m_sections.count(); }
+ int count() const override { return m_sections.count(); }
- void setGeometry (const QRect &rect)
+ void setGeometry (const QRect &rect) override
{
// nothing to do?
if (m_sections.isEmpty())
{
m_currentHeight = 0;
return;
}
// the names of the variables assume a vertical orientation,
// but all calculations are done based on the real orientation
const QSize iconSize = static_cast<Section*> (m_sections.first()->widget())->iconSize();
const int maxWidth = (m_orientation == Qt::Vertical) ? rect.width() : rect.height();
// using min 1 as width to e.g. protect against div by 0 below
const int iconWidth = qMax(1, (m_orientation == Qt::Vertical) ? iconSize.width() : iconSize.height());
const int iconHeight = qMax(1, (m_orientation == Qt::Vertical) ? iconSize.height() : iconSize.width());
const int maxColumns = qMax(1, (maxWidth / iconWidth));
int x = 0;
int y = 0;
bool firstSection = true;
foreach (QWidgetItem *wi, m_sections) {
Section *section = static_cast<Section*> (wi->widget());
// Since sections can overlap (if a section occupies two rows, and there
// is space on the second row for all of the next section, the next section
// will be placed overlapping with the previous section), it's important that
// later sections will be higher in the widget z-order than previous
// sections, so raise it.
section->raise();
const int buttonCount = section->visibleButtonCount();
if (buttonCount == 0) {
// move out of view, not perfect TODO: better solution
section->setGeometry(1000, 1000, 0, 0);
continue;
}
// rows needed for the buttons (calculation gets the ceiling value of the plain div)
const int neededRowCount = ((buttonCount-1) / maxColumns) + 1;
const int availableButtonCount = (maxWidth - x + 1) / iconWidth;
if (firstSection) {
firstSection = false;
} else if (buttonCount > availableButtonCount) {
// start on a new row, set separator
x = 0;
y += iconHeight + spacing();
const Section::Separators separator =
(m_orientation == Qt::Vertical) ? Section::SeparatorTop : Section::SeparatorLeft;
section->setSeparator( separator );
} else {
// append to last row, set separators (on first row only to the left side)
const bool isFirstRow = (y == 0);
const Section::Separators separators =
isFirstRow ?
((m_orientation == Qt::Vertical) ? Section::SeparatorLeft : Section::SeparatorTop) :
(Section::SeparatorTop | Section::SeparatorLeft);
section->setSeparator( separators );
}
const int usedColumns = qMin(buttonCount, maxColumns);
if (m_orientation == Qt::Vertical) {
section->setGeometry(x, y,
usedColumns * iconWidth, neededRowCount * iconHeight);
} else {
section->setGeometry(y, x,
neededRowCount * iconHeight, usedColumns * iconWidth);
}
// advance by the icons in the last row
const int lastRowColumnCount = buttonCount - ((neededRowCount-1) * maxColumns);
x += (lastRowColumnCount * iconWidth) + spacing();
// advance by all but the last used row
y += (neededRowCount - 1) * iconHeight;
}
// cache total height (or width), adding the iconHeight for the current row
m_currentHeight = y + iconHeight;
}
void setOrientation (Qt::Orientation orientation)
{
m_orientation = orientation;
invalidate();
}
private:
QList <QWidgetItem*> m_sections;
Qt::Orientation m_orientation;
mutable int m_currentHeight;
};
#endif
diff --git a/libs/widgets/KoToolBox_p.h b/libs/widgets/KoToolBox_p.h
index 52df6c6b02..bebf1a3508 100644
--- a/libs/widgets/KoToolBox_p.h
+++ b/libs/widgets/KoToolBox_p.h
@@ -1,117 +1,117 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2005-2008 Thomas Zander <zander@kde.org>
* Copyright (c) 2009 Peter Simonsson <peter.simonsson@gmail.com>
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_TOOLBOX_H_
#define _KO_TOOLBOX_H_
#include <KoCanvasObserverBase.h>
#include <QWidget>
#include <QList>
#include <KoToolManager.h>
class KoCanvasController;
class KoShapeLayer;
/**
* KoToolBox is a dock widget that can order tools according to type and
* priority.
*
* The ToolBox is a container for tool buttons which are themselves
* divided into sections.
*
* Adding buttons using addButton() will allow you to show those buttons. You should connect
* the button to your handling method yourself.
*
* The unique property of this toolbox is that it can be shown horizontal as well as vertical,
* rotating in a smart way to show the buttons optimally.
* @see KoToolManager
*/
class KoToolBox : public QWidget {
Q_OBJECT
public:
/// constructor
explicit KoToolBox();
- ~KoToolBox();
+ ~KoToolBox() override;
public Q_SLOTS:
/**
* Using the buttongroup id passed in addButton() you can set the new active button.
* If the id does not resolve to a visible button, this call is ignored.
* @param canvas the currently active canvas.
* @param id an id to identify the button to activate.
*/
void setActiveTool(KoCanvasController *canvas, int id);
/**
* Show only the dynamic buttons that have a code from parameter codes.
* The toolbox allows buttons to be optionally registered with a visibilityCode. This code
* can be passed here and all buttons that have that code are shown. All buttons that
* have another visibility code registered are hidden.
* @param canvas the currently active canvas.
* @param codes a list of all the codes to show.
*/
void setButtonsVisible(const QList<QString> &codes);
/// Set the orientation of the layout to @p orientation
void setOrientation(Qt::Orientation orientation);
void setFloating(bool v);
private:
/**
* Add a button to the toolbox.
* The buttons should all be added before the first showing since adding will not really add
* them to the UI until setup() is called.
*
* @param toolAction the action of the tool
* @see setup()
*/
void addButton(KoToolAction *toolAction);
private Q_SLOTS:
void setCurrentLayer(const KoCanvasController *canvas, const KoShapeLayer* newLayer);
/// add a tool post-initialization. The tool will also be activated.
void toolAdded(KoToolAction *toolAction, KoCanvasController *canvas);
/// resize the toolbox to show the icons without any gap at the edge
void adjustToFit();
/// unlocks the with after adjustToFit
void resizeUnlock();
/// set the icon size for all the buttons
void slotContextIconSize();
protected:
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent* event);
- void contextMenuEvent(QContextMenuEvent *event);
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent* event) override;
+ void contextMenuEvent(QContextMenuEvent *event) override;
private:
class Private;
Private * const d;
};
#endif // _KO_TOOLBOX_H_
diff --git a/libs/widgets/KoToolDocker.h b/libs/widgets/KoToolDocker.h
index 0feec8f17e..d24fa7b6c7 100644
--- a/libs/widgets/KoToolDocker.h
+++ b/libs/widgets/KoToolDocker.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
*
* Copyright (c) 2005-2006 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_TOOL_DOCKER_H
#define KO_TOOL_DOCKER_H
#include <QDockWidget>
#include <QPointer>
class QWidget;
#include <kritawidgets_export.h>
#include <KoCanvasObserverBase.h>
/**
* The tool docker shows the tool option widget associated with the
* current tool and the current canvas.
*/
class KRITAWIDGETS_EXPORT KoToolDocker : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
explicit KoToolDocker(QWidget *parent = 0);
- ~KoToolDocker();
+ ~KoToolDocker() override;
void resetWidgets();
/// reimplemented
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
protected:
- virtual void resizeEvent(QResizeEvent* event); ///< reimplemented from QWidget
+ void resizeEvent(QResizeEvent* event) override; ///< reimplemented from QWidget
public Q_SLOTS:
/**
* Update the option widgets to the argument one, removing the currently set widget.
*/
void setOptionWidgets(const QList<QPointer<QWidget> > &optionWidgetList);
/**
* Returns whether the docker has an optionwidget attached
*/
bool hasOptionWidget();
/**
* set the tab option
*/
void setTabEnabled(bool enabled);
private:
Q_PRIVATE_SLOT(d, void toggleTab())
Q_PRIVATE_SLOT(d, void locationChanged(Qt::DockWidgetArea area))
class Private;
Private * const d;
};
#endif
diff --git a/libs/widgets/KoTriangleColorSelector.h b/libs/widgets/KoTriangleColorSelector.h
index e164020d4c..27ea41b085 100644
--- a/libs/widgets/KoTriangleColorSelector.h
+++ b/libs/widgets/KoTriangleColorSelector.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License,
* or (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KO_TRIANGLE_COLOR_SELECTOR_H_
#define _KO_TRIANGLE_COLOR_SELECTOR_H_
#include <QWidget>
#include "kritawidgets_export.h"
#include <KisColorSelectorInterface.h>
class KoColor;
class KoColorDisplayRendererInterface;
class KRITAWIDGETS_EXPORT KoTriangleColorSelector : public KisColorSelectorInterface {
Q_OBJECT
public:
explicit KoTriangleColorSelector(QWidget *parent);
explicit KoTriangleColorSelector(const KoColorDisplayRendererInterface *displayRenderer, QWidget *parent);
- ~KoTriangleColorSelector();
+ ~KoTriangleColorSelector() override;
protected: // events
- void paintEvent( QPaintEvent * event );
- void resizeEvent( QResizeEvent * event );
- void mouseReleaseEvent( QMouseEvent * event );
- void mousePressEvent( QMouseEvent * event );
- void mouseMoveEvent( QMouseEvent * event );
+ void paintEvent( QPaintEvent * event ) override;
+ void resizeEvent( QResizeEvent * event ) override;
+ void mouseReleaseEvent( QMouseEvent * event ) override;
+ void mousePressEvent( QMouseEvent * event ) override;
+ void mouseMoveEvent( QMouseEvent * event ) override;
public:
int hue() const;
int value() const;
int saturation() const;
- KoColor getCurrentColor() const;
+ KoColor getCurrentColor() const override;
// please use realColor() instead!
Q_DECL_DEPRECATED QColor color() const;
public Q_SLOTS:
void setHue(int h);
void setValue(int v);
void setSaturation(int s);
void setHSV(int h, int s, int v);
- void slotSetColor(const KoColor& );
+ void slotSetColor(const KoColor& ) override;
Q_SIGNALS:
void colorChanged(const QColor& );
private Q_SLOTS:
void configurationChanged();
private:
void tellColorChanged();
void generateTriangle();
void generateWheel();
void updateTriangleCircleParameters();
void selectColorAt(int x, int y, bool checkInWheel = true);
private:
struct Private;
Private* const d;
};
#endif
diff --git a/libs/widgets/KoUnitDoubleSpinBox.h b/libs/widgets/KoUnitDoubleSpinBox.h
index 8224b1405d..2c017ad530 100644
--- a/libs/widgets/KoUnitDoubleSpinBox.h
+++ b/libs/widgets/KoUnitDoubleSpinBox.h
@@ -1,119 +1,119 @@
/* This file is part of the KDE project
Copyright (C) 2002, Rob Buis(buis@kde.org)
Copyright (C) 2004, Nicolas GOUTTE <goutte@kde.org>
Copyright (C) 2007, Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOUNITDOUBLESPINBOX_H
#define KOUNITDOUBLESPINBOX_H
#include "kritawidgets_export.h"
#include <QDoubleSpinBox>
class KoUnit;
/**
* Spin box for double precision numbers with unit display.
* Use this widget for any value that represents a real measurable value for consistency throughout
* Krita.
* This widget shows the value in the user-selected units (inch, milimeters, etc) but keeps the
* Krita-widget default measurement unit internally. This has the advantage that just setting and
* getting a value will not change the value due to conversions.
* The KoDocument class has a unit() method for consistent (document wide) configuration of the
* used unit.
* It is adviced to use a QDoubleSpinBox in QtDesigner and then use the context-menu item: 'Promote to Custom Widget' and use the values: 'classname=KoUnitDoubleSpinBox', 'headerfile=KoUnitDoubleSpinBox.h'
* This will generate code that uses this spinbox in the correct manner.
*
* This class need to be replaced as much as possible with \see KisDoubleParseUnitSpinBox to add math parsing ability.
*/
class KRITAWIDGETS_EXPORT KoUnitDoubleSpinBox : public QDoubleSpinBox
{
Q_OBJECT
public:
/**
* Constructor
* Create a new spinBox with very broad range predefined.
* This spinbox will have min and max borders of 10000 points and use
* the default unit of points.
* @param parent the parent widget
*/
explicit KoUnitDoubleSpinBox( QWidget *parent = 0);
- ~KoUnitDoubleSpinBox();
+ ~KoUnitDoubleSpinBox() override;
/**
* Set the new value in points which will then be converted to the current unit for display
* @param newValue the new value
* @see value()
*/
virtual void changeValue( double newValue );
/**
* This spinbox shows the internal value after a conversion to the unit set here.
*/
virtual void setUnit( const KoUnit &);
/// @return the current value, converted in points
double value( ) const;
/// Set minimum value in points.
void setMinimum(double min);
/// Set maximum value in points.
void setMaximum(double max);
/// Set step size in the current unit.
void setLineStep(double step);
/// Set step size in points.
void setLineStepPt(double step);
/// Set minimum, maximum value and the step size (all in points)
void setMinMaxStep( double min, double max, double step );
/// reimplemented from superclass, will forward to KoUnitDoubleValidator
- virtual QValidator::State validate(QString &input, int &pos) const;
+ QValidator::State validate(QString &input, int &pos) const override;
/**
* Transform the double in a nice text, using locale symbols
* @param value the number as double
* @return the resulting string
*/
- virtual QString textFromValue( double value ) const;
+ QString textFromValue( double value ) const override;
/**
* Transfrom a string into a double, while taking care of locale specific symbols.
* @param str the string to transform into a number
* @return the value as double
*/
- virtual double valueFromText( const QString& str ) const;
+ double valueFromText( const QString& str ) const override;
Q_SIGNALS:
/// emitted like valueChanged in the parent, but this one emits the point value
void valueChangedPt( qreal );
private:
class Private;
Private * const d;
private Q_SLOTS:
// exists to do emits for valueChangedPt
void privateValueChanged();
};
#endif
diff --git a/libs/widgets/KoVBox.h b/libs/widgets/KoVBox.h
index 80aab267dc..f225b25890 100644
--- a/libs/widgets/KoVBox.h
+++ b/libs/widgets/KoVBox.h
@@ -1,93 +1,93 @@
/* This file is part of the KDE libraries
Copyright (C) 2005 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KoVBOX_H
#define KoVBOX_H
#include <kritawidgets_export.h>
#include <QFrame>
class QChildEvent;
/**
* A container widget which arranges its children vertically.
*
* When using a KoVBox you don't need to create a layout nor
* to add the child widgets to it.
*
* Both margin and spacing are initialized to 0. Use QHBoxLayout
* if you need standard layout margins.
*
* @see KVBox
*/
class KRITAWIDGETS_EXPORT KoVBox : public QFrame
{
Q_OBJECT
public:
/**
* Creates a new hbox.
*/
explicit KoVBox(QWidget *parent = 0);
/**
* Destructor.
*/
- ~KoVBox();
+ ~KoVBox() override;
/**
* Sets the @p margin of the hbox.
*/
void setMargin(int margin);
/**
* Sets the spacing between the child widgets to @p space.
*
* To get the default layout spacing, set @p space to -1.
*/
void setSpacing(int space);
/**
* Sets the stretch factor of @p widget to @p stretch.
*/
void setStretchFactor(QWidget *widget, int stretch);
/**
* Calculate the recommended size for this hbox.
*/
QSize sizeHint() const override;
/**
* Calculate the recommended minimum size for this hbox.
*/
QSize minimumSizeHint() const override;
protected:
void childEvent(QChildEvent *ev) override;
private:
class Private;
friend class Private;
Private *const d;
Q_DISABLE_COPY(KoVBox)
};
#endif
diff --git a/libs/widgets/KoZoomAction.h b/libs/widgets/KoZoomAction.h
index b009edfc37..3b1365cba8 100644
--- a/libs/widgets/KoZoomAction.h
+++ b/libs/widgets/KoZoomAction.h
@@ -1,233 +1,233 @@
/* This file is part of the KDE libraries
Copyright (C) 2004 Ariya Hidayat <ariya@kde.org>
Copyright (C) 2006 Peter Simonsson <peter.simonsson@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMACTION_H
#define KOZOOMACTION_H
#include <kselectaction.h>
#include <KoZoomMode.h>
#include "kritawidgets_export.h"
/**
* Class KoZoomAction implements an action to provide zoom values.
* In a toolbar, KoZoomAction will show a dropdown list (combobox), also with
* the possibility for the user to enter arbritrary zoom value
* (must be an integer). The values shown on the list are always
* sorted.
* In a statusbar it provides a scale (slider) plus an editable value plus
* some buttons for special zoommodes
*/
class KRITAWIDGETS_EXPORT KoZoomAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY(qreal effectiveZoom READ effectiveZoom NOTIFY zoomChanged)
public:
/**
* Creates a new zoom action.
* @param zoomModes which zoom modes that should be shown
* @param text The text that will be displayed.
* @param parent The action's parent object.
*/
KoZoomAction( KoZoomMode::Modes zoomModes, const QString& text, QObject *parent);
- ~KoZoomAction();
+ ~KoZoomAction() override;
/**
* Reimplemented from QWidgetAction.
*/
- virtual QWidget* createWidget(QWidget* parent);
+ QWidget* createWidget(QWidget* parent) override;
enum SpecialButton {
AspectMode = 1, ///< changing aspect mode
ZoomToSelection = 2, ///< zooms to current selection
ZoomToAll = 4 ///< zooms to the whole content of the document
};
Q_DECLARE_FLAGS(SpecialButtons, SpecialButton)
/**
* Enables specified special buttons.
* This should be called immediately after calling the constructor.
* @param buttons mask of the special button flags to enable
*/
void setSpecialButtons( SpecialButtons buttons );
qreal effectiveZoom() const;
public Q_SLOTS:
/**
* Sets the zoom. If zoom not yet on the list of zoom values, it will be inserted
* into the list at proper place so that the values remain sorted.
* emits zoomChanged
*/
void setZoom( qreal zoom );
/**
* Change the zoom modes that should be shown
*/
void setZoomModes( KoZoomMode::Modes zoomModes );
/**
* Change the zoom to a closer look than current
* Zoom mode will be CONSTANT afterwards
* emits zoomChanged
*/
void zoomIn( );
/**
* Change the zoom to a wider look than current
* Zoom mode will be CONSTANT afterwards
* emits zoomChanged
*/
void zoomOut( );
/**
* Set the actual zoom value used in the app. This is needed when using @ref zoomIn() , @ref zoomOut() and/or when
* plugged into the viewbar.
*/
void setEffectiveZoom(qreal zoom);
/**
* Change the selected zoom mode.
*/
void setSelectedZoomMode( KoZoomMode::Mode mode );
/**
* Change status of "Use same aspect as pixels" button
* (emits aspectModeChanged(bool) after the change, ALWAYS)
*/
void setAspectMode(bool status);
/**
* Returns next preferred zoom level that should be used for
* zoom in operations.
*
* This can be used by the caller, when it needs some special
* mode of zooming (e.g. relative to point) and needs
* KoCanvasControllerWidget to accomplish this.
*/
qreal nextZoomLevel() const;
/**
* Returns previous preferred zoom level that should be used for
* zoom out operations.
*
* This can be used by the caller, when it needs some special
* mode of zooming (e.g. relative to point) and needs
* KoCanvasControllerWidget to accomplish this.
*/
qreal prevZoomLevel() const;
protected Q_SLOTS:
void triggered( const QString& text );
void sliderValueChanged(int value);
Q_SIGNALS:
/**
* Signal zoomChanged is triggered when user changes the zoom value, either by
* choosing it from the list or by entering new value.
* @param mode The selected zoom mode
* @param zoom the zoom, only defined if @p mode is KoZoomMode::ZOOM_CONSTANT
*/
void zoomChanged( KoZoomMode::Mode mode, qreal zoom );
/**
* Signal aspectModeChanged is triggered when the user toggles the widget.
* Nothing else happens except that this signal is emitted.
* @param status Whether the special aspect mode is on
*/
void aspectModeChanged( bool status );
/**
* Signal is triggered when the user clicks the zoom to selection button.
* Nothing else happens except that this signal is emitted.
*/
void zoomedToSelection();
/**
* Signal is triggered when the user clicks the zoom to all button.
* Nothing else happens except that this signal is emitted.
*/
void zoomedToAll();
void zoomLevelsChanged(const QStringList &values);
void currentZoomLevelChanged(const QString &valueString);
void sliderChanged(int value);
public:
/**
* Return the minimum zoom possible for documents.
*
* \return The minimum zoom possible.
*/
qreal minimumZoom();
/**
* Return the maximum zoom possible for documents.
*
* \return The maximum zoom possible.
*/
qreal maximumZoom();
/**
* Clamp the zoom value so that mimimumZoom <= zoom <= maximumZoom.
*
* \param zoom The value to clamp.
*
* \return minimumZoom if zoom < minimumZoom, maximumZoom if zoom >
* maximumZoom, zoom if otherwise.
*/
qreal clampZoom(qreal zoom);
/**
* Set the minimum zoom possible for documents.
*
* Note that after calling this, any existing KoZoomAction instances
* should be recreated.
*
* \param zoom The minimum zoom to use.
*/
void setMinimumZoom(qreal zoom);
/**
* Set the maximum zoom possible for documents.
*
* Note that after calling this, any existing KoZoomAction instances
* should be recreated.
*
* \param zoom The maximum zoom to use.
*/
void setMaximumZoom(qreal zoom);
protected:
/// Regenerates the action's items
void regenerateItems( const qreal zoom, bool asCurrent = false );
private:
void syncSliderWithZoom();
Q_DISABLE_COPY( KoZoomAction )
class Private;
Private * const d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KoZoomAction::SpecialButtons)
#endif
diff --git a/libs/widgets/KoZoomController.h b/libs/widgets/KoZoomController.h
index 12c1abde4b..b3210c12aa 100644
--- a/libs/widgets/KoZoomController.h
+++ b/libs/widgets/KoZoomController.h
@@ -1,207 +1,207 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007,2012 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMCONTROLLER_H
#define KOZOOMCONTROLLER_H
#include "KoZoomAction.h"
#include "kritawidgets_export.h"
#include <KoZoomMode.h>
#include <QObject>
#include <QSizeF>
class KoCanvasController;
class KoZoomAction;
class KoZoomHandler;
class KActionCollection;
class QSize;
/**
* This controller class handles zoom levels for any canvas.
*
* For each KoCanvasController you should have one instance of this
* class to go with it. This class then creates a KoZoomAction and
* basically handles all zooming for you.
*
* All you need to do is connect to the setDocumentSize() slot and
* keep the controller up-to-date if your on-screen document ever
* changes (note that this is in document units, so this is a zoom
* independent size).
*
* If you choose to have zoom modes of 'page' and 'width' you are
* required to set the page size using the setPageSize() method.
*
* Additionally you can connect to the zoomChanged() signal if you
* want to store the latest zoom level and mode, for example to
* restore the last used one at next restart.
*
* The specialAspectMode toggle is only a UI element. It does nothing
* except emit the aspectModeChanged signal.
*
*/
class KRITAWIDGETS_EXPORT KoZoomController : public QObject {
Q_OBJECT
public:
/**
* Constructor. Create one per canvasController. The zoomAction is created in the constructor and will
* be available to the passed actionCollection for usage by XMLGui.
* @param controller the canvasController
* @param zoomHandler the zoom handler (viewconverter with setter methods)
* @param actionCollection the action collection where the KoZoomAction is added to
* @param specialButtons controls which special buttons to show
*/
KoZoomController(KoCanvasController *controller,
KoZoomHandler *zoomHandler,
KActionCollection *actionCollection,
KoZoomAction::SpecialButtons specialButtons = 0,
QObject *parent = 0);
/// destructor
- ~KoZoomController();
+ ~KoZoomController() override;
/// returns the zoomAction that is maintained by this controller
KoZoomAction *zoomAction() const;
/**
* Alter the current zoom mode which updates the Gui.
* @param mode the new mode that will be used to auto-calculate a new zoom-level if needed.
*/
void setZoomMode(KoZoomMode::Mode mode);
/**
* Set the resolution, zoom, the zoom mode for this zoom Controller.
* Typically for use just after construction to restore the
* persistent data.
*
* @param mode new zoom mode for the canvas
* @param zoom (for ZOOM_CONSTANT zoom mode only) new zoom value for
* the canvas
* @param resolutionX new X resolution for the document
* @param resolutionY new Y resolution for the document
* @param stillPoint (for ZOOM_CONSTANT zoom mode only) the point
* which will not change its position in widget
* during the zooming. It is measured in view
* coordinate system *before* zoom.
*/
void setZoom(KoZoomMode::Mode mode, qreal zoom, qreal resolutionX, qreal resolutionY, const QPointF &stillPoint);
/**
* Convenience function that changes resolution with
* keeping the centering unchanged
*/
void setZoom(KoZoomMode::Mode mode, qreal zoom, qreal resolutionX, qreal resolutionY);
/**
* Convenience function that does not touch the resolution of the
* document
*/
void setZoom(KoZoomMode::Mode mode, qreal zoom, const QPointF &stillPoint);
/**
* Convenience function with @p center always set to the current
* center point of the canvas
*/
void setZoom(KoZoomMode::Mode mode, qreal zoom);
/**
* Set Aspect Mode button status and begin a chain of signals
*/
void setAspectMode(bool status);
public Q_SLOTS:
/**
* Set the size of the current page in document coordinates which allows zoom modes that use the pageSize
* to update.
* @param pageSize the new page size in points
*/
void setPageSize(const QSizeF &pageSize);
/**
* Returns the size of the current page in document coordinates
* @returns the page size in points
*/
QSizeF pageSize() const;
/**
* Set the dimensions of where text can appear which allows zoom modes that use the text
* to update.
* @param min the minimum x value (in document coordinates) where text can appear
* @param max the maximum x value (in document coordinates) where text can appear
*/
void setTextMinMax(qreal min, qreal max);
/**
* Set the size of the whole document currently being shown on the canvas.
* The document size will be used together with the current zoom level to calculate the size of the
* canvas in the canvasController.
* @param documentSize the new document size in points
* @param recalculateCenter tells canvas controller not to touch
* preferredCenterFraction
*/
void setDocumentSize(const QSizeF &documentSize, bool recalculateCenter = false);
/**
* Returns the size of the whole document currently being shown on the canvas.
* @returns the document size in points
*/
QSizeF documentSize() const;
Q_SIGNALS:
/**
* This signal is emitted whenever either the zoommode or the zoom level is changed by the user.
* the application can use the emitted data for persistency purposes.
*/
void zoomChanged (KoZoomMode::Mode mode, qreal zoom);
/**
* emitted when the special aspect mode toggle changes.
* @see KoZoomAction::aspectModeChanged()
*/
void aspectModeChanged (bool aspectModeActivated);
/**
* Signal is triggered when the user clicks the zoom to selection button.
* Nothing else happens except that this signal is emitted.
*/
void zoomedToSelection();
/**
* Signal is triggered when the user clicks the zoom to all button.
* Nothing else happens except that this signal is emitted.
*/
void zoomedToAll();
protected:
virtual QSize documentToViewport(const QSizeF &size);
private:
Q_PRIVATE_SLOT(d, void setAvailableSize())
Q_PRIVATE_SLOT(d, void requestZoomRelative(const qreal, const QPointF&))
Q_PRIVATE_SLOT(d, void setZoom(KoZoomMode::Mode, qreal))
Q_DISABLE_COPY( KoZoomController )
class Private;
Private * const d;
};
#endif
diff --git a/libs/widgets/KoZoomHandler.h b/libs/widgets/KoZoomHandler.h
index f8469144d9..4e6e539fcd 100644
--- a/libs/widgets/KoZoomHandler.h
+++ b/libs/widgets/KoZoomHandler.h
@@ -1,229 +1,229 @@
/* This file is part of the KDE project
Copyright (C) 2001-2005 David Faure <faure@kde.org>
Copyright (C) 2006, 2009 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMHANDLER_H
#define KOZOOMHANDLER_H
#include "kritawidgets_export.h"
#include <KoZoomMode.h>
#include <KoViewConverter.h>
/**
* This class handles the zooming and DPI stuff (conversions between
* postscript pt values and pixels). If the internal data of your
* document does not work with postscript points (for instance raster
* image pixels), you need to some additional converting yourself.
*
* An instance of KoZoomHandler operates at a given zoom and resolution
* so there is usually one instance of KoZoomHandler per view.
*/
class KRITAWIDGETS_EXPORT KoZoomHandler : public KoViewConverter
{
public:
KoZoomHandler();
- virtual ~KoZoomHandler();
+ ~KoZoomHandler() override;
/**
* @return the conversion factor between document and view, that
* includes the zoom and also the DPI setting.
*/
inline qreal zoomedResolutionX() const { return m_zoomedResolutionX; }
/**
* @return the conversion factor between document and view, that
* includes the zoom and also the DPI setting.
*/
inline qreal zoomedResolutionY() const { return m_zoomedResolutionY; }
inline qreal resolutionX() const { return m_resolutionX; }
inline qreal resolutionY() const { return m_resolutionY; }
/**
* Zoom factor for X. Equivalent to zoomedResolutionX()/resolutionX()
*/
inline qreal zoomFactorX() const { return m_zoomedResolutionX / m_resolutionX; }
/**
* Zoom factor for Y. Equivalent to zoomedResolutionY()/resolutionY()
*/
inline qreal zoomFactorY() const { return m_zoomedResolutionY / m_resolutionY; }
/**
* Set resolution expressed in dots-per-inch
*/
void setDpi(int dpiX, int dpiY);
/**
* Set a resolution for X and Y of the output device.
* The zoom factor is not changed.
*
* This number should be the result of:
* POINT_TO_INCH(static_cast<qreal>(DOTS_PER_INCH))
*/
void setResolution(qreal resolutionX, qreal resolutionY);
/**
* Set the resolution for X and Y to the display values reported by KGlobal.
* The zoom factor is not changed.
*/
void setResolutionToStandard( );
/**
* Set the zoomed resolution for X and Y.
* Compared to the setZoom... methods, this allows to set a different
* zoom factor for X and for Y.
*/
virtual void setZoomedResolution(qreal zoomedResolutionX, qreal zoomedResolutionY);
/**
* Change the zoom level, keeping the resolution unchanged.
* @param zoom the zoom factor (e.g. 1.0 for 100%)
*/
- void setZoom(qreal zoom);
+ void setZoom(qreal zoom) override;
/**
* Change the zoom mode
* @param zoomMode the zoom mode.
*/
inline void setZoomMode(KoZoomMode::Mode zoomMode) { m_zoomMode = zoomMode; }
/**
* @return the global zoom factor (e.g. 100 for 100%).
* Only use this to display to the user, don't use in calculations
*/
inline int zoomInPercent() const { return qRound(KoViewConverter::zoom() * 100); }
/**
* @return the global zoom mode (e.g. KoZoomMode::ZOOM_WIDTH).
* use this to determine how to zoom
*/
KoZoomMode::Mode zoomMode() const { return m_zoomMode; }
// Input: pt. Output: pixels. Resolution and zoom are applied.
inline qreal zoomItX(qreal z) const
{
return m_zoomedResolutionX * z;
}
inline qreal zoomItY(qreal z) const
{
return m_zoomedResolutionY * z ;
}
// Input: pixels. Output: pt.
inline qreal unzoomItX(qreal x) const
{
return x / m_zoomedResolutionX;
}
inline qreal unzoomItY(qreal y) const
{
return y / m_zoomedResolutionY;
}
// KoViewConverter-interface methods
/**
* Convert a coordinate in pt to pixels.
* @param documentPoint the point in the document coordinate system of a KoShape.
*/
- virtual QPointF documentToView(const QPointF &documentPoint) const;
+ QPointF documentToView(const QPointF &documentPoint) const override;
/**
* Convert a coordinate in pixels to pt.
* @param viewPoint the point in the coordinate system of the widget, or window.
*/
- virtual QPointF viewToDocument(const QPointF &viewPoint) const;
+ QPointF viewToDocument(const QPointF &viewPoint) const override;
/**
* Convert a rectangle in pt to pixels.
* @param documentRect the rect in the document coordinate system of a KoShape.
*/
- virtual QRectF documentToView(const QRectF &documentRect) const;
+ QRectF documentToView(const QRectF &documentRect) const override;
/**
* Convert a rectangle in pixels to pt.
* @param viewRect the rect in the coordinate system of the widget, or window.
*/
- virtual QRectF viewToDocument(const QRectF &viewRect) const;
+ QRectF viewToDocument(const QRectF &viewRect) const override;
/**
* Convert a size in pt to pixels.
* @param documentSize the size in pt.
* @return the size in pixels.
*/
- virtual QSizeF documentToView(const QSizeF &documentSize) const;
+ QSizeF documentToView(const QSizeF &documentSize) const override;
/**
* Convert a size in pixels to pt.
* @param viewSize the size in pixels.
* @return the size in pt.
*/
- virtual QSizeF viewToDocument(const QSizeF &viewSize) const;
+ QSizeF viewToDocument(const QSizeF &viewSize) const override;
/**
* Convert a single x coordinate in pt to pixels.
* @param documentX the x coordinate in pt.
* @return the x coordinate in pixels.
*/
- virtual qreal documentToViewX(qreal documentX) const;
+ qreal documentToViewX(qreal documentX) const override;
/**
* Convert a single y coordinate in pt to pixels.
* @param documentY the y coordinate in pt.
* @return the y coordinate in pixels.
*/
- virtual qreal documentToViewY(qreal documentY) const;
+ qreal documentToViewY(qreal documentY) const override;
/**
* Convert a single x coordinate in pixels to pt.
* @param viewX the x coordinate in pixels.
* @return the x coordinate in pt.
*/
- virtual qreal viewToDocumentX(qreal viewX) const;
+ qreal viewToDocumentX(qreal viewX) const override;
/**
* Convert a single y coordinate in pixels to pt.
* @param viewY the y coordinate in pixels.
* @return the y coordinate in pt.
*/
- virtual qreal viewToDocumentY(qreal viewY) const;
+ qreal viewToDocumentY(qreal viewY) const override;
/**
* Get the zoom levels of the individual x and y axis. Copy them to the pointer parameters.
* @param zoomX a pointer to a qreal which will be modified to set the horizontal zoom.
* @param zoomY a pointer to a qreal which will be modified to set the vertical zoom.
*/
- virtual void zoom(qreal *zoomX, qreal *zoomY) const;
+ void zoom(qreal *zoomX, qreal *zoomY) const override;
using KoViewConverter::zoom;
protected:
KoZoomMode::Mode m_zoomMode;
qreal m_resolutionX;
qreal m_resolutionY;
qreal m_zoomedResolutionX;
qreal m_zoomedResolutionY;
};
#endif
diff --git a/libs/widgets/KoZoomInput.h b/libs/widgets/KoZoomInput.h
index a9e0381b42..7c60339e6a 100644
--- a/libs/widgets/KoZoomInput.h
+++ b/libs/widgets/KoZoomInput.h
@@ -1,49 +1,49 @@
/* Copyright 2008 Peter Simonsson <peter.simonsson@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMINPUT_H
#define KOZOOMINPUT_H
#include <QStackedWidget>
class KoZoomInput : public QStackedWidget
{
Q_OBJECT
public:
explicit KoZoomInput(QWidget* parent = 0);
- ~KoZoomInput();
+ ~KoZoomInput() override;
void setZoomLevels(const QStringList& levels);
void setCurrentZoomLevel(const QString& level);
- virtual bool eventFilter(QObject* watched, QEvent* event);
+ bool eventFilter(QObject* watched, QEvent* event) override;
Q_SIGNALS:
void zoomLevelChanged(const QString& level);
protected:
- void enterEvent(QEvent* event);
- void leaveEvent(QEvent* event);
- void keyPressEvent(QKeyEvent* event);
+ void enterEvent(QEvent* event) override;
+ void leaveEvent(QEvent* event) override;
+ void keyPressEvent(QKeyEvent* event) override;
private:
class Private;
Private* const d;
};
#endif //KOZOOMINPUT_H
diff --git a/libs/widgets/KoZoomWidget.h b/libs/widgets/KoZoomWidget.h
index 1c0b864aef..e0dd25c482 100644
--- a/libs/widgets/KoZoomWidget.h
+++ b/libs/widgets/KoZoomWidget.h
@@ -1,83 +1,83 @@
/*
Copyright (C) 2004 Ariya Hidayat <ariya@kde.org>
Copyright (C) 2006 Peter Simonsson <peter.simonsson@gmail.com>
Copyright (C) 2006-2007 C. Boemann <cbo@boemann.dk>
Copyright (C) 2014 Sven Langkamp <sven.langkamp@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOZOOMWIDGET_H
#define KOZOOMWIDGET_H
#include <QWidget>
#include "KoZoomAction.h"
#include <QScopedPointer>
class KoZoomWidget : public QWidget
{
Q_OBJECT
public:
KoZoomWidget(QWidget* parent, KoZoomAction::SpecialButtons specialButtons, int maxZoom);
- ~KoZoomWidget();
+ ~KoZoomWidget() override;
Q_SIGNALS:
/**
* Signal sliderValueChanged is triggered when the user moves the slider
* @param value value of the slider
*/
void sliderValueChanged(int value);
/**
* Signal zoomLevelChanged is triggered when the user changes the KoZoomInput combobox widget
* @param value value of the slider
*/
void zoomLevelChanged(const QString& level);
/**
* Signal aspectModeChanged is triggered when the user toggles the widget.
* Nothing else happens except that this signal is emitted.
* @param status Whether the special aspect mode is on
*/
void aspectModeChanged( bool status );
/**
* Signal is triggered when the user clicks the zoom to selection button.
* Nothing else happens except that this signal is emitted.
*/
void zoomedToSelection();
/**
* Signal is triggered when the user clicks the zoom to all button.
* Nothing else happens except that this signal is emitted.
*/
void zoomedToAll();
public Q_SLOTS:
void setZoomLevels(const QStringList &values);
void setCurrentZoomLevel(const QString &valueString);
void setSliderValue(int value);
/**
* Change status of "Use same aspect as pixels" button
*/
void setAspectMode(bool status);
private:
class Private;
QScopedPointer<Private> const d;
};
#endif // KOZOOMWIDGET_H
diff --git a/libs/widgets/kis_double_parse_spin_box.h b/libs/widgets/kis_double_parse_spin_box.h
index bc3310f5e6..a38d143e60 100644
--- a/libs/widgets/kis_double_parse_spin_box.h
+++ b/libs/widgets/kis_double_parse_spin_box.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2016 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISDOUBLEPARSESPINBOX_H
#define KISDOUBLEPARSESPINBOX_H
#include <QDoubleSpinBox>
#include "kritawidgets_export.h"
class QLabel;
/*!
* \brief The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
*
* Use this spinbox instead of the basic one from Qt if you want it to be able to parse arithmetic expressions.
*/
class KRITAWIDGETS_EXPORT KisDoubleParseSpinBox : public QDoubleSpinBox
{
Q_OBJECT
public:
KisDoubleParseSpinBox(QWidget* parent = 0);
- virtual ~KisDoubleParseSpinBox(); //KisDoubleParseSpinBox may be used polymorphycally as a QDoubleSpinBox.
+ ~KisDoubleParseSpinBox() override; //KisDoubleParseSpinBox may be used polymorphycally as a QDoubleSpinBox.
- virtual double valueFromText(const QString & text) const;
- virtual QString textFromValue(double val) const;
- virtual QValidator::State validate ( QString & input, int & pos ) const;
+ double valueFromText(const QString & text) const override;
+ QString textFromValue(double val) const override;
+ QValidator::State validate ( QString & input, int & pos ) const override;
- virtual void stepBy(int steps);
+ void stepBy(int steps) override;
void setValue(double value); //polymorphism won't work directly, we use a signal/slot hack to do so but if signals are disabled this function will still be useful.
bool isLastValid() const{ return boolLastValid; }
//! \brief this virtual function is similar to cleanText(); for KisDoubleParseSpinBox. But child class may remove additional artifacts.
virtual QString veryCleanText() const;
Q_SIGNALS:
//! \brief signal emmitted when the last parsed expression create an error.
void errorWhileParsing(QString expr) const;
//! \brief signal emmitted when the last parsed expression is valid.
void noMoreParsingError() const;
public Q_SLOTS:
//! \brief useful to let the widget change it's stylesheet when an error occured in the last expression.
void setErrorStyle();
//! \brief useful to let the widget reset it's stylesheet when there's no more error.
void clearErrorStyle();
//! \brief say the widget to return to an error free state.
void clearError();
protected:
mutable bool boolLastValid;
mutable double oldValue;
mutable QString lastExprParsed;
QLabel* warningIcon;
QPalette oldPalette;
bool isOldPaletteSaved;
QMargins oldMargins;
bool areOldMarginsSaved;
};
#endif // KISDOUBLEPARSESPINBOX_H
diff --git a/libs/widgets/kis_double_parse_unit_spin_box.h b/libs/widgets/kis_double_parse_unit_spin_box.h
index a8efac06df..8ece97710c 100644
--- a/libs/widgets/kis_double_parse_unit_spin_box.h
+++ b/libs/widgets/kis_double_parse_unit_spin_box.h
@@ -1,137 +1,137 @@
/*
* Copyright (c) 2016 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DOUBLEPARSEUNITSPINBOX_H
#define KIS_DOUBLEPARSEUNITSPINBOX_H
#include <KoUnit.h>
#include "kis_double_parse_spin_box.h"
#include "kritawidgets_export.h"
class KisSpinBoxUnitManager;
/*!
* \brief The KisDoubleParseUnitSpinBox class is an evolution of the \see KoUnitDoubleSpinBox, but inherit from \see KisDoubleParseSpinBox to be able to parse math expressions.
*
* This class store the
*/
class KRITAWIDGETS_EXPORT KisDoubleParseUnitSpinBox : public KisDoubleParseSpinBox
{
Q_OBJECT
public:
KisDoubleParseUnitSpinBox(QWidget* parent = 0);
- virtual ~KisDoubleParseUnitSpinBox();
+ ~KisDoubleParseUnitSpinBox() override;
void setUnitManager(KisSpinBoxUnitManager* unitManager);
/**
* Set the new value in points (or other reference unit) which will then be converted to the current unit for display
* @param newValue the new value
* @see value()
*/
virtual void changeValue( double newValue );
/**
* This spinbox shows the internal value after a conversion to the unit set here.
*/
virtual void setUnit(const KoUnit &unit);
virtual void setUnit(const QString & symbol);
/*!
* \brief setReturnUnit set a unit, such that the spinbox now return values in this unit instead of the reference unit for the current dimension.
* \param symbol the symbol of the new unit.
*/
void setReturnUnit(const QString & symbol);
/**
* @brief setDimensionType set the dimension (for example length or angle) of the units the spinbox manage
* @param dim the dimension id. (if not an id in KisSpinBoxUnitManager::UnitDimension, then the function does nothing).
*/
virtual void setDimensionType(int dim);
/// @return the current value, converted in points
double value( ) const;
/// Set minimum value in points.
void setMinimum(double min);
/// Set maximum value in points.
void setMaximum(double max);
/// Set step size in the current unit.
void setLineStep(double step);
/// Set step size in points.
void setLineStepPt(double step);
/// Set minimum, maximum value and the step size (all in points)
void setMinMaxStep( double min, double max, double step );
/// reimplemented from superclass, will forward to KoUnitDoubleValidator
- virtual QValidator::State validate(QString &input, int &pos) const;
+ QValidator::State validate(QString &input, int &pos) const override;
/**
* Transform the double in a nice text, using locale symbols
* @param value the number as double
* @return the resulting string
*/
- virtual QString textFromValue( double value ) const;
+ QString textFromValue( double value ) const override;
//! \brief get the text in the spinbox without prefix or suffix, and remove unit symbol if present.
- virtual QString veryCleanText() const;
+ QString veryCleanText() const override;
/**
* Transfrom a string into a double, while taking care of locale specific symbols.
* @param str the string to transform into a number
* @return the value as double
*/
- virtual double valueFromText( const QString& str ) const;
+ double valueFromText( const QString& str ) const override;
void setUnitChangeFromOutsideBehavior(bool toggle); //if set to false, setting the unit using KoUnit won't have any effect.
//! \brief display the unit symbol in the spinbox or not. For example if the unit is displayed in a combobox connected to the unit manager.
void setDisplayUnit(bool toggle);
Q_SIGNALS:
/// emitted like valueChanged in the parent, but this one emits the point value, or converted to another reference unit.
void valueChangedPt( qreal );
private:
class Private;
Private * const d;
QString detectUnit();
QString makeTextClean(QString const& txt) const;
//thoses functions are usefull to sync the spinbox with it's unitmanager.
//! \brief change the unit, reset the spin box everytime. From the outside it's alway set unit that should be called.
void internalUnitChange(QString const& symbol);
void prepareUnitChange();
private Q_SLOTS:
// exists to do emits for valueChangedPt
void privateValueChanged();
void detectUnitChanges();
void disconnectExternalUnitManager();
};
#endif // KIS_DOUBLEPARSEUNITSPINBOX_H
diff --git a/libs/widgets/kis_file_name_requester.h b/libs/widgets/kis_file_name_requester.h
index 748a4908d7..53fbfb9df5 100644
--- a/libs/widgets/kis_file_name_requester.h
+++ b/libs/widgets/kis_file_name_requester.h
@@ -1,80 +1,80 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILE_NAME_REQUESTER_H
#define KIS_FILE_NAME_REQUESTER_H
#include "kritawidgets_export.h"
#include <QWidget>
#include <QString>
#include <QUrl>
#include <KoFileDialog.h>
namespace Ui {
class WdgFileNameRequester;
}
/**
* This represents an editable file name.
* Visual it presents a QLineEdit + a buton that pops up
* a file chooser.
*
* Signals are fired when the user changes the text
* or selects a new file via the button/file chooser.
*/
class KRITAWIDGETS_EXPORT KisFileNameRequester : public QWidget
{
Q_OBJECT
public:
explicit KisFileNameRequester(QWidget *parent = 0);
- ~KisFileNameRequester();
+ ~KisFileNameRequester() override;
void setStartDir(const QString &path);
QString fileName() const;
void setFileName(const QString &path);
void setMode(KoFileDialog::DialogType mode);
KoFileDialog::DialogType mode() const;
/**
* Sets the mime type filters to use, same format as KoFileDialog::setMimeTypeFilters.
* If this is not called, the default list is used, which simply selects all the image
* file formats Krita can load.
*/
void setMimeTypeFilters(const QStringList &filterList, QString defaultFilter = QString());
public Q_SLOTS:
void slotSelectFile();
Q_SIGNALS:
void textChanged(const QString &fileName);
void fileSelected(const QString &fileName);
private:
QScopedPointer<Ui::WdgFileNameRequester> m_ui;
QString m_basePath;
KoFileDialog::DialogType m_mode;
QStringList m_mime_filter_list;
QString m_mime_default_filter;
};
#endif // KIS_FILE_NAME_REQUESTER_H
diff --git a/libs/widgets/kis_int_parse_spin_box.h b/libs/widgets/kis_int_parse_spin_box.h
index ffd3b5c2dc..cf351883a0 100644
--- a/libs/widgets/kis_int_parse_spin_box.h
+++ b/libs/widgets/kis_int_parse_spin_box.h
@@ -1,82 +1,82 @@
/*
* Copyright (c) 2016 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISINTPARSESPINBOX_H
#define KISINTPARSESPINBOX_H
#include <QSpinBox>
#include "kritawidgets_export.h"
class QLabel;
/*!
* \brief The KisDoubleParseSpinBox class is a cleverer doubleSpinBox, able to parse arithmetic expressions.
*
* Use this spinbox instead of the basic one from Qt if you want it to be able to parse arithmetic expressions.
*/
class KRITAWIDGETS_EXPORT KisIntParseSpinBox : public QSpinBox
{
Q_OBJECT
public:
KisIntParseSpinBox(QWidget *parent = 0);
- ~KisIntParseSpinBox();
+ ~KisIntParseSpinBox() override;
- virtual int valueFromText(const QString & text) const;
- virtual QString textFromValue(int val) const;
- virtual QValidator::State validate ( QString & input, int & pos ) const;
+ int valueFromText(const QString & text) const override;
+ QString textFromValue(int val) const override;
+ QValidator::State validate ( QString & input, int & pos ) const override;
- virtual void stepBy(int steps);
+ void stepBy(int steps) override;
void setValue(int val); //polymorphism won't work directly, we use a signal/slot hack to do so but if signals are disabled this function will still be useful.
bool isLastValid() const{ return boolLastValid; }
Q_SIGNALS:
//! \brief signal emmitted when the last parsed expression create an error.
void errorWhileParsing(QString expr) const;
//! \brief signal emmitted when the last parsed expression is valid.
void noMoreParsingError() const;
public Q_SLOTS:
//! \brief useful to let the widget change it's stylesheet when an error occured in the last expression.
void setErrorStyle();
//! \brief useful to let the widget reset it's stylesheet when there's no more error.
void clearErrorStyle();
//! \brief say the widget to return to an error free state.
void clearError();
protected:
mutable QString* lastExprParsed;
mutable bool boolLastValid;
mutable int oldVal; //store the last correctly evaluated value.
QLabel* warningIcon;
QPalette oldPalette;
bool isOldPaletteSaved;
QMargins oldMargins;
bool areOldMarginsSaved;
};
#endif // KISINTPARSESPINBOX_H
diff --git a/libs/widgetutils/KoFileDialog.h b/libs/widgetutils/KoFileDialog.h
index 86f0b50794..9d1d284fa1 100644
--- a/libs/widgetutils/KoFileDialog.h
+++ b/libs/widgetutils/KoFileDialog.h
@@ -1,132 +1,132 @@
/* This file is part of the KDE project
Copyright (C) 2013 - 2014 Yue Liu <yue.liu@mail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOFILEDIALOG_H
#define KOFILEDIALOG_H
#include "kritawidgetutils_export.h"
#include <QFileDialog>
#include <QString>
#include <QStringList>
#include <QList>
/**
* Wrapper around QFileDialog providing native file dialogs
* on KDE/Gnome/Windows/OSX/etc.
*/
class KRITAWIDGETUTILS_EXPORT KoFileDialog : public QObject
{
Q_OBJECT
public:
enum DialogType {
OpenFile,
OpenFiles,
OpenDirectory,
ImportFile,
ImportFiles,
ImportDirectory,
SaveFile
};
/**
* @brief constructor
* @param parent The parent of the file dialog
* @param dialogType usage of the file dialog
* @param dialogName the name for the file dialog. This will be used to open
* the filedialog in the last open location, instead the specified directory.
*
* @return The name of the entry user selected in the file dialog
*
*/
KoFileDialog(QWidget *parent,
KoFileDialog::DialogType type,
const QString &dialogName);
- ~KoFileDialog();
+ ~KoFileDialog() override;
void setCaption(const QString &caption);
/**
* Use the given filename as a proposal.
*/
void setProposedFileName(const QString &filename);
/**
* @brief setDefaultDir set the default directory to defaultDir.
*
* @param defaultDir a path to a file or directory
*/
void setDefaultDir(const QString &defaultDir);
/**
* @brief setImageFilters sets the name filters for the file dialog to all
* image formats Qt's QImageReader supports.
*/
void setImageFilters();
void setMimeTypeFilters(const QStringList &filterList,
QString defaultFilter = QString());
/// Get the file names the user selected in the file dialog
QStringList filenames();
/// Get the file name the user selected in the file dialog
QString filename();
/**
* @brief selectedNameFilter returns the name filter the user selected, either
* directory or by clicking on it.
* @return
*/
QString selectedNameFilter() const;
QString selectedMimeType() const;
private:
/**
* @brief splitNameFilter take a single line of a QDialog name filter and split it
* into several lines. This is needed because a single line name filter can contain
* more than one mimetype, making it impossible to figure out the correct extension.
*
* The methods takes care of some duplicated extensions, like jpeg and jpg.
* @param nameFilter the namefilter to be split
* @param mimeList a pointer to the list with mimes that shouldn't be added.
* @return a stringlist of all name filters.
*/
static QStringList splitNameFilter(const QString &nameFilter, QStringList *mimeList);
void createFileDialog();
QString getUsedDir(const QString &dialogName);
void saveUsedDir(const QString &fileName, const QString &dialogName);
const QStringList getFilterStringListFromMime(const QStringList &mimeList,
bool withAllSupportedEntry = false);
class Private;
Private * const d;
};
#endif /* KOFILEDIALOG_H */
diff --git a/libs/widgetutils/KoGroupButton.h b/libs/widgetutils/KoGroupButton.h
index 889bf3fcb9..25142ef8fc 100644
--- a/libs/widgetutils/KoGroupButton.h
+++ b/libs/widgetutils/KoGroupButton.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE libraries
Copyright (C) 2007 Aurélien Gâteau <agateau@kde.org>
Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
Copyright (C) 2012 Jarosław Staniek <staniek@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KOGROUPBUTTON_H
#define KOGROUPBUTTON_H
#include "kritawidgetutils_export.h"
// Qt
#include <QToolButton>
/**
* A thin tool button which can be visually grouped with other buttons.
*
* The group can thus look like one solid bar: ( button1 | button2 | button3 )
*
* For groupping layout can be used. For exclusive checkable behaviour assign QButtonGroup on the buttons.
*/
class KRITAWIDGETUTILS_EXPORT KoGroupButton : public QToolButton
{
Q_OBJECT
Q_ENUMS( GroupPosition )
Q_PROPERTY( GroupPosition groupPosition READ groupPosition WRITE setGroupPosition )
public:
/**
* Position of the button within the button group what affects the appearance.
*/
enum GroupPosition {
NoGroup, //!< No particular position, gives the button unchanged appearance
GroupLeft, //!< The button is at the left of the group, so it would have rounded the left part
GroupRight, //!< The button is at the right of the group, so it would have rounded the right part
GroupCenter //!< The button is on the center of the group, so it would have separators on both sides
};
explicit KoGroupButton(GroupPosition position, QWidget* parent = 0);
/**
* Creates button with no NoGroup position.
*/
explicit KoGroupButton(QWidget* parent = 0);
- virtual ~KoGroupButton();
+ ~KoGroupButton() override;
void setGroupPosition(KoGroupButton::GroupPosition groupPosition);
KoGroupButton::GroupPosition groupPosition() const;
protected:
- virtual void paintEvent(QPaintEvent* event);
+ void paintEvent(QPaintEvent* event) override;
private:
class Private;
Private *const d;
};
#endif /* KOGROUPBUTTON_H */
diff --git a/libs/widgetutils/KoProgressBar.h b/libs/widgetutils/KoProgressBar.h
index 0aa7babbf3..3d0087ac58 100644
--- a/libs/widgetutils/KoProgressBar.h
+++ b/libs/widgetutils/KoProgressBar.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2009
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPROGRESSBAR_H
#define KOPROGRESSBAR_H
#include <QProgressBar>
#include <KoProgressProxy.h>
#include "kritawidgetutils_export.h"
/**
* KoProgressBar is a thin wrapper around QProgressBar that also implements
* the abstract base class KoProgressProxy. Use this class, not QProgressBar
* to pass to KoProgressUpdater.
*/
class KRITAWIDGETUTILS_EXPORT KoProgressBar : public QProgressBar, public KoProgressProxy
{
Q_OBJECT
public:
explicit KoProgressBar(QWidget *parent = 0);
- ~KoProgressBar();
+ ~KoProgressBar() override;
- int maximum() const;
- void setValue(int value);
- void setRange(int minimum, int maximum);
- void setFormat(const QString &format);
+ int maximum() const override;
+ void setValue(int value) override;
+ void setRange(int minimum, int maximum) override;
+ void setFormat(const QString &format) override;
Q_SIGNALS:
void done();
};
#endif
diff --git a/libs/widgetutils/KoProgressUpdater.h b/libs/widgetutils/KoProgressUpdater.h
index f40c792ac4..270292860f 100644
--- a/libs/widgetutils/KoProgressUpdater.h
+++ b/libs/widgetutils/KoProgressUpdater.h
@@ -1,140 +1,140 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPROGRESSUPDATER_H
#define KOPROGRESSUPDATER_H
#include "kritawidgetutils_export.h"
#include <QString>
#include <QObject>
#include <QPointer>
class KoUpdater;
class KoProgressProxy;
class QTextStream;
class QTime;
/**
* Allow multiple subtasks to safely update and report progress.
* This class is able to update a progress bar with the total progress
* of a project that may be separated into different subtasks.
* Each subtask will use one KoUpdater which that subtask can then report
* progress to. Each KoUpdater.setProgress() call will automatically calculate
* the total progress over the whole tasks made and update the progress bar
* with the total progress so far.
*
* This class is created specifically with threading in mind so that subtasks
* can report their progress from their personal subthread and the progress bar
* will be updated correctly and not more often than repaints can occur.
*
* Typical usage can be:
* @code
KoProgressUpdater *pu = new KoProgressUpdater(myProgressBar);
pu->start(100);
// create the subtasks
KoUpdater smooth = pu->startSubtask(5);
KoUpdater scale = pu->startSubtask(5);
KoUpdater cleanup = pu->startSubtask(1);
@endcode
* Doing a smooth.setProgress(50) will move the progress bar to 50% of the share
* of task 'smooth' which is 5 / 11 of the total and thus to 22.
*
* KoProgressUpdater should be created in the main thread;
* KoProgressProxy must be, if it is gui subclass in the QApplication
* main thread. The other objects can be created in whatever thread
* one wants.
*
* Also to prevent jumps in the progress-calculation and -display it is recommed
* to first create all the subtasks and then start to use setProgress on them.
*/
class KRITAWIDGETUTILS_EXPORT KoProgressUpdater : public QObject
{
Q_OBJECT
public:
enum Mode {
Threaded,
Unthreaded
};
/**
* Constructor.
* @param progressBar the progress bar to update.
*/
explicit KoProgressUpdater(KoProgressProxy *progressBar, Mode mode = Threaded);
/// destructor
- virtual ~KoProgressUpdater();
+ ~KoProgressUpdater() override;
/**
* Start a new task.
*
* This will invalidate any previously created subtasks and set
* the range of the progressBar as well as the text in the
* progressbar.
*
* @param range the total range of progress bar makes.
* @param text The text to show in the progressBar.
* @see KoProgressProxy::setRange()
* @see KoProgressProxy::setFormat()
*/
void start(int range = 100, const QString &text = QLatin1String("%p%"));
/**
* After calling start() you can create any number of Updaters,
* one for each subtask. @param weight use a weight to specify the
* weight this subtask has compared to the rest of the subtasks.
*
* KoProgressUpdater will delete the KoUpdater instances when a
* start() is called or when it is deleted. The KoUpdater pointers
* are packed in a QPointer so you can check whether they have
* been deleted before dereferencing.
*/
QPointer<KoUpdater> startSubtask(int weight=1,
const QString &name = QString());
/**
* Cancelling the action will make each subtask be marked as 'interrupted' and
* set the total progress to 100%.
*/
void cancel();
/**
* @return true when the processing is interrupted
*/
bool interrupted() const;
private Q_SLOTS:
void update();
void updateUi();
private:
class Private;
Private *const d;
};
#endif
diff --git a/libs/widgetutils/KoUpdater.h b/libs/widgetutils/KoUpdater.h
index 333444e011..f4dd208e92 100644
--- a/libs/widgetutils/KoUpdater.h
+++ b/libs/widgetutils/KoUpdater.h
@@ -1,129 +1,129 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_UPDATER_H
#define KO_UPDATER_H
#include "KoProgressProxy.h"
#include <QObject>
#include <QPointer>
class KoProgressUpdater;
class KoUpdaterPrivate;
/**
* An KoUpdater is a helper for keeping the progress of each subtask up to speed.
* This class is not thread safe, and it should only be used from one thread.
* The thread it is used in can be different from any other subtask or the
* KoProgressUpdater, though.
*
* It is possible to create a KoProgressUpdater on a KoUpdater for when you
* need to recursively split up progress reporting. (For instance, when your
* progress reporting routine can be called by other progress reporting
* routines.)
*
* KoUpdater implements KoProgressProxy because it is possible to recursively
* create another KoProgressUpdater with an updater as progress proxy.
*
* @see KoProgressUpdater::startSubtask()
*/
class KRITAWIDGETUTILS_EXPORT KoUpdater : public QObject, public KoProgressProxy {
Q_OBJECT
public:
/**
* Call this when this subtask wants to abort all the actions.
*/
void cancel();
public Q_SLOTS:
/**
* Update your progress. Progress is always from 0 to 100.
* The global progress shown to the user is determined by the total
* amount of subtasks there are. This means that each subtasks can just
* report its own private progress in the range from 0 to 100.
*/
void setProgress(int percent);
public:
/**
* return true when this task should stop processing immediately.
* When the task has been cancelled all the subtasks will get interrupted
* and should stop working. It is therefor important to have repeated calls to
* this method at regular (time) intervals and as soon as the method returns true
* cancel the subtask.
* @return true when this task should stop processing immediately.
*/
bool interrupted() const;
/**
* return the progress this subtask has made.
*/
int progress() const;
public: // KoProgressProxy implementation
- int maximum() const;
- void setValue( int value );
- void setRange( int minimum, int maximum );
- void setFormat( const QString & format );
+ int maximum() const override;
+ void setValue( int value ) override;
+ void setRange( int minimum, int maximum ) override;
+ void setFormat( const QString & format ) override;
Q_SIGNALS:
/// emitted whenever the subtask has called cancel on us
void sigCancel();
/// emitted whenever the subtask has called setProgress on us
void sigProgress( int percent );
protected:
friend class KoProgressUpdater;
KoUpdater(KoUpdaterPrivate *p);
public:
QPointer<KoUpdaterPrivate> d;
int range;
int min;
int max;
private Q_SLOTS:
void interrupt();
private:
bool m_interrupted;
int m_progressPercent;
};
/// An updater that does nothing
class KRITAWIDGETUTILS_EXPORT KoDummyUpdater : public KoUpdater
{
public:
KoDummyUpdater();
};
#endif
diff --git a/libs/widgetutils/KoUpdaterPrivate_p.h b/libs/widgetutils/KoUpdaterPrivate_p.h
index fd9fb1a4ec..5e6bb92f62 100644
--- a/libs/widgetutils/KoUpdaterPrivate_p.h
+++ b/libs/widgetutils/KoUpdaterPrivate_p.h
@@ -1,96 +1,96 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_UPDATERPRIVATE__P_H
#define KO_UPDATERPRIVATE__P_H
#include "KoProgressUpdater.h"
#include <QTime>
#include <QVector>
/**
* KoUpdaterPrivate is the gui-thread side of KoUpdater. Communication
* between KoUpdater and KoUpdaterPrivate is handled through queued
* connections -- this is the main app thread part of the
* KoUpdater-KoUpdaterPrivate bridge.
*
* The gui thread can iterate over its list of KoUpdaterPrivate
* instances for the total progress computation: the queued signals
* from the threads will only arrive when the eventloop in the gui
* thread has a chance to deliver them.
*/
class KoUpdaterPrivate : public QObject
{
Q_OBJECT
public:
KoUpdaterPrivate(KoProgressUpdater *parent, int weight, const QString& name)
: QObject(0)
, m_progress(0)
, m_weight(weight)
, m_interrupted(false)
, m_parent(parent)
{
setObjectName(name);
}
/// when deleting an updater, make sure the accompanying thread is
/// interrupted, too.
- virtual ~KoUpdaterPrivate();
+ ~KoUpdaterPrivate() override;
bool interrupted() const { return m_interrupted; }
int progress() const { return m_progress; }
int weight() const { return m_weight; }
public Q_SLOTS:
/// Cancel comes from KoUpdater
void cancel();
/// Interrupt comes from the gui, through KoProgressUpdater, goes
/// to KoUpdater to signal running tasks they might as well quit.
void interrupt();
/// progress comes from KoUpdater
void setProgress( int percent );
Q_SIGNALS:
/// Emitted whenever the progress changed
void sigUpdated();
/// Emitted whenever the parent KoProgressUpdater is interrupted,
/// for instance through a press on a cancel button
void sigInterrupted();
private:
int m_progress; // always in percent
int m_weight;
bool m_interrupted;
KoProgressUpdater *m_parent;
};
#endif
diff --git a/libs/widgetutils/config/kcolorschememanager.h b/libs/widgetutils/config/kcolorschememanager.h
index 19bcf761aa..71fde0ca6e 100644
--- a/libs/widgetutils/config/kcolorschememanager.h
+++ b/libs/widgetutils/config/kcolorschememanager.h
@@ -1,121 +1,121 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KCOLORSCHEMEMANAGER_H
#define KCOLORSCHEMEMANAGER_H
#include <kritawidgetutils_export.h>
#include <QObject>
class QAbstractItemModel;
class KActionMenu;
class KColorSchemeManagerPrivate;
/**
* A small helper to get access to all available color schemes and activating a scheme in the
* QApplication. This is useful for applications which want to provide a selection of custom color
* schemes to their user. For example it is very common for photo and painting applications to use
* a dark color scheme even if the default is a light scheme.
*
* The KColorSchemeManager provides access to a QAbstractItemModel which holds all the available
* schemes. A possible usage looks like the following:
*
* @code
* KColorSchemeManager *schemes = new KColorSchemeManager(this);
* QListView *view = new QListView(this);
* view->setModel(schemes->model());
* connect(view, &QListView::activated, schemes, &KColorSchemeManager::activateScheme);
* @endcode
*
* In addition the KColorSchemeManager also provides the possibility to create a KActionMenu populated
* with all the available color schemes in an action group. If one of the actions is selected the
* scheme is applied instantly:
*
* @code
* QToolButton *button = new QToolButton();
* KColorSchemeManager *schemes = new KColorSchemeManager(this);
* KActionMenu *menu = schemes->createSchemeSelectionMenu(QStringLiteral("Oxygen"), button);
* button->setMenu(menu->menu());
* @endcode
*
* @since 5.0
*/
class KRITAWIDGETUTILS_EXPORT KColorSchemeManager : public QObject
{
Q_OBJECT
public:
explicit KColorSchemeManager(QObject *parent = 0);
- virtual ~KColorSchemeManager();
+ ~KColorSchemeManager() override;
/**
* A QAbstractItemModel of all available color schemes.
*
* The model provides the name of the scheme in Qt::DisplayRole, a preview
* in Qt::DelegateRole and the full path to the scheme file in Qt::UserRole.
*
* @return Model of all available color schemes.
*/
QAbstractItemModel *model() const;
/**
* Returns the model index for the scheme with the given @p name. If no such
* scheme exists an invalid index is returned.
* @see model
*/
QModelIndex indexForScheme(const QString &name) const;
/**
* Creates a KActionMenu populated with all the available color schemes.
* All actions are in an action group and when one of the actions is triggered the scheme
* referenced by this action is activated.
*
* The color scheme with the same name as @p selectedSchemeName will be checked. If none
* of the available color schemes has the same name, no action will be checked.
*
* The KActionMenu will not be updated in case the installed color schemes change. It's the
* task of the user of the KActionMenu to monitor for changes if required.
*
* @param icon The icon to use for the KActionMenu
* @param text The text to use for the KActionMenu
* @param selectedSchemeName The name of the color scheme to select
* @param parent The parent of the KActionMenu
* @return KActionMenu populated with all available color schemes.
* @see activateScheme
*/
KActionMenu *createSchemeSelectionMenu(const QIcon &icon, const QString &text, const QString &selectedSchemeName, QObject *parent);
KActionMenu *createSchemeSelectionMenu(const QString &text, const QString &selectedSchemeName, QObject *parent);
KActionMenu *createSchemeSelectionMenu(const QString &selectedSchemeName, QObject *parent);
public Q_SLOTS:
/**
* @brief Activates the KColorScheme identified by the provided @p index.
*
* Installs the KColorScheme as the QApplication's QPalette.
*
* @param index The index for the KColorScheme to activate.
* The index must reference the QAbstractItemModel provided by @link model
* @see model()
*/
void activateScheme(const QModelIndex &index);
private:
QScopedPointer<KColorSchemeManagerPrivate> d;
};
#endif
diff --git a/libs/widgetutils/config/kcolorschememanager_p.h b/libs/widgetutils/config/kcolorschememanager_p.h
index 9302fff031..5600e20b0e 100644
--- a/libs/widgetutils/config/kcolorschememanager_p.h
+++ b/libs/widgetutils/config/kcolorschememanager_p.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KCOLORSCHEMEMANAGER_P_H
#define KCOLORSCHEMEMANAGER_P_H
#include <QAbstractListModel>
#include <QIcon>
struct KColorSchemeModelData {
QString name;
QString path;
QIcon preview;
};
class KColorSchemeModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit KColorSchemeModel(QObject *parent = 0);
- virtual ~KColorSchemeModel();
+ ~KColorSchemeModel() override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
private:
void init();
QIcon createPreview(const QString &path);
QVector<KColorSchemeModelData> m_data;
};
class KColorSchemeManagerPrivate
{
public:
KColorSchemeManagerPrivate();
QScopedPointer<KColorSchemeModel> model;
};
#endif
diff --git a/libs/widgetutils/config/klanguagebutton.h b/libs/widgetutils/config/klanguagebutton.h
index b0c82b85b8..dbe8eeb098 100644
--- a/libs/widgetutils/config/klanguagebutton.h
+++ b/libs/widgetutils/config/klanguagebutton.h
@@ -1,175 +1,175 @@
/*
* klangbutton.h - Button with language selection drop down menu.
* Derived from the KLangCombo class by Hans Petter Bieker.
*
* Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
* (c) 2001 Martijn Klingens <klingens@kde.org>
* (c) 2007 David Jarvie <software@astrojar.org.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KLANGUAGEBUTTON_H
#define KLANGUAGEBUTTON_H
#include "kritawidgetutils_export.h"
#include <QWidget>
class QAction;
class KLanguageButtonPrivate;
/**
* KLanguageButton is a pushbutton which allows a language to be selected from
* a popup list.
*
* Languages are identified by their ISO 639-1 codes, e.g. en, pt_BR.
*
* \image html klanguagebutton.png "KDE Language Selection Widget"
*
* @author Hans Petter Bieker <bieker@kde.org>, Martijn Klingens <klingens@kde.org>,
* David Jarvie <software@astrojar.org.uk>
*/
class KRITAWIDGETUTILS_EXPORT KLanguageButton : public QWidget
{
Q_OBJECT
public:
/**
* Constructs a button whose text is determined by the current language
* in the popup list.
*
* @param parent the parent of the button
*/
explicit KLanguageButton(QWidget *parent = 0);
/**
* Constructs a button with static text.
*
* @param text the text of the button
* @param parent the parent of the button
*/
explicit KLanguageButton(const QString &text, QWidget *parent = 0);
/**
* Deconstructor
*/
- virtual ~KLanguageButton();
+ ~KLanguageButton() override;
/**
* Sets the locale to display language names. By default, QLocale::system().name() is used.
*
* @param locale locale to use
*/
void setLocale(const QString &locale);
/**
* Sets a static button text.
*
* @param text button text
*/
void setText(const QString &text);
/**
* Specifies whether language codes should be shown alongside language names
* in the popup. Calling this method does not affect any previously
* inserted language texts, so it should normally be called before
* populating the list.
*
* @param show true to show codes, false to hide codes
*/
void showLanguageCodes(bool show);
/**
* Load all known languages into the popup list.
* The current language in the list is set to the default language for the
* current locale (as modified by setLocale()).
*/
void loadAllLanguages();
/**
* Inserts a language into the combo box.
* Normally the display name of the language is obtained automatically, but
* if either the language code does not exist, or there are special display
* requirements, the name of the language can be specified in @p name.
*
* @param languageCode the code for the language
* @param name language name. If empty, the name is obtained automatically.
* @param index the insertion position, or -1 to insert in alphabetical order
*/
void insertLanguage(const QString &languageCode, const QString &name = QString(), int index = -1);
/**
* Inserts a separator item into the combo box. A negative index will append the item.
*
* @param index the insertion position
*/
void insertSeparator(int index = -1);
/**
* Returns the number of items in the combo box.
*/
int count() const;
/**
* Removes all combobox items.
*/
void clear();
/**
* Returns the language code of the combobox's current item.
*
* @return the current item's language code
*/
QString current() const;
/**
* Checks whether the specified language is in the popup list.
*
* @param languageCode the language's code
* @return true if in the list
*/
bool contains(const QString &languageCode) const;
/**
* Sets a given language to be the current item.
*
* @param languageCode the language's code
*/
void setCurrentItem(const QString &languageCode);
Q_SIGNALS:
/**
* This signal is emitted when a new item is activated.
*
* @param languageCode code of the activated language
*/
void activated(const QString &languageCode);
/**
* This signal is emitted when a new item is highlighted.
*
* @param languageCode code of the highlighted language
*/
void highlighted(const QString &languageCode);
private Q_SLOTS:
void slotTriggered(QAction *);
void slotHovered(QAction *);
private:
KLanguageButtonPrivate *const d;
};
#endif
diff --git a/libs/widgetutils/config/krecentfilesaction.h b/libs/widgetutils/config/krecentfilesaction.h
index 5661cf85e0..7f19087e80 100644
--- a/libs/widgetutils/config/krecentfilesaction.h
+++ b/libs/widgetutils/config/krecentfilesaction.h
@@ -1,193 +1,193 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2003 Andras Mantia <amantia@kde.org>
(C) 2005-2006 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KRECENTFILESACTION_H
#define KRECENTFILESACTION_H
#include <kselectaction.h>
#include <qurl.h>
#include <kritawidgetutils_export.h>
class KConfigGroup;
class KRecentFilesActionPrivate;
/**
* @short Recent files action
*
* This class is an action to handle a recent files submenu.
* The best way to create the action is to use KStandardAction::openRecent.
* Then you simply need to call loadEntries on startup, saveEntries
* on shutdown, addURL when your application loads/saves a file.
*
* @author Michael Koch
*/
class KRITAWIDGETUTILS_EXPORT KRecentFilesAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY(int maxItems READ maxItems WRITE setMaxItems)
Q_DECLARE_PRIVATE(KRecentFilesAction)
public:
/**
* Constructs an action with the specified parent.
*
* @param parent The parent of this action.
*/
explicit KRecentFilesAction(QObject *parent);
/**
* Constructs an action with text; a shortcut may be specified by
* the ampersand character (e.g. \"&amp;Option\" creates a shortcut with key \e O )
*
* This is the most common KAction used when you do not have a
* corresponding icon (note that it won't appear in the current version
* of the "Edit ToolBar" dialog, because an action needs an icon to be
* plugged in a toolbar...).
*
* @param text The text that will be displayed.
* @param parent The parent of this action.
*/
KRecentFilesAction(const QString &text, QObject *parent);
/**
* Constructs an action with text and an icon; a shortcut may be specified by
* the ampersand character (e.g. \"&amp;Option\" creates a shortcut with key \e O )
*
* This is the other common KAction used. Use it when you
* \e do have a corresponding icon.
*
* @param icon The icon to display.
* @param text The text that will be displayed.
* @param parent The parent of this action.
*/
KRecentFilesAction(const QIcon &icon, const QString &text, QObject *parent);
/**
* Destructor.
*/
- virtual ~KRecentFilesAction();
+ ~KRecentFilesAction() override;
/**
* Adds \a action to the list of URLs, with \a url and title \a name.
*
* Do not use addAction(QAction*), as no url will be associated, and
* consequently urlSelected() will not be emitted when \a action is selected.
*/
void addAction(QAction *action, const QUrl &url, const QString &name);
/**
* Reimplemented for internal reasons.
*/
QAction *removeAction(QAction *action) override;
public Q_SLOTS:
/**
* Clears the recent files list.
* Note that there is also an action shown to the user for clearing the list.
*/
virtual void clear();
public:
/**
* Returns the maximum of items in the recent files list.
*/
int maxItems() const;
/**
* Sets the maximum of items in the recent files list.
* The default for this value is 10 set in the constructor.
*
* If this value is lesser than the number of items currently
* in the recent files list the last items are deleted until
* the number of items are equal to the new maximum.
*/
void setMaxItems(int maxItems);
/**
* Loads the recent files entries from a given KConfigGroup object.
* You can provide the name of the group used to load the entries.
* If the groupname is empty, entries are loaded from a group called 'RecentFiles'.
* Local file entries that do not exist anymore are not restored.
*
*/
void loadEntries(const KConfigGroup &config);
/**
* Saves the current recent files entries to a given KConfigGroup object.
* You can provide the name of the group used to load the entries.
* If the groupname is empty, entries are saved to a group called 'RecentFiles'
*
*/
void saveEntries(const KConfigGroup &config);
/**
* Add URL to recent files list.
*
* @param url The URL of the file
* @param name The user visible pretty name that appears before the URL
*/
void addUrl(const QUrl &url, const QString &name = QString());
/**
* Remove an URL from the recent files list.
*
* @param url The URL of the file
*/
void removeUrl(const QUrl &url);
/**
* Retrieve a list of all URLs in the recent files list.
*/
QList<QUrl> urls() const;
Q_SIGNALS:
/**
* This signal gets emitted when the user selects an URL.
*
* @param url The URL thats the user selected.
*/
void urlSelected(const QUrl &url);
/**
* This signal gets emitted when the user clear list.
* So when user store url in specific config file it can saveEntry.
* @since 4.3
*/
void recentListCleared();
private:
//Internal
void clearEntries();
// Don't warn about the virtual overload. As the comment of the other
// addAction() says, addAction( QAction* ) should not be used.
using KSelectAction::addAction;
KRecentFilesActionPrivate *d_ptr;
Q_PRIVATE_SLOT(d_func(), void _k_urlSelected(QAction *))
};
#endif
diff --git a/libs/widgetutils/kis_spin_box_unit_manager.h b/libs/widgetutils/kis_spin_box_unit_manager.h
index c0d44ffeb1..486578f5e8 100644
--- a/libs/widgetutils/kis_spin_box_unit_manager.h
+++ b/libs/widgetutils/kis_spin_box_unit_manager.h
@@ -1,164 +1,164 @@
/*
* Copyright (c) 2017 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSPINBOXUNITMANAGER_H
#define KISSPINBOXUNITMANAGER_H
#include <QObject>
#include <QStringList>
#include <QAbstractListModel>
#include "kritawidgetutils_export.h"
class KisSpinBoxUnitManager;
class KisSpinBoxUnitManagerBuilder;
class KisSpinBoxUnitManagerFactory;
/*!
* \brief The KisSpinBoxUnitManagerFactory class is a factory that is used to build a default KisSpinBoxUnitManager.
* \see KisSpinBoxUnitManagerBuilder
*/
class KRITAWIDGETUTILS_EXPORT KisSpinBoxUnitManagerFactory
{
public:
static KisSpinBoxUnitManager* buildDefaultUnitManager(QObject* parent);
//! \brief set a builder the factory can use. The factory should take on the lifecycle of the builder, so to delete it call clearUnitManagerBuilder();
static void setDefaultUnitManagerBuilder(KisSpinBoxUnitManagerBuilder* pBuilder);
static void clearUnitManagerBuilder();
private:
static KisSpinBoxUnitManagerBuilder* builder;
};
/*!
* \brief The KisSpinBoxUnitManagerBuilder class is the base class, used in the strategy pattern of KisSpinBoxUnitManagerFactory.
* \see KisSpinBoxUnitManagerFactory.
*/
class KRITAWIDGETUTILS_EXPORT KisSpinBoxUnitManagerBuilder
{
public:
virtual ~KisSpinBoxUnitManagerBuilder() {}
virtual KisSpinBoxUnitManager* buildUnitManager(QObject* parent) = 0; //this pure virtual function is used to build a unitmanager, it will be used by the unitManagerFactory.
};
/**
* @brief The KisSpinBoxUnitManager class is an abstract interface for the unitspinboxes classes to manage different type of units.
*
* The class make a difference between unit dimension (distance, angle, time).
*
* The class allow to convert values between reference unit and apparent unit, but also to get other informations like possible units symbols.
*
* This class don't allow to use relative units (units which conversion factor is dependant of the context), even if its private data are prepared to manage it.
* The reason for this is that from the library of this class it is very hard to acess easily the informations needed. So all will be managed by subclasses in other libs.
*
* The class is a subclass of QAbstractListModel, so that available list of units is easily acessed by other Qt standard components, like QComboBoxes.
*
*/
class KRITAWIDGETUTILS_EXPORT KisSpinBoxUnitManager : public QAbstractListModel
{
Q_OBJECT
public:
enum UnitDimension{
LENGTH = 0, //length, print size, reference is point
IMLENGTH = 1, //length, image size, reference is pixel. This dimension is used when the printing units must be avoided
ANGLE = 2,
TIME = 3
};
static inline bool isUnitId(int code) { return (code == LENGTH || code == ANGLE || code == TIME); }
//! \brief this list hold the symbols of the referenc unit per dimension. The index is equal to the value in UnitDimension so that the dimension name can be used to index the list.
static const QStringList referenceUnitSymbols;
enum Constrain{
NOCONSTR = 0,
REFISINT = 1,
VALISINT = 2
};
Q_DECLARE_FLAGS(Constrains, Constrain)
explicit KisSpinBoxUnitManager(QObject *parent = 0);
- virtual ~KisSpinBoxUnitManager();
+ ~KisSpinBoxUnitManager() override;
int getUnitDimensionType() const;
QString getReferenceUnitSymbol() const;
QString getApparentUnitSymbol() const;
//! \brief get the position of the apparent unit in the list of units. It is usefull if we want to build a model for combo-box based unit management.
int getApparentUnitId() const;
virtual QStringList getsUnitSymbolList(bool withName = false) const;
qreal getReferenceValue(double apparentValue) const;
qreal getApparentValue(double refValue) const;
//! \brief gets the conversion factor of a managed unit, or -1 in case of error. This method is the one that need to be overridden to extend the ability of the KisSpinBoxUnitManager.
virtual qreal getConversionFactor(int dim, QString symbol) const;
//! \brief some units conversions are done via an affine transform, not just a linear transform. This function gives the constant of this affine transform (usually 0).
virtual qreal getConversionConstant(int dim, QString symbol) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
Q_SIGNALS:
void unitDimensionChanged(int dimCode);
void unitAboutToChange();
void unitChanged(QString symbol);
void unitChanged(int index);
void conversionFactorChanged(qreal newConversionFactor, qreal oldConversionFactor) const;
void conversionConstantChanged(qreal newConversionFactor, qreal oldConversionFactor) const;
void unitListChanged();
public Q_SLOTS:
void setUnitDimension(UnitDimension dimension);
void setApparentUnitFromSymbol(QString pSymbol);
void selectApparentUnitFromIndex(int index);
protected:
class Private;
Private * d;
//! \brief convert a unitChanged signal with a QString to one with an index.
void newUnitSymbolToUnitIndex(QString symbol);
//unit's that may be used only if acess to the document informations exists.
static const QStringList documentRelativeLengthUnitSymbols;
static const QStringList documentRelativeTimeUnitSymbols;
void recomputeConversionFactor() const;
void recomputeConvesrionConstant() const;
//! \brief calling this method give acess to document relative units. Only subclasses that manage thoses units should call it.
void grantDocumentRelativeUnits();
};
#endif // KISSPINBOXUNITMANAGER_H
diff --git a/libs/widgetutils/xmlgui/KisShortcutsDialog.h b/libs/widgetutils/xmlgui/KisShortcutsDialog.h
index 756c742475..b275f02fb3 100644
--- a/libs/widgetutils/xmlgui/KisShortcutsDialog.h
+++ b/libs/widgetutils/xmlgui/KisShortcutsDialog.h
@@ -1,178 +1,178 @@
/* This file is part of the KDE libraries
Copyright (C) 1997 Nicolas Hadacek <hadacek@kde.org>
Copyright (C) 2001 Ellis Whitehead <ellis@kde.org>
Copyright (C) 2006 Hamish Rodda <rodda@kde.org>
Copyright (C) 2007 Roberto Raggi <roberto@kdevelop.org>
Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
Copyright (C) 2015 Michael Abrahams <miabraha@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KISSHORTCUTSDIALOG_H
#define KISSHORTCUTSDIALOG_H
#include <QDialog>
#include <KisShortcutsEditor.h>
// Altering this class and some classes it uses was one major impetus behind
// forking XmlGui. The first major workaround was to allow
// KisPart::configureShortcuts() to pull up the dialog, and to remote the scheme
// editor support, since it's incompatible with Krita.
//
// The files were forked from KF5 XmlGui version 5.12.0
// dialogs/KisShortcutsEditorItem.cpp <- kshortcutseditoritem.cpp
// dialogs/KisShortcutEditWidget.cpp <- kshortcuteditwidget.cpp
// dialogs/KisShortcutsEditorDelegate.cpp <- kshortcutseditordelegate.cpp
// dialogs/KisShortcutsDialog.cpp <- kshortcutsdialog.cpp, , kshortcutsdialog_p.cpp
// dialogs/KisShortcutsDialog.h <- kshortcutsdialog.h
// dialogs/KisShortcutsDialog_p.h <- kshortcutsdialog_p.h, kshortcutseditor_p.h
// forms/KisShortcutsDialog.ui <- kshortcutsdialog.ui
//
//
// Changes that have been done to the files:
// * Adapt of includes
// * Removing unwanted parts related to schemes
// * Renamed KShortcutsDialog/Editor to KisShortcutsDialog/Editor
// * Add export macro
// * Split apart kshortcutseditor_p
// * Copied KShortcutsEditorPrivate::itemFromIndex() implmentation from
// KF5 XmlGui's kshortcutseditor.cpp to begin of KisShortcutsEditorItem.cpp
/**
* @short Dialog for configuration of KActionCollection and KGlobalAccel.
*
* The KisShortcutsDialog class is used for configuring dictionaries of
* key/action associations for KActionCollection and KGlobalAccel. It uses the
* KShortcutsEditor widget and offers buttons to set all keys to defaults and
* invoke on-line help.
*
* Several static methods are supplied which provide the most convenient
* interface to the dialog. The most common and most encouraged use is with
* KActionCollection.
*
* \code
* KisShortcutsDialog::configure( actionCollection() );
* \endcode
*
* @since 4.3 By default this dialog is modal. If you don't want that,
* setModal(false) and then the non-static configure() will show the dialog. If
* you want to do anything extra when the dialog is done, connect to okClicked()
* and/or cancelClicked(). However, if your extra stuff depends on the changed
* settings already being saved, connect to saved() instead to be safe; if you
* connect to okClicked() your function might be called before the save happens.
*
* example:
* \code
* KisShortcutsDialog dlg;
* dlg.addCollection(myActions);
* dlg.setModal(false);
* connect(&dlg, SIGNAL(saved()), this, SLOT(doExtraStuff()));
* dlg.configure();
* \endcode
*
* \image html kshortcutsdialog.png "KDE Shortcuts Dialog"
*
* @author Nicolas Hadacek <hadacek@via.ecp.fr>
* @author Hamish Rodda <rodda@kde.org> (KDE 4 porting)
* @author Michael Jansen <kde@michael-jansen.biz>
*/
const auto defaultActionTypes = KisShortcutsEditor::WidgetAction \
| KisShortcutsEditor::WindowAction \
| KisShortcutsEditor::ApplicationAction;
class KRITAWIDGETUTILS_EXPORT KisShortcutsDialog : public QWidget
{
Q_OBJECT
public:
/**
* Constructs a KisShortcutsDialog. Mostly UI boilerplate.
*
* @param allowLetterShortcuts set to KisShortcutsEditor::LetterShortcutsDisallowed if unmodified alphanumeric
* keys ('A', '1', etc.) are not permissible shortcuts.
*
* @param parent the parent widget to attach to
*
* There is some legacy support for global (i.e. desktop-wide) shortucts
* that should probably be removed.
*/
explicit KisShortcutsDialog(KisShortcutsEditor::ActionTypes types = defaultActionTypes,
KisShortcutsEditor::LetterShortcuts allowLetterShortcuts \
= KisShortcutsEditor::LetterShortcutsAllowed,
QWidget *parent = 0);
- virtual ~KisShortcutsDialog();
+ ~KisShortcutsDialog() override;
/**
* Add all actions of the collection to the ones displayed and configured
* by the dialog. This is where the business happens.
*
* @param title the title associated with the collection.
*/
void addCollection(KActionCollection *, const QString &title = QString());
/**
* @return the list of action collections that are available for configuration in the dialog.
*/
QList<KActionCollection *> actionCollections() const;
/** @see QWidget::sizeHint() */
QSize sizeHint() const override;
/**
* Called when the "OK" button in the main configuration page is pressed.
*/
void save();
void allDefault();
void undo();
/**
* Import shortcut scheme file from @p path
*/
void importConfiguration(const QString &path);
/**
* Exports shortcut scheme file to @p path
*/
void exportConfiguration(const QString &path) const;
/**
* Import custom shortcuts from @p path
*/
void loadCustomShortcuts(const QString &path);
/**
* Exports custom shortcuts to @p path
*/
void saveCustomShortcuts(const QString &path) const;
private:
Q_PRIVATE_SLOT(d, void changeShortcutScheme(const QString &))
Q_PRIVATE_SLOT(d, void undo())
class KisShortcutsDialogPrivate;
class KisShortcutsDialogPrivate *const d;
Q_DISABLE_COPY(KisShortcutsDialog)
};
#endif // KISSHORTCUTSDIALOG_H
diff --git a/libs/widgetutils/xmlgui/KisShortcutsEditor.h b/libs/widgetutils/xmlgui/KisShortcutsEditor.h
index b9e5c65666..ba009e7b92 100644
--- a/libs/widgetutils/xmlgui/KisShortcutsEditor.h
+++ b/libs/widgetutils/xmlgui/KisShortcutsEditor.h
@@ -1,253 +1,253 @@
/* This file is part of the KDE libraries
Copyright (C) 1997 Nicolas Hadacek <hadacek@kde.org>
Copyright (C) 2001,2001 Ellis Whitehead <ellis@kde.org>
Copyright (C) 2006 Hamish Rodda <rodda@kde.org>
Copyright (C) 2007 Roberto Raggi <roberto@kdevelop.org>
Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KISSHORTCUTSEDITOR_H
#define KISSHORTCUTSEDITOR_H
#include <kritawidgetutils_export.h>
#include <QWidget>
class KActionCollection;
class KConfig;
class KConfigBase;
class KConfigGroup;
class KGlobalAccel;
class KisShortcutsEditorPrivate;
/**
* WARNING: KisShortcutsEditor expects that the list of existing shortcuts is
* already free of conflicts. If it is not, nothing will crash, but your users
* won't like the resulting behavior.
*
* TODO: Find the right place to check for conflicts.
*/
/**
* @short Widget for configuration of KAccel and KGlobalAccel.
*
* Configure dictionaries of key/action associations for KActions,
* including global shortcuts.
*
* The class takes care of all aspects of configuration, including
* handling key conflicts internally. Connect to the allDefault()
* slot if you want to set all configurable shortcuts to their
* default values.
*
* @see KShortcutsDialog
* @author Nicolas Hadacek <hadacek@via.ecp.fr>
* @author Hamish Rodda <rodda@kde.org> (KDE 4 porting)
* @author Michael Jansen <kde@michael-jansen.biz>
*/
class KRITAWIDGETUTILS_EXPORT KisShortcutsEditor : public QWidget
{
Q_OBJECT
Q_PROPERTY(ActionTypes actionTypes READ actionTypes WRITE setActionTypes)
public:
/*
* These attempt to build some sort of characterization of all actions. The
* idea is to determine which sorts of actions will be configured in the
* dialog.
*
* Enumerating all possible actions is a sorrowful, pitiable endeavor,
* useless for Krita. We should do something about this.
*/
enum ActionType {
/// Actions which are triggered by any keypress in a widget which has the action added to it
WidgetAction = Qt::WidgetShortcut /*0*/,
/// Actions which are triggered by any keypress in a window which has the action added to it or its child widget(s)
WindowAction = Qt::WindowShortcut /*1*/,
/// Actions which are triggered by any keypress in the application
ApplicationAction = Qt::ApplicationShortcut /*2*/,
/// Actions which are triggered by any keypress in the windowing system
GlobalAction = 4,
/// All actions
AllActions = 0xffffffff
};
Q_DECLARE_FLAGS(ActionTypes, ActionType)
enum LetterShortcuts {
/// Shortcuts without a modifier are not allowed, so 'A' would not be
/// valid, whereas 'Ctrl+A' would be. This only applies to printable
/// characters, however. 'F1', 'Insert' etc. could still be used.
LetterShortcutsDisallowed = 0,
/// Letter shortcuts are allowed
LetterShortcutsAllowed
};
/**
* \overload
*
* Creates a key chooser without a starting action collection.
*
* @param parent parent widget
* @param actionTypes types of actions to display in this widget.
* @param allowLetterShortcuts set to LetterShortcutsDisallowed if unmodified alphanumeric
* keys ('A', '1', etc.) are not permissible shortcuts.
*/
explicit KisShortcutsEditor(QWidget *parent,
ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed);
/// Destructor
- virtual ~KisShortcutsEditor();
+ ~KisShortcutsEditor() override;
/**
* @ret true if there are unsaved changes.
*/
bool isModified() const;
/**
* Removes all action collections from the editor
*/
void clearCollections();
/**
* Clears search area
*/
void clearSearch();
/**
* Note: the reason this is so damn complicated is because it's supposed to
* support having multiple applications running inside of each other through
* KisParts. That means we have to be able to separate sections within each
* configuration file.
*
* Insert an action collection, i.e. add all its actions to the ones
* already associated with the KisShortcutsEditor object.
*
* @param title subtree title of this collection of shortcut.
*/
void addCollection(KActionCollection *, const QString &title = QString());
/**
* Undo all change made since the last commit().
*/
void undo();
/**
* Save the changes.
*
* Before saving the changes are committed. This saves the actions to disk.
* Any KActionCollection objects with the xmlFile() value set will be
* written to an XML file. All other will be written to the application's
* rc file.
*/
void save();
/**
* Update the dialog entries without saving.
*
* @since 4.2
*/
void commit();
/**
* Removes all configured shortcuts.
*/
void clearConfiguration();
/**
* Write the current custom shortcut settings to the \p config object.
*
* @param config Config object to save to. Default is kritashortcutsrc.
*
*/
void saveShortcuts(KConfigGroup *config = 0) const;
/**
* Write the current shortcuts to a new scheme to configuration file
*
* @param config Config object to save to.
*/
void exportConfiguration(KConfigBase *config) const;
/**
* Import a shortcut configuration file.
*
* @param config Config object to load from.
* @param isScheme true for shortcut scheme, false for custom shortcuts
*/
void importConfiguration(KConfigBase *config, bool isScheme);
/**
* Sets the types of actions to display in this widget.
*
* @param actionTypes New types of actions
* @since 5.0
*/
void setActionTypes(ActionTypes actionTypes);
/**
*
* @return The types of actions currently displayed in this widget.
* @since 5.0
*/
ActionTypes actionTypes() const;
Q_SIGNALS:
/**
* Emitted when an action's shortcut has been changed.
**/
void keyChange();
public Q_SLOTS:
/**
* Resize columns to width required
*/
void resizeColumns();
/**
* Set all shortcuts to their default values (bindings).
**/
void allDefault();
/**
* Opens a printing dialog to print all the shortcuts
*/
void printShortcuts() const;
/**
* Expand or collapse the tree view when the search text changes
*/
void searchUpdated(QString s);
private:
Q_PRIVATE_SLOT(d, void capturedShortcut(QVariant, const QModelIndex &))
private:
friend class KisShortcutsDialog;
friend class KisShortcutsEditorPrivate;
KisShortcutsEditorPrivate *const d;
Q_DISABLE_COPY(KisShortcutsEditor)
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KisShortcutsEditor::ActionTypes)
#endif // KISSHORTCUTSEDITOR_H
diff --git a/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h b/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h
index 598dd28052..759e61888f 100644
--- a/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h
+++ b/libs/widgetutils/xmlgui/KisShortcutsEditor_p.h
@@ -1,185 +1,185 @@
/**
* Copyright (C) 1997 Nicolas Hadacek <hadacek@kde.org>
* Copyright (C) 1998 Matthias Ettrich <ettrich@kde.org>
* Copyright (C) 2001 Ellis Whitehead <ellis@kde.org>
* Copyright (C) 2006 Hamish Rodda <rodda@kde.org>
* Copyright (C) 2007 Roberto Raggi <roberto@kdevelop.org>
* Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
* Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSHORTCUTSEDITOR_P
#define KISSHORTCUTSEDITOR_P
#include "KisShortcutsEditor.h"
#include <QTreeWidget>
#include <ktreewidgetsearchline.h>
#include "KisShortcutsDialog_p.h"
// NEEDED FOR KisShortcutsEditorPrivate
#include "ui_KisShortcutsDialog.h"
/// Declared at the end of the file - provides the basic storage unit for this class
class KisShortcutsEditorItem;
/**
* @internal
*/
class KisShortcutsEditorPrivate
{
public:
//! Represents the three hierarchies the dialog displays.
enum hierarchyLevel {Root = 0, /* Base level node (Tools, Krita...) */
Program, /* We use this like "Path Tool, Default Tool," */
Action}; /* Individual actions */
KisShortcutsEditorPrivate(KisShortcutsEditor *q);
void initGUI(KisShortcutsEditor::ActionTypes actionTypes, KisShortcutsEditor::LetterShortcuts allowLetterShortcuts);
void appendToView(uint nList, const QString &title = QString());
//used in appendToView
QTreeWidgetItem *findOrMakeItem(QTreeWidgetItem *parent, const QString &name);
// Set all shortcuts to their default values (bindings).
void allDefault();
// clear all shortcuts
void clearConfiguration();
//changeXXX were described as "conflict resolution functions"
void changeKeyShortcut(KisShortcutsEditorItem *item, uint column, const QKeySequence &capture);
//this invokes the appropriate conflict resolution function
void capturedShortcut(const QVariant &, const QModelIndex &);
/**
* Add @p action at hierchy level @p level.
*
* Filters out QActions (TODO: hmm) and unnamed actions before adding.
*
* @return true if the actions was successfully added
*/
bool addAction(QAction *action, QTreeWidgetItem *hier[], hierarchyLevel level);
void printShortcuts() const;
// TODO: Is this necessary w/o global actions?
void setActionTypes(KisShortcutsEditor::ActionTypes actionTypes);
// Members
QList<KActionCollection *> actionCollections;
KisShortcutsEditor *q;
Ui::KisShortcutsDialog ui;
KisShortcutsEditor::ActionTypes actionTypes;
KisShortcutsEditorDelegate *delegate;
};
// Hack to make two protected methods public.
// Used by both KisShortcutsEditorPrivate and KisShortcutsEditorDelegate
class QTreeWidgetHack : public QTreeWidget
{
public:
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const
{
return QTreeWidget::itemFromIndex(index);
}
QModelIndex indexFromItem(QTreeWidgetItem *item, int column) const
{
return QTreeWidget::indexFromItem(item, column);
}
};
/**
* A QTreeWidgetItem that can handle QActions. It also provides undo functionality.
*
* Call commit() to save pending changes.
*
* @internal
*/
class KisShortcutsEditorItem : public QTreeWidgetItem
{
public:
KisShortcutsEditorItem(QTreeWidgetItem *parent, QAction *action);
//! Destructor will erase unsaved changes.
- virtual ~KisShortcutsEditorItem();
+ ~KisShortcutsEditorItem() override;
//! Undo the changes since the last commit.
void undo();
//! Commit the changes.
void commit();
QVariant data(int column, int role = Qt::DisplayRole) const override;
bool operator<(const QTreeWidgetItem &other) const override;
QKeySequence keySequence(uint column) const;
void setKeySequence(uint column, const QKeySequence &seq);
bool isModified(uint column) const;
bool isModified() const;
void setNameBold(bool flag)
{
m_isNameBold = flag;
}
private:
friend class KisShortcutsEditorPrivate;
//! Recheck modified status - could have changed back to initial value
void updateModified();
//! The action this item is responsible for
QAction *m_action;
//! Should the Name column be painted in bold?
bool m_isNameBold{false};
//@{
//! The original shortcuts before user changes. 0 means no change.
QList<QKeySequence> *m_oldLocalShortcut{0};
//@}
//! The localized action name
QString m_actionNameInTable;
//! The action id. Needed for exporting and importing
QString m_id;
//! The collator, for sorting
QCollator m_collator;
};
#endif // KISSHORTCUTSEDITOR_P
diff --git a/libs/widgetutils/xmlgui/kactioncategory.h b/libs/widgetutils/xmlgui/kactioncategory.h
index 3e4a3c8520..c50cbf1c50 100644
--- a/libs/widgetutils/xmlgui/kactioncategory.h
+++ b/libs/widgetutils/xmlgui/kactioncategory.h
@@ -1,188 +1,188 @@
/* This file is part of the KDE libraries
Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KACTIONCATEGORY_H
#define KACTIONCATEGORY_H
#include <kritawidgetutils_export.h>
#include "config-xmlgui.h"
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QList>
#include <kstandardaction.h>
#include "kactioncollection.h"
struct KActionCategoryPrivate;
class QAction;
/**
* Categorize actions for KShortcutsEditor.
*
* KActionCategory provides a second level to organize the actions in
* KShortcutsEditor.
*
* The first possibility is using more than one action collection. Each
* actions collection becomes a top level node.
*
* + action collection 1
* + first action
* + second action
* + third action
* + action collection 2
* + first action
* + second action
* + third action
*
* Using KActionCategory it's possible to group the actions of one collection.
* + action collection 1
* + first action
* + first category
* + action 1 in category
* + action 2 in category
* + second action
*
* \section Usage
*
* The usage is analog to action collections. Just create a category and use
* it instead of the collection to create the actions.
*
* The synchronization between KActionCollection and KActionCategory is done
* internally. There is for example no need to remove actions from a category.
* It is done implicitely if the action is removed from the associated
* collection.
*
* \code
*
* KActionCategory *file = new KActionCategory(i18n("File"), actionCollection());
* file->addAction(
* KStandardAction::New, //< see KStandardAction
* this, //< Receiver
* SLOT(fileNew())); //< SLOT
*
* ... more actions added to file ...
*
* KActionCategory *edit = new KActionCategory(i18n("Edit"), actionCollection());
* edit->addAction(
* KStandardAction::Copy, //< see KStandardAction
* this, //< Receiver
* SLOT(fileNew())); //< SLOT
*
* ...
*
* \endcode
*/
class KRITAWIDGETUTILS_EXPORT KActionCategory : public QObject
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)
public:
/**
* Default constructor
*/
explicit KActionCategory(const QString &text, KActionCollection *parent = 0);
/**
* Destructor
*/
- virtual ~KActionCategory();
+ ~KActionCategory() override;
/**
* \name Adding Actions
*
* Add a action to the category.
*
* This methods are provided for your convenience. They call the
* corresponding method of KActionCollection.
*/
//@{
QAction *addAction(const QString &name, QAction *action);
QAction *addAction(
KStandardAction::StandardAction actionType,
const QObject *receiver = 0,
const char *member = 0);
QAction *addAction(
KStandardAction::StandardAction actionType,
const QString &name,
const QObject *receiver = 0,
const char *member = 0);
QAction *addAction(
const QString &name,
const QObject *receiver = 0,
const char *member = 0);
template<class ActionType>
ActionType *add(
const QString &name,
const QObject *receiver = 0,
const char *member = 0)
{
ActionType *action = collection()->add<ActionType>(name, receiver, member);
addAction(action);
return action;
}
//@}
/**
* Returns the actions belonging to this category
*/
const QList<QAction *> actions() const;
/**
* The action collection this category is associated with.
*/
KActionCollection *collection() const;
/**
* The action categorys descriptive text
*/
QString text() const;
/**
* Set the action categorys descriptive text.
*/
void setText(const QString &text);
private:
/**
* Remove \action from this category if found.
*/
void unlistAction(QAction *action);
/**
* Add action to category
*/
void addAction(QAction *action);
//! KActionCollection needs access to some of our helper methods
friend class KActionCollectionPrivate;
//! Implementation details
KActionCategoryPrivate *const d;
};
#endif /* #ifndef KACTIONCATEGORY_H */
diff --git a/libs/widgetutils/xmlgui/kactioncollection.h b/libs/widgetutils/xmlgui/kactioncollection.h
index 5feab692b3..cbce2fa542 100644
--- a/libs/widgetutils/xmlgui/kactioncollection.h
+++ b/libs/widgetutils/xmlgui/kactioncollection.h
@@ -1,514 +1,514 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2005-2006 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KACTIONCOLLECTION_H
#define KACTIONCOLLECTION_H
#include "config-xmlgui.h"
#include <kritawidgetutils_export.h>
#include <kstandardaction.h>
#include <QtCore/QObject>
class QAction;
class KXMLGUIClient;
class KConfigGroup;
class QActionGroup;
class QString;
class KActionCategory;
/**
* \short A container for a set of QAction objects.
*
* KActionCollection manages a set of QAction objects. It
* allows them to be grouped for organized presentation of configuration to the user,
* saving + loading of configuration, and optionally for automatic plugging into
* specified widget(s).
*
* Additionally, KActionCollection provides several convenience functions for locating
* named actions, and actions grouped by QActionGroup.
*
* \note If you create your own action collection and need to assign shortcuts
* to the actions within, you have to call associateWidget() or
* addAssociatedWidget() to have them working.
*/
class KRITAWIDGETUTILS_EXPORT KActionCollection : public QObject
{
friend class KXMLGUIClient;
Q_OBJECT
Q_PROPERTY(QString configGroup READ configGroup WRITE setConfigGroup)
public:
/**
* Constructor. Allows specification of a component name other than the default
* application name, where needed (remember to call setComponentDisplayName() too).
*/
explicit KActionCollection(QObject *parent, const QString &cName = QString());
/**
* Destructor.
*/
- virtual ~KActionCollection();
+ ~KActionCollection() override;
/**
* Access the list of all action collections in existence for this app
*/
static const QList<KActionCollection *> &allCollections();
/**
* Clears the entire action collection, deleting all actions.
*/
void clear();
/**
* Associate all actions in this collection to the given \a widget.
* Unlike addAssociatedWidget, this method only adds all current actions
* in the collection to the given widget. Any action added after this call
* will not be added to the given widget automatically.
* So this is just a shortcut for a foreach loop and a widget->addAction call.
*/
void associateWidget(QWidget *widget) const;
/**
* Associate all actions in this collection to the given \a widget, including any actions
* added after this association is made.
*
* This does not change the action's shortcut context, so if you need to have the actions only
* trigger when the widget has focus, you'll need to set the shortcut context on each action
* to Qt::WidgetShortcut (or better still, Qt::WidgetWithChildrenShortcut with Qt 4.4+)
*/
void addAssociatedWidget(QWidget *widget);
/**
* Remove an association between all actions in this collection and the given \a widget, i.e.
* remove those actions from the widget, and stop associating newly added actions as well.
*/
void removeAssociatedWidget(QWidget *widget);
/**
* Return a list of all associated widgets.
*/
QList<QWidget *> associatedWidgets() const;
/**
* Clear all associated widgets and remove the actions from those widgets.
*/
void clearAssociatedWidgets();
/**
* Returns the KConfig group with which settings will be loaded and saved.
*/
QString configGroup() const;
/**
* Sets \a group as the KConfig group with which settings will be loaded and saved.
*/
void setConfigGroup(const QString &group);
/**
* Read all key associations from @p config.
*
* If @p config is zero, read all key associations from the
* application's configuration file KSharedConfig::openConfig(),
* in the group set by setConfigGroup().
*/
void readSettings();
/**
* Update shortcuts from the KisActionRegistry.
*/
void updateShortcuts();
/**
* Write the current configurable key associations. If @a is nonzero, use
* that configuration group.
*
* Otherwise, the output file is determined as follows. If this action
* collection belongs to a KXMLGuiClient the setting are saved to the
* kxmlgui definition file. If not the settings are written to the
* applications config file.
*
* \note oneAction() and writeDefaults() have no meaning for the kxmlgui
* configuration file.
*
* \param config Config object to save to, or null (see above)
* \param writeScheme set to true if we export all settings as new shortcut scheme
* \param oneAction pass an action here if you just want to save the values for one action, eg.
* if you know that action is the only one which has changed.
*/
void writeSettings(KConfigGroup *config = 0, bool writeScheme = false, QAction *oneAction = 0) const;
/**
* Returns the number of actions in the collection.
*
* This is equivalent to actions().count().
*/
int count() const;
/**
* Returns whether the action collection is empty or not.
*/
bool isEmpty() const;
/**
* Return the QAction* at position "index" in the action collection.
*
* This is equivalent to actions().value(index);
*/
QAction *action(int index) const;
/**
* Get the action with the given \a name from the action collection.
*
* @param name Name of the QAction
* @return A pointer to the QAction in the collection which matches the parameters or
* null if nothing matches.
*/
QAction *action(const QString &name) const;
/**
* Returns the list of QActions which belong to this action collection.
*
* The list is guaranteed to be in the same order the action were put into
* the collection.
*/
QList<QAction *> actions() const;
/**
* Returns the list of QActions without an QAction::actionGroup() which belong to this action collection.
*/
const QList<QAction *> actionsWithoutGroup() const;
/**
* Returns the list of all QActionGroups associated with actions in this action collection.
*/
const QList<QActionGroup *> actionGroups() const;
/**
* Set the \a componentName associated with this action collection.
*
* \warning Don't call this method on a KActionCollection that contains
* actions. This is not supported.
*
* \param componentData the name which is to be associated with this action collection,
* or QString() to indicate the app name. This is used to load/save settings into XML files.
* KXmlGuiClient::setComponentName takes care of calling this.
*/
void setComponentName(const QString &componentName);
/** The component name with which this class is associated. */
QString componentName() const;
/**
* Set the component display name associated with this action collection.
* (e.g. for the toolbar editor)
* KXmlGuiClient::setComponentName takes care of calling this.
*/
void setComponentDisplayName(const QString &displayName);
/** The display name for the associated component. */
QString componentDisplayName() const;
/**
* The parent KXMLGUIClient, or null if not available.
*/
const KXMLGUIClient *parentGUIClient() const;
/**
* Returns the KActionCategories inside this collection
*/
QList<KActionCategory *> categories() const;
/**
* Gets a category with name @p name inside this collection.
*
* Creates a new category if one does not exist.
*/
KActionCategory *getCategory(const QString &categoryName);
Q_SIGNALS:
/**
* Indicates that \a action was inserted into this action collection.
*/
void inserted(QAction *action);
/**
* Indicates that \a action was removed from this action collection.
* @deprecated
*/
QT_MOC_COMPAT void removed(QAction *action);
/**
* Indicates that \a action was highlighted (hovered over).
* @deprecated Replaced by actionHovered(QAction* action);
*/
QT_MOC_COMPAT void actionHighlighted(QAction *action);
/**
* Indicates that \a action was hovered.
*/
void actionHovered(QAction *action);
/**
* Indicates that \a action was triggered
*/
void actionTriggered(QAction *action);
protected:
/// Overridden to perform connections when someone wants to know whether an action was highlighted or triggered
void connectNotify(const QMetaMethod &signal) override;
protected Q_SLOTS:
virtual void slotActionTriggered();
/**
* @internal
* @deprecated Replaced by slotActionHovered();
*/
QT_MOC_COMPAT virtual void slotActionHighlighted();
private Q_SLOTS:
void slotActionHovered();
public:
/**
* Add an action under the given name to the collection.
*
* Inserting an action that was previously inserted under a different name will replace the
* old entry, i.e. the action will not be available under the old name anymore but only under
* the new one.
*
* Inserting an action under a name that is already used for another action will replace
* the other action in the collection (but will not delete it).
*
* If KAuthorized::authorizeKAction() reports that the action is not
* authorized, it will be disabled and hidden.
*
* @param name The name by which the action be retrieved again from the collection.
* @param action The action to add.
* @return the same as the action given as parameter. This is just for convenience
* (chaining calls) and consistency with the other addAction methods, you can also
* simply ignore the return value.
*/
Q_INVOKABLE QAction *addAction(const QString &name, QAction *action);
/**
* Adds a new action to the collection in category @p category.
*
* The category will be created if it does not already exist.
*/
Q_INVOKABLE QAction *addCategorizedAction(const QString &name, QAction *action, const QString &categoryName);
/**
* Adds a list of actions to the collection.
*
* The objectName of the actions is used as their internal name in the collection.
*
* Uses addAction(QString, QAction*).
*
* @param actions the list of the actions to add.
*
* @see addAction()
* @since 5.0
*/
void addActions(const QList<QAction *> &actions);
/**
* Removes an action from the collection and deletes it.
* @param action The action to remove.
*/
void removeAction(QAction *action);
/**
* Removes an action from the collection.
* @param action the action to remove.
*/
QAction *takeAction(QAction *action);
/**
* Creates a new standard action, adds it to the collection and connects the
* action's triggered(bool) signal to the specified receiver/member. The
* newly created action is also returned.
*
* Note: Using KStandardAction::OpenRecent will cause a different signal than
* triggered(bool) to be used, see KStandardAction for more information.
*
* The action can be retrieved later from the collection by its standard name as per
* KStandardAction::stdName.
*
* @param actionType The standard action type of the action to create.
* @param receiver The QObject to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @param member The SLOT to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @return new action of the given type ActionType.
*/
QAction *addAction(KStandardAction::StandardAction actionType, const QObject *receiver = 0, const char *member = 0);
/**
* Creates a new standard action, adds to the collection under the given name
* and connects the action's triggered(bool) signal to the specified
* receiver/member. The newly created action is also returned.
*
* Note: Using KStandardAction::OpenRecent will cause a different signal than
* triggered(bool) to be used, see KStandardAction for more information.
*
* The action can be retrieved later from the collection by the specified name.
*
* @param actionType The standard action type of the action to create.
* @param name The name by which the action be retrieved again from the collection.
* @param receiver The QObject to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @param member The SLOT to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @return new action of the given type ActionType.
*/
QAction *addAction(KStandardAction::StandardAction actionType, const QString &name,
const QObject *receiver = 0, const char *member = 0);
/**
* Creates a new action under the given name to the collection and connects
* the action's triggered(bool) signal to the specified receiver/member. The
* newly created action is returned.
*
* NOTE: KDE prior to 4.2 used the triggered() signal instead of the triggered(bool)
* signal.
*
* Inserting an action that was previously inserted under a different name will replace the
* old entry, i.e. the action will not be available under the old name anymore but only under
* the new one.
*
* Inserting an action under a name that is already used for another action will replace
* the other action in the collection.
*
* @param name The name by which the action be retrieved again from the collection.
* @param receiver The QObject to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @param member The SLOT to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @return new action of the given type ActionType.
*/
QAction *addAction(const QString &name, const QObject *receiver = 0, const char *member = 0);
/**
* Creates a new action under the given name, adds it to the collection and connects the action's triggered(bool)
* signal to the specified receiver/member. The receiver slot may accept either a bool or no
* parameters at all (i.e. slotTriggered(bool) or slotTriggered() ).
* The type of the action is specified by the template parameter ActionType.
*
* NOTE: KDE prior to 4.2 connected the triggered() signal instead of the triggered(bool)
* signal.
*
* @param name The internal name of the action (e.g. "file-open").
* @param receiver The QObject to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @param member The SLOT to connect the triggered(bool) signal to. Leave 0 if no
* connection is desired.
* @return new action of the given type ActionType.
*
* @see addAction()
*/
template<class ActionType>
ActionType *add(const QString &name, const QObject *receiver = 0, const char *member = 0)
{
ActionType *a = new ActionType(this);
if (receiver && member) {
connect(a, SIGNAL(triggered(bool)), receiver, member);
}
addAction(name, a);
return a;
}
/**
* Get the default primary shortcut for the given action.
*
* @param action the action for which the default primary shortcut should be returned.
* @return the default primary shortcut of the given action
* @since 5.0
*/
QKeySequence defaultShortcut(QAction *action) const;
/**
* Get the default shortcuts for the given action.
*
* @param action the action for which the default shortcuts should be returned.
* @return the default shortcuts of the given action
* @since 5.0
*/
QList<QKeySequence> defaultShortcuts(QAction *action) const;
//TODO KF6: Make setDefaultShortcut static
/**
* Set the default shortcut for the given action.
* Since 5.2, this also calls action->setShortcut(shortcut), i.e. the default shortcut is
* made active initially.
*
* @param action the action for which the default shortcut should be set.
* @param shortcut the shortcut to use for the given action in its specified shortcutContext()
* @since 5.0
*/
void setDefaultShortcut(QAction *action, const QKeySequence &shortcut);
/**
* Set the default shortcuts for the given action.
* Since 5.2, this also calls action->setShortcuts(shortcuts), i.e. the default shortcut is
* made active initially.
*
* @param action the action for which the default shortcut should be set.
* @param shortcuts the shortcuts to use for the given action in its specified shortcutContext()
* @since 5.0
*/
Q_INVOKABLE void setDefaultShortcuts(QAction *action, const QList<QKeySequence> &shortcuts);
/**
* Returns true if the given action's shortcuts may be configured by the user.
*
* @param action the action for the hint should be verified.
* @since 5.0
*/
bool isShortcutsConfigurable(QAction *action) const;
/**
* Indicate whether the user may configure the action's shortcuts.
*
* @param action the action for the hint should be verified.
* @param configurable set to true if the shortcuts of the given action may be configured by the user, otherwise false.
* @since 5.0
*/
void setShortcutsConfigurable(QAction *action, bool configurable);
private:
Q_PRIVATE_SLOT(d, void _k_actionDestroyed(QObject *))
Q_PRIVATE_SLOT(d, void _k_associatedWidgetDestroyed(QObject *))
KActionCollection(const KXMLGUIClient *parent); // used by KXMLGUIClient
friend class KActionCollectionPrivate;
class KActionCollectionPrivate *const d;
};
#endif
diff --git a/libs/widgetutils/xmlgui/kbugreport.h b/libs/widgetutils/xmlgui/kbugreport.h
index f9197e9d9d..d3225bf222 100644
--- a/libs/widgetutils/xmlgui/kbugreport.h
+++ b/libs/widgetutils/xmlgui/kbugreport.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE project
Copyright (C) 1999 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KBUGREPORT_H
#define KBUGREPORT_H
#include <QDialog>
#include <kritawidgetutils_export.h>
class KAboutData;
class KBugReportPrivate;
/**
* @short A dialog box for sending bug reports.
*
* All the information needed by the dialog box
* (program name, version, bug-report address, etc.)
* comes from the KAboutData class.
* Make sure you create an instance of KAboutData and pass it
* to KCmdLineArgs.
*
* \image html kbugreport.png "KDE Bug Report Dialog"
*
* @author David Faure <faure@kde.org>
*/
class KRITAWIDGETUTILS_EXPORT KBugReport : public QDialog
{
Q_OBJECT
public:
/**
* Creates a bug-report dialog.
* Note that you shouldn't have to do this manually,
* since KHelpMenu takes care of the menu item
* for "Report Bug..." and of creating a KBugReport dialog.
*/
explicit KBugReport(const KAboutData &aboutData, QWidget *parent = 0L);
/**
* Destructor
*/
- virtual ~KBugReport();
+ ~KBugReport() override;
/**
* OK has been clicked
*/
void accept() override;
private:
/**
* Update the url to match the current os, compiler, selected app, etc
*/
Q_PRIVATE_SLOT(d, void _k_updateUrl())
private:
friend class KBugReportPrivate;
KBugReportPrivate *const d;
Q_DISABLE_COPY(KBugReport)
};
#endif
diff --git a/libs/widgetutils/xmlgui/kedittoolbar.h b/libs/widgetutils/xmlgui/kedittoolbar.h
index 77c19cac2e..6ac28f710d 100644
--- a/libs/widgetutils/xmlgui/kedittoolbar.h
+++ b/libs/widgetutils/xmlgui/kedittoolbar.h
@@ -1,172 +1,172 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
Copyright (C) 2006 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KEDITTOOLBAR_H
#define KEDITTOOLBAR_H
#include <QDialog>
#include <kritawidgetutils_export.h>
class KActionCollection;
class KEditToolBarPrivate;
class KXMLGUIFactory;
/**
* @short A dialog used to customize or configure toolbars.
*
* This dialog only works if your application uses the XML UI
* framework for creating menus and toolbars. It depends on the XML
* files to describe the toolbar layouts and it requires the actions
* to determine which buttons are active.
*
* Typically you do not need to use it directly as KXmlGuiWindow::setupGUI
* takes care of it.
*
* If you use plugListAction you need to overload saveNewToolbarConfig()
* to plug actions again:
*
* \code
* void MyClass::saveNewToolbarConfig()
* {
* KXmlGuiWindow::saveNewToolbarConfig();
* plugActionList( "list1", list1Actions );
* plugActionList( "list2", list2Actions );
* }
* \endcode
*
* When created, KEditToolBar takes a KXMLGUIFactory object, and uses it to
* find all of the action collections and XML files (there is one of each for the
* mainwindow, but there could be more, when adding other XMLGUI clients like
* KParts or plugins). The editor aims to be semi-intelligent about where it
* assigns any modifications. In other words, it will not write out part specific
* changes to your application's main XML file.
*
* KXmlGuiWindow and KParts::MainWindow take care of creating KEditToolBar correctly
* and connecting to its newToolBarConfig slot, but if you really really want to do it
* yourself, see the KXmlGuiWindow::configureToolbars() and KXmlGuiWindow::saveNewToolbarConfig() code.
*
* \image html kedittoolbar.png "KDE Toolbar Editor (KWrite)"
*
* @author Kurt Granroth <granroth@kde.org>
* @maintainer David Faure <faure@kde.org>
*/
class KRITAWIDGETUTILS_EXPORT KEditToolBar : public QDialog
{
Q_OBJECT
public:
/**
* Old constructor for apps that do not use components.
* This constructor is somewhat deprecated, since it doesn't work
* with any KXMLGuiClient being added to the mainwindow.
* You really want to use the other constructor.
*
* You @em must pass along your collection of actions (some of which appear in your toolbars).
*
* @param collection The collection of actions to work on.
* @param parent The parent of the dialog.
*/
explicit KEditToolBar(KActionCollection *collection,
QWidget *parent = 0);
/**
* Main constructor.
*
* The main parameter, @p factory, is a pointer to the
* XML GUI factory object for your application. It contains a list
* of all of the GUI clients (along with the action collections and
* xml files) and the toolbar editor uses that.
*
* Use this like so:
* \code
* KEditToolBar edit(factory());
* if (edit.exec())
* ...
* \endcode
*
* @param factory Your application's factory object
* @param parent The usual parent for the dialog.
*/
explicit KEditToolBar(KXMLGUIFactory *factory,
QWidget *parent = 0);
/// destructor
- ~KEditToolBar();
+ ~KEditToolBar() override;
/**
* Sets the default toolbar that will be selected when the dialog is shown.
* If not set, or QString() is passed in, the global default tool bar name
* will be used.
* @param toolBarName the name of the tool bar
* @see setGlobalDefaultToolBar
*/
void setDefaultToolBar(const QString &toolBarName);
/**
* The name (absolute or relative) of your application's UI resource file
* is assumed to be share/apps/appname/appnameui.xmlgui though this can be
* overridden by calling this method.
*
* The global parameter controls whether or not the
* global resource file is used. If this is @p true, then you may
* edit all of the actions in your toolbars -- global ones and
* local one. If it is @p false, then you may edit only your
* application's entries. The only time you should set this to
* false is if your application does not use the global resource
* file at all (very rare).
*
* @param xmlfile The application's local resource file.
* @param global If @p true, then the global resource file will also
* be parsed.
*/
void setResourceFile(const QString &file, bool global = true);
/**
* Sets the default toolbar which will be auto-selected for all
* KEditToolBar instances. Can be overridden on a per-dialog basis
* by calling setDefaultToolBar( const QString& ) on the dialog.
* @param toolbarName the name of the tool bar
*/
static void setGlobalDefaultToolBar(const char *toolBarName); // TODO should be const QString&
Q_SIGNALS:
/**
* Signal emitted when 'apply' or 'ok' is clicked or toolbars were reset.
* Connect to it, to plug action lists and to call applyMainWindowSettings
* (see sample code in this class's documentation)
*/
void newToolBarConfig();
QT_MOC_COMPAT void newToolbarConfig();
protected:
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
private:
friend class KEditToolBarPrivate;
KEditToolBarPrivate *const d;
Q_PRIVATE_SLOT(d, void _k_slotButtonClicked(QAbstractButton *))
Q_PRIVATE_SLOT(d, void _k_acceptOK(bool))
Q_PRIVATE_SLOT(d, void _k_enableApply(bool))
Q_DISABLE_COPY(KEditToolBar)
};
#endif // _KEDITTOOLBAR_H
diff --git a/libs/widgetutils/xmlgui/kedittoolbar_p.h b/libs/widgetutils/xmlgui/kedittoolbar_p.h
index a089dcc460..52f31c2a5e 100644
--- a/libs/widgetutils/xmlgui/kedittoolbar_p.h
+++ b/libs/widgetutils/xmlgui/kedittoolbar_p.h
@@ -1,256 +1,256 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
Copyright (C) 2006 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KEDITTOOLBARP_H
#define KEDITTOOLBARP_H
#include "kxmlguiclient.h"
#include <QDialog>
#include <QListWidget>
class QDialogButtonBox;
class QLineEdit;
class QCheckBox;
namespace KDEPrivate
{
class ToolBarItem;
class KEditToolBarWidgetPrivate;
class ToolBarListWidget : public QListWidget
{
Q_OBJECT
public:
ToolBarListWidget(QWidget *parent = 0);
void makeVisible(QListWidgetItem *item)
{
scrollTo(indexFromItem(item));
}
ToolBarItem *currentItem() const;
void setActiveList(bool isActiveList)
{
m_activeList = isActiveList;
}
Q_SIGNALS:
void dropped(ToolBarListWidget *list, int index, ToolBarItem *item, bool sourceIsActiveList);
protected:
- virtual Qt::DropActions supportedDropActions() const
+ Qt::DropActions supportedDropActions() const override
{
return Qt::MoveAction;
}
- virtual QStringList mimeTypes() const
+ QStringList mimeTypes() const override
{
return QStringList() << QStringLiteral("application/x-kde-action-list");
}
- virtual QMimeData *mimeData(const QList<QListWidgetItem *> items) const;
+ QMimeData *mimeData(const QList<QListWidgetItem *> items) const override;
- virtual bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
+ bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action) override;
// Skip internal dnd handling in QListWidget ---- how is one supposed to figure this out
// without reading the QListWidget code !?
- virtual void dropEvent(QDropEvent *ev)
+ void dropEvent(QDropEvent *ev) override
{
QAbstractItemView::dropEvent(ev);
}
private:
bool m_activeList;
};
class IconTextEditDialog : public QDialog
{
Q_OBJECT
public:
explicit IconTextEditDialog(QWidget *parent = 0);
public:
void setIconText(const QString &text);
QString iconText() const;
void setTextAlongsideIconHidden(bool hidden);
bool textAlongsideIconHidden() const;
private Q_SLOTS:
void slotTextChanged(const QString &text);
private:
QLineEdit *m_lineEdit;
QCheckBox *m_cbHidden;
QDialogButtonBox *m_buttonBox;
};
/**
* @short A widget used to customize or configure toolbars
*
* This is the widget that does all of the work for the
* KEditToolBar dialog. In most cases, you will want to use the
* dialog instead of this widget directly.
*
* Typically, you would use this widget only if you wanted to embed
* the toolbar editing directly into your existing configure or
* preferences dialog.
*
* This widget only works if your application uses the XML UI
* framework for creating menus and toolbars. It depends on the XML
* files to describe the toolbar layouts and it requires the actions
* to determine which buttons are active.
*
* @author Kurt Granroth <granroth@kde.org>
* @internal
*/
class KEditToolBarWidget : public QWidget, virtual public KXMLGUIClient
{
Q_OBJECT
public:
/**
* Old constructor for apps that do not use components.
* This constructor is somewhat deprecated, since it doesn't work
* with any KXMLGuiClient being added to the mainwindow.
* You really want to use the other constructor.
*
* You @em must pass along your collection of actions (some of which appear in your toolbars).
* Then call old-style load.
*
* @param collection The collection of actions to work on
* @param parent This widget's parent
*/
explicit KEditToolBarWidget(KActionCollection *collection,
QWidget *parent = 0L);
/**
* Main constructor.
*
* Use this like so:
* \code
* KEditToolBarWidget widget(this);
* widget.load(factory());
* ...
* \endcode
*
* @param factory Your application's factory object
* @param parent This widget's parent
*/
explicit KEditToolBarWidget(QWidget *parent = 0L);
/**
* Destructor. Note that any changes done in this widget will
* @p NOT be saved in the destructor. You @p must call save()
* to do that.
*/
- virtual ~KEditToolBarWidget();
+ ~KEditToolBarWidget() override;
/**
* Old-style load.
*
* Loads the toolbar configuration into the widget. Should be called before being shown.
*
* @param resourceFile the name (absolute or relative) of your application's UI
* resource file. If it is left blank, then the resource file: share/apps/appname/appnameui.xmlgui
* is used. This is the same resource file that is used by the
* default createGUI function in KMainWindow so you're usually
* pretty safe in leaving it blank.
*
* @param global controls whether or not the
* global resource file is used. If this is true, then you may
* edit all of the actions in your toolbars -- global ones and
* local one. If it is false, then you may edit only your
* application's entries. The only time you should set this to
* false is if your application does not use the global resource
* file at all (very rare)
*
* @param defaultToolBar the default toolbar that will be selected when the dialog is shown.
* If not set, or QString() is passed in, the global default tool bar name
* will be used.
*
* @see KEditToolBar
*/
void load(const QString &resourceFile,
bool global = true,
const QString &defaultToolBar = QString());
/**
* Loads the toolbar configuration into the widget. Should be called before being shown.
*
* @param factory pointer to the XML GUI factory object for your application.
* It contains a list of all of the GUI clients (along with the action
* collections and xml files) and the toolbar editor uses that.
*
* @param defaultToolBar the default toolbar that will be selected when the dialog is shown.
* If not set, or QString() is passed in, the global default tool bar name
* will be used.
*
* @see KEditToolBar
*/
void load(KXMLGUIFactory *factory,
const QString &defaultToolBar = QString());
/**
* @internal Reimplemented for internal purposes.
*/
- virtual KActionCollection *actionCollection() const;
+ KActionCollection *actionCollection() const override;
/**
* Save any changes the user made. The file will be in the user's
* local directory (usually $HOME/.kde/share/apps/\<appname\>). The
* filename will be the one specified in the constructor.. or the
* made up one if the filename was NULL.
*
*/
void save();
/**
* Remove and readd all KMXLGUIClients to update the GUI
*/
void rebuildKXMLGUIClients();
Q_SIGNALS:
/**
* Emitted whenever any modifications are made by the user.
*/
void enableOk(bool);
private:
Q_PRIVATE_SLOT(d, void slotToolBarSelected(int index))
Q_PRIVATE_SLOT(d, void slotInactiveSelectionChanged())
Q_PRIVATE_SLOT(d, void slotActiveSelectionChanged())
Q_PRIVATE_SLOT(d, void slotInsertButton())
Q_PRIVATE_SLOT(d, void slotRemoveButton())
Q_PRIVATE_SLOT(d, void slotUpButton())
Q_PRIVATE_SLOT(d, void slotDownButton())
Q_PRIVATE_SLOT(d, void slotDropped(ToolBarListWidget *, int, ToolBarItem *, bool))
private:
friend class KEditToolBarWidgetPrivate;
KEditToolBarWidgetPrivate *const d;
Q_DISABLE_COPY(KEditToolBarWidget)
};
}
#endif
diff --git a/libs/widgetutils/xmlgui/kgesturemap_p.h b/libs/widgetutils/xmlgui/kgesturemap_p.h
index 98787a7e1b..0d37eb02ab 100644
--- a/libs/widgetutils/xmlgui/kgesturemap_p.h
+++ b/libs/widgetutils/xmlgui/kgesturemap_p.h
@@ -1,87 +1,87 @@
/* This file is part of the KDE libraries
Copyright (C) 2006,2007 Andreas Hartmetz (ahartmetz@gmail.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KGESTUREMAP_H
#define KGESTUREMAP_H
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QTimer>
#include <QPolygon>
#include "kgesture_p.h"
class QApplication;
class QAction;
class QEvent;
class KRITAWIDGETUTILS_EXPORT KGestureMap : public QObject
{
Q_OBJECT
public:
static KGestureMap *self();
bool eventFilter(QObject *obj, QEvent *e) override;
void setShapeGesture(QAction *kact, const KShapeGesture &gesture);
void setRockerGesture(QAction *kact, const KRockerGesture &gesture);
void setDefaultShapeGesture(QAction *kact, const KShapeGesture &gesture);
void setDefaultRockerGesture(QAction *kact, const KRockerGesture &gesture);
/**
* This method will remove all gestures defined for a given action
*/
void removeAllGestures(QAction *kact);
QAction *findAction(const KShapeGesture &gesture) const;
QAction *findAction(const KRockerGesture &gesture) const;
KShapeGesture shapeGesture(const QAction *kact) const;
KShapeGesture defaultShapeGesture(const QAction *kact) const;
KRockerGesture rockerGesture(const QAction *kact) const;
KRockerGesture defaultRockerGesture(const QAction *kact) const;
private Q_SLOTS:
void stopAcquisition();
private:
friend class KGestureMapContainer;
KGestureMap();
- virtual ~KGestureMap();
+ ~KGestureMap() override;
friend class KApplicationPrivate;
//intended to be used at application initialization
void installEventFilterOnMe(QApplication *app);
inline int bitCount(int n);
void handleAction(QAction *kact);
void matchShapeGesture();
//this is an internal class so don't bother with a d-pointer
typedef QHash< KShapeGesture, QAction * > ShapeGestureHash;
typedef QHash< KRockerGesture, QAction * > RockerGestureHash;
ShapeGestureHash m_shapeGestures;
ShapeGestureHash m_defaultShapeGestures;
RockerGestureHash m_rockerGestures;
RockerGestureHash m_defaultRockerGestures;
QPolygon m_points;
QTimer m_gestureTimeout;
bool m_acquiring;
KShapeGesture m_shapeGesture;
KRockerGesture m_rockerGesture;
};
#endif //KGESTUREMAP_H
diff --git a/libs/widgetutils/xmlgui/khelpmenu.h b/libs/widgetutils/xmlgui/khelpmenu.h
index 731cca8e0b..87edd870b8 100644
--- a/libs/widgetutils/xmlgui/khelpmenu.h
+++ b/libs/widgetutils/xmlgui/khelpmenu.h
@@ -1,267 +1,267 @@
/*
* This file is part of the KDE Libraries
* Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KHELPMENU_H
#define KHELPMENU_H
#include <kritawidgetutils_export.h>
#include <QtCore/QObject>
#include <QtCore/QString>
class QMenu;
class QWidget;
class QAction;
class KAboutData;
class KHelpMenuPrivate;
/**
* @short Standard %KDE help menu with dialog boxes.
*
* This class provides the standard %KDE help menu with the default "about"
* dialog boxes and help entry.
*
* This class is used in KMainWindow so
* normally you don't need to use this class yourself. However, if you
* need the help menu or any of its dialog boxes in your code that is
* not subclassed from KMainWindow you should use this class.
*
* The usage is simple:
*
* \code
* mHelpMenu = new KHelpMenu( this, <someText> );
* kmenubar->addMenu(mHelpMenu->menu() );
* \endcode
*
* or if you just want to open a dialog box:
*
* \code
* mHelpMenu = new KHelpMenu( this, <someText> );
* connect( this, SIGNAL(someSignal()), mHelpMenu,SLOT(aboutKDE()));
* \endcode
*
* IMPORTANT:
* The first time you use KHelpMenu::menu(), a QMenu object is
* allocated. Only one object is created by the class so if you call
* KHelpMenu::menu() twice or more, the same pointer is returned. The class
* will destroy the popupmenu in the destructor so do not delete this
* pointer yourself.
*
* The KHelpMenu object will be deleted when its parent is destroyed but you
* can delete it yourself if you want. The code below will always work.
*
* \code
* MyClass::~MyClass()
* {
* delete mHelpMenu;
* }
* \endcode
*
*
* Using your own "about application" dialog box:
*
* The standard "about application" dialog box is quite simple. If you
* need a dialog box with more functionality you must design that one
* yourself. When you want to display the dialog, you simply need to
* connect the help menu signal showAboutApplication() to your slot.
*
* \code
* void MyClass::myFunc()
* {
* ..
* KHelpMenu *helpMenu = new KHelpMenu( this );
* connect( helpMenu, SIGNAL(showAboutApplication()),
* this, SLOT(myDialogSlot()));
* ..
* }
*
* void MyClass::myDialogSlot()
* {
* <activate your custom dialog>
* }
* \endcode
*
* \image html khelpmenu.png "KDE Help Menu"
*
* KHelpMenu respects Kiosk settings (see the KAuthorized namespace in the
* KConfig framework). In particular, system administrators can disable items
* on this menu using some subset of the following configuration:
* @verbatim
[KDE Action Restrictions][$i]
actions/help_contents=false
actions/help_whats_this=false
actions/help_report_bug=false
actions/switch_application_language=false
actions/help_about_app=false
actions/help_about_kde=false
@endverbatim
*
* @author Espen Sand (espen@kde.org)
*/
class KRITAWIDGETUTILS_EXPORT KHelpMenu : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
*
* @param parent The parent of the dialog boxes. The boxes are modeless
* and will be centered with respect to the parent.
* @param aboutAppText User definable string that is used in the
* default application dialog box.
* @param showWhatsThis Decides whether a "Whats this" entry will be
* added to the dialog.
*
*/
explicit KHelpMenu(QWidget *parent = 0, const QString &aboutAppText = QString(),
bool showWhatsThis = true);
/**
* Constructor.
*
* This alternative constructor is mainly useful if you want to
* overide the standard actions (aboutApplication(), aboutKDE(),
* helpContents(), reportBug, and optionally whatsThis).
*
* @param parent The parent of the dialog boxes. The boxes are modeless
* and will be centered with respect to the parent.
* @param aboutData User and app data used in the About app dialog
* @param showWhatsThis Decides whether a "Whats this" entry will be
* added to the dialog.
*/
KHelpMenu(QWidget *parent, const KAboutData &aboutData,
bool showWhatsThis = true);
/**
* Destructor
*
* Destroys dialogs and the menu pointer retuned by menu
*/
- ~KHelpMenu();
+ ~KHelpMenu() override;
/**
* Returns a popup menu you can use in the menu bar or where you
* need it.
*
* The returned menu is configured with an icon, a title and
* menu entries. Therefore adding the returned pointer to your menu
* is enougth to have access to the help menu.
*
* Note: This method will only create one instance of the menu. If
* you call this method twice or more the same pointer is returned.
*/
QMenu *menu();
enum MenuId {
menuHelpContents = 0,
menuWhatsThis = 1,
menuAboutApp = 2,
menuAboutKDE = 3,
menuReportBug = 4,
menuSwitchLanguage = 5
};
/**
* Returns the QAction * associated with the given parameter
* Will return 0 pointers if menu() has not been called
*
* @param id The id of the action of which you want to get QAction *
*/
QAction *action(MenuId id) const;
public Q_SLOTS:
/**
* Opens the help page for the application. The application name is
* used as a key to determine what to display and the system will attempt
* to open \<appName\>/index.html.
*/
void appHelpActivated();
/**
* Activates What's This help for the application.
*/
void contextHelpActivated();
/**
* Opens an application specific dialog box.
*
* The method will try to open the about box using the following steps:
* - If the showAboutApplication() signal is connected, then it will be called.
* This means there is an application defined aboutBox.
* - If the aboutData was set in the constructor a KAboutApplicationDialog will be created.
* - Else a default about box using the aboutAppText from the constructor will be created.
*/
void aboutApplication();
/**
* Opens the standard "About KDE" dialog box.
*/
void aboutKDE();
/**
* Opens the standard "Report Bugs" dialog box.
*/
void reportBug();
/**
* Opens the changing default application language dialog box.
*/
void switchApplicationLanguage();
private Q_SLOTS:
/**
* Connected to the menu pointer (if created) to detect a delete
* operation on the pointer. You should not delete the pointer in your
* code yourself. Let the KHelpMenu destructor do the job.
*/
void menuDestroyed();
/**
* Connected to the dialogs (about kde and bug report) to detect
* when they are finished.
*/
void dialogFinished();
/**
* This slot will delete a dialog (about kde or bug report) if the
* dialog pointer is not zero and the dialog is not visible. This
* slot is activated by a one shot timer started in dialogHidden
*/
void timerExpired();
Q_SIGNALS:
/**
* This signal is emitted from aboutApplication() if no
* "about application" string has been defined. The standard
* application specific dialog box that is normally activated in
* aboutApplication() will not be displayed when this signal
* is emitted.
*/
void showAboutApplication();
private:
KHelpMenuPrivate *const d;
};
#endif
diff --git a/libs/widgetutils/xmlgui/kkeysequencewidget.h b/libs/widgetutils/xmlgui/kkeysequencewidget.h
index 69a56e64ec..b37fce008c 100644
--- a/libs/widgetutils/xmlgui/kkeysequencewidget.h
+++ b/libs/widgetutils/xmlgui/kkeysequencewidget.h
@@ -1,301 +1,301 @@
/* This file is part of the KDE libraries
Copyright (C) 2001, 2002 Ellis Whitehead <ellis@kde.org>
Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KKEYSEQUENCEWIDGET_H
#define KKEYSEQUENCEWIDGET_H
#include <kritawidgetutils_export.h>
#include <QtCore/QList>
#include <QPushButton>
class KKeySequenceWidgetPrivate;
class QAction;
class KActionCollection;
/**
* @short A widget to input a QKeySequence.
*
* This widget lets the user choose a QKeySequence, which is usually used as a
* shortcut key. The recording is initiated by calling captureKeySequence() or
* the user clicking into the widget.
*
* The widgets provides support for conflict handling. See
* setCheckForConflictsAgainst() for more information.
*
* \image html kkeysequencewidget.png "KDE Key Sequence Widget"
*
* @author Mark Donohoe <donohoe@kde.org>
* @internal
*/
class KRITAWIDGETUTILS_EXPORT KKeySequenceWidget: public QWidget
{
Q_OBJECT
Q_FLAGS(ShortcutTypes)
Q_PROPERTY(
bool multiKeyShortcutsAllowed
READ multiKeyShortcutsAllowed
WRITE setMultiKeyShortcutsAllowed)
Q_PROPERTY(
ShortcutTypes checkForConflictsAgainst
READ checkForConflictsAgainst
WRITE setCheckForConflictsAgainst)
Q_PROPERTY(
bool modifierlessAllowed
READ isModifierlessAllowed
WRITE setModifierlessAllowed)
public:
///An enum about validation when setting a key sequence.
///@see setKeySequence()
enum Validation {
///Validate key sequence
Validate = 0,
///Use key sequence without validation
NoValidate = 1
};
/**
* Constructor.
*/
explicit KKeySequenceWidget(QWidget *parent = 0);
/**
* Destructs the widget.
*/
- virtual ~KKeySequenceWidget();
+ ~KKeySequenceWidget() override;
/**
* \name Configuration
*
* Configuration options for the widget.
*/
//@{
enum ShortcutType {
None = 0x00, //!< No checking for conflicts
LocalShortcuts = 0x01, //!< Check with local shortcuts. @see setCheckActionCollections()
StandardShortcuts = 0x02, //!< Check against standard shortcuts. @see KStandardShortcut
GlobalShortcuts = 0x04 //!< Check against global shortcuts. @see KGlobalAccel
};
Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
/**
* Configure if the widget should check for conflicts with existing
* shortcuts.
*
* When capturing a key sequence for local shortcuts you should check
* against GlobalShortcuts and your other local shortcuts. This is the
* default.
*
* You have to provide the local actions to check against with
* setCheckActionCollections().
*
* When capturing a key sequence for a global shortcut you should
* check against StandardShortcuts, GlobalShortcuts and your local
* shortcuts.
*
* There are two ways to react to a user agreeing to steal a shortcut:
*
* 1. Listen to the stealShortcut() signal and steal the shortcuts
* manually. It's your responsibility to save that change later when
* you think it is appropriate.
*
* 2. Call applyStealShortcut and KKeySequenceWidget will steal the
* shortcut. This will save the actionCollections the shortcut is part
* of so make sure it doesn't inadvertly save some unwanted changes
* too. Read its documentation for some limitation when handling
* global shortcuts.
*
* If you want to do the conflict checking yourself here are some code
* snippets for global ...
*
* \code
* QStringList conflicting = KGlobalAccel::findActionNameSystemwide(keySequence);
* if (!conflicting.isEmpty()) {
* // Inform and ask the user about the conflict and reassigning
* // the keys sequence
* if (!KGlobalAccel::promptStealShortcutSystemwide(q, conflicting, keySequence)) {
* return true;
* }
* KGlobalAccel::stealShortcutSystemwide(keySequence);
* }
* \endcode
*
* ... and standard shortcuts
*
* \code
* KStandardShortcut::StandardShortcut ssc = KStandardShortcut::find(keySequence);
* if (ssc != KStandardShortcut::AccelNone) {
* // We have a conflict
* }
* \endcode
*
*
* @since 4.2
*/
void setCheckForConflictsAgainst(ShortcutTypes types);
/**
* The shortcut types we check for conflicts.
*
* @see setCheckForConflictsAgainst()
* @since 4.2
*/
ShortcutTypes checkForConflictsAgainst() const;
/**
* Allow multikey shortcuts?
*/
void setMultiKeyShortcutsAllowed(bool);
bool multiKeyShortcutsAllowed() const;
/**
* This only applies to user input, not to setShortcut().
* Set whether to accept "plain" keys without modifiers (like Ctrl, Alt, Meta).
* Plain keys by our definition include letter and symbol keys and
* text editing keys (Return, Space, Tab, Backspace, Delete).
* "Special" keys like F1, Cursor keys, Insert, PageDown will always work.
*/
void setModifierlessAllowed(bool allow);
/**
* @see setModifierlessAllowed()
*/
bool isModifierlessAllowed();
/**
* Set whether a small button to set an empty key sequence should be displayed next to the
* main input widget. The default is to show the clear button.
*/
void setClearButtonShown(bool show);
//@}
/**
* Checks whether the key sequence @a seq is available to grab.
*
* The sequence is checked under the same rules as if it has been typed by
* the user. This method is useful if you get key sequences from another
* input source and want to check if it is save to set them.
*
* @since 4.2
*/
bool isKeySequenceAvailable(const QKeySequence &seq) const;
/**
* Return the currently selected key sequence.
*/
QKeySequence keySequence() const;
/**
* Set a list of action collections to check against for conflictuous shortcut.
*
* @see setCheckForConflictsAgainst()
*
* If a KAction with a conflicting shortcut is found inside this list and
* its shortcut can be configured (KAction::isShortcutConfigurable()
* returns true) the user will be prompted whether to steal the shortcut
* from this action.
*
* @since 4.1
*/
void setCheckActionCollections(const QList<KActionCollection *> &actionCollections);
/**
* If the component using this widget supports shortcuts contexts, it has
* to set its component name so we can check conflicts correctly.
*/
void setComponentName(const QString &componentName);
Q_SIGNALS:
/**
* This signal is emitted when the current key sequence has changed, be it by user
* input or programmatically.
*/
void keySequenceChanged(const QKeySequence &seq);
/**
* This signal is emitted after the user agreed to steal a shortcut from
* an action. This is only done for local shortcuts. So you can be sure \a
* action is one of the actions you provided with setCheckActionList() or
* setCheckActionCollections().
*
* If you listen to that signal and don't call applyStealShortcut() you
* are supposed to steal the shortcut and save this change.
*/
void stealShortcut(const QKeySequence &seq, QAction *action);
public Q_SLOTS:
/**
* Capture a shortcut from the keyboard. This call will only return once a key sequence
* has been captured or input was aborted.
* If a key sequence was input, keySequenceChanged() will be emitted.
*
* @see setModifierlessAllowed()
*/
void captureKeySequence();
/**
* Set the key sequence.
*
* If @p val == Validate, and the call is actually changing the key sequence,
* conflictuous shortcut will be checked.
*/
void setKeySequence(const QKeySequence &seq, Validation val = NoValidate);
/**
* Clear the key sequence.
*/
void clearKeySequence();
/**
* Actually remove the shortcut that the user wanted to steal, from the
* action that was using it. This only applies to actions provided to us
* by setCheckActionCollections() and setCheckActionList().
*
* Global and Standard Shortcuts have to be stolen immediately when the
* user gives his consent (technical reasons). That means those changes
* will be active even if you never call applyStealShortcut().
*
* To be called before you apply your changes. No local shortcuts are
* stolen until this function is called.
*/
void applyStealShortcut();
private:
Q_PRIVATE_SLOT(d, void doneRecording())
private:
friend class KKeySequenceWidgetPrivate;
KKeySequenceWidgetPrivate *const d;
Q_DISABLE_COPY(KKeySequenceWidget)
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KKeySequenceWidget::ShortcutTypes)
#endif //KKEYSEQUENCEWIDGET_H
diff --git a/libs/widgetutils/xmlgui/kkeysequencewidget_p.h b/libs/widgetutils/xmlgui/kkeysequencewidget_p.h
index 26a30fd3bb..bdd3bbded4 100644
--- a/libs/widgetutils/xmlgui/kkeysequencewidget_p.h
+++ b/libs/widgetutils/xmlgui/kkeysequencewidget_p.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE libraries
Copyright (C) 2001, 2002 Ellis Whitehead <ellis@kde.org>
Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KKEYSEQUENCEWIDGET_P_H
#define KKEYSEQUENCEWIDGET_P_H
#include <QPushButton>
class KKeySequenceButton: public QPushButton
{
Q_OBJECT
public:
explicit KKeySequenceButton(KKeySequenceWidgetPrivate *d, QWidget *parent)
: QPushButton(parent),
d(d) {}
- virtual ~KKeySequenceButton();
+ ~KKeySequenceButton() override;
protected:
/**
* Reimplemented for internal reasons.
*/
- virtual bool event(QEvent *event);
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void keyReleaseEvent(QKeyEvent *event);
+ bool event(QEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
private:
KKeySequenceWidgetPrivate *const d;
};
#endif //KKEYSEQUENCEWIDGET_P_H
diff --git a/libs/widgetutils/xmlgui/kmainwindow.h b/libs/widgetutils/xmlgui/kmainwindow.h
index 1a3b295a7f..ca219eea49 100644
--- a/libs/widgetutils/xmlgui/kmainwindow.h
+++ b/libs/widgetutils/xmlgui/kmainwindow.h
@@ -1,615 +1,615 @@
/*
This file is part of the KDE libraries
Copyright
(C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997 Stephan Kulow (coolo@kde.org)
(C) 1997-2000 Sven Radej (radej@kde.org)
(C) 1997-2000 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 2002 Joseph Wenninger (jowenn@kde.org)
(C) 2005-2006 Hamish Rodda (rodda@kde.org)
(C) 2000-2008 David Faure (faure@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KMAINWINDOW_H
#define KMAINWINDOW_H
#include <kritawidgetutils_export.h>
#include <QMainWindow>
#include <QtCore/QMetaClassInfo>
class QMenu;
class KConfig;
class KConfigGroup;
class KMWSessionManager;
class KMainWindowPrivate;
class KToolBar;
// internal, not public API, may change any time
#define XMLGUI_DECLARE_PRIVATE(classname) \
inline classname ## Private *k_func() { return reinterpret_cast<classname ## Private *>(k_ptr); } \
inline const classname ## Private *k_func() const { return reinterpret_cast<classname ## Private *>(k_ptr); } \
friend class classname ## Private;
// This is mostly from KDE3. TODO KDE5: remove the constructor parameter.
#define KDE_DEFAULT_WINDOWFLAGS 0
/**
* @short %KDE top level main window
*
* Top level widget that provides toolbars, a status line and a frame.
*
* It should be used as a top level (parent-less) widget.
* It manages the geometry for all its children, including your
* main widget.
*
* Normally, you will inherit from KMainWindow,
* then construct (or use some existing) widget as
* your main view. You can set only one main view.
*
* You can add as many toolbars as you like. There can be only one menubar
* and only one statusbar.
*
* The toolbars, menubar, and statusbar can be created by the
* KMainWindow and - unlike the old KMainWindow - may, but do not
* have to, be deleted by you. KMainWindow will handle that internally.
*
* Height and width can be operated independently from each other. Simply
* define the minimum/maximum height/width of your main widget and
* KMainWindow will take this into account. For fixed size windows set
* your main widget to a fixed size.
*
* Fixed aspect ratios (heightForWidth()) and fixed width widgets are
* not supported.
*
* KMainWindow will set icon, mini icon and caption, which it gets
* from KApplication. It provides full session management, and
* will save its position, geometry and positions of toolbars and
* menubar on logout. If you want to save additional data, reimplement
* saveProperties() and (to read them again on next login)
* readProperties(). To save special data about your data, reimplement
* saveGlobalProperties(). To warn user that application or
* windows have unsaved data on close or logout, reimplement
* queryClose().
*
* You have to implement session restoring also in your main() function.
* There are also kRestoreMainWindows convenience functions which
* can do this for you and restore all your windows on next login.
*
* Note that KMainWindow uses KGlobal::ref() and KGlobal::deref() so that closing
* the last mainwindow will quit the application unless there is still something
* that holds a ref in KGlobal - like a KIO job, or a systray icon.
*
* @see KApplication
* @author Reginald Stadlbauer (reggie@kde.org) Stephan Kulow (coolo@kde.org), Matthias Ettrich (ettrich@kde.org), Chris Schlaeger (cs@kde.org), Sven Radej (radej@kde.org). Maintained by David Faure (faure@kde.org)
*/
class KRITAWIDGETUTILS_EXPORT KMainWindow : public QMainWindow
{
friend class KMWSessionManager;
friend class DockResizeListener;
XMLGUI_DECLARE_PRIVATE(KMainWindow)
Q_OBJECT
Q_PROPERTY(bool hasMenuBar READ hasMenuBar)
Q_PROPERTY(bool autoSaveSettings READ autoSaveSettings)
Q_PROPERTY(QString autoSaveGroup READ autoSaveGroup)
public:
/**
* Construct a main window.
*
* @param parent The widget parent. This is usually 0 but it may also be the window
* group leader. In that case, the KMainWindow becomes sort of a
* secondary window.
*
* @param f Specify the window flags. The default is none.
*
* Note that a KMainWindow per-default is created with the
* WA_DeleteOnClose attribute, i.e. it is automatically destroyed when the
* window is closed. If you do not want this behavior, call
* setAttribute(Qt::WA_DeleteOnClose, false);
*
* KMainWindows must be created on the heap with 'new', like:
* \code
* KMainWindow *kmw = new KMainWindow(...);
* kmw->setObjectName(...);
* \endcode
*
* IMPORTANT: For session management and window management to work
* properly, all main windows in the application should have a
* different name. If you don't do it, KMainWindow will create
* a unique name, but it's recommended to explicitly pass a window name that will
* also describe the type of the window. If there can be several windows of the same
* type, append '#' (hash) to the name, and KMainWindow will replace it with numbers to make
* the names unique. For example, for a mail client which has one main window showing
* the mails and folders, and which can also have one or more windows for composing
* mails, the name for the folders window should be e.g. "mainwindow" and
* for the composer windows "composer#".
*
*/
explicit KMainWindow(QWidget *parent = 0, Qt::WindowFlags f = KDE_DEFAULT_WINDOWFLAGS);
/**
* \brief Destructor.
*
* Will also destroy the toolbars, and menubar if
* needed.
*/
- virtual ~KMainWindow();
+ ~KMainWindow() override;
/**
* If the session did contain so high a number, @p true is returned,
* else @p false.
* @see restore()
**/
static bool canBeRestored(int number);
/**
* Returns the className() of the @p number of the toplevel window which
* should be restored.
*
* This is only useful if your application uses
* different kinds of toplevel windows.
*/
static const QString classNameOfToplevel(int number);
/**
* Try to restore the toplevel widget as defined by @p number (1..X).
*
* You should call canBeRestored() first.
*
* If the session did not contain so high a number, the configuration
* is not changed and @p false returned.
*
* That means clients could simply do the following:
* \code
* if (qApp->isSessionRestored()){
* int n = 1;
* while (KMainWindow::canBeRestored(n)){
* (new childMW)->restore(n);
* n++;
* }
* } else {
* // create default application as usual
* }
* \endcode
* Note that if @p show is true (default), QWidget::show() is called
* implicitly in restore.
*
* With this you can easily restore all toplevel windows of your
* application.
*
* If your application uses different kinds of toplevel
* windows, then you can use KMainWindow::classNameOfToplevel(n)
* to determine the exact type before calling the childMW
* constructor in the example from above.
*
* <i>Note that you don't need to deal with this function. Use the
* kRestoreMainWindows() convenience template function instead!</i>
* @see kRestoreMainWindows()
* @see readProperties()
* @see canBeRestored()
*/
bool restore(int number, bool show = true);
/**
* Returns true, if there is a menubar
*/
bool hasMenuBar();
/**
* List of members of KMainWindow class.
*/
static QList<KMainWindow *> memberList();
/**
* Returns a pointer to the toolbar with the specified name.
* This refers to toolbars created dynamically from the XML UI
* framework. If the toolbar does not exist one will be created.
*
* @param name The internal name of the toolbar. If no name is
* specified "mainToolBar" is assumed.
*
* @return A pointer to the toolbar
**/
KToolBar *toolBar(const QString &name = QString());
/**
* @return A list of all toolbars for this window
*/
QList<KToolBar *> toolBars() const;
/**
* Call this to enable "auto-save" of toolbar/menubar/statusbar settings
* (and optionally window size).
* If the *bars were moved around/shown/hidden when the window is closed,
* saveMainWindowSettings( KConfigGroup(KSharedConfig::openConfig(), groupName) ) will be called.
*
* @param groupName a name that identifies this "type of window".
* You can have several types of window in the same application.
*
* @param saveWindowSize set it to true to include the window size
* when saving.
*
* Typically, you will call setAutoSaveSettings() in your
* KMainWindow-inherited class constructor, and it will take care
* of restoring and saving automatically. Make sure you call this
* _after all_ your *bars have been created.
*
* To make sure that KMainWindow propertly obtains the default
* size of the window you should do the following:
* - Remove hard coded resize() calls in the constructor or main, they
* should be removed in favor of letting the automatic resizing
* determine the default window size. Hard coded window sizes will
* be wrong for users that have big fonts, use different styles,
* long/small translations, large toolbars, and other factors.
* - Put the setAutoSaveSettings ( or setupGUI() ) call after all widgets
* have been created and placed inside the main window (i.e. for 99% of
* apps setCentralWidget())
* - Widgets that inherit from QWidget (like game boards) should overload
* "virtual QSize sizeHint() const;" to specify a default size rather
* than letting QWidget::adjust use the default size of 0x0.
*/
void setAutoSaveSettings(const QString &groupName = QLatin1String("MainWindow"),
bool saveWindowSize = true);
/**
* Overload that lets you specify a KConfigGroup.
* This allows the settings to be saved into another file than KSharedConfig::openConfig().
* @since 4.1
*/
void setAutoSaveSettings(const KConfigGroup &group,
bool saveWindowSize = true);
/**
* Disable the auto-save-settings feature.
* You don't normally need to call this, ever.
*/
void resetAutoSaveSettings();
/**
* @return the current autosave setting, i.e. true if setAutoSaveSettings() was called,
* false by default or if resetAutoSaveSettings() was called.
*/
bool autoSaveSettings() const;
/**
* @return the group used for setting-autosaving.
* Only meaningful if setAutoSaveSettings(QString) was called.
* This can be useful for forcing a save or an apply, e.g. before and after
* using KEditToolbar.
*
* NOTE: you should rather use saveAutoSaveSettings() for saving or autoSaveConfigGroup() for loading.
* This method doesn't make sense if setAutoSaveSettings(KConfigGroup) was called.
*/
QString autoSaveGroup() const;
/**
* @return the group used for setting-autosaving.
* Only meaningful if setAutoSaveSettings() was called.
* This can be useful for forcing an apply, e.g. after using KEditToolbar.
* @since 4.1
*/
KConfigGroup autoSaveConfigGroup() const;
/**
* Read settings for statusbar, menubar and toolbar from their respective
* groups in the config file and apply them.
*
* @param config Config group to read the settings from.
* KF5 porting note: the unused bool argument was removed, make sure to remove it from your
* reimplementations too! And add a override for good measure.
*/
virtual void applyMainWindowSettings(const KConfigGroup &config);
/**
* Save settings for statusbar, menubar and toolbar to their respective
* groups in the config group @p config.
*
* @param config Config group to save the settings to.
*/
void saveMainWindowSettings(KConfigGroup &config);
/**
* Returns the path under which this window's D-Bus object is exported.
* @since 4.0.1
*/
QString dbusName() const;
public Q_SLOTS:
/**
* Makes a KDE compliant caption (window title).
*
* @param caption Your caption. @em Do @em not include the application name
* in this string. It will be added automatically according to the KDE
* standard.
*/
virtual void setCaption(const QString &caption);
/**
* Makes a KDE compliant caption.
*
* @param caption Your caption. @em Do @em not include the application name
* in this string. It will be added automatically according to the KDE
* standard.
* @param modified Specify whether the document is modified. This displays
* an additional sign in the title bar, usually "**".
*/
virtual void setCaption(const QString &caption, bool modified);
/**
* Make a plain caption without any modifications.
*
* @param caption Your caption. This is the string that will be
* displayed in the window title.
*/
virtual void setPlainCaption(const QString &caption);
/**
* Open the help page for the application.
*
* The application name is
* used as a key to determine what to display and the system will attempt
* to open \<appName\>/index.html.
*
* This method is intended for use by a help button in the toolbar or
* components outside the regular help menu. Use helpMenu() when you
* want to provide access to the help system from the help menu.
*
* Example (adding a help button to the first toolbar):
*
* \code
* toolBar(0)->addAction(KisIconUtils::loadIcon("help-contents"), i18n("Help"),
* this, SLOT(appHelpActivated()));
* \endcode
*
*/
void appHelpActivated(void);
/**
* Tell the main window that it should save its settings when being closed.
* This is part of the auto-save-settings feature.
* For everything related to toolbars this happens automatically,
* but you have to call setSettingsDirty() in the slot that toggles
* the visibility of the statusbar.
*/
void setSettingsDirty();
protected:
/**
* Reimplemented to catch QEvent::Polish in order to adjust the object name
* if needed, once all constructor code for the main window has run.
* Also reimplemented to catch when a QDockWidget is added or removed.
*/
bool event(QEvent *event) override;
/**
* Reimplemented to autosave settings and call queryClose().
*
* We recommend that you reimplement queryClose() rather than closeEvent().
* If you do it anyway, ensure to call the base implementation to keep
* the feature of auto-saving window settings working.
*/
void closeEvent(QCloseEvent *) override;
/**
Called before the window is closed, either by the user or indirectly by
the session manager.
The purpose of this function is to prepare the window in a way that it is
safe to close it, i.e. without the user losing some data.
Default implementation returns true. Returning @p false will cancel
the closing, and, if KApplication::sessionSaving() is true, it will also
cancel KDE logout.
Reimplement this function to prevent the user from losing data.
Example:
\code
switch ( KMessageBox::warningYesNoCancel( this,
i18n("Save changes to document foo?")) ) {
case KMessageBox::Yes :
// save document here. If saving fails, return false;
return true;
case KMessageBox::No :
return true;
default: // cancel
return false;
\endcode
Note that you should probably @em not actually close the document from
within this method, as it may be called by the session manager before the
session is saved. If the document is closed before the session save occurs,
its location might not be properly saved. In addition, the session shutdown
may be canceled, in which case the document should remain open.
@see KApplication::sessionSaving()
*/
virtual bool queryClose();
/**
* Save your instance-specific properties. The function is
* invoked when the session manager requests your application
* to save its state.
*
* Please reimplement these function in childclasses.
*
* Note: No user interaction is allowed
* in this function!
*
*/
virtual void saveProperties(KConfigGroup &) {}
/**
* Read your instance-specific properties.
*
* Is called indirectly by restore().
*/
virtual void readProperties(const KConfigGroup &) {}
/**
* Save your application-wide properties. The function is
* invoked when the session manager requests your application
* to save its state.
*
* This function is similar to saveProperties() but is only called for
* the very first main window, regardless how many main window are open.
* Override it if you need to save other data about your documents on
* session end. sessionConfig is a config to which that data should be
* saved. Normally, you don't need this function. But if you want to save
* data about your documents that are not in opened windows you might need
* it.
*
* Default implementation does nothing.
*/
virtual void saveGlobalProperties(KConfig *sessionConfig);
/**
* The counterpart of saveGlobalProperties().
*
* Read the application-specific properties in again.
*/
virtual void readGlobalProperties(KConfig *sessionConfig);
void savePropertiesInternal(KConfig *, int);
bool readPropertiesInternal(KConfig *, int);
/**
* For inherited classes
*/
bool settingsDirty() const;
protected Q_SLOTS:
/**
* This slot should only be called in case you reimplement closeEvent() and
* if you are using the "auto-save" feature. In all other cases,
* setSettingsDirty() should be called instead to benefit from the delayed
* saving.
*
* @see setAutoSaveSettings
* @see setSettingsDirty
*
* Example:
* \code
*
* void MyMainWindow::closeEvent( QCloseEvent *e )
* {
* // Save settings if auto-save is enabled, and settings have changed
* if ( settingsDirty() && autoSaveSettings() )
* saveAutoSaveSettings();
* ..
* }
* \endcode
*/
void saveAutoSaveSettings();
protected:
KMainWindow(KMainWindowPrivate &dd, QWidget *parent, Qt::WindowFlags f);
KMainWindowPrivate *const k_ptr;
private:
Q_PRIVATE_SLOT(k_func(), void _k_slotSettingsChanged(int))
Q_PRIVATE_SLOT(k_func(), void _k_slotSaveAutoSaveSize())
};
/**
* @def KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS
* @ingroup XMLGUIMacros
* Returns the maximal number of arguments that are actually
* supported by kRestoreMainWindows().
**/
#define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS 3
/**
* Restores the last session. (To be used in your main function).
*
* These functions work also if you have more than one kind of toplevel
* widget (each derived from KMainWindow, of course).
*
* Imagine you have three kinds of toplevel widgets: the classes childMW1,
* childMW2 and childMW3. Than you can just do:
*
* \code
* if (qApp->isSessionRestored())
* kRestoreMainWindows< childMW1, childMW2, childMW3 >();
* else {
* // create default application as usual
* }
* \endcode
*
* kRestoreMainWindows<>() will create (on the heap) as many instances
* of your main windows as have existed in the last session and
* call KMainWindow::restore() with the correct arguments. Note that
* also QWidget::show() is called implicitly.
*
* Currently, these functions are provided for up to three
* template arguments. If you need more, tell us. To help you in
* deciding whether or not you can use kRestoreMainWindows, a
* define #KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided.
*
* @see KMainWindow::restore()
* @see KMainWindow::classNameOfToplevel()
**/
template <typename T>
inline void kRestoreMainWindows()
{
for (int n = 1; KMainWindow::canBeRestored(n); ++n) {
const QString className = KMainWindow::classNameOfToplevel(n);
if (className == QLatin1String(T::staticMetaObject.className())) {
(new T)->restore(n);
}
}
}
template <typename T0, typename T1>
inline void kRestoreMainWindows()
{
const char *classNames[2];
classNames[0] = T0::staticMetaObject.className();
classNames[1] = T1::staticMetaObject.className();
for (int n = 1; KMainWindow::canBeRestored(n); ++n) {
const QString className = KMainWindow::classNameOfToplevel(n);
if (className == QLatin1String(classNames[0])) {
(new T0)->restore(n);
} else if (className == QLatin1String(classNames[1])) {
(new T1)->restore(n);
}
}
}
template <typename T0, typename T1, typename T2>
inline void kRestoreMainWindows()
{
const char *classNames[3];
classNames[0] = T0::staticMetaObject.className();
classNames[1] = T1::staticMetaObject.className();
classNames[2] = T2::staticMetaObject.className();
for (int n = 1; KMainWindow::canBeRestored(n); ++n) {
const QString className = KMainWindow::classNameOfToplevel(n);
if (className == QLatin1String(classNames[0])) {
(new T0)->restore(n);
} else if (className == QLatin1String(classNames[1])) {
(new T1)->restore(n);
} else if (className == QLatin1String(classNames[2])) {
(new T2)->restore(n);
}
}
}
#endif
diff --git a/libs/widgetutils/xmlgui/kmainwindow_p.h b/libs/widgetutils/xmlgui/kmainwindow_p.h
index c4a79eff32..21e4203ef9 100644
--- a/libs/widgetutils/xmlgui/kmainwindow_p.h
+++ b/libs/widgetutils/xmlgui/kmainwindow_p.h
@@ -1,88 +1,88 @@
/*
This file is part of the KDE libraries
Copyright
(C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997 Stephan Kulow (coolo@kde.org)
(C) 1997-2000 Sven Radej (radej@kde.org)
(C) 1997-2000 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 2002 Joseph Wenninger (jowenn@kde.org)
(C) 2005-2006 Hamish Rodda (rodda@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KMAINWINDOW_P_H
#define KMAINWINDOW_P_H
#include <kconfiggroup.h>
#include <QPointer>
#include <QEventLoopLocker>
#define K_D(Class) Class##Private * const d = k_func()
class QObject;
class QSessionManager;
class QTimer;
class KHelpMenu;
class KMainWindow;
class KMainWindowPrivate
{
public:
bool autoSaveSettings: 1;
bool settingsDirty: 1;
bool autoSaveWindowSize: 1;
bool sizeApplied: 1;
KConfigGroup autoSaveGroup;
QTimer *settingsTimer;
QTimer *sizeTimer;
QRect defaultWindowSize;
KHelpMenu *helpMenu;
KMainWindow *q;
QPointer<QObject> dockResizeListener;
QString dbusName;
bool letDirtySettings;
QEventLoopLocker locker;
// This slot will be called when the style KCM changes settings that need
// to be set on the already running applications.
void _k_slotSettingsChanged(int category);
void _k_slotSaveAutoSaveSize();
void init(KMainWindow *_q);
void polish(KMainWindow *q);
enum CallCompression {
NoCompressCalls = 0,
CompressCalls
};
void setSettingsDirty(CallCompression callCompression = CompressCalls);
void setSizeDirty();
};
class KMWSessionManager : public QObject
{
Q_OBJECT
public:
KMWSessionManager();
- ~KMWSessionManager();
+ ~KMWSessionManager() override;
private Q_SLOTS:
bool saveState(QSessionManager &);
};
#endif
diff --git a/libs/widgetutils/xmlgui/kmainwindowiface_p.h b/libs/widgetutils/xmlgui/kmainwindowiface_p.h
index 4e1dbed847..daafae8686 100644
--- a/libs/widgetutils/xmlgui/kmainwindowiface_p.h
+++ b/libs/widgetutils/xmlgui/kmainwindowiface_p.h
@@ -1,119 +1,119 @@
/* This file is part of the KDE project
Copyright (C) 2001 Ian Reinhart Geiser <geiseri@yahoo.com>
Copyright (C) 2006 Thiago Macieira <thiago@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KMAINWINDOWIFACE_P_H
#define KMAINWINDOWIFACE_P_H
#include <QDBusAbstractAdaptor>
#include <QtCore/QMap>
class KXmlGuiWindow;
/**
* @short D-Bus interface to KMainWindow.
*
* This is the main interface to the KMainWindow. This will provide a consistent
* D-Bus interface to all KDE applications that use it.
*
* @author Ian Reinhart Geiser <geiseri@yahoo.com>
*/
class KMainWindowInterface : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.KMainWindow")
public:
/**
Construct a new interface object.
@param mainWindow - The parent KMainWindow object
that will provide us with the KAction objects.
*/
KMainWindowInterface(KXmlGuiWindow *mainWindow);
/**
Destructor
Cleans up the dcop action proxy object.
**/
- ~KMainWindowInterface();
+ ~KMainWindowInterface() override;
public Q_SLOTS:
/**
Return a list of actions available to the application's window.
@return A QStringList containing valid names actions.
*/
QStringList actions();
/**
Activates the requested action.
@param action The name of the action to activate. The names of valid
actions can be found by calling actions().
@return The success of the operation.
*/
bool activateAction(const QString &action);
/**
Disables the requested action.
@param action The name of the action to disable. The names of valid
actions can be found by calling actions().
@return The success of the operation.
*/
bool disableAction(const QString &action);
/**
Enables the requested action.
@param action The name of the action to enable. The names of valid
actions can be found by calling actions().
@return The success of the operation.
*/
bool enableAction(const QString &action);
/**
Returns the status of the requested action.
@param action The name of the action. The names of valid
actions can be found by calling actions().
@returns The state of the action, true - enabled, false - disabled.
*/
bool actionIsEnabled(const QString &action);
/**
Returns the tool tip text of the requested action.
@param action The name of the action to activate. The names of valid
actions can be found by calling actions().
@return A QString containing the text of the action's tool tip.
*/
QString actionToolTip(const QString &action);
/**
Returns the ID of the current main window.
This is useful for automated screen captures or other evil
widget fun.
@return A integer value of the main window's ID.
**/
qlonglong winId();
/**
Copies a pixmap representation of the current main window to
the clipboard.
**/
void grabWindowToClipBoard();
private:
KXmlGuiWindow *m_MainWindow;
};
#endif // KMAINWINDOWIFACE_P_H
diff --git a/libs/widgetutils/xmlgui/kmenumenuhandler_p.h b/libs/widgetutils/xmlgui/kmenumenuhandler_p.h
index e43995b911..e906b05032 100644
--- a/libs/widgetutils/xmlgui/kmenumenuhandler_p.h
+++ b/libs/widgetutils/xmlgui/kmenumenuhandler_p.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE project
Copyright (C) 2006 Olivier Goffart <ogoffart@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kmenumenuhandler_p_h
#define kmenumenuhandler_p_h
#include <QObject>
class QAction;
class QMenu;
class KXMLGUIBuilder;
class KSelectAction;
namespace KDEPrivate
{
/**
* @internal
* This class handle the context menu of QMenu.
* Used by KXmlGuiBuilder
* @author Olivier Goffart <ogoffart@kde.org>
*/
class KMenuMenuHandler : public QObject
{
Q_OBJECT
public:
KMenuMenuHandler(KXMLGUIBuilder *b);
- ~KMenuMenuHandler() {}
+ ~KMenuMenuHandler() override {}
void insertMenu(QMenu *menu);
bool eventFilter(QObject *watched, QEvent *event) override;
private Q_SLOTS:
void slotSetShortcut();
void buildToolbarAction();
void slotAddToToolBar(int);
private:
void showContextMenu(QMenu *menu, const QPoint &pos);
KXMLGUIBuilder *m_builder;
KSelectAction *m_toolbarAction;
QMenu *m_popupMenu;
QAction *m_popupAction;
QMenu *m_contextMenu;
};
} //END namespace KDEPrivate
#endif
diff --git a/libs/widgetutils/xmlgui/kshortcutwidget.h b/libs/widgetutils/xmlgui/kshortcutwidget.h
index eb70b57e60..e98f3a58b1 100644
--- a/libs/widgetutils/xmlgui/kshortcutwidget.h
+++ b/libs/widgetutils/xmlgui/kshortcutwidget.h
@@ -1,89 +1,89 @@
/* This file is part of the KDE libraries
Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KSHORTCUTWIDGET_H
#define KSHORTCUTWIDGET_H
#include <kritawidgetutils_export.h>
#include <QKeySequence>
#include <QList>
#include <QWidget>
class KActionCollection;
class KShortcutWidgetPrivate;
/**
* \image html kshortcutwidget.png "KDE Shortcut Widget"
*/
class KRITAWIDGETUTILS_EXPORT KShortcutWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(bool modifierlessAllowed READ isModifierlessAllowed WRITE setModifierlessAllowed)
public:
KShortcutWidget(QWidget *parent = 0);
- ~KShortcutWidget();
+ ~KShortcutWidget() override;
void setModifierlessAllowed(bool allow);
bool isModifierlessAllowed();
void setClearButtonsShown(bool show);
QList<QKeySequence> shortcut() const;
/**
* Set a list of action collections to check against for conflictuous shortcut.
*
* If there is a conflictuous shortcut with a KAction, and that his shortcut can be configured
* (KAction::isShortcutConfigurable() returns true) the user will be prompted for eventually steal
* the shortcut from this action
*
* Global shortcuts are automatically checked for conflicts
*
* Don't forget to call applyStealShortcut to actually steal the shortcut.
*
* @since 4.1
*/
void setCheckActionCollections(const QList<KActionCollection *> &actionCollections);
Q_SIGNALS:
void shortcutChanged(const QList<QKeySequence> &cut);
public Q_SLOTS:
void setShortcut(const QList<QKeySequence> &cut);
void clearShortcut();
/**
* Actually remove the shortcut that the user wanted to steal, from the
* action that was using it.
*
* To be called before you apply your changes.
* No shortcuts are stolen until this function is called.
*/
void applyStealShortcut();
private:
Q_PRIVATE_SLOT(d, void priKeySequenceChanged(const QKeySequence &))
Q_PRIVATE_SLOT(d, void altKeySequenceChanged(const QKeySequence &))
private:
friend class KShortcutWidgetPrivate;
KShortcutWidgetPrivate *const d;
};
#endif //KSHORTCUTWIDGET_H
diff --git a/libs/widgetutils/xmlgui/kswitchlanguagedialog_p.h b/libs/widgetutils/xmlgui/kswitchlanguagedialog_p.h
index 753c81679c..573198b5e1 100644
--- a/libs/widgetutils/xmlgui/kswitchlanguagedialog_p.h
+++ b/libs/widgetutils/xmlgui/kswitchlanguagedialog_p.h
@@ -1,94 +1,94 @@
/*
* This file is part of the KDE Libraries
* Copyright (C) 2007 Krzysztof Lichota (lichota@mimuw.edu.pl)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef _KSWITCHLANGUAGEDIALOG_H_
#define _KSWITCHLANGUAGEDIALOG_H_
#include <QDialog>
namespace KDEPrivate
{
class KSwitchLanguageDialogPrivate;
/**
* @short Standard "switch application language" dialog box.
*
* This class provides "switch application language" dialog box that is used
* in KHelpMenu
*
* @author Krzysztof Lichota (lichota@mimuw.edu.pl)
* @internal
*/
class KSwitchLanguageDialog : public QDialog
{
Q_OBJECT
public:
/**
* Constructor. Creates a fully featured "Switch application language" dialog box.
* Note that this dialog is made modeless in the KHelpMenu class so
* the users may expect a modeless dialog.
*
* @param parent The parent of the dialog box. You should use the
* toplevel window so that the dialog becomes centered.
* @param name Internal name of the widget. This name in not used in the
* caption.
* @param modal If false, this widget will be modeless and must be
* made visible using QWidget::show(). Otherwise it will be
* modal and must be made visible using QWidget::exec()
*/
KSwitchLanguageDialog(QWidget *parent = 0);
- virtual ~KSwitchLanguageDialog();
+ ~KSwitchLanguageDialog() override;
protected Q_SLOTS:
/**
* Activated when the Ok button has been clicked.
*/
virtual void slotOk();
void slotDefault();
/**
Called when one of language buttons changes state.
*/
virtual void languageOnButtonChanged(const QString &);
/**
Called to add one language button to dialog.
*/
virtual void slotAddLanguageButton();
/**
Called when "Remove" language button is clicked.
*/
virtual void removeButtonClicked();
private:
KSwitchLanguageDialogPrivate *const d;
friend class KSwitchLanguageDialogPrivate;
};
}
#endif
diff --git a/libs/widgetutils/xmlgui/ktoggletoolbaraction.h b/libs/widgetutils/xmlgui/ktoggletoolbaraction.h
index fa7a863984..7c29f9ff85 100644
--- a/libs/widgetutils/xmlgui/ktoggletoolbaraction.h
+++ b/libs/widgetutils/xmlgui/ktoggletoolbaraction.h
@@ -1,95 +1,95 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2003 Andras Mantia <amantia@kde.org>
(C) 2005-2006 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KTOGGLETOOLBARACTION_H
#define KTOGGLETOOLBARACTION_H
#include <ktoggleaction.h>
#include <kritawidgetutils_export.h>
class KToolBar;
/**
* An action that takes care of everything associated with
* showing or hiding a toolbar by a menu action. It will
* show or hide the toolbar with the given name when
* activated, and check or uncheck itself if the toolbar
* is manually shown or hidden.
*
* If you need to perfom some additional action when the
* toolbar is shown or hidden, connect to the toggled(bool)
* signal. It will be emitted after the toolbar's
* visibility has changed, whenever it changes.
*/
class KRITAWIDGETUTILS_EXPORT KToggleToolBarAction : public KToggleAction
{
Q_OBJECT
public:
/**
* Create a KToggleToolbarAction that manages the toolbar
* named toolBarName. This can be either the name of a
* toolbar in an xml ui file, or a toolbar programmatically
* created with that name.
*
* @param The action's parent object.
*/
KToggleToolBarAction(const char *toolBarName, const QString &text, QObject *parent);
/**
* Create a KToggleToolbarAction that manages the @param toolBar.
* This can be either the name of a toolbar in an xml ui file,
* or a toolbar programmatically created with that name.
*
* @param toolBar the toolbar to be managed
* @param parent The action's parent object.
*/
KToggleToolBarAction(KToolBar *toolBar, const QString &text, QObject *parent);
/**
* Destroys toggle toolbar action.
*/
- virtual ~KToggleToolBarAction();
+ ~KToggleToolBarAction() override;
/**
* Returns a pointer to the tool bar it manages.
*/
KToolBar *toolBar();
/**
* Reimplemented from @see QObject.
*/
bool eventFilter(QObject *watched, QEvent *event) override;
private Q_SLOTS:
void slotToggled(bool checked) override;
private:
class Private;
Private *const d;
};
#endif
diff --git a/libs/widgetutils/xmlgui/ktoolbar.h b/libs/widgetutils/xmlgui/ktoolbar.h
index c84b13def6..8773a7f992 100644
--- a/libs/widgetutils/xmlgui/ktoolbar.h
+++ b/libs/widgetutils/xmlgui/ktoolbar.h
@@ -1,248 +1,248 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997, 1998 Stephan Kulow (coolo@kde.org)
(C) 1997, 1998 Sven Radej (radej@kde.org)
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 1999, 2000 Kurt Granroth (granroth@kde.org)
(C) 2005-2006 Hamish Rodda (rodda@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KTOOLBAR_H
#define KTOOLBAR_H
#include <kritawidgetutils_export.h>
#include <QToolBar>
class QDomElement;
class KConfigGroup;
class KConfig;
class KMainWindow;
class KXMLGUIClient;
/**
* @short Floatable toolbar with auto resize.
*
* A KDE-style toolbar.
*
* KToolBar can be used as a standalone widget, but KMainWindow
* provides easy factories and management of one or more toolbars.
*
* KToolBar uses a global config group to load toolbar settings on
* construction. It will reread this config group on a
* KApplication::appearanceChanged() signal.
*
* KToolBar respects Kiosk settings (see the KAuthorized namespace in the
* KConfig framework). In particular, system administrators can prevent users
* from moving toolbars with the "movable_toolbars" action, and from showing or
* hiding toolbars with the "options_show_toolbar" action. For example, to
* disable both, add the following the application or global configuration:
* @verbatim
[KDE Action Restrictions][$i]
movable_toolbars=false
options_show_toolbar=false
@endverbatim
*
* @note If you can't depend on KXmlGui but you want to integrate with KDE, you can use QToolBar with:
* Set ToolButtonStyle to Qt::ToolButtonFollowStyle, this will make QToolBar use the settings for "Main Toolbar"
* Additionally set QToolBar::setProperty("otherToolbar", true) to use settings for "Other toolbars"
* Settings from "Other toolbars" will only work on widget styles derived from KStyle
* @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>, Hamish Rodda <rodda@kde.org>.
*/
class KRITAWIDGETUTILS_EXPORT KToolBar : public QToolBar
{
Q_OBJECT
public:
/**
* Constructor.
*
* This constructor takes care of adding the toolbar to the mainwindow,
* if @p parent is a QMainWindow.
*
* Normally KDE applications do not call this directly, they either
* call KMainWindow::toolBar(name), or they use XML-GUI and specify
* toolbars using XML.
*
* @param parent The standard toolbar parent (usually a KMainWindow)
* @param isMainToolBar True for the "main toolbar", false for other toolbars. Different settings apply.
* @param readConfig whether to apply the configuration (global and application-specific)
*/
explicit KToolBar(QWidget *parent, bool isMainToolBar = false, bool readConfig = true);
// KDE5: remove. The one below is preferred so that all debug output from init() shows the right objectName already,
// and so that isMainToolBar() and iconSizeDefault() return correct values during loading too.
/**
* Constructor.
*
* This constructor takes care of adding the toolbar to the mainwindow,
* if @p parent is a QMainWindow.
*
* Normally KDE applications do not call this directly, they either
* call KMainWindow::toolBar(name), or they use XML-GUI and specify
* toolbars using XML.
*
* @param objectName The QObject name of this toolbar, required so that QMainWindow can save and load the toolbar position,
* and so that KToolBar can find out if it's the main toolbar.
* @param parent The standard toolbar parent (usually a KMainWindow)
* @param readConfig whether to apply the configuration (global and application-specific)
*/
explicit KToolBar(const QString &objectName, QWidget *parent, bool readConfig = true);
/**
* Alternate constructor with additional arguments, e.g. to choose in which area
* the toolbar should be auto-added. This is rarely used in KDE. When using XMLGUI
* you can specify this as an xml attribute instead.
*
* @param objectName The QObject name of this toolbar, required so that QMainWindow can save and load the toolbar position
* @param parentWindow The window that should be the parent of this toolbar
* @param area The position of the toolbar. Usually Qt::TopToolBarArea.
* @param newLine If true, start a new line in the dock for this toolbar.
* @param isMainToolBar True for the "main toolbar", false for other toolbars. Different settings apply.
* @param readConfig whether to apply the configuration (global and application-specific)
*/
KToolBar(const QString &objectName, QMainWindow *parentWindow, Qt::ToolBarArea area, bool newLine = false,
bool isMainToolBar = false, bool readConfig = true); // KDE5: remove, I don't think anyone is using this.
/**
* Destroys the toolbar.
*/
- virtual ~KToolBar();
+ ~KToolBar() override;
/**
* Returns the main window that this toolbar is docked with.
*/
KMainWindow *mainWindow() const;
/**
* Convenience function to set icon size
*/
void setIconDimensions(int size);
/**
* Returns the default size for this type of toolbar.
*
* @return the default size for this type of toolbar.
*/
int iconSizeDefault() const; // KDE5: hide from public API. Doesn't make sense to export this, and it isn't used.
/**
* Save the toolbar settings to group @p configGroup in @p config.
*/
void saveSettings(KConfigGroup &cg);
/**
* Read the toolbar settings from group @p configGroup in @p config
* and apply them.
*/
void applySettings(const KConfigGroup &cg);
/**
* Adds an XML gui client that uses this toolbar
* @since 4.8.1
*/
void addXMLGUIClient(KXMLGUIClient *client);
/**
* Removes an XML gui client that uses this toolbar
* @since 4.8.5
*/
void removeXMLGUIClient(KXMLGUIClient *client);
/**
* Load state from an XML @param element, called by KXMLGUIBuilder.
*/
void loadState(const QDomElement &element);
/**
* Save state into an XML @param element, called by KXMLGUIBuilder.
*/
void saveState(QDomElement &element) const;
/**
* Reimplemented to support context menu activation on disabled tool buttons.
*/
bool eventFilter(QObject *watched, QEvent *event) override;
/**
* Returns whether the toolbars are currently editable (drag & drop of actions).
*/
static bool toolBarsEditable();
/**
* Enable or disable toolbar editing via drag & drop of actions. This is
* called by KEditToolbar and should generally be set to disabled whenever
* KEditToolbar is not active.
*/
static void setToolBarsEditable(bool editable);
/**
* Returns whether the toolbars are locked (i.e., moving of the toobars disallowed).
*/
static bool toolBarsLocked();
/**
* Allows you to lock and unlock all toolbars (i.e., disallow/allow moving of the toobars).
*/
static void setToolBarsLocked(bool locked);
/**
* Emits a dbus signal to tell all toolbars in all applications, that the user settings have
* changed.
* @since 5.0
*/
static void emitToolbarStyleChanged();
protected Q_SLOTS:
virtual void slotMovableChanged(bool movable);
protected:
void contextMenuEvent(QContextMenuEvent *) override;
void actionEvent(QActionEvent *) override;
// Draggable toolbar configuration
void dragEnterEvent(QDragEnterEvent *) override;
void dragMoveEvent(QDragMoveEvent *) override;
void dragLeaveEvent(QDragLeaveEvent *) override;
void dropEvent(QDropEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
private:
class Private;
Private *const d;
Q_PRIVATE_SLOT(d, void slotAppearanceChanged())
Q_PRIVATE_SLOT(d, void slotContextAboutToShow())
Q_PRIVATE_SLOT(d, void slotContextAboutToHide())
Q_PRIVATE_SLOT(d, void slotContextLeft())
Q_PRIVATE_SLOT(d, void slotContextRight())
Q_PRIVATE_SLOT(d, void slotContextShowText())
Q_PRIVATE_SLOT(d, void slotContextTop())
Q_PRIVATE_SLOT(d, void slotContextBottom())
Q_PRIVATE_SLOT(d, void slotContextIcons())
Q_PRIVATE_SLOT(d, void slotContextText())
Q_PRIVATE_SLOT(d, void slotContextTextRight())
Q_PRIVATE_SLOT(d, void slotContextTextUnder())
Q_PRIVATE_SLOT(d, void slotContextIconSize())
Q_PRIVATE_SLOT(d, void slotLockToolBars(bool))
};
#endif
diff --git a/libs/widgetutils/xmlgui/ktoolbarhandler_p.h b/libs/widgetutils/xmlgui/ktoolbarhandler_p.h
index 1497bf53cd..954faf88fb 100644
--- a/libs/widgetutils/xmlgui/ktoolbarhandler_p.h
+++ b/libs/widgetutils/xmlgui/ktoolbarhandler_p.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE libraries
Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KTOOLBARHANDLER_H
#define KTOOLBARHANDLER_H
#include <QtCore/QLinkedList>
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <kxmlguiclient.h>
class KXmlGuiWindow;
namespace KDEPrivate
{
class ToolBarHandler : public QObject, public KXMLGUIClient
{
Q_OBJECT
public:
/**
* Creates a new tool bar handler for the supplied
* @param mainWindow.
*/
explicit ToolBarHandler(KXmlGuiWindow *mainWindow);
/**
* Creates a new tool bar handler for the supplied
* @param mainWindow and with the supplied parent.
*/
ToolBarHandler(KXmlGuiWindow *mainWindow, QObject *parent);
/**
* Destroys the tool bar handler.
*/
- virtual ~ToolBarHandler();
+ ~ToolBarHandler() override;
/**
* Returns the action which is responsible for the tool bar menu.
*/
QAction *toolBarMenuAction();
public Q_SLOTS:
void setupActions();
private:
class Private;
Private *const d;
Q_PRIVATE_SLOT(d, void clientAdded(KXMLGUIClient *))
};
} // namespace KDEPrivate
#endif // KTOOLBARHANDLER_H
diff --git a/libs/widgetutils/xmlgui/kxmlguifactory.h b/libs/widgetutils/xmlgui/kxmlguifactory.h
index 8f658944fe..692f4f4d19 100644
--- a/libs/widgetutils/xmlgui/kxmlguifactory.h
+++ b/libs/widgetutils/xmlgui/kxmlguifactory.h
@@ -1,200 +1,200 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kxmlguifactory_h
#define kxmlguifactory_h
#include <kritawidgetutils_export.h>
#include <QtCore/QObject>
class QAction;
class KXMLGUIFactoryPrivate;
class KXMLGUIClient;
class KXMLGUIBuilder;
class QDomAttr;
class QDomDocument;
class QDomElement;
class QDomNode;
class QDomNamedNodeMap;
namespace KXMLGUI
{
struct MergingIndex;
struct ContainerNode;
struct ContainerClient;
class BuildHelper;
}
/**
* KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create
* a GUI of container widgets (like menus, toolbars, etc.) and container items
* (menu items, toolbar buttons, etc.) from an XML document and action objects.
*
* Each KXMLGUIClient represents a part of the GUI, composed from containers and
* actions. KXMLGUIFactory takes care of building (with the help of a KXMLGUIBuilder)
* and merging the GUI from an unlimited number of clients.
*
* Each client provides XML through a QDomDocument and actions through a
* KActionCollection . The XML document contains the rules for how to merge the
* GUI.
*
* KXMLGUIFactory processes the DOM tree provided by a client and plugs in the client's actions,
* according to the XML and the merging rules of previously inserted clients. Container widgets
* are built via a KXMLGUIBuilder , which has to be provided with the KXMLGUIFactory constructor.
*/
class KRITAWIDGETUTILS_EXPORT KXMLGUIFactory : public QObject
{
friend class KXMLGUI::BuildHelper;
Q_OBJECT
public:
/**
* Constructs a KXMLGUIFactory. The provided @p builder KXMLGUIBuilder will be called
* for creating and removing container widgets, when clients are added/removed from the GUI.
*
* Note that the ownership of the given KXMLGUIBuilder object won't be transferred to this
* KXMLGUIFactory, so you have to take care of deleting it properly.
*/
explicit KXMLGUIFactory(KXMLGUIBuilder *builder, QObject *parent = 0);
/**
* Destructor
*/
- ~KXMLGUIFactory();
+ ~KXMLGUIFactory() override;
// XXX move to somewhere else? (Simon)
/// @internal
static QString readConfigFile(const QString &filename,
const QString &componentName = QString());
/// @internal
static bool saveConfigFile(const QDomDocument &doc, const QString &filename,
const QString &componentName = QString());
/**
* @internal
* Find or create the ActionProperties element, used when saving custom action properties
*/
static QDomElement actionPropertiesElement(QDomDocument &doc);
/**
* @internal
* Find or create the element for a given action, by name.
* Used when saving custom action properties
*/
static QDomElement findActionByName(QDomElement &elem, const QString &sName, bool create);
/**
* Creates the GUI described by the QDomDocument of the client,
* using the client's actions, and merges it with the previously
* created GUI.
* This also means that the order in which clients are added to the factory
* is relevant; assuming that your application supports plugins, you should
* first add your application to the factory and then the plugin, so that the
* plugin's UI is merged into the UI of your application, and not the other
* way round.
*/
void addClient(KXMLGUIClient *client);
/**
* Removes the GUI described by the client, by unplugging all
* provided actions and removing all owned containers (and storing
* container state information in the given client)
*/
void removeClient(KXMLGUIClient *client);
void plugActionList(KXMLGUIClient *client, const QString &name, const QList<QAction *> &actionList);
void unplugActionList(KXMLGUIClient *client, const QString &name);
/**
* Returns a list of all clients currently added to this factory
*/
QList<KXMLGUIClient *> clients() const;
/**
* Use this method to get access to a container widget with the name specified with @p containerName
* and which is owned by the @p client. The container name is specified with a "name" attribute in the
* XML document.
*
* This function is particularly useful for getting hold of a popupmenu defined in an XMLUI file.
* For instance:
* \code
* QMenu *popup = static_cast<QMenu*>(guiFactory()->container("my_popup",this));
* \endcode
* where @p "my_popup" is the name of the menu in the XMLUI file, and
* @p "this" is XMLGUIClient which owns the popupmenu (e.g. the mainwindow, or the part, or the plugin...)
*
* @param containerName Name of the container widget
* @param client Owner of the container widget
* @param useTagName Specifies whether to compare the specified name with the name attribute or
* the tag name.
*
* This method may return 0 if no container with the given name exists or is not owned by the client.
*/
QWidget *container(const QString &containerName, KXMLGUIClient *client, bool useTagName = false);
QList<QWidget *> containers(const QString &tagName);
/**
* Use this method to free all memory allocated by the KXMLGUIFactory. This deletes the internal node
* tree and therefore resets the internal state of the class. Please note that the actual GUI is
* NOT touched at all, meaning no containers are deleted nor any actions unplugged. That is
* something you have to do on your own. So use this method only if you know what you are doing :-)
*
* (also note that this will call KXMLGUIClient::setFactory( 0 ) for all inserted clients)
*/
void reset();
/**
* Use this method to free all memory allocated by the KXMLGUIFactory for a specific container,
* including all child containers and actions. This deletes the internal node subtree for the
* specified container. The actual GUI is not touched, no containers are deleted or any actions
* unplugged. Use this method only if you know what you are doing :-)
*
* (also note that this will call KXMLGUIClient::setFactory( 0 ) for all clients of the
* container)
*/
void resetContainer(const QString &containerName, bool useTagName = false);
Q_SIGNALS:
void clientAdded(KXMLGUIClient *client);
void clientRemoved(KXMLGUIClient *client);
/**
* Emitted when the factory is currently making changes to the GUI,
* i.e. adding or removing clients.
* makingChanges(true) is emitted before any change happens, and
* makingChanges(false) is emitted after the change is done.
* This allows e.g. KMainWindow to know that the GUI is
* being changed programmatically and not by the user (so there is no reason to
* save toolbar settings afterwards).
* @since 4.1.3
*/
void makingChanges(bool);
private:
friend class KXMLGUIClient;
/// Internal, called by KXMLGUIClient destructor
void forgetClient(KXMLGUIClient *client);
KXMLGUIFactoryPrivate *const d;
};
#endif
diff --git a/libs/widgetutils/xmlgui/kxmlguiwindow.h b/libs/widgetutils/xmlgui/kxmlguiwindow.h
index 6a948929ce..a7a2e6ce28 100644
--- a/libs/widgetutils/xmlgui/kxmlguiwindow.h
+++ b/libs/widgetutils/xmlgui/kxmlguiwindow.h
@@ -1,348 +1,348 @@
/*
This file is part of the KDE libraries
Copyright
(C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997 Stephan Kulow (coolo@kde.org)
(C) 1997-2000 Sven Radej (radej@kde.org)
(C) 1997-2000 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 2002 Joseph Wenninger (jowenn@kde.org)
(C) 2005-2006 Hamish Rodda (rodda@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KXMLGUIWINDOW_H
#define KXMLGUIWINDOW_H
#include "kxmlguiclient.h"
#include "kxmlguibuilder.h"
#include "kmainwindow.h"
#include <QtCore/QMetaClassInfo>
class KMenu;
class KXMLGUIFactory;
class KConfig;
class KConfigGroup;
class KToolBar;
class KXmlGuiWindowPrivate;
#define KDE_DEFAULT_WINDOWFLAGS 0
/**
* @short %KDE top level main window with predefined action layout
*
* Instead of creating a KMainWindow manually and assigning menus, menu entries,
* toolbar buttons and actions to it by hand, this class can be used to load an
* rc file to manage the main window's actions.
*
* See http://techbase.kde.org/Development/Tutorials/Using_KActions#XMLGUI
* for essential information on the XML file format and usage of this class.
*
* @see KMainWindow
* @author Reginald Stadlbauer (reggie@kde.org) Stephan Kulow (coolo@kde.org), Matthias Ettrich (ettrich@kde.org), Chris Schlaeger (cs@kde.org), Sven Radej (radej@kde.org). Maintained by Sven Radej (radej@kde.org)
*/
class KRITAWIDGETUTILS_EXPORT KXmlGuiWindow : public KMainWindow, public KXMLGUIBuilder, virtual public KXMLGUIClient
{
XMLGUI_DECLARE_PRIVATE(KXmlGuiWindow)
Q_OBJECT
Q_PROPERTY(bool hasMenuBar READ hasMenuBar)
Q_PROPERTY(bool autoSaveSettings READ autoSaveSettings)
Q_PROPERTY(QString autoSaveGroup READ autoSaveGroup)
Q_PROPERTY(bool standardToolBarMenuEnabled READ isStandardToolBarMenuEnabled WRITE setStandardToolBarMenuEnabled)
Q_FLAGS(StandardWindowOption)
public:
/**
* Construct a main window.
*
* @param parent The widget parent. This is usually 0 but it may also be the window
* group leader. In that case, the KMainWindow becomes sort of a
* secondary window.
*
* @param f Specify the widget flags. The default is
* Qt::Window and Qt::WA_DeleteOnClose. Qt::Window indicates that a
* main window is a toplevel window, regardless of whether it has a
* parent or not. Qt::WA_DeleteOnClose indicates that a main window is
* automatically destroyed when its window is closed. Pass 0 if
* you do not want this behavior.
*
* @see http://doc.trolltech.com/qt.html#WindowType-enum
*
* KMainWindows must be created on the heap with 'new', like:
* \code
* KMainWindow *kmw = new KMainWindow(...);
* kmw->setObjectName(...);
* \endcode
*
* IMPORTANT: For session management and window management to work
* properly, all main windows in the application should have a
* different name. If you don't do it, KMainWindow will create
* a unique name, but it's recommended to explicitly pass a window name that will
* also describe the type of the window. If there can be several windows of the same
* type, append '#' (hash) to the name, and KMainWindow will replace it with numbers to make
* the names unique. For example, for a mail client which has one main window showing
* the mails and folders, and which can also have one or more windows for composing
* mails, the name for the folders window should be e.g. "mainwindow" and
* for the composer windows "composer#".
*
*/
explicit KXmlGuiWindow(QWidget *parent = 0, Qt::WindowFlags f = KDE_DEFAULT_WINDOWFLAGS);
/**
* \brief Destructor.
*
* Will also destroy the toolbars, and menubar if
* needed.
*/
- virtual ~KXmlGuiWindow();
+ ~KXmlGuiWindow() override;
/**
* Enables the build of a standard help menu when calling createGUI/setupGUI().
*
* The default behavior is to build one, you must call this function
* to disable it
*/
void setHelpMenuEnabled(bool showHelpMenu = true);
/**
* Return @p true when the help menu is enabled
*/
bool isHelpMenuEnabled() const;
virtual KXMLGUIFactory *guiFactory();
/**
* Create a GUI given a local XML file. In a regular app you usually want to use
* setupGUI() instead of this one since it does more things for free
* like setting up the toolbar/shortcut edit actions, etc.
*
* If @p xmlfile is 0,
* then it will try to construct a local XML filename like
* appnameui.xmlgui where 'appname' is your app's name. If that file
* does not exist, then the XML UI code will only use the global
* (standard) XML file for the layout purposes.
*
* @param xmlfile The local xmlfile (relative or absolute)
*/
void createGUI(const QString &xmlfile = QString());
/**
* Sets whether KMainWindow should provide a menu that allows showing/hiding
* the available toolbars ( using KToggleToolBarAction ) . In case there
* is only one toolbar configured a simple 'Show \<toolbar name here\>' menu item
* is shown.
*
* The menu / menu item is implemented using xmlgui. It will be inserted in your
* menu structure in the 'Settings' menu.
*
* If your application uses a non-standard xmlgui resource file then you can
* specify the exact position of the menu / menu item by adding a
* &lt;Merge name="StandardToolBarMenuHandler" /&gt;
* line to the settings menu section of your resource file ( usually appname.xmlgui ).
*
* Note that you should enable this feature before calling createGUI() ( or similar ) .
*/
void setStandardToolBarMenuEnabled(bool enable);
bool isStandardToolBarMenuEnabled() const;
/**
* Sets whether KMainWindow should provide a menu that allows showing/hiding
* of the statusbar ( using KToggleStatusBarAction ).
*
* The menu / menu item is implemented using xmlgui. It will be inserted
* in your menu structure in the 'Settings' menu.
*
* Note that you should enable this feature before calling createGUI()
* ( or similar ).
*
* If an application maintains the action on its own (i.e. never calls
* this function) a connection needs to be made to let KMainWindow
* know when that status (hidden/shown) of the statusbar has changed.
* For example:
* connect(action, SIGNAL(activated()),
* kmainwindow, SLOT(setSettingsDirty()));
* Otherwise the status (hidden/show) of the statusbar might not be saved
* by KMainWindow.
*/
void createStandardStatusBarAction();
/**
* @see setupGUI()
*/
enum StandardWindowOption {
/**
* adds action to show/hide the toolbar(s) and adds
* action to configure the toolbar(s).
* @see setStandardToolBarMenuEnabled
*/
ToolBar = 1,
/**
* adds action to show the key configure action.
*/
Keys = 2,
/**
* adds action to show/hide the statusbar if the
* statusbar exists. @see createStandardStatusBarAction
*/
StatusBar = 4,
/**
* auto-saves (and loads) the toolbar/menubar/statusbar settings and
* window size using the default name. @see setAutoSaveSettings
*
* Typically you want to let the default window size be determined by
* the widgets size hints. Make sure that setupGUI() is called after
* all the widgets are created ( including setCentralWidget ) so the
* default size's will be correct. @see setAutoSaveSettings for
* more information on this topic.
*/
Save = 8,
/**
* calls createGUI() once ToolBar, Keys and Statusbar have been
* taken care of. @see createGUI
*
* NOTE: when using KParts::MainWindow, remove this flag from the
* setupGUI call, since you'll be using createGUI(part) instead.
* @code
* setupGUI(ToolBar | Keys | StatusBar | Save);
* @endcode
*/
Create = 16,
/**
* All the above option
* (this is the default)
*/
Default = ToolBar | Keys | StatusBar | Save | Create
};
Q_DECLARE_FLAGS(StandardWindowOptions, StandardWindowOption)
/**
* Configures the current windows and its actions in the typical KDE
* fashion. The options are all enabled by default but can be turned
* off if desired through the params or if the prereqs don't exists.
*
* Typically this function replaces createGUI().
*
* @see StandardWindowOptions
* @note Since this method will restore the state of the application (toolbar, dockwindows
* positions...), you need to have added all your actions to your toolbars etc before
* calling to this method. (This note is only applicable if you are using the Default or
* Save flag).
* @warning If you are calling createGUI yourself, remember to remove the Create flag from
* the @p options parameter.
*
*/
void setupGUI(StandardWindowOptions options = Default, const QString &xmlfile = QString());
/**
* Configures the current windows and its actions in the typical KDE
* fashion. The options are all enabled by default but can be turned
* off if desired through the params or if the prereqs don't exists.
*
* @p defaultSize The default size of the window
*
* Typically this function replaces createGUI().
*
* @see StandardWindowOptions
* @note Since this method will restore the state of the application (toolbar, dockwindows
* positions...), you need to have added all your actions to your toolbars etc before
* calling to this method. (This note is only applicable if you are using the Default or
* Save flag).
* @warning If you are calling createGUI yourself, remember to remove the Create flag from
* the @p options parameter. Also, call setupGUI always after you call createGUI.
*/
void setupGUI(const QSize &defaultSize, StandardWindowOptions options = Default, const QString &xmlfile = QString());
/**
* Returns a pointer to the mainwindows action responsible for the toolbars menu
*/
QAction *toolBarMenuAction();
/**
* @internal for KToolBar
*/
void setupToolbarMenuActions();
// KDE5 TODO: change it to "using KXMLGUIBuilder::finalizeGUI;"
void finalizeGUI(KXMLGUIClient *client) override;
/**
* @internal
*/
void finalizeGUI(bool force);
// reimplemented for internal reasons
void applyMainWindowSettings(const KConfigGroup &config) override;
public Q_SLOTS:
/**
* Show a standard configure toolbar dialog.
*
* This slot can be connected directly to the action to configure toolbar.
* This is very simple to do that by adding a single line
* \code
* KStandardAction::configureToolbars( this, SLOT( configureToolbars() ),
* actionCollection() );
* \endcode
*/
virtual void configureToolbars();
/**
* Apply a state change
*
* Enable and disable actions as defined in the XML rc file
*/
virtual void slotStateChanged(const QString &newstate);
/**
* Apply a state change
*
* Enable and disable actions as defined in the XML rc file,
* can "reverse" the state (disable the actions which should be
* enabled, and vice-versa) if specified.
*/
void slotStateChanged(const QString &newstate,
bool reverse);
protected:
/**
* Reimplemented to catch QEvent::Polish in order to adjust the object name
* if needed, once all constructor code for the main window has run.
* Also reimplemented to catch when a QDockWidget is added or removed.
*/
bool event(QEvent *event) override;
protected Q_SLOTS:
/**
* Rebuilds the GUI after KEditToolbar changed the toolbar layout.
* @see configureToolbars()
*/
virtual void saveNewToolbarConfig();
private:
Q_PRIVATE_SLOT(k_func(), void _k_slotFactoryMakingChanges(bool))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KXmlGuiWindow::StandardWindowOptions)
#endif
diff --git a/packaging/linux/snap/setup/gui/krita.desktop b/packaging/linux/snap/setup/gui/krita.desktop
index 86bb57a2e1..25b662520e 100755
--- a/packaging/linux/snap/setup/gui/krita.desktop
+++ b/packaging/linux/snap/setup/gui/krita.desktop
@@ -1,125 +1,126 @@
[Desktop Entry]
Name=Krita
Name[af]=Krita
Name[bg]=Krita
Name[br]=Krita
Name[bs]=Krita
Name[ca]=Krita
Name[ca@valencia]=Krita
Name[cs]=Krita
Name[cy]=Krita
Name[da]=Krita
Name[de]=Krita
Name[el]=Krita
Name[en_GB]=Krita
Name[eo]=Krita
Name[es]=Krita
Name[et]=Krita
Name[eu]=Krita
Name[fi]=Krita
Name[fr]=Krita
Name[fy]=Krita
Name[ga]=Krita
Name[gl]=Krita
Name[he]=Krita
Name[hi]=केरिता
Name[hne]=केरिता
Name[hr]=Krita
Name[hu]=Krita
Name[ia]=Krita
Name[is]=Krita
Name[it]=Krita
Name[ja]=Krita
Name[kk]=Krita
Name[ko]=Krita
Name[lt]=Krita
Name[lv]=Krita
Name[mr]=क्रिटा
Name[ms]=Krita
Name[nb]=Krita
Name[nds]=Krita
Name[ne]=क्रिता
Name[nl]=Krita
Name[pl]=Krita
Name[pt]=Krita
Name[pt_BR]=Krita
Name[ro]=Krita
Name[ru]=Krita
Name[se]=Krita
Name[sk]=Krita
Name[sl]=Krita
Name[sv]=Krita
Name[ta]=கிரிட்டா
Name[tg]=Krita
Name[tr]=Krita
Name[ug]=Krita
Name[uk]=Krita
Name[uz]=Krita
Name[uz@cyrillic]=Krita
Name[wa]=Krita
Name[xh]=Krita
Name[x-test]=xxKritaxx
Name[zh_CN]=Krita
Name[zh_TW]=繪圖_Krita
Exec=krita %U
GenericName=Digital Painting
GenericName[bs]=Digitalno Bojenje
GenericName[ca]=Dibuix digital
GenericName[ca@valencia]=Dibuix digital
GenericName[da]=Digital tegning
GenericName[de]=Digitales Malen
GenericName[el]=Ψηφιακή ζωγραφική
GenericName[en_GB]=Digital Painting
GenericName[es]=Pintura digital
GenericName[et]=Digitaalne joonistamine
GenericName[eu]=Pintura digitala
GenericName[fi]=Digitaalimaalaus
GenericName[fr]=Peinture numérique
GenericName[gl]=Debuxo dixital
GenericName[hu]=Digitális festészet
GenericName[ia]=Pintura Digital
GenericName[it]=Pittura digitale
GenericName[ja]=デジタルペインティング
GenericName[kk]=Цифрлық сурет салу
GenericName[lt]=Skaitmeninis piešimas
GenericName[mr]=डिजिटल पेंटिंग
GenericName[nb]=Digital maling
GenericName[nl]=Digitaal schilderen
GenericName[pl]=Cyfrowe malowanie
GenericName[pt]=Pintura Digital
GenericName[pt_BR]=Pintura digital
GenericName[ru]=Цифровая живопись
GenericName[sk]=Digitálne maľovanie
GenericName[sl]=Digitalno slikanje
GenericName[sv]=Digital målning
GenericName[tr]=Sayısal Boyama
GenericName[ug]=سىفىرلىق رەسىم سىزغۇ
GenericName[uk]=Цифрове малювання
GenericName[x-test]=xxDigital Paintingxx
GenericName[zh_CN]=数字绘画
MimeType=application/x-krita;image/openraster;application/x-krita-paintoppreset;
Comment=Pixel-based image manipulation program for the Calligra Suite
Comment[ca]=Programa de manipulació d'imatges basades en píxels per a la Suite Calligra
Comment[ca@valencia]=Programa de manipulació d'imatges basades en píxels per a la Suite Calligra
Comment[de]=Pixelbasiertes Bildbearbeitungsprogramm für die Calligra-Suite
Comment[en_GB]=Pixel-based image manipulation program for the Calligra Suite
Comment[es]=Programa de manipulación de imágenes basado en píxeles para la suite Calligra
Comment[et]=Calligra pikslipõhine pilditöötluse rakendus
Comment[it]=Programma di manipolazione delle immagini basato su pixel per Calligra Suite
Comment[nl]=Afbeeldingsbewerkingsprogramma gebaseerd op pixels voor de Calligra Suite
Comment[pl]=Program do obróbki obrazów na poziomie pikseli dla Pakietu Calligra
Comment[pt]='Plugin' de manipulação de imagens em pixels para o Calligra Stage
Comment[pt_BR]=Programa de manipulação de imagens baseado em pixels para o Calligra Suite
Comment[ru]=Программа редактирования пиксельной анимации для the Calligra Suite
Comment[sk]=Program na manipuláciu s pixelmi pre Calligra Suite
Comment[sv]=Bildpunktsbaserat bildbehandlingsprogram för Calligra-sviten
+Comment[tr]=Calligra Suite için Pixel tabanlı görüntü düzenleme programı
Comment[uk]=Програма для роботи із растровими зображеннями для комплексу програм Calligra
Comment[x-test]=xxPixel-based image manipulation program for the Calligra Suitexx
Comment[zh_CN]=Calligra 套件的位图图像处理程序
Type=Application
Icon=${SNAP}/meta/gui/calligrakrita.png
Categories=Qt;KDE;Graphics;
X-KDE-NativeMimeType=application/x-krita
X-KDE-ExtraNativeMimeTypes=
StartupNotify=true
X-Krita-Version=28
diff --git a/plugins/assistants/RulerAssistant/ConcentricEllipseAssistant.h b/plugins/assistants/RulerAssistant/ConcentricEllipseAssistant.h
index 22e9ada262..79aa2435e1 100644
--- a/plugins/assistants/RulerAssistant/ConcentricEllipseAssistant.h
+++ b/plugins/assistants/RulerAssistant/ConcentricEllipseAssistant.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _CONCENTRIC_ELLIPSE_ASSISTANT_H_
#define _CONCENTRIC_ELLIPSE_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include "Ellipse.h"
#include <QLineF>
#include <QObject>
class ConcentricEllipseAssistant : public KisPaintingAssistant
{
public:
ConcentricEllipseAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 3; }
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 3; }
protected:
- virtual QRect boundingRect() const;
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ QRect boundingRect() const override;
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt, const QPointF& strokeBegin) const;
mutable Ellipse e;
mutable Ellipse extraE;
};
class ConcentricEllipseAssistantFactory : public KisPaintingAssistantFactory
{
public:
ConcentricEllipseAssistantFactory();
- virtual ~ConcentricEllipseAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~ConcentricEllipseAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/EllipseAssistant.h b/plugins/assistants/RulerAssistant/EllipseAssistant.h
index 3b8af378c8..8538cd77a3 100644
--- a/plugins/assistants/RulerAssistant/EllipseAssistant.h
+++ b/plugins/assistants/RulerAssistant/EllipseAssistant.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ELLIPSE_ASSISTANT_H_
#define _ELLIPSE_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include "Ellipse.h"
#include <QObject>
class EllipseAssistant : public KisPaintingAssistant
{
public:
EllipseAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 3; }
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 3; }
protected:
- virtual QRect boundingRect() const;
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ QRect boundingRect() const override;
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt) const;
mutable Ellipse e;
};
class EllipseAssistantFactory : public KisPaintingAssistantFactory
{
public:
EllipseAssistantFactory();
- virtual ~EllipseAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~EllipseAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/FisheyePointAssistant.h b/plugins/assistants/RulerAssistant/FisheyePointAssistant.h
index 8d02a26056..cc92bffb0e 100644
--- a/plugins/assistants/RulerAssistant/FisheyePointAssistant.h
+++ b/plugins/assistants/RulerAssistant/FisheyePointAssistant.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
* Copyright (c) 2014 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _FISHEYEPOINT_ASSISTANT_H_
#define _FISHEYEPOINT_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include "Ellipse.h"
#include <QObject>
#include <QPolygonF>
#include <QLineF>
#include <QTransform>
//class FisheyePoint;
class FisheyePointAssistant : public KisPaintingAssistant
{
public:
FisheyePointAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
//virtual void endStroke();
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 3; }
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 3; }
protected:
- virtual QRect boundingRect() const;
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ QRect boundingRect() const override;
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt, const QPointF& strokeBegin);
mutable Ellipse e;
mutable Ellipse extraE;
};
class FisheyePointAssistantFactory : public KisPaintingAssistantFactory
{
public:
FisheyePointAssistantFactory();
- virtual ~FisheyePointAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~FisheyePointAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/InfiniteRulerAssistant.h b/plugins/assistants/RulerAssistant/InfiniteRulerAssistant.h
index c8bded6e37..ff5562beea 100644
--- a/plugins/assistants/RulerAssistant/InfiniteRulerAssistant.h
+++ b/plugins/assistants/RulerAssistant/InfiniteRulerAssistant.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
* Copyright (c) 2014 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _INFINITERULER_ASSISTANT_H_
#define _INFINITERULER_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include <QObject>
#include <QPolygonF>
#include <QLineF>
#include <QTransform>
/* Design:
*/
class InfiniteRuler;
class InfiniteRulerAssistant : public KisPaintingAssistant
{
public:
InfiniteRulerAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
//virtual void endStroke();
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 2; }
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 2; }
protected:
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt, const QPointF& strokeBegin);
};
class InfiniteRulerAssistantFactory : public KisPaintingAssistantFactory
{
public:
InfiniteRulerAssistantFactory();
- virtual ~InfiniteRulerAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~InfiniteRulerAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/ParallelRulerAssistant.h b/plugins/assistants/RulerAssistant/ParallelRulerAssistant.h
index 3f33dca2fd..9a37b40559 100644
--- a/plugins/assistants/RulerAssistant/ParallelRulerAssistant.h
+++ b/plugins/assistants/RulerAssistant/ParallelRulerAssistant.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
* Copyright (c) 2014 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PARALLELRULER_ASSISTANT_H_
#define _PARALLELRULER_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include <QObject>
#include <QPolygonF>
#include <QLineF>
#include <QTransform>
/* Design:
*/
class ParallelRuler;
class ParallelRulerAssistant : public KisPaintingAssistant
{
public:
ParallelRulerAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
//virtual void endStroke();
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 2; }
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 2; }
protected:
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt, const QPointF& strokeBegin);
};
class ParallelRulerAssistantFactory : public KisPaintingAssistantFactory
{
public:
ParallelRulerAssistantFactory();
- virtual ~ParallelRulerAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~ParallelRulerAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/PerspectiveAssistant.h b/plugins/assistants/RulerAssistant/PerspectiveAssistant.h
index 99da002ad5..c843dadfaa 100644
--- a/plugins/assistants/RulerAssistant/PerspectiveAssistant.h
+++ b/plugins/assistants/RulerAssistant/PerspectiveAssistant.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PERSPECTIVE_ASSISTANT_H_
#define _PERSPECTIVE_ASSISTANT_H_
#include "kis_abstract_perspective_grid.h"
#include "kis_painting_assistant.h"
#include <QObject>
#include <QPolygonF>
#include <QLineF>
#include <QTransform>
class PerspectiveAssistant : public KisAbstractPerspectiveGrid, public KisPaintingAssistant
{
Q_OBJECT
public:
PerspectiveAssistant(QObject * parent = 0);
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
- virtual void endStroke();
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 4; }
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true);
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
+ void endStroke() override;
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 4; }
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;
- virtual bool contains(const QPointF& point) const;
- virtual qreal distance(const QPointF& point) const;
+ bool contains(const QPointF& point) const override;
+ qreal distance(const QPointF& point) const override;
protected:
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt, const QPointF& strokeBegin);
// creates the convex hull, returns false if it's not a quadrilateral
bool quad(QPolygonF& out) const;
// finds the transform from perspective coordinates (a unit square) to the document
bool getTransform(QPolygonF& polyOut, QTransform& transformOut) const;
// which direction to snap to (in transformed coordinates)
QLineF m_snapLine;
// cached information
mutable QTransform m_cachedTransform;
mutable QPolygonF m_cachedPolygon;
mutable QPointF m_cachedPoints[4];
mutable bool m_cacheValid;
};
class PerspectiveAssistantFactory : public KisPaintingAssistantFactory
{
public:
PerspectiveAssistantFactory();
- virtual ~PerspectiveAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~PerspectiveAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/RulerAssistant.h b/plugins/assistants/RulerAssistant/RulerAssistant.h
index 8546aec9ba..39bae336ee 100644
--- a/plugins/assistants/RulerAssistant/RulerAssistant.h
+++ b/plugins/assistants/RulerAssistant/RulerAssistant.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _RULER_ASSISTANT_H_
#define _RULER_ASSISTANT_H_
#include "kis_painting_assistant.h"
class Ruler;
class RulerAssistant : public KisPaintingAssistant
{
public:
RulerAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 2; }
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 2; }
protected:
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt) const;
};
class RulerAssistantFactory : public KisPaintingAssistantFactory
{
public:
RulerAssistantFactory();
- virtual ~RulerAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~RulerAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/SplineAssistant.h b/plugins/assistants/RulerAssistant/SplineAssistant.h
index 749861b001..acab43e22c 100644
--- a/plugins/assistants/RulerAssistant/SplineAssistant.h
+++ b/plugins/assistants/RulerAssistant/SplineAssistant.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SPLINE_ASSISTANT_H_
#define _SPLINE_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include <QObject>
class SplineAssistant : public KisPaintingAssistant
{
public:
SplineAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 4; }
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 4; }
protected:
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached, KisCanvas2* canvas, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt) const;
};
class SplineAssistantFactory : public KisPaintingAssistantFactory
{
public:
SplineAssistantFactory();
- virtual ~SplineAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~SplineAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/VanishingPointAssistant.h b/plugins/assistants/RulerAssistant/VanishingPointAssistant.h
index fd25ef4923..c1ce729d50 100644
--- a/plugins/assistants/RulerAssistant/VanishingPointAssistant.h
+++ b/plugins/assistants/RulerAssistant/VanishingPointAssistant.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Geoffry Song <goffrie@gmail.com>
* Copyright (c) 2014 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _VANISHINGPOINT_ASSISTANT_H_
#define _VANISHINGPOINT_ASSISTANT_H_
#include "kis_painting_assistant.h"
#include <QObject>
#include <QPolygonF>
#include <QLineF>
#include <QTransform>
/* Design:
*The idea behind the vanishing point ruler is that in a perspective deformed landscape, a set of parallel
*lines al share a single vanishing point.
*Therefore, a perspective can contain an theoretical infinite of vanishing points.
*It's a pity if we only allowed an artist to access 1, 2 or 3 of these at any given time, as other
*solutions for perspective tools do.
*Hence a vanishing point ruler.
*
*This ruler is relatively simple compared to the other perspective ruler:
*It has only one vanishing point that is required to draw.
*However, it does have it's own weaknesses in how to determine onto which of these infinite rulers to snap.
*Furthermore, it has four extra handles for adding a perspective ruler to a preexisting perspective.
*/
//class VanishingPoint;
class VanishingPointAssistant : public KisPaintingAssistant
{
public:
VanishingPointAssistant();
- virtual QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin);
+ QPointF adjustPosition(const QPointF& point, const QPointF& strokeBegin) override;
//virtual void endStroke();
- virtual QPointF buttonPosition() const;
- virtual int numHandles() const { return 1; }
+ QPointF buttonPosition() const override;
+ int numHandles() const override { return 1; }
protected:
- virtual void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true);
- virtual void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true);
+ void drawAssistant(QPainter& gc, const QRectF& updateRect, const KisCoordinatesConverter* converter, bool cached = true,KisCanvas2* canvas=0, bool assistantVisible=true, bool previewVisible=true) override;
+ void drawCache(QPainter& gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override;
private:
QPointF project(const QPointF& pt, const QPointF& strokeBegin);
};
class VanishingPointAssistantFactory : public KisPaintingAssistantFactory
{
public:
VanishingPointAssistantFactory();
- virtual ~VanishingPointAssistantFactory();
- virtual QString id() const;
- virtual QString name() const;
- virtual KisPaintingAssistant* createPaintingAssistant() const;
+ ~VanishingPointAssistantFactory() override;
+ QString id() const override;
+ QString name() const override;
+ KisPaintingAssistant* createPaintingAssistant() const override;
};
#endif
diff --git a/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h b/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h
index 99d0dd6da9..636a2d3757 100644
--- a/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h
+++ b/plugins/assistants/RulerAssistant/kis_ruler_assistant_tool.h
@@ -1,128 +1,128 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RULER_ASSISTANT_TOOL_H_
#define _KIS_RULER_ASSISTANT_TOOL_H_
#include <QPointer>
#include <KoToolFactoryBase.h>
#include <KoIcon.h>
#include <kis_tool.h>
#include "kis_painting_assistant.h"
#include <kis_icon.h>
#include <kis_canvas2.h>
#include "ui_AssistantsToolOptions.h"
class KisRulerAssistantTool : public KisTool
{
Q_OBJECT
enum PerspectiveAssistantEditionMode {
MODE_CREATION, // This is the mode when there is not yet a perspective grid
MODE_EDITING, // This is the mode when the grid has been created, and we are waiting for the user to click on a control box
MODE_DRAGGING_NODE, // In this mode one node is translated
MODE_DRAGGING_TRANSLATING_TWONODES // This mode is used when creating a new sub perspective grid
};
public:
KisRulerAssistantTool(KoCanvasBase * canvas);
- virtual ~KisRulerAssistantTool();
+ ~KisRulerAssistantTool() override;
virtual quint32 priority() {
return 3;
}
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
- void mouseMoveEvent(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
- virtual QWidget *createOptionWidget();
+ QWidget *createOptionWidget() override;
private:
void addAssistant();
void removeAssistant(KisPaintingAssistantSP assistant);
void snappingOn(KisPaintingAssistantSP assistant);
void snappingOff(KisPaintingAssistantSP assistant);
void outlineOn(KisPaintingAssistantSP assistant);
void outlineOff(KisPaintingAssistantSP assistant);
bool mouseNear(const QPointF& mousep, const QPointF& point);
KisPaintingAssistantHandleSP nodeNearPoint(KisPaintingAssistantSP grid, QPointF point);
QPointF snapToGuide(KoPointerEvent *e, const QPointF &offset, bool useModifiers);
QPointF snapToGuide(const QPointF& pt, const QPointF &offset);
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
private Q_SLOTS:
void removeAllAssistants();
void saveAssistants();
void loadAssistants();
protected:
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
protected:
QPointer<KisCanvas2> m_canvas;
QList<KisPaintingAssistantHandleSP> m_handles, m_sideHandles;
KisPaintingAssistantHandleSP m_handleDrag;
KisPaintingAssistantHandleSP m_handleCombine;
KisPaintingAssistantSP m_assistantDrag;
KisPaintingAssistantSP m_newAssistant;
QPointF m_cursorStart;
QPointF m_currentAdjustment;
Ui::AssistantsToolOptions m_options;
QWidget* m_optionsWidget;
QPointF m_dragStart;
QLineF m_radius;
bool m_snapIsRadial;
QPointF m_dragEnd;
private:
PerspectiveAssistantEditionMode m_internalMode;
qint32 m_handleSize, m_handleHalfSize;
KisPaintingAssistantHandleSP m_selectedNode1, m_selectedNode2, m_higlightedNode;
int m_assistantHelperYOffset;
};
class KisRulerAssistantToolFactory : public KoToolFactoryBase
{
public:
KisRulerAssistantToolFactory()
: KoToolFactoryBase("KisRulerAssistantTool") {
setToolTip(i18n("Assistant Tool"));
setSection(TOOL_TYPE_VIEW);
setIconName(koIconNameCStr("krita_tool_ruler_assistant"));
setPriority(0);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
};
- virtual ~KisRulerAssistantToolFactory() {}
+ ~KisRulerAssistantToolFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase * canvas) {
+ KoToolBase * createTool(KoCanvasBase * canvas) override {
return new KisRulerAssistantTool(canvas);
}
};
#endif
diff --git a/plugins/assistants/RulerAssistant/ruler_assistant_tool.h b/plugins/assistants/RulerAssistant/ruler_assistant_tool.h
index 71aefeac02..d3d52949b9 100644
--- a/plugins/assistants/RulerAssistant/ruler_assistant_tool.h
+++ b/plugins/assistants/RulerAssistant/ruler_assistant_tool.h
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _RULERASSISTANTTOOL_H_
#define _RULERASSISTANTTOOL_H_
#include <QObject>
#include <QVariant>
class RulerAssistantToolPlugin : public QObject
{
Q_OBJECT
public:
RulerAssistantToolPlugin(QObject *parent, const QVariantList &);
- virtual ~RulerAssistantToolPlugin();
+ ~RulerAssistantToolPlugin() override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/extensions_plugin.h b/plugins/color/colorspaceextensions/extensions_plugin.h
index e07151741b..bce9b529cd 100644
--- a/plugins/color/colorspaceextensions/extensions_plugin.h
+++ b/plugins/color/colorspaceextensions/extensions_plugin.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2
* of the License.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _EXTENSIONS_PLUGIN_H_
#define _EXTENSIONS_PLUGIN_H_
#include <QObject>
#include <QVariant>
class ExtensionsPlugin : public QObject
{
Q_OBJECT
public:
ExtensionsPlugin(QObject *parent, const QVariantList &);
- virtual ~ExtensionsPlugin();
+ ~ExtensionsPlugin() override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_burnhighlights_adjustment.h b/plugins/color/colorspaceextensions/kis_burnhighlights_adjustment.h
index 807ae2fa55..437b268e34 100644
--- a/plugins/color/colorspaceextensions/kis_burnhighlights_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_burnhighlights_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library 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; version 2
* of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BURN_HIGHLIGHTS_ADJUSTMENT_H_
#define _KIS_BURN_HIGHLIGHTS_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisBurnHighlightsAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisBurnHighlightsAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_burnmidtones_adjustment.h b/plugins/color/colorspaceextensions/kis_burnmidtones_adjustment.h
index 94c2b59534..5e626563dc 100644
--- a/plugins/color/colorspaceextensions/kis_burnmidtones_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_burnmidtones_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library 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; version 2
* of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BURN_MIDTONES_ADJUSTMENT_H_
#define _KIS_BURN_MIDTONES_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisBurnMidtonesAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisBurnMidtonesAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_burnshadows_adjustment.h b/plugins/color/colorspaceextensions/kis_burnshadows_adjustment.h
index d0f032506e..017e0b7c9f 100644
--- a/plugins/color/colorspaceextensions/kis_burnshadows_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_burnshadows_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil@gmail.com>
*
* This library 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; version 2
* of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BURN_SHADOWS_ADJUSTMENT_H_
#define _KIS_BURN_SHADOWS_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisBurnShadowsAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisBurnShadowsAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_color_balance_adjustment.h b/plugins/color/colorspaceextensions/kis_color_balance_adjustment.h
index 2e68552406..e0cb2b6e93 100644
--- a/plugins/color/colorspaceextensions/kis_color_balance_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_color_balance_adjustment.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_BALANCE_ADJUSTMENT_H_
#define _KIS_COLOR_BALANCE_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisColorBalanceAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisColorBalanceAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
class KisColorBalanceMath
{
public:
KisColorBalanceMath();
float colorBalanceTransform(float value, float lightness, float shadows, float midtones, float highlights);
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_desaturate_adjustment.h b/plugins/color/colorspaceextensions/kis_desaturate_adjustment.h
index dae374f3bd..067fbd28fc 100644
--- a/plugins/color/colorspaceextensions/kis_desaturate_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_desaturate_adjustment.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2013 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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; version 2
* of the License.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DESATURATE_ADJUSTMENT_H
#define KIS_DESATURATE_ADJUSTMENT_H
#include "KoColorTransformationFactory.h"
class KisDesaturateAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisDesaturateAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif // KIS_DESATURATE_ADJUSTMENT_H
diff --git a/plugins/color/colorspaceextensions/kis_dodgehighlights_adjustment.h b/plugins/color/colorspaceextensions/kis_dodgehighlights_adjustment.h
index bd4eb058b5..c6c045dc87 100644
--- a/plugins/color/colorspaceextensions/kis_dodgehighlights_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_dodgehighlights_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library 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; version 2
* of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DODGE_HIGHLIGHTS_ADJUSTMENT_H_
#define _KIS_DODGE_HIGHLIGHTS_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisDodgeHighlightsAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisDodgeHighlightsAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_dodgemidtones_adjustment.h b/plugins/color/colorspaceextensions/kis_dodgemidtones_adjustment.h
index 8a851b719d..bbf7f7d35b 100644
--- a/plugins/color/colorspaceextensions/kis_dodgemidtones_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_dodgemidtones_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library 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; version 2
* of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DODGE_MIDTONES_ADJUSTMENT_H_
#define _KIS_DODGE_MIDTONES_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisDodgeMidtonesAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisDodgeMidtonesAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_dodgeshadows_adjustment.h b/plugins/color/colorspaceextensions/kis_dodgeshadows_adjustment.h
index 0ba78ec387..6e4e7ce6d2 100644
--- a/plugins/color/colorspaceextensions/kis_dodgeshadows_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_dodgeshadows_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library 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; version 2
* of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DODGE_SHADOWS_ADJUSTMENT_H_
#define _KIS_DODGE_SHADOWS_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisDodgeShadowsAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisDodgeShadowsAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/colorspaceextensions/kis_hsv_adjustment.h b/plugins/color/colorspaceextensions/kis_hsv_adjustment.h
index 7655dd1472..b46d4b01f7 100644
--- a/plugins/color/colorspaceextensions/kis_hsv_adjustment.h
+++ b/plugins/color/colorspaceextensions/kis_hsv_adjustment.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2
* of the License.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_HSV_ADJUSTMENT_H_
#define _KIS_HSV_ADJUSTMENT_H_
#include "KoColorTransformationFactory.h"
class KisHSVAdjustmentFactory : public KoColorTransformationFactory
{
public:
KisHSVAdjustmentFactory();
- virtual QList< QPair< KoID, KoID > > supportedModels() const;
+ QList< QPair< KoID, KoID > > supportedModels() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* colorSpace, QHash<QString, QVariant> parameters) const override;
};
#endif
diff --git a/plugins/color/lcms2engine/IccColorSpaceEngine.h b/plugins/color/lcms2engine/IccColorSpaceEngine.h
index 85c9c9838c..c9ce1e98db 100644
--- a/plugins/color/lcms2engine/IccColorSpaceEngine.h
+++ b/plugins/color/lcms2engine/IccColorSpaceEngine.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_ICC_COLOR_SPACE_ENGINE_H_
#define _KO_ICC_COLOR_SPACE_ENGINE_H_
#include <KoColorSpaceEngine.h>
class IccColorSpaceEngine : public KoColorSpaceEngine
{
public:
IccColorSpaceEngine();
- virtual ~IccColorSpaceEngine();
- const KoColorProfile *addProfile(const QString &filename);
- const KoColorProfile *addProfile(const QByteArray &data);
- void removeProfile(const QString &filename);
- virtual KoColorConversionTransformation *createColorTransformation(const KoColorSpace *srcColorSpace,
+ ~IccColorSpaceEngine() override;
+ const KoColorProfile *addProfile(const QString &filename) override;
+ const KoColorProfile *addProfile(const QByteArray &data) override;
+ void removeProfile(const QString &filename) override;
+ KoColorConversionTransformation *createColorTransformation(const KoColorSpace *srcColorSpace,
const KoColorSpace *dstColorSpace,
KoColorConversionTransformation::Intent renderingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags) const;
- virtual KoColorProofingConversionTransformation *createColorProofingTransformation(const KoColorSpace *srcColorSpace,
+ KoColorConversionTransformation::ConversionFlags conversionFlags) const override;
+ KoColorProofingConversionTransformation *createColorProofingTransformation(const KoColorSpace *srcColorSpace,
const KoColorSpace *dstColorSpace,
const KoColorSpace *proofingSpace,
KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::Intent proofingIntent,
- KoColorConversionTransformation::ConversionFlags conversionFlags, quint8 *gamutWarning, double adaptationState) const;
+ KoColorConversionTransformation::ConversionFlags conversionFlags, quint8 *gamutWarning, double adaptationState) const override;
quint32 computeColorSpaceType(const KoColorSpace *cs) const;
private:
struct Private;
Private *const d;
};
#endif
diff --git a/plugins/color/lcms2engine/LcmsColorSpace.h b/plugins/color/lcms2engine/LcmsColorSpace.h
index 4c1b4815b8..84d193daf6 100644
--- a/plugins/color/lcms2engine/LcmsColorSpace.h
+++ b/plugins/color/lcms2engine/LcmsColorSpace.h
@@ -1,488 +1,488 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005-2006 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2004,2006-2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOLCMSCOLORSPACE_H_
#define KOLCMSCOLORSPACE_H_
#include <colorprofiles/LcmsColorProfileContainer.h>
#include <KoColorSpaceAbstract.h>
#include <QMutex>
#include <QMutexLocker>
class LcmsColorProfileContainer;
class KoLcmsInfo
{
struct Private {
cmsUInt32Number cmType; // The colorspace type as defined by littlecms
cmsColorSpaceSignature colorSpaceSignature; // The colorspace signature as defined in icm/icc files
};
public:
KoLcmsInfo(cmsUInt32Number cmType, cmsColorSpaceSignature colorSpaceSignature)
: d(new Private)
{
d->cmType = cmType;
d->colorSpaceSignature = colorSpaceSignature;
}
virtual ~KoLcmsInfo()
{
delete d;
}
virtual quint32 colorSpaceType() const
{
return d->cmType;
}
virtual cmsColorSpaceSignature colorSpaceSignature() const
{
return d->colorSpaceSignature;
}
private:
Private *const d;
};
struct KoLcmsDefaultTransformations {
cmsHTRANSFORM toRGB;
cmsHTRANSFORM fromRGB;
static cmsHPROFILE s_RGBProfile;
static QMap< QString, QMap< LcmsColorProfileContainer *, KoLcmsDefaultTransformations * > > s_transformations;
};
/**
* This is the base class for all colorspaces that are based on the lcms library, for instance
* RGB 8bits and 16bits, CMYK 8bits and 16bits, LAB...
*/
template<class _CSTraits>
class LcmsColorSpace : public KoColorSpaceAbstract<_CSTraits>, public KoLcmsInfo
{
struct KoLcmsColorTransformation : public KoColorTransformation {
KoLcmsColorTransformation(const KoColorSpace *colorSpace)
: KoColorTransformation()
, m_colorSpace(colorSpace)
{
csProfile = 0;
cmstransform = 0;
cmsAlphaTransform = 0;
profiles[0] = 0;
profiles[1] = 0;
profiles[2] = 0;
}
- ~KoLcmsColorTransformation()
+ ~KoLcmsColorTransformation() override
{
if (cmstransform) {
cmsDeleteTransform(cmstransform);
}
if (profiles[0] && profiles[0] != csProfile) {
cmsCloseProfile(profiles[0]);
}
if (profiles[1] && profiles[1] != csProfile) {
cmsCloseProfile(profiles[1]);
}
if (profiles[2] && profiles[2] != csProfile) {
cmsCloseProfile(profiles[2]);
}
}
- virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const
+ void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override
{
cmsDoTransform(cmstransform, const_cast<quint8 *>(src), dst, nPixels);
qint32 numPixels = nPixels;
qint32 pixelSize = m_colorSpace->pixelSize();
int index = 0;
if (cmsAlphaTransform) {
qreal *alpha = new qreal[nPixels];
qreal *dstalpha = new qreal[nPixels];
while (index < nPixels) {
alpha[index] = m_colorSpace->opacityF(src);
src += pixelSize;
index++;
}
cmsDoTransform(cmsAlphaTransform, const_cast<qreal *>(alpha), static_cast<qreal *>(dstalpha), nPixels);
for (int i = 0; i < numPixels; i++) {
m_colorSpace->setOpacity(dst, dstalpha[i], 1);
dst += pixelSize;
}
delete [] alpha;
delete [] dstalpha;
} else {
while (numPixels > 0) {
qreal alpha = m_colorSpace->opacityF(src);
m_colorSpace->setOpacity(dst, alpha, 1);
src += pixelSize;
dst += pixelSize;
numPixels--;
}
}
}
const KoColorSpace *m_colorSpace;
cmsHPROFILE csProfile;
cmsHPROFILE profiles[3];
cmsHTRANSFORM cmstransform;
cmsHTRANSFORM cmsAlphaTransform;
};
struct Private {
mutable quint8 *qcolordata; // A small buffer for conversion from and to qcolor.
KoLcmsDefaultTransformations *defaultTransformations;
mutable cmsHPROFILE lastRGBProfile; // Last used profile to transform to/from RGB
mutable cmsHTRANSFORM lastToRGB; // Last used transform to transform to RGB
mutable cmsHTRANSFORM lastFromRGB; // Last used transform to transform from RGB
LcmsColorProfileContainer *profile;
KoColorProfile *colorProfile;
QMutex mutex;
};
protected:
LcmsColorSpace(const QString &id,
const QString &name,
cmsUInt32Number cmType,
cmsColorSpaceSignature colorSpaceSignature,
KoColorProfile *p)
: KoColorSpaceAbstract<_CSTraits>(id, name)
, KoLcmsInfo(cmType, colorSpaceSignature)
, d(new Private())
{
Q_ASSERT(p); // No profile means the lcms color space can't work
Q_ASSERT(profileIsCompatible(p));
d->profile = asLcmsProfile(p);
Q_ASSERT(d->profile);
d->colorProfile = p;
d->qcolordata = 0;
d->lastRGBProfile = 0;
d->lastToRGB = 0;
d->lastFromRGB = 0;
d->defaultTransformations = 0;
}
- virtual ~LcmsColorSpace()
+ ~LcmsColorSpace() override
{
delete d->colorProfile;
delete[] d->qcolordata;
delete d->defaultTransformations;
delete d;
}
void init()
{
// Default pixel buffer for QColor conversion
d->qcolordata = new quint8[3];
Q_CHECK_PTR(d->qcolordata);
Q_ASSERT(d->profile);
if (KoLcmsDefaultTransformations::s_RGBProfile == 0) {
KoLcmsDefaultTransformations::s_RGBProfile = cmsCreate_sRGBProfile();
}
d->defaultTransformations = KoLcmsDefaultTransformations::s_transformations[this->id()][ d->profile];
if (!d->defaultTransformations) {
d->defaultTransformations = new KoLcmsDefaultTransformations;
d->defaultTransformations->fromRGB = cmsCreateTransform(KoLcmsDefaultTransformations::s_RGBProfile,
TYPE_BGR_8,
d->profile->lcmsProfile(),
this->colorSpaceType(),
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
Q_ASSERT(d->defaultTransformations->fromRGB);
d->defaultTransformations->toRGB = cmsCreateTransform(d->profile->lcmsProfile(),
this->colorSpaceType(),
KoLcmsDefaultTransformations::s_RGBProfile,
TYPE_BGR_8,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
Q_ASSERT(d->defaultTransformations->toRGB);
KoLcmsDefaultTransformations::s_transformations[ this->id()][ d->profile ] = d->defaultTransformations;
}
}
public:
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return false;
}
- virtual const KoColorProfile *profile() const
+ const KoColorProfile *profile() const override
{
return d->colorProfile;
}
- virtual bool profileIsCompatible(const KoColorProfile *profile) const
+ bool profileIsCompatible(const KoColorProfile *profile) const override
{
const IccColorProfile *p = dynamic_cast<const IccColorProfile *>(profile);
return (p && p->asLcms()->colorSpaceSignature() == colorSpaceSignature());
}
- virtual void fromQColor(const QColor &color, quint8 *dst, const KoColorProfile *koprofile = 0) const
+ void fromQColor(const QColor &color, quint8 *dst, const KoColorProfile *koprofile = 0) const override
{
QMutexLocker locker(&d->mutex);
d->qcolordata[2] = color.red();
d->qcolordata[1] = color.green();
d->qcolordata[0] = color.blue();
LcmsColorProfileContainer *profile = asLcmsProfile(koprofile);
if (profile == 0) {
// Default sRGB
Q_ASSERT(d->defaultTransformations && d->defaultTransformations->fromRGB);
cmsDoTransform(d->defaultTransformations->fromRGB, d->qcolordata, dst, 1);
} else {
if (d->lastFromRGB == 0 || (d->lastFromRGB != 0 && d->lastRGBProfile != profile->lcmsProfile())) {
d->lastFromRGB = cmsCreateTransform(profile->lcmsProfile(),
TYPE_BGR_8,
d->profile->lcmsProfile(),
this->colorSpaceType(),
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
d->lastRGBProfile = profile->lcmsProfile();
}
cmsDoTransform(d->lastFromRGB, d->qcolordata, dst, 1);
}
this->setOpacity(dst, (quint8)(color.alpha()), 1);
}
- virtual void toQColor(const quint8 *src, QColor *c, const KoColorProfile *koprofile = 0) const
+ void toQColor(const quint8 *src, QColor *c, const KoColorProfile *koprofile = 0) const override
{
QMutexLocker locker(&d->mutex);
LcmsColorProfileContainer *profile = asLcmsProfile(koprofile);
if (profile == 0) {
// Default sRGB transform
Q_ASSERT(d->defaultTransformations && d->defaultTransformations->toRGB);
cmsDoTransform(d->defaultTransformations->toRGB, const_cast <quint8 *>(src), d->qcolordata, 1);
} else {
if (d->lastToRGB == 0 || (d->lastToRGB != 0 && d->lastRGBProfile != profile->lcmsProfile())) {
d->lastToRGB = cmsCreateTransform(d->profile->lcmsProfile(), this->colorSpaceType(),
profile->lcmsProfile(), TYPE_BGR_8,
KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
d->lastRGBProfile = profile->lcmsProfile();
}
cmsDoTransform(d->lastToRGB, const_cast <quint8 *>(src), d->qcolordata, 1);
}
c->setRgb(d->qcolordata[2], d->qcolordata[1], d->qcolordata[0]);
c->setAlpha(this->opacityU8(src));
}
- virtual KoColorTransformation *createBrightnessContrastAdjustment(const quint16 *transferValues) const
+ KoColorTransformation *createBrightnessContrastAdjustment(const quint16 *transferValues) const override
{
if (!d->profile) {
return 0;
}
cmsToneCurve *transferFunctions[3];
transferFunctions[0] = cmsBuildTabulatedToneCurve16(0, 256, transferValues);
transferFunctions[1] = cmsBuildGamma(0, 1.0);
transferFunctions[2] = cmsBuildGamma(0, 1.0);
KoLcmsColorTransformation *adj = new KoLcmsColorTransformation(this);
adj->profiles[1] = cmsCreateLinearizationDeviceLink(cmsSigLabData, transferFunctions);
cmsSetDeviceClass(adj->profiles[1], cmsSigAbstractClass);
adj->profiles[0] = d->profile->lcmsProfile();
adj->profiles[2] = d->profile->lcmsProfile();
adj->cmstransform = cmsCreateMultiprofileTransform(adj->profiles, 3, this->colorSpaceType(), this->colorSpaceType(),
KoColorConversionTransformation::adjustmentRenderingIntent(),
KoColorConversionTransformation::adjustmentConversionFlags());
adj->csProfile = d->profile->lcmsProfile();
return adj;
}
- virtual KoColorTransformation *createPerChannelAdjustment(const quint16 *const *transferValues) const
+ KoColorTransformation *createPerChannelAdjustment(const quint16 *const *transferValues) const override
{
if (!d->profile) {
return 0;
}
cmsToneCurve **transferFunctions = new cmsToneCurve*[ this->colorChannelCount()];
for (uint ch = 0; ch < this->colorChannelCount(); ch++) {
transferFunctions[ch] = transferValues[ch] ?
cmsBuildTabulatedToneCurve16(0, 256, transferValues[ch]) :
cmsBuildGamma(0, 1.0);
}
cmsToneCurve **alphaTransferFunctions = new cmsToneCurve*[1];
alphaTransferFunctions[0] = transferValues[this->colorChannelCount()] ?
cmsBuildTabulatedToneCurve16(0, 256, transferValues[this->colorChannelCount()]) :
cmsBuildGamma(0, 1.0);
KoLcmsColorTransformation *adj = new KoLcmsColorTransformation(this);
adj->profiles[0] = cmsCreateLinearizationDeviceLink(this->colorSpaceSignature(), transferFunctions);
adj->profiles[1] = cmsCreateLinearizationDeviceLink(cmsSigGrayData, alphaTransferFunctions);
adj->profiles[2] = 0;
adj->csProfile = d->profile->lcmsProfile();
adj->cmstransform = cmsCreateTransform(adj->profiles[0], this->colorSpaceType(), 0, this->colorSpaceType(),
KoColorConversionTransformation::adjustmentRenderingIntent(),
KoColorConversionTransformation::adjustmentConversionFlags());
adj->cmsAlphaTransform = cmsCreateTransform(adj->profiles[1], TYPE_GRAY_DBL, 0, TYPE_GRAY_DBL,
KoColorConversionTransformation::adjustmentRenderingIntent(),
KoColorConversionTransformation::adjustmentConversionFlags());
delete [] transferFunctions;
delete [] alphaTransferFunctions;
return adj;
}
- virtual quint8 difference(const quint8 *src1, const quint8 *src2) const
+ quint8 difference(const quint8 *src1, const quint8 *src2) const override
{
quint8 lab1[8], lab2[8];
cmsCIELab labF1, labF2;
if (this->opacityU8(src1) == OPACITY_TRANSPARENT_U8
|| this->opacityU8(src2) == OPACITY_TRANSPARENT_U8) {
return (this->opacityU8(src1) == this->opacityU8(src2) ? 0 : 255);
}
Q_ASSERT(this->toLabA16Converter());
this->toLabA16Converter()->transform(src1, lab1, 1);
this->toLabA16Converter()->transform(src2, lab2, 1);
cmsLabEncoded2Float(&labF1, (cmsUInt16Number *)lab1);
cmsLabEncoded2Float(&labF2, (cmsUInt16Number *)lab2);
qreal diff = cmsDeltaE(&labF1, &labF2);
if (diff > 255.0) {
return 255;
} else {
return quint8(diff);
}
}
- virtual quint8 differenceA(const quint8 *src1, const quint8 *src2) const
+ quint8 differenceA(const quint8 *src1, const quint8 *src2) const override
{
quint8 lab1[8];
quint8 lab2[8];
cmsCIELab labF1;
cmsCIELab labF2;
if (this->opacityU8(src1) == OPACITY_TRANSPARENT_U8
|| this->opacityU8(src2) == OPACITY_TRANSPARENT_U8) {
return (this->opacityU8(src1) == this->opacityU8(src2) ? 0 : 255);
}
Q_ASSERT(this->toLabA16Converter());
this->toLabA16Converter()->transform(src1, lab1, 1);
this->toLabA16Converter()->transform(src2, lab2, 1);
cmsLabEncoded2Float(&labF1, (cmsUInt16Number *)lab1);
cmsLabEncoded2Float(&labF2, (cmsUInt16Number *)lab2);
cmsFloat64Number dL;
cmsFloat64Number da;
cmsFloat64Number db;
cmsFloat64Number dAlpha;
dL = fabs((qreal)(labF1.L - labF2.L));
da = fabs((qreal)(labF1.a - labF2.a));
db = fabs((qreal)(labF1.b - labF2.b));
static const int LabAAlphaPos = 3;
static const cmsFloat64Number alphaScale = 100.0 / KoColorSpaceMathsTraits<quint16>::max;
quint16 alpha1 = reinterpret_cast<quint16 *>(lab1)[LabAAlphaPos];
quint16 alpha2 = reinterpret_cast<quint16 *>(lab2)[LabAAlphaPos];
dAlpha = fabs((qreal)(alpha1 - alpha2)) * alphaScale;
qreal diff = pow(dL * dL + da * da + db * db + dAlpha * dAlpha, 0.5);
if (diff > 255.0) {
return 255;
} else {
return quint8(diff);
}
}
private:
inline LcmsColorProfileContainer *lcmsProfile() const
{
return d->profile;
}
inline static LcmsColorProfileContainer *asLcmsProfile(const KoColorProfile *p)
{
if (!p) {
return 0;
}
const IccColorProfile *iccp = dynamic_cast<const IccColorProfile *>(p);
if (!iccp) {
return 0;
}
Q_ASSERT(iccp->asLcms());
return iccp->asLcms();
}
Private *const d;
};
/**
* Base class for all LCMS based ColorSpace factories.
*/
class LcmsColorSpaceFactory : public KoColorSpaceFactory, private KoLcmsInfo
{
public:
LcmsColorSpaceFactory(cmsUInt32Number cmType, cmsColorSpaceSignature colorSpaceSignature)
: KoLcmsInfo(cmType, colorSpaceSignature)
{
}
- virtual bool profileIsCompatible(const KoColorProfile *profile) const
+ bool profileIsCompatible(const KoColorProfile *profile) const override
{
const IccColorProfile *p = dynamic_cast<const IccColorProfile *>(profile);
return (p && p->asLcms()->colorSpaceSignature() == colorSpaceSignature());
}
- virtual QString colorSpaceEngine() const
+ QString colorSpaceEngine() const override
{
return "icc";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return false;
}
- virtual int crossingCost() const override {
+ int crossingCost() const override {
return 1;
}
- virtual QList<KoColorConversionTransformationFactory *> colorConversionLinks() const;
- virtual KoColorProfile *createColorProfile(const QByteArray &rawData) const;
+ QList<KoColorConversionTransformationFactory *> colorConversionLinks() const override;
+ KoColorProfile *createColorProfile(const QByteArray &rawData) const override;
};
#endif
diff --git a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h
index c95ca0116d..948876ba66 100644
--- a/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h
+++ b/plugins/color/lcms2engine/colorprofiles/IccColorProfile.h
@@ -1,143 +1,143 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_ICC_COLOR_PROFILE_H_
#define _KO_ICC_COLOR_PROFILE_H_
#include "KoColorProfile.h"
#include "KoChannelInfo.h"
class LcmsColorProfileContainer;
/**
* This class contains an ICC color profile.
*/
class IccColorProfile : public KoColorProfile
{
public:
using KoColorProfile::save;
/**
* Contains the data associated with a profile. This is
* shared through internal representation.
*/
class Data
{
public:
Data();
explicit Data(const QByteArray &rawData);
~Data();
QByteArray rawData();
void setRawData(const QByteArray &);
private:
struct Private;
QScopedPointer<Private> const d;
};
/**
* This class should be used to wrap the ICC profile
* representation coming from various CMS engine.
*/
class Container
{
public:
Container();
virtual ~Container();
public:
virtual QString name() const = 0;
virtual QString info() const = 0;
virtual QString manufacturer() const = 0;
virtual QString copyright() const = 0;
virtual bool valid() const = 0;
virtual bool isSuitableForOutput() const = 0;
virtual bool isSuitableForPrinting() const = 0;
virtual bool isSuitableForDisplay() const = 0;
virtual bool hasColorants() const = 0;
virtual QVector <double> getColorantsXYZ() const = 0;
virtual QVector <double> getColorantsxyY() const = 0;
virtual QVector <double> getWhitePointXYZ() const = 0;
virtual QVector <double> getWhitePointxyY() const = 0;
virtual QVector <double> getEstimatedTRC() const = 0;
virtual QByteArray getProfileUniqueId() const = 0;
};
public:
explicit IccColorProfile(const QString &fileName = QString());
explicit IccColorProfile(const QByteArray &rawData);
IccColorProfile(const IccColorProfile &rhs);
- virtual ~IccColorProfile();
+ ~IccColorProfile() override;
- virtual KoColorProfile *clone() const;
+ KoColorProfile *clone() const override;
- virtual bool load();
+ bool load() override;
virtual bool save();
/**
* @return an array with the raw data of the profile
*/
- QByteArray rawData() const;
- virtual bool valid() const;
- virtual float version() const;
- virtual bool isSuitableForOutput() const;
- virtual bool isSuitableForPrinting() const;
- virtual bool isSuitableForDisplay() const;
- virtual bool supportsPerceptual() const;
- virtual bool supportsSaturation() const;
- virtual bool supportsAbsolute() const;
- virtual bool supportsRelative() const;
- virtual bool hasColorants() const;
- virtual bool hasTRC() const;
- virtual QVector <qreal> getColorantsXYZ() const;
- virtual QVector <qreal> getColorantsxyY() const;
- virtual QVector <qreal> getWhitePointXYZ() const;
- virtual QVector <qreal> getWhitePointxyY() const;
- virtual QVector <qreal> getEstimatedTRC() const;
- virtual void linearizeFloatValue(QVector <qreal> & Value) const;
- virtual void delinearizeFloatValue(QVector <qreal> & Value) const;
- virtual void linearizeFloatValueFast(QVector <qreal> & Value) const;
- virtual void delinearizeFloatValueFast(QVector <qreal> & Value) const;
- virtual QByteArray uniqueId() const;
- virtual bool operator==(const KoColorProfile &) const;
- virtual QString type() const
+ QByteArray rawData() const override;
+ bool valid() const override;
+ float version() const override;
+ bool isSuitableForOutput() const override;
+ bool isSuitableForPrinting() const override;
+ bool isSuitableForDisplay() const override;
+ bool supportsPerceptual() const override;
+ bool supportsSaturation() const override;
+ bool supportsAbsolute() const override;
+ bool supportsRelative() const override;
+ bool hasColorants() const override;
+ bool hasTRC() const override;
+ QVector <qreal> getColorantsXYZ() const override;
+ QVector <qreal> getColorantsxyY() const override;
+ QVector <qreal> getWhitePointXYZ() const override;
+ QVector <qreal> getWhitePointxyY() const override;
+ QVector <qreal> getEstimatedTRC() const override;
+ void linearizeFloatValue(QVector <qreal> & Value) const override;
+ void delinearizeFloatValue(QVector <qreal> & Value) const override;
+ void linearizeFloatValueFast(QVector <qreal> & Value) const override;
+ void delinearizeFloatValueFast(QVector <qreal> & Value) const override;
+ QByteArray uniqueId() const override;
+ bool operator==(const KoColorProfile &) const override;
+ QString type() const override
{
return "icc";
}
/**
* Returns the set of min/maxes for each channel in this profile.
* These (sometimes approximate) min and maxes are suitable
* for UI building.
* Furthermore, then only apply to the floating point uses of this profile,
* and not the integer variants.
*/
const QVector<KoChannelInfo::DoubleRange> &getFloatUIMinMax(void) const;
protected:
void setRawData(const QByteArray &rawData);
public:
LcmsColorProfileContainer *asLcms() const;
protected:
bool init();
void calculateFloatUIMinMax(void);
private:
struct Private;
QScopedPointer<Private> d;
};
#endif
diff --git a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h
index 4060510430..f1dca0c9c9 100644
--- a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h
+++ b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.h
@@ -1,119 +1,119 @@
/*
* This file is part of the KDE project
* Copyright (c) 2000 Matthias Elter <elter@kde.org>
* 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KO_LCMS_COLORPROFILE_H
#define _KO_LCMS_COLORPROFILE_H
#include "IccColorProfile.h"
#include <lcms2.h>
#include <QByteArray>
#include <QString>
/**
* This class contains an LCMS color profile. Don't use it outside LcmsColorSpace.
*/
class LcmsColorProfileContainer : public IccColorProfile::Container
{
friend class IccColorProfile;
protected:
LcmsColorProfileContainer(IccColorProfile::Data *);
private:
/**
* Create a byte array from a lcms profile.
*/
static QByteArray lcmsProfileToByteArray(const cmsHPROFILE profile);
public:
/**
* @param profile lcms memory structure with the profile, it is freed after the call
* to this function
* @return an ICC profile created from an LCMS profile
*/
static IccColorProfile *createFromLcmsProfile(const cmsHPROFILE profile);
public:
- virtual ~LcmsColorProfileContainer();
+ ~LcmsColorProfileContainer() override;
/**
* @return the ICC color space signature
*/
cmsColorSpaceSignature colorSpaceSignature() const;
/**
* @return the class of the color space signature
*/
cmsProfileClassSignature deviceClass() const;
/**
* @return the name of the manufacturer
*/
- QString manufacturer() const;
+ QString manufacturer() const override;
/**
* @return the embedded copyright
*/
- QString copyright() const;
+ QString copyright() const override;
/**
* @return the structure to use with LCMS functions
*/
cmsHPROFILE lcmsProfile() const;
- virtual bool valid() const;
+ bool valid() const override;
virtual float version() const;
- virtual bool isSuitableForOutput() const;
+ bool isSuitableForOutput() const override;
- virtual bool isSuitableForPrinting() const;
+ bool isSuitableForPrinting() const override;
- virtual bool isSuitableForDisplay() const;
+ bool isSuitableForDisplay() const override;
virtual bool supportsPerceptual() const;
virtual bool supportsSaturation() const;
virtual bool supportsAbsolute() const;
virtual bool supportsRelative() const;
- virtual bool hasColorants() const;
+ bool hasColorants() const override;
virtual bool hasTRC() const;
- virtual QVector <double> getColorantsXYZ() const;
- virtual QVector <double> getColorantsxyY() const;
- virtual QVector <double> getWhitePointXYZ() const;
- virtual QVector <double> getWhitePointxyY() const;
- virtual QVector <double> getEstimatedTRC() const;
+ QVector <double> getColorantsXYZ() const override;
+ QVector <double> getColorantsxyY() const override;
+ QVector <double> getWhitePointXYZ() const override;
+ QVector <double> getWhitePointxyY() const override;
+ QVector <double> getEstimatedTRC() const override;
virtual void LinearizeFloatValue(QVector <double> & Value) const;
virtual void DelinearizeFloatValue(QVector <double> & Value) const;
virtual void LinearizeFloatValueFast(QVector <double> & Value) const;
virtual void DelinearizeFloatValueFast(QVector <double> & Value) const;
- virtual QString name() const;
- virtual QString info() const;
- virtual QByteArray getProfileUniqueId() const;
+ QString name() const override;
+ QString info() const override;
+ QByteArray getProfileUniqueId() const override;
protected:
LcmsColorProfileContainer();
private:
bool init();
class Private;
Private *const d;
};
#endif // KOCOLORPROFILE_H
diff --git a/plugins/color/lcms2engine/colorspaces/cmyk_f32/CmykF32ColorSpace.h b/plugins/color/lcms2engine/colorspaces/cmyk_f32/CmykF32ColorSpace.h
index d332c3997e..4d75f6f931 100644
--- a/plugins/color/lcms2engine/colorspaces/cmyk_f32/CmykF32ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/cmyk_f32/CmykF32ColorSpace.h
@@ -1,125 +1,125 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORSPACE_CMYK_F32_H_
#define KIS_COLORSPACE_CMYK_F32_H_
#include <LcmsColorSpace.h>
#include "KoColorModelStandardIds.h"
struct KoCmykF32Traits;
#define TYPE_CMYKA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(4))
class CmykF32ColorSpace : public LcmsColorSpace<KoCmykF32Traits>
{
public:
CmykF32ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return CMYKAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY( qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY( qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "CMYKAF32";
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class CmykF32ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
CmykF32ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_CMYKA_FLT, cmsSigCmykData)
{
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return CmykF32ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(CMYKAColorModelID.name()).arg(Float32BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return CMYKAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 32;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new CmykF32ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "Chemical proof";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/cmyk_u16/CmykU16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/cmyk_u16/CmykU16ColorSpace.h
index 215fd6b86f..0e8ccf55b8 100644
--- a/plugins/color/lcms2engine/colorspaces/cmyk_u16/CmykU16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/cmyk_u16/CmykU16ColorSpace.h
@@ -1,116 +1,116 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
#define KIS_STRATEGY_COLORSPACE_CMYK_U16_H_
#include <LcmsColorSpace.h>
#include <KoCmykColorSpaceTraits.h>
#include "KoColorModelStandardIds.h"
typedef KoCmykTraits<quint16> CmykU16Traits;
#define TYPE_CMYKA_16 (COLORSPACE_SH(PT_CMYK)|EXTRA_SH(1)|CHANNELS_SH(4)|BYTES_SH(2))
class CmykU16ColorSpace : public LcmsColorSpace<CmykU16Traits>
{
public:
CmykU16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return CMYKAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "CMYKAU16";
}
};
class CmykU16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
CmykU16ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_CMYKA_16, cmsSigCmykData)
{
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return CmykU16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(CMYKAColorModelID.name()).arg(Integer16BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return CMYKAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new CmykU16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "Chemical proof";
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/cmyk_u8/CmykU8ColorSpace.h b/plugins/color/lcms2engine/colorspaces/cmyk_u8/CmykU8ColorSpace.h
index 0e39156df3..a1f26cf6e8 100644
--- a/plugins/color/lcms2engine/colorspaces/cmyk_u8/CmykU8ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/cmyk_u8/CmykU8ColorSpace.h
@@ -1,114 +1,114 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_STRATEGY_COLORSPACE_CMYK_U8_H_
#define KIS_STRATEGY_COLORSPACE_CMYK_U8_H_
#include <LcmsColorSpace.h>
#include <KoCmykColorSpaceTraits.h>
#include "KoColorModelStandardIds.h"
typedef KoCmykTraits<quint8> CmykU8Traits;
class CmykU8ColorSpace : public LcmsColorSpace<CmykU8Traits>
{
public:
CmykU8ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return CMYKAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "CMYK";
}
};
class CmykU8ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
CmykU8ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_CMYK5_8, cmsSigCmykData)
{
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return CmykU8ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(CMYKAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return CMYKAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 8;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new CmykU8ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "Chemical proof";
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/gray_f16/GrayF16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/gray_f16/GrayF16ColorSpace.h
index 65bd44af4f..710065d367 100644
--- a/plugins/color/lcms2engine/colorspaces/gray_f16/GrayF16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/gray_f16/GrayF16ColorSpace.h
@@ -1,125 +1,125 @@
/*
* Copyright (c) 2004-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLORSPACE_GRAYSCALE_F16_H_
#define COLORSPACE_GRAYSCALE_F16_H_
#include <klocalizedstring.h>
#include <KoColorModelStandardIds.h>
#include "LcmsColorSpace.h"
#define TYPE_GRAYA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(2))
struct KoGrayF16Traits;
class GrayF16ColorSpace : public LcmsColorSpace<KoGrayF16Traits>
{
public:
GrayF16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence) const
+ bool willDegrade(ColorSpaceIndependence) const override
{
return false;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "GRAYAF16";
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class GrayF16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
GrayF16ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_GRAYA_HALF_FLT, cmsSigGrayData)
{
}
- virtual QString id() const
+ QString id() const override
{
return GrayF16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(GrayAColorModelID.name()).arg(Float16BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new GrayF16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "gray built-in";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
diff --git a/plugins/color/lcms2engine/colorspaces/gray_f32/GrayF32ColorSpace.h b/plugins/color/lcms2engine/colorspaces/gray_f32/GrayF32ColorSpace.h
index 0fcfcc82d3..b254a3b20b 100644
--- a/plugins/color/lcms2engine/colorspaces/gray_f32/GrayF32ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/gray_f32/GrayF32ColorSpace.h
@@ -1,125 +1,125 @@
/*
* Copyright (c) 2004-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLORSPACE_GRAYSCALE_F32_H_
#define COLORSPACE_GRAYSCALE_F32_H_
#include <klocalizedstring.h>
#include <KoColorModelStandardIds.h>
#include "LcmsColorSpace.h"
#define TYPE_GRAYA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|EXTRA_SH(1)|CHANNELS_SH(1)|BYTES_SH(4))
struct KoGrayF32Traits;
class GrayF32ColorSpace : public LcmsColorSpace<KoGrayF32Traits>
{
public:
GrayF32ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence) const
+ bool willDegrade(ColorSpaceIndependence) const override
{
return false;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "GRAYAF32";
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class GrayF32ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
GrayF32ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_GRAYA_FLT, cmsSigGrayData)
{
}
- virtual QString id() const
+ QString id() const override
{
return GrayF32ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(GrayAColorModelID.name()).arg(Float32BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 32;
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new GrayF32ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "gray built-in";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
diff --git a/plugins/color/lcms2engine/colorspaces/gray_u16/GrayU16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/gray_u16/GrayU16ColorSpace.h
index ba84fd0d9a..e469a4a695 100644
--- a/plugins/color/lcms2engine/colorspaces/gray_u16/GrayU16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/gray_u16/GrayU16ColorSpace.h
@@ -1,114 +1,114 @@
/*
* Copyright (c) 2004-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORSPACE_GRAYSCALE_U16_H_
#define KIS_COLORSPACE_GRAYSCALE_U16_H_
#include <klocalizedstring.h>
#include "LcmsColorSpace.h"
#include <KoColorSpaceTraits.h>
#include "KoColorModelStandardIds.h"
typedef KoColorSpaceTrait<quint16, 2, 1> GrayAU16Traits;
class GrayAU16ColorSpace : public LcmsColorSpace<GrayAU16Traits>
{
public:
GrayAU16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence) const
+ bool willDegrade(ColorSpaceIndependence) const override
{
return false;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "GRAYAU16";
}
};
class GrayAU16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
GrayAU16ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_GRAYA_16, cmsSigGrayData)
{
}
- virtual QString id() const
+ QString id() const override
{
return GrayAU16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(GrayAColorModelID.name()).arg(Integer16BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new GrayAU16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "gray built-in";
}
};
#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
diff --git a/plugins/color/lcms2engine/colorspaces/gray_u8/GrayU8ColorSpace.h b/plugins/color/lcms2engine/colorspaces/gray_u8/GrayU8ColorSpace.h
index aa2416ee03..e7710e3a9e 100644
--- a/plugins/color/lcms2engine/colorspaces/gray_u8/GrayU8ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/gray_u8/GrayU8ColorSpace.h
@@ -1,116 +1,116 @@
/*
* Copyright (c) 2004-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRAY_COLORSPACE_H_
#define KIS_GRAY_COLORSPACE_H_
#include <klocalizedstring.h>
#include <LcmsColorSpace.h>
#include <KoColorSpaceTraits.h>
#include "KoColorModelStandardIds.h"
typedef KoColorSpaceTrait<quint8, 2, 1> GrayAU8Traits;
class GrayAU8ColorSpace : public LcmsColorSpace<GrayAU8Traits>
{
public:
GrayAU8ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence) const
+ bool willDegrade(ColorSpaceIndependence) const override
{
return false;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return "GRAYA";
}
};
class GrayAU8ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
GrayAU8ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_GRAYA_8, cmsSigGrayData)
{
}
- virtual QString id() const
+ QString id() const override
{
return GrayAU8ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(GrayAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return GrayAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 8;
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new GrayAU8ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "gray built-in";
}
};
#endif // KIS_STRATEGY_COLORSPACE_GRAYSCALE_H_
diff --git a/plugins/color/lcms2engine/colorspaces/lab_f32/LabF32ColorSpace.h b/plugins/color/lcms2engine/colorspaces/lab_f32/LabF32ColorSpace.h
index 1b427e6b9c..aa62bb726b 100644
--- a/plugins/color/lcms2engine/colorspaces/lab_f32/LabF32ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/lab_f32/LabF32ColorSpace.h
@@ -1,122 +1,122 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LabF32ColorSpace_H_
#define LabF32ColorSpace_H_
#include "LcmsColorSpace.h"
#include "KoColorModelStandardIds.h"
// XXX: implement normalizedChannelValues?
struct KoLabF32Traits;
class LabF32ColorSpace : public LcmsColorSpace<KoLabF32Traits>
{
public:
LabF32ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
static QString colorSpaceId()
{
return QString("LABAF32");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return LABAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class LabF32ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
LabF32ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_LabA_FLT, cmsSigLabData)
{
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return LabF32ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(LABAColorModelID.name()).arg(Float32BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return LABAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 32;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new LabF32ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "Lab identity built-in";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/lab_u16/LabColorSpace.h b/plugins/color/lcms2engine/colorspaces/lab_u16/LabColorSpace.h
index 1005fbd61e..975b2f3fc9 100644
--- a/plugins/color/lcms2engine/colorspaces/lab_u16/LabColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/lab_u16/LabColorSpace.h
@@ -1,120 +1,120 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LabU16ColorSpace_H_
#define LabU16ColorSpace_H_
#include "LcmsColorSpace.h"
#include "KoColorModelStandardIds.h"
#define TYPE_LABA_16 (COLORSPACE_SH(PT_Lab) | CHANNELS_SH(3) | BYTES_SH(2) | EXTRA_SH(1))
struct KoLabF32Traits;
class LabU16ColorSpace : public LcmsColorSpace<KoLabU16Traits>
{
public:
LabU16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const;
+ QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const override;
static QString colorSpaceId()
{
return QString("LABA");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return LABAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
private:
static const quint32 MAX_CHANNEL_L = 0xff00;
static const quint32 MAX_CHANNEL_AB = 0xffff;
static const quint32 CHANNEL_AB_ZERO_OFFSET = 0x8000;
};
class LabU16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
LabU16ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_LABA_16, cmsSigLabData)
{
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return LabU16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(LABAColorModelID.name()).arg(Integer16BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return LABAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new LabU16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "Lab identity built-in";
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/lab_u8/LabU8ColorSpace.h b/plugins/color/lcms2engine/colorspaces/lab_u8/LabU8ColorSpace.h
index cbbd131f48..9fe59a8a89 100644
--- a/plugins/color/lcms2engine/colorspaces/lab_u8/LabU8ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/lab_u8/LabU8ColorSpace.h
@@ -1,112 +1,112 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LabU8ColorSpace_H_
#define LabU8ColorSpace_H_
#include "LcmsColorSpace.h"
#include "KoColorModelStandardIds.h"
#define TYPE_LABA_8 (COLORSPACE_SH(PT_Lab) | CHANNELS_SH(3) | BYTES_SH(1) | EXTRA_SH(1))
struct KoLabU8Traits;
class LabU8ColorSpace : public LcmsColorSpace<KoLabU8Traits>
{
public:
LabU8ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
- virtual QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
+ QString normalisedChannelValueText(const quint8 *pixel, quint32 channelIndex) const override;
static QString colorSpaceId()
{
return QString("LABAU8");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return LABAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
virtual KoColorSpace* clone() const;
- virtual void colorToXML(const quint8* pixel, QDomDocument& doc, QDomElement& colorElt) const;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorToXML(const quint8* pixel, QDomDocument& doc, QDomElement& colorElt) const override;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
private:
static const quint32 MAX_CHANNEL_L = 100;
static const quint32 MAX_CHANNEL_AB = 255;
static const quint32 CHANNEL_AB_ZERO_OFFSET = 128;
};
class LabU8ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
LabU8ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_LABA_8, cmsSigLabData) {}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return LabU8ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(LABAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return LABAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 8;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new LabU8ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "Lab identity built-in";
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/rgb_f16/RgbF16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/rgb_f16/RgbF16ColorSpace.h
index a75cd9a4e8..e67932713b 100644
--- a/plugins/color/lcms2engine/colorspaces/rgb_f16/RgbF16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/rgb_f16/RgbF16ColorSpace.h
@@ -1,121 +1,121 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORGBF16COLORSPACE_H_
#define KORGBF16COLORSPACE_H_
#include "LcmsColorSpace.h"
#include "KoColorModelStandardIds.h"
struct KoRgbF16Traits;
class RgbF16ColorSpace : public LcmsColorSpace<KoRgbF16Traits>
{
public:
RgbF16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("RGBAF16");
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class RgbF16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
RgbF16ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_RGBA_HALF_FLT, cmsSigRgbData)
{
}
- virtual QString id() const
+ QString id() const override
{
return RgbF16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(RGBAColorModelID.name()).arg(Float16BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new RgbF16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "sRGB-elle-V2-g10.icc";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/rgb_f32/RgbF32ColorSpace.h b/plugins/color/lcms2engine/colorspaces/rgb_f32/RgbF32ColorSpace.h
index e5f2dbe2f7..bbfff27875 100644
--- a/plugins/color/lcms2engine/colorspaces/rgb_f32/RgbF32ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/rgb_f32/RgbF32ColorSpace.h
@@ -1,121 +1,121 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORGBF32COLORSPACE_H_
#define KORGBF32COLORSPACE_H_
#include "LcmsColorSpace.h"
#include "KoColorModelStandardIds.h"
struct KoRgbF32Traits;
class RgbF32ColorSpace : public LcmsColorSpace<KoRgbF32Traits>
{
public:
RgbF32ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("RGBAF32");
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class RgbF32ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
RgbF32ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_RGBA_FLT, cmsSigRgbData)
{
}
- virtual QString id() const
+ QString id() const override
{
return RgbF32ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(RGBAColorModelID.name()).arg(Float32BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 32;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new RgbF32ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "sRGB-elle-V2-g10.icc";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/rgb_u16/RgbU16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/rgb_u16/RgbU16ColorSpace.h
index 058518d306..a10a003e2b 100644
--- a/plugins/color/lcms2engine/colorspaces/rgb_u16/RgbU16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/rgb_u16/RgbU16ColorSpace.h
@@ -1,105 +1,105 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORGBU16COLORSPACE_H_
#define KORGBU16COLORSPACE_H_
#include "LcmsColorSpace.h"
#include "KoColorModelStandardIds.h"
struct KoBgrU16Traits;
class RgbU16ColorSpace : public LcmsColorSpace<KoBgrU16Traits>
{
public:
RgbU16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("RGBA16");
}
};
class RgbU16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
RgbU16ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_BGRA_16, cmsSigRgbData)
{
}
- virtual QString id() const
+ QString id() const override
{
return RgbU16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(RGBAColorModelID.name()).arg(Integer16BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new RgbU16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "sRGB-elle-V2-g10.icc";//this is a linear space, because 16bit is enough to only enjoy advantages of linear space
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.h b/plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.h
index 208cf70bd4..21cefeb8fc 100644
--- a/plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.h
@@ -1,118 +1,118 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KO_STRATEGY_COLORSPACE_RGB_H_
#define KO_STRATEGY_COLORSPACE_RGB_H_
#include <klocalizedstring.h>
#include <LcmsColorSpace.h>
#include "KoColorModelStandardIds.h"
struct KoBgrU8Traits;
class RgbU8ColorSpace : public LcmsColorSpace<KoBgrU8Traits>
{
public:
RgbU8ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence) const
+ bool willDegrade(ColorSpaceIndependence) const override
{
return false;
}
- virtual KoColorTransformation *createInvertTransformation() const;
+ KoColorTransformation *createInvertTransformation() const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8 *pixel, const QDomElement &elt) const;
+ void colorFromXML(quint8 *pixel, const QDomElement &elt) const override;
- virtual quint8 intensity8(const quint8 * src) const;
+ quint8 intensity8(const quint8 * src) const override;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("RGBA");
}
};
class RgbU8ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
RgbU8ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_BGRA_8, cmsSigRgbData) {}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual QString id() const
+ QString id() const override
{
return RgbU8ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(RGBAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return RGBAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 8;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new RgbU8ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "sRGB-elle-V2-srgbtrc.icc";
}
};
#endif // KO_STRATEGY_COLORSPACE_RGB_H_
diff --git a/plugins/color/lcms2engine/colorspaces/xyz_f16/XyzF16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/xyz_f16/XyzF16ColorSpace.h
index f52a319184..eb16abaacc 100644
--- a/plugins/color/lcms2engine/colorspaces/xyz_f16/XyzF16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/xyz_f16/XyzF16ColorSpace.h
@@ -1,125 +1,125 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_XYZ_F16_COLORSPACE_H_
#define KIS_XYZ_F16_COLORSPACE_H_
#include <LcmsColorSpace.h>
#define TYPE_XYZA_HALF_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
#include <KoColorModelStandardIds.h>
struct KoXyzF16Traits;
class XyzF16ColorSpace : public LcmsColorSpace<KoXyzF16Traits>
{
public:
XyzF16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("XYZAF16");
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class XyzF16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
XyzF16ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_XYZA_HALF_FLT, cmsSigXYZData)
{
}
- virtual QString id() const
+ QString id() const override
{
return XyzF16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(XYZAColorModelID.name()).arg(Float16BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new XyzF16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "XYZ identity built-in";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/xyz_f32/XyzF32ColorSpace.h b/plugins/color/lcms2engine/colorspaces/xyz_f32/XyzF32ColorSpace.h
index 1119f9a592..8dcdce74e3 100644
--- a/plugins/color/lcms2engine/colorspaces/xyz_f32/XyzF32ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/xyz_f32/XyzF32ColorSpace.h
@@ -1,125 +1,125 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_XYZ_F32_COLORSPACE_H_
#define KIS_XYZ_F32_COLORSPACE_H_
#include <LcmsColorSpace.h>
#define TYPE_XYZA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_XYZ)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4))
#include <KoColorModelStandardIds.h>
struct KoXyzF32Traits;
class XyzF32ColorSpace : public LcmsColorSpace<KoXyzF32Traits>
{
public:
XyzF32ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("XYZAF32");
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
};
class XyzF32ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
XyzF32ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_XYZA_FLT, cmsSigXYZData)
{
}
- virtual QString id() const
+ QString id() const override
{
return XyzF32ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(XYZAColorModelID.name()).arg(Float32BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 32;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new XyzF32ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "XYZ identity built-in";
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/xyz_u16/XyzU16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/xyz_u16/XyzU16ColorSpace.h
index 6bee624555..d89ac09f64 100644
--- a/plugins/color/lcms2engine/colorspaces/xyz_u16/XyzU16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/xyz_u16/XyzU16ColorSpace.h
@@ -1,107 +1,107 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_XYZ_U16_COLORSPACE_H_
#define KIS_XYZ_U16_COLORSPACE_H_
#include <LcmsColorSpace.h>
#include <KoColorSpaceTraits.h>
#include <KoColorModelStandardIds.h>
#define TYPE_XYZA_16 (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(2)|EXTRA_SH(1))
class XyzU16ColorSpace : public LcmsColorSpace<KoXyzU16Traits>
{
public:
XyzU16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
static QString colorSpaceId()
{
return QString("XYZA16");
}
};
class XyzU16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
XyzU16ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_XYZA_16, cmsSigXYZData)
{
}
- virtual QString id() const
+ QString id() const override
{
return XyzU16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(XYZAColorModelID.name()).arg(Integer16BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new XyzU16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "XYZ identity built-in";
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/xyz_u8/XyzU8ColorSpace.h b/plugins/color/lcms2engine/colorspaces/xyz_u8/XyzU8ColorSpace.h
index 51883900c0..0ff15c2c6f 100644
--- a/plugins/color/lcms2engine/colorspaces/xyz_u8/XyzU8ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/xyz_u8/XyzU8ColorSpace.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_XYZ_U8_COLORSPACE_H_
#define KIS_XYZ_U8_COLORSPACE_H_
#include <LcmsColorSpace.h>
#include <KoColorModelStandardIds.h>
#define TYPE_XYZA_8 (COLORSPACE_SH(PT_XYZ)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1))
struct KoXyzU8Traits;
class XyzU8ColorSpace : public LcmsColorSpace<KoXyzU8Traits>
{
public:
XyzU8ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
static QString colorSpaceId()
{
return QString("XYZA8");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
};
class XyzU8ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
XyzU8ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_XYZA_8, cmsSigXYZData)
{
}
- virtual QString id() const
+ QString id() const override
{
return XyzU8ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(XYZAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return XYZAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 8;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new XyzU8ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return "XYZ identity built-in";
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/ycbcr_f32/YCbCrF32ColorSpace.h b/plugins/color/lcms2engine/colorspaces/ycbcr_f32/YCbCrF32ColorSpace.h
index e8ca2f8ba3..4a0cbd99fd 100644
--- a/plugins/color/lcms2engine/colorspaces/ycbcr_f32/YCbCrF32ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/ycbcr_f32/YCbCrF32ColorSpace.h
@@ -1,126 +1,126 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_YCBCR_F32_COLORSPACE_H_
#define KIS_YCBCR_F32_COLORSPACE_H_
#include <LcmsColorSpace.h>
#include <KoColorModelStandardIds.h>
#define TYPE_YCbCrA_FLT (FLOAT_SH(1)|COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|EXTRA_SH(1)|BYTES_SH(4))
struct KoYCbCrF32Traits;
class YCbCrF32ColorSpace : public LcmsColorSpace<KoYCbCrF32Traits>
{
public:
YCbCrF32ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
static QString colorSpaceId()
{
return QString("YCBCRF32");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return YCbCrAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual bool hasHighDynamicRange() const
+ bool hasHighDynamicRange() const override
{
return true;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
};
class YCbCrF32ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
YCbCrF32ColorSpaceFactory()
: LcmsColorSpaceFactory(TYPE_YCbCrA_FLT, cmsSigYCbCrData)
{
}
- virtual QString id() const
+ QString id() const override
{
return YCbCrF32ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(YCbCrAColorModelID.name()).arg(Float32BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return YCbCrAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Float32BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 32;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new YCbCrF32ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return QString();
}
- virtual bool isHdr() const
+ bool isHdr() const override
{
return true;
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/ycbcr_u16/YCbCrU16ColorSpace.h b/plugins/color/lcms2engine/colorspaces/ycbcr_u16/YCbCrU16ColorSpace.h
index 349a8b2167..18ac3ac701 100644
--- a/plugins/color/lcms2engine/colorspaces/ycbcr_u16/YCbCrU16ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/ycbcr_u16/YCbCrU16ColorSpace.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_YCBCR_U16_COLORSPACE_H_
#define KIS_YCBCR_U16_COLORSPACE_H_
#include <LcmsColorSpace.h>
#include <KoColorModelStandardIds.h>
#define TYPE_YCbCrA_16 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(2)|EXTRA_SH(1))
struct KoYCbCrU16Traits;
class YCbCrU16ColorSpace : public LcmsColorSpace<KoYCbCrU16Traits>
{
public:
YCbCrU16ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
static QString colorSpaceId()
{
return QString("YCBCRAU16");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return YCbCrAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
};
class YCbCrU16ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
YCbCrU16ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_YCbCrA_16, cmsSigYCbCrData)
{
}
- virtual QString id() const
+ QString id() const override
{
return YCbCrU16ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(YCbCrAColorModelID.name()).arg(Integer16BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return YCbCrAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer16BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 16;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new YCbCrU16ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return QString();
}
};
#endif
diff --git a/plugins/color/lcms2engine/colorspaces/ycbcr_u8/YCbCrU8ColorSpace.h b/plugins/color/lcms2engine/colorspaces/ycbcr_u8/YCbCrU8ColorSpace.h
index 0610c2ccc4..b2f83119ae 100644
--- a/plugins/color/lcms2engine/colorspaces/ycbcr_u8/YCbCrU8ColorSpace.h
+++ b/plugins/color/lcms2engine/colorspaces/ycbcr_u8/YCbCrU8ColorSpace.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_YCBCR_U8_COLORSPACE_H_
#define KIS_YCBCR_U8_COLORSPACE_H_
#include <LcmsColorSpace.h>
#include <KoColorModelStandardIds.h>
#define TYPE_YCbCrA_8 (COLORSPACE_SH(PT_YCbCr)|CHANNELS_SH(3)|BYTES_SH(1)|EXTRA_SH(1))
struct KoYCbCrU8Traits;
class YCbCrU8ColorSpace : public LcmsColorSpace<KoYCbCrU8Traits>
{
public:
YCbCrU8ColorSpace(const QString &name, KoColorProfile *p);
- virtual bool willDegrade(ColorSpaceIndependence independence) const;
+ bool willDegrade(ColorSpaceIndependence independence) const override;
static QString colorSpaceId()
{
return QString("YCBCRA8");
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return YCbCrAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
virtual KoColorSpace *clone() const;
- virtual void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const;
+ void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override;
- virtual void colorFromXML(quint8* pixel, const QDomElement& elt) const;
- virtual void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const;
- virtual QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const;
- virtual void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const;
- virtual QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const;
+ void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
+ void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
+ QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
+ void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
+ QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
};
class YCbCrU8ColorSpaceFactory : public LcmsColorSpaceFactory
{
public:
YCbCrU8ColorSpaceFactory() : LcmsColorSpaceFactory(TYPE_YCbCrA_8, cmsSigYCbCrData)
{
}
- virtual QString id() const
+ QString id() const override
{
return YCbCrU8ColorSpace::colorSpaceId();
}
- virtual QString name() const
+ QString name() const override
{
return QString("%1 (%2)").arg(YCbCrAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
}
- virtual bool userVisible() const
+ bool userVisible() const override
{
return true;
}
- virtual KoID colorModelId() const
+ KoID colorModelId() const override
{
return YCbCrAColorModelID;
}
- virtual KoID colorDepthId() const
+ KoID colorDepthId() const override
{
return Integer8BitsColorDepthID;
}
- virtual int referenceDepth() const
+ int referenceDepth() const override
{
return 8;
}
- virtual KoColorSpace *createColorSpace(const KoColorProfile *p) const
+ KoColorSpace *createColorSpace(const KoColorProfile *p) const override
{
return new YCbCrU8ColorSpace(name(), p->clone());
}
- virtual QString defaultProfile() const
+ QString defaultProfile() const override
{
return QString();
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpClear.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpClear.h
index 2d1f9f8eb0..b372013237 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpClear.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpClear.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPCLEAR_H
#define RGBCOMPOSITEOPCLEAR_H
#include <KoCompositeOp.h>
template<class _CSTraits>
class RgbCompositeOpClear : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpClear(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_CLEAR, i18n("Clear"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
Q_UNUSED(opacity);
Q_UNUSED(srcRowStart);
Q_UNUSED(srcRowStride);
Q_UNUSED(maskRowStart);
Q_UNUSED(maskRowStride);
qint32 channelSize = sizeof(channels_type);
qint32 linesize = _CSTraits::channels_nb * channelSize * numColumns;
if (channelFlags.isEmpty()) {
quint8 *d = dstRowStart;
while (rows-- > 0) {
memset(d, 0, linesize);
d += dstRowStride;
}
} else {
channels_type *d = reinterpret_cast<channels_type *>(dstRowStart);
while (rows-- > 0) {
for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
if (channelFlags.testBit(channel)) {
memset(d, 0, channelSize);
}
d++;
}
}
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpDarken.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpDarken.h
index d8eb8df18d..3487beddeb 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpDarken.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpDarken.h
@@ -1,115 +1,115 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPDARKEN_H
#define RGBCOMPOSITEOPDARKEN_H
#include <KoCompositeOp.h>
template<class _CSTraits>
class RgbCompositeOpDarken : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpDarken(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_DARKEN, i18n("Darken"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
while (rows > 0) {
const quint8 *mask = maskRowStart;
const channels_type *src = reinterpret_cast<const channels_type *>(srcRowStart);
channels_type *dst = reinterpret_cast<channels_type *>(dstRowStart);
for (int i = numColumns; i > 0; --i) {
channels_type srcAlpha = src[_CSTraits::alpha_pos];
channels_type dstAlpha = dst[_CSTraits::alpha_pos];
srcAlpha = qMin(srcAlpha, dstAlpha);
// apply the alphamask
if (mask != 0) {
if (*mask != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(*mask);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, tmpOpacity);
}
mask++;
}
if (srcAlpha != NATIVE_OPACITY_TRANSPARENT) {
if (opacity != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(opacity);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(src[_CSTraits::alpha_pos], tmpOpacity);
}
channels_type srcBlend;
if (dstAlpha == NATIVE_OPACITY_OPAQUE) {
srcBlend = srcAlpha;
} else {
channels_type newAlpha = dstAlpha + KoColorSpaceMaths<channels_type>::multiply(NATIVE_OPACITY_OPAQUE - dstAlpha, srcAlpha);
dst[KoBgrU8Traits::alpha_pos] = newAlpha;
if (newAlpha != 0) {
srcBlend = KoColorSpaceMaths<channels_type>::divide(srcAlpha, newAlpha);
} else {
srcBlend = srcAlpha;
}
}
for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::alpha_pos)) {
channels_type srcColor = src[channel];
channels_type dstColor = dst[channel];
srcColor = qMin(srcColor, dstColor);
channels_type newColor = KoColorSpaceMaths<channels_type>::blend(srcColor, dstColor, srcBlend);
dst[channel] = newColor;
}
}
}
src += _CSTraits::channels_nb;
dst += _CSTraits::channels_nb;
}
rows--;
srcRowStart += srcRowStride;
dstRowStart += dstRowStride;
if (maskRowStart) {
maskRowStart += maskRowStride;
}
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpDissolve.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpDissolve.h
index c877b006cd..f29f2475bd 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpDissolve.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpDissolve.h
@@ -1,97 +1,97 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPDISSOLVE_H
#define RGBCOMPOSITEOPDISSOLVE_H
#include <KoCompositeOp.h>
template<class _CSTraits>
class RgbCompositeOpDissolve : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpDissolve(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_DISSOLVE, i18n("Dissolve"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
Q_UNUSED(maskRowStart);
Q_UNUSED(maskRowStride);
if (opacity == OPACITY_TRANSPARENT_U8) {
return;
}
channels_type *d;
const channels_type *s;
qint32 i;
qreal sAlpha, dAlpha;
while (rows-- > 0) {
d = reinterpret_cast<channels_type *>(dstRowStart);
s = reinterpret_cast<const channels_type *>(srcRowStart);
for (i = numColumns; i > 0; i--, d += _CSTraits::channels_nb, s += _CSTraits::channels_nb) {
// XXX: correct?
if (s[_CSTraits::alpha_pos] == NATIVE_OPACITY_TRANSPARENT) {
continue;
}
sAlpha = NATIVE_OPACITY_OPAQUE - s[_CSTraits::alpha_pos];
dAlpha = NATIVE_OPACITY_OPAQUE - d[_CSTraits::alpha_pos];
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::red_pos))
d[_CSTraits::red_pos] = (channels_type)(((qreal) sAlpha * s[_CSTraits::red_pos] +
(NATIVE_OPACITY_OPAQUE - sAlpha) * d[_CSTraits::red_pos]) / NATIVE_OPACITY_OPAQUE + 0.5);
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::green_pos))
d[_CSTraits::green_pos] = (channels_type)(((qreal) sAlpha * s[_CSTraits::green_pos] +
(NATIVE_OPACITY_OPAQUE - sAlpha) * d[_CSTraits::green_pos]) / NATIVE_OPACITY_OPAQUE + 0.5);
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::blue_pos))
d[_CSTraits::blue_pos] = (channels_type)(((qreal) sAlpha * s[_CSTraits::blue_pos] +
(NATIVE_OPACITY_OPAQUE - sAlpha) * d[_CSTraits::blue_pos]) / NATIVE_OPACITY_OPAQUE + 0.5);
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::alpha_pos)) {
d[_CSTraits::alpha_pos] = NATIVE_OPACITY_OPAQUE;
}
}
dstRowStart += dstRowStride;
srcRowStart += srcRowStride;
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpHue.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpHue.h
index 6ce1eefa8c..35e4f8920f 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpHue.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpHue.h
@@ -1,140 +1,140 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPHUE_H
#define RGBCOMPOSITEOPHUE_H
#include "KoColorConversions.h"
#include <KoCompositeOp.h>
#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< channels_type, float>::scaleToA( v )
#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, channels_type>::scaleToA( v )
template<class _CSTraits>
class RgbCompositeOpHue : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpHue(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_HUE, i18n("Hue"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
channels_type *dst;
const channels_type *src;
while (rows > 0) {
const quint8 *mask = maskRowStart;
src = reinterpret_cast<const channels_type *>(srcRowStart);
dst = reinterpret_cast<channels_type *>(dstRowStart);
for (int i = numColumns; i > 0; --i) {
channels_type srcAlpha = src[_CSTraits::alpha_pos];
channels_type dstAlpha = dst[_CSTraits::alpha_pos];
srcAlpha = qMin(srcAlpha, dstAlpha);
// apply the alphamask
if (mask != 0) {
if (*mask != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(*mask);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, tmpOpacity);
}
mask++;
}
if (srcAlpha != NATIVE_OPACITY_TRANSPARENT) {
if (opacity != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(opacity);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(src[_CSTraits::alpha_pos], tmpOpacity);
}
channels_type srcBlend;
if (dstAlpha == NATIVE_OPACITY_OPAQUE) {
srcBlend = srcAlpha;
} else {
channels_type newAlpha = dstAlpha + KoColorSpaceMaths<channels_type>::multiply(NATIVE_OPACITY_OPAQUE - dstAlpha, srcAlpha);
dst[_CSTraits::alpha_pos] = newAlpha;
if (newAlpha != 0) {
srcBlend = KoColorSpaceMaths<channels_type>::divide(srcAlpha, newAlpha);
} else {
srcBlend = srcAlpha;
}
}
float dstRed = SCALE_TO_FLOAT(dst[_CSTraits::red_pos]);
float dstGreen = SCALE_TO_FLOAT(dst[_CSTraits::green_pos]);
float dstBlue = SCALE_TO_FLOAT(dst[_CSTraits::blue_pos]);
float srcHue;
float srcSaturation;
float srcValue;
float dstHue;
float dstSaturation;
float dstValue;
float srcRed = SCALE_TO_FLOAT(src[_CSTraits::red_pos]);
float srcGreen = SCALE_TO_FLOAT(src[_CSTraits::green_pos]);
float srcBlue = SCALE_TO_FLOAT(src[_CSTraits::blue_pos]);
RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
HSVToRGB(srcHue, dstSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::red_pos)) {
dst[_CSTraits::red_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcRed), SCALE_FROM_FLOAT(dstRed), srcBlend);
}
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::green_pos)) {
dst[_CSTraits::green_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcGreen), SCALE_FROM_FLOAT(dstGreen), srcBlend);
}
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::blue_pos)) {
dst[_CSTraits::blue_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcBlue), SCALE_FROM_FLOAT(dstBlue), srcBlend);
}
}
src += _CSTraits::channels_nb;
dst += _CSTraits::channels_nb;
}
rows--;
srcRowStart += srcRowStride;
dstRowStart += dstRowStride;
if (maskRowStart) {
maskRowStart += maskRowStride;
}
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpIn.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpIn.h
index 003b358f94..4ba79b2bb0 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpIn.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpIn.h
@@ -1,92 +1,92 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPIN_H
#define RGBCOMPOSITEOPIN_H
#include <KoCompositeOp.h>
#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< channels_type, float>::scaleToA( v )
#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, channels_type>::scaleToA( v )
template<class _CSTraits>
class RgbCompositeOpIn : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpIn(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_IN, i18n("In"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
Q_UNUSED(maskRowStart);
Q_UNUSED(maskRowStride);
if (opacity == OPACITY_TRANSPARENT_U8) {
return;
}
channels_type *d;
const channels_type *s;
qint32 i;
//qreal sAlpha, dAlpha;
qreal alpha;
while (rows-- > 0) {
d = reinterpret_cast<channels_type *>(dstRowStart);
s = reinterpret_cast<const channels_type *>(srcRowStart);
for (i = numColumns; i > 0; i--, d += _CSTraits::channels_nb, s += _CSTraits::channels_nb) {
if (s[_CSTraits::alpha_pos] == NATIVE_OPACITY_TRANSPARENT) {
d[_CSTraits::alpha_pos] = NATIVE_OPACITY_TRANSPARENT;
continue;
} else if (s[_CSTraits::alpha_pos] == NATIVE_OPACITY_OPAQUE) {
continue;
}
if (d[_CSTraits::alpha_pos] == NATIVE_OPACITY_TRANSPARENT) {
continue;
}
alpha = (qreal)(s[_CSTraits::alpha_pos]) * d[_CSTraits::alpha_pos] / NATIVE_OPACITY_OPAQUE;
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::alpha_pos)) {
d[_CSTraits::alpha_pos] = (channels_type)((d[_CSTraits::alpha_pos] * alpha / NATIVE_OPACITY_OPAQUE) + 0.5);
}
}
dstRowStart += dstRowStride;
srcRowStart += srcRowStride;
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpLighten.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpLighten.h
index 882e8bd9f6..1d560241fd 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpLighten.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpLighten.h
@@ -1,117 +1,117 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPLIGHTEN_H
#define RGBCOMPOSITEOPLIGHTEN_H
#include <KoCompositeOp.h>
template<class _CSTraits>
class RgbCompositeOpLighten : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpLighten(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_LIGHTEN, i18n("Lighten"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
while (rows > 0) {
const quint8 *mask = maskRowStart;
const channels_type *src = reinterpret_cast<const channels_type *>(srcRowStart);
channels_type *dst = reinterpret_cast<channels_type *>(dstRowStart);
for (int i = numColumns; i > 0; --i) {
channels_type srcAlpha = src[_CSTraits::alpha_pos];
channels_type dstAlpha = dst[_CSTraits::alpha_pos];
srcAlpha = qMin(srcAlpha, dstAlpha);
// apply the alphamask
if (mask != 0) {
if (*mask != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(*mask);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, tmpOpacity);
}
mask++;
}
if (srcAlpha != NATIVE_OPACITY_TRANSPARENT) {
if (opacity != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(opacity);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(src[_CSTraits::alpha_pos], tmpOpacity);
}
channels_type srcBlend;
if (dstAlpha == NATIVE_OPACITY_OPAQUE) {
srcBlend = srcAlpha;
} else {
channels_type newAlpha = dstAlpha + KoColorSpaceMaths<channels_type>::multiply(NATIVE_OPACITY_OPAQUE - dstAlpha, srcAlpha);
dst[_CSTraits::alpha_pos] = newAlpha;
if (newAlpha != 0) {
srcBlend = KoColorSpaceMaths<channels_type>::divide(srcAlpha, newAlpha);
} else {
srcBlend = srcAlpha;
}
}
for (int channel = 0; channel < MAX_CHANNEL_RGB; channel++) {
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::alpha_pos)) {
channels_type srcColor = src[channel];
channels_type dstColor = dst[channel];
srcColor = qMax(srcColor, dstColor);
channels_type newColor = KoColorSpaceMaths<channels_type>::blend(srcColor, dstColor, srcBlend);
dst[channel] = newColor;
}
}
}
src += _CSTraits::channels_nb;
dst += _CSTraits::channels_nb;
}
rows--;
srcRowStart += srcRowStride;
dstRowStart += dstRowStride;
if (maskRowStart) {
maskRowStart += maskRowStride;
}
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpOut.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpOut.h
index c536ed24a8..2403d9762b 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpOut.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpOut.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPOUT_H
#define RGBCOMPOSITEOPOUT_H
#include <KoCompositeOp.h>
#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< channels_type, float>::scaleToA( v )
#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, channels_type>::scaleToA( v )
template<class _CSTraits>
class RgbCompositeOpOut : public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpOut(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_OUT, i18n("Out"))
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
Q_UNUSED(maskRowStart);
Q_UNUSED(maskRowStride);
if (opacity == OPACITY_TRANSPARENT_U8) {
return;
}
channels_type *d;
const channels_type *s;
qint32 i;
//qreal sAlpha, dAlpha;
qreal alpha;
while (rows-- > 0) {
d = reinterpret_cast<channels_type *>(dstRowStart);
s = reinterpret_cast<const channels_type *>(srcRowStart);
for (i = numColumns; i > 0; --i, d += _CSTraits::channels_nb, s += _CSTraits::channels_nb) {
if (s[_CSTraits::alpha_pos] == NATIVE_OPACITY_TRANSPARENT) {
continue;
} else if (s[_CSTraits::alpha_pos] == NATIVE_OPACITY_OPAQUE) {
d[_CSTraits::alpha_pos] = NATIVE_OPACITY_TRANSPARENT;
continue;
}
if (d[_CSTraits::alpha_pos] == NATIVE_OPACITY_TRANSPARENT) {
continue;
}
alpha = (channels_type)(s[_CSTraits::alpha_pos]) * d[_CSTraits::alpha_pos] / NATIVE_OPACITY_OPAQUE;
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::alpha_pos)) {
d[_CSTraits::alpha_pos] = (channels_type)((d[_CSTraits::alpha_pos] * (NATIVE_OPACITY_OPAQUE - alpha) / NATIVE_OPACITY_OPAQUE) + 0.5);
}
}
dstRowStart += dstRowStride;
srcRowStart += srcRowStride;
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpSaturation.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpSaturation.h
index c06b658b25..4dba82616b 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpSaturation.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpSaturation.h
@@ -1,138 +1,138 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPSATURATION_H
#define RGBCOMPOSITEOPSATURATION_H
#include "KoColorConversions.h"
#include <KoCompositeOp.h>
#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< channels_type, float>::scaleToA( v )
#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, channels_type>::scaleToA( v )
template<class _CSTraits>
class RgbCompositeOpSaturation: public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpSaturation(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_SATURATION, i18n("Saturation"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
while (rows > 0) {
const quint8 *mask = maskRowStart;
const channels_type *src = reinterpret_cast<const channels_type *>(srcRowStart);
channels_type *dst = reinterpret_cast<channels_type *>(dstRowStart);
for (int i = numColumns; i > 0; --i) {
channels_type srcAlpha = src[_CSTraits::alpha_pos];
channels_type dstAlpha = dst[_CSTraits::alpha_pos];
srcAlpha = qMin(srcAlpha, dstAlpha);
// apply the alphamask
if (mask != 0) {
if (*mask != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(*mask);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, tmpOpacity);
}
mask++;
}
if (srcAlpha != NATIVE_OPACITY_TRANSPARENT) {
if (opacity != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(opacity);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(src[_CSTraits::alpha_pos], tmpOpacity);
}
channels_type srcBlend;
if (dstAlpha == NATIVE_OPACITY_OPAQUE) {
srcBlend = srcAlpha;
} else {
channels_type newAlpha = dstAlpha + KoColorSpaceMaths<channels_type>::multiply(NATIVE_OPACITY_OPAQUE - dstAlpha, srcAlpha);
dst[_CSTraits::alpha_pos] = newAlpha;
if (newAlpha != 0) {
srcBlend = KoColorSpaceMaths<channels_type>::divide(srcAlpha, newAlpha);
} else {
srcBlend = srcAlpha;
}
}
float dstRed = SCALE_TO_FLOAT(dst[_CSTraits::red_pos]);
float dstGreen = SCALE_TO_FLOAT(dst[_CSTraits::green_pos]);
float dstBlue = SCALE_TO_FLOAT(dst[_CSTraits::blue_pos]);
float srcHue;
float srcSaturation;
float srcValue;
float dstHue;
float dstSaturation;
float dstValue;
float srcRed = SCALE_TO_FLOAT(src[_CSTraits::red_pos]);
float srcGreen = SCALE_TO_FLOAT(src[_CSTraits::green_pos]);
float srcBlue = SCALE_TO_FLOAT(src[_CSTraits::blue_pos]);
RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
HSVToRGB(dstHue, srcSaturation, dstValue, &srcRed, &srcGreen, &srcBlue);
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::red_pos)) {
dst[_CSTraits::red_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcRed), SCALE_FROM_FLOAT(dstRed), srcBlend);
}
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::green_pos)) {
dst[_CSTraits::green_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcGreen), SCALE_FROM_FLOAT(dstGreen), srcBlend);
}
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::blue_pos)) {
dst[_CSTraits::blue_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcBlue), SCALE_FROM_FLOAT(dstBlue), srcBlend);
}
}
src += _CSTraits::channels_nb;
dst += _CSTraits::channels_nb;
}
rows--;
srcRowStart += srcRowStride;
dstRowStart += dstRowStride;
if (maskRowStart) {
maskRowStart += maskRowStride;
}
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/compositeops/RgbCompositeOpValue.h b/plugins/color/lcms2engine/compositeops/RgbCompositeOpValue.h
index 1754cde15c..bb05fa011d 100644
--- a/plugins/color/lcms2engine/compositeops/RgbCompositeOpValue.h
+++ b/plugins/color/lcms2engine/compositeops/RgbCompositeOpValue.h
@@ -1,138 +1,138 @@
/*
* Copyright (c) 2006 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY const; 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 const; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RGBCOMPOSITEOPVALUE_H
#define RGBCOMPOSITEOPVALUE_H
#include "KoColorConversions.h"
#include <KoCompositeOp.h>
#define SCALE_TO_FLOAT( v ) KoColorSpaceMaths< channels_type, float>::scaleToA( v )
#define SCALE_FROM_FLOAT( v ) KoColorSpaceMaths< float, channels_type>::scaleToA( v )
template<class _CSTraits>
class RgbCompositeOpValue: public KoCompositeOp
{
typedef typename _CSTraits::channels_type channels_type;
typedef typename KoColorSpaceMathsTraits<typename _CSTraits::channels_type>::compositetype compositetype;
public:
RgbCompositeOpValue(KoColorSpace *cs)
: KoCompositeOp(cs, COMPOSITE_VALUE, i18n("Value"), "")
{
}
using KoCompositeOp::composite;
void composite(quint8 *dstRowStart, qint32 dstRowStride,
const quint8 *srcRowStart, qint32 srcRowStride,
const quint8 *maskRowStart, qint32 maskRowStride,
qint32 rows, qint32 numColumns,
quint8 opacity,
- const QBitArray &channelFlags) const
+ const QBitArray &channelFlags) const override
{
while (rows > 0) {
const quint8 *mask = maskRowStart;
const channels_type *src = reinterpret_cast<const channels_type *>(srcRowStart);
channels_type *dst = reinterpret_cast<channels_type *>(dstRowStart);
for (int i = numColumns; i > 0; --i) {
channels_type srcAlpha = src[_CSTraits::alpha_pos];
channels_type dstAlpha = dst[_CSTraits::alpha_pos];
srcAlpha = qMin(srcAlpha, dstAlpha);
// apply the alphamask
if (mask != 0) {
if (*mask != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(*mask);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(srcAlpha, tmpOpacity);
}
mask++;
}
if (srcAlpha != NATIVE_OPACITY_TRANSPARENT) {
if (opacity != OPACITY_OPAQUE_U8) {
channels_type tmpOpacity = KoColorSpaceMaths<quint8, channels_type>::scaleToA(opacity);
srcAlpha = KoColorSpaceMaths<channels_type>::multiply(src[_CSTraits::alpha_pos], tmpOpacity);
}
channels_type srcBlend;
if (dstAlpha == NATIVE_OPACITY_OPAQUE) {
srcBlend = srcAlpha;
} else {
channels_type newAlpha = dstAlpha + KoColorSpaceMaths<channels_type>::multiply(NATIVE_OPACITY_OPAQUE - dstAlpha, srcAlpha);
dst[_CSTraits::alpha_pos] = newAlpha;
if (newAlpha != 0) {
srcBlend = KoColorSpaceMaths<channels_type>::divide(srcAlpha, newAlpha);
} else {
srcBlend = srcAlpha;
}
}
float dstRed = SCALE_TO_FLOAT(dst[_CSTraits::red_pos]);
float dstGreen = SCALE_TO_FLOAT(dst[_CSTraits::green_pos]);
float dstBlue = SCALE_TO_FLOAT(dst[_CSTraits::blue_pos]);
float srcHue;
float srcSaturation;
float srcValue;
float dstHue;
float dstSaturation;
float dstValue;
float srcRed = SCALE_TO_FLOAT(src[_CSTraits::red_pos]);
float srcGreen = SCALE_TO_FLOAT(src[_CSTraits::green_pos]);
float srcBlue = SCALE_TO_FLOAT(src[_CSTraits::blue_pos]);
RGBToHSV(srcRed, srcGreen, srcBlue, &srcHue, &srcSaturation, &srcValue);
RGBToHSV(dstRed, dstGreen, dstBlue, &dstHue, &dstSaturation, &dstValue);
HSVToRGB(dstHue, dstSaturation, srcValue, &srcRed, &srcGreen, &srcBlue);
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::red_pos)) {
dst[_CSTraits::red_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcRed), SCALE_FROM_FLOAT(dstRed), srcBlend);
}
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::green_pos)) {
dst[_CSTraits::green_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcGreen), SCALE_FROM_FLOAT(dstGreen), srcBlend);
}
if (channelFlags.isEmpty() || channelFlags.testBit(_CSTraits::blue_pos)) {
dst[_CSTraits::blue_pos] = KoColorSpaceMaths<channels_type>::blend(SCALE_FROM_FLOAT(srcBlue), SCALE_FROM_FLOAT(dstBlue), srcBlend);
}
}
src += _CSTraits::channels_nb;
dst += _CSTraits::channels_nb;
}
rows--;
srcRowStart += srcRowStride;
dstRowStart += dstRowStride;
if (maskRowStart) {
maskRowStart += maskRowStride;
}
}
}
};
#endif
diff --git a/plugins/color/lcms2engine/tests/TestKoColorSpaceRegistry.cpp b/plugins/color/lcms2engine/tests/TestKoColorSpaceRegistry.cpp
index ac3ee61a46..5837e16151 100644
--- a/plugins/color/lcms2engine/tests/TestKoColorSpaceRegistry.cpp
+++ b/plugins/color/lcms2engine/tests/TestKoColorSpaceRegistry.cpp
@@ -1,95 +1,89 @@
#include "TestKoColorSpaceRegistry.h"
#include <QTest>
#include "KoColorSpaceRegistry.h"
#include "KoColorSpace.h"
#include "RgbU8ColorSpace.h"
#include "RgbU16ColorSpace.h"
#include "LabColorSpace.h"
void TestKoColorSpaceRegistry::testConstruction()
{
KoColorSpaceRegistry *instance = KoColorSpaceRegistry::instance();
Q_ASSERT(instance);
}
void TestKoColorSpaceRegistry::testRgbU8()
{
- QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(RGBAColorModelID,
- Integer8BitsColorDepthID);
- const KoColorSpaceFactory *colorSpaceFactory = KoColorSpaceRegistry::instance()->colorSpaceFactory(colorSpaceId);
- QVERIFY(colorSpaceFactory != 0);
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(RGBAColorModelID,
+ Integer8BitsColorDepthID);
const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->rgb8();
QVERIFY(colorSpace != 0);
const KoColorProfile *profile = colorSpace->profile();
QVERIFY(profile != 0);
- QCOMPARE(profile->name(), colorSpaceFactory->defaultProfile());
+ QCOMPARE(profile->name(), KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId));
cmsHPROFILE lcmsProfile = cmsCreate_sRGBProfile();
QString testProfileName = "TestRGBU8ProfileName";
cmsWriteTag(lcmsProfile, cmsSigProfileDescriptionTag, testProfileName.toLatin1().constData());
cmsWriteTag(lcmsProfile, cmsSigDeviceModelDescTag, testProfileName.toLatin1().constData());
cmsWriteTag(lcmsProfile, cmsSigDeviceMfgDescTag, "");
}
void TestKoColorSpaceRegistry::testRgbU16()
{
- QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(RGBAColorModelID,
- Integer16BitsColorDepthID);
- const KoColorSpaceFactory *colorSpaceFactory = KoColorSpaceRegistry::instance()->colorSpaceFactory(colorSpaceId);
- QVERIFY(colorSpaceFactory != 0);
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(RGBAColorModelID,
+ Integer16BitsColorDepthID);
const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->rgb16();
QVERIFY(colorSpace != 0);
const KoColorProfile *profile = colorSpace->profile();
QVERIFY(profile != 0);
- QCOMPARE(profile->name(), colorSpaceFactory->defaultProfile());
+ QCOMPARE(profile->name(), KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId));
cmsHPROFILE lcmsProfile = cmsCreate_sRGBProfile();
QString testProfileName = "TestRGBU16ProfileName";
cmsWriteTag(lcmsProfile, cmsSigProfileDescriptionTag, testProfileName.toLatin1().constData());
cmsWriteTag(lcmsProfile, cmsSigDeviceModelDescTag, testProfileName.toLatin1().constData());
cmsWriteTag(lcmsProfile, cmsSigDeviceMfgDescTag, "");
}
void TestKoColorSpaceRegistry::testLab()
{
- QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(LABAColorModelID,
- Integer16BitsColorDepthID);
- const KoColorSpaceFactory *colorSpaceFactory = KoColorSpaceRegistry::instance()->colorSpaceFactory(colorSpaceId);
- QVERIFY(colorSpaceFactory != 0);
+ const QString colorSpaceId = KoColorSpaceRegistry::instance()->colorSpaceId(LABAColorModelID,
+ Integer16BitsColorDepthID);
const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->lab16();
QVERIFY(colorSpace != 0);
const KoColorProfile *profile = colorSpace->profile();
QVERIFY(profile != 0);
- QCOMPARE(profile->name(), colorSpaceFactory->defaultProfile());
+ QCOMPARE(profile->name(), KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId));
cmsCIExyY whitepoint;
whitepoint.x = 0.33;
whitepoint.y = 0.33;
whitepoint.Y = 1.0;
cmsHPROFILE lcmsProfile = cmsCreateLab2Profile(&whitepoint);
QString testProfileName = "TestLabProfileName";
cmsWriteTag(lcmsProfile, cmsSigProfileDescriptionTag, testProfileName.toLatin1().constData());
cmsWriteTag(lcmsProfile, cmsSigDeviceModelDescTag, testProfileName.toLatin1().constData());
cmsWriteTag(lcmsProfile, cmsSigDeviceMfgDescTag, "");
}
QTEST_GUILESS_MAIN(TestKoColorSpaceRegistry)
diff --git a/plugins/dockers/advancedcolorselector/colorselectorng.h b/plugins/dockers/advancedcolorselector/colorselectorng.h
index 698040202e..08da99cf15 100644
--- a/plugins/dockers/advancedcolorselector/colorselectorng.h
+++ b/plugins/dockers/advancedcolorselector/colorselectorng.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _COLORSELECTORNG_H_
#define _COLORSELECTORNG_H_
#include <QObject>
#include <QVariant>
/**
* Template of view plugin
*/
class ColorSelectorNgPlugin : public QObject
{
Q_OBJECT
public:
ColorSelectorNgPlugin(QObject *parent, const QVariantList &);
- virtual ~ColorSelectorNgPlugin();
+ ~ColorSelectorNgPlugin() override;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_color_history.h b/plugins/dockers/advancedcolorselector/kis_color_history.h
index b0dabbf337..f6055fe0ab 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_history.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_history.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_HISTORY_H
#define KIS_COLOR_HISTORY_H
#include "kis_color_patches.h"
class KisCanvasResourceProvider;
class KisColorHistory : public KisColorPatches
{
Q_OBJECT
public:
explicit KisColorHistory(QWidget *parent = 0);
- void setCanvas(KisCanvas2 *canvas);
- void unsetCanvas();
+ void setCanvas(KisCanvas2 *canvas) override;
+ void unsetCanvas() override;
protected:
- KisColorSelectorBase* createPopup() const;
+ KisColorSelectorBase* createPopup() const override;
public Q_SLOTS:
void addColorToHistory(const KoColor& color);
private:
QList<KoColor> m_colorHistory;
KisCanvasResourceProvider *m_resourceProvider; // to disconnect...
};
#endif // KIS_COLOR_HISTORY_H
diff --git a/plugins/dockers/advancedcolorselector/kis_color_patches.h b/plugins/dockers/advancedcolorselector/kis_color_patches.h
index 0b44bfdf78..1905d4c102 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_patches.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_patches.h
@@ -1,89 +1,89 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_PATCHES_H
#define KIS_COLOR_PATCHES_H
#include "kis_color_selector_base.h"
#include "KoColor.h"
class KoColor;
class KisColorPatches : public KisColorSelectorBase
{
Q_OBJECT
public:
explicit KisColorPatches(QString configPrefix, QWidget *parent = 0);
enum Direction { Horizontal, Vertical };
public Q_SLOTS:
- void updateSettings();
+ void updateSettings() override;
protected:
void setColors(QList<KoColor> colors);
QList<KoColor> colors() const {return m_colors;}
- void paintEvent(QPaintEvent *);
- void wheelEvent(QWheelEvent *);
- void resizeEvent(QResizeEvent *);
- void mouseReleaseEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
+ void paintEvent(QPaintEvent *) override;
+ void wheelEvent(QWheelEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
int patchCount() const;
bool colorAt(const QPoint &, KoColor *result) const;
public:
/// set buttons, that should be drawn additionally to the patches
/// this class takes ownership of them and will delete them
/// they will be resized to the patchsize
void setAdditionalButtons(QList<QWidget*> buttonList);
private:
int m_patchWidth;
int m_patchHeight;
int m_patchCount;
QList<KoColor> m_colors;
bool m_allowColorListChangeGuard;
int m_scrollValue;
Direction m_direction;
bool m_allowScrolling;
int m_numCols;
int m_numRows;
QList<QWidget*> m_buttonList;
/// returns width of the patchfield, if there are only m_numRows allowed
int widthOfAllPatches();
/// returns height of the patchfield, if there are only m_numCols allowed
int heightOfAllPatches();
/// returns height, that is needed to display all patches with the given width
- int heightForWidth(int width) const;
+ int heightForWidth(int width) const override;
/// returns width, that is needed to display all patches with the given height
int widthForHeight(int height) const;
/// returns count of colors and buttons
int fieldCount() const;
QString m_configPrefix;
QPoint m_dragStartPos;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector.h b/plugins/dockers/advancedcolorselector/kis_color_selector.h
index 35799c1f33..f349bf1b9a 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_SELECTOR_H
#define KIS_COLOR_SELECTOR_H
#include "kis_color_selector_base.h"
#include <KisColorSelectorConfiguration.h>
class KisColorSelectorRing;
class KisColorSelectorComponent;
class KisColorSelectorSimple;
class KisColorSelectorWheel;
class QPushButton;
class KisSignalCompressor;
class KisColorSelector : public KisColorSelectorBase
{
Q_OBJECT
public:
KisColorSelector(KisColorSelectorConfiguration conf, QWidget* parent = 0);
KisColorSelector(QWidget* parent=0);
- KisColorSelectorBase* createPopup() const;
+ KisColorSelectorBase* createPopup() const override;
void setConfiguration(KisColorSelectorConfiguration conf);
KisColorSelectorConfiguration configuration() const;
- void setColor(const KoColor &color);
+ void setColor(const KoColor &color) override;
public Q_SLOTS:
- void reset();
- void updateSettings();
+ void reset() override;
+ void updateSettings() override;
Q_SIGNALS:
void settingsButtonClicked();
protected:
- void paintEvent(QPaintEvent*);
- void resizeEvent(QResizeEvent*);
- void mousePressEvent(QMouseEvent*);
- void mouseMoveEvent(QMouseEvent*);
- void mouseReleaseEvent(QMouseEvent*);
+ void paintEvent(QPaintEvent*) override;
+ void resizeEvent(QResizeEvent*) override;
+ void mousePressEvent(QMouseEvent*) override;
+ void mouseMoveEvent(QMouseEvent*) override;
+ void mouseReleaseEvent(QMouseEvent*) override;
bool displaySettingsButton();
private:
void mouseEvent(QMouseEvent* e);
void init();
KisColorSelectorRing* m_ring;
KisColorSelectorComponent* m_triangle;
KisColorSelectorSimple* m_slider;
KisColorSelectorSimple* m_square;
KisColorSelectorWheel* m_wheel;
QPushButton* m_button;
KisColorSelectorComponent* m_mainComponent;
KisColorSelectorComponent* m_subComponent;
KisColorSelectorComponent* m_grabbingComponent;
KisSignalCompressor *m_signalCompressor;
KisColorSelectorConfiguration m_configuration;
KoColor m_lastRealColor;
KoColor m_currentRealColor;
bool m_blipDisplay;
Acs::ColorRole m_lastColorRole;
public:
void setDisplayBlip(bool disp) {m_blipDisplay = disp;}
bool displayBlip() const {return m_blipDisplay;}
};
#endif // KIS_COLSELNG_COLOR_SELECTOR_H
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_base.h b/plugins/dockers/advancedcolorselector/kis_color_selector_base.h
index 811878b062..3a70663ef8 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_base.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_base.h
@@ -1,129 +1,129 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_BASE_H
#define KIS_COLOR_SELECTOR_BASE_H
#include <QWidget>
#include <QRgb>
#include <QPointer>
#include <kis_canvas2.h>
#include "kis_acs_types.h"
#include "kis_signal_compressor_with_param.h"
class KoColor;
class QTimer;
class KoColorSpace;
class KisCanvas2;
class KisColorPreviewPopup;
class KisDisplayColorConverter;
/// Base class for all color selectors, that should support color management and zooming.
class KisColorSelectorBase : public QWidget
{
Q_OBJECT
public:
enum Move {MoveToMousePosition, DontMove};
explicit KisColorSelectorBase(QWidget *parent = 0);
- ~KisColorSelectorBase();
+ ~KisColorSelectorBase() override;
void setPopupBehaviour(bool onMouseOver, bool onMouseClick);
void setColorSpace(const KoColorSpace* colorSpace);
virtual void setCanvas(KisCanvas2* canvas);
virtual void unsetCanvas();
const KoColorSpace* colorSpace() const;
KisDisplayColorConverter* converter() const;
public:
void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset);
void updateColorPreview(const KoColor &color);
void showColorPreview();
void updateBaseColorPreview(const KoColor &color);
void updatePreviousColorPreview();
virtual void setColor(const KoColor& color);
public Q_SLOTS:
/**
* Flushes caches and redraws the selectors
*/
virtual void reset();
virtual void updateSettings();
virtual void showPopup(Move move=MoveToMousePosition);
public:
- void enterEvent(QEvent *e);
- void leaveEvent(QEvent *e);
+ void enterEvent(QEvent *e) override;
+ void leaveEvent(QEvent *e) override;
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
protected:
- void keyPressEvent(QKeyEvent *);
+ void keyPressEvent(QKeyEvent *) override;
virtual KisColorSelectorBase* createPopup() const = 0;
- void dragEnterEvent(QDragEnterEvent *);
- void dropEvent(QDropEvent *);
+ void dragEnterEvent(QDragEnterEvent *) override;
+ void dropEvent(QDropEvent *) override;
void setHidingTime(int time);
bool isPopup() const { return m_isPopup; }
- void mouseMoveEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event) override;
void requestUpdateColorAndPreview(const KoColor &color, Acs::ColorRole role);
private:
void commitColor(const KoColor& koColor, Acs::ColorRole role);
protected Q_SLOTS:
void hidePopup();
/// if you overwrite this, keep in mind, that you should set the colour only, if m_colorUpdateAllowed is true
virtual void canvasResourceChanged(int key, const QVariant& v);
void updateLastUsedColorPreview(const KoColor &color);
public:
// This is a private interface for signal compressor, don't use it.
// Use requestUpdateColorAndPreview() instead
void slotUpdateColorAndPreview(QPair<KoColor, Acs::ColorRole> color);
private:
void lazyCreatePopup();
protected:
QPointer<KisCanvas2> m_canvas;
KisColorSelectorBase* m_popup;
QWidget* m_parent;
bool m_colorUpdateAllowed;
bool m_colorUpdateSelf;
private:
QTimer* m_hideTimer;
bool m_popupOnMouseOver;
bool m_popupOnMouseClick;
mutable const KoColorSpace* m_colorSpace;
bool m_isPopup; //this instance is a popup
bool m_hideOnMouseClick;
KisColorPreviewPopup* m_colorPreviewPopup;
typedef KisSignalCompressorWithParam<QPair<KoColor, Acs::ColorRole>> ColorCompressorType;
QScopedPointer<ColorCompressorType> m_updateColorCompressor;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_base_proxy.h b/plugins/dockers/advancedcolorselector/kis_color_selector_base_proxy.h
index 181e0a15da..6764c5bcff 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_base_proxy.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_base_proxy.h
@@ -1,88 +1,88 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLOR_SELECTOR_BASE_PROXY_H
#define __KIS_COLOR_SELECTOR_BASE_PROXY_H
#include "kis_acs_types.h"
class KoColor;
class KoColorSpace;
class KisDisplayColorConverter;
/**
* A proxy interface for accessing high-level KisColorSelectorBase
* structure by lower level classes.
*
* This small abstractions makes the interface clear and hides all the
* non-relevant features from the clients
*/
class KisColorSelectorBaseProxy
{
public:
virtual ~KisColorSelectorBaseProxy();
virtual const KoColorSpace* colorSpace() const = 0;
virtual void showColorPreview() = 0;
virtual void updateColorPreview(const KoColor &color) = 0;
virtual void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset) = 0;
virtual KisDisplayColorConverter* converter() const = 0;
};
class KisColorSelectorBaseProxyNoop : public KisColorSelectorBaseProxy
{
public:
KisColorSelectorBaseProxyNoop();
- ~KisColorSelectorBaseProxyNoop();
+ ~KisColorSelectorBaseProxyNoop() override;
- const KoColorSpace* colorSpace() const;
+ const KoColorSpace* colorSpace() const override;
- void showColorPreview() {}
+ void showColorPreview() override {}
- void updateColorPreview(const KoColor &color) {
+ void updateColorPreview(const KoColor &color) override {
Q_UNUSED(color);
}
- void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset) {
+ void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset) override {
Q_UNUSED(color);
Q_UNUSED(role);
Q_UNUSED(needsExplicitColorReset);
}
- KisDisplayColorConverter* converter() const;
+ KisDisplayColorConverter* converter() const override;
};
class KisColorSelectorBase;
class KisColorSelectorBaseProxyObject : public KisColorSelectorBaseProxy
{
public:
KisColorSelectorBaseProxyObject(KisColorSelectorBase *parent);
- const KoColorSpace* colorSpace() const;
- void showColorPreview();
- void updateColorPreview(const KoColor &color);
- void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset);
- KisDisplayColorConverter* converter() const;
+ const KoColorSpace* colorSpace() const override;
+ void showColorPreview() override;
+ void updateColorPreview(const KoColor &color) override;
+ void updateColor(const KoColor &color, Acs::ColorRole role, bool needsExplicitColorReset) override;
+ KisDisplayColorConverter* converter() const override;
private:
KisColorSelectorBase *m_parent;
};
#endif /* __KIS_COLOR_SELECTOR_BASE_PROXY_H */
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_combo_box.h b/plugins/dockers/advancedcolorselector/kis_color_selector_combo_box.h
index a141ffe5ca..1a7e54e230 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_combo_box.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_combo_box.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_COMBO_BOX_H
#define KIS_COLOR_SELECTOR_COMBO_BOX_H
#include <QComboBox>
#include "kis_color_selector.h"
class KisColorSelectorComboBoxPrivate;
class KoColorSpace;
class KisColorSelectorComboBox : public QComboBox
{
Q_OBJECT
public:
KisColorSelectorComboBox(QWidget* parent=0);
- ~KisColorSelectorComboBox();
- void hidePopup();
- void showPopup();
+ ~KisColorSelectorComboBox() override;
+ void hidePopup() override;
+ void showPopup() override;
KisColorSelectorConfiguration configuration() const;
//int m_model;
protected:
- void paintEvent(QPaintEvent *e);
+ void paintEvent(QPaintEvent *e) override;
public Q_SLOTS:
void setColorSpace(const KoColorSpace* colorSpace);
void setConfiguration(KisColorSelectorConfiguration);
void setList(int model);
private:
KisColorSelectorComboBoxPrivate* m_private;
KisColorSelectorConfiguration m_configuration;
KisColorSelector m_currentSelector;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_container.h b/plugins/dockers/advancedcolorselector/kis_color_selector_container.h
index fd445c8db7..27c32fa151 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_container.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_container.h
@@ -1,69 +1,69 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_CONTAINER_H
#define KIS_COLOR_SELECTOR_CONTAINER_H
#include <QWidget>
#include <QPointer>
#include <kis_canvas2.h>
class KisColorSelector;
class KisMyPaintShadeSelector;
class KisMinimalShadeSelector;
class QBoxLayout;
class QAction;
class KisColorSelectorContainer : public QWidget
{
Q_OBJECT
public:
explicit KisColorSelectorContainer(QWidget *parent = 0);
void setCanvas(KisCanvas2* canvas);
void unsetCanvas();
enum ShadeSelectorType{MyPaintSelector, MinimalSelector, NoSelector};
Q_SIGNALS:
void openSettings();
void settingsChanged();
protected Q_SLOTS:
void updateSettings();
void reactOnLayerChange();
protected:
- void resizeEvent(QResizeEvent *);
+ void resizeEvent(QResizeEvent *) override;
private:
KisColorSelector* m_colorSelector;
KisMyPaintShadeSelector* m_myPaintShadeSelector;
KisMinimalShadeSelector* m_minimalShadeSelector;
QWidget* m_shadeSelector;
int m_onDockerResizeSetting;
QBoxLayout* m_widgetLayout;
QAction * m_colorSelAction;
QAction * m_mypaintAction;
QAction * m_minimalAction;
QPointer<KisCanvas2> m_canvas;
};
#endif // KIS_COLOR_SELECTOR_CONTAINER_H
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_ng_dock.h b/plugins/dockers/advancedcolorselector/kis_color_selector_ng_dock.h
index ec910f0467..7df03d9a10 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_ng_dock.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_ng_dock.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_SELECTOR_NG_DOCKER_H
#define KIS_COLOR_SELECTOR_NG_DOCKER_H
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
class KisColorSelectorNgDockerWidget;
class KisColorSelectorNgDock : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
KisColorSelectorNgDock();
- QString observerName() { return "KisColorSelectorNgDock"; }
+ QString observerName() override { return "KisColorSelectorNgDock"; }
/// reimplemented from KoCanvasObserverBase
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private:
KisColorSelectorNgDockerWidget *m_colorSelectorNgWidget;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_ring.h b/plugins/dockers/advancedcolorselector/kis_color_selector_ring.h
index e851fcb781..e941fd6137 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_ring.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_ring.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_RING_H
#define KIS_COLOR_SELECTOR_RING_H
#include "kis_color_selector_component.h"
#include <QImage>
class KisColorSelectorRing : public KisColorSelectorComponent
{
Q_OBJECT
public:
explicit KisColorSelectorRing(KisColorSelector *parent);
int innerRadius() const;
- void setColor(const KoColor &color);
+ void setColor(const KoColor &color) override;
void setInnerRingRadiusFraction(qreal newFraction);
protected:
- void paint(QPainter*);
- KoColor selectColor(int x, int y);
- bool containsPointInComponentCoords(int x, int y) const;
+ void paint(QPainter*) override;
+ KoColor selectColor(int x, int y) override;
+ bool containsPointInComponentCoords(int x, int y) const override;
private:
void paintCache();
void colorCache();
int outerRadius() const;
QImage m_pixelCache;
const KoColorSpace* m_cachedColorSpace;
int m_cachedSize;
qreal m_lastHue;
QList<QRgb> m_cachedColors;
qreal m_innerRingRadiusFraction;
};
#endif // KIS_COLOR_SELECTOR_RING_H
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_settings.h b/plugins/dockers/advancedcolorselector/kis_color_selector_settings.h
index 501fc9cc06..499eb8a658 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_settings.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_settings.h
@@ -1,95 +1,95 @@
/*
* Copyright (C) 2010 Celarek Adam <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_SELECTOR_SETTINGS_H
#define KIS_COLOR_SELECTOR_SETTINGS_H
#include <QDialog>
#include "kis_preference_set_registry.h"
namespace Ui {
class KisColorSelectorSettings;
}
class QIcon;
class KisColorSelectorSettings : public KisPreferenceSet {
Q_OBJECT
public:
KisColorSelectorSettings(QWidget *parent = 0);
- ~KisColorSelectorSettings();
+ ~KisColorSelectorSettings() override;
- virtual QString id();
- virtual QString name();
- virtual QString header();
- virtual QIcon icon();
+ QString id() override;
+ QString name() override;
+ QString header() override;
+ QIcon icon() override;
public Q_SLOTS:
- void savePreferences() const;
- void loadPreferences();
- void loadDefaultPreferences();
+ void savePreferences() const override;
+ void loadPreferences() override;
+ void loadDefaultPreferences() override;
void changedColorDocker(int);
void useDifferentColorSpaceChecked(bool);
void changedACSColorSelectorType(int);
void changedACSShadeSelectorType(int);
void changedACSColorAlignment(bool);
void changedACSLastUsedColorAlignment(bool);
Q_SIGNALS:
void settingsChanged() const;
void hsxchanged(int);
protected:
//void changeEvent(QEvent *e);
private:
Ui::KisColorSelectorSettings *ui;
};
class KisColorSelectorSettingsUpdateRepeater : public QObject {
Q_OBJECT
Q_SIGNALS:
void settingsUpdated();
public Q_SLOTS:
void updateSettings() {
emit settingsUpdated();
}
};
class KisColorSelectorSettingsFactory : public KisAbstractPreferenceSetFactory {
public:
- KisPreferenceSet* createPreferenceSet() {
+ KisPreferenceSet* createPreferenceSet() override {
KisColorSelectorSettings* ps = new KisColorSelectorSettings();
QObject::connect(ps, SIGNAL(settingsChanged()), &repeater, SLOT(updateSettings()), Qt::UniqueConnection);
return ps;
}
- virtual QString id() const { return "ColorSelectorSettings"; }
+ QString id() const override { return "ColorSelectorSettings"; }
KisColorSelectorSettingsUpdateRepeater repeater;
};
class KisColorSelectorSettingsDialog : public QDialog {
Q_OBJECT
public:
KisColorSelectorSettingsDialog(QWidget *parent = 0);
private:
KisColorSelectorSettings* m_widget;
};
#endif // KIS_COLOR_SELECTOR_SETTINGS_H
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_simple.h b/plugins/dockers/advancedcolorselector/kis_color_selector_simple.h
index 0eecc5afdd..59810ded82 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_simple.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_simple.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_SIMPLE_H
#define KIS_COLOR_SELECTOR_SIMPLE_H
typedef unsigned int QRgb;
#include <QColor>
#include <QImage>
#include "KoColor.h"
#include "kis_color_selector_component.h"
namespace Acs {
class PixelCacheRenderer;
}
class KisColorSelectorSimple : public KisColorSelectorComponent
{
Q_OBJECT
public:
explicit KisColorSelectorSimple(KisColorSelector *parent);
- void setColor(const KoColor &color);
+ void setColor(const KoColor &color) override;
protected:
- void paint(QPainter*);
- KoColor selectColor(int x, int y);
+ void paint(QPainter*) override;
+ KoColor selectColor(int x, int y) override;
private:
friend class Acs::PixelCacheRenderer;
KoColor colorAt(int x, int y);
private:
QPointF m_lastClickPos;
QImage m_pixelCache;
qreal R;
qreal G;
qreal B;
qreal Gamma;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_triangle.h b/plugins/dockers/advancedcolorselector/kis_color_selector_triangle.h
index dd605761df..742749d799 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_triangle.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_triangle.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_TRIANGLE_H
#define KIS_COLOR_SELECTOR_TRIANGLE_H
#include "kis_color_selector_component.h"
#include "kis_paint_device.h"
#include <QSize>
#include <QImage>
namespace Acs {
class PixelCacheRenderer;
}
class KisColorSelectorTriangle : public KisColorSelectorComponent
{
Q_OBJECT
public:
explicit KisColorSelectorTriangle(KisColorSelector* parent);
- void setColor(const KoColor &color);
+ void setColor(const KoColor &color) override;
protected:
- void paint(QPainter*);
- KoColor selectColor(int x, int y);
- bool containsPointInComponentCoords(int x, int y) const;
+ void paint(QPainter*) override;
+ KoColor selectColor(int x, int y) override;
+ bool containsPointInComponentCoords(int x, int y) const override;
private:
friend class Acs::PixelCacheRenderer;
KoColor colorAt(int x, int y) const;
private:
int triangleWidth() const;
int triangleHeight() const;
void updatePixelCache();
QPoint widgetToTriangleCoordinates(const QPoint& point) const;
QPoint triangleToWidgetCoordinates(const QPoint& point) const;
private:
QImage m_renderedPixelCache;
KisPaintDeviceSP m_realPixelCache;
QSize m_cachedSize;
QPointF m_lastClickPos;
};
#endif // KIS_COLOR_SELECTOR_TRIANGLE_H
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_wheel.h b/plugins/dockers/advancedcolorselector/kis_color_selector_wheel.h
index 176db8b6c8..9eff86aa09 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_wheel.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_wheel.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef KIS_COLOR_SELECTOR_WHEEL_H
#define KIS_COLOR_SELECTOR_WHEEL_H
typedef unsigned int QRgb;
#include <QColor>
#include <QImage>
#include "KoColor.h"
#include "kis_color_selector_component.h"
namespace Acs {
class PixelCacheRenderer;
}
class KisColorSelectorWheel : public KisColorSelectorComponent
{
Q_OBJECT
public:
explicit KisColorSelectorWheel(KisColorSelector *parent);
- void setColor(const KoColor &color);
+ void setColor(const KoColor &color) override;
protected:
- KoColor selectColor(int x, int y);
- void paint(QPainter*);
+ KoColor selectColor(int x, int y) override;
+ void paint(QPainter*) override;
private:
friend class Acs::PixelCacheRenderer;
KoColor colorAt(int x, int y, bool forceValid = false);
private:
QPointF m_lastClickPos;
QImage m_pixelCache;
QPoint m_pixelCacheOffset;
qreal R;
qreal G;
qreal B;
qreal Gamma;
};
#endif // KIS_COLOR_SELECTOR_WHEEL_H
diff --git a/plugins/dockers/advancedcolorselector/kis_common_colors.h b/plugins/dockers/advancedcolorselector/kis_common_colors.h
index 9c4033ffd3..47470af25e 100644
--- a/plugins/dockers/advancedcolorselector/kis_common_colors.h
+++ b/plugins/dockers/advancedcolorselector/kis_common_colors.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COMMON_COLORS_H
#define KIS_COMMON_COLORS_H
#include <QMutex>
#include <QTimer>
#include "kis_color_patches.h"
#include <kis_types.h>
class QPushButton;
class KisCommonColors : public KisColorPatches
{
Q_OBJECT
public:
explicit KisCommonColors(QWidget *parent = 0);
- void setCanvas(KisCanvas2 *canvas);
- void unsetCanvas() {}
- KisColorSelectorBase* createPopup() const;
+ void setCanvas(KisCanvas2 *canvas) override;
+ void unsetCanvas() override {}
+ KisColorSelectorBase* createPopup() const override;
public Q_SLOTS:
void setColors(QList<KoColor> colors);
- void updateSettings();
+ void updateSettings() override;
void recalculate();
private:
QMutex m_mutex;
QTimer m_recalculationTimer;
QPushButton* m_reloadButton;
QList<KoColor> m_calculatedColors;
KisImageWSP m_image;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_common_colors_recalculation_runner.h b/plugins/dockers/advancedcolorselector/kis_common_colors_recalculation_runner.h
index 52938c58bc..d31885db4a 100644
--- a/plugins/dockers/advancedcolorselector/kis_common_colors_recalculation_runner.h
+++ b/plugins/dockers/advancedcolorselector/kis_common_colors_recalculation_runner.h
@@ -1,31 +1,31 @@
#ifndef KIS_COMMON_COLORS_RECALCULATION_RUNNER_H
#define KIS_COMMON_COLORS_RECALCULATION_RUNNER_H
#include <QRunnable>
#include <QColor>
#include <QImage>
class KoColor;
class KisCommonColors;
class KisCommonColorsRecalculationRunner : public QRunnable
{
public:
KisCommonColorsRecalculationRunner(QImage data, int numberOfColors, KisCommonColors* parentObj)
: m_imageData(data)
, m_numColors(numberOfColors)
, m_commonColors(parentObj)
{}
- void run();
+ void run() override;
QList<KoColor> extractColors();
QList<QRgb> getColors();
private:
QImage m_imageData;
int m_numColors;
KisCommonColors* m_commonColors;
};
#endif // KIS_COMMON_COLORS_RECALCULATION_RUNNER_H
diff --git a/plugins/dockers/advancedcolorselector/kis_minimal_shade_selector.h b/plugins/dockers/advancedcolorselector/kis_minimal_shade_selector.h
index 2b317c4bc3..0b86c095e2 100644
--- a/plugins/dockers/advancedcolorselector/kis_minimal_shade_selector.h
+++ b/plugins/dockers/advancedcolorselector/kis_minimal_shade_selector.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MINIMAL_SHADE_SELECTOR_H
#define KIS_MINIMAL_SHADE_SELECTOR_H
#include <QPointer>
#include <kis_canvas2.h>
#include "kis_color_selector_base.h"
class KisShadeSelectorLine;
class KisCanvas2;
class KisColorSelectorBaseProxy;
class KisMinimalShadeSelector : public KisColorSelectorBase
{
Q_OBJECT
public:
explicit KisMinimalShadeSelector(QWidget *parent = 0);
- ~KisMinimalShadeSelector();
- void unsetCanvas();
- void setCanvas(KisCanvas2* canvas);
+ ~KisMinimalShadeSelector() override;
+ void unsetCanvas() override;
+ void setCanvas(KisCanvas2* canvas) override;
protected:
- void setColor(const KoColor& color);
- void mouseMoveEvent(QMouseEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
+ void setColor(const KoColor& color) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
public Q_SLOTS:
- void updateSettings();
+ void updateSettings() override;
protected Q_SLOTS:
- void canvasResourceChanged(int key, const QVariant& v);
+ void canvasResourceChanged(int key, const QVariant& v) override;
protected:
- void paintEvent(QPaintEvent *);
- virtual KisColorSelectorBase* createPopup() const;
+ void paintEvent(QPaintEvent *) override;
+ KisColorSelectorBase* createPopup() const override;
private:
QList<KisShadeSelectorLine*> m_shadingLines;
KoColor m_lastRealColor;
QPointer<KisCanvas2> m_canvas;
QScopedPointer<KisColorSelectorBaseProxy> m_proxy;
};
#endif
diff --git a/plugins/dockers/advancedcolorselector/kis_my_paint_shade_selector.h b/plugins/dockers/advancedcolorselector/kis_my_paint_shade_selector.h
index ebb5b90666..f0e5bab939 100644
--- a/plugins/dockers/advancedcolorselector/kis_my_paint_shade_selector.h
+++ b/plugins/dockers/advancedcolorselector/kis_my_paint_shade_selector.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
* Copyright (c) 2008 Martin Renold <martinxyz@gmx.ch>
* Copyright (c) 2009 Ilya Portnov <nomail>
*
* This class is based on "lib/colorchanger.hpp" from MyPaint (mypaint.intilinux.com)
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MY_PAINT_SHADE_SELECTOR_H
#define KIS_MY_PAINT_SHADE_SELECTOR_H
#include "kis_color_selector_base.h"
#include <QColor>
#include <QImage>
#include <KoColor.h>
class KoColorSpace;
class QTimer;
class KisMyPaintShadeSelector : public KisColorSelectorBase
{
Q_OBJECT
public:
KisMyPaintShadeSelector(QWidget *parent = 0);
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
public:
- void setColor(const KoColor &color);
+ void setColor(const KoColor &color) override;
protected Q_SLOTS:
- void canvasResourceChanged(int key, const QVariant& v);
+ void canvasResourceChanged(int key, const QVariant& v) override;
protected:
- void paintEvent(QPaintEvent *);
- KisColorSelectorBase* createPopup() const;
+ void paintEvent(QPaintEvent *) override;
+ KisColorSelectorBase* createPopup() const override;
private:
qreal m_colorH, m_colorS, m_colorV;
qreal R, G, B;
QTimer* m_updateTimer;
KoColor m_lastRealColor;
KisPaintDeviceSP m_realPixelCache;
KisPaintDeviceSP m_realCircleBorder;
const KoColorSpace *m_cachedColorSpace;
};
#endif // KIS_MY_PAINT_SHADE_SELECTOR_H
diff --git a/plugins/dockers/advancedcolorselector/kis_shade_selector_line.h b/plugins/dockers/advancedcolorselector/kis_shade_selector_line.h
index 913b545ea6..2ac5ec8c7a 100644
--- a/plugins/dockers/advancedcolorselector/kis_shade_selector_line.h
+++ b/plugins/dockers/advancedcolorselector/kis_shade_selector_line.h
@@ -1,96 +1,96 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHADE_SELECTOR_LINE_H
#define KIS_SHADE_SELECTOR_LINE_H
#include <QWidget>
#include <KoColor.h>
#include "kis_types.h"
class KisCanvas2;
class KisShadeSelectorLineComboBox;
class KisColorSelectorBaseProxy;
class KoColorSpace;
class KisShadeSelectorLineBase : public QWidget {
public:
KisShadeSelectorLineBase(QWidget* parent) : QWidget(parent)
{}
void setLineNumber(int n) {m_lineNumber=n;}
virtual QString toString() const = 0;
virtual void fromString(const QString& string) = 0;
protected:
int m_lineNumber;
};
class KisShadeSelectorLine : public KisShadeSelectorLineBase
{
Q_OBJECT
public:
explicit KisShadeSelectorLine(KisColorSelectorBaseProxy *parentProxy,
QWidget *parent = 0);
explicit KisShadeSelectorLine(qreal hueDelta, qreal satDelta, qreal valDelta,
KisColorSelectorBaseProxy *parentProxy, QWidget *parent = 0, qreal hueShift = 0, qreal satShift = 0, qreal valShift = 0);
- ~KisShadeSelectorLine();
+ ~KisShadeSelectorLine() override;
void setParam(qreal hue, qreal sat, qreal val, qreal hueShift, qreal satShift, qreal shiftVal);
void setColor(const KoColor& color);
void updateSettings();
void setCanvas(KisCanvas2* canvas);
void showHelpText() {m_displayHelpText=true;}
- QString toString() const;
- void fromString(const QString& string);
-
- void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
+ QString toString() const override;
+ void fromString(const QString& string) override;
+
+ void paintEvent(QPaintEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
private:
qreal m_hueDelta;
qreal m_saturationDelta;
qreal m_valueDelta;
qreal m_hueShift;
qreal m_saturationShift;
qreal m_valueShift;
KoColor m_realColor;
KisPaintDeviceSP m_realPixelCache;
const KoColorSpace *m_cachedColorSpace;
bool m_gradient;
int m_patchCount;
int m_lineHeight;
bool m_displayHelpText;
qreal m_mouseX;
QPoint m_ev;
qreal m_width;
bool m_isDown;
friend class KisShadeSelectorLineComboBox;
KisColorSelectorBaseProxy* m_parentProxy;
};
#endif // KIS_SHADE_SELECTOR_LINE_H
diff --git a/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box.h b/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box.h
index 5430006d00..72e069a631 100644
--- a/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box.h
+++ b/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SHADE_SELECTOR_LINE_COMBO_BOX_H
#define KIS_SHADE_SELECTOR_LINE_COMBO_BOX_H
#include <QComboBox>
class KisShadeSelectorLineComboBoxPopup;
class KisShadeSelectorLine;
class KisColorSelectorBaseProxy;
class KisShadeSelectorLineComboBox : public QComboBox
{
Q_OBJECT
public:
explicit KisShadeSelectorLineComboBox(QWidget *parent = 0);
- ~KisShadeSelectorLineComboBox();
- void hidePopup();
- void showPopup();
+ ~KisShadeSelectorLineComboBox() override;
+ void hidePopup() override;
+ void showPopup() override;
QString configuration() const;
void setLineNumber(int n);
protected:
- void resizeEvent(QResizeEvent *e);
+ void resizeEvent(QResizeEvent *e) override;
public Q_SLOTS:
void setConfiguration(const QString& stri);
void updateSettings();
void setGradient(bool);
void setPatches(bool);
void setPatchCount(int count);
void setLineHeight(int height);
private:
KisShadeSelectorLineComboBoxPopup* m_popup;
QScopedPointer<KisColorSelectorBaseProxy> m_parentProxy;
KisShadeSelectorLine* m_currentLine;
};
#endif // KIS_SHADE_SELECTOR_LINE_COMBO_BOX_H
diff --git a/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box_popup.h b/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box_popup.h
index 483a2cb3b1..6d2c64a173 100644
--- a/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box_popup.h
+++ b/plugins/dockers/advancedcolorselector/kis_shade_selector_line_combo_box_popup.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SHADE_SELECTOR_LINE_COMBO_BOX_POPUP_H
#define __KIS_SHADE_SELECTOR_LINE_COMBO_BOX_POPUP_H
#include <QWidget>
class KisShadeSelectorLineBase;
class KisShadeSelectorLineEditor;
class KisColorSelectorBaseProxy;
class KisShadeSelectorLineComboBoxPopup : public QWidget {
Q_OBJECT
public:
- ~KisShadeSelectorLineComboBoxPopup();
+ ~KisShadeSelectorLineComboBoxPopup() override;
const int spacing;
KisShadeSelectorLineComboBoxPopup(QWidget* parent);
void setConfiguration(const QString &string);
private Q_SLOTS:
void activateItem(QWidget *widget);
private:
- void paintEvent(QPaintEvent *);
- void mouseMoveEvent(QMouseEvent * e);
- void mousePressEvent(QMouseEvent* e);
+ void paintEvent(QPaintEvent *) override;
+ void mouseMoveEvent(QMouseEvent * e) override;
+ void mousePressEvent(QMouseEvent* e) override;
void updateSelectedArea(const QRect &newRect);
void updateHighlightedArea(const QRect &newRect);
private:
KisShadeSelectorLineBase *m_lastHighlightedItem;
KisShadeSelectorLineBase *m_lastSelectedItem;
KisShadeSelectorLineEditor *m_lineEditor;
QRect m_highlightedArea;
QRect m_selectedArea;
QScopedPointer<KisColorSelectorBaseProxy> m_parentProxy;
};
#endif /* __KIS_SHADE_SELECTOR_LINE_COMBO_BOX_POPUP_H */
diff --git a/plugins/dockers/advancedcolorselector/kis_shade_selector_line_editor.h b/plugins/dockers/advancedcolorselector/kis_shade_selector_line_editor.h
index 53bdd91a57..cf4febcf6e 100644
--- a/plugins/dockers/advancedcolorselector/kis_shade_selector_line_editor.h
+++ b/plugins/dockers/advancedcolorselector/kis_shade_selector_line_editor.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2010 Adam Celarek <kdedev at xibo dot at>
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SHADE_SELECTOR_LINE_EDITOR_H
#define __KIS_SHADE_SELECTOR_LINE_EDITOR_H
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QDoubleSpinBox>
#include <QLabel>
#include <klocalizedstring.h>
#include "kis_shade_selector_line.h"
class KisDoubleParseSpinBox;
class KisShadeSelectorLineEditor : public KisShadeSelectorLineBase {
Q_OBJECT
public:
KisShadeSelectorLineEditor(QWidget* parent);
- QString toString() const;
- void fromString(const QString &string);
+ QString toString() const override;
+ void fromString(const QString &string) override;
private Q_SLOTS:
void valueChanged();
Q_SIGNALS:
void requestActivateLine(QWidget *widget);
private:
KisDoubleParseSpinBox* m_hueDelta;
KisDoubleParseSpinBox* m_saturationDelta;
KisDoubleParseSpinBox* m_valueDelta;
KisDoubleParseSpinBox* m_hueShift;
KisDoubleParseSpinBox* m_saturationShift;
KisDoubleParseSpinBox* m_valueShift;
};
#endif /* __KIS_SHADE_SELECTOR_LINE_EDITOR_H */
diff --git a/plugins/dockers/animation/animation_docker.h b/plugins/dockers/animation/animation_docker.h
index a5a4608ae1..2f0c375238 100644
--- a/plugins/dockers/animation/animation_docker.h
+++ b/plugins/dockers/animation/animation_docker.h
@@ -1,121 +1,121 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ANIMATION_DOCKER_H_
#define _ANIMATION_DOCKER_H_
#include "kritaimage_export.h"
#include <QDockWidget>
#include <QPointer>
#include <kis_mainwindow_observer.h>
#include <kis_action.h>
#include <kis_canvas2.h>
class Ui_WdgAnimation;
class KisMainWindow;
class AnimationDocker : public QDockWidget, public KisMainwindowObserver {
Q_OBJECT
public:
AnimationDocker();
- ~AnimationDocker();
- QString observerName() { return "AnimationDocker"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
- void setMainWindow(KisViewManager *kisview);
+ ~AnimationDocker() override;
+ QString observerName() override { return "AnimationDocker"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ void setMainWindow(KisViewManager *kisview) override;
private Q_SLOTS:
void slotPreviousFrame();
void slotNextFrame();
void slotPreviousKeyFrame();
void slotNextKeyFrame();
void slotFirstFrame();
void slotLastFrame();
void slotPlayPause();
void slotAddBlankFrame();
void slotAddDuplicateFrame();
void slotDeleteKeyframe();
void slotAddOpacityKeyframe();
void slotDeleteOpacityKeyframe();
void slotAddTransformKeyframe();
void slotDeleteTransformKeyframe();
void slotUIRangeChanged();
void slotUIFramerateChanged();
void slotUpdateIcons();
void slotOnionSkinOptions();
void slotGlobalTimeChanged();
void slotTimeSpinBoxChanged();
void updatePlayPauseIcon();
void updateLazyFrameIcon();
void updateDropFramesIcon();
void slotLazyFrameChanged(bool value);
void slotDropFramesChanged(bool value);
void slotCurrentNodeChanged(KisNodeSP node);
private:
QPointer<KisCanvas2> m_canvas;
Ui_WdgAnimation *m_animationWidget;
KisAction *m_previousFrameAction;
KisAction *m_nextFrameAction;
KisAction *m_previousKeyFrameAction;
KisAction *m_nextKeyFrameAction;
KisAction *m_firstFrameAction;
KisAction *m_lastFrameAction;
KisAction *m_playPauseAction;
KisAction *m_addBlankFrameAction;
KisAction *m_addDuplicateFrameAction;
KisAction *m_deleteKeyframeAction;
KisAction *m_lazyFrameAction;
KisAction *m_dropFramesAction;
QMenu *m_newKeyframeMenu;
KisAction *m_addOpacityKeyframeAction;
KisAction *m_addTransformKeyframeAction;
QMenu *m_deleteKeyframeMenu;
KisAction *m_deleteOpacityKeyframeAction;
KisAction *m_deleteTransformKeyframeAction;
KisMainWindow *m_mainWindow;
void addKeyframe(const QString &channel, bool copy);
void deleteKeyframe(const QString &channel);
};
#endif
diff --git a/plugins/dockers/animation/animation_dockers.h b/plugins/dockers/animation/animation_dockers.h
index 3fb0370478..6d3e3e1624 100644
--- a/plugins/dockers/animation/animation_dockers.h
+++ b/plugins/dockers/animation/animation_dockers.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ANIMATION_DOCKERS_H_
#define _ANIMATION_DOCKERS_H_
#include <QObject>
#include <QVariantList>
class KisViewManager;
class AnimationDockersPlugin : public QObject
{
Q_OBJECT
public:
AnimationDockersPlugin(QObject *parent, const QVariantList &);
- virtual ~AnimationDockersPlugin();
+ ~AnimationDockersPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curve_channel_list_delegate.h b/plugins/dockers/animation/kis_animation_curve_channel_list_delegate.h
index d87679470d..3c312c98ce 100644
--- a/plugins/dockers/animation/kis_animation_curve_channel_list_delegate.h
+++ b/plugins/dockers/animation/kis_animation_curve_channel_list_delegate.h
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVE_CHANNEL_LIST_DELEGATE_H
#define _KIS_ANIMATION_CURVE_CHANNEL_LIST_DELEGATE_H
#include <qstyleditemdelegate.h>
class KisAnimationCurveChannelListDelegate : public QStyledItemDelegate
{
public:
KisAnimationCurveChannelListDelegate(QObject *parent);
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
- bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curve_channel_list_model.h b/plugins/dockers/animation/kis_animation_curve_channel_list_model.h
index eb0509ab5b..8e1b31af24 100644
--- a/plugins/dockers/animation/kis_animation_curve_channel_list_model.h
+++ b/plugins/dockers/animation/kis_animation_curve_channel_list_model.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVE_CHANNEL_LIST_MODEL_H
#define _KIS_ANIMATION_CURVE_CHANNEL_LIST_MODEL_H
#include <QAbstractItemModel>
#include "kis_types.h"
class KisAnimationCurvesModel;
class KisDummiesFacadeBase;
class KisKeyframeChannel;
class KisAnimationCurveChannelListModel : public QAbstractItemModel
{
Q_OBJECT
public:
KisAnimationCurveChannelListModel(KisAnimationCurvesModel *curvesModel, QObject *parent);
- ~KisAnimationCurveChannelListModel();
+ ~KisAnimationCurveChannelListModel() override;
void setDummiesFacade(KisDummiesFacadeBase *facade);
- QModelIndex index(int row, int column, const QModelIndex &parent) const;
- QModelIndex parent(const QModelIndex &child) const;
- int rowCount(const QModelIndex &parent) const;
- int columnCount(const QModelIndex &parent) const;
- QVariant data(const QModelIndex &index, int role) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
+ QModelIndex index(int row, int column, const QModelIndex &parent) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
enum ItemDataRole
{
CurveColorRole = Qt::UserRole,
CurveVisibleRole
};
public Q_SLOTS:
void selectedNodesChanged(const KisNodeList &nodes);
void clear();
void keyframeChannelAddedToNode(KisKeyframeChannel *channel);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curve_docker.h b/plugins/dockers/animation/kis_animation_curve_docker.h
index f380e7c086..b176bb2e0a 100644
--- a/plugins/dockers/animation/kis_animation_curve_docker.h
+++ b/plugins/dockers/animation/kis_animation_curve_docker.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVE_DOCKER_H_
#define _KIS_ANIMATION_CURVE_DOCKER_H_
#include <QDockWidget>
#include <kis_mainwindow_observer.h>
#include <QScopedPointer>
class KisCanvas2;
class KisAction;
class KisAnimationCurveDocker : public QDockWidget, public KisMainwindowObserver
{
Q_OBJECT
public:
KisAnimationCurveDocker();
- ~KisAnimationCurveDocker();
+ ~KisAnimationCurveDocker() override;
- QString observerName() { return "AnimationCurveDocker"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
- void setMainWindow(KisViewManager *kisview);
+ QString observerName() override { return "AnimationCurveDocker"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ void setMainWindow(KisViewManager *kisview) override;
private Q_SLOTS:
void slotUpdateIcons();
void slotListRowsInserted(const QModelIndex &parentIndex, int first, int last);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curves_keyframe_delegate.h b/plugins/dockers/animation/kis_animation_curves_keyframe_delegate.h
index 1dcf80ed1e..2182b480fa 100644
--- a/plugins/dockers/animation/kis_animation_curves_keyframe_delegate.h
+++ b/plugins/dockers/animation/kis_animation_curves_keyframe_delegate.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVES_KEYFRAME_DELEGATE_H
#define _KIS_ANIMATION_CURVES_KEYFRAME_DELEGATE_H
#include <qabstractitemdelegate.h>
#include "timeline_ruler_header.h"
#include "kis_animation_curves_value_ruler.h"
class KisAnimationCurvesKeyframeDelegate : public QAbstractItemDelegate
{
Q_OBJECT
public:
KisAnimationCurvesKeyframeDelegate(const TimelineRulerHeader *horizontalRuler, const KisAnimationCurvesValueRuler *verticalRuler, QObject *parent);
- ~KisAnimationCurvesKeyframeDelegate();
+ ~KisAnimationCurvesKeyframeDelegate() override;
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QPointF nodeCenter(const QModelIndex index, bool selected) const;
bool hasHandle(const QModelIndex index, int handle) const;
QPointF leftHandle(const QModelIndex index, bool active) const;
QPointF rightHandle(const QModelIndex index, bool active) const;
void setSelectedItemVisualOffset(QPointF offset);
void setHandleAdjustment(QPointF offset, int handle);
QPointF unscaledTangent(QPointF handlePosition) const;
QRect itemRect(const QModelIndex index) const;
QRect visualRect(const QModelIndex index) const;
private:
struct Private;
const QScopedPointer<Private> m_d;
void paintHandle(QPainter *painter, QPointF nodePos, QPointF tangent) const;
QPointF handlePosition(const QModelIndex index, bool active, int handle) const;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curves_model.h b/plugins/dockers/animation/kis_animation_curves_model.h
index c8299e1ba0..919dcb5fda 100644
--- a/plugins/dockers/animation/kis_animation_curves_model.h
+++ b/plugins/dockers/animation/kis_animation_curves_model.h
@@ -1,98 +1,98 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVES_MODEL_H
#define _KIS_ANIMATION_CURVES_MODEL_H
#include <QScopedPointer>
#include <QIcon>
#include <QAbstractItemModel>
#include "kis_time_based_item_model.h"
#include "kis_types.h"
#include "kundo2command.h"
class KisScalarKeyframeChannel;
class KisAnimationCurve {
public:
KisAnimationCurve(KisScalarKeyframeChannel *channel, QColor color);
KisScalarKeyframeChannel *channel() const;
QColor color() const;
void setVisible(bool visible);
bool visible() const;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
class KisAnimationCurvesModel : public KisTimeBasedItemModel
{
Q_OBJECT
public:
KisAnimationCurvesModel(QObject *parent);
- ~KisAnimationCurvesModel();
+ ~KisAnimationCurvesModel() override;
bool hasConnectionToCanvas() const;
KisAnimationCurve *addCurve(KisScalarKeyframeChannel *channel);
void removeCurve(KisAnimationCurve *curve);
void setCurveVisible(KisAnimationCurve *curve, bool visible);
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
/**
* Begins a block of commands. The following calls to setData will be grouped to a single undo step.
* Note: MUST be followed by a call to endCommand().
*/
void beginCommand(const KUndo2MagicString &text);
void endCommand();
bool adjustKeyframes(const QModelIndexList &indexes, int timeOffset, qreal valueOffset);
enum ItemDataRole
{
ScalarValueRole = KisTimeBasedItemModel::UserRole + 101,
InterpolationModeRole,
TangentsModeRole,
LeftTangentRole,
RightTangentRole,
CurveColorRole,
CurveVisibleRole,
PreviousKeyframeTime,
NextKeyframeTime
};
protected:
- KisNodeSP nodeAt(QModelIndex index) const;
- QList<KisKeyframeChannel *> channelsAt(QModelIndex index) const;
+ KisNodeSP nodeAt(QModelIndex index) const override;
+ QList<KisKeyframeChannel *> channelsAt(QModelIndex index) const override;
private Q_SLOTS:
void slotKeyframeChanged(KisKeyframeSP keyframe);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curves_value_ruler.h b/plugins/dockers/animation/kis_animation_curves_value_ruler.h
index ddd45409e1..e79901bece 100644
--- a/plugins/dockers/animation/kis_animation_curves_value_ruler.h
+++ b/plugins/dockers/animation/kis_animation_curves_value_ruler.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVES_VALUE_RULER_H
#define _KIS_ANIMATION_CURVES_VALUE_RULER_H
#include <QHeaderView>
class KisAnimationCurvesValueRuler : public QHeaderView
{
Q_OBJECT
public:
KisAnimationCurvesValueRuler(QWidget *parent);
- ~KisAnimationCurvesValueRuler();
+ ~KisAnimationCurvesValueRuler() override;
void setScale(float scale);
float scaleFactor() const;
void setOffset(float offset);
float offset() const;
float mapValueToView(float value) const;
float mapViewToValue(float y) const;
- QSize sizeHint() const;
- void paintEvent(QPaintEvent *e);
+ QSize sizeHint() const override;
+ void paintEvent(QPaintEvent *e) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/dockers/animation/kis_animation_curves_view.h b/plugins/dockers/animation/kis_animation_curves_view.h
index b748aebfc2..df3be1da56 100644
--- a/plugins/dockers/animation/kis_animation_curves_view.h
+++ b/plugins/dockers/animation/kis_animation_curves_view.h
@@ -1,97 +1,97 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ANIMATION_CURVES_VIEW_H
#define _KIS_ANIMATION_CURVES_VIEW_H
#include <QScopedPointer>
#include <QTableView>
class KisAction;
class KisZoomButton;
class KisAnimationCurvesView : public QAbstractItemView
{
Q_OBJECT
public:
KisAnimationCurvesView(QWidget *parent);
- ~KisAnimationCurvesView();
+ ~KisAnimationCurvesView() override;
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) override;
void setZoomButtons(KisZoomButton *horizontal, KisZoomButton *vertical);
- QRect visualRect(const QModelIndex &index) const;
- void scrollTo(const QModelIndex &index, ScrollHint hint);
- QModelIndex indexAt(const QPoint &point) const;
+ QRect visualRect(const QModelIndex &index) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint) override;
+ QModelIndex indexAt(const QPoint &point) const override;
protected:
- void paintEvent(QPaintEvent *);
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
- int horizontalOffset() const;
- int verticalOffset() const;
- bool isIndexHidden(const QModelIndex &index) const;
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command);
- QRegion visualRegionForSelection(const QItemSelection &selection) const;
- void scrollContentsBy(int dx, int dy);
-
- void mousePressEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *);
- void mouseReleaseEvent(QMouseEvent *);
+ void paintEvent(QPaintEvent *) override;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
+ bool isIndexHidden(const QModelIndex &index) const override;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
+ void scrollContentsBy(int dx, int dy) override;
+
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
public Q_SLOTS:
void applyConstantMode();
void applyLinearMode();
void applyBezierMode();
void applySmoothMode();
void applySharpMode();
void createKeyframe();
void removeKeyframes();
void zoomToFit();
protected Q_SLOTS:
- void updateGeometries();
+ void updateGeometries() override;
private Q_SLOTS:
void slotRowsChanged(const QModelIndex &parentIndex, int first, int last);
void slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void slotHeaderDataChanged(Qt::Orientation orientation, int first, int last);
void slotHorizontalZoomStarted(qreal staticPoint);
void slotVerticalZoomStarted(qreal staticPoint);
void slotHorizontalZoomLevelChanged(qreal level);
void slotVerticalZoomLevelChanged(qreal level);
private:
struct Private;
const QScopedPointer<Private> m_d;
void paintCurves(QPainter &painter, int firstFrame, int lastFrame);
void paintCurve(int channel, int firstFrame, int lastFrame, QPainter &painter);
void paintCurveSegment(QPainter &painter, QPointF pos1, QPointF rightTangent, QPointF leftTangent, QPointF pos2);
void paintKeyframes(QPainter &painter, int firstFrame, int lastFrame);
QModelIndex findNextKeyframeIndex(int channel, int time, int selectionOffset, bool backward);
void findExtremes(qreal *minimum, qreal *maximum);
void updateVerticalRange();
void startPan(QPoint mousePos);
};
#endif
diff --git a/plugins/dockers/animation/kis_custom_modifiers_catcher.h b/plugins/dockers/animation/kis_custom_modifiers_catcher.h
index 03e3538eca..1094afb1ac 100644
--- a/plugins/dockers/animation/kis_custom_modifiers_catcher.h
+++ b/plugins/dockers/animation/kis_custom_modifiers_catcher.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CUSTOM_MODIFIERS_CATCHER_H
#define __KIS_CUSTOM_MODIFIERS_CATCHER_H
#include <QScopedPointer>
#include <QObject>
/**
* @brief The KisCustomModifiersCatcher class is a special utility class that
* tracks custom modifiers pressed. Its main purpose is to avoid manual tracking
* of KeyPress/KeyRelease/FocusIn events in the class and reuse the common code in
* multiple widgets.
*
* ~~~~~~~~~~~~~~~~~~~~{.cpp}
* // in the c-tor of your widget create the catcher, it will automatically
* // connect to the passed parent
* KisCustomModifiersCatcher *catcher = new KisCustomModifiersCatcher(parent);
*
* // Register a tracked modifier
* catcher->addModifier("pan-zoom", Qt::Key_Space);
*
* // in the pointer tracking event handlers just check
* // if the modifier is pressed or not
* bool isPressed = catcher->modifierPressed("pan-zoom");
* ~~~~~~~~~~~~~~~~~~~~
*/
class KisCustomModifiersCatcher : public QObject
{
public:
/**
* Create the catcher and connect to the passed widget/object to
* track its key events
*/
KisCustomModifiersCatcher(QObject *parent);
- ~KisCustomModifiersCatcher();
+ ~KisCustomModifiersCatcher() override;
- bool eventFilter(QObject* object, QEvent* event);
+ bool eventFilter(QObject* object, QEvent* event) override;
/**
* @brief addModifier registers a custom modifier
* @param id a unique id string associated with the modifier. Later, you will use this string to fetch the modifier state.
* @param modifier the key to track
*/
void addModifier(const QString &id, Qt::Key modifier);
/**
* @brief modifierPressed returns the state of the tracked modifier
*/
bool modifierPressed(const QString &id);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_CUSTOM_MODIFIERS_CATCHER_H */
diff --git a/plugins/dockers/animation/kis_draggable_tool_button.h b/plugins/dockers/animation/kis_draggable_tool_button.h
index afe317fa9c..631cd48258 100644
--- a/plugins/dockers/animation/kis_draggable_tool_button.h
+++ b/plugins/dockers/animation/kis_draggable_tool_button.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DRAGGABLE_TOOL_BUTTON_H
#define __KIS_DRAGGABLE_TOOL_BUTTON_H
#include <QToolButton>
class KisDraggableToolButton : public QToolButton
{
Q_OBJECT
public:
KisDraggableToolButton(QWidget *parent);
- ~KisDraggableToolButton();
+ ~KisDraggableToolButton() override;
- void mousePressEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
static int unitRadius();
void beginDrag(const QPoint &pos);
int continueDrag(const QPoint &pos);
Q_SIGNALS:
void valueChanged(int value);
private:
Qt::Orientation m_orientation;
QPoint m_startPoint;
};
#endif /* __KIS_DRAGGABLE_TOOL_BUTTON_H */
diff --git a/plugins/dockers/animation/kis_equalizer_button.h b/plugins/dockers/animation/kis_equalizer_button.h
index 7519d2b514..360503e5e2 100644
--- a/plugins/dockers/animation/kis_equalizer_button.h
+++ b/plugins/dockers/animation/kis_equalizer_button.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_EQUALIZER_BUTTON_H
#define __KIS_EQUALIZER_BUTTON_H
#include <QScopedPointer>
#include <QAbstractButton>
class KisEqualizerButton : public QAbstractButton
{
public:
KisEqualizerButton(QWidget *parent);
- ~KisEqualizerButton();
+ ~KisEqualizerButton() override;
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
void setRightmost(bool value);
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
- void enterEvent(QEvent *event);
- void leaveEvent(QEvent *event);
+ void enterEvent(QEvent *event) override;
+ void leaveEvent(QEvent *event) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_EQUALIZER_BUTTON_H */
diff --git a/plugins/dockers/animation/kis_equalizer_column.h b/plugins/dockers/animation/kis_equalizer_column.h
index 6758bd4d63..33af35186e 100644
--- a/plugins/dockers/animation/kis_equalizer_column.h
+++ b/plugins/dockers/animation/kis_equalizer_column.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_EQUALIZER_COLUMN_H
#define __KIS_EQUALIZER_COLUMN_H
#include <QWidget>
#include <QScopedPointer>
#include <QSlider>
#include "kritaanimationdocker_export.h"
class KRITAANIMATIONDOCKER_EXPORT KisEqualizerColumn : public QWidget
{
Q_OBJECT
public:
KisEqualizerColumn(QWidget *parent, int id, const QString &title);
- ~KisEqualizerColumn();
+ ~KisEqualizerColumn() override;
void setRightmost(bool value);
int value() const;
void setValue(int value);
bool state() const;
void setState(bool value);
void setForceDisabled(bool value);
Q_SIGNALS:
void sigColumnChanged(int id, bool state, int value);
private Q_SLOTS:
void slotSliderChanged(int value);
void slotButtonChanged(bool value);
private:
struct Private;
const QScopedPointer<Private> m_d;
void updateState();
};
#endif /* __KIS_EQUALIZER_COLUMN_H */
diff --git a/plugins/dockers/animation/kis_equalizer_slider.h b/plugins/dockers/animation/kis_equalizer_slider.h
index 75da2be223..7d2e31a6cf 100644
--- a/plugins/dockers/animation/kis_equalizer_slider.h
+++ b/plugins/dockers/animation/kis_equalizer_slider.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_EQUALIZER_SLIDER_H
#define __KIS_EQUALIZER_SLIDER_H
#include <QScopedPointer>
#include <QAbstractSlider>
#include "kritaanimationdocker_export.h"
class KRITAANIMATIONDOCKER_EXPORT KisEqualizerSlider : public QAbstractSlider
{
public:
KisEqualizerSlider(QWidget *parent);
- ~KisEqualizerSlider();
+ ~KisEqualizerSlider() override;
- void mousePressEvent(QMouseEvent *ev);
- void mouseMoveEvent(QMouseEvent *ev);
- void mouseReleaseEvent(QMouseEvent *ev);
- void paintEvent(QPaintEvent *event);
+ void mousePressEvent(QMouseEvent *ev) override;
+ void mouseMoveEvent(QMouseEvent *ev) override;
+ void mouseReleaseEvent(QMouseEvent *ev) override;
+ void paintEvent(QPaintEvent *event) override;
- QSize sizeHint() const;
- QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void setRightmost(bool value);
void setToggleState(bool value);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_EQUALIZER_SLIDER_H */
diff --git a/plugins/dockers/animation/kis_equalizer_widget.h b/plugins/dockers/animation/kis_equalizer_widget.h
index fc1acc681e..611a6c1d9e 100644
--- a/plugins/dockers/animation/kis_equalizer_widget.h
+++ b/plugins/dockers/animation/kis_equalizer_widget.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_EQUALIZER_WIDGET_H
#define __KIS_EQUALIZER_WIDGET_H
#include <QScopedPointer>
#include <QWidget>
#include <QMap>
#include "kritaanimationdocker_export.h"
class KRITAANIMATIONDOCKER_EXPORT KisEqualizerWidget : public QWidget
{
Q_OBJECT
public:
KisEqualizerWidget(int maxDistance, QWidget *parent);
- ~KisEqualizerWidget();
+ ~KisEqualizerWidget() override;
struct EqualizerValues {
int maxDistance;
QMap<int, int> value;
QMap<int, bool> state;
};
EqualizerValues getValues() const;
void setValues(const EqualizerValues &values);
void toggleMasterSwitch();
- void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
- void mouseMoveEvent(QMouseEvent *ev);
+ void mouseMoveEvent(QMouseEvent *ev) override;
Q_SIGNALS:
void sigConfigChanged();
private Q_SLOTS:
void slotMasterColumnChanged(int, bool, int);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_EQUALIZER_WIDGET_H */
diff --git a/plugins/dockers/animation/kis_time_based_item_model.h b/plugins/dockers/animation/kis_time_based_item_model.h
index 458b6aa6b6..72cb3382b8 100644
--- a/plugins/dockers/animation/kis_time_based_item_model.h
+++ b/plugins/dockers/animation/kis_time_based_item_model.h
@@ -1,98 +1,98 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TIME_BASED_ITEM_MODEL_H
#define _KIS_TIME_BASED_ITEM_MODEL_H
#include <QAbstractTableModel>
#include <QList>
#include "kritaanimationdocker_export.h"
#include "kis_types.h"
class KisTimeRange;
class KisAnimationPlayer;
class KisKeyframeChannel;
class KRITAANIMATIONDOCKER_EXPORT KisTimeBasedItemModel : public QAbstractTableModel
{
Q_OBJECT
public:
KisTimeBasedItemModel(QObject *parent);
- ~KisTimeBasedItemModel();
+ ~KisTimeBasedItemModel() override;
void setImage(KisImageWSP image);
void setFrameCache(KisAnimationFrameCacheSP cache);
void setAnimationPlayer(KisAnimationPlayer *player);
void setLastVisibleFrame(int time);
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
- virtual QVariant data(const QModelIndex &index, int role) const;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role);
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override;
bool removeFrames(const QModelIndexList &indexes);
bool offsetFrames(QModelIndexList srcIndexes, const QPoint &offset, bool copyFrames);
void setScrubState(bool active);
void scrubTo(int time, bool preview);
void setPlaybackRange(const KisTimeRange &range);
bool isPlaybackActive() const;
int currentTime() const;
enum ItemDataRole
{
ActiveFrameRole = Qt::UserRole + 101,
FrameExistsRole,
SpecialKeyframeExists,
FrameCachedRole,
FrameEditableRole,
FramesPerSecondRole,
UserRole
};
protected:
virtual KisNodeSP nodeAt(QModelIndex index) const = 0;
virtual QList<KisKeyframeChannel*> channelsAt(QModelIndex index) const = 0;
KisImageWSP image() const;
KUndo2Command* createOffsetFramesCommand(QModelIndexList srcIndexes, const QPoint &offset, bool copyFrames, KUndo2Command *parentCommand = 0);
private Q_SLOTS:
void slotFramerateChanged();
void slotCurrentTimeChanged(int time);
void slotCacheChanged();
void slotInternalScrubPreviewRequested(int time);
void slotPlaybackFrameChanged();
void slotPlaybackStopped();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/dockers/animation/kis_zoom_button.h b/plugins/dockers/animation/kis_zoom_button.h
index 20695ab645..34aab3339c 100644
--- a/plugins/dockers/animation/kis_zoom_button.h
+++ b/plugins/dockers/animation/kis_zoom_button.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ZOOM_BUTTON_H
#define _KIS_ZOOM_BUTTON_H
#include "kis_draggable_tool_button.h"
class KisZoomButton : public KisDraggableToolButton
{
Q_OBJECT
public:
KisZoomButton(QWidget *parent);
- ~KisZoomButton();
+ ~KisZoomButton() override;
qreal zoomLevel() const;
void setZoomLevel(qreal level);
void beginZoom(QPoint mousePos, qreal staticPoint);
void continueZoom(QPoint mousePos);
- void mousePressEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e) override;
Q_SIGNALS:
void zoomStarted(qreal staticPoint);
void zoomLevelChanged(qreal level);
private Q_SLOTS:
void slotValueChanged(int value);
private:
qreal m_zoomLevel;
qreal m_initialDragZoomLevel;
};
#endif
diff --git a/plugins/dockers/animation/onion_skins_docker.h b/plugins/dockers/animation/onion_skins_docker.h
index 756396b0d5..4cdda5b2f2 100644
--- a/plugins/dockers/animation/onion_skins_docker.h
+++ b/plugins/dockers/animation/onion_skins_docker.h
@@ -1,66 +1,66 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef ONION_SKINS_DOCKER_H
#define ONION_SKINS_DOCKER_H
#include <QDockWidget>
#include <kis_mainwindow_observer.h>
#include "kis_signal_compressor.h"
class KisAction;
namespace Ui {
class OnionSkinsDocker;
}
class KisEqualizerWidget;
class OnionSkinsDocker : public QDockWidget, public KisMainwindowObserver
{
Q_OBJECT
public:
explicit OnionSkinsDocker(QWidget *parent = 0);
- ~OnionSkinsDocker();
+ ~OnionSkinsDocker() override;
- QString observerName() { return "OnionSkinsDocker"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
- void setMainWindow(KisViewManager *kisview);
+ QString observerName() override { return "OnionSkinsDocker"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ void setMainWindow(KisViewManager *kisview) override;
private:
Ui::OnionSkinsDocker *ui;
KisSignalCompressor m_updatesCompressor;
KisEqualizerWidget *m_equalizerWidget;
KisAction *m_toggleOnionSkinsAction;
private:
void loadSettings();
private Q_SLOTS:
void changed();
void slotShowAdditionalSettings(bool value);
void slotUpdateIcons();
void slotToggleOnionSkins();
void slotFilteredColorsChanged();
};
#endif // ONION_SKINS_DOCKER_H
diff --git a/plugins/dockers/animation/timeline_docker.h b/plugins/dockers/animation/timeline_docker.h
index c74daa4503..d234866d9b 100644
--- a/plugins/dockers/animation/timeline_docker.h
+++ b/plugins/dockers/animation/timeline_docker.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _TIMELINE_DOCKER_H_
#define _TIMELINE_DOCKER_H_
#include "kritaimage_export.h"
#include <QDockWidget>
#include <kis_mainwindow_observer.h>
#include <QScopedPointer>
class KisCanvas2;
class KisAction;
class TimelineDocker : public QDockWidget, public KisMainwindowObserver
{
Q_OBJECT
public:
TimelineDocker();
- ~TimelineDocker();
+ ~TimelineDocker() override;
- QString observerName() { return "TimelineDocker"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
- void setMainWindow(KisViewManager *kisview);
+ QString observerName() override { return "TimelineDocker"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ void setMainWindow(KisViewManager *kisview) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/dockers/animation/timeline_frames_item_delegate.h b/plugins/dockers/animation/timeline_frames_item_delegate.h
index 9da6f4285a..8dcdc6483f 100644
--- a/plugins/dockers/animation/timeline_frames_item_delegate.h
+++ b/plugins/dockers/animation/timeline_frames_item_delegate.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TIMELINE_FRAMES_ITEM_DELEGATE_H
#define __TIMELINE_FRAMES_ITEM_DELEGATE_H
#include <QItemDelegate>
class TimelineFramesItemDelegate : public QItemDelegate
{
public:
TimelineFramesItemDelegate(QObject *parent);
- ~TimelineFramesItemDelegate();
+ ~TimelineFramesItemDelegate() override;
static void paintActiveFrameSelector(QPainter *painter, const QRect &rc, bool isCurrentFrame);
static void paintSpecialKeyframeIndicator(QPainter *painter, const QModelIndex &index, const QRect &rc);
void drawBackground(QPainter *painter, const QModelIndex &index, const QRect &rc) const;
void drawFocus(QPainter *painter,
const QStyleOptionViewItem &option,
- const QRect &rect) const;
+ const QRect &rect) const override;
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
QVector<QColor> labelColors;
};
#endif /* __TIMELINE_FRAMES_ITEM_DELEGATE_H */
diff --git a/plugins/dockers/animation/timeline_frames_model.h b/plugins/dockers/animation/timeline_frames_model.h
index 1d8435b987..1c39151c3c 100644
--- a/plugins/dockers/animation/timeline_frames_model.h
+++ b/plugins/dockers/animation/timeline_frames_model.h
@@ -1,132 +1,132 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TIMELINE_FRAMES_MODEL_H
#define __TIMELINE_FRAMES_MODEL_H
#include <QScopedPointer>
#include <QIcon>
#include "kritaanimationdocker_export.h"
#include "kis_node_model.h"
#include "kis_types.h"
#include "kis_node.h"
#include "timeline_node_list_keeper.h"
class KisNodeDummy;
class KisDummiesFacadeBase;
class KisAnimationPlayer;
class KRITAANIMATIONDOCKER_EXPORT TimelineFramesModel : public TimelineNodeListKeeper::ModelWithExternalNotifications
{
Q_OBJECT
public:
TimelineFramesModel(QObject *parent);
- ~TimelineFramesModel();
+ ~TimelineFramesModel() override;
bool hasConnectionToCanvas() const;
void setDummiesFacade(KisDummiesFacadeBase *dummiesFacade, KisImageSP image);
bool canDropFrameData(const QMimeData *data, const QModelIndex &index);
bool insertOtherLayer(int index, int dstRow);
int activeLayerRow() const;
bool createFrame(const QModelIndex &dstIndex);
bool copyFrame(const QModelIndex &dstIndex);
QString audioChannelFileName() const;
void setAudioChannelFileName(const QString &fileName);
bool isAudioMuted() const;
void setAudioMuted(bool value);
qreal audioVolume() const;
void setAudioVolume(qreal value);
void setLastClickedIndex(const QModelIndex &index);
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role) const;
- bool setData(const QModelIndex &index, const QVariant &value, int role);
- QVariant headerData(int section, Qt::Orientation orientation, int role) const;
- bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role);
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override;
- Qt::DropActions supportedDragActions() const;
- Qt::DropActions supportedDropActions() const;
- QStringList mimeTypes() const;
- QMimeData * mimeData(const QModelIndexList &indexes) const;
- bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
- Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::DropActions supportedDragActions() const override;
+ Qt::DropActions supportedDropActions() const override;
+ QStringList mimeTypes() const override;
+ QMimeData * mimeData(const QModelIndexList &indexes) const override;
+ bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- bool insertRows(int row, int count, const QModelIndex &parent);
- bool removeRows(int row, int count, const QModelIndex &parent);
+ bool insertRows(int row, int count, const QModelIndex &parent) override;
+ bool removeRows(int row, int count, const QModelIndex &parent) override;
enum ItemDataRole
{
ActiveLayerRole = KisTimeBasedItemModel::UserRole,
TimelinePropertiesRole,
OtherLayersRole,
LayerUsedInTimelineRole,
FrameColorLabelIndexRole
};
// metatype is added by the original implementation
typedef KisBaseNode::Property Property;
typedef KisBaseNode::PropertyList PropertyList;
typedef TimelineNodeListKeeper::OtherLayer OtherLayer;
typedef TimelineNodeListKeeper::OtherLayersList OtherLayersList;
struct NodeManipulationInterface {
virtual ~NodeManipulationInterface() {}
virtual KisLayerSP addPaintLayer() const = 0;
virtual void removeNode(KisNodeSP node) const = 0;
};
/**
* NOTE: the model has an ownership over the interface, that is it'll
* be deleted automatically later
*/
void setNodeManipulationInterface(NodeManipulationInterface *iface);
protected:
- KisNodeSP nodeAt(QModelIndex index) const;
- QList<KisKeyframeChannel*> channelsAt(QModelIndex index) const;
+ KisNodeSP nodeAt(QModelIndex index) const override;
+ QList<KisKeyframeChannel*> channelsAt(QModelIndex index) const override;
private Q_SLOTS:
void slotDummyChanged(KisNodeDummy *dummy);
void processUpdateQueue();
public Q_SLOTS:
void slotCurrentNodeChanged(KisNodeSP node);
Q_SIGNALS:
void requestCurrentNodeChanged(KisNodeSP node);
void sigInfiniteTimelineUpdateNeeded();
void sigAudioChannelChanged();
void sigEnsureRowVisible(int row);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __TIMELINE_FRAMES_MODEL_H */
diff --git a/plugins/dockers/animation/timeline_frames_view.h b/plugins/dockers/animation/timeline_frames_view.h
index 7ada9ac895..46006d19c7 100644
--- a/plugins/dockers/animation/timeline_frames_view.h
+++ b/plugins/dockers/animation/timeline_frames_view.h
@@ -1,109 +1,109 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TIMELINE_FRAMES_VIEW_H
#define __TIMELINE_FRAMES_VIEW_H
#include <QScopedPointer>
#include <QTableView>
#include "kritaanimationdocker_export.h"
class KisAction;
class TimelineWidget;
class KRITAANIMATIONDOCKER_EXPORT TimelineFramesView : public QTableView
{
Q_OBJECT
public:
TimelineFramesView(QWidget *parent);
- ~TimelineFramesView();
+ ~TimelineFramesView() override;
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) override;
- void updateGeometries();
+ void updateGeometries() override;
QMap<QString, KisAction*> globalActions() const;
public Q_SLOTS:
void slotSelectionChanged();
private Q_SLOTS:
void slotUpdateLayersMenu();
void slotAddNewLayer();
void slotAddExistingLayer(QAction *action);
void slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void slotRemoveLayer();
void slotHideLayerFromTimeline();
void slotLayerContextMenuRequested(const QPoint &globalPos);
void slotNewFrame();
void slotCopyFrame();
void slotRemoveFrame();
void slotReselectCurrentIndex();
void slotUpdateInfiniteFramesCount();
void slotHeaderDataChanged(Qt::Orientation orientation, int first, int last);
void slotZoomButtonPressed(qreal staticPoint);
void slotZoomButtonChanged(qreal value);
void slotColorLabelChanged(int);
void slotEnsureRowVisible(int row);
void slotSelectAudioChannelFile();
void slotAudioChannelMute(bool value);
void slotAudioChannelRemove();
void slotUpdateAudioActions();
void slotAudioVolumeChanged(int value);
private:
void setFramesPerSecond(int fps);
void updateShowInTimeline();
protected:
QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index,
- const QEvent *event) const;
-
- void currentChanged(const QModelIndex &current, const QModelIndex &previous);
- void startDrag(Qt::DropActions supportedActions);
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
- void wheelEvent(QWheelEvent *e);
- void rowsInserted(const QModelIndex& parent, int start, int end);
- bool viewportEvent(QEvent *event);
+ const QEvent *event) const override;
+
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
+ void startDrag(Qt::DropActions supportedActions) override;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void wheelEvent(QWheelEvent *e) override;
+ void rowsInserted(const QModelIndex& parent, int start, int end) override;
+ bool viewportEvent(QEvent *event) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __TIMELINE_FRAMES_VIEW_H */
diff --git a/plugins/dockers/animation/timeline_layers_header.h b/plugins/dockers/animation/timeline_layers_header.h
index 89b22dad10..780c7b9287 100644
--- a/plugins/dockers/animation/timeline_layers_header.h
+++ b/plugins/dockers/animation/timeline_layers_header.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TIMELINE_LAYERS_HEADER_H
#define __TIMELINE_LAYERS_HEADER_H
#include <QHeaderView>
#include <QScopedPointer>
class TimelineLayersHeader : public QHeaderView
{
Q_OBJECT
public:
TimelineLayersHeader(QWidget *parent);
- ~TimelineLayersHeader();
+ ~TimelineLayersHeader() override;
protected:
- QSize sectionSizeFromContents(int logicalIndex) const;
- void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
- bool viewportEvent(QEvent *e);
- void mousePressEvent(QMouseEvent *e);
+ QSize sectionSizeFromContents(int logicalIndex) const override;
+ void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override;
+ bool viewportEvent(QEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
Q_SIGNALS:
void sigRequestContextMenu(const QPoint &pos);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __TIMELINE_LAYERS_HEADER_H */
diff --git a/plugins/dockers/animation/timeline_node_list_keeper.h b/plugins/dockers/animation/timeline_node_list_keeper.h
index 7c898b8970..0182aecefc 100644
--- a/plugins/dockers/animation/timeline_node_list_keeper.h
+++ b/plugins/dockers/animation/timeline_node_list_keeper.h
@@ -1,107 +1,107 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TIMELINE_NODE_LIST_KEEPER_H
#define __TIMELINE_NODE_LIST_KEEPER_H
#include <QObject>
#include <QList>
#include <QScopedPointer>
#include <QAbstractTableModel>
#include "kritaanimationdocker_export.h"
#include "kis_time_based_item_model.h"
class KisNodeDummy;
class KisDummiesFacadeBase;
class KRITAANIMATIONDOCKER_EXPORT TimelineNodeListKeeper : public QObject
{
Q_OBJECT
public:
struct ModelWithExternalNotifications;
struct OtherLayer;
typedef QList<OtherLayer> OtherLayersList;
TimelineNodeListKeeper(ModelWithExternalNotifications *model, KisDummiesFacadeBase *dummiesFacade);
- ~TimelineNodeListKeeper();
+ ~TimelineNodeListKeeper() override;
KisNodeDummy* dummyFromRow(int row);
int rowForDummy(KisNodeDummy *dummy);
int rowCount();
OtherLayersList otherLayersList() const;
void updateActiveDummy(KisNodeDummy *dummy);
private Q_SLOTS:
void slotEndInsertDummy(KisNodeDummy *dummy);
void slotBeginRemoveDummy(KisNodeDummy *dummy);
void slotDummyChanged(KisNodeDummy *dummy);
void slotUpdateDummyContent(QObject *dummy);
public:
struct ModelWithExternalNotifications : public KisTimeBasedItemModel {
ModelWithExternalNotifications(QObject *parent)
: KisTimeBasedItemModel(parent) {}
void callBeginInsertRows(const QModelIndex &parent, int first, int last) {
beginInsertRows(parent, first, last);
}
void callEndInsertRows() {
endInsertRows();
}
void callBeginRemoveRows(const QModelIndex &parent, int first, int last) {
beginRemoveRows(parent, first, last);
}
void callEndRemoveRows() {
endRemoveRows();
}
void callIndexChanged(const QModelIndex &index0, const QModelIndex &index1) {
emit dataChanged(index0, index1);
}
};
struct OtherLayer {
OtherLayer(const QString &_name, KisNodeDummy *_dummy)
: name(_name),
dummy(_dummy)
{
}
QString name;
KisNodeDummy *dummy;
};
private:
struct Private;
const QScopedPointer<Private> m_d;
};
Q_DECLARE_METATYPE( TimelineNodeListKeeper::OtherLayersList )
#endif /* __TIMELINE_NODE_LIST_KEEPER_H */
diff --git a/plugins/dockers/animation/timeline_ruler_header.h b/plugins/dockers/animation/timeline_ruler_header.h
index d29b6daa69..6b9a3be097 100644
--- a/plugins/dockers/animation/timeline_ruler_header.h
+++ b/plugins/dockers/animation/timeline_ruler_header.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TIMELINE_RULER_HEADER_H
#define TIMELINE_RULER_HEADER_H
#include <QHeaderView>
#include <QScopedPointer>
class QPaintEvent;
class TimelineRulerHeader : public QHeaderView
{
Q_OBJECT
public:
TimelineRulerHeader(QWidget *parent = 0);
- ~TimelineRulerHeader();
+ ~TimelineRulerHeader() override;
void setFramePerSecond(int fps);
bool setZoom(qreal zoomLevel);
- void setModel(QAbstractItemModel *model);
+ void setModel(QAbstractItemModel *model) override;
protected:
- void mousePressEvent(QMouseEvent *e);
- void mouseMoveEvent(QMouseEvent *e);
- void mouseReleaseEvent(QMouseEvent *e);
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
- void paintEvent(QPaintEvent *e);
- void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
+ void paintEvent(QPaintEvent *e) override;
+ void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override;
void paintSection1(QPainter *painter, const QRect &rect, int logicalIndex) const;
- void changeEvent(QEvent *event);
+ void changeEvent(QEvent *event) override;
private:
void updateMinimumSize();
void paintSpan(QPainter *painter, int userFrameId,
const QRect &spanRect,
bool isIntegralLine,
bool isPrevIntegralLine,
QStyle *style,
const QPalette &palette,
const QPen &gridPen) const;
private Q_SLOTS:
void slotInsertColumnLeft();
void slotInsertColumnRight();
void slotClearColumns(bool removeColumns = false);
void slotRemoveColumns();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // TIMELINE_RULER_HEADER_H
diff --git a/plugins/dockers/arrangedocker/arrange_docker_widget.h b/plugins/dockers/arrangedocker/arrange_docker_widget.h
index 96718f80ab..88ce957f74 100644
--- a/plugins/dockers/arrangedocker/arrange_docker_widget.h
+++ b/plugins/dockers/arrangedocker/arrange_docker_widget.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef ARRANGE_DOCKER_WIDGET_H
#define ARRANGE_DOCKER_WIDGET_H
#include <QWidget>
#include <QScopedPointer>
#include "kactioncollection.h"
namespace Ui {
class ArrangeDockerWidget;
}
class ArrangeDockerWidget : public QWidget
{
Q_OBJECT
public:
explicit ArrangeDockerWidget(QWidget *parent = 0);
- ~ArrangeDockerWidget();
+ ~ArrangeDockerWidget() override;
void setActionCollection(KActionCollection *collection);
private:
Ui::ArrangeDockerWidget *ui;
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // ARRANGE_DOCKER_WIDGET_H
diff --git a/plugins/dockers/arrangedocker/arrangedocker.h b/plugins/dockers/arrangedocker/arrangedocker.h
index cc9d110b26..3e1880a238 100644
--- a/plugins/dockers/arrangedocker/arrangedocker.h
+++ b/plugins/dockers/arrangedocker/arrangedocker.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ARRANGE_DOCKER_H_
#define _ARRANGE_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class ArrangeDockerPlugin : public QObject
{
Q_OBJECT
public:
ArrangeDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~ArrangeDockerPlugin();
+ ~ArrangeDockerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/arrangedocker/arrangedocker_dock.h b/plugins/dockers/arrangedocker/arrangedocker_dock.h
index c424f0a5f2..b8243d9330 100644
--- a/plugins/dockers/arrangedocker/arrangedocker_dock.h
+++ b/plugins/dockers/arrangedocker/arrangedocker_dock.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _GRID_DOCK_H_
#define _GRID_DOCK_H_
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
#include "kis_signal_auto_connection.h"
class KisCanvas2;
class ArrangeDockerWidget;
class KisSignalAutoConnection;
class ArrangeDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
ArrangeDockerDock();
- ~ArrangeDockerDock();
- QString observerName() { return "ArrangeDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ ~ArrangeDockerDock() override;
+ QString observerName() override { return "ArrangeDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private Q_SLOTS:
void slotToolChanged();
private:
ArrangeDockerWidget *m_configWidget;
QPointer<KisCanvas2> m_canvas;
KisSignalAutoConnectionsStore m_canvasConnections;
};
#endif
diff --git a/plugins/dockers/artisticcolorselector/artisticcolorselector_dock.h b/plugins/dockers/artisticcolorselector/artisticcolorselector_dock.h
index a99a0f73c2..712791eda5 100644
--- a/plugins/dockers/artisticcolorselector/artisticcolorselector_dock.h
+++ b/plugins/dockers/artisticcolorselector/artisticcolorselector_dock.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef H_ARTISTIC_COLOR_SELECTOR_DOCK_H
#define H_ARTISTIC_COLOR_SELECTOR_DOCK_H
#include <QDockWidget>
#include <kis_mainwindow_observer.h>
class KisCanvasResourceProvider;
class KisColor;
class QButtonGroup;
class QMenu;
struct ArtisticColorSelectorUI;
struct ColorPreferencesPopupUI;
class ArtisticColorSelectorDock: public QDockWidget, public KisMainwindowObserver
{
Q_OBJECT
public:
ArtisticColorSelectorDock();
- ~ArtisticColorSelectorDock();
- QString observerName() { return "ArtisticColorSelectorDock"; }
- virtual void setMainWindow(KisViewManager* kisview);
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ ~ArtisticColorSelectorDock() override;
+ QString observerName() override { return "ArtisticColorSelectorDock"; }
+ void setMainWindow(KisViewManager* kisview) override;
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private Q_SLOTS:
void slotCanvasResourceChanged(int key, const QVariant& value);
void slotFgColorChanged(const KisColor& color);
void slotBgColorChanged(const KisColor& color);
void slotColorSpaceSelected(int type);
void slotPreferenceChanged();
void slotMenuActionTriggered(QAction* action);
void slotResetDefaultSettings();
void slotLightModeChanged(bool setToAbsolute);
private:
KisCanvasResourceProvider* m_resourceProvider;
QButtonGroup* m_hsxButtons;
QMenu* m_resetMenu;
ArtisticColorSelectorUI* m_selectorUI;
ColorPreferencesPopupUI* m_preferencesUI;
};
#endif // H_ARTISTIC_COLOR_SELECTOR_DOCK_H
diff --git a/plugins/dockers/artisticcolorselector/kis_color_selector.h b/plugins/dockers/artisticcolorselector/kis_color_selector.h
index f7d8b7506a..78c9476353 100644
--- a/plugins/dockers/artisticcolorselector/kis_color_selector.h
+++ b/plugins/dockers/artisticcolorselector/kis_color_selector.h
@@ -1,155 +1,155 @@
/*
Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef H_KIS_COLOR_SELECTOR_H
#define H_KIS_COLOR_SELECTOR_H
#include <QWidget>
#include <QVector>
#include <QImage>
#include <QPainterPath>
#include "kis_color.h"
#include "kis_radian.h"
#include "kis_acs_types.h"
#include "kis_signal_compressor_with_param.h"
class QPainter;
class QPainter;
class KisColorSelector: public QWidget
{
Q_OBJECT
typedef KisRadian<float> Radian;
struct ColorRing
{
ColorRing(): angle(0) { }
Radian getPieceAngle() const { return RAD_360 / float(pieced.size()); }
Radian getShift () const { return angle % getPieceAngle(); }
Radian getMovedAngel() const { return angle - tmpAngle; }
void setTemporaries(const KisColor& color) {
tmpAngle = angle;
tmpColor = color;
}
KisColor tmpColor;
Radian tmpAngle;
Radian angle;
float saturation;
float outerRadius;
float innerRadius;
QVector<QPainterPath> pieced;
};
public:
KisColorSelector(QWidget* parent, KisColor::Type type=KisColor::HSL);
void setColorSpace(KisColor::Type type);
void setNumPieces(int num);
void setNumLightPieces(int num);
void setNumRings(int num);
void resetRings();
void resetSelectedRing();
void resetLight();
void setLight(float light=0.0f, bool relative=true);
void setInverseSaturation(bool inverse);
void selectColor(const KisColor& color);
void setFgColor(const KisColor& fgColor);
void setBgColor(const KisColor& bgColor);
void saveSettings();
void loadSettings();
KisColor::Type getColorSpace () const { return m_colorSpace; }
qint32 getNumRings () const { return m_colorRings.size(); }
qint32 getNumPieces () const { return m_numPieces; }
qint32 getNumLightPieces () const { return m_numLightPieces; }
qreal getLight () const { return m_light; }
bool isSaturationInverted() const { return m_inverseSaturation; }
bool islightRelative () const { return m_relativeLight; }
Q_SIGNALS:
void sigFgColorChanged(const KisColor& color);
void sigBgColorChanged(const KisColor& color);
private:
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseMoveEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
- virtual void resizeEvent(QResizeEvent* event);
- virtual void paintEvent(QPaintEvent* event);
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseMoveEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
+ void resizeEvent(QResizeEvent* event) override;
+ void paintEvent(QPaintEvent* event) override;
void requestUpdateColorAndPreview(const KisColor &color, Acs::ColorRole role);
void recalculateAreas(quint8 numLightPieces);
void recalculateRings(quint8 numRings, quint8 numPieces);
void createRing(ColorRing& wheel, quint8 numPieces, qreal innerRadius, qreal outerRadius);
void drawRing(QPainter& painter, ColorRing& wheel, const QRect& rect);
void drawOutline(QPainter& painter, const QRect& rect);
void drawLightStrip(QPainter& painter, const QRect& rect);
qint8 getHueIndex(Radian hue, Radian shift=0.0f) const;
qreal getHue(int hueIdx, Radian shift=0.0f) const;
qint8 getLightIndex(const QPointF& pt) const;
qint8 getLightIndex(qreal light) const;
qreal getLight(qreal light, qreal hue, bool relative) const;
qreal getLight(const QPointF& pt) const;
qint8 getSaturationIndex(const QPointF& pt) const;
qint8 getSaturationIndex(qreal saturation) const;
qreal getSaturation(int saturationIdx) const;
QPointF mapCoord(const QPointF& pt, const QRectF& rect) const;
public:
// This is a private interface for signal compressor, don't use it.
// Use requestUpdateColorAndPreview() instead
void slotUpdateColorAndPreview(QPair<KisColor, Acs::ColorRole> color);
private:
KisColor::Type m_colorSpace;
quint8 m_numPieces;
quint8 m_numLightPieces;
bool m_inverseSaturation;
bool m_relativeLight;
float m_light;
qint8 m_selectedRing;
qint8 m_selectedPiece;
qint8 m_selectedLightPiece;
KisColor m_selectedColor;
KisColor m_fgColor;
KisColor m_bgColor;
QImage m_renderBuffer;
QRect m_renderArea;
QRect m_lightStripArea;
bool m_mouseMoved;
Acs::ColorRole m_selectedColorRole;
QPointF m_clickPos;
qint8 m_clickedRing;
QVector<ColorRing> m_colorRings;
Qt::MouseButtons m_pressedButtons;
typedef KisSignalCompressorWithParam<QPair<KisColor, Acs::ColorRole>> ColorCompressorType;
QScopedPointer<ColorCompressorType> m_updateColorCompressor;
};
#endif // H_KIS_COLOR_SELECTOR_H
diff --git a/plugins/dockers/channeldocker/channeldocker.h b/plugins/dockers/channeldocker/channeldocker.h
index baee16caa2..bf374e8302 100644
--- a/plugins/dockers/channeldocker/channeldocker.h
+++ b/plugins/dockers/channeldocker/channeldocker.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CHANNELDOCKER_H
#define CHANNELDOCKER_H
#include <QObject>
#include <QVariant>
/**
* Docker showing the channels of the current layer
*/
class ChannelDockerPlugin : public QObject
{
Q_OBJECT
public:
ChannelDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~ChannelDockerPlugin();
+ ~ChannelDockerPlugin() override;
};
#endif
diff --git a/plugins/dockers/channeldocker/channeldocker_dock.h b/plugins/dockers/channeldocker/channeldocker_dock.h
index 7a2543e94c..c2022c1820 100644
--- a/plugins/dockers/channeldocker/channeldocker_dock.h
+++ b/plugins/dockers/channeldocker/channeldocker_dock.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CHANNELDOCKER_DOCK_H
#define CHANNELDOCKER_DOCK_H
#include <QPointer>
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
#include <kis_canvas2.h>
class ChannelModel;
class QTableView;
class KisSignalCompressor;
class KisIdleWatcher;
class ChannelDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
ChannelDockerDock();
- QString observerName() { return "ChannelDockerDock"; }
- void setCanvas(KoCanvasBase *canvas);
- void unsetCanvas();
- void showEvent(QShowEvent *event);
+ QString observerName() override { return "ChannelDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ void showEvent(QShowEvent *event) override;
public Q_SLOTS:
void startUpdateCanvasProjection();
private Q_SLOTS:
void updateChannelTable(void);
private:
KisIdleWatcher* m_imageIdleWatcher;
KisSignalCompressor *m_compressor;
QPointer<KisCanvas2> m_canvas;
QTableView *m_channelTable;
ChannelModel *m_model;
};
#endif
diff --git a/plugins/dockers/channeldocker/channelmodel.h b/plugins/dockers/channeldocker/channelmodel.h
index ac9f1f6159..a05b73c068 100644
--- a/plugins/dockers/channeldocker/channelmodel.h
+++ b/plugins/dockers/channeldocker/channelmodel.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CHANNELMODEL_H
#define CHANNELMODEL_H
#include <QModelIndex>
#include <QSize>
#include <QPointer>
#include <kis_canvas2.h>
#include <kis_types.h>
class KoColorSpace;
class ChannelModel : public QAbstractTableModel
{
Q_OBJECT
public:
ChannelModel(QObject* parent = 0);
- virtual ~ChannelModel();
+ ~ChannelModel() override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- int rowCount(const QModelIndex& parent = QModelIndex()) const;
- int columnCount(const QModelIndex& parent = QModelIndex()) const;
- bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
- Qt::ItemFlags flags(const QModelIndex& index) const;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
void unsetCanvas( void );
//set maximum size of the thumbnail image. This should be set based on screen resolution, etc.
void setThumbnailSizeLimit(QSize size);
public Q_SLOTS:
void slotSetCanvas(KisCanvas2* canvas);
void slotColorSpaceChanged(const KoColorSpace *colorSpace);
void updateData(KisCanvas2 *canvas);
void rowActivated(const QModelIndex &index);
Q_SIGNALS:
void channelFlagsChanged();
private:
void updateThumbnails();
private:
QPointer<KisCanvas2> m_canvas;
QVector<QImage> m_thumbnails;
QSize m_thumbnailSizeLimit;
int m_oversampleRatio;
int m_channelCount;
};
#endif // CHANNELMODEL_H
diff --git a/plugins/dockers/colorslider/kis_color_slider.h b/plugins/dockers/colorslider/kis_color_slider.h
index 8e7c55b268..ff2ecfe3bf 100644
--- a/plugins/dockers/colorslider/kis_color_slider.h
+++ b/plugins/dockers/colorslider/kis_color_slider.h
@@ -1,40 +1,40 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Wolthera van Hövell <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _COLORSLIDER_H_
#define _COLORSLIDER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class ColorSliderPlugin : public QObject
{
Q_OBJECT
public:
ColorSliderPlugin(QObject *parent, const QVariantList &);
- virtual ~ColorSliderPlugin();
+ ~ColorSliderPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/colorslider/kis_color_slider_dock.h b/plugins/dockers/colorslider/kis_color_slider_dock.h
index 4e80411f72..4bc1f3fbe0 100644
--- a/plugins/dockers/colorslider/kis_color_slider_dock.h
+++ b/plugins/dockers/colorslider/kis_color_slider_dock.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Wolthera van Hövell <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _COLORSLIDER_DOCK_H_
#define _COLORSLIDER_DOCK_H_
#include <QDockWidget>
#include <QPointer>
#include <KoCanvasObserverBase.h>
#include "kis_signal_auto_connection.h"
#include <kis_types.h>
#include <kis_canvas2.h>
class KisViewManager;
class KisColorSliderWidget;
class ColorSliderDock : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
ColorSliderDock();
- QString observerName() { return "ColorSliderDock"; }
+ QString observerName() override { return "ColorSliderDock"; }
/// reimplemented from KoCanvasObserverBase
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
public Q_SLOTS:
void udpateSliders();
private:
QPointer<KisCanvas2> m_canvas;
KisViewManager *m_view;
KisColorSliderWidget* m_colorSliders;
KisSignalAutoConnectionsStore m_canvasConnections;
};
#endif
diff --git a/plugins/dockers/colorslider/kis_color_slider_input.h b/plugins/dockers/colorslider/kis_color_slider_input.h
index b9da0d3add..dfd8f26e7d 100644
--- a/plugins/dockers/colorslider/kis_color_slider_input.h
+++ b/plugins/dockers/colorslider/kis_color_slider_input.h
@@ -1,92 +1,92 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Wolthera van Hövell <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_SLIDER_INPUT_H_
#define _KIS_COLOR_SLIDER_INPUT_H_
#include <QWidget>
#include <QPointer>
#include "KoColorDisplayRendererInterface.h"
#include "kis_canvas2.h"
class KoColor;
class QWidget;
class QDoubleSpinBox;
class KisDoubleParseSpinBox;
class KisHSVSlider;
class KisDisplayColorConverter;
class KisColorSliderInput : public QWidget
{
Q_OBJECT
public:
KisColorSliderInput(QWidget* parent, KoColor* color, const int type, KoColorDisplayRendererInterface *displayRenderer, KisCanvas2* canvas);
protected:
void init();
virtual QWidget* createInput() = 0;
Q_SIGNALS:
void updated();
protected:
const int m_type;
KoColor* m_color;
KoColorDisplayRendererInterface *m_displayRenderer;
QPointer<KisCanvas2> m_canvas;
KisHSVSlider* m_hsvSlider;
};
class KisHSXColorSliderInput : public KisColorSliderInput
{
Q_OBJECT
public:
KisHSXColorSliderInput(QWidget* parent, const int type, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, KisCanvas2* canvas);
KisDisplayColorConverter* converter() const;
protected:
- virtual QWidget* createInput();
+ QWidget* createInput() override;
QPointer<KisCanvas2> m_canvas;
public Q_SLOTS:
void setValue(double);
void update();
void hueUpdate(int h);
void satUpdate(int s, int type);
void toneUpdate(int l, int type);
void sliderChanged(int i);
void sliderIn();
void sliderOut();
void numInputChanged(double v);
Q_SIGNALS:
void hueUpdated(int);
void satUpdated(int, int);
void toneUpdated(int, int);
private:
KisDoubleParseSpinBox* m_NumInput;
qreal m_hue;
qreal m_sat;
qreal m_val;
qreal R, G, B, Gamma;
bool m_hueupdating;
bool m_satupdating;
bool m_toneupdating;
bool m_sliderisupdating;
};
#endif
diff --git a/plugins/dockers/colorslider/kis_color_slider_widget.h b/plugins/dockers/colorslider/kis_color_slider_widget.h
index c3e39490d2..89fa226a93 100644
--- a/plugins/dockers/colorslider/kis_color_slider_widget.h
+++ b/plugins/dockers/colorslider/kis_color_slider_widget.h
@@ -1,87 +1,87 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Wolthera van Hövell <griffinvalley@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_SLIDER_WIDGET_H_
#define _KIS_COLOR_SLIDER_WIDGET_H_
#include <QWidget>
#include <QPointer>
#include <KoColor.h>
#include "kis_canvas2.h"
class KoColorSpace;
class KoColorDisplayRendererInterface;
class QVBoxLayout;
class KisColorSliderInput;
class KisSignalCompressor;
class QBitArray;
class KisColorSliderWidget : public QWidget
{
Q_OBJECT
public:
KisColorSliderWidget(KoColorDisplayRendererInterface *displayRenderer, QWidget* parent, KisCanvas2* canvas, QBitArray SlidersConfigArray);
- ~KisColorSliderWidget();
+ ~KisColorSliderWidget() override;
//bool customColorSpaceUsed();
public Q_SLOTS:
//void setColorSpace(const KoColorSpace*);
void setColor(const KoColor&);
void slotConfigChanged();
private Q_SLOTS:
void update();
void updateTimeout();
void hueUpdate(int h);
void satUpdate(int s, int type);
void toneUpdate(int l, int type);
void setSlidersVisible(QBitArray SlidersConfigArray);
void setConfig();
//void setCustomColorSpace(const KoColorSpace *);
Q_SIGNALS:
void colorChanged(const KoColor&);
void updated();
void hueUpdated(int);
void satUpdated(int, int);
void toneUpdated(int, int);
private:
QList<KisColorSliderInput*> m_inputs;
// const KoColorSpace* m_colorSpace;
QVBoxLayout *m_layout;
KoColor m_color;
bool m_updateAllowed;
KisSignalCompressor *m_updateCompressor;
KisSignalCompressor *m_configCompressor;
KoColorDisplayRendererInterface *m_displayRenderer;
QPointer<KisCanvas2> m_canvas;
KisColorSliderInput* hsvH;
KisColorSliderInput* hsvS;
KisColorSliderInput* hsvV;
KisColorSliderInput* hslH;
KisColorSliderInput* hslS;
KisColorSliderInput* hslL;
KisColorSliderInput* hsiH;
KisColorSliderInput* hsiS;
KisColorSliderInput* hsiI;
KisColorSliderInput* hsyH;
KisColorSliderInput* hsyS;
KisColorSliderInput* hsyY;
};
#endif
diff --git a/plugins/dockers/colorslider/kis_hsv_slider.h b/plugins/dockers/colorslider/kis_hsv_slider.h
index daf4ed620d..e447c52271 100644
--- a/plugins/dockers/colorslider/kis_hsv_slider.h
+++ b/plugins/dockers/colorslider/kis_hsv_slider.h
@@ -1,62 +1,62 @@
/* This file is part of the KDE project
Copyright (C) 2006 Sven Langkamp <sven.langkamp@gmail.com>
Copyright (C) 2014 Wolthera van Hövell <griffinvalley@gmail.com>
Copyright (c) 2015 Moritz Molch <kde@moritzmolch.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HSVSLIDER_H
#define KIS_HSVSLIDER_H
#include <QPointer>
#include <kselector.h>
#include "KoColorDisplayRendererInterface.h"
#include "kis_canvas2.h"
class KoColor;
class KisDisplayColorConverter;
class KisHSVSlider : public KSelector
{
Q_OBJECT
public:
explicit KisHSVSlider(QWidget *parent = 0, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
explicit KisHSVSlider(Qt::Orientation orientation, QWidget *parent = 0, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), KisCanvas2* canvas = 0);
- virtual ~KisHSVSlider();
+ ~KisHSVSlider() override;
public:
void setColors( const KoColor& currentcolor, const int type, qreal hue_backup, qreal l_R=0.2126, qreal l_G=0.7152, qreal l_B=0.0722, qreal gamma=2.2);
/**
* Return the current color
*/
KoColor currentColor() const;
KoColor HSXcolor(int type, qreal t) const;
KisDisplayColorConverter* converter() const;
protected:
- virtual void drawContents( QPainter* );
- virtual void drawArrow(QPainter *painter, const QPoint &pos);
+ void drawContents( QPainter* ) override;
+ void drawArrow(QPainter *painter, const QPoint &pos) override;
struct Private;
Private* const d;
private:
qreal R, G, B, Gamma;
KoColorDisplayRendererInterface *m_displayRenderer;
QPointer<KisCanvas2> m_canvas;
};
#endif
diff --git a/plugins/dockers/compositiondocker/compositiondocker.h b/plugins/dockers/compositiondocker/compositiondocker.h
index 90f99c584b..d715d38316 100644
--- a/plugins/dockers/compositiondocker/compositiondocker.h
+++ b/plugins/dockers/compositiondocker/compositiondocker.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COMPOSITIONDOCKER_H
#define COMPOSITIONDOCKER_H
#include <QObject>
#include <QVariant>
/**
* Docker compositions of the image
*/
class CompositionDockerPlugin : public QObject
{
Q_OBJECT
public:
CompositionDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~CompositionDockerPlugin();
+ ~CompositionDockerPlugin() override;
};
#endif
diff --git a/plugins/dockers/compositiondocker/compositiondocker_dock.h b/plugins/dockers/compositiondocker/compositiondocker_dock.h
index 161aa6185c..85c82589e2 100644
--- a/plugins/dockers/compositiondocker/compositiondocker_dock.h
+++ b/plugins/dockers/compositiondocker/compositiondocker_dock.h
@@ -1,66 +1,66 @@
/*
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COMPOSITIONDOCKER_DOCK_H
#define COMPOSITIONDOCKER_DOCK_H
#include <QDockWidget>
#include <QModelIndex>
#include <QPointer>
#include <KoCanvasObserverBase.h>
#include <kis_canvas2.h>
#include "ui_wdgcompositiondocker.h"
class CompositionModel;
class KisAction;
class CompositionDockerDock : public QDockWidget, public KoCanvasObserverBase, public Ui_WdgCompositionDocker {
Q_OBJECT
public:
CompositionDockerDock();
- ~CompositionDockerDock();
- QString observerName() { return "CompositionDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ ~CompositionDockerDock() override;
+ QString observerName() override { return "CompositionDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
void updateModel();
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
private Q_SLOTS:
void activated (const QModelIndex& index);
void deleteClicked();
void saveClicked();
void exportClicked();
void activateCurrentIndex();
void customContextMenuRequested(QPoint pos);
void updateComposition();
void renameComposition();
private:
QPointer<KisCanvas2> m_canvas;
CompositionModel *m_model;
QVector<KisAction*> m_actions;
};
#endif
diff --git a/plugins/dockers/compositiondocker/compositionmodel.h b/plugins/dockers/compositiondocker/compositionmodel.h
index 743675b926..637b6f8123 100644
--- a/plugins/dockers/compositiondocker/compositionmodel.h
+++ b/plugins/dockers/compositiondocker/compositionmodel.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COMPOSITIONMODEL_H
#define COMPOSITIONMODEL_H
#include <QModelIndex>
#include <kis_types.h>
#include <kis_layer_composition.h>
class CompositionModel : public QAbstractTableModel
{
Q_OBJECT
public:
CompositionModel(QObject* parent = 0);
- virtual ~CompositionModel();
+ ~CompositionModel() override;
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
- virtual bool setData ( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
- virtual Qt::ItemFlags flags(const QModelIndex& index) const;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ bool setData ( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ) override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
KisLayerCompositionSP compositionFromIndex(const QModelIndex& index);
void setCompositions(QList<KisLayerCompositionSP> compositions);
// public Q_SLOTS:
// void clear();
private:
QList<KisLayerCompositionSP> m_compositions;
};
#endif // TASKSETMODEL_H
diff --git a/plugins/dockers/defaultdockers/defaultdockers.h b/plugins/dockers/defaultdockers/defaultdockers.h
index fa11189cc6..0949692cce 100644
--- a/plugins/dockers/defaultdockers/defaultdockers.h
+++ b/plugins/dockers/defaultdockers/defaultdockers.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DEFAULT_DOCKERS_H
#define _DEFAULT_DOCKERS_H
#include <QObject>
#include <QVariant>
/**
* Template of view plugin
*/
class KritaDefaultDockersPlugin : public QObject
{
Q_OBJECT
public:
KritaDefaultDockersPlugin(QObject *parent, const QVariantList &);
- virtual ~KritaDefaultDockersPlugin();
+ ~KritaDefaultDockersPlugin() override;
};
#endif
diff --git a/plugins/dockers/defaultdockers/kis_layer_box.h b/plugins/dockers/defaultdockers/kis_layer_box.h
index be605cd20f..f13202bd8a 100644
--- a/plugins/dockers/defaultdockers/kis_layer_box.h
+++ b/plugins/dockers/defaultdockers/kis_layer_box.h
@@ -1,190 +1,190 @@
/*
* kis_layer_box.h - part of Krita aka Krayon aka KimageShop
*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (C) 2006 Gábor Lehel <illissius@gmail.com>
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2007-2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LAYERBOX_H
#define KIS_LAYERBOX_H
#include <QFrame>
#include <QList>
#include <QDockWidget>
#include <QPointer>
#include <QTimer>
#include <kis_debug.h>
#include <KoColorSpace.h>
#include <KoDockFactoryBase.h>
#include <kis_types.h>
#include "kis_action.h"
#include "KisViewManager.h"
#include "kis_mainwindow_observer.h"
#include "kis_signal_compressor.h"
class QModelIndex;
typedef QList<QModelIndex> QModelIndexList;
class QMenu;
class QAbstractButton;
class KoCompositeOp;
class KisCanvas2;
class KisNodeModel;
class KisNodeFilterProxyModel;
class Ui_WdgLayerBox;
class KisNodeJugglerCompressed;
class KisColorLabelSelectorWidget;
class QWidgetAction;
class KisKeyframeChannel;
/**
* A widget that shows a visualization of the layer structure.
*
* The center of the layer box is KisNodeModel, which shows the actual layers.
* This widget adds docking functionality and command buttons.
*
*/
class KisLayerBox : public QDockWidget, public KisMainwindowObserver
{
Q_OBJECT
public:
KisLayerBox();
- virtual ~KisLayerBox();
- QString observerName() { return "KisLayerBox"; }
+ ~KisLayerBox() override;
+ QString observerName() override { return "KisLayerBox"; }
/// reimplemented from KisMainwindowObserver
- virtual void setMainWindow(KisViewManager* kisview);
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ void setMainWindow(KisViewManager* kisview) override;
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private Q_SLOTS:
void notifyImageDeleted();
void slotContextMenuRequested(const QPoint &pos, const QModelIndex &index);
void slotMinimalView();
void slotDetailedView();
void slotThumbnailView();
// From the node manager to the layerbox
void slotSetCompositeOp(const KoCompositeOp* compositeOp);
void slotSetOpacity(double opacity);
void slotFillCompositeOps(const KoColorSpace * colorSpace);
void updateUI();
void setCurrentNode(KisNodeSP node);
void slotModelReset();
// from the layerbox to the node manager
void slotRmClicked();
void slotRaiseClicked();
void slotLowerClicked();
void slotPropertiesClicked();
void slotCompositeOpChanged(int index);
void slotOpacityChanged();
void slotOpacitySliderMoved(qreal opacity);
void slotCollapsed(const QModelIndex &index);
void slotExpanded(const QModelIndex &index);
void slotSelectOpaque();
void slotNodeCollapsedChanged();
void slotEditGlobalSelection(bool showSelections);
void slotRenameCurrentNode();
void slotAboutToRemoveRows(const QModelIndex &parent, int first, int last);
void selectionChanged(const QModelIndexList selection);
void slotNodeManagerChangedSelection(const QList<KisNodeSP> &nodes);
void slotColorLabelChanged(int index);
void updateThumbnail();
void updateAvailableLabels();
void updateLayerFiltering();
// Opacity keyframing
void slotKeyframeChannelAdded(KisKeyframeChannel *channel);
void slotOpacityKeyframeChanged(KisKeyframeSP keyframe);
void slotOpacityKeyframeMoved(KisKeyframeSP keyframe, int fromTime);
void slotImageTimeChanged(int time);
private:
inline void connectActionToButton(KisViewManager* view, QAbstractButton *button, const QString &id);
inline void addActionToMenu(QMenu *menu, const QString &id);
void watchOpacityChannel(KisKeyframeChannel *channel);
KisNodeSP findNonHidableNode(KisNodeSP startNode);
private:
QPointer<KisCanvas2> m_canvas;
QMenu *m_newLayerMenu;
KisImageWSP m_image;
QPointer<KisNodeModel> m_nodeModel;
QPointer<KisNodeFilterProxyModel> m_filteringModel;
QPointer<KisNodeManager> m_nodeManager;
QPointer<KisColorLabelSelectorWidget> m_colorSelector;
QPointer<QWidgetAction> m_colorSelectorAction;
Ui_WdgLayerBox* m_wdgLayerBox;
QTimer m_opacityDelayTimer;
int m_newOpacity;
QVector<KisAction*> m_actions;
KisAction* m_removeAction;
KisAction* m_propertiesAction;
KisAction* m_selectOpaque;
KisSignalCompressor m_thumbnailCompressor;
KisSignalCompressor m_colorLabelCompressor;
KisNodeSP m_activeNode;
QPointer<KisKeyframeChannel> m_opacityChannel;
bool m_blockOpacityUpdate {false};
};
class KisLayerBoxFactory : public KoDockFactoryBase
{
public:
KisLayerBoxFactory() { }
- virtual QString id() const {
+ QString id() const override {
return QString("KisLayerBox");
}
- virtual QDockWidget* createDockWidget() {
+ QDockWidget* createDockWidget() override {
KisLayerBox * dockWidget = new KisLayerBox();
dockWidget->setObjectName(id());
return dockWidget;
}
- DockPosition defaultDockPosition() const {
+ DockPosition defaultDockPosition() const override {
return DockRight;
}
};
#endif // KIS_LAYERBOX_H
diff --git a/plugins/dockers/digitalmixer/digitalmixer.h b/plugins/dockers/digitalmixer/digitalmixer.h
index 3f4982431a..c5b0510c40 100644
--- a/plugins/dockers/digitalmixer/digitalmixer.h
+++ b/plugins/dockers/digitalmixer/digitalmixer.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DIGITALMIXER_H_
#define _DIGITALMIXER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class DigitalMixerPlugin : public QObject
{
Q_OBJECT
public:
DigitalMixerPlugin(QObject *parent, const QVariantList &);
- virtual ~DigitalMixerPlugin();
+ ~DigitalMixerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/digitalmixer/digitalmixer_dock.h b/plugins/dockers/digitalmixer/digitalmixer_dock.h
index ce14446472..251d83fa51 100644
--- a/plugins/dockers/digitalmixer/digitalmixer_dock.h
+++ b/plugins/dockers/digitalmixer/digitalmixer_dock.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DIGITALMIXER_DOCK_H_
#define _DIGITALMIXER_DOCK_H_
#include <QPointer>
#include <QDockWidget>
#include <KoColor.h>
#include <KoCanvasObserverBase.h>
#include <KoCanvasBase.h>
class KoColorPopupAction;
class KoColorSlider;
class KoColorPatch;
class KisColorButton;
class DigitalMixerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
DigitalMixerDock( );
- QString observerName() { return "DigitalMixerDock"; }
+ QString observerName() override { return "DigitalMixerDock"; }
/// reimplemented from KoCanvasObserverBase
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas() { m_canvas = 0; setEnabled(false);}
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override { m_canvas = 0; setEnabled(false);}
public Q_SLOTS:
void setCurrentColor(const KoColor& );
void canvasResourceChanged(int, const QVariant&);
private Q_SLOTS:
void popupColorChanged(int i);
void colorSliderChanged(int i);
void targetColorChanged(int);
private:
QPointer<KoCanvasBase> m_canvas;
KoColor m_currentColor;
KoColorPatch* m_currentColorPatch;
struct Mixer {
KoColorPatch* targetColor;
KoColorSlider* targetSlider;
KisColorButton* actionColor;
};
QList<Mixer> m_mixers;
bool m_tellCanvas;
};
#endif
diff --git a/plugins/dockers/griddocker/grid_config_widget.cpp b/plugins/dockers/griddocker/grid_config_widget.cpp
index 51010c66db..3dd1cde309 100644
--- a/plugins/dockers/griddocker/grid_config_widget.cpp
+++ b/plugins/dockers/griddocker/grid_config_widget.cpp
@@ -1,328 +1,336 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "grid_config_widget.h"
#include "ui_grid_config_widget.h"
#include "kis_grid_config.h"
#include "kis_guides_config.h"
#include "kis_debug.h"
#include "kis_aspect_ratio_locker.h"
#include "kis_int_parse_spin_box.h"
struct GridConfigWidget::Private
{
Private() : guiSignalsBlocked(false) {}
KisGridConfig gridConfig;
KisGuidesConfig guidesConfig;
bool guiSignalsBlocked;
};
GridConfigWidget::GridConfigWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::GridConfigWidget),
m_d(new Private)
{
ui->setupUi(this);
ui->colorMain->setAlphaChannelEnabled(true);
ui->colorSubdivision->setAlphaChannelEnabled(true);
ui->colorGuides->setAlphaChannelEnabled(true);
ui->angleLeftSpinbox->setSuffix(QChar(Qt::Key_degree));
ui->angleRightSpinbox->setSuffix(QChar(Qt::Key_degree));
ui->cellSpacingSpinbox->setSuffix(i18n(" px"));
ui->gridTypeCombobox->addItem(i18n("Rectangle"));
ui->gridTypeCombobox->addItem(i18n("Isometric"));
ui->gridTypeCombobox->setCurrentIndex(0); // set to rectangle by default
slotGridTypeChanged(); // update the UI to hide any elements we don't need
connect(ui->gridTypeCombobox, SIGNAL(currentIndexChanged(int)), SLOT(slotGridTypeChanged()));
m_isGridEnabled = false;
setGridConfig(m_d->gridConfig);
setGuidesConfig(m_d->guidesConfig);
// hide offset UI elements if offset is disabled
connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->lblXOffset, SLOT(setVisible(bool)));
connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->lblYOffset, SLOT(setVisible(bool)));
connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->intXOffset, SLOT(setVisible(bool)));
connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->intYOffset, SLOT(setVisible(bool)));
connect(ui->chkOffset, SIGNAL(toggled(bool)), ui->offsetAspectButton, SLOT(setVisible(bool)));
ui->lblXOffset->setVisible(false);
ui->lblYOffset->setVisible(false);
ui->intXOffset->setVisible(false);
ui->intYOffset->setVisible(false);
ui->offsetAspectButton->setVisible(false);
connect(ui->chkShowGrid, SIGNAL(stateChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->chkSnapToGrid, SIGNAL(stateChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->chkShowGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged()));
connect(ui->chkSnapToGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged()));
connect(ui->chkLockGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged()));
connect(ui->intSubdivision, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->angleLeftSpinbox, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->angleRightSpinbox, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->cellSpacingSpinbox, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->selectMainStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->colorMain, SIGNAL(changed(const QColor&)), SLOT(slotGridGuiChanged()));
connect(ui->selectSubdivisionStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->colorSubdivision, SIGNAL(changed(const QColor&)), SLOT(slotGridGuiChanged()));
connect(ui->selectGuidesStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGuidesGuiChanged()));
connect(ui->colorGuides, SIGNAL(changed(const QColor&)), SLOT(slotGuidesGuiChanged()));
ui->chkOffset->setChecked(false);
KisAspectRatioLocker *offsetLocker = new KisAspectRatioLocker(this);
offsetLocker->connectSpinBoxes(ui->intXOffset, ui->intYOffset, ui->offsetAspectButton);
KisAspectRatioLocker *spacingLocker = new KisAspectRatioLocker(this);
spacingLocker->connectSpinBoxes(ui->intHSpacing, ui->intVSpacing, ui->spacingAspectButton);
connect(offsetLocker, SIGNAL(sliderValueChanged()), SLOT(slotGridGuiChanged()));
connect(offsetLocker, SIGNAL(aspectButtonChanged()), SLOT(slotGridGuiChanged()));
connect(spacingLocker, SIGNAL(sliderValueChanged()), SLOT(slotGridGuiChanged()));
connect(spacingLocker, SIGNAL(aspectButtonChanged()), SLOT(slotGridGuiChanged()));
+
+ connect(ui->chkShowRulers,SIGNAL(toggled(bool)),SIGNAL(showRulersChanged(bool)));
}
GridConfigWidget::~GridConfigWidget()
{
delete ui;
}
void GridConfigWidget::setGridConfig(const KisGridConfig &value)
{
KisGridConfig currentConfig = fetchGuiGridConfig();
if (currentConfig == value) return;
setGridConfigImpl(value);
}
void GridConfigWidget::setGuidesConfig(const KisGuidesConfig &value)
{
KisGuidesConfig currentConfig = fetchGuiGuidesConfig();
if (currentConfig == value) return;
setGuidesConfigImpl(value);
}
void GridConfigWidget::setGridConfigImpl(const KisGridConfig &value)
{
m_d->gridConfig = value;
m_d->guiSignalsBlocked = true;
ui->offsetAspectButton->setKeepAspectRatio(m_d->gridConfig.offsetAspectLocked());
ui->spacingAspectButton->setKeepAspectRatio(m_d->gridConfig.spacingAspectLocked());
ui->chkShowGrid->setChecked(m_d->gridConfig.showGrid());
ui->intHSpacing->setValue(m_d->gridConfig.spacing().x());
ui->intVSpacing->setValue(m_d->gridConfig.spacing().y());
ui->intXOffset->setValue(m_d->gridConfig.offset().x());
ui->intYOffset->setValue(m_d->gridConfig.offset().y());
ui->intSubdivision->setValue(m_d->gridConfig.subdivision());
ui->chkSnapToGrid->setChecked(m_d->gridConfig.snapToGrid());
ui->angleLeftSpinbox->setValue(m_d->gridConfig.angleLeft());
ui->angleRightSpinbox->setValue(m_d->gridConfig.angleRight());
ui->cellSpacingSpinbox->setValue(m_d->gridConfig.cellSpacing());
ui->selectMainStyle->setCurrentIndex(int(m_d->gridConfig.lineTypeMain()));
ui->selectSubdivisionStyle->setCurrentIndex(int(m_d->gridConfig.lineTypeSubdivision()));
ui->gridTypeCombobox->setCurrentIndex(m_d->gridConfig.gridType());
ui->colorMain->setColor(m_d->gridConfig.colorMain());
ui->colorSubdivision->setColor(m_d->gridConfig.colorSubdivision());
m_d->guiSignalsBlocked = false;
emit gridValueChanged();
}
void GridConfigWidget::setGuidesConfigImpl(const KisGuidesConfig &value)
{
m_d->guidesConfig = value;
m_d->guiSignalsBlocked = true;
ui->chkShowGuides->setChecked(m_d->guidesConfig.showGuides());
ui->chkSnapToGuides->setChecked(m_d->guidesConfig.snapToGuides());
ui->chkLockGuides->setChecked(m_d->guidesConfig.lockGuides());
ui->selectGuidesStyle->setCurrentIndex(int(m_d->guidesConfig.guidesLineType()));
ui->colorGuides->setColor(m_d->guidesConfig.guidesColor());
m_d->guiSignalsBlocked = false;
emit guidesValueChanged();
}
KisGridConfig GridConfigWidget::gridConfig() const
{
return m_d->gridConfig;
}
KisGuidesConfig GridConfigWidget::guidesConfig() const
{
return m_d->guidesConfig;
}
void GridConfigWidget::setGridDivision(int w, int h)
{
ui->intHSpacing->setMaximum(w);
ui->intVSpacing->setMaximum(h);
}
KisGridConfig GridConfigWidget::fetchGuiGridConfig() const
{
KisGridConfig config;
config.setShowGrid(ui->chkShowGrid->isChecked());
config.setSnapToGrid(ui->chkSnapToGrid->isChecked());
QPoint pt;
pt.rx() = ui->intHSpacing->value();
pt.ry() = ui->intVSpacing->value();
config.setSpacing(pt);
pt.rx() = ui->intXOffset->value();
pt.ry() = ui->intYOffset->value();
config.setOffset(pt);
config.setSubdivision(ui->intSubdivision->value());
config.setAngleLeft(ui->angleLeftSpinbox->value());
config.setAngleRight(ui->angleRightSpinbox->value());
config.setCellSpacing(ui->cellSpacingSpinbox->value());
config.setGridType(ui->gridTypeCombobox->currentIndex());
config.setOffsetAspectLocked(ui->offsetAspectButton->keepAspectRatio());
config.setSpacingAspectLocked(ui->spacingAspectButton->keepAspectRatio());
config.setLineTypeMain(KisGridConfig::LineTypeInternal(ui->selectMainStyle->currentIndex()));
config.setLineTypeSubdivision(KisGridConfig::LineTypeInternal(ui->selectSubdivisionStyle->currentIndex()));
config.setColorMain(ui->colorMain->color());
config.setColorSubdivision(ui->colorSubdivision->color());
return config;
}
KisGuidesConfig GridConfigWidget::fetchGuiGuidesConfig() const
{
KisGuidesConfig config = m_d->guidesConfig;
config.setShowGuides(ui->chkShowGuides->isChecked());
config.setSnapToGuides(ui->chkSnapToGuides->isChecked());
config.setLockGuides(ui->chkLockGuides->isChecked());
config.setGuidesLineType(KisGuidesConfig::LineTypeInternal(ui->selectGuidesStyle->currentIndex()));
config.setGuidesColor(ui->colorGuides->color());
return config;
}
void GridConfigWidget::slotGridGuiChanged()
{
if (m_d->guiSignalsBlocked) return;
KisGridConfig currentConfig = fetchGuiGridConfig();
if (currentConfig == m_d->gridConfig) return;
setGridConfigImpl(currentConfig);
}
void GridConfigWidget::slotGuidesGuiChanged()
{
if (m_d->guiSignalsBlocked) return;
KisGuidesConfig currentConfig = fetchGuiGuidesConfig();
if (currentConfig == m_d->guidesConfig) return;
setGuidesConfigImpl(currentConfig);
}
void GridConfigWidget::slotGridTypeChanged() {
bool showRectangleControls = ui->gridTypeCombobox->currentIndex() == 0;
// specific rectangle UI controls
ui->lblXSpacing->setVisible(showRectangleControls);
ui->lblYSpacing->setVisible(showRectangleControls);
ui->intHSpacing->setVisible(showRectangleControls);
ui->intVSpacing->setVisible(showRectangleControls);
ui->spacingAspectButton->setVisible(showRectangleControls);
ui->lblSubdivision->setVisible(showRectangleControls);
ui->intSubdivision->setVisible(showRectangleControls);
ui->lblSubdivisionStyle->setVisible(showRectangleControls);
ui->selectSubdivisionStyle->setVisible(showRectangleControls);
ui->colorSubdivision->setVisible(showRectangleControls);
// specific isometric UI controls
ui->leftAngleLabel->setVisible(!showRectangleControls);
ui->rightAngleLabel->setVisible(!showRectangleControls);
ui->angleLeftSpinbox->setVisible(!showRectangleControls);
ui->angleRightSpinbox->setVisible(!showRectangleControls);
ui->cellSpacingLabel->setVisible(!showRectangleControls);
ui->cellSpacingSpinbox->setVisible(!showRectangleControls);
// disable snapping for isometric grid type for now
// remember if we had snapping enabled if it was on the rectangule mode
if (!showRectangleControls) {
m_isGridEnabled = ui->chkSnapToGrid->isChecked();
ui->chkSnapToGrid->setEnabled(false);
ui->chkSnapToGrid->setChecked(false);
} else {
ui->chkSnapToGrid->setEnabled(true);
ui->chkSnapToGrid->setChecked(m_isGridEnabled);
}
slotGridGuiChanged();
}
+bool GridConfigWidget::showRulers() const
+{
+ return ui->chkShowRulers->isChecked();
+}
-
-
+void GridConfigWidget::setShowRulers(bool value)
+{
+ ui->chkShowRulers->setChecked(value);
+}
diff --git a/plugins/dockers/griddocker/grid_config_widget.h b/plugins/dockers/griddocker/grid_config_widget.h
index 931d20ce6c..d0d20752f4 100644
--- a/plugins/dockers/griddocker/grid_config_widget.h
+++ b/plugins/dockers/griddocker/grid_config_widget.h
@@ -1,72 +1,78 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef GRID_CONFIG_WIDGET_H
#define GRID_CONFIG_WIDGET_H
#include <QWidget>
#include <QScopedPointer>
namespace Ui {
class GridConfigWidget;
}
class KisGridConfig;
class KisGuidesConfig;
class GridConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit GridConfigWidget(QWidget *parent = 0);
- ~GridConfigWidget();
+ ~GridConfigWidget() override;
void setGridConfig(const KisGridConfig &value);
KisGridConfig gridConfig() const;
void setGuidesConfig(const KisGuidesConfig &value);
KisGuidesConfig guidesConfig() const;
void setGridDivision(int w, int h);
+ bool showRulers() const;
+
+public Q_SLOTS:
+ void setShowRulers(bool value);
+
private Q_SLOTS:
void slotGridGuiChanged();
void slotGuidesGuiChanged();
void slotGridTypeChanged();
Q_SIGNALS:
void gridValueChanged();
void guidesValueChanged();
+ void showRulersChanged(bool);
private:
KisGridConfig fetchGuiGridConfig() const;
void setGridConfigImpl(const KisGridConfig &value);
KisGuidesConfig fetchGuiGuidesConfig() const;
void setGuidesConfigImpl(const KisGuidesConfig &value);
private:
Ui::GridConfigWidget *ui;
struct Private;
const QScopedPointer<Private> m_d;
bool m_isGridEnabled;
};
#endif // GRID_CONFIG_WIDGET_H
diff --git a/plugins/dockers/griddocker/grid_config_widget.ui b/plugins/dockers/griddocker/grid_config_widget.ui
index bee6e42556..d6a24494c7 100644
--- a/plugins/dockers/griddocker/grid_config_widget.ui
+++ b/plugins/dockers/griddocker/grid_config_widget.ui
@@ -1,716 +1,723 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GridConfigWidget</class>
<widget class="QWidget" name="GridConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>258</width>
<height>527</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>187</width>
<height>280</height>
</size>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Grid</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QCheckBox" name="chkShowGrid">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Show grid</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkSnapToGrid">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Snap to grid</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="gridTypeCombobox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="isometricControlsLayout" columnstretch="0,0">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="2" column="1">
<widget class="QSpinBox" name="cellSpacingSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="angleRightSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>89</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="cellSpacingLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Cell Spacing:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="angleLeftSpinbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>89</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="rightAngleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Right Angle:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="leftAngleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Left Angle:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="rectangleGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblXSpacing">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X spacing:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KisIntParseSpinBox" name="intHSpacing">
<property name="suffix">
<string> px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="2">
<widget class="KoAspectButton" name="spacingAspectButton" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblYSpacing">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y spacing:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KisIntParseSpinBox" name="intVSpacing">
<property name="suffix">
<string> px</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSubdivision">
<property name="text">
<string>Subdivision:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KisIntParseSpinBox" name="intSubdivision">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>2</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="KColorButton" name="colorSubdivision">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblSubdivisionStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Div Style:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="selectSubdivisionStyle">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Dashed</string>
</property>
</item>
<item>
<property name="text">
<string>Dots</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<widget class="KColorButton" name="colorMain">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="selectMainStyle">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Dashed</string>
</property>
</item>
<item>
<property name="text">
<string>Dots</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblMainStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Main Style:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="chkOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>107</width>
<height>22</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Grid Offset</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="KisIntParseSpinBox" name="intXOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> px</string>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblXOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X offset:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblYOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y offset:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KisIntParseSpinBox" name="intYOffset">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> px</string>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="KoAspectButton" name="offsetAspectButton" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Guides</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="chkShowGuides">
<property name="text">
<string>Show guides</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="chkSnapToGuides">
<property name="text">
<string>Snap to guides</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkLockGuides">
<property name="text">
<string>Lock guides</string>
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkShowRulers">
+ <property name="text">
+ <string>Show rulers</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblGuidesStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Guides:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="selectGuidesStyle">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Lines</string>
</property>
</item>
<item>
<property name="text">
<string>Dashed</string>
</property>
</item>
<item>
<property name="text">
<string>Dots</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="KColorButton" name="colorGuides">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KoAspectButton</class>
<extends>QWidget</extends>
<header>KoAspectButton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisIntParseSpinBox</class>
<extends>QSpinBox</extends>
<header>kis_int_parse_spin_box.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/plugins/dockers/griddocker/griddocker.h b/plugins/dockers/griddocker/griddocker.h
index 5821088512..fa7df907cf 100644
--- a/plugins/dockers/griddocker/griddocker.h
+++ b/plugins/dockers/griddocker/griddocker.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _GRID_DOCKER_H_
#define _GRID_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class GridDockerPlugin : public QObject
{
Q_OBJECT
public:
GridDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~GridDockerPlugin();
+ ~GridDockerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/griddocker/griddocker_dock.cpp b/plugins/dockers/griddocker/griddocker_dock.cpp
index 2332a7b1a6..797cc42173 100644
--- a/plugins/dockers/griddocker/griddocker_dock.cpp
+++ b/plugins/dockers/griddocker/griddocker_dock.cpp
@@ -1,111 +1,118 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "griddocker_dock.h"
//#include "gridwidget.h"
// #include <QLabel>
// #include <QVBoxLayout>
#include <QStatusBar>
#include <klocalizedstring.h>
#include "kis_canvas2.h"
#include <KisViewManager.h>
#include <kis_zoom_manager.h>
#include "kis_image.h"
#include "kis_paint_device.h"
#include "kis_signal_compressor.h"
#include "grid_config_widget.h"
#include "kis_grid_manager.h"
#include "kis_grid_config.h"
#include "kis_guides_manager.h"
#include "kis_guides_config.h"
+#include "kis_action.h"
GridDockerDock::GridDockerDock( )
: QDockWidget(i18n("Grid and Guides"))
, m_canvas(0)
{
m_configWidget = new GridConfigWidget(this);
connect(m_configWidget, SIGNAL(gridValueChanged()), SLOT(slotGuiGridConfigChanged()));
connect(m_configWidget, SIGNAL(guidesValueChanged()), SLOT(slotGuiGuidesConfigChanged()));
setWidget(m_configWidget);
setEnabled(m_canvas);
}
GridDockerDock::~GridDockerDock()
{
}
void GridDockerDock::setCanvas(KoCanvasBase * canvas)
{
if(canvas && m_canvas == canvas)
return;
if (m_canvas) {
m_canvasConnections.clear();
m_canvas->disconnectCanvasObserver(this);
m_canvas->image()->disconnect(this);
}
m_canvas = canvas ? dynamic_cast<KisCanvas2*>(canvas) : 0;
setEnabled(m_canvas);
if (m_canvas) {
m_canvasConnections.addConnection(
m_canvas->viewManager()->gridManager(),
SIGNAL(sigRequestUpdateGridConfig(const KisGridConfig&)),
this,
SLOT(slotGridConfigUpdateRequested(const KisGridConfig&)));
+ KisAction* action = m_canvas->viewManager()->actionManager()->actionByName("view_ruler");
+
+ m_canvasConnections.addConnection(m_configWidget,SIGNAL(showRulersChanged(bool)),action,SLOT(setChecked(bool)));
+ m_canvasConnections.addConnection(action,SIGNAL(toggled(bool)),m_configWidget,SLOT(setShowRulers(bool)));
+ m_configWidget->setShowRulers(action->isChecked());
+
m_canvasConnections.addConnection(
m_canvas->viewManager()->guidesManager(),
SIGNAL(sigRequestUpdateGuidesConfig(const KisGuidesConfig&)),
this,
SLOT(slotGuidesConfigUpdateRequested(const KisGuidesConfig&)));
QRect rc = m_canvas->image()->bounds();
m_configWidget->setGridDivision(rc.width() / 2, rc.height() / 2);
}
}
void GridDockerDock::unsetCanvas()
{
setCanvas(0);
}
void GridDockerDock::slotGuiGridConfigChanged()
{
if (!m_canvas) return;
m_canvas->viewManager()->gridManager()->setGridConfig(m_configWidget->gridConfig());
}
void GridDockerDock::slotGridConfigUpdateRequested(const KisGridConfig &config)
{
m_configWidget->setGridConfig(config);
}
void GridDockerDock::slotGuiGuidesConfigChanged()
{
if (!m_canvas) return;
m_canvas->viewManager()->guidesManager()->setGuidesConfig(m_configWidget->guidesConfig());
}
void GridDockerDock::slotGuidesConfigUpdateRequested(const KisGuidesConfig &config)
{
m_configWidget->setGuidesConfig(config);
}
diff --git a/plugins/dockers/griddocker/griddocker_dock.h b/plugins/dockers/griddocker/griddocker_dock.h
index c7c9eaa88d..d7d1a775d8 100644
--- a/plugins/dockers/griddocker/griddocker_dock.h
+++ b/plugins/dockers/griddocker/griddocker_dock.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _GRID_DOCK_H_
#define _GRID_DOCK_H_
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
#include "kis_signal_auto_connection.h"
class QVBoxLayout;
class KisCanvas2;
class GridConfigWidget;
class KisSignalAutoConnection;
class KisGridConfig;
class KisGuidesConfig;
class GridDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
GridDockerDock();
- ~GridDockerDock();
- QString observerName() { return "GridDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ ~GridDockerDock() override;
+ QString observerName() override { return "GridDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
public Q_SLOTS:
void slotGuiGridConfigChanged();
void slotGridConfigUpdateRequested(const KisGridConfig &config);
void slotGuiGuidesConfigChanged();
void slotGuidesConfigUpdateRequested(const KisGuidesConfig &config);
private:
GridConfigWidget *m_configWidget;
QPointer<KisCanvas2> m_canvas;
KisSignalAutoConnectionsStore m_canvasConnections;
};
#endif
diff --git a/plugins/dockers/histogram/histogramdocker.h b/plugins/dockers/histogram/histogramdocker.h
index 650eaa5323..0e73af0b5e 100644
--- a/plugins/dockers/histogram/histogramdocker.h
+++ b/plugins/dockers/histogram/histogramdocker.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2016 Eugene Ingerman <geneing at gmail dot com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _HISTOGRAM_DOCKER_H_
#define _HISTOGRAM_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class HistogramDockerPlugin : public QObject
{
Q_OBJECT
public:
HistogramDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~HistogramDockerPlugin();
+ ~HistogramDockerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/histogram/histogramdocker_dock.h b/plugins/dockers/histogram/histogramdocker_dock.h
index 5227cf04e2..334fa894e5 100644
--- a/plugins/dockers/histogram/histogramdocker_dock.h
+++ b/plugins/dockers/histogram/histogramdocker_dock.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2016 Eugene Ingerman <geneing at gmail dot com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _HISTOGRAM_DOCK_H_
#define _HISTOGRAM_DOCK_H_
#include <QDockWidget>
#include <QPointer>
#include <KoCanvasObserverBase.h>
#include <kis_paint_device.h>
#include <kis_canvas2.h>
class QVBoxLayout;
class KisHistogramView;
class KisIdleWatcher;
class KoHistogramProducer;
class HistogramDockerWidget;
class HistogramDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
HistogramDockerDock();
- QString observerName() { return "HistogramDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ QString observerName() override { return "HistogramDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
public Q_SLOTS:
void startUpdateCanvasProjection();
void sigColorSpaceChanged(const KoColorSpace* cs);
void updateHistogram();
protected:
- void showEvent(QShowEvent *event);
+ void showEvent(QShowEvent *event) override;
private:
QVBoxLayout *m_layout;
KisIdleWatcher *m_imageIdleWatcher;
HistogramDockerWidget *m_histogramWidget;
QPointer<KisCanvas2> m_canvas;
};
#endif
diff --git a/plugins/dockers/histogram/histogramdockerwidget.h b/plugins/dockers/histogram/histogramdockerwidget.h
index b1f456f3c9..a482583c11 100644
--- a/plugins/dockers/histogram/histogramdockerwidget.h
+++ b/plugins/dockers/histogram/histogramdockerwidget.h
@@ -1,74 +1,74 @@
/*
* Copyright (c) 2016 Eugene Ingerman <geneing at gmail dot com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef HISTOGRAMDOCKERWIDGET_H
#define HISTOGRAMDOCKERWIDGET_H
#include <QObject>
#include <QWidget>
#include <QLabel>
#include <QThread>
#include "kis_types.h"
#include <vector>
class KisCanvas2;
typedef std::vector<std::vector<quint32> > HistVector; //Don't use QVector here - it's too slow for this purpose
class HistogramComputationThread : public QThread
{
Q_OBJECT
public:
HistogramComputationThread(KisPaintDeviceSP _dev, const QRect& _bounds) : m_dev(_dev), m_bounds(_bounds)
{}
void run() override;
Q_SIGNALS:
void resultReady(HistVector*);
private:
KisPaintDeviceSP m_dev;
QRect m_bounds;
HistVector bins;
};
class HistogramDockerWidget : public QLabel
{
Q_OBJECT
public:
HistogramDockerWidget(QWidget *parent = 0, const char *name = 0, Qt::WindowFlags f = 0);
- ~HistogramDockerWidget();
+ ~HistogramDockerWidget() override;
void setPaintDevice(KisCanvas2* canvas);
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
public Q_SLOTS:
void updateHistogram();
void receiveNewHistogram(HistVector*);
private:
KisPaintDeviceSP m_paintDevice;
HistVector m_histogramData;
QRect m_bounds;
bool m_smoothHistogram;
};
#endif // HISTOGRAMDOCKERWIDGET_H
diff --git a/plugins/dockers/historydocker/History.h b/plugins/dockers/historydocker/History.h
index 1c9da9d9f6..f5e162ea81 100644
--- a/plugins/dockers/historydocker/History.h
+++ b/plugins/dockers/historydocker/History.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _HISTORY_H_
#define _HISTORY_H_
#include <QObject>
#include <QVariant>
class HistoryPlugin : public QObject
{
Q_OBJECT
public:
HistoryPlugin(QObject *parent, const QVariantList &);
- virtual ~HistoryPlugin();
+ ~HistoryPlugin() override;
};
#endif
diff --git a/plugins/dockers/historydocker/HistoryDock.h b/plugins/dockers/historydocker/HistoryDock.h
index a8d6ed8844..7549afbbb4 100644
--- a/plugins/dockers/historydocker/HistoryDock.h
+++ b/plugins/dockers/historydocker/HistoryDock.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _HISTORY_DOCK_H_
#define _HISTORY_DOCK_H_
#include <QDockWidget>
#include <QToolButton>
#include "KisUndoView.h"
#include <KoCanvasObserverBase.h>
#include <klocalizedstring.h>
#include <kundo2stack.h>
#include <KoShapeController.h>
#include <KoCanvasBase.h>
#include "kis_types.h"
#include "kis_canvas2.h"
#include "KisViewManager.h"
#include "kis_image.h"
#include "kis_paint_device.h"
class HistoryDock : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
HistoryDock();
- QString observerName() { return "HistoryDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ QString observerName() override { return "HistoryDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private Q_SLOTS:
void configure();
private:
KisUndoView *m_undoView;
QToolButton *m_bnConfigure;
KoCanvasBase *m_historyCanvas;
};
#endif
diff --git a/plugins/dockers/historydocker/KisUndoModel.h b/plugins/dockers/historydocker/KisUndoModel.h
index c5547ef818..16348587f8 100644
--- a/plugins/dockers/historydocker/KisUndoModel.h
+++ b/plugins/dockers/historydocker/KisUndoModel.h
@@ -1,114 +1,114 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef KIS_UNDO_MODEL_H
#define KIS_UNDO_MODEL_H
#include <QAbstractItemModel>
#include <kundo2qstack.h>
#include <QItemSelectionModel>
#include <QIcon>
#include <QPointer>
#include <kundo2command.h>
#include "kis_types.h"
#include "kis_canvas2.h"
#include "KisViewManager.h"
#include "kis_image.h"
#include "kis_paint_device.h"
class KisUndoModel : public QAbstractItemModel
{
Q_OBJECT
public:
KisUndoModel(QObject *parent = 0);
KUndo2QStack *stack() const;
- virtual QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column,
+ const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QModelIndex selectedIndex() const;
QItemSelectionModel *selectionModel() const;
QString emptyLabel() const;
void setEmptyLabel(const QString &label);
void setCleanIcon(const QIcon &icon);
QIcon cleanIcon() const;
void setCanvas(KisCanvas2* canvas);
bool checkMergedCommand(int index);
public Q_SLOTS:
void setStack(KUndo2QStack *stack);
void addImage(int idx);
private Q_SLOTS:
void stackChanged();
void stackDestroyed(QObject *obj);
void setStackCurrentIndex(const QModelIndex &index);
private:
bool m_blockOutgoingHistoryChange;
KUndo2QStack *m_stack;
QItemSelectionModel *m_sel_model;
QString m_empty_label;
QIcon m_clean_icon;
QPointer<KisCanvas2> m_canvas;
QMap<const KUndo2Command*, QImage> m_imageMap;
};
#endif
diff --git a/plugins/dockers/historydocker/KisUndoView.h b/plugins/dockers/historydocker/KisUndoView.h
index f21d78065e..b2aea7d773 100644
--- a/plugins/dockers/historydocker/KisUndoView.h
+++ b/plugins/dockers/historydocker/KisUndoView.h
@@ -1,121 +1,121 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef KisUndoView_H
#define KisUndoView_H
#include <QListView>
#include <QString>
#include <QAction>
#include <QMenu>
#include <kis_types.h>
#include <klocalizedstring.h>
#include <kis_icon.h>
#include "kis_canvas2.h"
#ifndef QT_NO_UNDOVIEW
class KisUndoViewPrivate;
class KUndo2QStack;
class KUndo2Group;
class QIcon;
class KisUndoView : public QListView
{
Q_OBJECT
Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel)
Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon)
public:
explicit KisUndoView(QWidget *parent = 0);
explicit KisUndoView(KUndo2QStack *stack, QWidget *parent = 0);
#ifndef QT_NO_UNDOGROUP
explicit KisUndoView(KUndo2Group *group, QWidget *parent = 0);
#endif
- ~KisUndoView();
+ ~KisUndoView() override;
KUndo2QStack *stack() const;
#ifndef QT_NO_UNDOGROUP
KUndo2Group *group() const;
#endif
void setEmptyLabel(const QString &label);
QString emptyLabel() const;
void setCleanIcon(const QIcon &icon);
QIcon cleanIcon() const;
void setCanvas(KisCanvas2* canvas);
public Q_SLOTS:
void setStack(KUndo2QStack *stack);
void toggleCumulativeUndoRedo();
void setStackT1(double value);
void setStackT2(double value);
void setStackN(int value);
#ifndef QT_NO_UNDOGROUP
void setGroup(KUndo2Group *group);
#endif
private:
KisUndoViewPrivate* const d;
Q_DISABLE_COPY(KisUndoView)
};
#endif // QT_NO_UNDOVIEW
#endif // KisUndoView_H
diff --git a/plugins/dockers/imagedocker/image_strip_scene.h b/plugins/dockers/imagedocker/image_strip_scene.h
index 6e73a20794..155ec12645 100644
--- a/plugins/dockers/imagedocker/image_strip_scene.h
+++ b/plugins/dockers/imagedocker/image_strip_scene.h
@@ -1,123 +1,123 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef H_IMAGE_STRIP_SCENE_H_
#define H_IMAGE_STRIP_SCENE_H_
#include <QGraphicsScene>
#include <QGraphicsWidget>
#include <QImageReader>
#include <QThread>
#include <QAtomicInt>
#include <QMutex>
class ImageItem;
class ImageLoader: public QThread
{
Q_OBJECT
struct Data
{
Data() { }
Data(const QString& p):
path(p), isLoaded(false) { };
Data(const Data& d):
image(d.image), path(d.path), isLoaded(d.isLoaded) { };
QImage image;
QString path;
QAtomicInt isLoaded;
};
Q_SIGNALS:
void sigItemContentChanged(ImageItem* item);
public:
ImageLoader(float size);
void addPath(ImageItem* item, const QString& path) {
m_data[item] = Data(path);
}
bool isImageLoaded(ImageItem* item) const {
return m_data[item].isLoaded != 0;
}
QImage getImage(ImageItem* item) const {
return m_data[item].image;
}
- virtual void run();
+ void run() override;
public Q_SLOTS:
void stopExecution();
private:
float m_size;
QHash<ImageItem*,Data> m_data;
QAtomicInt m_run;
};
class ImageItem: public QGraphicsWidget
{
public:
ImageItem(float size, const QString& path, ImageLoader* loader):
m_size(size), m_loader(loader), m_path(path)
{
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
const QString& path() const { return m_path; }
- virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint=QSizeF()) const;
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget=0);
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint=QSizeF()) const override;
+ void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget=0) override;
private:
float m_size;
ImageLoader* m_loader;
QString m_path;
};
class ImageStripScene: public QGraphicsScene
{
Q_OBJECT
public:
ImageStripScene();
- ~ImageStripScene();
+ ~ImageStripScene() override;
bool setCurrentDirectory(const QString& path);
QString currentPath() { return m_path; }
Q_SIGNALS:
void sigImageActivated(const QString& path);
private:
- virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
private Q_SLOTS:
void slotItemContentChanged(ImageItem* item);
private:
float m_imgSize;
quint32 m_numItems;
ImageLoader* m_loader;
QMutex m_mutex;
QString m_path;
};
#endif // H_IMAGE_STRIP_SCENE_H_
diff --git a/plugins/dockers/imagedocker/image_view.h b/plugins/dockers/imagedocker/image_view.h
index 41208e62d8..820edcd8ce 100644
--- a/plugins/dockers/imagedocker/image_view.h
+++ b/plugins/dockers/imagedocker/image_view.h
@@ -1,94 +1,94 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef H_KIS_IMAGE_VIEW_H
#define H_KIS_IMAGE_VIEW_H
#include <QScrollArea>
#include <QPixmap>
#include <QRubberBand>
class ImageViewport: public QWidget
{
Q_OBJECT
public:
ImageViewport();
QRect imageRect() const;
QColor imageColor(const QPoint& pos) const;
QSize imageSize() const;
void setImage(const QPixmap& pixmap, qreal scale);
void setScale(qreal scale);
- virtual QSize sizeHint() const;
- virtual void paintEvent(QPaintEvent* event);
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseMoveEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
+ QSize sizeHint() const override;
+ void paintEvent(QPaintEvent* event) override;
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseMoveEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
private:
qreal m_scale;
QPixmap m_pixmap;
QPixmap m_cachedPixmap;
bool m_mousePressed;
QRubberBand m_rubberBand;
QRect m_selection;
Q_SIGNALS:
void sigImageClicked(const QPoint& pos);
void sigRegionSelected(const QRect& rect);
};
class ImageView: public QScrollArea
{
Q_OBJECT
public:
enum { VIEW_MODE_FREE=0, VIEW_MODE_ADJUST=1, VIEW_MODE_FIT=2 };
ImageView(QWidget* parent=0);
void setPixmap(const QPixmap& pixmap, int viewMode=VIEW_MODE_FIT, qreal scale=1.0);
void setViewMode(int viewMode, qreal scale=1.0);
void setScrollPos(const QPoint& pos);
QPoint getScrollPos() const;
qreal getScale() const;
Q_SIGNALS:
void sigColorSelected(const QColor& color);
void sigViewModeChanged(int viewMode, qreal scale);
private Q_SLOTS:
void slotImageClicked(const QPoint& pos);
void slotRegionSelected(const QRect& rect);
private:
qreal calcScale(qreal scale, int viewMode, const QSizeF& imgSize) const;
QSize viewportSize(bool withScrollbars) const;
- virtual void resizeEvent(QResizeEvent* event);
+ void resizeEvent(QResizeEvent* event) override;
private:
qreal m_scale;
int m_viewMode;
qreal m_minScale;
qreal m_maxScale;
ImageViewport* m_imgViewport;
};
#endif // H_KIS_IMAGE_VIEW_H
diff --git a/plugins/dockers/imagedocker/imagedocker_dock.h b/plugins/dockers/imagedocker/imagedocker_dock.h
index 4710adf0d2..c5df038db2 100644
--- a/plugins/dockers/imagedocker/imagedocker_dock.h
+++ b/plugins/dockers/imagedocker/imagedocker_dock.h
@@ -1,111 +1,111 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef H_IMAGEDOCKER_DOCK_H_
#define H_IMAGEDOCKER_DOCK_H_
#include <QPointer>
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
#include <QStringList>
#include <QPixmap>
#include <QMap>
#include <KoCanvasBase.h>
class QModelIndex;
class QFileSystemModel;
class QButtonGroup;
class ImageFilter;
class ImageStripScene;
class ImageListModel;
class QTemporaryFile;
struct ImageDockerUI;
struct PopupWidgetUI;
class ImageDockerDock: public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
struct ImageInfo
{
qint64 id;
int viewMode;
QString path;
QString name;
float scale;
QPixmap pixmap;
QPoint scrollPos;
};
typedef QMap<qint64,ImageInfo>::iterator ImageInfoIter;
public:
ImageDockerDock();
- virtual ~ImageDockerDock();
- QString observerName() { return "ImageDockerDock"; }
- virtual void setCanvas(KoCanvasBase* canvas);
- virtual void unsetCanvas() {
+ ~ImageDockerDock() override;
+ QString observerName() override { return "ImageDockerDock"; }
+ void setCanvas(KoCanvasBase* canvas) override;
+ void unsetCanvas() override {
m_canvas = 0; // Intentionally not disabled if there's no canvas
}
private Q_SLOTS:
void slotItemDoubleClicked(const QModelIndex& index);
void slotBackButtonClicked();
void slotUpButtonClicked();
void slotHomeButtonClicked();
void slotCloseCurrentImage();
void slotNextImage();
void slotPrevImage();
void slotOpenImage(const QString& path);
void slotImageChoosenFromComboBox(int index);
void slotZoomChanged(int zoom);
void slotColorSelected(const QColor& color);
void slotViewModeChanged(int viewMode, qreal scale);
void slotCloseZoomPopup();
void slotChangeRoot(const QString& path);
protected:
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
- void dragEnterEvent(QDragEnterEvent *event);
- void dropEvent(QDropEvent *event);
- void showEvent(QShowEvent *);
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void showEvent(QShowEvent *) override;
private:
void addCurrentPathToHistory();
void updatePath(const QString& path);
qint64 generateImageID() const;
void setCurrentImage(qint64 imageID);
bool isImageLoaded() const { return m_currImageID != -1; }
void setZoom(const ImageInfo& info);
private:
QFileSystemModel* m_model;
QButtonGroup* m_zoomButtons;
QPointer<KoCanvasBase> m_canvas;
ImageFilter* m_proxyModel;
ImageListModel* m_imgListModel;
QStringList m_history;
ImageStripScene* m_imageStripScene;
ImageDockerUI* m_ui;
PopupWidgetUI* m_popupUi;
QMap<qint64,ImageInfo> m_imgInfoMap;
qint64 m_currImageID;
QList<QTemporaryFile*> m_temporaryFiles;
};
#endif // H_IMAGEDOCKER_DOCK_H_
diff --git a/plugins/dockers/overview/overviewdocker.h b/plugins/dockers/overview/overviewdocker.h
index 61861670e5..3820926ddf 100644
--- a/plugins/dockers/overview/overviewdocker.h
+++ b/plugins/dockers/overview/overviewdocker.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _OVERVIEW_DOCKER_H_
#define _OVERVIEW_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class OverviewDockerPlugin : public QObject
{
Q_OBJECT
public:
OverviewDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~OverviewDockerPlugin();
+ ~OverviewDockerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/overview/overviewdocker_dock.h b/plugins/dockers/overview/overviewdocker_dock.h
index 194aa00ea5..d9995751bc 100644
--- a/plugins/dockers/overview/overviewdocker_dock.h
+++ b/plugins/dockers/overview/overviewdocker_dock.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _OVERVIEW_DOCK_H_
#define _OVERVIEW_DOCK_H_
#include <QPointer>
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
#include <kis_canvas2.h>
class QVBoxLayout;
class OverviewWidget;
class OverviewDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
OverviewDockerDock();
- QString observerName() { return "OverviewDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ QString observerName() override { return "OverviewDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private:
QVBoxLayout *m_layout;
OverviewWidget *m_overviewWidget;
QWidget *m_zoomSlider;
QPointer<KisCanvas2> m_canvas;
};
#endif
diff --git a/plugins/dockers/overview/overviewwidget.h b/plugins/dockers/overview/overviewwidget.h
index bfb36337aa..b033fa8e91 100644
--- a/plugins/dockers/overview/overviewwidget.h
+++ b/plugins/dockers/overview/overviewwidget.h
@@ -1,113 +1,113 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2014 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef OVERVIEWWIDGET_H
#define OVERVIEWWIDGET_H
#include <QObject>
#include <QWidget>
#include <QPixmap>
#include <QPointer>
#include <QMutex>
#include "kis_idle_watcher.h"
#include "kis_simple_stroke_strategy.h"
#include <kis_canvas2.h>
class KisSignalCompressor;
class KoCanvasBase;
class OverviewThumbnailStrokeStrategy : public QObject, public KisSimpleStrokeStrategy
{
Q_OBJECT
public:
OverviewThumbnailStrokeStrategy(KisImageWSP image);
- ~OverviewThumbnailStrokeStrategy();
+ ~OverviewThumbnailStrokeStrategy() override;
static QList<KisStrokeJobData*> createJobsData(KisPaintDeviceSP dev, const QRect& imageRect, KisPaintDeviceSP thumbDev, const QSize &thumbnailSize);
private:
- void initStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
- void finishStrokeCallback();
- void cancelStrokeCallback();
+ void initStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
Q_SIGNALS:
//Emitted when thumbnail is updated and overviewImage is fully generated.
void thumbnailUpdated(QImage pixmap);
private:
struct Private;
const QScopedPointer<Private> m_d;
QMutex m_thumbnailMergeMutex;
KisImageSP m_image;
};
class OverviewWidget : public QWidget
{
Q_OBJECT
public:
OverviewWidget(QWidget * parent = 0);
- virtual ~OverviewWidget();
+ ~OverviewWidget() override;
virtual void setCanvas(KoCanvasBase *canvas);
virtual void unsetCanvas()
{
m_canvas = 0;
}
public Q_SLOTS:
void startUpdateCanvasProjection();
void generateThumbnail();
void updateThumbnail(QImage pixmap);
protected:
- void resizeEvent(QResizeEvent *event);
- void showEvent(QShowEvent *event);
- void paintEvent(QPaintEvent *event);
-
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseMoveEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
- virtual void wheelEvent(QWheelEvent* event);
+ void resizeEvent(QResizeEvent *event) override;
+ void showEvent(QShowEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseMoveEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
+ void wheelEvent(QWheelEvent* event) override;
private:
QSize calculatePreviewSize();
QPointF previewOrigin();
QTransform imageToPreviewTransform();
QPolygonF previewPolygon();
QPixmap m_pixmap;
QPointer<KisCanvas2> m_canvas;
bool m_dragging;
QPointF m_lastPos;
QColor m_outlineColor;
KisIdleWatcher m_imageIdleWatcher;
KisStrokeId strokeId;
QMutex mutex;
};
#endif /* OVERVIEWWIDGET_H */
diff --git a/plugins/dockers/palettedocker/palettedocker.h b/plugins/dockers/palettedocker/palettedocker.h
index 42bf6d8eb3..5b6c082b39 100644
--- a/plugins/dockers/palettedocker/palettedocker.h
+++ b/plugins/dockers/palettedocker/palettedocker.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PALETTEDOCKER_H
#define PALETTEDOCKER_H
#include <QObject>
#include <QVariant>
/**
* Docker showing the channels of the current layer
*/
class PaletteDockerPlugin : public QObject
{
Q_OBJECT
public:
PaletteDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~PaletteDockerPlugin();
+ ~PaletteDockerPlugin() override;
};
#endif
diff --git a/plugins/dockers/palettedocker/palettedocker_dock.h b/plugins/dockers/palettedocker/palettedocker_dock.h
index b39754a078..8d2a43b720 100644
--- a/plugins/dockers/palettedocker/palettedocker_dock.h
+++ b/plugins/dockers/palettedocker/palettedocker_dock.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PALETTEDOCKER_DOCK_H
#define PALETTEDOCKER_DOCK_H
#include <QDockWidget>
#include <QModelIndex>
#include <QPointer>
#include <KoCanvasObserverBase.h>
#include <KoResourceServerAdapter.h>
#include <KoResourceServerObserver.h>
#include <resources/KoColorSet.h>
#include <kis_canvas2.h>
#include <kis_mainwindow_observer.h>
class KisViewManager;
class KisCanvasResourceProvider;
class KisWorkspaceResource;
class KisColorsetChooser;
class KisPaletteModel;
class Ui_WdgPaletteDock;
class PaletteDockerDock : public QDockWidget, public KisMainwindowObserver, public KoResourceServerObserver<KoColorSet> {
Q_OBJECT
public:
PaletteDockerDock();
- virtual ~PaletteDockerDock();
- QString observerName() { return "PaletteDockerDock"; }
- virtual void setMainWindow(KisViewManager* kisview);
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ ~PaletteDockerDock() override;
+ QString observerName() override { return "PaletteDockerDock"; }
+ void setMainWindow(KisViewManager* kisview) override;
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
public: // KoResourceServerObserver
- virtual void unsetResourceServer();
- virtual void resourceAdded(KoColorSet *) {}
- virtual void removingResource(KoColorSet *resource);
- virtual void resourceChanged(KoColorSet *resource);
- virtual void syncTaggedResourceView() {}
- virtual void syncTagAddition(const QString&) {}
- virtual void syncTagRemoval(const QString&) {}
+ void unsetResourceServer() override;
+ void resourceAdded(KoColorSet *) override {}
+ void removingResource(KoColorSet *resource) override;
+ void resourceChanged(KoColorSet *resource) override;
+ void syncTaggedResourceView() override {}
+ void syncTagAddition(const QString&) override {}
+ void syncTagRemoval(const QString&) override {}
private Q_SLOTS:
void addColorForeground();
void addColor();
void removeColor();
void entrySelected(QModelIndex index);
void setColorSet(KoColorSet* colorSet);
void saveToWorkspace(KisWorkspaceResource* workspace);
void loadFromWorkspace(KisWorkspaceResource* workspace);
private:
Ui_WdgPaletteDock* m_wdgPaletteDock;
KisPaletteModel *m_model;
QSharedPointer<KoAbstractResourceServerAdapter> m_serverAdapter;
KoColorSet *m_currentColorSet;
KisColorsetChooser *m_colorSetChooser;
KisCanvasResourceProvider *m_resourceProvider;
QPointer<KisCanvas2> m_canvas;
};
#endif
diff --git a/plugins/dockers/patterndocker/patterndocker.h b/plugins/dockers/patterndocker/patterndocker.h
index 2847374171..1d4b908b10 100644
--- a/plugins/dockers/patterndocker/patterndocker.h
+++ b/plugins/dockers/patterndocker/patterndocker.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PATTERN_DOCKER_H_
#define _PATTERN_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class PatternDockerPlugin : public QObject
{
Q_OBJECT
public:
PatternDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~PatternDockerPlugin();
+ ~PatternDockerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/patterndocker/patterndocker_dock.h b/plugins/dockers/patterndocker/patterndocker_dock.h
index db14e9d72d..6d24b7e224 100644
--- a/plugins/dockers/patterndocker/patterndocker_dock.h
+++ b/plugins/dockers/patterndocker/patterndocker_dock.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PATTERN_DOCK_H_
#define _PATTERN_DOCK_H_
#include <QDockWidget>
#include <kis_mainwindow_observer.h>
class KoPattern;
class KisPatternChooser;
class PatternDockerDock : public QDockWidget, public KisMainwindowObserver {
Q_OBJECT
public:
PatternDockerDock( );
- virtual void setMainWindow(KisViewManager* kisview);
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ void setMainWindow(KisViewManager* kisview) override;
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
- QString observerName() { return "PatternDockerDock"; }
+ QString observerName() override { return "PatternDockerDock"; }
public Q_SLOTS:
void patternChanged(KoPattern *pattern);
private Q_SLOTS:
private:
KisPatternChooser* m_patternChooser;
};
#endif
diff --git a/plugins/dockers/presetdocker/presetdocker.h b/plugins/dockers/presetdocker/presetdocker.h
index ce65c974b9..0635425c62 100644
--- a/plugins/dockers/presetdocker/presetdocker.h
+++ b/plugins/dockers/presetdocker/presetdocker.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PRESET_DOCKER_H_
#define _PRESET_DOCKER_H_
#include <QObject>
#include <QVariant>
class KisViewManager;
/**
* Template of view plugin
*/
class PresetDockerPlugin : public QObject
{
Q_OBJECT
public:
PresetDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~PresetDockerPlugin();
+ ~PresetDockerPlugin() override;
private:
KisViewManager* m_view;
};
#endif
diff --git a/plugins/dockers/presetdocker/presetdocker_dock.h b/plugins/dockers/presetdocker/presetdocker_dock.h
index 5bb9c1e83f..ed8f252935 100644
--- a/plugins/dockers/presetdocker/presetdocker_dock.h
+++ b/plugins/dockers/presetdocker/presetdocker_dock.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PRESETDOCKER_DOCK_H_
#define _PRESETDOCKER_DOCK_H_
#include <QPointer>
#include <QDockWidget>
#include <KoCanvasObserverBase.h>
#include <kis_canvas2.h>
class KisPaintOpPresetsChooserPopup;
class PresetDockerDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
PresetDockerDock( );
- QString observerName() { return "PresetDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas() { m_canvas = 0; setEnabled(false);}
+ QString observerName() override { return "PresetDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override { m_canvas = 0; setEnabled(false);}
public Q_SLOTS:
void canvasResourceChanged(int key, const QVariant& v);
private Q_SLOTS:
private:
QPointer<KisCanvas2> m_canvas;
KisPaintOpPresetsChooserPopup* m_presetChooser;
};
#endif
diff --git a/plugins/dockers/presethistory/presethistory.h b/plugins/dockers/presethistory/presethistory.h
index 8dc561f33a..41cfc3f59a 100644
--- a/plugins/dockers/presethistory/presethistory.h
+++ b/plugins/dockers/presethistory/presethistory.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PRESET_DOCKER_H_
#define _PRESET_DOCKER_H_
#include <QObject>
#include <QVariant>
/**
* Shows the last used presets
*/
class PresetHistoryPlugin : public QObject
{
Q_OBJECT
public:
PresetHistoryPlugin(QObject *parent, const QVariantList &);
- virtual ~PresetHistoryPlugin();
+ ~PresetHistoryPlugin() override;
};
#endif
diff --git a/plugins/dockers/presethistory/presethistory_dock.h b/plugins/dockers/presethistory/presethistory_dock.h
index 6f23b8ee05..2c647806ed 100644
--- a/plugins/dockers/presethistory/presethistory_dock.h
+++ b/plugins/dockers/presethistory/presethistory_dock.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PRESETHISTORY_DOCK_H_
#define _PRESETHISTORY_DOCK_H_
#include <QDockWidget>
#include <QPointer>
#include <KoCanvasObserverBase.h>
#include <kis_canvas2.h>
#include <kis_types.h>
class QListWidget;
class QListWidgetItem;
class PresetHistoryDock : public QDockWidget, public KoCanvasObserverBase {
Q_OBJECT
public:
PresetHistoryDock();
- QString observerName() { return "PresetHistoryDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ QString observerName() override { return "PresetHistoryDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private Q_SLOTS:
void presetSelected(QListWidgetItem* item);
void canvasResourceChanged(int key, const QVariant& v);
private:
void addPreset(KisPaintOpPresetSP preset);
private:
QPointer<KisCanvas2> m_canvas;
QListWidget *m_presetHistory;
bool m_block;
bool m_initialized;
};
#endif
diff --git a/plugins/dockers/shapedockers/Plugin.h b/plugins/dockers/shapedockers/Plugin.h
index ec4f1b742a..96fc6177cf 100644
--- a/plugins/dockers/shapedockers/Plugin.h
+++ b/plugins/dockers/shapedockers/Plugin.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PLUGIN_H
#define PLUGIN_H
#include <QObject>
#include <QVariantList>
class Plugin : public QObject
{
Q_OBJECT
public:
Plugin(QObject *parent, const QVariantList &);
- ~Plugin() {}
+ ~Plugin() override {}
};
#endif
diff --git a/plugins/dockers/shapedockers/shapecollection/CollectionItemModel.h b/plugins/dockers/shapedockers/shapecollection/CollectionItemModel.h
index fcd481afa5..7f0731854e 100644
--- a/plugins/dockers/shapedockers/shapecollection/CollectionItemModel.h
+++ b/plugins/dockers/shapedockers/shapecollection/CollectionItemModel.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Peter Simonsson <peter.simonsson@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIVIOSHAPETEMPLATEMODEL_H
#define KIVIOSHAPETEMPLATEMODEL_H
#include <KoShape.h>
#include <QAbstractItemModel>
#include <QList>
#include <QString>
#include <QIcon>
class KoProperties;
/**
* Struct containing the information stored in CollectionItemModel item
*/
struct KoCollectionItem {
KoCollectionItem()
{
properties = 0;
};
QString id;
QString name;
QString toolTip;
QIcon icon;
const KoProperties *properties;
};
class CollectionItemModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit CollectionItemModel(QObject *parent = 0);
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
- virtual QStringList mimeTypes() const;
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
+ QStringList mimeTypes() const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
/**
* Set the list of KoCollectionItem to be stored in the model
*/
void setShapeTemplateList(const QList<KoCollectionItem> &newlist);
QList<KoCollectionItem> shapeTemplateList() const
{
return m_shapeTemplateList;
}
const KoProperties *properties(const QModelIndex &index) const;
private:
QList<KoCollectionItem> m_shapeTemplateList;
QString m_family;
};
#endif //KIVIOSHAPETEMPLATEMODEL_H
diff --git a/plugins/dockers/shapedockers/shapecollection/ShapeCollectionDocker.h b/plugins/dockers/shapedockers/shapecollection/ShapeCollectionDocker.h
index 10c71b8e1e..0fe04d0fae 100644
--- a/plugins/dockers/shapedockers/shapecollection/ShapeCollectionDocker.h
+++ b/plugins/dockers/shapedockers/shapecollection/ShapeCollectionDocker.h
@@ -1,124 +1,124 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Peter Simonsson <peter.simonsson@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSHAPECOLLECTIONDOCKER_H
#define KOSHAPECOLLECTIONDOCKER_H
#include <QDockWidget>
#include <QModelIndex>
#include <QMap>
#include <QIcon>
#include <KoDockFactoryBase.h>
#include <KoCanvasObserverBase.h>
class ShapeCollectionDockerFactory : public KoDockFactoryBase
{
public:
ShapeCollectionDockerFactory();
- virtual QString id() const;
- virtual QDockWidget *createDockWidget();
- DockPosition defaultDockPosition() const
+ QString id() const override;
+ QDockWidget *createDockWidget() override;
+ DockPosition defaultDockPosition() const override
{
return DockRight;
}
};
class CollectionItemModel;
class KoShape;
class QListView;
class QListWidget;
class QListWidgetItem;
class QToolButton;
class QMenu;
class QSpacerItem;
class QGridLayout;
class ShapeCollectionDocker : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
explicit ShapeCollectionDocker(QWidget *parent = 0);
/// reimplemented
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
protected Q_SLOTS:
/**
* Activates the shape creation tool when a shape is selected.
*/
void activateShapeCreationTool(const QModelIndex &index);
void activateShapeCreationToolFromQuick(const QModelIndex &index);
/**
* Changes the current shape collection
*/
void activateShapeCollection(QListWidgetItem *item);
/**
* Called when a collection is added from the add collection menu
*/
void loadCollection();
/// Called when the close collection button is clicked
void removeCurrentCollection();
/// Called when the docker changes area
void locationChanged(Qt::DockWidgetArea area);
protected:
/**
* Load the default calligra shapes
*/
void loadDefaultShapes();
/**
* Add a collection to the docker
*/
bool addCollection(const QString &id, const QString &title, CollectionItemModel *model);
void removeCollection(const QString &id);
/**
* Builds the menu for the Add Collection Button
*/
void buildAddCollectionMenu();
/// Generate an icon from @p shape
QIcon generateShapeIcon(KoShape *shape);
private:
void scanCollectionDir(const QString &dirName, QMenu *menu);
private:
QListView *m_quickView;
QToolButton *m_moreShapes;
QMenu *m_moreShapesContainer;
QListWidget *m_collectionChooser;
QListView *m_collectionView;
QToolButton *m_closeCollectionButton;
QToolButton *m_addCollectionButton;
QSpacerItem *m_spacer;
QGridLayout *m_layout;
QMap<QString, CollectionItemModel *> m_modelMap;
};
#endif //KOSHAPECOLLECTIONDOCKER_H
diff --git a/plugins/dockers/smallcolorselector/kis_small_color_widget.h b/plugins/dockers/smallcolorselector/kis_small_color_widget.h
index a78e919bce..8c8f22f5cd 100644
--- a/plugins/dockers/smallcolorselector/kis_small_color_widget.h
+++ b/plugins/dockers/smallcolorselector/kis_small_color_widget.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SMALL_COLOR_WIDGET_H_
#define _KIS_SMALL_COLOR_WIDGET_H_
#include <QWidget>
class KisSmallColorWidget : public QWidget
{
Q_OBJECT
public:
KisSmallColorWidget(QWidget* parent);
- ~KisSmallColorWidget();
+ ~KisSmallColorWidget() override;
public:
- void paintEvent(QPaintEvent * event);
- void resizeEvent(QResizeEvent * event);
- void mouseReleaseEvent(QMouseEvent * event);
- void mousePressEvent(QMouseEvent * event);
- void mouseMoveEvent(QMouseEvent * event);
+ void paintEvent(QPaintEvent * event) override;
+ void resizeEvent(QResizeEvent * event) override;
+ void mouseReleaseEvent(QMouseEvent * event) override;
+ void mousePressEvent(QMouseEvent * event) override;
+ void mouseMoveEvent(QMouseEvent * event) override;
public:
int hue() const;
int value() const;
int saturation() const;
QColor color() const;
public Q_SLOTS:
void setHue(int h);
void setHSV(int h, int s, int v);
void setQColor(const QColor&);
Q_SIGNALS:
void colorChanged(const QColor&);
private:
void tellColorChanged();
void updateParameters();
void generateRubber();
void generateSquare();
void selectColorAt(int _x, int _y);
private:
struct Private;
Private* const d;
};
#endif
diff --git a/plugins/dockers/smallcolorselector/smallcolorselector.h b/plugins/dockers/smallcolorselector/smallcolorselector.h
index 22bd0cad2f..8c78bfb170 100644
--- a/plugins/dockers/smallcolorselector/smallcolorselector.h
+++ b/plugins/dockers/smallcolorselector/smallcolorselector.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SMALLCOLORSELECTOR_H_
#define _SMALLCOLORSELECTOR_H_
#include <QObject>
#include <QVariant>
/**
* Template of view plugin
*/
class SmallColorSelectorPlugin : public QObject
{
Q_OBJECT
public:
SmallColorSelectorPlugin(QObject *parent, const QVariantList &);
- virtual ~SmallColorSelectorPlugin();
+ ~SmallColorSelectorPlugin() override;
};
#endif
diff --git a/plugins/dockers/smallcolorselector/smallcolorselector_dock.h b/plugins/dockers/smallcolorselector/smallcolorselector_dock.h
index f739f751bd..b794042457 100644
--- a/plugins/dockers/smallcolorselector/smallcolorselector_dock.h
+++ b/plugins/dockers/smallcolorselector/smallcolorselector_dock.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SMALLCOLORSELECTOR_DOCK_H_
#define _SMALLCOLORSELECTOR_DOCK_H_
#include <QPointer>
#include <QDockWidget>
#include <KoCanvasBase.h>
#include <KoCanvasObserverBase.h>
class KisSmallColorWidget;
class SmallColorSelectorDock : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT
public:
SmallColorSelectorDock();
- QString observerName() { return "SmallColorSelectorDock"; }
+ QString observerName() override { return "SmallColorSelectorDock"; }
/// reimplemented from KoCanvasObserverBase
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas() { m_canvas = 0; setEnabled(false); }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override { m_canvas = 0; setEnabled(false); }
public Q_SLOTS:
void colorChangedProxy(const QColor&);
void canvasResourceChanged(int, const QVariant&);
private:
KisSmallColorWidget* m_smallColorWidget;
QPointer<KoCanvasBase> m_canvas;
};
#endif
diff --git a/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.h b/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.h
index c0330f5e3b..889c8c6ea2 100644
--- a/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.h
+++ b/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SPECIFIC_COLOR_SELECTOR_WIDGET_H_
#define _KIS_SPECIFIC_COLOR_SELECTOR_WIDGET_H_
#include <QWidget>
#include <KoColor.h>
#include "kis_signal_auto_connection.h"
class KoColorSpace;
class QVBoxLayout;
class KisColorInput;
class KisColorSpaceSelector;
class QCheckBox;
class KisSignalCompressor;
class QSpacerItem;
class KisDisplayColorConverter;
class KisSpecificColorSelectorWidget : public QWidget
{
Q_OBJECT
public:
KisSpecificColorSelectorWidget(QWidget* parent);
- ~KisSpecificColorSelectorWidget();
+ ~KisSpecificColorSelectorWidget() override;
bool customColorSpaceUsed();
public Q_SLOTS:
void setDisplayConverter(KisDisplayColorConverter *colorConverter);
void setColorSpace(const KoColorSpace *cs, bool force = false);
void setColor(const KoColor&);
private Q_SLOTS:
void update();
void updateTimeout();
void setCustomColorSpace(const KoColorSpace *);
void rereadCurrentColorSpace(bool force = false);
Q_SIGNALS:
void colorChanged(const KoColor&);
void updated();
private:
QList<KisColorInput*> m_inputs;
const KoColorSpace* m_colorSpace;
QVBoxLayout *m_layout;
QSpacerItem *m_spacer;
KoColor m_color;
bool m_updateAllowed;
KisSignalCompressor *m_updateCompressor;
KisColorSpaceSelector *m_colorspaceSelector;
bool m_customColorSpaceSelected;
QCheckBox *m_chkShowColorSpaceSelector;
KisDisplayColorConverter *m_displayConverter;
KisSignalAutoConnectionsStore m_converterConnection;
};
#endif
diff --git a/plugins/dockers/specificcolorselector/specificcolorselector.h b/plugins/dockers/specificcolorselector/specificcolorselector.h
index 3aceac2778..52bec70c0b 100644
--- a/plugins/dockers/specificcolorselector/specificcolorselector.h
+++ b/plugins/dockers/specificcolorselector/specificcolorselector.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SPECIFICCOLORSELECTOR_H_
#define _SPECIFICCOLORSELECTOR_H_
#include <QObject>
#include <QVariant>
/**
* Template of view plugin
*/
class SpecificColorSelectorPlugin : public QObject
{
Q_OBJECT
public:
SpecificColorSelectorPlugin(QObject *parent, const QVariantList &);
- virtual ~SpecificColorSelectorPlugin();
+ ~SpecificColorSelectorPlugin() override;
};
#endif
diff --git a/plugins/dockers/specificcolorselector/specificcolorselector_dock.h b/plugins/dockers/specificcolorselector/specificcolorselector_dock.h
index bf6e287b14..e1b06b9f15 100644
--- a/plugins/dockers/specificcolorselector/specificcolorselector_dock.h
+++ b/plugins/dockers/specificcolorselector/specificcolorselector_dock.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SPECIFICCOLORSELECTOR_DOCK_H_
#define _SPECIFICCOLORSELECTOR_DOCK_H_
#include <QDockWidget>
#include <QPointer>
#include <kis_types.h>
#include <kis_mainwindow_observer.h>
#include <kis_canvas2.h>
class KisViewManager;
class KisSpecificColorSelectorWidget;
class SpecificColorSelectorDock : public QDockWidget, public KisMainwindowObserver
{
Q_OBJECT
public:
SpecificColorSelectorDock();
- QString observerName() { return "SpecificColorSelectorDock"; }
+ QString observerName() override { return "SpecificColorSelectorDock"; }
/// reimplemented from KoCanvasObserverBase/KisMainwindowObserver
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
- virtual void setMainWindow(KisViewManager* kisview);
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
+ void setMainWindow(KisViewManager* kisview) override;
private:
QPointer<KisCanvas2> m_canvas;
KisViewManager *m_view;
KisSpecificColorSelectorWidget* m_colorSelector;
};
#endif
diff --git a/plugins/dockers/tasksetdocker/taskset_resource.h b/plugins/dockers/tasksetdocker/taskset_resource.h
index e11a88f7be..39ee14b2e4 100644
--- a/plugins/dockers/tasksetdocker/taskset_resource.h
+++ b/plugins/dockers/tasksetdocker/taskset_resource.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TASKSET_RESOURCE_H
#define TASKSET_RESOURCE_H
#include <resources/KoResource.h>
#include <QStringList>
class TasksetResource : public KoResource
{
public:
TasksetResource(const QString& filename);
- virtual ~TasksetResource();
+ ~TasksetResource() override;
- virtual bool load();
- virtual bool loadFromDevice(QIODevice *dev);
- virtual bool save();
- virtual bool saveToDevice(QIODevice* dev) const;
+ bool load() override;
+ bool loadFromDevice(QIODevice *dev) override;
+ bool save() override;
+ bool saveToDevice(QIODevice* dev) const override;
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
void setActionList(const QStringList actions);
QStringList actionList();
private:
QStringList m_actions;
};
#endif // TASKSET_RESOURCE_H
diff --git a/plugins/dockers/tasksetdocker/tasksetdocker.h b/plugins/dockers/tasksetdocker/tasksetdocker.h
index 6eb5813eec..fbacf0eec4 100644
--- a/plugins/dockers/tasksetdocker/tasksetdocker.h
+++ b/plugins/dockers/tasksetdocker/tasksetdocker.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TASKSETDOCKER_H
#define TASKSETDOCKER_H
#include <QObject>
#include <QVariant>
/**
* Docker showing the channels of the current layer
*/
class TasksetDockerPlugin : public QObject
{
Q_OBJECT
public:
TasksetDockerPlugin(QObject *parent, const QVariantList &);
- virtual ~TasksetDockerPlugin();
+ ~TasksetDockerPlugin() override;
};
#endif
diff --git a/plugins/dockers/tasksetdocker/tasksetdocker_dock.h b/plugins/dockers/tasksetdocker/tasksetdocker_dock.h
index cdab4d4068..ffd3b52631 100644
--- a/plugins/dockers/tasksetdocker/tasksetdocker_dock.h
+++ b/plugins/dockers/tasksetdocker/tasksetdocker_dock.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TASKSETDOCKER_DOCK_H
#define TASKSETDOCKER_DOCK_H
#include <QDockWidget>
#include <QModelIndex>
#include <QPointer>
#include <KoCanvasObserverBase.h>
#include <KoResourceServer.h>
#include <kis_canvas2.h>
#include "taskset_resource.h"
#include "ui_wdgtasksetdocker.h"
class KoResourceLoaderThread;
class TasksetModel;
class TasksetDockerDock : public QDockWidget, public KoCanvasObserverBase, public Ui_WdgTasksetDocker {
Q_OBJECT
public:
TasksetDockerDock();
- ~TasksetDockerDock();
- QString observerName() { return "TasksetDockerDock"; }
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
+ ~TasksetDockerDock() override;
+ QString observerName() override { return "TasksetDockerDock"; }
+ void setCanvas(KoCanvasBase *canvas) override;
+ void unsetCanvas() override;
private Q_SLOTS:
void actionTriggered(QAction* action);
void activated (const QModelIndex& index);
void recordClicked();
void saveClicked();
void clearClicked();
void resourceSelected( KoResource * resource );
private:
QPointer<KisCanvas2> m_canvas;
TasksetModel *m_model;
bool m_blocked;
KoResourceServer<TasksetResource>* m_rserver;
KoResourceLoaderThread *m_taskThread;
};
#endif
diff --git a/plugins/dockers/tasksetdocker/tasksetmodel.h b/plugins/dockers/tasksetdocker/tasksetmodel.h
index f034412154..524d75ad28 100644
--- a/plugins/dockers/tasksetdocker/tasksetmodel.h
+++ b/plugins/dockers/tasksetdocker/tasksetmodel.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TASKSETMODEL_H
#define TASKSETMODEL_H
#include <QModelIndex>
#include <kis_types.h>
class QAction;
class TasksetModel : public QAbstractTableModel
{
Q_OBJECT
public:
TasksetModel(QObject* parent = 0);
- virtual ~TasksetModel();
+ ~TasksetModel() override;
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
- virtual Qt::ItemFlags flags(const QModelIndex& index) const;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ Qt::ItemFlags flags(const QModelIndex& index) const override;
void addAction(QAction* action);
QAction* actionFromIndex(const QModelIndex& index);
QVector<QAction*> actions();
public Q_SLOTS:
void clear();
private:
QVector<QAction*> m_actions;
};
#endif // TASKSETMODEL_H
diff --git a/plugins/extensions/animationrenderer/AnimationRenderer.cpp b/plugins/extensions/animationrenderer/AnimationRenderer.cpp
index 6ee8680e19..d65734ec56 100644
--- a/plugins/extensions/animationrenderer/AnimationRenderer.cpp
+++ b/plugins/extensions/animationrenderer/AnimationRenderer.cpp
@@ -1,180 +1,199 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "AnimationRenderer.h"
#include <QMessageBox>
#include <klocalizedstring.h>
#include <kpluginfactory.h>
#include <kis_image.h>
#include <KisViewManager.h>
#include <kis_node_manager.h>
#include <kis_image_manager.h>
#include <kis_action.h>
#include <kis_image_animation_interface.h>
#include <kis_properties_configuration.h>
#include <kis_config.h>
#include <kis_animation_exporter.h>
#include <KisDocument.h>
#include <KisMimeDatabase.h>
#include <kis_time_range.h>
#include <KisImportExportManager.h>
#include "DlgAnimationRenderer.h"
K_PLUGIN_FACTORY_WITH_JSON(AnimaterionRendererFactory, "kritaanimationrenderer.json", registerPlugin<AnimaterionRenderer>();)
AnimaterionRenderer::AnimaterionRenderer(QObject *parent, const QVariantList &)
: KisViewPlugin(parent)
{
// Shows the big dialog
KisAction *action = createAction("render_animation");
action->setActivationFlags(KisAction::IMAGE_HAS_ANIMATION);
connect(action, SIGNAL(triggered()), this, SLOT(slotRenderAnimation()));
// Re-renders the image sequence as defined in the last render
action = createAction("render_image_sequence_again");
action->setActivationFlags(KisAction::IMAGE_HAS_ANIMATION);
connect(action, SIGNAL(triggered()), this, SLOT(slotRenderSequenceAgain()));
}
AnimaterionRenderer::~AnimaterionRenderer()
{
}
void AnimaterionRenderer::slotRenderAnimation()
{
KisImageWSP image = m_view->image();
if (!image) return;
if (!image->animationInterface()->hasAnimation()) return;
KisDocument *doc = m_view->document();
doc->setFileProgressProxy();
doc->setFileProgressUpdater(i18n("Export frames"));
DlgAnimationRenderer dlgAnimationRenderer(doc, m_view->mainWindow());
dlgAnimationRenderer.setCaption(i18n("Render Animation"));
KisConfig kisConfig;
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
cfg->fromXML(kisConfig.exportConfiguration("IMAGESEQUENCE"));
dlgAnimationRenderer.setSequenceConfiguration(cfg);
cfg->clearProperties();
cfg->fromXML(kisConfig.exportConfiguration("ANIMATION_RENDERER"));
dlgAnimationRenderer.setVideoConfiguration(cfg);
cfg->clearProperties();
cfg->fromXML(kisConfig.exportConfiguration("FFMPEG_CONFIG"));
dlgAnimationRenderer.setEncoderConfiguration(cfg);
// update the UI to show the selected export options
dlgAnimationRenderer.updateExportUIOptions();
if (dlgAnimationRenderer.exec() == QDialog::Accepted) {
KisPropertiesConfigurationSP sequenceConfig = dlgAnimationRenderer.getSequenceConfiguration();
kisConfig.setExportConfiguration("IMAGESEQUENCE", sequenceConfig);
QString mimetype = sequenceConfig->getString("mimetype");
QString extension = KisMimeDatabase::suffixesForMimeType(mimetype).first();
QString baseFileName = QString("%1/%2.%3").arg(sequenceConfig->getString("directory"))
.arg(sequenceConfig->getString("basename"))
.arg(extension);
KisAnimationExportSaver exporter(doc, baseFileName, sequenceConfig->getInt("first_frame"), sequenceConfig->getInt("last_frame"), sequenceConfig->getInt("sequence_start"));
- bool success = exporter.exportAnimation(dlgAnimationRenderer.getFrameExportConfiguration()) == KisImportExportFilter::OK;
-
- // the folder could have been read-only or something else could happen
- if (success) {
+ KisImportExportFilter::ConversionStatus status =
+ exporter.exportAnimation(dlgAnimationRenderer.getFrameExportConfiguration());
+
+ if (status != KisImportExportFilter::OK) {
+ const QString msg = KisImportExportFilter::conversionStatusString(status);
+ QMessageBox::critical(0, i18nc("@title:window", "Krita"),
+ i18n("Could not export animation frames:\n%1", msg));
+ } else {
QString savedFilesMask = exporter.savedFilesMask();
KisPropertiesConfigurationSP videoConfig = dlgAnimationRenderer.getVideoConfiguration();
if (videoConfig) {
kisConfig.setExportConfiguration("ANIMATION_RENDERER", videoConfig);
KisPropertiesConfigurationSP encoderConfig = dlgAnimationRenderer.getEncoderConfiguration();
if (encoderConfig) {
kisConfig.setExportConfiguration("FFMPEG_CONFIG", encoderConfig);
encoderConfig->setProperty("savedFilesMask", savedFilesMask);
}
+ const QString fileName = videoConfig->getString("filename");
+ QString resultFile = fileName;
+ KIS_SAFE_ASSERT_RECOVER_NOOP(QFileInfo(resultFile).isAbsolute())
+
+ {
+ const QFileInfo info(resultFile);
+ QDir dir(info.absolutePath());
+
+ if (!dir.exists()) {
+ dir.mkpath(info.absolutePath());
+ }
+ KIS_SAFE_ASSERT_RECOVER_NOOP(dir.exists());
+ }
+
QSharedPointer<KisImportExportFilter> encoder = dlgAnimationRenderer.encoderFilter();
encoder->setMimeType(mimetype.toLatin1());
- QFile fi(videoConfig->getString("filename"));
+ QFile fi(resultFile);
+
KisImportExportFilter::ConversionStatus res;
if (!fi.open(QIODevice::WriteOnly)) {
qWarning() << "Could not open" << fi.fileName() << "for writing!";
res = KisImportExportFilter::CreationError;
}
else {
encoder->setFilename(fi.fileName());
res = encoder->convert(doc, &fi, encoderConfig);
fi.close();
}
if (res != KisImportExportFilter::OK) {
QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Could not render animation:\n%1", doc->errorMessage()));
}
if (videoConfig->getBool("delete_sequence", false)) {
QDir d(sequenceConfig->getString("directory"));
QStringList sequenceFiles = d.entryList(QStringList() << sequenceConfig->getString("basename") + "*." + extension, QDir::Files);
Q_FOREACH(const QString &f, sequenceFiles) {
d.remove(f);
}
}
}
}
}
doc->clearFileProgressUpdater();
doc->clearFileProgressProxy();
}
void AnimaterionRenderer::slotRenderSequenceAgain()
{
KisImageWSP image = m_view->image();
if (!image) return;
if (!image->animationInterface()->hasAnimation()) return;
KisDocument *doc = m_view->document();
doc->setFileProgressProxy(); doc->setFileProgressUpdater(i18n("Export frames"));
KisConfig kisConfig;
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
cfg->fromXML(kisConfig.exportConfiguration("IMAGESEQUENCE"));
QString mimetype = cfg->getString("mimetype");
QString extension = KisMimeDatabase::suffixesForMimeType(mimetype).first();
QString baseFileName = QString("%1/%2.%3").arg(cfg->getString("directory"))
.arg(cfg->getString("basename"))
.arg(extension);
KisAnimationExportSaver exporter(doc, baseFileName, cfg->getInt("first_frame"), cfg->getInt("last_frame"), cfg->getInt("sequence_start"));
bool success = exporter.exportAnimation();
Q_ASSERT(success);
doc->clearFileProgressUpdater();
doc->clearFileProgressProxy();
}
#include "AnimationRenderer.moc"
diff --git a/plugins/extensions/animationrenderer/AnimationRenderer.h b/plugins/extensions/animationrenderer/AnimationRenderer.h
index 7ad80f5b54..351b2cf6f6 100644
--- a/plugins/extensions/animationrenderer/AnimationRenderer.h
+++ b/plugins/extensions/animationrenderer/AnimationRenderer.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef ANIMATIONRENDERERIMAGE_H
#define ANIMATIONRENDERERIMAGE_H
#include <QVariant>
#include <kis_view_plugin.h>
class AnimaterionRenderer : public KisViewPlugin
{
Q_OBJECT
public:
AnimaterionRenderer(QObject *parent, const QVariantList &);
- virtual ~AnimaterionRenderer();
+ ~AnimaterionRenderer() override;
private Q_SLOTS:
void slotRenderAnimation();
void slotRenderSequenceAgain();
};
#endif // ANIMATIONRENDERERIMAGE_H
diff --git a/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp b/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp
index 1f2131a976..c1ac46fa3d 100644
--- a/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp
+++ b/plugins/extensions/animationrenderer/DlgAnimationRenderer.cpp
@@ -1,506 +1,541 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "DlgAnimationRenderer.h"
#include <QStandardPaths>
#include <QPluginLoader>
#include <QJsonObject>
#include <QMessageBox>
#include <QStringList>
#include <QProcess>
#include <klocalizedstring.h>
#include <kpluginfactory.h>
#include <KoResourcePaths.h>
#include <kis_properties_configuration.h>
#include <kis_debug.h>
#include <KisMimeDatabase.h>
#include <KoJsonTrader.h>
#include <KisImportExportFilter.h>
#include <kis_image.h>
#include <kis_image_animation_interface.h>
#include <kis_time_range.h>
#include <KisImportExportManager.h>
#include <kis_config_widget.h>
#include <KisDocument.h>
#include <QHBoxLayout>
#include <KisImportExportFilter.h>
#include <kis_config.h>
#include <kis_file_name_requester.h>
#include <KisDocument.h>
#include <KoDialog.h>
DlgAnimationRenderer::DlgAnimationRenderer(KisDocument *doc, QWidget *parent)
: KoDialog(parent)
, m_image(doc->image())
, m_doc(doc)
, m_defaultFileName(QFileInfo(doc->url().toLocalFile()).completeBaseName())
{
KisConfig cfg;
setCaption(i18n("Render Animation"));
setButtons(Ok | Cancel);
setDefaultButton(Ok);
if (m_defaultFileName.isEmpty()) {
m_defaultFileName = i18n("Untitled");
}
m_page = new WdgAnimaterionRenderer(this);
m_page->layout()->setMargin(0);
m_page->dirRequester->setMode(KoFileDialog::OpenDirectory);
QString lastLocation = cfg.readEntry<QString>("AnimationRenderer/last_sequence_export_location", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
m_page->dirRequester->setFileName(lastLocation);
m_page->intStart->setMinimum(doc->image()->animationInterface()->fullClipRange().start());
m_page->intStart->setMaximum(doc->image()->animationInterface()->fullClipRange().end());
m_page->intStart->setValue(doc->image()->animationInterface()->playbackRange().start());
m_page->intEnd->setMinimum(doc->image()->animationInterface()->fullClipRange().start());
m_page->intEnd->setMaximum(doc->image()->animationInterface()->fullClipRange().end());
m_page->intEnd->setValue(doc->image()->animationInterface()->playbackRange().end());
QFileInfo audioFileInfo(doc->image()->animationInterface()->audioChannelFileName());
const bool hasAudio = audioFileInfo.exists();
m_page->chkIncludeAudio->setEnabled(hasAudio);
m_page->chkIncludeAudio->setChecked(hasAudio && !doc->image()->animationInterface()->isAudioMuted());
QStringList mimes = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
mimes.sort();
Q_FOREACH(const QString &mime, mimes) {
QString description = KisMimeDatabase::descriptionForMimeType(mime);
if (description.isEmpty()) {
description = mime;
}
m_page->cmbMimetype->addItem(description, mime);
if (mime == "image/png") {
m_page->cmbMimetype->setCurrentIndex(m_page->cmbMimetype->count() - 1);
}
}
setMainWidget(m_page);
KoJsonTrader trader;
QList<QPluginLoader *>list = trader.query("Krita/AnimationExporter", "");
Q_FOREACH(QPluginLoader *loader, list) {
QJsonObject json = loader->metaData().value("MetaData").toObject();
QStringList mimetypes = json.value("X-KDE-Export").toString().split(",");
Q_FOREACH(const QString &mime, mimetypes) {
KLibFactory *factory = qobject_cast<KLibFactory *>(loader->instance());
if (!factory) {
warnUI << loader->errorString();
continue;
}
QObject* obj = factory->create<KisImportExportFilter>(0);
if (!obj || !obj->inherits("KisImportExportFilter")) {
delete obj;
continue;
}
QSharedPointer<KisImportExportFilter>filter(static_cast<KisImportExportFilter*>(obj));
if (!filter) {
delete obj;
continue;
}
m_renderFilters.append(filter);
QString description = KisMimeDatabase::descriptionForMimeType(mime);
if (description.isEmpty()) {
description = mime;
}
m_page->cmbRenderType->addItem(description, mime);
}
}
m_page->videoFilename->setMode(KoFileDialog::SaveFile);
m_page->videoFilename->setStartDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
qDeleteAll(list);
connect(m_page->bnExportOptions, SIGNAL(clicked()), this, SLOT(sequenceMimeTypeSelected()));
connect(m_page->bnRenderOptions, SIGNAL(clicked()), this, SLOT(selectRenderOptions()));
m_page->ffmpegLocation->setFileName(findFFMpeg());
m_page->ffmpegLocation->setMode(KoFileDialog::OpenFile);
connect(m_page->ffmpegLocation, SIGNAL(fileSelected(QString)), this, SLOT(ffmpegLocationChanged(QString)));
m_page->cmbRenderType->setCurrentIndex(cfg.readEntry<int>("AnimationRenderer/render_type", 0));
connect(m_page->shouldExportOnlyImageSequence, SIGNAL(toggled(bool)), this, SLOT(slotExportTypeChanged()));
connect(m_page->shouldExportOnlyVideo, SIGNAL(toggled(bool)), this, SLOT(slotExportTypeChanged()));
connect(m_page->shouldExportAll, SIGNAL(toggled(bool)), this, SLOT(slotExportTypeChanged()));
updateExportUIOptions();
// connect and cold init
connect(m_page->cmbRenderType, SIGNAL(currentIndexChanged(int)), this, SLOT(selectRenderType(int)));
selectRenderType(m_page->cmbRenderType->currentIndex());
resize(m_page->sizeHint());
}
DlgAnimationRenderer::~DlgAnimationRenderer()
{
KisConfig cfg;
cfg.writeEntry<QString>("AnimationRenderer/last_sequence_export_location", m_page->dirRequester->fileName());
cfg.writeEntry<int>("AnimationRenderer/render_type", m_page->cmbRenderType->currentIndex());
cfg.setCustomFFMpegPath(m_page->ffmpegLocation->fileName());
if (m_encoderConfigWidget) {
m_encoderConfigWidget->setParent(0);
m_encoderConfigWidget->deleteLater();
}
if (m_frameExportConfigWidget) {
m_frameExportConfigWidget->setParent(0);
m_frameExportConfigWidget->deleteLater();
}
delete m_page;
}
+QString DlgAnimationRenderer::fetchRenderingDirectory() const
+{
+ QString result = m_page->dirRequester->fileName();
+
+ if (m_page->shouldExportOnlyVideo->isChecked()) {
+ const QFileInfo info(fetchRenderingFileName());
+
+ if (info.isAbsolute()) {
+ result = info.absolutePath();
+ }
+ }
+
+ return result;
+}
+
+QString DlgAnimationRenderer::fetchRenderingFileName() const
+{
+ QString filename = m_page->videoFilename->fileName();
+
+ if (QFileInfo(filename).completeSuffix().isEmpty()) {
+ QString mimetype = m_page->cmbRenderType->itemData(m_page->cmbRenderType->currentIndex()).toString();
+ filename += "." + KisMimeDatabase::suffixesForMimeType(mimetype).first();
+ }
+
+ if (QFileInfo(filename).isRelative()) {
+ QDir baseDir(m_page->dirRequester->fileName());
+
+ if (m_page->shouldExportOnlyVideo->isChecked()) {
+ QString documentDir = QFileInfo(m_doc->url().toLocalFile()).absolutePath();
+ if (!documentDir.isEmpty()) {
+ baseDir = documentDir;
+ }
+ }
+
+ filename = baseDir.absoluteFilePath(filename);
+ }
+
+ return filename;
+}
+
KisPropertiesConfigurationSP DlgAnimationRenderer::getSequenceConfiguration() const
{
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
cfg->setProperty("basename", m_page->txtBasename->text());
cfg->setProperty("last_document_path", m_doc->localFilePath());
- cfg->setProperty("directory", m_page->dirRequester->fileName());
+ cfg->setProperty("directory", fetchRenderingDirectory());
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
cfg->setProperty("mimetype", m_page->cmbMimetype->currentData().toString());
return cfg;
}
void DlgAnimationRenderer::setSequenceConfiguration(KisPropertiesConfigurationSP cfg)
{
m_page->txtBasename->setText(cfg->getString("basename", "frame"));
if (cfg->getString("last_document_path") != m_doc->localFilePath()) {
cfg->removeProperty("first_frame");
cfg->removeProperty("last_frame");
cfg->removeProperty("sequence_start");
}
m_page->dirRequester->setFileName(cfg->getString("directory", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)));
m_page->intStart->setValue(cfg->getInt("first_frame", m_image->animationInterface()->playbackRange().start()));
m_page->intEnd->setValue(cfg->getInt("last_frame", m_image->animationInterface()->playbackRange().end()));
m_page->sequenceStart->setValue(cfg->getInt("sequence_start", m_image->animationInterface()->playbackRange().start()));
QString mimetype = cfg->getString("mimetype");
for (int i = 0; i < m_page->cmbMimetype->count(); ++i) {
if (m_page->cmbMimetype->itemData(i).toString() == mimetype) {
m_page->cmbMimetype->setCurrentIndex(i);
break;
}
}
}
KisPropertiesConfigurationSP DlgAnimationRenderer::getFrameExportConfiguration() const
{
if (m_frameExportConfigWidget) {
KisPropertiesConfigurationSP cfg = m_frameExportConfigWidget->configuration();
cfg->setProperty("basename", m_page->txtBasename->text());
- cfg->setProperty("directory", m_page->dirRequester->fileName());
+ cfg->setProperty("directory", fetchRenderingDirectory());
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
cfg->setProperty("ffmpeg_path", m_page->ffmpegLocation->fileName());
return m_frameExportConfigWidget->configuration();
}
return 0;
}
KisPropertiesConfigurationSP DlgAnimationRenderer::getVideoConfiguration() const
{
// don't continue if we are only exporting image sequence
if (m_page->shouldExportOnlyImageSequence->isChecked()) {
return 0;
}
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
- QString filename = m_page->videoFilename->fileName();
- if (QFileInfo(filename).completeSuffix().isEmpty()) {
- QString mimetype = m_page->cmbRenderType->itemData(m_page->cmbRenderType->currentIndex()).toString();
- filename += "." + KisMimeDatabase::suffixesForMimeType(mimetype).first();
- }
- cfg->setProperty("filename", filename);
+ cfg->setProperty("filename", fetchRenderingFileName());
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
// delete image sequence if we are only exporting out video
cfg->setProperty("delete_sequence", m_page->shouldExportOnlyVideo->isChecked());
return cfg;
}
void DlgAnimationRenderer::setVideoConfiguration(KisPropertiesConfigurationSP /*cfg*/)
{
}
KisPropertiesConfigurationSP DlgAnimationRenderer::getEncoderConfiguration() const
{
// don't continue if we are only exporting image sequence
if (m_page->shouldExportOnlyImageSequence->isChecked()) {
return 0;
}
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
if (m_encoderConfigWidget) {
cfg = m_encoderConfigWidget->configuration();
}
cfg->setProperty("mimetype", m_page->cmbRenderType->currentData().toString());
- cfg->setProperty("directory", m_page->dirRequester->fileName());
+ cfg->setProperty("directory", fetchRenderingDirectory());
cfg->setProperty("first_frame", m_page->intStart->value());
cfg->setProperty("last_frame", m_page->intEnd->value());
cfg->setProperty("sequence_start", m_page->sequenceStart->value());
cfg->setProperty("include_audio", m_page->chkIncludeAudio->isChecked());
return cfg;
}
void DlgAnimationRenderer::setEncoderConfiguration(KisPropertiesConfigurationSP /*cfg*/)
{
}
QSharedPointer<KisImportExportFilter> DlgAnimationRenderer::encoderFilter() const
{
if (m_page->cmbRenderType->currentIndex() < m_renderFilters.size()) {
return m_renderFilters[m_page->cmbRenderType->currentIndex()];
}
return QSharedPointer<KisImportExportFilter>(0);
}
void DlgAnimationRenderer::selectRenderType(int index)
{
if (index >= m_renderFilters.size()) return;
QString mimetype = m_page->cmbRenderType->itemData(index).toString();
if (!m_page->videoFilename->fileName().isEmpty() && QFileInfo(m_page->videoFilename->fileName()).completeBaseName() != m_defaultFileName) {
m_defaultFileName = QFileInfo(m_page->videoFilename->fileName()).completeBaseName();
}
m_page->videoFilename->setMimeTypeFilters(QStringList() << mimetype, mimetype);
m_page->videoFilename->setFileName(m_defaultFileName + "." + KisMimeDatabase::suffixesForMimeType(mimetype).first());
}
void DlgAnimationRenderer::selectRenderOptions()
{
int index = m_page->cmbRenderType->currentIndex();
if (m_encoderConfigWidget) {
m_encoderConfigWidget->deleteLater();
m_encoderConfigWidget = 0;
}
if (index >= m_renderFilters.size()) return;
QSharedPointer<KisImportExportFilter> filter = m_renderFilters[index];
QString mimetype = m_page->cmbRenderType->itemData(index).toString();
if (filter) {
m_encoderConfigWidget = filter->createConfigurationWidget(0, KisDocument::nativeFormatMimeType(), mimetype.toLatin1());
if (m_encoderConfigWidget) {
m_encoderConfigWidget->setConfiguration(filter->lastSavedConfiguration("", mimetype.toLatin1()));
KoDialog dlg(this);
dlg.setMainWidget(m_encoderConfigWidget);
dlg.setButtons(KoDialog::Ok | KoDialog::Cancel);
if (!dlg.exec()) {
m_encoderConfigWidget->setConfiguration(filter->lastSavedConfiguration());
}
dlg.setMainWidget(0);
m_encoderConfigWidget->hide();
m_encoderConfigWidget->setParent(0);
}
}
else {
m_encoderConfigWidget = 0;
}
}
void DlgAnimationRenderer::sequenceMimeTypeSelected()
{
int index = m_page->cmbMimetype->currentIndex();
if (m_frameExportConfigWidget) {
m_frameExportConfigWidget->deleteLater();
m_frameExportConfigWidget = 0;
}
QString mimetype = m_page->cmbMimetype->itemData(index).toString();
QSharedPointer<KisImportExportFilter> filter(KisImportExportManager::filterForMimeType(mimetype, KisImportExportManager::Export));
if (filter) {
m_frameExportConfigWidget = filter->createConfigurationWidget(0, KisDocument::nativeFormatMimeType(), mimetype.toLatin1());
if (m_frameExportConfigWidget) {
m_frameExportConfigWidget->setConfiguration(filter->lastSavedConfiguration("", mimetype.toLatin1()));
KoDialog dlg(this);
dlg.setMainWidget(m_frameExportConfigWidget);
dlg.setButtons(KoDialog::Ok | KoDialog::Cancel);
if (!dlg.exec()) {
m_frameExportConfigWidget->setConfiguration(filter->lastSavedConfiguration());
}
m_frameExportConfigWidget->hide();
m_frameExportConfigWidget->setParent(0);
dlg.setMainWidget(0);
}
}
}
void DlgAnimationRenderer::ffmpegLocationChanged(const QString &s)
{
KisConfig cfg;
cfg.setCustomFFMpegPath(s);
}
void DlgAnimationRenderer::updateExportUIOptions() {
KisConfig cfg;
// read in what type to export to. Defaults to image sequence only
QString exportType = cfg.readEntry<QString>("AnimationRenderer/export_type", "ImageSequence");
if (exportType == "ImageSequence") {
m_page->shouldExportOnlyImageSequence->setChecked(true);
} else if (exportType == "Video") {
m_page->shouldExportOnlyVideo->setChecked(true);
} else {
m_page->shouldExportAll->setChecked(true); // export to both
}
}
void DlgAnimationRenderer::slotButtonClicked(int button)
{
if (button == KoDialog::Ok && !m_page->shouldExportOnlyImageSequence->isChecked()) {
QString ffmpeg = m_page->ffmpegLocation->fileName();
if (m_page->videoFilename->fileName().isEmpty()) {
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("Please enter a file name to render to."));
return;
}
else if (ffmpeg.isEmpty()) {
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("The location of FFmpeg is unknown. Please install FFmpeg first: Krita cannot render animations without FFmpeg. (<a href=\"https://www.ffmpeg.org\">www.ffmpeg.org</a>)"));
return;
}
else {
QFileInfo fi(ffmpeg);
if (!fi.exists()) {
QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("The location of FFmpeg is invalid. Please select the correct location of the FFmpeg executable on your system."));
return;
}
}
}
KoDialog::slotButtonClicked(button);
}
QString DlgAnimationRenderer::findFFMpeg()
{
QString result;
QStringList proposedPaths;
QString customPath = KisConfig().customFFMpegPath();
proposedPaths << customPath;
proposedPaths << customPath + QDir::separator() + "ffmpeg";
proposedPaths << QDir::homePath() + "/bin/ffmpeg";
proposedPaths << "/usr/bin/ffmpeg";
proposedPaths << "/usr/local/bin/ffmpeg";
proposedPaths << KoResourcePaths::getApplicationRoot() +
QDir::separator() + "bin" + QDir::separator() + "ffmpeg";
Q_FOREACH (const QString &path, proposedPaths) {
if (path.isEmpty()) continue;
QProcess testProcess;
testProcess.start(path, QStringList() << "-version");
testProcess.waitForFinished(1000);
const bool successfulStart =
testProcess.state() == QProcess::NotRunning &&
testProcess.error() == QProcess::UnknownError;
if (successfulStart) {
result = path;
break;
}
}
return result;
}
void DlgAnimationRenderer::slotExportTypeChanged()
{
KisConfig cfg;
// if a video format needs to be outputted
if (m_page->shouldExportAll->isChecked() || m_page->shouldExportOnlyVideo->isChecked()) {
// videos always uses PNG for creating video, so disable the ability to change the format
m_page->cmbMimetype->setEnabled(false);
for (int i = 0; i < m_page->cmbMimetype->count(); ++i) {
if (m_page->cmbMimetype->itemData(i).toString() == "image/png") {
m_page->cmbMimetype->setCurrentIndex(i);
break;
}
}
}
// if only exporting video
- if (m_page->shouldExportOnlyVideo) {
+ if (m_page->shouldExportOnlyVideo->isChecked()) {
m_page->cmbMimetype->setEnabled(false); // allow to change image format
m_page->imageSequenceOptionsGroup->setVisible(false);
m_page->videoOptionsGroup->setVisible(false); //shrinks the horizontal space temporarily to help resize() work
m_page->videoOptionsGroup->setVisible(true);
cfg.writeEntry<QString>("AnimationRenderer/export_type", "Video");
}
// if only an image sequence needs to be output
if (m_page->shouldExportOnlyImageSequence->isChecked()) {
m_page->cmbMimetype->setEnabled(true); // allow to change image format
m_page->videoOptionsGroup->setVisible(false);
m_page->imageSequenceOptionsGroup->setVisible(true);
cfg.writeEntry<QString>("AnimationRenderer/export_type", "ImageSequence");
}
// show all options
if (m_page->shouldExportAll->isChecked() ) {
m_page->imageSequenceOptionsGroup->setVisible(true);
m_page->videoOptionsGroup->setVisible(true);
cfg.writeEntry<QString>("AnimationRenderer/export_type", "VideoAndImageSequence");
}
// for the resize to work as expected, try to hide elements first before displaying other ones.
// if the widget gets bigger at any point, the resize will use that, even if elements are hidden later to make it smaller
resize(m_page->sizeHint());
}
diff --git a/plugins/extensions/animationrenderer/DlgAnimationRenderer.h b/plugins/extensions/animationrenderer/DlgAnimationRenderer.h
index d8b60344a0..59a7baf21e 100644
--- a/plugins/extensions/animationrenderer/DlgAnimationRenderer.h
+++ b/plugins/extensions/animationrenderer/DlgAnimationRenderer.h
@@ -1,99 +1,103 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_ANIMATIONRENDERERIMAGE
#define DLG_ANIMATIONRENDERERIMAGE
#include <KoDialog.h>
#include <kis_properties_configuration.h>
#include "ui_wdg_animationrenderer.h"
#include <QSharedPointer>
#include <kis_types.h>
class KisDocument;
class KisImportExportFilter;
class KisConfigWidget;
class QHBoxLayout;
class WdgAnimaterionRenderer : public QWidget, public Ui::WdgAnimaterionRenderer
{
Q_OBJECT
public:
WdgAnimaterionRenderer(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
};
class DlgAnimationRenderer: public KoDialog
{
Q_OBJECT
public:
DlgAnimationRenderer(KisDocument *doc, QWidget *parent = 0);
- ~DlgAnimationRenderer();
+ ~DlgAnimationRenderer() override;
KisPropertiesConfigurationSP getSequenceConfiguration() const;
void setSequenceConfiguration(KisPropertiesConfigurationSP cfg);
KisPropertiesConfigurationSP getFrameExportConfiguration() const;
KisPropertiesConfigurationSP getVideoConfiguration() const;
void setVideoConfiguration(KisPropertiesConfigurationSP cfg);
KisPropertiesConfigurationSP getEncoderConfiguration() const;
void setEncoderConfiguration(KisPropertiesConfigurationSP cfg);
QSharedPointer<KisImportExportFilter> encoderFilter() const;
// fires when the render animation action is called. makes sure the correct export type is selected for the UI
void updateExportUIOptions();
private Q_SLOTS:
void selectRenderType(int i);
void selectRenderOptions();
void sequenceMimeTypeSelected();
void ffmpegLocationChanged(const QString&);
void slotExportTypeChanged();
protected Q_SLOTS:
- void slotButtonClicked(int button);
+ void slotButtonClicked(int button) override;
+
+private:
+ QString fetchRenderingDirectory() const;
+ QString fetchRenderingFileName() const;
private:
static QString findFFMpeg();
KisImageSP m_image;
KisDocument *m_doc;
WdgAnimaterionRenderer *m_page {0};
QList<QSharedPointer<KisImportExportFilter>> m_renderFilters;
KisConfigWidget *m_encoderConfigWidget {0};
KisConfigWidget *m_frameExportConfigWidget {0};
QString m_defaultFileName;
};
#endif // DLG_ANIMATIONRENDERERIMAGE
diff --git a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.h b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.h
index 0a371f6342..8ad167b9be 100644
--- a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.h
+++ b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ACTIONS_EDITOR_H_
#define _KIS_ACTIONS_EDITOR_H_
#include <QWidget>
class KisMacro;
class KisMacroModel;
class KisRecordedAction;
class QModelIndex;
class QGridLayout;
namespace Ui
{
class ActionsEditor;
}
class KisActionsEditor : public QWidget
{
Q_OBJECT
public:
KisActionsEditor(QWidget* parent);
- ~KisActionsEditor();
+ ~KisActionsEditor() override;
void setMacro(KisMacro*);
private Q_SLOTS:
void slotCreateAction(const QString& _id);
void slotActionActivated(const QModelIndex&);
void slotBtnDelete();
void slotBtnDuplicate();
void slotBtnRaise();
void slotBtnLower();
private:
void setCurrentAction(KisRecordedAction* _action);
private:
QWidget* m_currentEditor;
Ui::ActionsEditor* m_form;
KisMacro* m_macro;
KisMacroModel* m_model;
QGridLayout* m_widgetLayout;
};
#endif
diff --git a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_dialog.h b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_dialog.h
index 8164dfa3ba..8ca9a824c2 100644
--- a/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_dialog.h
+++ b/plugins/extensions/bigbrother/actionseditor/kis_actions_editor_dialog.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ACTIONS_EDITOR_DIALOG_H_
#define _KIS_ACTIONS_EDITOR_DIALOG_H_
#include <KoDialog.h>
class KisActionsEditor;
class KisActionsEditorDialog : public KoDialog
{
public:
KisActionsEditorDialog(QWidget* parent);
- ~KisActionsEditorDialog();
+ ~KisActionsEditorDialog() override;
KisActionsEditor* actionsEditor();
private:
KisActionsEditor* m_actionsEditor;
};
#endif
diff --git a/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h b/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h
index 6b14097258..8cd9189f8c 100644
--- a/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h
+++ b/plugins/extensions/bigbrother/actionseditor/kis_macro_model.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_MACRO_MODEL_H_
#define _KIS_MACRO_MODEL_H_
#include <QAbstractListModel>
class KisRecordedAction;
class KisMacro;
class KisMacroModel : public QAbstractListModel
{
public:
KisMacroModel(KisMacro*);
- ~KisMacroModel();
- virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
- virtual Qt::ItemFlags flags(const QModelIndex & index) const;
- virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
- virtual bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
+ ~KisMacroModel() override;
+ int rowCount(const QModelIndex & parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex & index) const override;
+ bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override;
+ bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()) override;
void addAction(const QModelIndex& _after, const KisRecordedAction& _action);
void duplicateAction(const QModelIndex& index);
void raise(const QModelIndex& index);
void lower(const QModelIndex& index);
private:
KisMacro* m_macro;
};
#endif
diff --git a/plugins/extensions/bigbrother/bigbrother.h b/plugins/extensions/bigbrother/bigbrother.h
index 4b6a3115cd..9459248136 100644
--- a/plugins/extensions/bigbrother/bigbrother.h
+++ b/plugins/extensions/bigbrother/bigbrother.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2007 Cyrille Berger (cberger@cberger.net)
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _BIGBROTHER_H_
#define _BIGBROTHER_H_
#include <QVariant>
#include <kis_view_plugin.h>
class KisAction;
class KisMacro;
class KisViewManager;
class BigBrotherPlugin : public KisViewPlugin
{
Q_OBJECT
public:
BigBrotherPlugin(QObject *parent, const QVariantList &);
- virtual ~BigBrotherPlugin();
+ ~BigBrotherPlugin() override;
private Q_SLOTS:
void slotOpenPlay();
void slotOpenEdit();
void slotStartRecordingMacro();
void slotStopRecordingMacro();
private:
void saveMacro(const KisMacro* macro);
KisMacro *openMacro();
private:
KisViewManager *m_view;
KisMacro *m_recorder;
KisAction *m_startRecordingMacroAction;
KisAction *m_stopRecordingMacroAction;
};
#endif // bigbrotherPlugin_H
diff --git a/plugins/extensions/clonesarray/clonesarray.h b/plugins/extensions/clonesarray/clonesarray.h
index 986e878134..63ab9213af 100644
--- a/plugins/extensions/clonesarray/clonesarray.h
+++ b/plugins/extensions/clonesarray/clonesarray.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CLONESARRAY_H
#define CLONESARRAY_H
#include <kis_view_plugin.h>
#include <kis_types.h>
class ClonesArray : public KisViewPlugin
{
Q_OBJECT
public:
ClonesArray(QObject *parent, const QVariantList &);
- virtual ~ClonesArray();
+ ~ClonesArray() override;
private Q_SLOTS:
void slotCreateClonesArray();
};
#endif // CLONESARRAY<_H
diff --git a/plugins/extensions/clonesarray/dlg_clonesarray.h b/plugins/extensions/clonesarray/dlg_clonesarray.h
index 67f9828884..dac2cb9add 100644
--- a/plugins/extensions/clonesarray/dlg_clonesarray.h
+++ b/plugins/extensions/clonesarray/dlg_clonesarray.h
@@ -1,79 +1,79 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_CLONESARRAY
#define DLG_CLONESARRAY
#include <KoDialog.h>
#include <kis_global.h>
#include "kis_types.h"
#include "ui_wdg_clonesarray.h"
class KisViewManager;
class KisProcessingApplicator;
class WdgClonesArray : public QWidget, public Ui::WdgClonesArray
{
Q_OBJECT
public:
WdgClonesArray(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgClonesArray: public KoDialog
{
Q_OBJECT
public:
DlgClonesArray(KisViewManager *view, QWidget * parent = 0);
- ~DlgClonesArray();
+ ~DlgClonesArray() override;
private Q_SLOTS:
void okClicked();
void applyClicked();
void cancelClicked();
void syncOrthogonalToAngular();
void syncAngularToOrthogonal();
void setDirty();
void updateCheckboxAvailability();
private:
void setOrthogonalSignalsEnabled(bool value);
void setAngularSignalsEnabled(bool value);
void initializeValues();
void reapplyClones();
void setClean();
private:
WdgClonesArray *m_page;
KisViewManager *m_view;
KisProcessingApplicator *m_applicator;
KisLayerSP m_baseLayer;
bool m_isDirty;
};
#endif // DLG_CLONESARRAY
diff --git a/plugins/extensions/colorrange/colorrange.h b/plugins/extensions/colorrange/colorrange.h
index ecb77b71c6..e1ab5192b5 100644
--- a/plugins/extensions/colorrange/colorrange.h
+++ b/plugins/extensions/colorrange/colorrange.h
@@ -1,40 +1,40 @@
/*
* colorrange.h -- Part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLORRANGE_H
#define COLORRANGE_H
#include <QVariant>
#include <kis_view_plugin.h>
class ColorRange : public KisViewPlugin
{
Q_OBJECT
public:
ColorRange(QObject *parent, const QVariantList &);
- virtual ~ColorRange();
+ ~ColorRange() override;
private Q_SLOTS:
void slotActivated();
void selectOpaque();
};
#endif // COLORRANGE_H
diff --git a/plugins/extensions/colorrange/dlg_colorrange.h b/plugins/extensions/colorrange/dlg_colorrange.h
index ec97516451..7c4858b8f9 100644
--- a/plugins/extensions/colorrange/dlg_colorrange.h
+++ b/plugins/extensions/colorrange/dlg_colorrange.h
@@ -1,100 +1,100 @@
/*
* dlg_colorrange.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_COLORRANGE
#define DLG_COLORRANGE
#include <QCursor>
#include <KoDialog.h>
#include <kis_selection.h> // For enums
#include <kis_pixel_selection.h>
#include <kis_types.h>
#include <kis_global.h>
#include "ui_wdg_colorrange.h"
class KisViewManager;
class DlgColorRange;
enum enumAction {
REDS,
YELLOWS,
GREENS,
CYANS,
BLUES,
MAGENTAS,
HIGHLIGHTS,
MIDTONES,
SHADOWS
};
class WdgColorRange : public QWidget, public Ui::WdgColorRange
{
Q_OBJECT
public:
WdgColorRange(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* This dialog allows the user to create a selection mask based
* on a (range of) colors.
*/
class DlgColorRange: public KoDialog
{
Q_OBJECT
public:
DlgColorRange(KisViewManager *view, QWidget *parent = 0);
- ~DlgColorRange();
+ ~DlgColorRange() override;
private Q_SLOTS:
void okClicked();
void cancelClicked();
void slotInvertClicked();
void slotSelectionTypeChanged(int index);
void slotSubtract(bool on);
void slotAdd(bool on);
void slotSelectClicked();
void slotDeselectClicked();
private:
QImage createMask(KisSelectionSP selection, KisPaintDeviceSP layer);
private:
WdgColorRange * m_page;
KisViewManager * m_view;
SelectionAction m_mode;
QCursor m_oldCursor;
enumAction m_currentAction;
bool m_invert;
int m_selectionCommandsAdded;
};
#endif // DLG_COLORRANGE
diff --git a/plugins/extensions/colorspaceconversion/colorspaceconversion.h b/plugins/extensions/colorspaceconversion/colorspaceconversion.h
index aa0d75dd26..66569aaa67 100644
--- a/plugins/extensions/colorspaceconversion/colorspaceconversion.h
+++ b/plugins/extensions/colorspaceconversion/colorspaceconversion.h
@@ -1,44 +1,44 @@
/*
* colorspaceconversion.h -- Part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLORSPACECONVERSION_H
#define COLORSPACECONVERSION_H
#include <QVariant>
#include <kis_view_plugin.h>
/**
* Dialog for converting between color models.
*/
class ColorSpaceConversion : public KisViewPlugin
{
Q_OBJECT
public:
ColorSpaceConversion(QObject *parent, const QVariantList &);
- virtual ~ColorSpaceConversion();
+ ~ColorSpaceConversion() override;
private Q_SLOTS:
void slotImageColorSpaceConversion();
void slotLayerColorSpaceConversion();
};
#endif // COLORSPACECONVERSION_H
diff --git a/plugins/extensions/colorspaceconversion/dlg_colorspaceconversion.h b/plugins/extensions/colorspaceconversion/dlg_colorspaceconversion.h
index 63a2432c34..9f0152466d 100644
--- a/plugins/extensions/colorspaceconversion/dlg_colorspaceconversion.h
+++ b/plugins/extensions/colorspaceconversion/dlg_colorspaceconversion.h
@@ -1,67 +1,67 @@
/*
* dlg_colorspaceconversion.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_COLORSPACECONVERSION
#define DLG_COLORSPACECONVERSION
#include <QButtonGroup>
#include <KoDialog.h>
#include <KoID.h>
#include "ui_wdgconvertcolorspace.h"
class KoColorSpace;
class WdgConvertColorSpace : public QWidget, public Ui::WdgConvertColorSpace
{
Q_OBJECT
public:
WdgConvertColorSpace(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* XXX
*/
class DlgColorSpaceConversion: public KoDialog
{
Q_OBJECT
public:
DlgColorSpaceConversion(QWidget * parent = 0, const char* name = 0);
- ~DlgColorSpaceConversion();
+ ~DlgColorSpaceConversion() override;
void setInitialColorSpace(const KoColorSpace *cs);
WdgConvertColorSpace * m_page;
QButtonGroup m_intentButtonGroup;
public Q_SLOTS:
void selectionChanged(bool);
void okClicked();
};
#endif // DLG_COLORSPACECONVERSION
diff --git a/plugins/extensions/histogram/dlg_histogram.h b/plugins/extensions/histogram/dlg_histogram.h
index 0894cc9fed..9ac59133e7 100644
--- a/plugins/extensions/histogram/dlg_histogram.h
+++ b/plugins/extensions/histogram/dlg_histogram.h
@@ -1,55 +1,55 @@
/*
* dlg_histogram.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_HISTOGRAM
#define DLG_HISTOGRAM
#include <KoDialog.h>
#include "kis_types.h"
class KisHistogramWidget;
/**
* This dialog shows the histogram for the (selected) portion
* of the current layer.
*
* XXX: Also for complete image?
*/
class DlgHistogram: public KoDialog
{
Q_OBJECT
public:
DlgHistogram(QWidget * parent = 0,
const char* name = 0);
- ~DlgHistogram();
+ ~DlgHistogram() override;
void setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds);
private Q_SLOTS:
void okClicked();
private:
KisHistogramWidget * m_page;
};
#endif // DLG_HISTOGRAM
diff --git a/plugins/extensions/histogram/histogram.h b/plugins/extensions/histogram/histogram.h
index 8acc177563..c7fe795293 100644
--- a/plugins/extensions/histogram/histogram.h
+++ b/plugins/extensions/histogram/histogram.h
@@ -1,39 +1,39 @@
/*
* histogram.h -- Part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef HISTOGRAM_H
#define HISTOGRAM_H
#include <QVariant>
#include <kis_view_plugin.h>
class Histogram : public KisViewPlugin
{
Q_OBJECT
public:
Histogram(QObject *parent, const QVariantList &);
- virtual ~Histogram();
+ ~Histogram() override;
private Q_SLOTS:
void slotActivated();
};
#endif // HISTOGRAM_H
diff --git a/plugins/extensions/histogram/kis_histogram_widget.h b/plugins/extensions/histogram/kis_histogram_widget.h
index fc13628567..6cb9f4faf7 100644
--- a/plugins/extensions/histogram/kis_histogram_widget.h
+++ b/plugins/extensions/histogram/kis_histogram_widget.h
@@ -1,92 +1,92 @@
/*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HISTOGRAM_WIDGET_
#define KIS_HISTOGRAM_WIDGET_
#include "kis_types.h"
#include "ui_wdghistogram.h"
#include "KoHistogramProducer.h"
class WdgHistogram : public QWidget, public Ui::WdgHistogram
{
Q_OBJECT
public:
WdgHistogram(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* The histogram widget takes a paint device or an image and
* draws a histogram for the given KisHistogram.
*/
class KisHistogramWidget : public WdgHistogram
{
Q_OBJECT
public:
KisHistogramWidget(QWidget *parent, const char *name);
- virtual ~KisHistogramWidget();
+ ~KisHistogramWidget() override;
void setPaintDevice(KisPaintDeviceSP dev, const QRect &bounds);
/** Sets the currently displayed channels to channels of the producer with producerID as ID*/
void setCurrentChannels(const KoID& producerID, QList<KoChannelInfo *> channels);
/** Be careful, producer will be modified */
void setCurrentChannels(KoHistogramProducer *producer, QList<KoChannelInfo *> channels);
private Q_SLOTS:
void setActiveChannel(int channel);
void slotTypeSwitched(void);
void slotZoomIn();
void slotZoomOut();
void slide(int val);
private:
void setChannels(void);
void addProducerChannels(KoHistogramProducer *producer);
typedef struct {
bool isProducer;
KoHistogramProducer *producer;
KoChannelInfo * channel;
} ComboboxInfo;
QVector<ComboboxInfo> m_comboInfo;
// Maps the channels in m_channels to a real channel offset in the producer->channels()
QVector<qint32> m_channelToOffset;
QStringList m_channelStrings;
QList<KoChannelInfo *> m_channels;
const KoColorSpace* m_cs;
QStringList channelStrings();
/** Lists all producers currently available */
QList<QString> producers();
void setView(double from, double size);
void updateEnabled();
double m_from, m_width;
KoHistogramProducer* m_currentProducer;
bool m_color;
};
#endif // KIS_HISTOGRAM_WIDGET_
diff --git a/plugins/extensions/imagesize/dlg_canvassize.h b/plugins/extensions/imagesize/dlg_canvassize.h
index 91ea435bed..1c8ec8f4f6 100644
--- a/plugins/extensions/imagesize/dlg_canvassize.h
+++ b/plugins/extensions/imagesize/dlg_canvassize.h
@@ -1,100 +1,100 @@
/*
*
* Copyright (c) 2009 Edward Apap <schumifer@hotmail.com>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_CANVASSIZE
#define DLG_CANVASSIZE
#include <KoDialog.h>
#include <QIcon>
#include "ui_wdg_canvassize.h"
class KisDocumentAwareSpinBoxUnitManager;
class WdgCanvasSize : public QWidget, public Ui::WdgCanvasSize
{
Q_OBJECT
public:
WdgCanvasSize(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgCanvasSize: public KoDialog
{
Q_OBJECT
public:
enum anchor { NORTH_WEST = 0, NORTH, NORTH_EAST, WEST, CENTER, EAST, SOUTH_WEST, SOUTH, SOUTH_EAST, NONE};
DlgCanvasSize(QWidget * parent, int width, int height, double resolution);
- ~DlgCanvasSize();
+ ~DlgCanvasSize() override;
qint32 width();
qint32 height();
qint32 xOffset();
qint32 yOffset();
private Q_SLOTS:
void slotAspectChanged(bool keep);
void slotAnchorButtonClicked(int id);
void slotWidthChanged(double v);
void slotHeightChanged(double v);
void slotXOffsetChanged(double v);
void slotYOffsetChanged(double v);
void slotCanvasPreviewXOffsetChanged(int v);
void slotCanvasPreviewYOffsetChanged(int v);
private:
void loadAnchorIcons();
void updateAnchorIcons(int id);
void updateButtons(int forceId);
void updateOffset(int id);
void expectedOffset(int id, double &xOffset, double &yOffset);
bool m_keepAspect;
const double m_aspectRatio;
const double m_resolution;
const int m_originalWidth, m_originalHeight;
int m_newWidth, m_newHeight;
int m_xOffset, m_yOffset;
WdgCanvasSize * m_page;
QIcon m_anchorIcons[9];
QButtonGroup *m_group;
KisDocumentAwareSpinBoxUnitManager* _widthUnitManager;
KisDocumentAwareSpinBoxUnitManager* _heightUnitManager;
KisDocumentAwareSpinBoxUnitManager* _xOffsetUnitManager;
KisDocumentAwareSpinBoxUnitManager* _yOffsetUnitManager;
};
#endif // DLG_CANVASSIZE
diff --git a/plugins/extensions/imagesize/dlg_imagesize.h b/plugins/extensions/imagesize/dlg_imagesize.h
index 77e4fbf527..901dc49943 100644
--- a/plugins/extensions/imagesize/dlg_imagesize.h
+++ b/plugins/extensions/imagesize/dlg_imagesize.h
@@ -1,91 +1,91 @@
/*
* dlg_imagesize.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_IMAGESIZE
#define DLG_IMAGESIZE
#include <KoDialog.h>
class KisFilterStrategy;
class WdgImageSize;
class KisDocumentAwareSpinBoxUnitManager;
class KisSpinBoxUnitManager;
#include "ui_wdg_imagesize.h"
class WdgImageSize : public QWidget, public Ui::WdgImageSize
{
Q_OBJECT
public:
WdgImageSize(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgImageSize: public KoDialog
{
Q_OBJECT
public:
DlgImageSize(QWidget * parent, int width, int height, double resolution);
- ~DlgImageSize();
+ ~DlgImageSize() override;
qint32 width();
qint32 height();
double resolution();
KisFilterStrategy *filterType();
private Q_SLOTS:
void slotPixelWidthChanged(double w);
void slotPixelHeightChanged(double h);
void slotPrintWidthChanged(double w);
void slotPrintHeightChanged(double h);
void slotAspectChanged(bool keep);
void slotPrintResolutionChanged(double r);
void slotPrintResolutionEditFinished();
void slotPrintResolutionUnitChanged();
private:
void updatePixelWidthUIValue(double value);
void updatePixelHeightUIValue(double value);
void updatePrintWidthUIValue(double value);
void updatePrintHeightUIValue(double value);
void updatePrintResolutionUIValue(double value);
WdgImageSize *m_page;
const double m_aspectRatio;
const int m_originalWidth, m_originalHeight;
int m_width, m_height;
double m_printWidth, m_printHeight; // in points
const double m_originalResolution;
double m_resolution;
bool m_keepAspect;
KisDocumentAwareSpinBoxUnitManager* _widthUnitManager;
KisDocumentAwareSpinBoxUnitManager* _heightUnitManager;
KisSpinBoxUnitManager* _printWidthUnitManager;
KisSpinBoxUnitManager* _printHeightUnitManager;
};
#endif // DLG_IMAGESIZE
diff --git a/plugins/extensions/imagesize/dlg_layersize.h b/plugins/extensions/imagesize/dlg_layersize.h
index 53fccdf309..100e46611a 100644
--- a/plugins/extensions/imagesize/dlg_layersize.h
+++ b/plugins/extensions/imagesize/dlg_layersize.h
@@ -1,79 +1,79 @@
/*
* dlg_layersize.h -- part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2005 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_LAYERSIZE
#define DLG_LAYERSIZE
#include <KoDialog.h>
#include "ui_wdg_layersize.h"
class KisDocumentAwareSpinBoxUnitManager;
class WdgLayerSize : public QWidget, public Ui::WdgLayerSize
{
Q_OBJECT
public:
WdgLayerSize(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KisFilterStrategy;
class DlgLayerSize: public KoDialog
{
Q_OBJECT
public:
DlgLayerSize(QWidget * parent, const char* name,
int width, int height, double resolution);
- ~DlgLayerSize();
+ ~DlgLayerSize() override;
qint32 width();
qint32 height();
KisFilterStrategy *filterType();
private Q_SLOTS:
void slotWidthChanged(double w);
void slotHeightChanged(double h);
void slotAspectChanged(bool keep);
private:
void updateWidthUIValue(double value);
void updateHeightUIValue(double value);
WdgLayerSize * m_page;
const double m_aspectRatio;
const int m_originalWidth, m_originalHeight;
int m_width, m_height;
const double m_resolution;
bool m_keepAspect;
KisDocumentAwareSpinBoxUnitManager* _widthUnitManager;
KisDocumentAwareSpinBoxUnitManager* _heightUnitManager;
};
#endif // DLG_IMAGESIZE
diff --git a/plugins/extensions/imagesize/imagesize.h b/plugins/extensions/imagesize/imagesize.h
index feb2f768bc..740ca2c304 100644
--- a/plugins/extensions/imagesize/imagesize.h
+++ b/plugins/extensions/imagesize/imagesize.h
@@ -1,42 +1,42 @@
/*
* imagesize.h -- Part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef IMAGESIZE_H
#define IMAGESIZE_H
#include <QVariant>
#include <kis_view_plugin.h>
class ImageSize : public KisViewPlugin
{
Q_OBJECT
public:
ImageSize(QObject *parent, const QVariantList &);
- virtual ~ImageSize();
+ ~ImageSize() override;
private Q_SLOTS:
void slotImageSize();
void slotCanvasSize();
void slotLayerSize();
void slotSelectionScale();
};
#endif // IMAGESIZE_H
diff --git a/plugins/extensions/imagesize/kcanvaspreview.h b/plugins/extensions/imagesize/kcanvaspreview.h
index d8aa62d8f5..85f81cf985 100644
--- a/plugins/extensions/imagesize/kcanvaspreview.h
+++ b/plugins/extensions/imagesize/kcanvaspreview.h
@@ -1,63 +1,63 @@
/*
*
* Copyright (c) 2009 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KCANVASPREVIEW_H
#define KCANVASPREVIEW_H
#include <QWidget>
class KCanvasPreview : public QWidget
{
Q_OBJECT
public:
KCanvasPreview(QWidget * parent = 0);
- virtual ~KCanvasPreview();
+ ~KCanvasPreview() override;
- void paintEvent(QPaintEvent *);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *);
- void mouseMoveEvent(QMouseEvent *event);
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
void setImageSize(qint32 w, qint32 h);
void setCanvasSize(qint32 w, qint32 h);
void setImageOffset(qint32 x, qint32 y);
Q_SIGNALS:
void sigModifiedXOffset(int);
void sigModifiedYOffset(int);
protected:
bool isInRegion(QPoint point);
double scalingFactor();
protected:
qint32 m_width, m_height;
qint32 m_imageWidth, m_imageHeight;
qint32 m_xOffset, m_yOffset;
qint16 m_xCanvasOffset, m_yCanvasOffset;
bool m_dragging;
QImage m_image;
QPoint m_prevDragPoint;
};
#endif /* KCANVASPREVIEW_H */
diff --git a/plugins/extensions/imagesplit/dlg_imagesplit.h b/plugins/extensions/imagesplit/dlg_imagesplit.h
index 7f6de88308..c59302654a 100644
--- a/plugins/extensions/imagesplit/dlg_imagesplit.h
+++ b/plugins/extensions/imagesplit/dlg_imagesplit.h
@@ -1,58 +1,58 @@
/*
* dlg_imagesplit.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_IMAGESPLIT
#define DLG_IMAGESPLIT
#include <KoDialog.h>
#include <kis_types.h>
#include "wdg_imagesplit.h"
class KisViewManager;
/**
* This dialog allows the user to create a selection mask based
* on a (range of) colors.
*/
class DlgImagesplit: public KoDialog
{
Q_OBJECT
public:
DlgImagesplit(KisViewManager* view, const QString &suffix, QStringList listMimeType, int defaultMimeIndex);
- ~DlgImagesplit();
+ ~DlgImagesplit() override;
bool autoSave();
int horizontalLines();
int verticalLines();
int cmbIndex;
QString suffix();
private Q_SLOTS:
void applyClicked();
void lineEditEnable();
void setMimeType(int index);
private:
WdgImagesplit* m_page;
};
#endif // DLG_IMAGESPLIT
diff --git a/plugins/extensions/imagesplit/imagesplit.h b/plugins/extensions/imagesplit/imagesplit.h
index 2c5865f630..09f490bf8d 100644
--- a/plugins/extensions/imagesplit/imagesplit.h
+++ b/plugins/extensions/imagesplit/imagesplit.h
@@ -1,42 +1,42 @@
/*
* imagesplit.h -- Part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef IMAGESPLIT_H
#define IMAGESPLIT_H
#include <QVariant>
#include <QUrl>
#include <kis_view_plugin.h>
class Imagesplit : public KisViewPlugin
{
Q_OBJECT
public:
Imagesplit(QObject *parent, const QVariantList &);
- virtual ~Imagesplit();
+ ~Imagesplit() override;
private Q_SLOTS:
void slotImagesplit();
bool saveAsImage(const QRect &imgSize, const QString &mimeType, const QString &url);
};
#endif // IMAGESPLIT_H
diff --git a/plugins/extensions/layergroupswitcher/layergroupswitcher.h b/plugins/extensions/layergroupswitcher/layergroupswitcher.h
index a6a04a3cd0..9a143955b6 100644
--- a/plugins/extensions/layergroupswitcher/layergroupswitcher.h
+++ b/plugins/extensions/layergroupswitcher/layergroupswitcher.h
@@ -1,40 +1,40 @@
/*
* layergroupswitcher.h -- Part of Krita
*
* Copyright (c) 2013 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LAYERGROUP_SWITCHER_H
#define LAYERGROUP_SWITCHER_H
#include <QVariant>
#include <kis_view_plugin.h>
class LayerGroupSwitcher : public KisViewPlugin
{
Q_OBJECT
public:
LayerGroupSwitcher(QObject *parent, const QVariantList &);
- virtual ~LayerGroupSwitcher();
+ ~LayerGroupSwitcher() override;
private Q_SLOTS:
void moveIntoNextGroup();
void moveIntoPreviousGroup();
};
#endif // LAYERGROUP_SWITCHER_H
diff --git a/plugins/extensions/layersplit/dlg_layersplit.h b/plugins/extensions/layersplit/dlg_layersplit.h
index 21e671de0c..b75aa5574e 100644
--- a/plugins/extensions/layersplit/dlg_layersplit.h
+++ b/plugins/extensions/layersplit/dlg_layersplit.h
@@ -1,63 +1,63 @@
/*
* Copyright (C) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DLG_LAYERSPLIT
#define DLG_LAYERSPLIT
#include <KoDialog.h>
#include <KoColorSet.h>
#include <KisColorsetChooser.h>
#include <kis_types.h>
#include "wdg_layersplit.h"
/**
* This dialog allows the user to create a selection mask based
* on a (range of) colors.
*/
class DlgLayerSplit: public KoDialog
{
Q_OBJECT
public:
DlgLayerSplit();
- ~DlgLayerSplit();
+ ~DlgLayerSplit() override;
bool createBaseGroup() const;
bool createSeparateGroups() const;
bool lockAlpha() const;
bool hideOriginal() const;
bool sortLayers() const;
bool disregardOpacity() const;
int fuzziness() const;
KoColorSet* palette() const;
private Q_SLOTS:
void applyClicked();
void slotSetPalette(KoColorSet *pal);
private:
WdgLayerSplit *m_page {0};
KisColorsetChooser *m_colorSetChooser {0};
KoColorSet *m_palette {0};
};
#endif // DLG_LAYERSPLIT
diff --git a/plugins/extensions/layersplit/layersplit.h b/plugins/extensions/layersplit/layersplit.h
index 2147b70f26..afe3461117 100644
--- a/plugins/extensions/layersplit/layersplit.h
+++ b/plugins/extensions/layersplit/layersplit.h
@@ -1,40 +1,40 @@
/*
* Copyright (C) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LAYERSPLIT_H
#define LAYERSPLIT_H
#include <QVariant>
#include <QUrl>
#include <kis_view_plugin.h>
class LayerSplit : public KisViewPlugin
{
Q_OBJECT
public:
LayerSplit(QObject *parent, const QVariantList &);
- virtual ~LayerSplit();
+ ~LayerSplit() override;
private Q_SLOTS:
void slotLayerSplit();
};
#endif // LAYERSPLIT_H
diff --git a/plugins/extensions/metadataeditor/kis_entry_editor.h b/plugins/extensions/metadataeditor/kis_entry_editor.h
index 601ddbeaea..53fd109632 100644
--- a/plugins/extensions/metadataeditor/kis_entry_editor.h
+++ b/plugins/extensions/metadataeditor/kis_entry_editor.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ENTRY_EDITOR_H_
#define _KIS_ENTRY_EDITOR_H_
#include <QObject>
class QString;
namespace KisMetaData
{
class Store;
}
class KisEntryEditor : public QObject
{
Q_OBJECT
struct Private;
public:
KisEntryEditor(QObject* obj, KisMetaData::Store* store, QString key, QString propertyName, QString structField, int arrayIndex);
- ~KisEntryEditor();
+ ~KisEntryEditor() override;
public Q_SLOTS:
void valueEdited();
void valueChanged();
Q_SIGNALS:
void valueHasBeenEdited();
private:
Private* const d;
};
#endif
diff --git a/plugins/extensions/metadataeditor/kis_meta_data_editor.h b/plugins/extensions/metadataeditor/kis_meta_data_editor.h
index 4ad5bf52b2..1ff7fcd23a 100644
--- a/plugins/extensions/metadataeditor/kis_meta_data_editor.h
+++ b/plugins/extensions/metadataeditor/kis_meta_data_editor.h
@@ -1,69 +1,69 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_META_DATA_EDITOR_H_
#define _KIS_META_DATA_EDITOR_H_
#include <QWidget>
#include <kpagedialog.h>
#include "ui_dublincore.h"
#include "ui_exif.h"
namespace KisMetaData
{
class Store;
}
class WdgDublinCore : public QWidget, public Ui::DublinCore
{
Q_OBJECT
public:
WdgDublinCore(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class WdgExif : public QWidget, public Ui::Exif
{
Q_OBJECT
public:
WdgExif(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KisMetaDataEditor : public KPageDialog
{
Q_OBJECT
private:
struct Private;
public:
KisMetaDataEditor(QWidget* parent, KisMetaData::Store* store);
- ~KisMetaDataEditor();
+ ~KisMetaDataEditor() override;
public Q_SLOTS:
- virtual void accept();
+ void accept() override;
private:
Private* const d;
};
#endif
diff --git a/plugins/extensions/metadataeditor/kis_meta_data_model.h b/plugins/extensions/metadataeditor/kis_meta_data_model.h
index 98783d21ab..f23ea1c2e6 100644
--- a/plugins/extensions/metadataeditor/kis_meta_data_model.h
+++ b/plugins/extensions/metadataeditor/kis_meta_data_model.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_META_DATA_MODEL_H
#define KIS_META_DATA_MODEL_H
#include <QAbstractTableModel>
namespace KisMetaData
{
class Store;
}
class KisMetaDataModel : public QAbstractTableModel
{
public:
KisMetaDataModel(KisMetaData::Store* store);
public:
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
private:
KisMetaData::Store* m_store;
};
#endif
diff --git a/plugins/extensions/metadataeditor/metadataeditor.h b/plugins/extensions/metadataeditor/metadataeditor.h
index 735ef6020b..b828285506 100644
--- a/plugins/extensions/metadataeditor/metadataeditor.h
+++ b/plugins/extensions/metadataeditor/metadataeditor.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _METADATAEDITOR_H_
#define _METADATAEDITOR_H_
#include <QVariant>
#include <kis_view_plugin.h>
namespace KisMetaData
{
}
/**
* Template of view plugin
*/
class metadataeditorPlugin : public KisViewPlugin
{
Q_OBJECT
public:
metadataeditorPlugin(QObject *parent, const QVariantList &);
- virtual ~metadataeditorPlugin();
+ ~metadataeditorPlugin() override;
private Q_SLOTS:
void slotEditLayerMetaData();
};
#endif // metadataeditorPlugin_H
diff --git a/plugins/extensions/modify_selection/dlg_border_selection.h b/plugins/extensions/modify_selection/dlg_border_selection.h
index a6e900fdc0..6592207063 100644
--- a/plugins/extensions/modify_selection/dlg_border_selection.h
+++ b/plugins/extensions/modify_selection/dlg_border_selection.h
@@ -1,49 +1,49 @@
/*
* dlg_border_selection.h -- part of Krita
*
* Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_BORDER_SELECTION_H
#define DLG_BORDER_SELECTION_H
#include "ui_wdg_border_selection.h"
#include <operations/kis_operation_ui_widget.h>
class KisViewManager;
class WdgBorderSelection : public KisOperationUIWidget, public Ui::WdgBorderSelection
{
Q_OBJECT
public:
WdgBorderSelection(QWidget *parent, KisViewManager* view);
- virtual void getConfiguration(KisOperationConfigurationSP config);
+ void getConfiguration(KisOperationConfigurationSP config) override;
private Q_SLOTS:
void slotWidthChanged(int width);
void slotWidthChanged(double width);
void slotUnitChanged(int index);
private:
void updateWidthUIValue(double value);
double m_resolution;
int m_width;
};
#endif // DLG_BORDER_SELECTION_H
diff --git a/plugins/extensions/modify_selection/dlg_feather_selection.h b/plugins/extensions/modify_selection/dlg_feather_selection.h
index b7ee16c2be..c81d1fd426 100644
--- a/plugins/extensions/modify_selection/dlg_feather_selection.h
+++ b/plugins/extensions/modify_selection/dlg_feather_selection.h
@@ -1,49 +1,49 @@
/*
* dlg_feather_selection.h -- part of Krita
*
* Copyright (c) 2009 Edward Apap <schumifer@hotmail.com>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_FEATHER_SELECTION_H
#define DLG_FEATHER_SELECTION_H
#include "ui_wdg_feather_selection.h"
#include <operations/kis_operation_ui_widget.h>
class KisViewManager;
class WdgFeatherSelection : public KisOperationUIWidget, public Ui::WdgFeatherSelection
{
Q_OBJECT
public:
WdgFeatherSelection(QWidget *parent, KisViewManager *view);
- virtual void getConfiguration(KisOperationConfigurationSP config);
+ void getConfiguration(KisOperationConfigurationSP config) override;
private Q_SLOTS:
void slotRadiusChanged(int radius);
void slotRadiusChanged(double radius);
void slotUnitChanged(int index);
private:
void updateRadiusUIValue(double value);
double m_resolution;
int m_radius;
};
#endif // DLG_GROW_SELECTION_H
diff --git a/plugins/extensions/modify_selection/dlg_grow_selection.h b/plugins/extensions/modify_selection/dlg_grow_selection.h
index 882498cded..a68fe32845 100644
--- a/plugins/extensions/modify_selection/dlg_grow_selection.h
+++ b/plugins/extensions/modify_selection/dlg_grow_selection.h
@@ -1,49 +1,49 @@
/*
* dlg_grow_selection.h -- part of Krita
*
* Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_GROW_SELECTION_H
#define DLG_GROW_SELECTION_H
#include "ui_wdg_grow_selection.h"
#include <operations/kis_operation_ui_widget.h>
class KisViewManager;
class WdgGrowSelection : public KisOperationUIWidget, public Ui::WdgGrowSelection
{
Q_OBJECT
public:
WdgGrowSelection(QWidget *parent, KisViewManager* view);
- virtual void getConfiguration(KisOperationConfigurationSP config);
+ void getConfiguration(KisOperationConfigurationSP config) override;
private Q_SLOTS:
void slotGrowValueChanged(int value);
void slotGrowValueChanged(double value);
void slotUnitChanged(int index);
private:
void updateGrowUIValue(double value);
double m_resolution;
int m_growValue;
};
#endif // DLG_GROW_SELECTION_H
diff --git a/plugins/extensions/modify_selection/dlg_shrink_selection.h b/plugins/extensions/modify_selection/dlg_shrink_selection.h
index c02af70254..8eb9b5a684 100644
--- a/plugins/extensions/modify_selection/dlg_shrink_selection.h
+++ b/plugins/extensions/modify_selection/dlg_shrink_selection.h
@@ -1,49 +1,49 @@
/*
* dlg_shrink_selection.h -- part of Krita
*
* Copyright (c) 2006 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
* Copyright (c) 2013 Juan Palacios <jpalaciosdev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_SHRINK_SELECTION_H
#define DLG_SHRINK_SELECTION_H
#include "ui_wdg_shrink_selection.h"
#include <operations/kis_operation_ui_widget.h>
class KisViewManager;
class WdgShrinkSelection : public KisOperationUIWidget, public Ui::WdgShrinkSelection
{
Q_OBJECT
public:
WdgShrinkSelection(QWidget *parent, KisViewManager* view);
- virtual void getConfiguration(KisOperationConfigurationSP config);
+ void getConfiguration(KisOperationConfigurationSP config) override;
private Q_SLOTS:
void slotShrinkValueChanged(int value);
void slotShrinkValueChanged(double value);
void slotUnitChanged(int index);
private:
void updateShrinkUIValue(double value);
double m_resolution;
int m_shrinkValue;
};
#endif // DLG_SHRINK_SELECTION_H
diff --git a/plugins/extensions/modify_selection/modify_selection.h b/plugins/extensions/modify_selection/modify_selection.h
index 4fbeea3f9a..500387401a 100644
--- a/plugins/extensions/modify_selection/modify_selection.h
+++ b/plugins/extensions/modify_selection/modify_selection.h
@@ -1,35 +1,35 @@
/*
* modify_selection.h -- Part of Krita
*
* Copyright (c) 2006 Michael Thaler (michael.thaler@physik.tu-muenchen.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MODIFY_SELECTION_H
#define MODIFY_SELECTION_H
#include <QVariant>
#include <kis_view_plugin.h>
class ModifySelection : public KisViewPlugin
{
Q_OBJECT
public:
ModifySelection(QObject *parent, const QVariantList &);
- virtual ~ModifySelection();
+ ~ModifySelection() override;
};
#endif // MODIFY_SELECTION_H
diff --git a/plugins/extensions/modify_selection/modify_selection_operations.h b/plugins/extensions/modify_selection/modify_selection_operations.h
index a77e83c6dc..f5c6192cd6 100644
--- a/plugins/extensions/modify_selection/modify_selection_operations.h
+++ b/plugins/extensions/modify_selection/modify_selection_operations.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef MODIFY_SELECTION_OPERATIONS_H
#define MODIFY_SELECTION_OPERATIONS_H
#include <operations/kis_operation.h>
#include <operations/kis_filter_selection_operation.h>
class KisViewManager;
struct GrowSelectionOperation : public KisFilterSelectionOperation {
GrowSelectionOperation() : KisFilterSelectionOperation("growselection") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config);
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override;
};
struct ShrinkSelectionOperation : public KisFilterSelectionOperation {
ShrinkSelectionOperation() : KisFilterSelectionOperation("shrinkselection") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config);
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override;
};
struct BorderSelectionOperation : public KisFilterSelectionOperation {
BorderSelectionOperation() : KisFilterSelectionOperation("borderselection") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config);
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override;
};
struct FeatherSelectionOperation : public KisFilterSelectionOperation {
FeatherSelectionOperation() : KisFilterSelectionOperation("featherselection") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config);
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override;
};
struct SmoothSelectionOperation : public KisFilterSelectionOperation {
SmoothSelectionOperation() : KisFilterSelectionOperation("smoothselection") {}
- void runFromXML(KisViewManager *view, const KisOperationConfiguration &config);
+ void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override;
};
#endif // MODIFY_SELECTION_OPERATIONS_H
diff --git a/plugins/extensions/offsetimage/dlg_offsetimage.h b/plugins/extensions/offsetimage/dlg_offsetimage.h
index 5488fa6517..b0d1ef1973 100644
--- a/plugins/extensions/offsetimage/dlg_offsetimage.h
+++ b/plugins/extensions/offsetimage/dlg_offsetimage.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2013 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_OFFSETIMAGE
#define DLG_OFFSETIMAGE
#include <KoDialog.h>
#include <kis_global.h>
#include "ui_wdg_offsetimage.h"
class KisDocumentAwareSpinBoxUnitManager;
class WdgOffsetImage : public QWidget, public Ui::WdgOffsetImage
{
Q_OBJECT
public:
WdgOffsetImage(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgOffsetImage: public KoDialog
{
Q_OBJECT
public:
DlgOffsetImage(QWidget * parent = 0, const char* name = 0, QSize imageSize = QSize());
- ~DlgOffsetImage();
+ ~DlgOffsetImage() override;
int offsetX() const { return m_offsetX;}
int offsetY() const { return m_offsetY;}
private Q_SLOTS:
void okClicked();
void slotOffsetXChanged(double);
void slotOffsetYChanged(double);
void slotMiddleOffset();
private:
WdgOffsetImage * m_page;
int m_offsetX;
int m_offsetY;
bool m_lock;
QSize m_offsetSize;
KisDocumentAwareSpinBoxUnitManager* _widthUnitManager;
KisDocumentAwareSpinBoxUnitManager* _heightUnitManager;
};
#endif // DLG_OFFSETIMAGE
diff --git a/plugins/extensions/offsetimage/kis_offset_processing_visitor.h b/plugins/extensions/offsetimage/kis_offset_processing_visitor.h
index 3d280b9efa..ad26d4de5a 100644
--- a/plugins/extensions/offsetimage/kis_offset_processing_visitor.h
+++ b/plugins/extensions/offsetimage/kis_offset_processing_visitor.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2013 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_OFFSET_PROCESSING_VISITOR_H
#define __KIS_OFFSET_PROCESSING_VISITOR_H
#include "processing/kis_simple_processing_visitor.h"
#include <QRect>
#include "kis_types.h"
class KisOffsetProcessingVisitor : public KisSimpleProcessingVisitor
{
public:
KisOffsetProcessingVisitor(const QPoint &offsetPoint, const QRect &wrapRect);
- void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter);
- void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter);
- void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter);
+ void visitNodeWithPaintDevice(KisNode *node, KisUndoAdapter *undoAdapter) override;
+ void visitExternalLayer(KisExternalLayer *layer, KisUndoAdapter *undoAdapter) override;
+ void visitColorizeMask(KisColorizeMask *mask, KisUndoAdapter *undoAdapter) override;
private:
void offsetPaintDevice(KisPaintDeviceSP device, KisUndoAdapter *undoAdapter);
private:
QPoint m_offset;
QRect m_wrapRect;
};
#endif /* __KIS_OFFSET_PROCESSING_VISITOR_H */
diff --git a/plugins/extensions/offsetimage/offsetimage.h b/plugins/extensions/offsetimage/offsetimage.h
index 4148e975f1..6f6f2b6c0d 100644
--- a/plugins/extensions/offsetimage/offsetimage.h
+++ b/plugins/extensions/offsetimage/offsetimage.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2013 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef OFFSETIMAGE_H
#define OFFSETIMAGE_H
#include <QVariant>
#include <kis_view_plugin.h>
#include <kis_types.h>
#include <kis_node.h>
class KUndo2MagicString;
class OffsetImage : public KisViewPlugin
{
Q_OBJECT
public:
OffsetImage(QObject *parent, const QVariantList &);
- virtual ~OffsetImage();
+ ~OffsetImage() override;
public Q_SLOTS:
void slotOffsetImage();
void slotOffsetLayer();
void offsetImpl(const KUndo2MagicString &actionName, KisNodeSP node, const QPoint &offsetPoint);
private:
QRect offsetWrapRect();
};
#endif // OFFSETIMAGE_H
diff --git a/plugins/extensions/pykrita/plugin/plugins/assignprofiledialog/kritapykrita_assignprofiledialog.desktop b/plugins/extensions/pykrita/plugin/plugins/assignprofiledialog/kritapykrita_assignprofiledialog.desktop
index 8fcb3817b5..6c744694b5 100644
--- a/plugins/extensions/pykrita/plugin/plugins/assignprofiledialog/kritapykrita_assignprofiledialog.desktop
+++ b/plugins/extensions/pykrita/plugin/plugins/assignprofiledialog/kritapykrita_assignprofiledialog.desktop
@@ -1,26 +1,32 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=assignprofiledialog
X-Python-2-Compatible=false
Name=Assign Profile to Image
Name[ca]=Assigna un perfil a una imatge
Name[ca@valencia]=Assigna un perfil a una imatge
Name[cs]=Přiřadit obrázku profil
+Name[en_GB]=Assign Profile to Image
Name[es]=Asignar perfil a imagen
Name[it]=Assegna profilo a immagine
Name[nl]=Profiel aan afbeelding toekennen
+Name[pl]=Przypisz profil do obrazu
Name[pt]=Atribuir um Perfil à Imagem
Name[sv]=Tilldela profil till bild
+Name[tr]=Görüntüye Profil Ata
Name[uk]=Призначити профіль до зображення
Name[x-test]=xxAssign Profile to Imagexx
Comment=Assign a profile to an image without converting it.
Comment[ca]=Assigna un perfil a una imatge sense convertir-la.
Comment[ca@valencia]=Assigna un perfil a una imatge sense convertir-la.
+Comment[en_GB]=Assign a profile to an image without converting it.
Comment[es]=Asignar un perfil a una imagen sin convertirla.
Comment[it]=Assegna un profilo a un'immagine senza convertirla.
Comment[nl]=Een profiel aan een afbeelding toekennen zonder het te converteren.
+Comment[pl]=Przypisz profil do obrazu bez jego przekształcania.
Comment[pt]=Atribui um perfil à imagem sem a converter.
Comment[sv]=Tilldela en profil till en bild utan att konvertera den.
+Comment[tr]=Bir görüntüye, görüntüyü değiştirmeden bir profil ata.
Comment[uk]=Призначити профіль до зображення без його перетворення.
Comment[x-test]=xxAssign a profile to an image without converting it.xx
diff --git a/plugins/extensions/pykrita/plugin/plugins/hello/kritapykrita_hello.desktop b/plugins/extensions/pykrita/plugin/plugins/hello/kritapykrita_hello.desktop
index 22237086a8..3eace05f04 100644
--- a/plugins/extensions/pykrita/plugin/plugins/hello/kritapykrita_hello.desktop
+++ b/plugins/extensions/pykrita/plugin/plugins/hello/kritapykrita_hello.desktop
@@ -1,27 +1,34 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=hello
X-Python-2-Compatible=false
Name=Hello World
Name[ca]=Hola món
Name[ca@valencia]=Hola món
Name[cs]=Hello World
+Name[en_GB]=Hello World
Name[es]=Hola mundo
+Name[fr]=Bonjour tout le monde
Name[it]=Ciao mondo
Name[nl]=Hallo wereld
+Name[pl]=Witaj świecie
Name[pt]=Olá Mundo
Name[sv]=Hello World
+Name[tr]=Merhaba Dünya
Name[uk]=Привіт, світе
Name[x-test]=xxHello Worldxx
Comment=Basic plugin to test PyKrita
Comment[ca]=Connector bàsic per provar el PyKrita
Comment[ca@valencia]=Connector bàsic per provar el PyKrita
Comment[cs]=Základní modul pro testování PyKrita
+Comment[en_GB]=Basic plugin to test PyKrita
Comment[es]=Complemento básico para probar PyKrita
Comment[it]=Estensione di base per provare PyKrita
Comment[nl]=Basisplug-in om PyKrita te testen
+Comment[pl]=Podstawowa wtyczka do wypróbowania PyKrity
Comment[pt]='Plugin' básico para testar o PyKrita
Comment[sv]=Enkelt insticksprogram för att utprova PyKrita
+Comment[tr]=PyKrita'yı test etmek için temel eklenti
Comment[uk]=Базовий додаток для тестування PyKrita
Comment[x-test]=xxBasic plugin to test PyKritaxx
diff --git a/plugins/extensions/pykrita/plugin/plugins/highpass/kritapykrita_highpass.desktop b/plugins/extensions/pykrita/plugin/plugins/highpass/kritapykrita_highpass.desktop
index 372e509936..f796953a51 100644
--- a/plugins/extensions/pykrita/plugin/plugins/highpass/kritapykrita_highpass.desktop
+++ b/plugins/extensions/pykrita/plugin/plugins/highpass/kritapykrita_highpass.desktop
@@ -1,28 +1,34 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=highpass
X-Python-2-Compatible=false
Name=Highpass Filter
Name[ca]=Filtre passa-alt
Name[ca@valencia]=Filtre passa-alt
Name[cs]=Filtr s horní propustí
Name[de]=Hochpassfilter
+Name[en_GB]=Highpass Filter
Name[es]=Filtro paso alto
Name[it]=Filtro di accentuazione passaggio
Name[nl]=Hoogdoorlaatfilter
+Name[pl]=Filtr górnoprzepustowy
Name[pt]=Filtro Passa-Alto
Name[sv]=Högpassfilter
+Name[tr]=Yüksek Geçirgen Süzgeç
Name[uk]=Високочастотний фільтр
Name[x-test]=xxHighpass Filterxx
Comment=Highpass Filter, based on http://registry.gimp.org/node/7385
Comment[ca]=Filtre passa-alt, basat en el http://registry.gimp.org/node/7385
Comment[ca@valencia]=Filtre passa-alt, basat en el http://registry.gimp.org/node/7385
Comment[de]=Hochpassfilter, Grundlage ist http://registry.gimp.org/node/7385
+Comment[en_GB]=Highpass Filter, based on http://registry.gimp.org/node/7385
Comment[es]=Filtro paso alto, basado en http://registry.gimp.org/node/7385
Comment[it]=Filtro di accentuazione passaggio, basato su http://registry.gimp.org/node/7385
Comment[nl]=Hoogdoorlaatfilter, gebaseerd op http://registry.gimp.org/node/7385
+Comment[pl]=Filtr górnoprzepustowy, oparty na http://registry.gimp.org/node/7385
Comment[pt]=Filtro passa-alto, baseado em http://registry.gimp.org/node/7385
Comment[sv]=Högpassfilter, baserat på http://registry.gimp.org/node/7385
+Comment[tr]=http://registry.gimp.org/node/7385 tabanlı Yüksek Geçirgen Süzgeç
Comment[uk]=Високочастотний фільтр, засновано на on http://registry.gimp.org/node/7385
Comment[x-test]=xxHighpass Filter, based on http://registry.gimp.org/node/7385xx
diff --git a/plugins/extensions/pykrita/plugin/plugins/scripter/kritapykrita_scripter.desktop b/plugins/extensions/pykrita/plugin/plugins/scripter/kritapykrita_scripter.desktop
index 7fac2d24cc..8dce2bdee2 100644
--- a/plugins/extensions/pykrita/plugin/plugins/scripter/kritapykrita_scripter.desktop
+++ b/plugins/extensions/pykrita/plugin/plugins/scripter/kritapykrita_scripter.desktop
@@ -1,26 +1,32 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=scripter
X-Python-2-Compatible=false
Name=Scripter
Name[ca]=Scripter
Name[ca@valencia]=Scripter
Name[de]=Scripter
+Name[en_GB]=Scripter
Name[es]=Guionador
Name[it]=Scripter
Name[nl]=Scriptschrijver
+Name[pl]=Skrypter
Name[pt]=Programador
Name[sv]=Skriptgenerator
+Name[tr]=Betik yazarı
Name[uk]=Скриптер
Name[x-test]=xxScripterxx
Comment=Plugin to execute ad-hoc Python code
Comment[ca]=Connector per executar codi Python ad-hoc
Comment[ca@valencia]=Connector per executar codi Python ad-hoc
+Comment[en_GB]=Plugin to execute ad-hoc Python code
Comment[es]=Complemento para ejecutar código Python a medida
Comment[it]=Estensione per eseguire ad-hoc codice Python
Comment[nl]=Plug-in om ad-hoc Python code uit te voeren
+Comment[pl]=Wtyczka do wykonywania kodu Pythona ad-hoc
Comment[pt]='Plugin' para executar código em Python arbitrário
Comment[sv]=Insticksprogram för att köra godtycklig Python-kod
+Comment[tr]=Geçici Python kodu çalıştırmak için eklenti
Comment[uk]=Додаток для виконання апріорного коду Python
Comment[x-test]=xxPlugin to execute ad-hoc Python codexx
diff --git a/plugins/extensions/pykrita/plugin/plugins/selectionsbagdocker/kritapykrita_selectionsbagdocker.desktop b/plugins/extensions/pykrita/plugin/plugins/selectionsbagdocker/kritapykrita_selectionsbagdocker.desktop
index e439689d64..9c1fcb44a2 100644
--- a/plugins/extensions/pykrita/plugin/plugins/selectionsbagdocker/kritapykrita_selectionsbagdocker.desktop
+++ b/plugins/extensions/pykrita/plugin/plugins/selectionsbagdocker/kritapykrita_selectionsbagdocker.desktop
@@ -1,26 +1,32 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=selectionsbagdocker
X-Python-2-Compatible=false
Name=Selections Bag Docker
Name[ca]=Acoblador de bossa de seleccions
Name[ca@valencia]=Acoblador de bossa de seleccions
+Name[en_GB]=Selections Bag Docker
Name[es]=Panel de selecciones
Name[it]=Area di raccolta selezioni
Name[nl]=Docker van zak met selecties
+Name[pl]=Dok worka zaznaczeń
Name[pt]=Área de Selecções
Name[sv]=Dockningspanel med markeringspåse
+Name[tr]=Seçim Çantası İşçisi
Name[uk]=Бічна панель позначеного
Name[x-test]=xxSelections Bag Dockerxx
Comment=A docker that allow to store a list of selections
Comment[ca]=Un acoblador que permet emmagatzemar una llista de seleccions
Comment[ca@valencia]=Un acoblador que permet emmagatzemar una llista de seleccions
Comment[cs]=Dok umožňující uložit seznam výběrů
+Comment[en_GB]=A docker that allow to store a list of selections
Comment[es]=Un panel que permite guardar una lista de selecciones
Comment[it]=Un'area di aggancio che consente di memorizzare un elenco di selezioni
Comment[nl]=Een docker die een lijst met selecties kan opslaan
+Comment[pl]=Dok, który umożliwia przechowywanie listy zaznaczeń
Comment[pt]=Uma área acoplável que permite guardar uma lista de selecções
Comment[sv]=En dockningspanel som gör det möjligt att lagra en lista över markeringar
+Comment[tr]=Seçimlerin bir listesini saklamayı sağlayan işçi
Comment[uk]=Бічна панель, на якій можна зберігати список позначеного
Comment[x-test]=xxA docker that allow to store a list of selectionsxx
diff --git a/plugins/extensions/pykrita/plugin/plugins/tenbrushes/kritapykrita_tenbrushes.desktop b/plugins/extensions/pykrita/plugin/plugins/tenbrushes/kritapykrita_tenbrushes.desktop
index ef420225e8..25986a3e45 100644
--- a/plugins/extensions/pykrita/plugin/plugins/tenbrushes/kritapykrita_tenbrushes.desktop
+++ b/plugins/extensions/pykrita/plugin/plugins/tenbrushes/kritapykrita_tenbrushes.desktop
@@ -1,26 +1,32 @@
[Desktop Entry]
Type=Service
ServiceTypes=Krita/PythonPlugin
X-KDE-Library=tenbrushes
X-Python-2-Compatible=false
Name=Ten Brushes
Name[ca]=Deu pinzells
Name[ca@valencia]=Deu pinzells
Name[cs]=Deset štětců
+Name[en_GB]=Ten Brushes
Name[es]=Diez pinceles
Name[it]=Dieci pennelli
Name[nl]=Tien penselen
+Name[pl]=Dziesięć pędzli
Name[pt]=Dez Pincéis
Name[sv]=Tio penslar
+Name[tr]=On Fırça
Name[uk]=Десять пензлів
Name[x-test]=xxTen Brushesxx
Comment=Assign a preset to ctrl-1 to ctrl-0
Comment[ca]=Assigna una predefinició des de Ctrl-1 a Ctrl-0
Comment[ca@valencia]=Assigna una predefinició des de Ctrl-1 a Ctrl-0
+Comment[en_GB]=Assign a preset to ctrl-1 to ctrl-0
Comment[es]=Asignar una preselección a Ctrl-1 hasta Ctrl-0
Comment[it]=Assegna una preimpostazione per ctrl-1 a ctrl-0
Comment[nl]=Een voorinstelling toekennen aan Ctrl-1 tot Ctrl-0
+Comment[pl]=Przypisz nastawę do ctrl-1 lub ctrl-0
Comment[pt]=Atribuir uma predefinição de Ctrl-1 a Ctrl-0
Comment[sv]=Tilldela en förinställning för Ctrl+1 till Ctrl+0
+Comment[tr]= ctrl-1 ve ctrl-0 için ayar atama
Comment[uk]=Прив’язування наборів налаштувань до скорочень від ctrl-1 до ctrl-0
Comment[x-test]=xxAssign a preset to ctrl-1 to ctrl-0xx
diff --git a/plugins/extensions/pykrita/sip/CMakeLists.txt b/plugins/extensions/pykrita/sip/CMakeLists.txt
index 9b3a12794d..beb7a1f6b7 100644
--- a/plugins/extensions/pykrita/sip/CMakeLists.txt
+++ b/plugins/extensions/pykrita/sip/CMakeLists.txt
@@ -1,16 +1,27 @@
include(SIPMacros)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libkis)
-set(SIP_INCLUDES ${PYQT_SIP_DIR_OVERRIDE} ./krita)
+message( ${SIP_VERSION} " - The version of SIP found expressed as a 6 digit hex number suitable for comparison as a string.")
+message( ${SIP_VERSION_STR} " - The version of SIP found as a human readable string.")
+message( ${SIP_EXECUTABLE} " - Path and filename of the SIP command line executable.")
+message( ${SIP_INCLUDE_DIR} " - Directory holding the SIP C++ header file.")
+message( ${SIP_DEFAULT_SIP_DIR} " - default SIP dir" )
+
+set(SIP_INCLUDES
+ ${SIP_DEFAULT_SIP_DIR}
+ ${SIP_DEFAULT_SIP_DIR}/PyQt5
+ ${PYQT_SIP_DIR_OVERRIDE}
+ ./krita)
+
set(SIP_CONCAT_PARTS 1)
set(SIP_TAGS ALL WS_X11 ${PYQT5_VERSION_TAG})
set(SIP_EXTRA_OPTIONS -g -x PyKDE_QVector)
set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${DATA_INSTALL_DIR}/krita/pykrita/)
add_sip_python_module(PyKrita.krita ./krita/kritamod.sip kritalibkis kritaui kritaimage kritalibbrush)
#install(FILES
# ./__init__.py
# DESTINATION ${PYTHON_SITE_PACKAGES_INSTALL_DIR})
diff --git a/plugins/extensions/resourcemanager/dlg_bundle_manager.h b/plugins/extensions/resourcemanager/dlg_bundle_manager.h
index 5d3f37536e..ba8c72cf08 100644
--- a/plugins/extensions/resourcemanager/dlg_bundle_manager.h
+++ b/plugins/extensions/resourcemanager/dlg_bundle_manager.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2014 Victor Lafon metabolic.ewilan@hotmail.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DLG_BUNDLE_MANAGER_H
#define DLG_BUNDLE_MANAGER_H
#include <QWidget>
#include <KoDialog.h>
#include "kis_action_manager.h"
#include "resourcemanager.h"
class KisResourceBundle;
class QListWidget;
class QListWidgetItem;
namespace Ui
{
class WdgDlgBundleManager;
}
class DlgBundleManager : public KoDialog
{
Q_OBJECT
public:
explicit DlgBundleManager(ResourceManager *resourceManager, KisActionManager* actionMgr, QWidget *parent = 0);
private Q_SLOTS:
- void accept();
+ void accept() override;
void addSelected();
void removeSelected();
void itemSelected(QListWidgetItem *current, QListWidgetItem *previous);
void itemSelected(QListWidgetItem *current);
void editBundle();
void slotImportResource();
void slotCreateBundle();
void slotDeleteBackupFiles();
void slotOpenResourceFolder();
private:
QWidget *m_page;
Ui::WdgDlgBundleManager *m_ui;
void fillListWidget(QList<KisResourceBundle*> bundles, QListWidget *w);
void refreshListData();
QMap<QString, KisResourceBundle*> m_blacklistedBundles;
QMap<QString, KisResourceBundle*> m_activeBundles;
KisResourceBundle *m_currentBundle;
KisActionManager *m_actionManager;
ResourceManager *m_resourceManager;
};
#endif // DLG_BUNDLE_MANAGER_H
diff --git a/plugins/extensions/resourcemanager/dlg_create_bundle.h b/plugins/extensions/resourcemanager/dlg_create_bundle.h
index 2d52b9c387..8d58b41537 100644
--- a/plugins/extensions/resourcemanager/dlg_create_bundle.h
+++ b/plugins/extensions/resourcemanager/dlg_create_bundle.h
@@ -1,81 +1,81 @@
/*
* Copyright (c) 2014 Victor Lafon metabolic.ewilan@hotmail.fr
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOBUNDLECREATIONWIDGET_H
#define KOBUNDLECREATIONWIDGET_H
#include <KoDialog.h>
class KisResourceBundle;
namespace Ui
{
class WdgDlgCreateBundle;
}
class DlgCreateBundle : public KoDialog
{
Q_OBJECT
public:
explicit DlgCreateBundle(KisResourceBundle *bundle = 0, QWidget *parent = 0);
- ~DlgCreateBundle();
+ ~DlgCreateBundle() override;
QString bundleName() const;
QString authorName() const;
QString email() const;
QString website() const;
QString license() const;
QString description() const;
QString saveLocation() const;
QString previewImage() const;
QStringList selectedBrushes() const { return m_selectedBrushes; }
QStringList selectedPresets() const { return m_selectedPresets; }
QStringList selectedGradients() const { return m_selectedGradients; }
QStringList selectedPatterns() const { return m_selectedPatterns; }
QStringList selectedPalettes() const { return m_selectedPalettes; }
QStringList selectedWorkspaces() const { return m_selectedWorkspaces; }
private Q_SLOTS:
- void accept();
+ void accept() override;
void selectSaveLocation();
void addSelected();
void removeSelected();
void resourceTypeSelected(int idx);
void getPreviewImage();
private:
QWidget *m_page;
Ui::WdgDlgCreateBundle *m_ui;
QStringList m_selectedBrushes;
QStringList m_selectedPresets;
QStringList m_selectedGradients;
QStringList m_selectedPatterns;
QStringList m_selectedPalettes;
QStringList m_selectedWorkspaces;
QString m_previewImage;
KisResourceBundle *m_bundle;
};
#endif // KOBUNDLECREATIONWIDGET_H
diff --git a/plugins/extensions/resourcemanager/resourcemanager.h b/plugins/extensions/resourcemanager/resourcemanager.h
index 5da781c4d7..11ae3373c1 100644
--- a/plugins/extensions/resourcemanager/resourcemanager.h
+++ b/plugins/extensions/resourcemanager/resourcemanager.h
@@ -1,63 +1,63 @@
/*
* resourcemanager.h -- Part of Krita
*
* Copyright (c) 2014 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RESOURCEMANAGER_H
#define RESOURCEMANAGER_H
#include <QVariant>
#include <QStringList>
#include <QString>
#include <KoResourceServer.h>
#include <kis_view_plugin.h>
#include "KisResourceBundle.h"
#include "dlg_create_bundle.h"
class ResourceManager : public KisViewPlugin
{
Q_OBJECT
public:
ResourceManager(QObject *parent, const QVariantList &);
- virtual ~ResourceManager();
+ ~ResourceManager() override;
KisResourceBundle *saveBundle(const DlgCreateBundle &dlgCreateBundle);
private Q_SLOTS:
void slotCreateBundle();
void slotManageBundles();
void slotImportBrushes();
void slotImportGradients();
void slotImportPalettes();
void slotImportPatterns();
void slotImportPresets();
void slotImportWorkspaces();
void slotImportBundles();
private:
QStringList importResources(const QString &title, const QStringList &mimes) const;
class Private;
QScopedPointer<Private> d;
};
#endif // RESOURCEMANAGER_H
diff --git a/plugins/extensions/rotateimage/dlg_rotateimage.h b/plugins/extensions/rotateimage/dlg_rotateimage.h
index 5fa2d8d0f1..758776aec8 100644
--- a/plugins/extensions/rotateimage/dlg_rotateimage.h
+++ b/plugins/extensions/rotateimage/dlg_rotateimage.h
@@ -1,75 +1,75 @@
/*
* dlg_rotateimage.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_ROTATEIMAGE
#define DLG_ROTATEIMAGE
#include <KoDialog.h>
#include "kis_global.h"
#include "ui_wdg_rotateimage.h"
enum enumRotationDirection {
CLOCKWISE,
COUNTERCLOCKWISE
};
class WdgRotateImage : public QWidget, public Ui::WdgRotateImage
{
Q_OBJECT
public:
WdgRotateImage(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgRotateImage: public KoDialog
{
Q_OBJECT
public:
DlgRotateImage(QWidget * parent = 0,
const char* name = 0);
- ~DlgRotateImage();
+ ~DlgRotateImage() override;
void setAngle(quint32 w);
double angle();
void setDirection(enumRotationDirection direction);
enumRotationDirection direction();
private Q_SLOTS:
void okClicked();
void resetPreview();
void slotAngleValueChanged(double);
private:
WdgRotateImage * m_page;
double m_oldAngle;
bool m_lock;
};
#endif // DLG_ROTATEIMAGE
diff --git a/plugins/extensions/rotateimage/rotateimage.h b/plugins/extensions/rotateimage/rotateimage.h
index be6bac23ba..60a610245b 100644
--- a/plugins/extensions/rotateimage/rotateimage.h
+++ b/plugins/extensions/rotateimage/rotateimage.h
@@ -1,45 +1,45 @@
/*
* rotateimage.h -- Part of Krita
*
* Copyright (c) 2004 Michael Thaler (michael.thaler@physik.tu-muenchen.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef ROTATEIMAGE_H
#define ROTATEIMAGE_H
#include <QVariant>
#include <kis_view_plugin.h>
class RotateImage : public KisViewPlugin
{
Q_OBJECT
public:
RotateImage(QObject *parent, const QVariantList &);
- virtual ~RotateImage();
+ ~RotateImage() override;
private Q_SLOTS:
void slotRotateImage();
void slotRotateImage90();
void slotRotateImage180();
void slotRotateImage270();
void slotMirrorImageVertical();
void slotMirrorImageHorizontal();
void slotRotateLayer();
};
#endif // ROTATEIMAGE_H
diff --git a/plugins/extensions/separate_channels/dlg_separate.h b/plugins/extensions/separate_channels/dlg_separate.h
index cc8d0e1879..020a628325 100644
--- a/plugins/extensions/separate_channels/dlg_separate.h
+++ b/plugins/extensions/separate_channels/dlg_separate.h
@@ -1,75 +1,75 @@
/*
* dlg_imagesize.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_SEPARATE
#define DLG_SEPARATE
#include <KoDialog.h>
#include <kis_channel_separator.h>
#include "ui_wdg_separations.h"
class WdgSeparations : public QWidget, public Ui::WdgSeparations
{
public:
WdgSeparations(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
/**
* This dialog allows the user to configure the decomposition of an image
* into layers: one layer for each color channel.
*/
class DlgSeparate: public KoDialog
{
Q_OBJECT
public:
DlgSeparate(const QString & imageCS, const QString & layerCS, QWidget * parent = 0,
const char* name = 0);
- ~DlgSeparate();
+ ~DlgSeparate() override;
public:
enumSepAlphaOptions getAlphaOptions();
enumSepSource getSource();
enumSepOutput getOutput();
bool getDownscale();
void enableDownscale(bool enable);
bool getToColor();
private Q_SLOTS:
void slotSetColorSpaceLabel();
void okClicked();
private:
WdgSeparations * m_page;
QString m_imageCS;
QString m_layerCS;
};
#endif // DLG_SEPARATE
diff --git a/plugins/extensions/separate_channels/kis_separate_channels_plugin.h b/plugins/extensions/separate_channels/kis_separate_channels_plugin.h
index 098f8117db..f9e9e2019e 100644
--- a/plugins/extensions/separate_channels/kis_separate_channels_plugin.h
+++ b/plugins/extensions/separate_channels/kis_separate_channels_plugin.h
@@ -1,39 +1,39 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_SEPARATE_CHANNELS_PLUGIN_H_
#define _KIS_SEPARATE_CHANNELS_PLUGIN_H_
#include <QVariant>
#include <kis_view_plugin.h>
class KisSeparateChannelsPlugin : public KisViewPlugin
{
Q_OBJECT
public:
KisSeparateChannelsPlugin(QObject *parent, const QVariantList &);
- virtual ~KisSeparateChannelsPlugin();
+ ~KisSeparateChannelsPlugin() override;
private Q_SLOTS:
void slotSeparate();
};
#endif
diff --git a/plugins/extensions/shearimage/dlg_shearimage.h b/plugins/extensions/shearimage/dlg_shearimage.h
index 05a13a2cf8..b8cf81a202 100644
--- a/plugins/extensions/shearimage/dlg_shearimage.h
+++ b/plugins/extensions/shearimage/dlg_shearimage.h
@@ -1,65 +1,65 @@
/*
* dlg_shearimage.h -- part of KimageShop^WKrayon^WKrita
*
* Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_SHEARIMAGE
#define DLG_SHEARIMAGE
#include <KoDialog.h>
#include "ui_wdg_shearimage.h"
class WdgShearImage : public QWidget, public Ui::WdgShearImage
{
Q_OBJECT
public:
WdgShearImage(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgShearImage: public KoDialog
{
Q_OBJECT
public:
DlgShearImage(QWidget * parent = 0,
const char* name = 0);
- ~DlgShearImage();
+ ~DlgShearImage() override;
void setAngleX(quint32 w);
void setAngleY(quint32 w);
qint32 angleX();
qint32 angleY();
private Q_SLOTS:
void okClicked();
private:
WdgShearImage * m_page;
double m_oldAngle;
bool m_lock;
};
#endif // DLG_SHEARIMAGE
diff --git a/plugins/extensions/shearimage/shearimage.h b/plugins/extensions/shearimage/shearimage.h
index 8338ec9f72..d9d1f8b5f8 100644
--- a/plugins/extensions/shearimage/shearimage.h
+++ b/plugins/extensions/shearimage/shearimage.h
@@ -1,40 +1,40 @@
/*
* shearimage.h -- Part of Krita
*
* Copyright (c) 2004 Michael Thaler (michael.thaler@physik.tu-muenchen.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef SHEARIMAGE_H
#define SHEARIMAGE_H
#include <QVariant>
#include <kis_view_plugin.h>
class ShearImage : public KisViewPlugin
{
Q_OBJECT
public:
ShearImage(QObject *parent, const QVariantList &);
- virtual ~ShearImage();
+ ~ShearImage() override;
private Q_SLOTS:
void slotShearImage();
void slotShearLayer();
};
#endif // SHEARIMAGE_H
diff --git a/plugins/extensions/waveletdecompose/dlg_waveletdecompose.h b/plugins/extensions/waveletdecompose/dlg_waveletdecompose.h
index b24a08c309..90a2307cfc 100644
--- a/plugins/extensions/waveletdecompose/dlg_waveletdecompose.h
+++ b/plugins/extensions/waveletdecompose/dlg_waveletdecompose.h
@@ -1,60 +1,60 @@
/*
*
* Copyright (c) 2016 Miroslav Talasek <miroslav.talasek@seznam.cz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DLG_WAVELETDECOMPOSE
#define DLG_WAVELETDECOMPOSE
#include <KoDialog.h>
#include "ui_wdg_waveletdecompose.h"
class WdgWaveletDecompose : public QWidget, public Ui::WdgWaveletDecompose
{
Q_OBJECT
public:
WdgWaveletDecompose(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class DlgWaveletDecompose: public KoDialog
{
Q_OBJECT
public:
DlgWaveletDecompose(QWidget * parent = 0,
const char* name = 0);
- ~DlgWaveletDecompose();
+ ~DlgWaveletDecompose() override;
void setScales(quint32 scales);
qint32 scales();
private Q_SLOTS:
void okClicked();
private:
WdgWaveletDecompose * m_page;
};
#endif // DLG_WAVELETDECOMPOSE
diff --git a/plugins/extensions/waveletdecompose/waveletdecompose.h b/plugins/extensions/waveletdecompose/waveletdecompose.h
index 8ca2387154..9456ca7044 100644
--- a/plugins/extensions/waveletdecompose/waveletdecompose.h
+++ b/plugins/extensions/waveletdecompose/waveletdecompose.h
@@ -1,40 +1,40 @@
/*
* Copyright (C) 2016 Miroslav Talasek <miroslav.talasek@seznam.cz>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef WAVELETDECOMPOSE_H
#define WAVELETDECOMPOSE_H
#include <QVariant>
#include <QUrl>
#include <kis_view_plugin.h>
class WaveletDecompose : public KisViewPlugin
{
Q_OBJECT
public:
WaveletDecompose(QObject *parent, const QVariantList &);
- virtual ~WaveletDecompose();
+ ~WaveletDecompose() override;
private Q_SLOTS:
void slotWaveletDecompose();
};
#endif // WAVELETDECOMPOSE_H
diff --git a/plugins/filters/blur/blur.h b/plugins/filters/blur/blur.h
index 46bfdc4ab1..1d3ce30a15 100644
--- a/plugins/filters/blur/blur.h
+++ b/plugins/filters/blur/blur.h
@@ -1,35 +1,35 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef BLURPLUGIN_H
#define BLURPLUGIN_H
#include <QObject>
#include <QVariant>
class BlurFilterPlugin : public QObject
{
Q_OBJECT
public:
BlurFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~BlurFilterPlugin();
+ ~BlurFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/blur/kis_blur_filter.h b/plugins/filters/blur/kis_blur_filter.h
index 87e48eba15..aee3bd80d6 100644
--- a/plugins/filters/blur/kis_blur_filter.h
+++ b/plugins/filters/blur/kis_blur_filter.h
@@ -1,48 +1,48 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BLUR_FILTER_H
#define KIS_BLUR_FILTER_H
#include "filter/kis_filter.h"
class KisBlurFilter : public KisFilter
{
public:
KisBlurFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("blur", i18n("Blur"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
- QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
+ QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
};
#endif
diff --git a/plugins/filters/blur/kis_gaussian_blur_filter.h b/plugins/filters/blur/kis_gaussian_blur_filter.h
index eb5e18da39..770123f345 100644
--- a/plugins/filters/blur/kis_gaussian_blur_filter.h
+++ b/plugins/filters/blur/kis_gaussian_blur_filter.h
@@ -1,50 +1,50 @@
/* This file is part of Krita
*
* Copyright (c) 2009 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GAUSSIAN_BLUR_FILTER_H
#define KIS_GAUSSIAN_BLUR_FILTER_H
#include "filter/kis_filter.h"
#include "ui_wdg_gaussian_blur.h"
#include <Eigen/Core>
class KisGaussianBlurFilter : public KisFilter
{
public:
KisGaussianBlurFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& rect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("gaussian blur", i18n("Gaussian Blur"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
- QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
+ QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
};
#endif
diff --git a/plugins/filters/blur/kis_lens_blur_filter.h b/plugins/filters/blur/kis_lens_blur_filter.h
index 11a06fe7e4..f3d330b0bb 100644
--- a/plugins/filters/blur/kis_lens_blur_filter.h
+++ b/plugins/filters/blur/kis_lens_blur_filter.h
@@ -1,59 +1,59 @@
/*
* This file is part of Krita
*
* Copyright (c) 2010 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_LENS_BLUR_FILTER_H
#define KIS_LENS_BLUR_FILTER_H
#include "filter/kis_filter.h"
#include "ui_wdg_lens_blur.h"
#include <Eigen/Core>
class KisLensBlurFilter : public KisFilter
{
public:
KisLensBlurFilter();
public:
void processImpl(KisPaintDeviceSP src,
const QRect& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("lens blur", i18n("Lens Blur"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
static QSize getKernelHalfSize(const KisFilterConfigurationSP config, int lod);
- QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
- QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
+ QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
+ QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
public:
- KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
private:
static QPolygonF getIrisPolygon(const KisFilterConfigurationSP config, int lod);
};
#endif
diff --git a/plugins/filters/blur/kis_motion_blur_filter.h b/plugins/filters/blur/kis_motion_blur_filter.h
index 940c469c10..ce6c878d72 100644
--- a/plugins/filters/blur/kis_motion_blur_filter.h
+++ b/plugins/filters/blur/kis_motion_blur_filter.h
@@ -1,52 +1,52 @@
/*
* This file is part of Krita
*
* Copyright (c) 2010 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MOTION_BLUR_FILTER_H
#define KIS_MOTION_BLUR_FILTER_H
#include "filter/kis_filter.h"
#include "ui_wdg_motion_blur.h"
#include <Eigen/Core>
class KisMotionBlurFilter : public KisFilter
{
public:
KisMotionBlurFilter();
public:
void processImpl(KisPaintDeviceSP src,
const QRect& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("motion blur", i18n("Motion Blur"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
- QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
+ QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
};
#endif
diff --git a/plugins/filters/blur/kis_wdg_blur.h b/plugins/filters/blur/kis_wdg_blur.h
index de60032597..1b770b30c5 100644
--- a/plugins/filters/blur/kis_wdg_blur.h
+++ b/plugins/filters/blur/kis_wdg_blur.h
@@ -1,52 +1,52 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_WDG_BLUR_H_
#define _KIS_WDG_BLUR_H_
#include <kis_config_widget.h>
class Ui_WdgBlur;
class KisWdgBlur : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgBlur(QWidget * parent);
- virtual ~KisWdgBlur();
+ ~KisWdgBlur() override;
inline const Ui_WdgBlur* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private Q_SLOTS:
void linkSpacingToggled(bool);
void spinBoxHalfWidthChanged(int);
void spinBoxHalfHeightChanged(int);
private:
bool m_halfSizeLink;
Ui_WdgBlur* m_widget;
};
#endif
diff --git a/plugins/filters/blur/kis_wdg_gaussian_blur.h b/plugins/filters/blur/kis_wdg_gaussian_blur.h
index 35bb17bad7..de4d0be4ee 100644
--- a/plugins/filters/blur/kis_wdg_gaussian_blur.h
+++ b/plugins/filters/blur/kis_wdg_gaussian_blur.h
@@ -1,49 +1,49 @@
/*
* This file is part of Krita
*
* Copyright (c) 2009 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_WDG_GAUSSIAN_BLUR_H_
#define _KIS_WDG_GAUSSIAN_BLUR_H_
#include <kis_config_widget.h>
class Ui_WdgGaussianBlur;
class KisWdgGaussianBlur : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgGaussianBlur(QWidget * parent);
- virtual ~KisWdgGaussianBlur();
+ ~KisWdgGaussianBlur() override;
inline const Ui_WdgGaussianBlur* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private Q_SLOTS:
void horizontalRadiusChanged(qreal);
void verticalRadiusChanged(qreal);
void aspectLockChanged(bool);
private:
Ui_WdgGaussianBlur* m_widget;
};
#endif
diff --git a/plugins/filters/blur/kis_wdg_lens_blur.h b/plugins/filters/blur/kis_wdg_lens_blur.h
index 0f573573d8..ca3ee745d0 100644
--- a/plugins/filters/blur/kis_wdg_lens_blur.h
+++ b/plugins/filters/blur/kis_wdg_lens_blur.h
@@ -1,43 +1,43 @@
/*
* This file is part of Krita
*
* Copyright (c) 2010 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_WDG_LENS_BLUR_H_
#define _KIS_WDG_LENS_BLUR_H_
#include <kis_config_widget.h>
class Ui_WdgLensBlur;
class KisWdgLensBlur : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgLensBlur(QWidget * parent);
- virtual ~KisWdgLensBlur();
+ ~KisWdgLensBlur() override;
inline const Ui_WdgLensBlur* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgLensBlur* m_widget;
};
#endif
diff --git a/plugins/filters/blur/kis_wdg_motion_blur.h b/plugins/filters/blur/kis_wdg_motion_blur.h
index 29749d3432..b61fba8f5a 100644
--- a/plugins/filters/blur/kis_wdg_motion_blur.h
+++ b/plugins/filters/blur/kis_wdg_motion_blur.h
@@ -1,46 +1,46 @@
/*
* This file is part of Krita
*
* Copyright (c) 2010 Edward Apap <schumifer@hotmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_WDG_MOTION_BLUR_H_
#define _KIS_WDG_MOTION_BLUR_H_
#include <kis_config_widget.h>
class Ui_WdgMotionBlur;
class KisWdgMotionBlur : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgMotionBlur(QWidget * parent);
- virtual ~KisWdgMotionBlur();
+ ~KisWdgMotionBlur() override;
inline const Ui_WdgMotionBlur* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
public Q_SLOTS:
void angleSliderChanged(int);
void angleDialChanged(int);
private:
Ui_WdgMotionBlur* m_widget;
};
#endif
diff --git a/plugins/filters/colors/colors.h b/plugins/filters/colors/colors.h
index c85f0aac0b..dc61f01888 100644
--- a/plugins/filters/colors/colors.h
+++ b/plugins/filters/colors/colors.h
@@ -1,35 +1,35 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLORS_H
#define COLORS_H
#include <QObject>
#include <QVariant>
class KritaExtensionsColors : public QObject
{
Q_OBJECT
public:
KritaExtensionsColors(QObject *parent, const QVariantList &);
- virtual ~KritaExtensionsColors();
+ ~KritaExtensionsColors() override;
};
#endif
diff --git a/plugins/filters/colors/kis_color_to_alpha.h b/plugins/filters/colors/kis_color_to_alpha.h
index 01a8e21b99..c0048bd1d8 100644
--- a/plugins/filters/colors/kis_color_to_alpha.h
+++ b/plugins/filters/colors/kis_color_to_alpha.h
@@ -1,49 +1,49 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_TO_ALPHA_H_
#define KIS_COLOR_TO_ALPHA_H_
#include "filter/kis_filter.h"
class KisFilterColorToAlpha : public KisFilter
{
public:
KisFilterColorToAlpha();
void processImpl(KisPaintDeviceSP device,
const QRect& rect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("colortoalpha", i18n("Color to Alpha"));
}
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/plugins/filters/colors/kis_minmax_filters.h b/plugins/filters/colors/kis_minmax_filters.h
index fca02f4f6a..c71f036764 100644
--- a/plugins/filters/colors/kis_minmax_filters.h
+++ b/plugins/filters/colors/kis_minmax_filters.h
@@ -1,60 +1,60 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MINMAX_FILTERS_H
#define KIS_MINMAX_FILTERS_H
#include "filter/kis_filter.h"
class KisFilterMax : public KisFilter
{
public:
KisFilterMax();
void processImpl(KisPaintDeviceSP src,
const QRect& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("maximize", i18n("Maximize Channel"));
}
};
class KisFilterMin : public KisFilter
{
public:
KisFilterMin();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& rect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("minimize", i18n("Minimize Channel"));
}
};
#endif
diff --git a/plugins/filters/colors/kis_wdg_color_to_alpha.h b/plugins/filters/colors/kis_wdg_color_to_alpha.h
index 44e83ef423..2272161fd1 100644
--- a/plugins/filters/colors/kis_wdg_color_to_alpha.h
+++ b/plugins/filters/colors/kis_wdg_color_to_alpha.h
@@ -1,60 +1,60 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_WDG_COLOR_TO_ALPHA_H_
#define _KIS_WDG_COLOR_TO_ALPHA_H_
#include <kis_config_widget.h>
class KoColor;
class Ui_WdgColorToAlphaBase;
class KisWdgColorToAlpha : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgColorToAlpha(QWidget * parent);
- virtual ~KisWdgColorToAlpha();
+ ~KisWdgColorToAlpha() override;
inline const Ui_WdgColorToAlphaBase* widget() const {
return m_widget;
}
- void setView(KisViewManager *view);
+ void setView(KisViewManager *view) override;
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
protected:
- void hideEvent(QHideEvent *);
- void showEvent(QShowEvent *);
+ void hideEvent(QHideEvent *) override;
+ void showEvent(QShowEvent *) override;
private Q_SLOTS:
void slotFgColorChanged(const KoColor &color);
void slotColorSelectorChanged(const KoColor &color);
void slotCustomColorSelected(const KoColor &color);
private:
Ui_WdgColorToAlphaBase* m_widget;
KisViewManager *m_view;
};
#endif
diff --git a/plugins/filters/colorsfilters/colorsfilters.h b/plugins/filters/colorsfilters/colorsfilters.h
index 40e84aba19..67aa3b2957 100644
--- a/plugins/filters/colorsfilters/colorsfilters.h
+++ b/plugins/filters/colorsfilters/colorsfilters.h
@@ -1,55 +1,55 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef COLORSFILTERS_H
#define COLORSFILTERS_H
#include <QObject>
#include <QVariant>
#include "kis_perchannel_filter.h"
#include "filter/kis_color_transformation_filter.h"
class ColorsFilters : public QObject
{
Q_OBJECT
public:
ColorsFilters(QObject *parent, const QVariantList &);
- virtual ~ColorsFilters();
+ ~ColorsFilters() override;
};
class KisAutoContrast : public KisFilter
{
public:
KisAutoContrast();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("autocontrast", i18n("Auto Contrast"));
}
};
#endif
diff --git a/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h b/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h
index 1a4508ba1d..b92dddac7c 100644
--- a/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h
+++ b/plugins/filters/colorsfilters/kis_brightness_contrast_filter.h
@@ -1,116 +1,116 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BRIGHTNESS_CONTRAST_FILTER_H_
#define _KIS_BRIGHTNESS_CONTRAST_FILTER_H_
#include <QList>
#include "filter/kis_color_transformation_filter.h"
#include "kis_config_widget.h"
#include "ui_wdg_brightness_contrast.h"
#include <filter/kis_color_transformation_configuration.h>
#include <kis_selection.h>
#include <kis_paint_device.h>
#include <kis_processing_information.h>
#include <KoColor.h>
class QWidget;
class KoColorTransformation;
class WdgBrightnessContrast : public QWidget, public Ui::WdgBrightnessContrast
{
Q_OBJECT
public:
WdgBrightnessContrast(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KisBrightnessContrastFilterConfiguration : public KisColorTransformationConfiguration
{
public:
using KisFilterConfiguration::fromXML;
using KisFilterConfiguration::toXML;
using KisFilterConfiguration::fromLegacyXML;
- virtual void fromLegacyXML(const QDomElement& root);
+ void fromLegacyXML(const QDomElement& root) override;
- virtual void fromXML(const QDomElement& e);
- virtual void toXML(QDomDocument& doc, QDomElement& root) const;
+ void fromXML(const QDomElement& e) override;
+ void toXML(QDomDocument& doc, QDomElement& root) const override;
KisBrightnessContrastFilterConfiguration();
- virtual ~KisBrightnessContrastFilterConfiguration();
+ ~KisBrightnessContrastFilterConfiguration() override;
- virtual void setCurve(const KisCubicCurve &curve);
+ void setCurve(const KisCubicCurve &curve) override;
const QVector<quint16>& transfer() const;
- virtual const KisCubicCurve& curve() const;
+ const KisCubicCurve& curve() const override;
private:
void updateTransfer();
private:
KisCubicCurve m_curve;
QVector<quint16> m_transfer;
};
/**
* This class affect Intensity Y of the image
*/
class KisBrightnessContrastFilter : public KisColorTransformationFilter
{
public:
KisBrightnessContrastFilter();
public:
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
static inline KoID id() {
return KoID("brightnesscontrast", i18n("Brightness / Contrast"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
class KisBrightnessContrastConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisBrightnessContrastConfigWidget(QWidget * parent, KisPaintDeviceSP dev, Qt::WFlags f = 0);
- virtual ~KisBrightnessContrastConfigWidget();
+ ~KisBrightnessContrastConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
WdgBrightnessContrast * m_page;
- void setView(KisViewManager *view);
+ void setView(KisViewManager *view) override;
public Q_SLOTS:
void slotDrawLine(const KoColor &color);
};
#endif
diff --git a/plugins/filters/colorsfilters/kis_color_balance_filter.h b/plugins/filters/colorsfilters/kis_color_balance_filter.h
index d7303e3ef5..57ff681f3c 100644
--- a/plugins/filters/colorsfilters/kis_color_balance_filter.h
+++ b/plugins/filters/colorsfilters/kis_color_balance_filter.h
@@ -1,80 +1,80 @@
/*
* Copyright (c) 2013 Sahil Nagpal <nagpal.sahil01@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLOR_BALANCE_FILTER_H_
#define _KIS_COLOR_BALANCE_FILTER_H_
#include <QList>
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
#include "ui_wdg_color_balance.h"
#include "filter/kis_color_transformation_filter.h"
class QWidget;
class KoColorTransformation;
class KisColorBalanceFilter : public KisColorTransformationFilter
{
public:
KisColorBalanceFilter();
public:
enum Type {
SHADOWS,
MIDTONES,
HIGHLIGHTS
};
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
static inline KoID id() {
return KoID("colorbalance", i18n("Color Balance"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
class KisColorBalanceConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisColorBalanceConfigWidget(QWidget * parent);
- virtual ~KisColorBalanceConfigWidget();
+ ~KisColorBalanceConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
Ui_Form * m_page;
QString m_id;
public Q_SLOTS:
void slotShadowsClear();
void slotMidtonesClear();
void slotHighlightsClear();
};
#endif
diff --git a/plugins/filters/colorsfilters/kis_desaturate_filter.h b/plugins/filters/colorsfilters/kis_desaturate_filter.h
index 874bf29980..a2e058052b 100644
--- a/plugins/filters/colorsfilters/kis_desaturate_filter.h
+++ b/plugins/filters/colorsfilters/kis_desaturate_filter.h
@@ -1,70 +1,70 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef KIS_DESATURATE_FILTER_H
#define KIS_DESATURATE_FILTER_H
#include <QObject>
#include <QVariant>
#include <kis_config_widget.h>
#include <filter/kis_color_transformation_filter.h>
#include "ui_wdg_desaturate.h"
class KoColorSpace;
class KoColorTransformation;
class KisDesaturateFilter : public KisColorTransformationFilter
{
public:
KisDesaturateFilter();
- ~KisDesaturateFilter();
+ ~KisDesaturateFilter() override;
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
static inline KoID id() {
return KoID("desaturate", i18n("Desaturate"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
class KisDesaturateConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisDesaturateConfigWidget(QWidget * parent, Qt::WFlags f = 0);
- virtual ~KisDesaturateConfigWidget();
+ ~KisDesaturateConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
Ui_WdgDesaturate *m_page;
QButtonGroup *m_group;
};
#endif
diff --git a/plugins/filters/colorsfilters/kis_hsv_adjustment_filter.h b/plugins/filters/colorsfilters/kis_hsv_adjustment_filter.h
index 934cbb9f15..ae27f37363 100644
--- a/plugins/filters/colorsfilters/kis_hsv_adjustment_filter.h
+++ b/plugins/filters/colorsfilters/kis_hsv_adjustment_filter.h
@@ -1,77 +1,77 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2
* of the License.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_HSV_ADJUSTMENT_FILTER_H_
#define _KIS_HSV_ADJUSTMENT_FILTER_H_
#include <QList>
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
#include "ui_wdg_hsv_adjustment.h"
#include "filter/kis_color_transformation_filter.h"
class QWidget;
class KoColorTransformation;
/**
* This class affect Intensity Y of the image
*/
class KisHSVAdjustmentFilter : public KisColorTransformationFilter
{
public:
KisHSVAdjustmentFilter();
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
static inline KoID id() {
return KoID("hsvadjustment", i18n("HSV/HSL Adjustment"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
class KisHSVConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisHSVConfigWidget(QWidget * parent, Qt::WFlags f = 0);
- virtual ~KisHSVConfigWidget();
+ ~KisHSVConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
Ui_WdgHSVAdjustment * m_page;
private Q_SLOTS:
void configureSliderLimitsAndLabels();
};
#endif
diff --git a/plugins/filters/colorsfilters/kis_perchannel_filter.h b/plugins/filters/colorsfilters/kis_perchannel_filter.h
index 566734bd60..2169279ccf 100644
--- a/plugins/filters/colorsfilters/kis_perchannel_filter.h
+++ b/plugins/filters/colorsfilters/kis_perchannel_filter.h
@@ -1,135 +1,135 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PERCHANNEL_FILTER_H_
#define _KIS_PERCHANNEL_FILTER_H_
#include <QPair>
#include <QList>
#include <filter/kis_color_transformation_filter.h>
#include <filter/kis_color_transformation_configuration.h>
#include <kis_config_widget.h>
#include <kis_paint_device.h>
#include "ui_wdg_perchannel.h"
#include "virtual_channel_info.h"
class WdgPerChannel : public QWidget, public Ui::WdgPerChannel
{
Q_OBJECT
public:
WdgPerChannel(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KisPerChannelFilterConfiguration
: public KisColorTransformationConfiguration
{
public:
KisPerChannelFilterConfiguration(int n);
- ~KisPerChannelFilterConfiguration();
+ ~KisPerChannelFilterConfiguration() override;
using KisFilterConfiguration::fromXML;
using KisFilterConfiguration::toXML;
using KisFilterConfiguration::fromLegacyXML;
- virtual void fromLegacyXML(const QDomElement& root);
+ void fromLegacyXML(const QDomElement& root) override;
- virtual void fromXML(const QDomElement& e);
- virtual void toXML(QDomDocument& doc, QDomElement& root) const;
+ void fromXML(const QDomElement& e) override;
+ void toXML(QDomDocument& doc, QDomElement& root) const override;
- virtual void setCurves(QList<KisCubicCurve> &curves);
+ void setCurves(QList<KisCubicCurve> &curves) override;
static inline void initDefaultCurves(QList<KisCubicCurve> &curves, int nCh);
- bool isCompatible(const KisPaintDeviceSP) const;
+ bool isCompatible(const KisPaintDeviceSP) const override;
const QVector<QVector<quint16> >& transfers() const;
- virtual const QList<KisCubicCurve>& curves() const;
+ const QList<KisCubicCurve>& curves() const override;
private:
QList<KisCubicCurve> m_curves;
private:
void updateTransfers();
private:
QVector<QVector<quint16> > m_transfers;
};
/**
* This class is generic for filters that affect channel separately
*/
class KisPerChannelFilter
: public KisColorTransformationFilter
{
public:
KisPerChannelFilter();
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ KisFilterConfigurationSP factoryConfiguration() const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
- virtual bool needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const;
+ bool needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const override;
static inline KoID id() {
return KoID("perchannel", i18n("Color Adjustment"));
}
private:
};
class KisPerChannelConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisPerChannelConfigWidget(QWidget * parent, KisPaintDeviceSP dev, Qt::WFlags f = 0);
- virtual ~KisPerChannelConfigWidget();
+ ~KisPerChannelConfigWidget() override;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
+ KisPropertiesConfigurationSP configuration() const override;
private Q_SLOTS:
virtual void setActiveChannel(int ch);
private:
QVector<VirtualChannelInfo> m_virtualChannels;
int m_activeVChannel;
// private routines
inline QPixmap getHistogram();
inline QPixmap createGradient(Qt::Orientation orient /*, int invert (not used now) */);
// members
WdgPerChannel * m_page;
KisPaintDeviceSP m_dev;
KisHistogram *m_histogram;
mutable QList<KisCubicCurve> m_curves;
// scales for displaying color numbers
double m_scale;
double m_shift;
};
#endif
diff --git a/plugins/filters/convolutionfilters/convolutionfilters.h b/plugins/filters/convolutionfilters/convolutionfilters.h
index e92add0196..6e12664e3d 100644
--- a/plugins/filters/convolutionfilters/convolutionfilters.h
+++ b/plugins/filters/convolutionfilters/convolutionfilters.h
@@ -1,158 +1,158 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CONVOLUTIONFILTERS_H
#define CONVOLUTIONFILTERS_H
#include <QObject>
#include <QVariant>
#include "kis_convolution_filter.h"
class KisSharpenFilter : public KisConvolutionFilter
{
public:
KisSharpenFilter();
public:
static inline KoID id() {
return KoID("sharpen", i18n("Sharpen"));
}
};
class KisMeanRemovalFilter : public KisConvolutionFilter
{
public:
KisMeanRemovalFilter();
public:
static inline KoID id() {
return KoID("mean removal", i18n("Mean Removal"));
}
};
class KisEmbossLaplascianFilter : public KisConvolutionFilter
{
public:
KisEmbossLaplascianFilter();
public:
static inline KoID id() {
return KoID("emboss laplascian", i18n("Emboss (Laplacian)"));
}
};
class KisEmbossInAllDirectionsFilter : public KisConvolutionFilter
{
public:
KisEmbossInAllDirectionsFilter();
public:
static inline KoID id() {
return KoID("emboss all directions", i18n("Emboss in All Directions"));
}
};
class KisEmbossHorizontalVerticalFilter : public KisConvolutionFilter
{
public:
KisEmbossHorizontalVerticalFilter();
public:
static inline KoID id() {
return KoID("emboss horizontal and vertical", i18n("Emboss Horizontal & Vertical"));
}
};
class KisEmbossVerticalFilter : public KisConvolutionFilter
{
public:
KisEmbossVerticalFilter();
public:
static inline KoID id() {
return KoID("emboss vertical only", i18n("Emboss Vertical Only"));
}
};
class KisEmbossHorizontalFilter : public KisConvolutionFilter
{
public:
KisEmbossHorizontalFilter();
public:
static inline KoID id() {
return KoID("emboss horizontal only", i18n("Emboss Horizontal Only"));
}
};
class KisEmbossDiagonalFilter : public KisConvolutionFilter
{
public:
KisEmbossDiagonalFilter();
public:
static inline KoID id() {
return KoID("emboss diagonal", i18n("Emboss Diagonal"));
}
};
class KisTopEdgeDetectionFilter : public KisConvolutionFilter
{
public:
KisTopEdgeDetectionFilter();
public:
static inline KoID id() {
return KoID("top edge detections", i18n("Top Edge Detection"));
}
};
class KisRightEdgeDetectionFilter : public KisConvolutionFilter
{
public:
KisRightEdgeDetectionFilter();
public:
static inline KoID id() {
return KoID("right edge detections", i18n("Right Edge Detection"));
}
};
class KisBottomEdgeDetectionFilter : public KisConvolutionFilter
{
public:
KisBottomEdgeDetectionFilter();
public:
static inline KoID id() {
return KoID("bottom edge detections", i18n("Bottom Edge Detection"));
}
};
class KisLeftEdgeDetectionFilter : public KisConvolutionFilter
{
public:
KisLeftEdgeDetectionFilter();
public:
static inline KoID id() {
return KoID("left edge detections", i18n("Left Edge Detection"));
}
};
class KritaConvolutionFilters : public QObject
{
Q_OBJECT
public:
KritaConvolutionFilters(QObject *parent, const QVariantList &);
- virtual ~KritaConvolutionFilters();
+ ~KritaConvolutionFilters() override;
};
#endif
diff --git a/plugins/filters/convolutionfilters/kis_convolution_filter.h b/plugins/filters/convolutionfilters/kis_convolution_filter.h
index e05c5d983d..ab7cdb45d9 100644
--- a/plugins/filters/convolutionfilters/kis_convolution_filter.h
+++ b/plugins/filters/convolutionfilters/kis_convolution_filter.h
@@ -1,47 +1,47 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CONVOLUTION_FILTER_H_
#define _KIS_CONVOLUTION_FILTER_H_
#include "filter/kis_filter.h"
#include "filter/kis_filter_registry.h"
#include "filter/kis_filter_configuration.h"
#include "kis_convolution_painter.h"
class KisConvolutionFilter : public KisFilter
{
public:
KisConvolutionFilter(const KoID& id, const KoID & category, const QString & entry);
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater* progressUpdater) const;
+ KoUpdater* progressUpdater) const override;
protected:
void setIgnoreAlpha(bool v);
protected:
KisConvolutionKernelSP m_matrix;
bool m_ignoreAlpha;
};
#endif
diff --git a/plugins/filters/dodgeburn/DodgeBurn.h b/plugins/filters/dodgeburn/DodgeBurn.h
index 9d8d08cc46..2acc751eb3 100644
--- a/plugins/filters/dodgeburn/DodgeBurn.h
+++ b/plugins/filters/dodgeburn/DodgeBurn.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DODGE_BURN_H
#define DODGE_BURN_H
#include "filter/kis_color_transformation_filter.h"
#include "kis_config_widget.h"
class KisFilterDodgeBurn : public KisColorTransformationFilter
{
public:
enum Type {
SHADOWS,
MIDTONES,
HIGHLIGHTS
};
public:
KisFilterDodgeBurn(const QString& id, const QString& prefix, const QString& name );
public:
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
- KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
private:
QString m_prefix;
};
class Ui_DodgeBurnConfigurationBaseWidget;
class KisDodgeBurnConfigWidget : public KisConfigWidget
{
public:
KisDodgeBurnConfigWidget(QWidget * parent, const QString& id);
- virtual ~KisDodgeBurnConfigWidget();
+ ~KisDodgeBurnConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
QString m_id;
Ui_DodgeBurnConfigurationBaseWidget * m_page;
};
#endif
diff --git a/plugins/filters/dodgeburn/DodgeBurnPlugin.h b/plugins/filters/dodgeburn/DodgeBurnPlugin.h
index e4d24981f4..b039ae9de0 100644
--- a/plugins/filters/dodgeburn/DodgeBurnPlugin.h
+++ b/plugins/filters/dodgeburn/DodgeBurnPlugin.h
@@ -1,32 +1,32 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DODGE_BURN_PLUGIN_H_
#define _DODGE_BURN_PLUGIN_H_
#include <QObject>
#include <QVariant>
class DodgeBurnPlugin : public QObject
{
Q_OBJECT
public:
DodgeBurnPlugin(QObject *parent, const QVariantList &);
- virtual ~DodgeBurnPlugin();
+ ~DodgeBurnPlugin() override;
};
#endif
diff --git a/plugins/filters/embossfilter/kis_emboss_filter.h b/plugins/filters/embossfilter/kis_emboss_filter.h
index e441ea3093..67fe340cb5 100644
--- a/plugins/filters/embossfilter/kis_emboss_filter.h
+++ b/plugins/filters/embossfilter/kis_emboss_filter.h
@@ -1,51 +1,51 @@
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_EMBOSS_FILTER_H_
#define _KIS_EMBOSS_FILTER_H_
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
class KisEmbossFilter : public KisFilter
{
public:
KisEmbossFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("emboss", i18n("Emboss with Variable Depth"));
}
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
protected:
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
private:
inline int Lim_Max(int Now, int Up, int Max) const;
};
#endif
diff --git a/plugins/filters/embossfilter/kis_emboss_filter_plugin.h b/plugins/filters/embossfilter/kis_emboss_filter_plugin.h
index e74fb28d7e..eb66738506 100644
--- a/plugins/filters/embossfilter/kis_emboss_filter_plugin.h
+++ b/plugins/filters/embossfilter/kis_emboss_filter_plugin.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_EMBOSS_FILTER_PLUGIN_H_
#define _KIS_EMBOSS_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisEmbossFilterPlugin : public QObject
{
Q_OBJECT
public:
KisEmbossFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisEmbossFilterPlugin();
+ ~KisEmbossFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/example/example.h b/plugins/filters/example/example.h
index d9473105db..92cf3abb52 100644
--- a/plugins/filters/example/example.h
+++ b/plugins/filters/example/example.h
@@ -1,51 +1,51 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef EXAMPLE_H
#define EXAMPLE_H
#include <QObject>
#include <QVariant>
#include "filter/kis_color_transformation_filter.h"
class KritaExample : public QObject
{
Q_OBJECT
public:
KritaExample(QObject *parent, const QVariantList &);
- virtual ~KritaExample();
+ ~KritaExample() override;
};
class KisFilterInvert : public KisColorTransformationFilter
{
public:
KisFilterInvert();
public:
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
static inline KoID id() {
return KoID("invert", i18n("Invert"));
}
- bool needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const;
+ bool needsTransparentPixels(const KisFilterConfigurationSP config, const KoColorSpace *cs) const override;
};
#endif
diff --git a/plugins/filters/fastcolortransfer/fastcolortransfer.h b/plugins/filters/fastcolortransfer/fastcolortransfer.h
index 592e1d4e31..61755c3368 100644
--- a/plugins/filters/fastcolortransfer/fastcolortransfer.h
+++ b/plugins/filters/fastcolortransfer/fastcolortransfer.h
@@ -1,55 +1,55 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLORTRANSFER_H
#define COLORTRANSFER_H
#include <QObject>
#include <QVariant>
#include <filter/kis_filter.h>
class FastColorTransferPlugin : public QObject
{
Q_OBJECT
public:
FastColorTransferPlugin(QObject *parent, const QVariantList &);
- virtual ~FastColorTransferPlugin();
+ ~FastColorTransferPlugin() override;
};
class KisFilterFastColorTransfer : public KisFilter
{
public:
KisFilterFastColorTransfer();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater* progressUpdater) const;
+ KoUpdater* progressUpdater) const override;
static inline KoID id() {
return KoID("colortransfer", i18n("Color Transfer"));
}
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.h b/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.h
index 8825130d91..0547fdaa0c 100644
--- a/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.h
+++ b/plugins/filters/fastcolortransfer/kis_wdg_fastcolortransfer.h
@@ -1,45 +1,45 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_FASTCOLORTRANSFER_H
#define KIS_WDG_FASTCOLORTRANSFER_H
#include <kis_config_widget.h>
class Ui_WdgFastColorTransfer;
/**
@author Cyrille Berger <cberger@cberger.net>
*/
class KisWdgFastColorTransfer : public KisConfigWidget
{
public:
KisWdgFastColorTransfer(QWidget * parent);
- ~KisWdgFastColorTransfer();
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
+ ~KisWdgFastColorTransfer() override;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
inline const Ui_WdgFastColorTransfer* widget() const {
return m_widget;
}
- virtual KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgFastColorTransfer* m_widget;
};
#endif
diff --git a/plugins/filters/gradientmap/gradientmap.h b/plugins/filters/gradientmap/gradientmap.h
index c719e5a249..b874933705 100644
--- a/plugins/filters/gradientmap/gradientmap.h
+++ b/plugins/filters/gradientmap/gradientmap.h
@@ -1,76 +1,76 @@
/*
* This file is part of Krita
*
* Copyright (c) 2016 Spencer Brown <sbrown655@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
#include "QObject"
#include "ui_wdg_gradientmap.h"
#include "kis_properties_configuration.h"
#include "filter/kis_color_transformation_configuration.h"
#include "kis_config_widget.h"
class WdgGradientMap : public QWidget, public Ui::WdgGradientMap
{
Q_OBJECT
public:
WdgGradientMap(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KritaGradientMapFilterConfiguration : public KisColorTransformationConfiguration
{
public:
KritaGradientMapFilterConfiguration();
- virtual ~KritaGradientMapFilterConfiguration();
+ ~KritaGradientMapFilterConfiguration() override;
virtual void setGradient(const KoResource* gradient);
virtual const KoResource* gradient() const;
private:
KoResource const* m_gradient;
};
class KritaGradientMapConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KritaGradientMapConfigWidget(QWidget *parent, KisPaintDeviceSP dev, Qt::WFlags f = 0);
- virtual ~KritaGradientMapConfigWidget();
+ ~KritaGradientMapConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
WdgGradientMap * m_page;
- void setView(KisViewManager *view);
+ void setView(KisViewManager *view) override;
void gradientResourceChanged(KoResource *gradient);
};
class KritaGradientMap : public QObject
{
Q_OBJECT
public:
KritaGradientMap(QObject *parent, const QVariantList &);
- virtual ~KritaGradientMap();
+ ~KritaGradientMap() override;
};
diff --git a/plugins/filters/gradientmap/krita_filter_gradient_map.h b/plugins/filters/gradientmap/krita_filter_gradient_map.h
index 4a3303175c..d54b2abc32 100644
--- a/plugins/filters/gradientmap/krita_filter_gradient_map.h
+++ b/plugins/filters/gradientmap/krita_filter_gradient_map.h
@@ -1,52 +1,52 @@
/*
* This file is part of Krita
*
* Copyright (c) 2016 Spencer Brown <sbrown655@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRADIENT_MAP_H
#define KIS_GRADIENT_MAP_H
#include <kis_global.h>
#include <kis_types.h>
#include <kis_paint_device.h>
#include <filter/kis_filter.h>
#include <kis_filter_configuration.h>
#include <kis_config_widget.h>
#include <KoUpdater.h>
class KritaFilterGradientMap : public KisFilter
{
public:
KritaFilterGradientMap();
public:
static inline KoID id() {
return KoID("gradientmap", i18n("Gradient Map"));
}
- virtual void processImpl(KisPaintDeviceSP device,
+ void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater *progressUpdater) const;
+ KoUpdater *progressUpdater) const override;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
- virtual KisConfigWidget* createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget* createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
#endif
diff --git a/plugins/filters/halftone/kis_halftone_filter.h b/plugins/filters/halftone/kis_halftone_filter.h
index 6c44db621a..b77df890fb 100644
--- a/plugins/filters/halftone/kis_halftone_filter.h
+++ b/plugins/filters/halftone/kis_halftone_filter.h
@@ -1,101 +1,101 @@
/*
* This file is part of Krita
*
* Copyright (c) 2016 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISHALFTONEFILTER_H
#define KISHALFTONEFILTER_H
#include <QObject>
#include <filter/kis_filter.h>
#include <kis_filter_configuration.h>
#include <kis_config_widget.h>
#include "ui_wdg_halftone_filter.h"
class WdgHalftone;
class KritaHalftone : public QObject
{
Q_OBJECT
public:
KritaHalftone(QObject *parent, const QVariantList &);
- virtual ~KritaHalftone();
+ ~KritaHalftone() override;
};
/**
* @brief The kisHalftoneFilter class
* This filter will allow the user to input an image and have it be approximated with
* a halftone pattern. https://en.wikipedia.org/wiki/Halftone
*
* The primary usecase of such a filter is for specialised printing techniques, but for
* many people the half-tone pattern also serves as a neutral pattern that is more pleasant
* than plain flat look. The half tone in this case also becomes a stylistic technique.
*
* Based on that, there's a few ways a user could want to use this techique:
* 1. Per-component. Per patch, each component will have a halftone approximated.
* 2. Intensity only. The relative luminosity of the patch is determined and will be used
* for the approximation, resulting in a black/white pattern.
* 3. Intensity and then two colors mapped to the black/white pattern.
*
* On top of that, the pattern can be rotated, the shape can be chosen, and the user will want to
* decide whether or not to use antialiasing(as printers themselves give
* inefficient results with anti-aliasing).
*
* As of currently, 2 and 3 can be done. 1 is not impossible to code with some creative usage of composite
* modes, but might be a little slow.
*/
class KisHalftoneFilter : public KisFilter
{
public:
KisHalftoneFilter();
static inline KoID id() {
return KoID("halftone", i18n("Halftone"));
}
- virtual void processImpl(KisPaintDeviceSP device,
+ void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater *progressUpdater) const;
+ KoUpdater *progressUpdater) const override;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
- virtual KisConfigWidget *createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev) const override;
private:
QPolygonF m_gridPoints;
};
class KisHalftoneConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisHalftoneConfigWidget(QWidget *parent, KisPaintDeviceSP dev);
- virtual ~KisHalftoneConfigWidget();
+ ~KisHalftoneConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
Ui::WdgHalftone m_page;
};
#endif // KISHALFTONEFILTER_H
diff --git a/plugins/filters/imageenhancement/imageenhancement.h b/plugins/filters/imageenhancement/imageenhancement.h
index 19ffd6f7ea..fcbf3931a2 100644
--- a/plugins/filters/imageenhancement/imageenhancement.h
+++ b/plugins/filters/imageenhancement/imageenhancement.h
@@ -1,36 +1,36 @@
/*
* This file is part of Krita
*
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef IMAGEENHANCEMENT_H
#define IMAGEENHANCEMENT_H
#include <QObject>
#include <QVariant>
class KritaImageEnhancement : public QObject
{
Q_OBJECT
public:
KritaImageEnhancement(QObject *parent, const QVariantList &);
- virtual ~KritaImageEnhancement();
+ ~KritaImageEnhancement() override;
};
#endif
diff --git a/plugins/filters/imageenhancement/kis_simple_noise_reducer.h b/plugins/filters/imageenhancement/kis_simple_noise_reducer.h
index a78ca45075..6ceb3e27b3 100644
--- a/plugins/filters/imageenhancement/kis_simple_noise_reducer.h
+++ b/plugins/filters/imageenhancement/kis_simple_noise_reducer.h
@@ -1,48 +1,48 @@
/*
a * Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSIMPLENOISEREDUCER_H
#define KISSIMPLENOISEREDUCER_H
#include <filter/kis_filter.h>
#include "kis_config_widget.h"
/**
@author Cyrille Berger
*/
class KisSimpleNoiseReducer : public KisFilter
{
public:
KisSimpleNoiseReducer();
- ~KisSimpleNoiseReducer();
+ ~KisSimpleNoiseReducer() override;
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ ) const override;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
static inline KoID id() {
return KoID("gaussiannoisereducer", i18n("Gaussian Noise Reducer"));
}
protected:
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/plugins/filters/imageenhancement/kis_wavelet_noise_reduction.h b/plugins/filters/imageenhancement/kis_wavelet_noise_reduction.h
index e6cbc43854..9657d4329b 100644
--- a/plugins/filters/imageenhancement/kis_wavelet_noise_reduction.h
+++ b/plugins/filters/imageenhancement/kis_wavelet_noise_reduction.h
@@ -1,57 +1,57 @@
/*
* This file is part of the KDE project
*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WAVELET_NOISE_REDUCTION_H
#define KIS_WAVELET_NOISE_REDUCTION_H
#include <vector>
#include <filter/kis_filter.h>
#define BEST_WAVELET_THRESHOLD_VALUE 7.0
/**
@author Cyrille Berger
*/
class KisWaveletNoiseReduction : public KisFilter
{
public:
KisWaveletNoiseReduction();
- ~KisWaveletNoiseReduction();
+ ~KisWaveletNoiseReduction() override;
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ ) const override;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
static inline KoID id() {
return KoID("waveletnoisereducer", i18n("Wavelet Noise Reducer"));
}
private:
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/plugins/filters/indexcolors/indexcolors.h b/plugins/filters/indexcolors/indexcolors.h
index 943fe0d5be..316382ff91 100644
--- a/plugins/filters/indexcolors/indexcolors.h
+++ b/plugins/filters/indexcolors/indexcolors.h
@@ -1,69 +1,69 @@
/*
* Copyright 2014 Manuel Riecke <spell1337@gmail.com>
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appear in all
* copies and that both that the copyright notice and this
* permission notice and warranty disclaimer appear in supporting
* documentation, and that the name of the author not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* The author disclaim all warranties with regard to this
* software, including all implied warranties of merchantability
* and fitness. In no event shall the author be liable for any
* special, indirect or consequential damages or any damages
* whatsoever resulting from loss of use, data or profits, whether
* in an action of contract, negligence or other tortious action,
* arising out of or in connection with the use or performance of
* this software.
*/
#ifndef INDEXCOLORS_H
#define INDEXCOLORS_H
#include <QObject>
#include <QVariant>
#include "filter/kis_color_transformation_filter.h"
#include "kis_config_widget.h"
#include <KoColor.h>
#include "indexcolorpalette.h"
class IndexColors : public QObject
{
Q_OBJECT
public:
IndexColors(QObject *parent, const QVariantList &);
- virtual ~IndexColors();
+ ~IndexColors() override;
};
class KisFilterIndexColors : public KisColorTransformationFilter
{
public:
KisFilterIndexColors();
public:
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
- virtual KisConfigWidget* createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
+ KisConfigWidget* createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
static inline KoID id() {
return KoID("indexcolors", i18n("Index Colors"));
}
protected:
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
class KisIndexColorTransformation : public KoColorTransformation
{
public:
KisIndexColorTransformation(IndexColorPalette palette, const KoColorSpace* cs, int alphaSteps);
- virtual void transform(const quint8* src, quint8* dst, qint32 nPixels) const;
+ void transform(const quint8* src, quint8* dst, qint32 nPixels) const override;
private:
const KoColorSpace* m_colorSpace;
quint32 m_psize;
IndexColorPalette m_palette;
quint16 m_alphaStep;
quint16 m_alphaHalfStep;
};
#endif
diff --git a/plugins/filters/indexcolors/kiswdgindexcolors.h b/plugins/filters/indexcolors/kiswdgindexcolors.h
index ee576f8d6f..902f9a73af 100644
--- a/plugins/filters/indexcolors/kiswdgindexcolors.h
+++ b/plugins/filters/indexcolors/kiswdgindexcolors.h
@@ -1,59 +1,59 @@
/*
* Copyright 2014 Manuel Riecke <spell1337@gmail.com>
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appear in all
* copies and that both that the copyright notice and this
* permission notice and warranty disclaimer appear in supporting
* documentation, and that the name of the author not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* The author disclaim all warranties with regard to this
* software, including all implied warranties of merchantability
* and fitness. In no event shall the author be liable for any
* special, indirect or consequential damages or any damages
* whatsoever resulting from loss of use, data or profits, whether
* in an action of contract, negligence or other tortious action,
* arising out of or in connection with the use or performance of
* this software.
*/
#ifndef KISWDGINDEXCOLORS_H
#define KISWDGINDEXCOLORS_H
#include <kis_config_widget.h>
#include <QSpinBox>
class QCheckBox;
class KisColorButton;
namespace Ui
{
class KisWdgIndexColors;
}
class KisWdgIndexColors : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgIndexColors(QWidget* parent = 0, Qt::WFlags f = 0, int delay = 500);
- virtual KisPropertiesConfigurationSP configuration() const;
- virtual void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
void setup(QStringList shadesLabels, int ramps);
private Q_SLOTS:
void slotColorLimitChanged(int value);
private:
struct ColorWidgets
{
KisColorButton* button;
QCheckBox* checkbox;
};
QVector< QVector<ColorWidgets> > m_colorSelectors;
QVector< QSpinBox* > m_stepSpinners;
Ui::KisWdgIndexColors* ui;
};
#endif // KISWDGINDEXCOLORS_H
diff --git a/plugins/filters/levelfilter/kis_level_filter.h b/plugins/filters/levelfilter/kis_level_filter.h
index d0fe6cf42c..4d581d577b 100644
--- a/plugins/filters/levelfilter/kis_level_filter.h
+++ b/plugins/filters/levelfilter/kis_level_filter.h
@@ -1,84 +1,84 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_LEVEL_FILTER_H_
#define _KIS_LEVEL_FILTER_H_
#include "filter/kis_color_transformation_filter.h"
#include "kis_config_widget.h"
#include "ui_wdg_level.h"
class WdgLevel;
class QWidget;
class KisHistogram;
/**
* This class affect Intensity Y of the image
*/
class KisLevelFilter : public KisColorTransformationFilter
{
public:
KisLevelFilter();
- ~KisLevelFilter();
+ ~KisLevelFilter() override;
public:
// virtual KisFilterConfigurationSP factoryConfiguration() const;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
static inline KoID id() {
return KoID("levels", i18n("Levels"));
}
};
class KisLevelConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisLevelConfigWidget(QWidget * parent, KisPaintDeviceSP dev);
- virtual ~KisLevelConfigWidget();
+ ~KisLevelConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
Ui::WdgLevel m_page;
protected Q_SLOTS:
void slotDrawHistogram(bool logarithmic = false);
void slotModifyInBlackLimit(int);
void slotModifyInWhiteLimit(int);
void slotModifyOutBlackLimit(int);
void slotModifyOutWhiteLimit(int);
void slotAutoLevel(void);
protected:
QScopedPointer<KisHistogram> m_histogram;
bool m_histlog;
};
#endif
diff --git a/plugins/filters/levelfilter/levelfilter.h b/plugins/filters/levelfilter/levelfilter.h
index 474eac6081..518012f9fb 100644
--- a/plugins/filters/levelfilter/levelfilter.h
+++ b/plugins/filters/levelfilter/levelfilter.h
@@ -1,35 +1,35 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Frederic Coiffier <fcoiffie@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef LEVEL_H
#define LEVEL_H
#include <QObject>
#include <QVariant>
class LevelFilter : public QObject
{
Q_OBJECT
public:
LevelFilter(QObject *parent, const QVariantList &);
- virtual ~LevelFilter();
+ ~LevelFilter() override;
};
#endif
diff --git a/plugins/filters/noisefilter/kis_wdg_noise.h b/plugins/filters/noisefilter/kis_wdg_noise.h
index 59f1f04fe7..1e18cf2766 100644
--- a/plugins/filters/noisefilter/kis_wdg_noise.h
+++ b/plugins/filters/noisefilter/kis_wdg_noise.h
@@ -1,47 +1,47 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_NOISE_H
#define KIS_WDG_NOISE_H
#include <kis_config_widget.h>
class Ui_WdgNoiseOptions;
class KisFilter;
class KisWdgNoise : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgNoise(KisFilter* nfilter, QWidget* parent = 0);
- ~KisWdgNoise();
+ ~KisWdgNoise() override;
public:
inline const Ui_WdgNoiseOptions* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgNoiseOptions* m_widget;
int m_seedThreshold, m_seedRed, m_seedGreen, m_seedBlue;
};
#endif
diff --git a/plugins/filters/noisefilter/noisefilter.h b/plugins/filters/noisefilter/noisefilter.h
index 6f3f36b088..53f6fad158 100644
--- a/plugins/filters/noisefilter/noisefilter.h
+++ b/plugins/filters/noisefilter/noisefilter.h
@@ -1,56 +1,56 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef NOISEFILTER_H
#define NOISEFILTER_H
#include <QObject>
#include <QVariant>
#include "filter/kis_filter.h"
class KisConfigWidget;
class KritaNoiseFilter : public QObject
{
Q_OBJECT
public:
KritaNoiseFilter(QObject *parent, const QVariantList &);
- virtual ~KritaNoiseFilter();
+ ~KritaNoiseFilter() override;
};
class KisFilterNoise : public KisFilter
{
public:
KisFilterNoise();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("noise", i18n("Noise"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
#endif
diff --git a/plugins/filters/normalize/kis_normalize.h b/plugins/filters/normalize/kis_normalize.h
index 1b07e70dec..00d7152db3 100644
--- a/plugins/filters/normalize/kis_normalize.h
+++ b/plugins/filters/normalize/kis_normalize.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef NORMALIZE_H
#define NORMALIZE_H
#include <QObject>
#include <QVariant>
#include "filter/kis_color_transformation_filter.h"
class KritaNormalizeFilter : public QObject
{
Q_OBJECT
public:
KritaNormalizeFilter(QObject *parent, const QVariantList &);
- virtual ~KritaNormalizeFilter();
+ ~KritaNormalizeFilter() override;
};
class KisFilterNormalize : public KisColorTransformationFilter
{
public:
KisFilterNormalize();
public:
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
};
class KisNormalizeTransformation : public KoColorTransformation
{
public:
KisNormalizeTransformation(const KoColorSpace* cs);
- virtual void transform(const quint8* src, quint8* dst, qint32 nPixels) const;
+ void transform(const quint8* src, quint8* dst, qint32 nPixels) const override;
private:
const KoColorSpace* m_colorSpace;
quint32 m_psize;
};
#endif
diff --git a/plugins/filters/oilpaintfilter/kis_oilpaint_filter.h b/plugins/filters/oilpaintfilter/kis_oilpaint_filter.h
index 846ebdeaa0..ad73283d02 100644
--- a/plugins/filters/oilpaintfilter/kis_oilpaint_filter.h
+++ b/plugins/filters/oilpaintfilter/kis_oilpaint_filter.h
@@ -1,51 +1,51 @@
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_OILPAINT_FILTER_H_
#define _KIS_OILPAINT_FILTER_H_
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
class KisOilPaintFilter : public KisFilter
{
public:
KisOilPaintFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater* progressUpdater ) const;
+ KoUpdater* progressUpdater ) const override;
static inline KoID id() {
return KoID("oilpaint", i18n("Oilpaint"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
private:
void OilPaint(const KisPaintDeviceSP src, KisPaintDeviceSP dst, const QPoint& srcTopLeft, const QPoint& dstTopLeft, int w, int h,
int BrushSize, int Smoothness, KoUpdater* progressUpdater) const;
void MostFrequentColor(KisPaintDeviceSP src, quint8* dst, const QRect& bounds, int X, int Y, int Radius, int Intensity) const;
};
#endif
diff --git a/plugins/filters/oilpaintfilter/kis_oilpaint_filter_plugin.h b/plugins/filters/oilpaintfilter/kis_oilpaint_filter_plugin.h
index e0810b0214..829771dd7d 100644
--- a/plugins/filters/oilpaintfilter/kis_oilpaint_filter_plugin.h
+++ b/plugins/filters/oilpaintfilter/kis_oilpaint_filter_plugin.h
@@ -1,34 +1,34 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_OILPAINT_FILTER_PLUGIN_H_
#define _KIS_OILPAINT_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisOilPaintFilterPlugin : public QObject
{
Q_OBJECT
public:
KisOilPaintFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisOilPaintFilterPlugin();
+ ~KisOilPaintFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/phongbumpmap/kis_phong_bumpmap_config_widget.h b/plugins/filters/phongbumpmap/kis_phong_bumpmap_config_widget.h
index a61c8d0dbc..aed4fe678b 100644
--- a/plugins/filters/phongbumpmap/kis_phong_bumpmap_config_widget.h
+++ b/plugins/filters/phongbumpmap/kis_phong_bumpmap_config_widget.h
@@ -1,66 +1,66 @@
/*
* Copyright (c) 2010-2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PHONG_BUMPMAP_CONFIG_WIDGET_H
#define KIS_PHONG_BUMPMAP_CONFIG_WIDGET_H
#include "ui_wdgphongbumpmap.h"
#include "kis_paint_device.h"
#include "kis_config_widget.h"
#include "kis_image.h"
class KisPhongBumpmapWidget : public QWidget, public Ui::WdgPhongBumpmap
{
Q_OBJECT
public:
KisPhongBumpmapWidget(QWidget *parent) : QWidget(parent)
{
setupUi(this);
ambientReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
diffuseReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
specularReflectivityKisDoubleSliderSpinBox -> setRange(0, 1, 2);
shinynessExponentKisSliderSpinBox -> setRange(1, 200);
ambientReflectivityKisDoubleSliderSpinBox -> setValue(0.1);
diffuseReflectivityKisDoubleSliderSpinBox -> setValue(0.5);
specularReflectivityKisDoubleSliderSpinBox -> setValue(0.5);
shinynessExponentKisSliderSpinBox -> setValue(40);
}
};
class KisPhongBumpmapConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisPhongBumpmapConfigWidget(const KisPaintDeviceSP dev, QWidget *parent, Qt::WFlags f = 0);
- virtual ~KisPhongBumpmapConfigWidget() {}
- void setConfiguration(const KisPropertiesConfigurationSP config);
- KisPropertiesConfigurationSP configuration() const;
+ ~KisPhongBumpmapConfigWidget() override {}
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
+ KisPropertiesConfigurationSP configuration() const override;
KisPhongBumpmapWidget *m_page;
private:
KisPaintDeviceSP m_device;
private Q_SLOTS:
void slotDisableHeightChannelCombobox(bool normalmapchecked);
};
#endif //KIS_PHONG_BUMPMAP_CONFIG_WIDGET_H
diff --git a/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.h b/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.h
index a2789db634..8de0c9664e 100644
--- a/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.h
+++ b/plugins/filters/phongbumpmap/kis_phong_bumpmap_filter.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2010-2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PHONG_BUMPMAP_FILTER_H
#define KIS_PHONG_BUMPMAP_FILTER_H
#include <kis_types.h>
#include <filter/kis_filter.h>
/**
* This class is an implementation of the phong illumination model.
* It uses a heightmap as an input mesh (normally taken from 1
* channel of a colorspace) to achieve a bumpmapping effect with
* multiple illumination sources.
*/
class KisFilterPhongBumpmap : public KisFilter
{
public:
KisFilterPhongBumpmap();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater *progressUpdater
- ) const;
+ ) const override;
- QRect neededRect(const QRect &rect, const KisFilterConfigurationSP config, int lod) const;
- QRect changedRect(const QRect &rect, const KisFilterConfigurationSP config, int lod) const;
+ QRect neededRect(const QRect &rect, const KisFilterConfigurationSP config, int lod) const override;
+ QRect changedRect(const QRect &rect, const KisFilterConfigurationSP config, int lod) const override;
- virtual KisConfigWidget *createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev) const;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev) const override;
+ KisFilterConfigurationSP factoryConfiguration() const override;
private:
//bool m_usenormalmap;
};
#endif //KIS_PHONG_BUMPMAP_FILTER_H
diff --git a/plugins/filters/phongbumpmap/kis_phong_bumpmap_plugin.h b/plugins/filters/phongbumpmap/kis_phong_bumpmap_plugin.h
index afd46d8a71..49dee056b6 100644
--- a/plugins/filters/phongbumpmap/kis_phong_bumpmap_plugin.h
+++ b/plugins/filters/phongbumpmap/kis_phong_bumpmap_plugin.h
@@ -1,33 +1,33 @@
/*
* Copyright (c) 2010-2011 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PHONG_BUMPMAP_PLUGIN_H
#define KIS_PHONG_BUMPMAP_PLUGIN_H
#include <QObject>
#include <QVariantList>
class KisPhongBumpmapPlugin : public QObject
{
Q_OBJECT
public:
KisPhongBumpmapPlugin(QObject *parent, const QVariantList &);
- virtual ~KisPhongBumpmapPlugin();
+ ~KisPhongBumpmapPlugin() override;
};
#endif //KIS_PHONG_BUMPMAP_PLUGIN_H
diff --git a/plugins/filters/pixelizefilter/kis_pixelize_filter.h b/plugins/filters/pixelizefilter/kis_pixelize_filter.h
index f1c73f6418..7391c978c8 100644
--- a/plugins/filters/pixelizefilter/kis_pixelize_filter.h
+++ b/plugins/filters/pixelizefilter/kis_pixelize_filter.h
@@ -1,47 +1,47 @@
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PIXELIZE_FILTER_H_
#define _KIS_PIXELIZE_FILTER_H_
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
class KisPixelizeFilter : public KisFilter
{
public:
KisPixelizeFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater* progressUpdater) const;
+ KoUpdater* progressUpdater) const override;
static inline KoID id() {
return KoID("pixelize", i18n("Pixelize"));
}
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
#endif
diff --git a/plugins/filters/pixelizefilter/kis_pixelize_filter_plugin.h b/plugins/filters/pixelizefilter/kis_pixelize_filter_plugin.h
index 887dae786d..297dcdd490 100644
--- a/plugins/filters/pixelizefilter/kis_pixelize_filter_plugin.h
+++ b/plugins/filters/pixelizefilter/kis_pixelize_filter_plugin.h
@@ -1,34 +1,34 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_PIXELIZE_FILTER_PLUGIN_H_
#define _KIS_PIXELIZE_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisPixelizeFilterPlugin : public QObject
{
Q_OBJECT
public:
KisPixelizeFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisPixelizeFilterPlugin();
+ ~KisPixelizeFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/posterize/posterize.h b/plugins/filters/posterize/posterize.h
index d306424c77..5271b6ba26 100644
--- a/plugins/filters/posterize/posterize.h
+++ b/plugins/filters/posterize/posterize.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2014 Manuel Riecke <spell1337@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef POSTERIZE_H
#define POSTERIZE_H
#include <QObject>
#include <QVariant>
#include "filter/kis_color_transformation_filter.h"
#include "kis_config_widget.h"
class Posterize : public QObject
{
Q_OBJECT
public:
Posterize(QObject *parent, const QVariantList &);
- virtual ~Posterize();
+ ~Posterize() override;
};
class KisFilterPosterize : public KisColorTransformationFilter
{
public:
KisFilterPosterize();
public:
- virtual KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const;
- virtual KisConfigWidget* createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KoColorTransformation* createTransformation(const KoColorSpace* cs, const KisFilterConfigurationSP config) const override;
+ KisConfigWidget* createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
static inline KoID id() {
return KoID("posterize", i18n("Posterize"));
}
protected:
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
};
class KisPosterizeColorTransformation : public KoColorTransformation
{
public:
KisPosterizeColorTransformation(int steps, const KoColorSpace* cs);
- virtual void transform(const quint8* src, quint8* dst, qint32 nPixels) const;
+ void transform(const quint8* src, quint8* dst, qint32 nPixels) const override;
private:
const KoColorSpace* m_colorSpace;
quint32 m_psize;
quint16 m_step;
quint16 m_halfStep;
};
#endif
diff --git a/plugins/filters/raindropsfilter/kis_raindrops_filter.h b/plugins/filters/raindropsfilter/kis_raindrops_filter.h
index b542ac6276..ff77c381d1 100644
--- a/plugins/filters/raindropsfilter/kis_raindrops_filter.h
+++ b/plugins/filters/raindropsfilter/kis_raindrops_filter.h
@@ -1,51 +1,51 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RAINDROPS_FILTER_H_
#define _KIS_RAINDROPS_FILTER_H_
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
#include "kis_paint_device.h"
class KisRainDropsFilter : public KisFilter
{
public:
KisRainDropsFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater* progressUpdater) const;
+ KoUpdater* progressUpdater) const override;
static inline KoID id() {
return KoID("raindrops", i18n("Raindrops"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
private:
bool** CreateBoolArray(uint Columns, uint Rows) const;
void FreeBoolArray(bool** lpbArray, uint Columns) const;
uchar LimitValues(int ColorValue) const;
};
#endif
diff --git a/plugins/filters/raindropsfilter/kis_raindrops_filter_plugin.h b/plugins/filters/raindropsfilter/kis_raindrops_filter_plugin.h
index f23679b22a..d87612a4d8 100644
--- a/plugins/filters/raindropsfilter/kis_raindrops_filter_plugin.h
+++ b/plugins/filters/raindropsfilter/kis_raindrops_filter_plugin.h
@@ -1,35 +1,35 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_RAINDROPS_FILTER_PLUGIN_H_
#define _KIS_RAINDROPS_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisRainDropsFilterPlugin : public QObject
{
Q_OBJECT
public:
KisRainDropsFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisRainDropsFilterPlugin();
+ ~KisRainDropsFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/randompickfilter/kis_wdg_random_pick.h b/plugins/filters/randompickfilter/kis_wdg_random_pick.h
index 92c1aa653f..1a1d85f874 100644
--- a/plugins/filters/randompickfilter/kis_wdg_random_pick.h
+++ b/plugins/filters/randompickfilter/kis_wdg_random_pick.h
@@ -1,47 +1,47 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_RANDOMPICK_H
#define KIS_WDG_RANDOMPICK_H
#include <kis_config_widget.h>
class Ui_WdgRandomPickOptions;
class KisFilter;
class KisWdgRandomPick : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgRandomPick(KisFilter* nfilter, QWidget* parent = 0);
- ~KisWdgRandomPick();
+ ~KisWdgRandomPick() override;
public:
inline const Ui_WdgRandomPickOptions* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgRandomPickOptions* m_widget;
int m_seedH, m_seedV, m_seedThreshold;
};
#endif
diff --git a/plugins/filters/randompickfilter/randompickfilter.h b/plugins/filters/randompickfilter/randompickfilter.h
index 6056a9fb44..28d5a90073 100644
--- a/plugins/filters/randompickfilter/randompickfilter.h
+++ b/plugins/filters/randompickfilter/randompickfilter.h
@@ -1,59 +1,59 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef RANDOMPICKFILTER_H
#define RANDOMPICKFILTER_H
#include <QObject>
#include <QVariant>
#include "filter/kis_filter.h"
class KisConfigWidget;
class KritaRandomPickFilter : public QObject
{
Q_OBJECT
public:
KritaRandomPickFilter(QObject *parent, const QVariantList &);
- virtual ~KritaRandomPickFilter();
+ ~KritaRandomPickFilter() override;
};
class KisFilterRandomPick : public KisFilter
{
public:
KisFilterRandomPick();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("randompick", i18n("Random Pick"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
- virtual QRect neededRect(const QRect& rect, const KisFilterConfigurationSP config, int lod = 0) const;
+ QRect neededRect(const QRect& rect, const KisFilterConfigurationSP config, int lod = 0) const override;
};
#endif
diff --git a/plugins/filters/roundcorners/kis_round_corners_filter.h b/plugins/filters/roundcorners/kis_round_corners_filter.h
index 2b9b25ea4f..30ad806e8e 100644
--- a/plugins/filters/roundcorners/kis_round_corners_filter.h
+++ b/plugins/filters/roundcorners/kis_round_corners_filter.h
@@ -1,47 +1,47 @@
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ROUND_CORNERS_FILTER_H_
#define _KIS_ROUND_CORNERS_FILTER_H_
#include "kis_paint_device.h"
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
class KisRoundCornersFilter : public KisFilter
{
public:
KisRoundCornersFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("roundcorners", i18n("Round Corners"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
private:
};
#endif
diff --git a/plugins/filters/roundcorners/kis_round_corners_filter_plugin.h b/plugins/filters/roundcorners/kis_round_corners_filter_plugin.h
index 757ace628a..c76f1a5e10 100644
--- a/plugins/filters/roundcorners/kis_round_corners_filter_plugin.h
+++ b/plugins/filters/roundcorners/kis_round_corners_filter_plugin.h
@@ -1,34 +1,34 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_ROUND_CORNERS_FILTER_PLUGIN_H_
#define _KIS_ROUND_CORNERS_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisRoundCornersFilterPlugin : public QObject
{
Q_OBJECT
public:
KisRoundCornersFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisRoundCornersFilterPlugin();
+ ~KisRoundCornersFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/smalltilesfilter/kis_small_tiles_filter.h b/plugins/filters/smalltilesfilter/kis_small_tiles_filter.h
index 72d045bf2a..e29dc15fe0 100644
--- a/plugins/filters/smalltilesfilter/kis_small_tiles_filter.h
+++ b/plugins/filters/smalltilesfilter/kis_small_tiles_filter.h
@@ -1,51 +1,51 @@
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SMALL_TILES_FILTER_H_
#define _KIS_SMALL_TILES_FILTER_H_
#include "kis_paint_device.h"
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
class KisSmallTilesFilter : public KisFilter
{
public:
KisSmallTilesFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("smalltiles", i18n("Small Tiles"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
#endif
diff --git a/plugins/filters/smalltilesfilter/kis_small_tiles_filter_plugin.h b/plugins/filters/smalltilesfilter/kis_small_tiles_filter_plugin.h
index d27a577eba..d53c2f631c 100644
--- a/plugins/filters/smalltilesfilter/kis_small_tiles_filter_plugin.h
+++ b/plugins/filters/smalltilesfilter/kis_small_tiles_filter_plugin.h
@@ -1,34 +1,34 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_SMALL_TILES_FILTER_PLUGIN_H_
#define _KIS_SMALL_TILES_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisSmallTilesFilterPlugin : public QObject
{
Q_OBJECT
public:
KisSmallTilesFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisSmallTilesFilterPlugin();
+ ~KisSmallTilesFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/sobelfilter/kis_sobel_filter.h b/plugins/filters/sobelfilter/kis_sobel_filter.h
index f7d4322e6d..048c518e4a 100644
--- a/plugins/filters/sobelfilter/kis_sobel_filter.h
+++ b/plugins/filters/sobelfilter/kis_sobel_filter.h
@@ -1,48 +1,48 @@
/*
* This file is part of the KDE project
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SOBEL_FILTER_H_
#define _KIS_SOBEL_FILTER_H_
#include "filter/kis_filter.h"
#include "kis_config_widget.h"
class KisSobelFilter : public KisFilter
{
public:
KisSobelFilter();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("sobel", i18n("Sobel"));
}
public:
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
private:
void prepareRow(const KisPaintDeviceSP src, quint8* data, quint32 x, quint32 y, quint32 w) const;
};
#endif
diff --git a/plugins/filters/sobelfilter/kis_sobel_filter_plugin.h b/plugins/filters/sobelfilter/kis_sobel_filter_plugin.h
index ec4ae1f4bd..530316c9ec 100644
--- a/plugins/filters/sobelfilter/kis_sobel_filter_plugin.h
+++ b/plugins/filters/sobelfilter/kis_sobel_filter_plugin.h
@@ -1,34 +1,34 @@
/*
* This file is part of Krita
*
* Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _KIS_SOBEL_FILTER_PLUGIN_H_
#define _KIS_SOBEL_FILTER_PLUGIN_H_
#include <QObject>
#include <QVariant>
class KisSobelFilterPlugin : public QObject
{
Q_OBJECT
public:
KisSobelFilterPlugin(QObject *parent, const QVariantList &);
- virtual ~KisSobelFilterPlugin();
+ ~KisSobelFilterPlugin() override;
};
#endif
diff --git a/plugins/filters/threshold/threshold.h b/plugins/filters/threshold/threshold.h
index ff84d21af0..8b5ae80ff9 100644
--- a/plugins/filters/threshold/threshold.h
+++ b/plugins/filters/threshold/threshold.h
@@ -1,91 +1,91 @@
/*
* This file is part of Krita
*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef THRESHOLD_H
#define THRESHOLD_H
#include <QObject>
#include <QVariant>
#include <filter/kis_filter.h>
#include <kis_filter_configuration.h>
#include <kis_config_widget.h>
#include "ui_wdg_threshold.h"
class WdgThreshold;
class QWidget;
class KisHistogram;
class KritaThreshold : public QObject
{
Q_OBJECT
public:
KritaThreshold(QObject *parent, const QVariantList &);
- virtual ~KritaThreshold();
+ ~KritaThreshold() override;
};
class KisFilterThreshold : public KisFilter
{
public:
KisFilterThreshold();
public:
static inline KoID id() {
return KoID("threshold", i18n("Threshold"));
}
- virtual void processImpl(KisPaintDeviceSP device,
+ void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater *progressUpdater) const;
+ KoUpdater *progressUpdater) const override;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
- virtual KisConfigWidget *createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const KisPaintDeviceSP dev) const override;
};
class KisThresholdConfigWidget : public KisConfigWidget
{
Q_OBJECT
public:
KisThresholdConfigWidget(QWidget *parent, KisPaintDeviceSP dev);
- virtual ~KisThresholdConfigWidget();
+ ~KisThresholdConfigWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const;
- void setConfiguration(const KisPropertiesConfigurationSP config);
+ KisPropertiesConfigurationSP configuration() const override;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
Ui::WdgThreshold m_page;
private Q_SLOTS:
void slotDrawHistogram(bool logarithmic = false);
void slotSetThreshold(int);
protected:
QScopedPointer<KisHistogram> m_histogram;
bool m_histlog;
};
#endif
diff --git a/plugins/filters/unsharp/kis_unsharp_filter.h b/plugins/filters/unsharp/kis_unsharp_filter.h
index 5a59acedb5..39b5754561 100644
--- a/plugins/filters/unsharp/kis_unsharp_filter.h
+++ b/plugins/filters/unsharp/kis_unsharp_filter.h
@@ -1,64 +1,64 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_UNSHARP_FILTER_H
#define KIS_UNSHARP_FILTER_H
#include "filter/kis_filter.h"
class KisUnsharpFilter : public KisFilter
{
public:
KisUnsharpFilter();
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("unsharp", i18n("Unsharp Mask"));
}
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
+ KisFilterConfigurationSP factoryConfiguration() const override;
- QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
- QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const;
+ QRect changedRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
+ QRect neededRect(const QRect & rect, const KisFilterConfigurationSP _config, int lod) const override;
private:
void processLightnessOnly(KisPaintDeviceSP device,
const QRect &rect,
quint8 threshold,
qreal weights[2],
qreal factor,
const QBitArray &channelFlags) const;
void processRaw(KisPaintDeviceSP device,
const QRect &rect,
quint8 threshold,
qreal weights[2],
qreal factor,
const QBitArray &channelFlags) const;
};
#endif
diff --git a/plugins/filters/unsharp/kis_wdg_unsharp.h b/plugins/filters/unsharp/kis_wdg_unsharp.h
index ac82b6c126..ca16549abb 100644
--- a/plugins/filters/unsharp/kis_wdg_unsharp.h
+++ b/plugins/filters/unsharp/kis_wdg_unsharp.h
@@ -1,43 +1,43 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_WDG_UNSHARP_H_
#define _KIS_WDG_UNSHARP_H_
#include <kis_config_widget.h>
class Ui_WdgUnsharp;
class KisWdgUnsharp : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgUnsharp(QWidget * parent);
- virtual ~KisWdgUnsharp();
+ ~KisWdgUnsharp() override;
inline const Ui_WdgUnsharp* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgUnsharp* m_widget;
};
#endif
diff --git a/plugins/filters/unsharp/unsharp.h b/plugins/filters/unsharp/unsharp.h
index ba728ec4dc..b50705d1ce 100644
--- a/plugins/filters/unsharp/unsharp.h
+++ b/plugins/filters/unsharp/unsharp.h
@@ -1,35 +1,35 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _UNSHARP_PLUGIN_H_
#define _UNSHARP_PLUGIN_H_
#include <QObject>
#include <QVariant>
class UnsharpPlugin : public QObject
{
Q_OBJECT
public:
UnsharpPlugin(QObject *parent, const QVariantList &);
- virtual ~UnsharpPlugin();
+ ~UnsharpPlugin() override;
};
#endif
diff --git a/plugins/filters/wavefilter/kis_wdg_wave.h b/plugins/filters/wavefilter/kis_wdg_wave.h
index b2002c3200..195d155c35 100644
--- a/plugins/filters/wavefilter/kis_wdg_wave.h
+++ b/plugins/filters/wavefilter/kis_wdg_wave.h
@@ -1,46 +1,46 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_WAVE_H
#define KIS_WDG_WAVE_H
#include <kis_config_widget.h>
class Ui_WdgWaveOptions;
class KisFilter;
class KisWdgWave : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgWave(KisFilter* nfilter, QWidget* parent = 0);
- ~KisWdgWave();
+ ~KisWdgWave() override;
public:
inline const Ui_WdgWaveOptions* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgWaveOptions* m_widget;
};
#endif
diff --git a/plugins/filters/wavefilter/wavefilter.h b/plugins/filters/wavefilter/wavefilter.h
index cd197a5cfe..cc2921f766 100644
--- a/plugins/filters/wavefilter/wavefilter.h
+++ b/plugins/filters/wavefilter/wavefilter.h
@@ -1,61 +1,61 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef WAVEFILTER_H
#define WAVEFILTER_H
#include <QObject>
#include <QVariant>
#include "filter/kis_filter.h"
class KisConfigWidget;
class KritaWaveFilter : public QObject
{
Q_OBJECT
public:
KritaWaveFilter(QObject *parent, const QVariantList &);
- virtual ~KritaWaveFilter();
+ ~KritaWaveFilter() override;
};
class KisFilterWave : public KisFilter
{
public:
KisFilterWave();
public:
void processImpl(KisPaintDeviceSP device,
const QRect& applyRect,
const KisFilterConfigurationSP config,
- KoUpdater* progressUpdater) const;
+ KoUpdater* progressUpdater) const override;
static inline KoID id() {
return KoID("wave", i18n("Wave"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
public:
- virtual QRect neededRect(const QRect& rect, const KisFilterConfigurationSP config = 0, int lod = 0) const;
+ QRect neededRect(const QRect& rect, const KisFilterConfigurationSP config = 0, int lod = 0) const override;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
#endif
diff --git a/plugins/flake/artistictextshape/AddTextRangeCommand.h b/plugins/flake/artistictextshape/AddTextRangeCommand.h
index d3a4d2f1a2..3ea3306e41 100644
--- a/plugins/flake/artistictextshape/AddTextRangeCommand.h
+++ b/plugins/flake/artistictextshape/AddTextRangeCommand.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2011 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ADDTEXTRANGECOMMAND_H
#define ADDTEXTRANGECOMMAND_H
#include <kundo2command.h>
#include "ArtisticTextTool.h"
#include "ArtisticTextRange.h"
#include <QPointer>
class ArtisticTextShape;
/// Undo command to add a range of text to a artistic text shape
class AddTextRangeCommand : public KUndo2Command
{
public:
AddTextRangeCommand(ArtisticTextTool *tool, ArtisticTextShape *shape, const QString &text, int from);
AddTextRangeCommand(ArtisticTextTool *tool, ArtisticTextShape *shape, const ArtisticTextRange &text, int from);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
QPointer<ArtisticTextTool> m_tool;
ArtisticTextShape *m_shape;
QString m_plainText;
ArtisticTextRange m_formattedText;
QList<ArtisticTextRange> m_oldFormattedText;
int m_from;
};
#endif // ADDTEXTRANGECOMMAND_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextShape.h b/plugins/flake/artistictextshape/ArtisticTextShape.h
index 65456c3dde..1dc03190a2 100644
--- a/plugins/flake/artistictextshape/ArtisticTextShape.h
+++ b/plugins/flake/artistictextshape/ArtisticTextShape.h
@@ -1,236 +1,236 @@
/* This file is part of the KDE project
* Copyright (C) 2007-2008,2011 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTSHAPE_H
#define ARTISTICTEXTSHAPE_H
#include "ArtisticTextRange.h"
#include <KoShape.h>
#include <KoPostscriptPaintDevice.h>
#include <SvgShape.h>
#include <QFont>
#include <QPainterPath>
#include <QVector>
class QPainter;
class KoPathShape;
class ArtisticTextLoadingContext;
class SvgGraphicsContext;
#define ArtisticTextShapeID "ArtisticText"
/// Character position within text shape (range index, range character index)
typedef QPair<int, int> CharIndex;
class ArtisticTextShape : public KoShape, public SvgShape
{
public:
enum TextAnchor { AnchorStart, AnchorMiddle, AnchorEnd };
enum LayoutMode {
Straight, ///< baseline is a straight line
OnPath, ///< baseline is a QPainterPath
OnPathShape ///< baseline is the outline of a path shape
};
ArtisticTextShape();
- virtual ~ArtisticTextShape();
+ ~ArtisticTextShape() override;
/// reimplemented
- void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
/// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
/// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// reimplemented
- virtual QSizeF size() const;
+ QSizeF size() const override;
/// reimplemented
- virtual void setSize(const QSizeF &size);
+ void setSize(const QSizeF &size) override;
/// reimplemented
- virtual QPainterPath outline() const;
+ QPainterPath outline() const override;
/// reimplemented from SvgShape
- virtual bool saveSvg(SvgSavingContext &context);
+ bool saveSvg(SvgSavingContext &context) override;
/// reimplemented from SvgShape
- virtual bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context);
+ bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context) override;
/// Sets the plain text to display
void setPlainText(const QString &newText);
/// Returns the plain text content
QString plainText() const;
/// Returns formatted text
QList<ArtisticTextRange> text() const;
/// Returns if text shape is empty, i.e. no text
bool isEmpty() const;
/// Clears the text shape
void clear();
/**
* Sets the font used for drawing
* Note that it is expected that the font has its point size set
* in postscript points.
*/
void setFont(const QFont &font);
/**
* Sets the font for the specified range of characters
* @param charIndex the index of the first character of the range
* @param charCount the number of characters of the range
* @param font the new font to set
*/
void setFont(int charIndex, int charCount, const QFont &font);
/**
* Returns the font at the specified character position
* If the text shape is empty it will return the default font.
* If the character index is smaller than zero it will return the font
* of the first character. If the character index is greater than the
* last character index it will return the font of the last character.
*/
QFont fontAt(int charIndex) const;
/// Returns the default font
QFont defaultFont() const;
/// Attaches this text shape to the given path shape
bool putOnPath(KoPathShape *path);
/// Puts the text on the given path, the path is expected to be in document coordinates
bool putOnPath(const QPainterPath &path);
/// Detaches this text shape from an already attached path shape
void removeFromPath();
/// Returns if shape is attached to a path shape
bool isOnPath() const;
/// Sets the offset for for text on path
void setStartOffset(qreal offset);
/// Returns the start offset for text on path
qreal startOffset() const;
/**
* Returns the y-offset from the top-left corner to the baseline.
* This is usable for being able to exactly position the texts baseline.
* Note: The value makes only sense for text not attached to a path.
*/
qreal baselineOffset() const;
/// Sets the text anchor
void setTextAnchor(TextAnchor anchor);
/// Returns the actual text anchor
TextAnchor textAnchor() const;
/// Returns the current layout mode
LayoutMode layout() const;
/// Returns the baseline path
QPainterPath baseline() const;
/// Returns a pointer to the shape used as baseline
KoPathShape *baselineShape() const;
/// Removes a range of text starting from the given character
QList<ArtisticTextRange> removeText(int charIndex, int charCount);
/// Copies a range of text starting from the given character
QList<ArtisticTextRange> copyText(int charIndex, int charCount);
/// Adds a range of text at the given index
void insertText(int charIndex, const QString &plainText);
/// Adds range of text at the given index
void insertText(int charIndex, const ArtisticTextRange &textRange);
/// Adds ranges of text at the given index
void insertText(int charIndex, const QList<ArtisticTextRange> &textRanges);
/// Appends plain text to the last text range
void appendText(const QString &plainText);
/// Appends a single formatted range of text
void appendText(const ArtisticTextRange &text);
/// Replaces a range of text with the specified text range
bool replaceText(int charIndex, int charCount, const ArtisticTextRange &textRange);
/// Replaces a range of text with the specified text ranges
bool replaceText(int charIndex, int charCount, const QList<ArtisticTextRange> &textRanges);
/// Gets the angle of the char with the given index
qreal charAngleAt(int charIndex) const;
/// Gets the position of the char with the given index in shape coordinates
QPointF charPositionAt(int charIndex) const;
/// Gets the extents of the char with the given index
QRectF charExtentsAt(int charIndex) const;
/// Returns index of range and index within range of specified character
CharIndex indexOfChar(int charIndex) const;
/// reimplemented from KoShape
- virtual void shapeChanged(ChangeType type, KoShape *shape);
+ void shapeChanged(ChangeType type, KoShape *shape) override;
private:
void updateSizeAndPosition(bool global = false);
void cacheGlyphOutlines();
bool pathHasChanged() const;
void createOutline();
void beginTextUpdate();
void finishTextUpdate();
/// Calculates abstract character positions in baseline coordinates
QVector<QPointF> calculateAbstractCharacterPositions();
/// Returns the bounding box for an empty text shape
QRectF nullBoundBox() const;
/// Saves svg font
void saveSvgFont(const QFont &font, SvgSavingContext &context);
/// Saves svg text range
void saveSvgTextRange(const ArtisticTextRange &range, SvgSavingContext &context, bool saveFont, qreal baselineOffset);
/// Parse nested text ranges
void parseTextRanges(const KoXmlElement &element, SvgLoadingContext &context, ArtisticTextLoadingContext &textContext);
/// Creates text range
ArtisticTextRange createTextRange(const QString &text, ArtisticTextLoadingContext &context, SvgGraphicsContext *gc);
QList<ArtisticTextRange> m_ranges;
KoPostscriptPaintDevice m_paintDevice;
KoPathShape *m_path; ///< the path shape we are attached to
QList<QPainterPath> m_charOutlines; ///< cached character oulines
qreal m_startOffset; ///< the offset from the attached path start point
QPointF m_outlineOrigin; ///< the top-left corner of the non-normalized text outline
QPainterPath m_outline; ///< the actual text outline
QPainterPath m_baseline; ///< the baseline path the text is put on
TextAnchor m_textAnchor; ///< the actual text anchor
QVector<qreal> m_charOffsets; ///< char positions [0..1] on baseline path
QVector<QPointF> m_charPositions; ///< char positions in shape coordinates
int m_textUpdateCounter;
QFont m_defaultFont;
};
#endif // ARTISTICTEXTSHAPE_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextShapeFactory.h b/plugins/flake/artistictextshape/ArtisticTextShapeFactory.h
index 4ddc037b6a..3bf75d2306 100644
--- a/plugins/flake/artistictextshape/ArtisticTextShapeFactory.h
+++ b/plugins/flake/artistictextshape/ArtisticTextShapeFactory.h
@@ -1,38 +1,38 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTSHAPEFACTORY_H
#define ARTISTICTEXTSHAPEFACTORY_H
#include <KoShapeFactoryBase.h>
class KoShape;
class ArtisticTextShapeFactory : public KoShapeFactoryBase
{
public:
ArtisticTextShapeFactory();
- ~ArtisticTextShapeFactory() {}
+ ~ArtisticTextShapeFactory() override {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
// reimplemented from KoShapeFactoryBase
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
};
#endif // ARTISTICTEXTSHAPEFACTORY_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextShapeLoadingUpdater.h b/plugins/flake/artistictextshape/ArtisticTextShapeLoadingUpdater.h
index 3a9e50cac9..108cc5a740 100644
--- a/plugins/flake/artistictextshape/ArtisticTextShapeLoadingUpdater.h
+++ b/plugins/flake/artistictextshape/ArtisticTextShapeLoadingUpdater.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTSHAPELOADINGUPDATER_H
#define ARTISTICTEXTSHAPELOADINGUPDATER_H
#include <KoLoadingShapeUpdater.h>
class ArtisticTextShape;
class ArtisticTextShapeLoadingUpdater : public KoLoadingShapeUpdater
{
public:
explicit ArtisticTextShapeLoadingUpdater(ArtisticTextShape *artisticTextShape);
- virtual ~ArtisticTextShapeLoadingUpdater();
- virtual void update(KoShape *shape);
+ ~ArtisticTextShapeLoadingUpdater() override;
+ void update(KoShape *shape) override;
private:
ArtisticTextShape *m_artisticTextShape;
};
#endif // ARTISTICTEXTSHAPELOADINGUPDATER_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextShapeOnPathWidget.h b/plugins/flake/artistictextshape/ArtisticTextShapeOnPathWidget.h
index ddc4ef05ff..b43060c312 100644
--- a/plugins/flake/artistictextshape/ArtisticTextShapeOnPathWidget.h
+++ b/plugins/flake/artistictextshape/ArtisticTextShapeOnPathWidget.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTSHAPEONPATHWIDGET_H
#define ARTISTICTEXTSHAPEONPATHWIDGET_H
#include <QWidget>
namespace Ui
{
class ArtisticTextShapeOnPathWidget;
}
class ArtisticTextTool;
class ArtisticTextShapeOnPathWidget : public QWidget
{
Q_OBJECT
public:
explicit ArtisticTextShapeOnPathWidget(ArtisticTextTool *tool, QWidget *parent = 0);
- ~ArtisticTextShapeOnPathWidget();
+ ~ArtisticTextShapeOnPathWidget() override;
public Q_SLOTS:
void updateWidget();
Q_SIGNALS:
/// triggered whenever the start offset has changed
void offsetChanged(int);
private:
Ui::ArtisticTextShapeOnPathWidget *ui;
ArtisticTextTool *m_textTool;
};
#endif // ARTISTICTEXTSHAPEONPATHWIDGET_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextShapePlugin.h b/plugins/flake/artistictextshape/ArtisticTextShapePlugin.h
index 4f1186738e..a8dd859e05 100644
--- a/plugins/flake/artistictextshape/ArtisticTextShapePlugin.h
+++ b/plugins/flake/artistictextshape/ArtisticTextShapePlugin.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTSHAPEPLUGIN_H
#define ARTISTICTEXTSHAPEPLUGIN_H
#include <QObject>
#include <QVariantList>
class ArtisticTextShapePlugin : public QObject
{
Q_OBJECT
public:
ArtisticTextShapePlugin(QObject *parent, const QVariantList &);
- ~ArtisticTextShapePlugin();
+ ~ArtisticTextShapePlugin() override;
};
#endif // ARTISTICTEXTSHAPEPLUGIN_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextTool.h b/plugins/flake/artistictextshape/ArtisticTextTool.h
index 73708efba0..298fc36363 100644
--- a/plugins/flake/artistictextshape/ArtisticTextTool.h
+++ b/plugins/flake/artistictextshape/ArtisticTextTool.h
@@ -1,156 +1,156 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2011 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTTOOL_H
#define ARTISTICTEXTTOOL_H
#include "ArtisticTextShape.h"
#include "ArtisticTextToolSelection.h"
#include <KoToolBase.h>
#include <QTimer>
class QAction;
class QActionGroup;
class KoInteractionStrategy;
/// This is the tool for the artistic text shape.
class ArtisticTextTool : public KoToolBase
{
Q_OBJECT
public:
explicit ArtisticTextTool(KoCanvasBase *canvas);
- ~ArtisticTextTool();
+ ~ArtisticTextTool() override;
/// reimplemented
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/// reimplemented
- virtual void repaintDecorations();
+ void repaintDecorations() override;
/// reimplemented
- virtual void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mouseReleaseEvent(KoPointerEvent *event) override;
/// reimplemented
virtual void shortcutOverrideEvent(QKeyEvent *event);
/// reimplemented
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
/// reimplemented
- virtual void activate(ToolActivation activation, const QSet<KoShape *> &shapes);
+ void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
/// reimplemented
- virtual void deactivate();
+ void deactivate() override;
/// reimplemented
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
/// reimplemented
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
/// reimplemented
- virtual KoToolSelection *selection();
+ KoToolSelection *selection() override;
/// reimplemented from superclass
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const override;
/// Sets cursor for specified text shape it is the current text shape
void setTextCursor(ArtisticTextShape *textShape, int textCursor);
/// Returns the current text cursor position
int textCursor() const;
/**
* Determines cursor position from specified mouse position.
* @param mousePosition mouse position in document coordinates
* @return cursor position, -1 means invalid cursor
*/
int cursorFromMousePosition(const QPointF &mousePosition);
protected:
void enableTextCursor(bool enable);
void removeFromTextCursor(int from, unsigned int count);
void addToTextCursor(const QString &str);
private Q_SLOTS:
void detachPath();
void convertText();
void blinkCursor();
void textChanged();
void shapeSelectionChanged();
void setStartOffset(int offset);
void toggleFontBold(bool enabled);
void toggleFontItalic(bool enabled);
void anchorChanged(QAction *);
void setFontFamiliy(const QFont &font);
void setFontSize(int size);
void setSuperScript();
void setSubScript();
void selectAll();
void deselectAll();
Q_SIGNALS:
void shapeSelected();
private:
void updateActions();
void setTextCursorInternal(int textCursor);
void createTextCursorShape();
void updateTextCursorArea() const;
void setCurrentShape(ArtisticTextShape *currentShape);
enum FontProperty {
BoldProperty,
ItalicProperty,
FamiliyProperty,
SizeProperty
};
/// Changes the specified font property for the current text selection
void changeFontProperty(FontProperty property, const QVariant &value);
/// Toggle sub and super script
void toggleSubSuperScript(ArtisticTextRange::BaselineShift mode);
/// returns the transformation matrix for the text cursor
QTransform cursorTransform() const;
/// Returns the offset handle shape for the current text shape
QPainterPath offsetHandleShape();
ArtisticTextToolSelection m_selection; ///< the tools selection
ArtisticTextShape *m_currentShape; ///< the current text shape we are working on
ArtisticTextShape *m_hoverText; ///< the text shape the mouse cursor is hovering over
KoPathShape *m_hoverPath; ///< the path shape the mouse cursor is hovering over
QPainterPath m_textCursorShape; ///< our visual text cursor representation
bool m_hoverHandle;
QAction *m_detachPath;
QAction *m_convertText;
QAction *m_fontBold;
QAction *m_fontItalic;
QAction *m_superScript;
QAction *m_subScript;
QActionGroup *m_anchorGroup;
int m_textCursor;
QTimer m_blinkingCursor;
bool m_showCursor;
QList<QPointF> m_linefeedPositions; ///< offset positions for temporary line feeds
KoInteractionStrategy *m_currentStrategy;
};
#endif // ARTISTICTEXTTOOL_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextToolFactory.h b/plugins/flake/artistictextshape/ArtisticTextToolFactory.h
index a3068da45b..227858f901 100644
--- a/plugins/flake/artistictextshape/ArtisticTextToolFactory.h
+++ b/plugins/flake/artistictextshape/ArtisticTextToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTTOOLFACTORY_H
#define ARTISTICTEXTTOOLFACTORY_H
#include <KoToolFactoryBase.h>
class ArtisticTextToolFactory : public KoToolFactoryBase
{
public:
ArtisticTextToolFactory();
- ~ArtisticTextToolFactory();
+ ~ArtisticTextToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif // ARTISTICTEXTTOOLFACTORY_H
diff --git a/plugins/flake/artistictextshape/ArtisticTextToolSelection.h b/plugins/flake/artistictextshape/ArtisticTextToolSelection.h
index 4b159adb59..179af6bf46 100644
--- a/plugins/flake/artistictextshape/ArtisticTextToolSelection.h
+++ b/plugins/flake/artistictextshape/ArtisticTextToolSelection.h
@@ -1,76 +1,76 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ARTISTICTEXTTOOLSELECTION_H
#define ARTISTICTEXTTOOLSELECTION_H
#include <KoToolSelection.h>
#include <QPainterPath>
#include <QPointer>
#include <KoCanvasBase.h>
class ArtisticTextShape;
class KoViewConverter;
class QPainter;
class ArtisticTextToolSelection : public KoToolSelection
{
public:
explicit ArtisticTextToolSelection(KoCanvasBase *canvas, QObject *parent = 0);
- virtual ~ArtisticTextToolSelection();
+ ~ArtisticTextToolSelection() override;
// reimplemented from KoToolSelection
- virtual bool hasSelection();
+ bool hasSelection() override;
/// Sets the currently selected text shape
void setSelectedShape(ArtisticTextShape *textShape);
/// Returns the currently selected text shape
ArtisticTextShape *selectedShape() const;
/// Selects specified range of characters
void selectText(int from, int to);
/// Returns the start character index of the selection
int selectionStart() const;
/// Returns number of selected characters
int selectionCount() const;
/// Clears the selection
void clear();
/// Paints the selection
void paint(QPainter &painter, const KoViewConverter &converter);
/// Triggers a repaint of the selection
void repaintDecoration();
private:
/// Returns the outline of the selection in document coordinates
QPainterPath outline();
QPointer<KoCanvasBase> m_canvas;
ArtisticTextShape *m_currentShape; ///< the currently selected text shape
int m_selectionStart;
int m_selectionCount;
};
#endif // ARTISTICTEXTTOOLSELECTION_H
diff --git a/plugins/flake/artistictextshape/AttachTextToPathCommand.h b/plugins/flake/artistictextshape/AttachTextToPathCommand.h
index 9f29181222..3e7aa10cc3 100644
--- a/plugins/flake/artistictextshape/AttachTextToPathCommand.h
+++ b/plugins/flake/artistictextshape/AttachTextToPathCommand.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ATTACHTEXTTOPATHCOMMAND_H
#define ATTACHTEXTTOPATHCOMMAND_H
#include <kundo2command.h>
#include <QTransform>
class ArtisticTextShape;
class KoPathShape;
class AttachTextToPathCommand : public KUndo2Command
{
public:
AttachTextToPathCommand(ArtisticTextShape *textShape, KoPathShape *pathShape, KUndo2Command *parent = 0);
/// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
/// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
private:
ArtisticTextShape *m_textShape;
KoPathShape *m_pathShape;
QTransform m_oldMatrix;
};
#endif // ATTACHTEXTTOPATHCOMMAND_H
diff --git a/plugins/flake/artistictextshape/ChangeTextAnchorCommand.h b/plugins/flake/artistictextshape/ChangeTextAnchorCommand.h
index 29c2fef75a..28a955699a 100644
--- a/plugins/flake/artistictextshape/ChangeTextAnchorCommand.h
+++ b/plugins/flake/artistictextshape/ChangeTextAnchorCommand.h
@@ -1,39 +1,39 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGETEXTANCHORCOMMAND_H
#define CHANGETEXTANCHORCOMMAND_H
#include "ArtisticTextShape.h"
#include <kundo2command.h>
class ChangeTextAnchorCommand : public KUndo2Command
{
public:
ChangeTextAnchorCommand(ArtisticTextShape *shape, ArtisticTextShape::TextAnchor anchor);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
ArtisticTextShape *m_shape;
ArtisticTextShape::TextAnchor m_anchor;
ArtisticTextShape::TextAnchor m_oldAnchor;
};
#endif // CHANGETEXTANCHORCOMMAND_H
diff --git a/plugins/flake/artistictextshape/ChangeTextFontCommand.h b/plugins/flake/artistictextshape/ChangeTextFontCommand.h
index 698f789f8a..b13a7789dc 100644
--- a/plugins/flake/artistictextshape/ChangeTextFontCommand.h
+++ b/plugins/flake/artistictextshape/ChangeTextFontCommand.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2011 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGETEXTFONTCOMMAND_H
#define CHANGETEXTFONTCOMMAND_H
#include "ArtisticTextRange.h"
#include <kundo2command.h>
#include <QFont>
class ArtisticTextShape;
class ChangeTextFontCommand : public KUndo2Command
{
public:
ChangeTextFontCommand(ArtisticTextShape *shape, const QFont &font, KUndo2Command *parent = 0);
ChangeTextFontCommand(ArtisticTextShape *shape, int from, int count, const QFont &font, KUndo2Command *parent = 0);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
ArtisticTextShape *m_shape;
QFont m_newFont;
QList<ArtisticTextRange> m_oldText;
QList<ArtisticTextRange> m_newText;
int m_rangeStart;
int m_rangeCount;
};
#endif // CHANGETEXTFONTCOMMAND_H
diff --git a/plugins/flake/artistictextshape/ChangeTextOffsetCommand.h b/plugins/flake/artistictextshape/ChangeTextOffsetCommand.h
index 4e9fcc25da..490c01437c 100644
--- a/plugins/flake/artistictextshape/ChangeTextOffsetCommand.h
+++ b/plugins/flake/artistictextshape/ChangeTextOffsetCommand.h
@@ -1,41 +1,41 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGETEXTOFFSETCOMMAND_H
#define CHANGETEXTOFFSETCOMMAND_H
#include <kundo2command.h>
class ArtisticTextShape;
class ChangeTextOffsetCommand : public KUndo2Command
{
public:
ChangeTextOffsetCommand(ArtisticTextShape *textShape, qreal oldOffset, qreal newOffset, KUndo2Command *parent = 0);
/// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
/// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
private:
ArtisticTextShape *m_textShape;
qreal m_oldOffset;
qreal m_newOffset;
};
#endif // CHANGETEXTOFFSETCOMMAND_H
diff --git a/plugins/flake/artistictextshape/DetachTextFromPathCommand.h b/plugins/flake/artistictextshape/DetachTextFromPathCommand.h
index 4f5dd1a3ef..85ed56f241 100644
--- a/plugins/flake/artistictextshape/DetachTextFromPathCommand.h
+++ b/plugins/flake/artistictextshape/DetachTextFromPathCommand.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DETACHTEXTFROMPATHCOMMAND_H
#define DETACHTEXTFROMPATHCOMMAND_H
#include <kundo2command.h>
#include <QPainterPath>
class ArtisticTextShape;
class KoPathShape;
class DetachTextFromPathCommand : public KUndo2Command
{
public:
explicit DetachTextFromPathCommand(ArtisticTextShape *textShape, KUndo2Command *parent = 0);
/// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
/// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
private:
ArtisticTextShape *m_textShape;
KoPathShape *m_pathShape;
QPainterPath m_path;
};
#endif // DETACHTEXTFROMPATHCOMMAND_H
diff --git a/plugins/flake/artistictextshape/MoveStartOffsetStrategy.h b/plugins/flake/artistictextshape/MoveStartOffsetStrategy.h
index 04768473bf..28aff2452d 100644
--- a/plugins/flake/artistictextshape/MoveStartOffsetStrategy.h
+++ b/plugins/flake/artistictextshape/MoveStartOffsetStrategy.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MOVESTARTOFFSETSTRATEGY_H
#define MOVESTARTOFFSETSTRATEGY_H
#include <KoInteractionStrategy.h>
#include <QList>
class KoPathShape;
class ArtisticTextShape;
class KoToolBase;
/// A strategy to change the offset of a text when put on a path
class MoveStartOffsetStrategy : public KoInteractionStrategy
{
public:
MoveStartOffsetStrategy(KoToolBase *tool, ArtisticTextShape *text);
- ~MoveStartOffsetStrategy();
+ ~MoveStartOffsetStrategy() override;
// reimplemnted from KoInteractionStrategy
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
// reimplemnted from KoInteractionStrategy
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
// reimplemnted from KoInteractionStrategy
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
private:
ArtisticTextShape *m_text; ///< the text shape we are working on
KoPathShape *m_baselineShape; ///< path shape the text is put on
qreal m_oldStartOffset; ///< the initial start offset
QList<qreal> m_segmentLengths; ///< cached lenths of baseline path segments
qreal m_totalLength; ///< total length of baseline path
};
#endif // MOVESTARTOFFSETSTRATEGY_H
diff --git a/plugins/flake/artistictextshape/RemoveTextRangeCommand.h b/plugins/flake/artistictextshape/RemoveTextRangeCommand.h
index 0db152fc0f..1fba42dfa4 100644
--- a/plugins/flake/artistictextshape/RemoveTextRangeCommand.h
+++ b/plugins/flake/artistictextshape/RemoveTextRangeCommand.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2011 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2008 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REMOVETEXTRANGECOMMAND_H
#define REMOVETEXTRANGECOMMAND_H
#include <kundo2command.h>
#include <QPointer>
#include "ArtisticTextTool.h"
class ArtisticTextShape;
/// Undo command to remove a range of text from an artistic text shape
class RemoveTextRangeCommand : public KUndo2Command
{
public:
RemoveTextRangeCommand(ArtisticTextTool *tool, ArtisticTextShape *shape, int from, unsigned int count);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
QPointer<ArtisticTextTool> m_tool;
ArtisticTextShape *m_shape;
int m_from;
int m_count;
QList<ArtisticTextRange> m_text;
int m_cursor;
};
#endif // REMOVETEXTRANGECOMMAND_H
diff --git a/plugins/flake/artistictextshape/ReplaceTextRangeCommand.h b/plugins/flake/artistictextshape/ReplaceTextRangeCommand.h
index faadebad17..45c8ef83c1 100644
--- a/plugins/flake/artistictextshape/ReplaceTextRangeCommand.h
+++ b/plugins/flake/artistictextshape/ReplaceTextRangeCommand.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REPLACETEXTRANGECOMMAND_H
#define REPLACETEXTRANGECOMMAND_H
#include <kundo2command.h>
#include "ArtisticTextTool.h"
#include "ArtisticTextRange.h"
#include <QPointer>
class ArtisticTextShape;
/// Undo command to replace a range of text on an artistic text shape
class ReplaceTextRangeCommand : public KUndo2Command
{
public:
ReplaceTextRangeCommand(ArtisticTextShape *shape, const QString &text, int from, int count, ArtisticTextTool *tool, KUndo2Command *parent = 0);
ReplaceTextRangeCommand(ArtisticTextShape *shape, const ArtisticTextRange &text, int from, int count, ArtisticTextTool *tool, KUndo2Command *parent = 0);
ReplaceTextRangeCommand(ArtisticTextShape *shape, const QList<ArtisticTextRange> &text, int from, int count, ArtisticTextTool *tool, KUndo2Command *parent = 0);
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
QPointer<ArtisticTextTool> m_tool;
ArtisticTextShape *m_shape;
QList<ArtisticTextRange> m_newFormattedText;
QList<ArtisticTextRange> m_oldFormattedText;
int m_from;
int m_count;
};
#endif // REPLACETEXTRANGECOMMAND_H
diff --git a/plugins/flake/artistictextshape/SelectTextStrategy.h b/plugins/flake/artistictextshape/SelectTextStrategy.h
index dcfd4b205c..a63a9c8073 100644
--- a/plugins/flake/artistictextshape/SelectTextStrategy.h
+++ b/plugins/flake/artistictextshape/SelectTextStrategy.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SELECTTEXTSTRATEGY_H
#define SELECTTEXTSTRATEGY_H
#include <KoInteractionStrategy.h>
class ArtisticTextTool;
class ArtisticTextToolSelection;
/// A strategy to select text on a artistic text shape
class SelectTextStrategy : public KoInteractionStrategy
{
public:
SelectTextStrategy(ArtisticTextTool *textTool, int cursor);
- ~SelectTextStrategy();
+ ~SelectTextStrategy() override;
// reimplemnted from KoInteractionStrategy
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
// reimplemnted from KoInteractionStrategy
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
// reimplemnted from KoInteractionStrategy
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
private:
ArtisticTextToolSelection *m_selection;
int m_oldCursor;
int m_newCursor;
};
#endif // SELECTTEXTSTRATEGY_H
diff --git a/plugins/flake/imageshape/ImageShape.h b/plugins/flake/imageshape/ImageShape.h
index d12d405545..515146a404 100644
--- a/plugins/flake/imageshape/ImageShape.h
+++ b/plugins/flake/imageshape/ImageShape.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef IMAGESHAPE_H
#define IMAGESHAPE_H
#include <QScopedPointer>
#include "KoTosContainer.h"
#include <SvgShape.h>
#define ImageShapeId "ImageShape"
class ImageShape : public KoTosContainer, public SvgShape
{
public:
ImageShape();
- ~ImageShape();
+ ~ImageShape() override;
- KoShape *cloneShape() const;
+ KoShape *cloneShape() const override;
- void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext);
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintContext) override;
void setSize(const QSizeF &size) override;
void saveOdf(KoShapeSavingContext &context) const override;
bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
bool saveSvg(SvgSavingContext &context) override;
bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context) override;
private:
ImageShape(const ImageShape &rhs);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // IMAGESHAPE_H
diff --git a/plugins/flake/imageshape/ImageShapeFactory.h b/plugins/flake/imageshape/ImageShapeFactory.h
index fb8efc6b56..044ed100d0 100644
--- a/plugins/flake/imageshape/ImageShapeFactory.h
+++ b/plugins/flake/imageshape/ImageShapeFactory.h
@@ -1,42 +1,42 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef IMAGESHAPE_FACTORY_H
#define IMAGESHAPE_FACTORY_H
// Calligra
#include <KoShapeFactoryBase.h>
class KoShape;
class ImageShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
ImageShapeFactory();
- ~ImageShapeFactory() {}
+ ~ImageShapeFactory() override {}
KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
QList<KoShapeConfigWidgetBase *> createShapeOptionPanels() override;
};
#endif
diff --git a/plugins/flake/imageshape/ImageShapePlugin.h b/plugins/flake/imageshape/ImageShapePlugin.h
index f15c6bb001..8052a2d9f1 100644
--- a/plugins/flake/imageshape/ImageShapePlugin.h
+++ b/plugins/flake/imageshape/ImageShapePlugin.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef IMAGESHAPE_PLUGIN_H
#define IMAGESHAPE_PLUGIN_H
// Qt
#include <QObject>
#include <QVariantList>
class ImageShapePlugin : public QObject
{
Q_OBJECT
public:
ImageShapePlugin(QObject *parent, const QVariantList &);
- ~ImageShapePlugin() {}
+ ~ImageShapePlugin() override {}
};
#endif
diff --git a/plugins/flake/pathshapes/PathShapesPlugin.h b/plugins/flake/pathshapes/PathShapesPlugin.h
index 83cb10c909..972950aaf8 100644
--- a/plugins/flake/pathshapes/PathShapesPlugin.h
+++ b/plugins/flake/pathshapes/PathShapesPlugin.h
@@ -1,36 +1,36 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PATHSHAPESPLUGIN_H
#define PATHSHAPESPLUGIN_H
#include <QObject>
#include <QVariantList>
class PathShapesPlugin : public QObject
{
Q_OBJECT
public:
PathShapesPlugin(QObject *parent, const QVariantList &);
- ~PathShapesPlugin() {}
+ ~PathShapesPlugin() override {}
};
#endif
diff --git a/plugins/flake/pathshapes/ellipse/EllipseShape.h b/plugins/flake/pathshapes/ellipse/EllipseShape.h
index c392616cab..5270147fb8 100644
--- a/plugins/flake/pathshapes/ellipse/EllipseShape.h
+++ b/plugins/flake/pathshapes/ellipse/EllipseShape.h
@@ -1,122 +1,122 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOELLIPSESHAPE_H
#define KOELLIPSESHAPE_H
#include "KoParameterShape.h"
#include <SvgShape.h>
#define EllipseShapeId "EllipseShape"
/**
* This class adds support for arc, pie, chord, circle and ellipse
* shapes. The ellipse/circle radii are defined by the actual size
* of the ellipse shape which can be changed with the setSize
* method.
*/
class EllipseShape : public KoParameterShape, public SvgShape
{
public:
/// the possible ellipse types
enum EllipseType {
Arc = 0, ///< an ellipse arc
Pie = 1, ///< an ellipse pie
Chord = 2 ///< an ellipse chord
};
EllipseShape();
- virtual ~EllipseShape();
+ ~EllipseShape() override;
KoShape* cloneShape() const override;
- void setSize(const QSizeF &newSize);
- virtual QPointF normalize();
+ void setSize(const QSizeF &newSize) override;
+ QPointF normalize() override;
/**
* Sets the type of the ellipse.
* @param type the new ellipse type
*/
void setType(EllipseType type);
/// Returns the actual ellipse type
EllipseType type() const;
/**
* Sets the start angle of the ellipse.
* @param angle the new start angle in degree
*/
void setStartAngle(qreal angle);
/// Returns the actual ellipse start angle in degree
qreal startAngle() const;
/**
* Sets the end angle of the ellipse.
* @param angle the new end angle in degree
*/
void setEndAngle(qreal angle);
/// Returns the actual ellipse end angle in degree
qreal endAngle() const;
/// reimplemented
- virtual QString pathShapeId() const;
+ QString pathShapeId() const override;
/// reimplemented from SvgShape
- virtual bool saveSvg(SvgSavingContext &context);
+ bool saveSvg(SvgSavingContext &context) override;
/// reimplemented from SvgShape
- virtual bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context);
+ bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context) override;
protected:
// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
- void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- void updatePath(const QSizeF &size);
+ void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
+ void updatePath(const QSizeF &size) override;
void createPoints(int requiredPointCount);
private:
qreal sweepAngle() const;
void updateKindHandle();
void updateAngleHandles();
EllipseShape(const EllipseShape &rhs);
// start angle in degree
qreal m_startAngle;
// end angle in degree
qreal m_endAngle;
// angle for modifying the kind in radiant
qreal m_kindAngle;
// the center of the ellipse
QPointF m_center;
// the radii of the ellips
QPointF m_radii;
// the actual ellipse type
EllipseType m_type;
};
#endif /* KOELLIPSESHAPE_H */
diff --git a/plugins/flake/pathshapes/ellipse/EllipseShapeFactory.h b/plugins/flake/pathshapes/ellipse/EllipseShapeFactory.h
index b608d35520..e6a9ca430d 100644
--- a/plugins/flake/pathshapes/ellipse/EllipseShapeFactory.h
+++ b/plugins/flake/pathshapes/ellipse/EllipseShapeFactory.h
@@ -1,40 +1,40 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOELLIPSESHAPEFACTORY_H
#define KOELLIPSESHAPEFACTORY_H
#include "KoShapeFactoryBase.h"
#include <QDebug>
class KoShape;
/// Factory for ellipse shapes
class EllipseShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
EllipseShapeFactory();
- virtual ~EllipseShapeFactory() {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
- virtual QList<KoShapeConfigWidgetBase *> createShapeOptionPanels();
+ ~EllipseShapeFactory() override {}
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
+ QList<KoShapeConfigWidgetBase *> createShapeOptionPanels() override;
};
#endif /* KOELLIPSESHAPEFACTORY_H */
diff --git a/plugins/flake/pathshapes/enhancedpath/EnhancedPathParameter.h b/plugins/flake/pathshapes/enhancedpath/EnhancedPathParameter.h
index f6f604ebe8..82389fd014 100644
--- a/plugins/flake/pathshapes/enhancedpath/EnhancedPathParameter.h
+++ b/plugins/flake/pathshapes/enhancedpath/EnhancedPathParameter.h
@@ -1,104 +1,104 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOENHANCEDPATHPARAMETER_H
#define KOENHANCEDPATHPARAMETER_H
#include <QString>
class EnhancedPathShape;
/// the different possible identifiers, taken from the odf spec
enum Identifier {
IdentifierUnknown, ///< unknown identifier
IdentifierPi, ///< value of pi.
IdentifierLeft, ///< left of svg:viewBox or draw:coordinate-origin-x
IdentifierTop, ///< top of svg:viewBox or draw:coordinate-origin-y
IdentifierRight, ///< right of svg:viewBox or draw:coordinate-origin-x + draw:coordinate-width
IdentifierBottom, ///< bottom of svg:viewBox or draw:coordinate-origin-y + draw:coordinate-height
IdentifierXstretch, ///< The value of draw:path-stretchpoint-x is used.
IdentifierYstretch, ///< The value of draw:path-stretchpoint-y is used.
IdentifierHasStroke, ///< If the shape has a line style, a value of 1 is used.
IdentifierHasFill, ///< If the shape has a fill style, a value of 1 is used.
IdentifierWidth, ///< The width of the svg:viewBox is used.
IdentifierHeight, ///< The height of the svg:viewBox is used.
IdentifierLogwidth, ///< The width of the svg:viewBox in 1/100th mm is used.
IdentifierLogheight ///< The height of the svg:viewBox in 1/100th mm is used.
};
/// The bstract parameter class
class EnhancedPathParameter
{
public:
explicit EnhancedPathParameter(EnhancedPathShape *parent);
virtual ~EnhancedPathParameter();
/// evaluates the parameter using the given path
virtual qreal evaluate() = 0;
/// modifies the parameter if possible, using the new value
virtual void modify(qreal value);
/// returns string representation of the parameter
virtual QString toString() const = 0;
protected:
EnhancedPathShape *parent();
private:
EnhancedPathShape *m_parent;
};
/// A constant parameter, a fixed value (i.e. 5, 11.3, -7)
class EnhancedPathConstantParameter : public EnhancedPathParameter
{
public:
/// Constructs the constant parameter with the given value
EnhancedPathConstantParameter(qreal value, EnhancedPathShape *parent);
- qreal evaluate();
- virtual QString toString() const;
+ qreal evaluate() override;
+ QString toString() const override;
private:
qreal m_value; ///< the constant value
};
/// A named parameter, one that refers to a variable of the path
class EnhancedPathNamedParameter : public EnhancedPathParameter
{
public:
/// Constructs named parameter from given identifier
EnhancedPathNamedParameter(Identifier identifier, EnhancedPathShape *parent);
/// Constructs named parameter from given identifier string
EnhancedPathNamedParameter(const QString &identifier, EnhancedPathShape *parent);
- qreal evaluate();
+ qreal evaluate() override;
/// Returns identfier type from given string
static Identifier identifierFromString(const QString &text);
- virtual QString toString() const;
+ QString toString() const override;
private:
Identifier m_identifier; ///< the identifier type
};
/// A referencing parameter, one that references another formula or a modifier
class EnhancedPathReferenceParameter : public EnhancedPathParameter
{
public:
/// Constructs reference parameter from the given reference string
explicit EnhancedPathReferenceParameter(const QString &reference, EnhancedPathShape *parent);
- qreal evaluate();
- virtual void modify(qreal value);
- virtual QString toString() const;
+ qreal evaluate() override;
+ void modify(qreal value) override;
+ QString toString() const override;
private:
QString m_reference; ///< the reference, formula or modifier
};
#endif // KOENHANCEDPATHPARAMETER_H
diff --git a/plugins/flake/pathshapes/enhancedpath/EnhancedPathShape.h b/plugins/flake/pathshapes/enhancedpath/EnhancedPathShape.h
index ba3166038a..3a2d815e71 100644
--- a/plugins/flake/pathshapes/enhancedpath/EnhancedPathShape.h
+++ b/plugins/flake/pathshapes/enhancedpath/EnhancedPathShape.h
@@ -1,185 +1,185 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2010,2011 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2010 Carlos Licea <carlos@kdab.com>
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* Contact: Suresh Chande suresh.chande@nokia.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOENHANCEDPATHSHAPE_H
#define KOENHANCEDPATHSHAPE_H
#include <KoParameterShape.h>
#include <QList>
#include <QMap>
#include <QRectF>
#include <QStringList>
#define EnhancedPathShapeId "EnhancedPathShape"
class EnhancedPathCommand;
class EnhancedPathHandle;
class EnhancedPathFormula;
class EnhancedPathParameter;
class KoShapeSavingContext;
class KoShapeLoadingContext;
/**
* An enhanced shape is a custom shape which can be defined
* by enhanced geometry data.
* The data consists of a list of commands like moveto,
* lineto, curveto, etc. which are used to create the outline
* of the shape. The coordinates or parameters of the commands
* can be constant values, named variables (identifiers),
* modifiers, functions or formulae.
*/
class EnhancedPathShape : public KoParameterShape
{
public:
EnhancedPathShape(const QRect &viewBox);
- virtual ~EnhancedPathShape();
+ ~EnhancedPathShape() override;
KoShape* cloneShape() const override;
/**
* Evaluates the given reference to a identifier, modifier or formula.
* @param reference the reference to evaluate
* @return the result of the evaluation
*/
qreal evaluateReference(const QString &reference);
/**
* Evaluates the given constant or reference to a identifier, modifier
* or formula.
* @param val the value to evaluate
* @return the result of the evaluation
*/
qreal evaluateConstantOrReference(const QString &val);
/**
* Attempts to modify a given reference.
*
* Only modifiers can me modified, others silently ignore the attempt.
*
* @param reference the reference to modify
* @param value the new value
*/
void modifyReference(const QString &reference, qreal value);
// from KoShape
- virtual void setSize(const QSizeF &newSize);
+ void setSize(const QSizeF &newSize) override;
// from KoParameterShape
- virtual QPointF normalize();
+ QPointF normalize() override;
/// Add formula with given name and textual represenation
void addFormula(const QString &name, const QString &formula);
/// Add a single handle with format: x y minX maxX minY maxY
void addHandle(const QMap<QString, QVariant> &handle);
/// Add modifiers with format: modifier0 modifier1 modifier2 ...
void addModifiers(const QString &modifiers);
/// Add command for instance "M 0 0"
void addCommand(const QString &command);
/// Returns the viewbox of the enhanced path shape
QRect viewBox() const;
/// Converts from shape coordinates to viewbox coordinates
QPointF shapeToViewbox(const QPointF &point) const;
/// Sets if the shape is to be mirrored horizontally before aplying any other transformations
//NOTE: in the standard nothing is mentioned about the priorities of the transformations"
//it's assumed like this because of the behavior shwon in OOo
void setMirrorHorizontally(bool mirrorHorizontally);
/// Sets if the shape is to be mirrored vertically before aplying any other transformations
//NOTE: in the standard nothing is mentioned about the priorities of the transformations"
//it's assumed like this because of the behavior shwon in OOo
void setMirrorVertically(bool mirrorVertically);
// Sets member variable representing draw:path-stretchpoint-x attribute
void setPathStretchPointX(qreal pathStretchPointX);
// Sets member variable representing draw:path-stretchpoint-y attribute
void setPathStretchPointY(qreal pathStretchPointY);
/// Returns parameter from given textual representation
EnhancedPathParameter *parameter(const QString &text);
protected:
// from KoShape
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
// from KoShape
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
//from KoShape
- virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
+ void shapeChanged(ChangeType type, KoShape *shape = 0) override;
// from KoParameterShape
- virtual void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
// from KoParameterShape
- virtual void updatePath(const QSizeF &size);
+ void updatePath(const QSizeF &size) override;
private:
EnhancedPathShape(const EnhancedPathShape &rhs);
void evaluateHandles();
void reset();
/// parses the enhanced path data
void parsePathData(const QString &data);
/// Adds a new command
void addCommand(const QString &command, bool triggerUpdate);
/// Updates the size and position of an optionally existing text-on-shape text area
void updateTextArea();
/// Enables chaching results
void enableResultCache(bool enable);
// This function checks if draw:path-stretchpoint-x or draw:path-stretchpoint-y attributes are set.
// If the attributes are set the path shape coordinates (m_subpaths) are changed so that the form
// of the shape is preserved after stretching. It is needed for example in round-rectangles, to
// have the corners round after stretching. Without it the corners would be eliptical.
// Returns true if any points were actually changed, otherwise false.
bool useStretchPoints(const QSizeF &size, qreal &scale);
typedef QMap<QString, EnhancedPathFormula *> FormulaStore;
typedef QList<qreal> ModifierStore;
typedef QMap<QString, EnhancedPathParameter *> ParameterStore;
QRect m_viewBox; ///< the viewbox rectangle
QRectF m_viewBound; ///< the bounding box of the path in viewbox coordinates
QTransform m_viewMatrix; ///< matrix to convert from viewbox coordinates to shape coordinates
QTransform m_mirrorMatrix; ///< matrix to used for mirroring
QPointF m_viewBoxOffset;
QStringList m_textArea;
QList<EnhancedPathCommand *> m_commands; ///< the commands creating the outline
QList<EnhancedPathHandle *> m_enhancedHandles; ///< the handles for modifiying the shape
FormulaStore m_formulae; ///< the formulae
ModifierStore m_modifiers; ///< the modifier values
ParameterStore m_parameters; ///< the shared parameters
bool m_mirrorVertically; ///<whether or not the shape is to be mirrored vertically before transforming it
bool m_mirrorHorizontally; ///<whether or not the shape is to be mirrored horizontally before transforming it
qreal m_pathStretchPointX; ///< draw:path-stretchpoint-x attribute
qreal m_pathStretchPointY; ///< draw:path-stretchpoint-y attribute
QHash<QString, qreal> m_resultChache; ///< cache for intermediate results used when evaluating path
bool m_cacheResults; ///< indicates if result cache is enabled
};
#endif // KOENHANCEDPATHSHAPE_H
diff --git a/plugins/flake/pathshapes/enhancedpath/EnhancedPathShapeFactory.h b/plugins/flake/pathshapes/enhancedpath/EnhancedPathShapeFactory.h
index 38babc1259..19ec8effbc 100644
--- a/plugins/flake/pathshapes/enhancedpath/EnhancedPathShapeFactory.h
+++ b/plugins/flake/pathshapes/enhancedpath/EnhancedPathShapeFactory.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOENHANCEDPATHSHAPEFACTORY_H
#define KOENHANCEDPATHSHAPEFACTORY_H
#include <KoShapeFactoryBase.h>
class KoShape;
/// Factory for path shapes
class EnhancedPathShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
EnhancedPathShapeFactory();
- ~EnhancedPathShapeFactory() {}
- virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
+ ~EnhancedPathShapeFactory() override {}
+ KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const override;
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
private:
void addCross();
void addArrow();
void addCallout();
void addSmiley();
void addCircularArrow();
void addGearhead();
typedef QMap<QString, QVariant > ComplexType;
typedef QList<QVariant> ListType;
KoProperties *dataToProperties(const QString &modifiers, const QStringList &commands,
const ListType &handles, const ComplexType &formulae) const;
};
#endif // KOENHANCEDPATHSHAPEFACTORY_H
diff --git a/plugins/flake/pathshapes/rectangle/RectangleShape.h b/plugins/flake/pathshapes/rectangle/RectangleShape.h
index 36ff22081d..08c828c2b2 100644
--- a/plugins/flake/pathshapes/rectangle/RectangleShape.h
+++ b/plugins/flake/pathshapes/rectangle/RectangleShape.h
@@ -1,97 +1,97 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORECTANGLESHAPE_H
#define KORECTANGLESHAPE_H
#include "KoParameterShape.h"
#include <SvgShape.h>
#define RectangleShapeId "RectangleShape"
/**
* The RectangleShape is a shape that represents a rectangle.
* The rectangle can have rounded corners, with different corner
* radii in x- and y-direction.
*/
class RectangleShape : public KoParameterShape, public SvgShape
{
public:
RectangleShape();
- ~RectangleShape();
+ ~RectangleShape() override;
KoShape* cloneShape() const override;
/// Returns the corner radius in x-direction
qreal cornerRadiusX() const;
/**
* Sets the corner radius in x-direction.
*
* The corner x-radius is a percent value (a number between 0 and 100)
* of the half size of the rectangles width.
*
* @param radius the new corner radius in x-direction
*/
void setCornerRadiusX(qreal radius);
/// Returns the corner radius in y-direction
qreal cornerRadiusY() const;
/**
* Sets the corner radius in y-direction.
*
* The corner y-radius is a percent value (a number between 0 and 100)
* of the half size of the rectangles height.
*
* @param radius the new corner radius in y-direction
*/
void setCornerRadiusY(qreal radius);
/// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
/// reimplemented
- virtual QString pathShapeId() const;
+ QString pathShapeId() const override;
/// reimplemented from SvgShape
- virtual bool saveSvg(SvgSavingContext &context);
+ bool saveSvg(SvgSavingContext &context) override;
/// reimplemented from SvgShape
- virtual bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context);
+ bool loadSvg(const KoXmlElement &element, SvgLoadingContext &context) override;
protected:
RectangleShape(const RectangleShape &rhs);
- void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- void updatePath(const QSizeF &size);
+ void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
+ void updatePath(const QSizeF &size) override;
void createPoints(int requiredPointCount);
void updateHandles();
private:
qreal m_cornerRadiusX; ///< in percent of half of the rectangle width (a number between 0 and 100)
qreal m_cornerRadiusY; ///< in percent of half of the rectangle height (a number between 0 and 100)
};
#endif /* KORECTANGLESHAPE_H */
diff --git a/plugins/flake/pathshapes/rectangle/RectangleShapeFactory.h b/plugins/flake/pathshapes/rectangle/RectangleShapeFactory.h
index 1252a2b7ba..2e9aebcfa4 100644
--- a/plugins/flake/pathshapes/rectangle/RectangleShapeFactory.h
+++ b/plugins/flake/pathshapes/rectangle/RectangleShapeFactory.h
@@ -1,39 +1,39 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KORECTANGLESHAPEFACTORY_H
#define KORECTANGLESHAPEFACTORY_H
#include "KoShapeFactoryBase.h"
class KoShape;
/// Factory for path shapes
class RectangleShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
RectangleShapeFactory();
- virtual ~RectangleShapeFactory() {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
- virtual QList<KoShapeConfigWidgetBase *> createShapeOptionPanels();
+ ~RectangleShapeFactory() override {}
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
+ QList<KoShapeConfigWidgetBase *> createShapeOptionPanels() override;
};
#endif
diff --git a/plugins/flake/pathshapes/spiral/SpiralShape.h b/plugins/flake/pathshapes/spiral/SpiralShape.h
index f60b698b9f..d58d6c6245 100644
--- a/plugins/flake/pathshapes/spiral/SpiralShape.h
+++ b/plugins/flake/pathshapes/spiral/SpiralShape.h
@@ -1,105 +1,105 @@
/* This file is part of the KDE project
Copyright (C) 2007 Rob Buis <buis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSPIRALSHAPE_H
#define KOSPIRALSHAPE_H
#include "KoParameterShape.h"
#define SpiralShapeId "SpiralShape"
/**
* This class adds support for the spiral
* shape.
*/
class SpiralShape : public KoParameterShape
{
public:
/// the possible spiral types
enum SpiralType {
Curve = 0, ///< spiral uses curves
Line = 1 ///< spiral uses lines
};
SpiralShape();
- ~SpiralShape();
+ ~SpiralShape() override;
KoShape* cloneShape() const override;
- void setSize(const QSizeF &newSize);
- virtual QPointF normalize();
+ void setSize(const QSizeF &newSize) override;
+ QPointF normalize() override;
/**
* Sets the type of the spiral.
* @param type the new spiral type
*/
void setType(SpiralType type);
/// Returns the actual spiral type
SpiralType type() const;
/**
* Sets the fade parameter of the spiral.
* @param angle the new start angle in degree
*/
void setFade(qreal fade);
/// Returns the actual fade parameter
qreal fade() const;
bool clockWise() const;
void setClockWise(bool clockwise);
/// reimplemented
- virtual QString pathShapeId() const;
+ QString pathShapeId() const override;
protected:
SpiralShape(const SpiralShape &rhs);
// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
- void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- void updatePath(const QSizeF &size);
+ void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
+ void updatePath(const QSizeF &size) override;
void createPath(const QSizeF &size);
private:
void updateKindHandle();
void updateAngleHandles();
// fade parameter
qreal m_fade;
// angle for modifying the kind in radiant
qreal m_kindAngle;
// the center of the spiral
QPointF m_center;
// the radii of the spiral
QPointF m_radii;
// the actual spiral type
SpiralType m_type;
//
bool m_clockwise;
KoSubpath m_points;
};
#endif /* KOSPIRALSHAPE_H */
diff --git a/plugins/flake/pathshapes/spiral/SpiralShapeConfigCommand.h b/plugins/flake/pathshapes/spiral/SpiralShapeConfigCommand.h
index 9f4b592045..70de1db46f 100644
--- a/plugins/flake/pathshapes/spiral/SpiralShapeConfigCommand.h
+++ b/plugins/flake/pathshapes/spiral/SpiralShapeConfigCommand.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SPIRALSHAPECONFIGCOMMAND_H
#define SPIRALSHAPECONFIGCOMMAND_H
#include "SpiralShape.h"
#include <kundo2command.h>
/// The undo / redo command for configuring a spiral shape
class SpiralShapeConfigCommand : public KUndo2Command
{
public:
/**
* Configures an spiral shape
* @param spiral the spiral shape to configure
* @param type the spiral type
* @param fade the fade parameter
* @param parent the optional parent command
*/
SpiralShapeConfigCommand(SpiralShape *spiral, SpiralShape::SpiralType type, bool clockWise, qreal fade, KUndo2Command *parent = 0);
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
SpiralShape *m_spiral;
SpiralShape::SpiralType m_oldType;
bool m_oldClockWise;
qreal m_oldFade;
SpiralShape::SpiralType m_newType;
bool m_newClockWise;
qreal m_newFade;
};
#endif // SPIRALSHAPECONFIGCOMMAND_H
diff --git a/plugins/flake/pathshapes/spiral/SpiralShapeConfigWidget.h b/plugins/flake/pathshapes/spiral/SpiralShapeConfigWidget.h
index 7c07da5219..f6e8c4b533 100644
--- a/plugins/flake/pathshapes/spiral/SpiralShapeConfigWidget.h
+++ b/plugins/flake/pathshapes/spiral/SpiralShapeConfigWidget.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SPIRALSHAPECONFIGWIDGET_H
#define SPIRALSHAPECONFIGWIDGET_H
#include "SpiralShape.h"
#include <ui_SpiralShapeConfigWidget.h>
#include <KoShapeConfigWidgetBase.h>
class SpiralShapeConfigWidget : public KoShapeConfigWidgetBase
{
Q_OBJECT
public:
SpiralShapeConfigWidget();
/// reimplemented
- virtual void open(KoShape *shape);
+ void open(KoShape *shape) override;
/// reimplemented
- virtual void save();
+ void save() override;
/// reimplemented
- virtual bool showOnShapeCreate()
+ bool showOnShapeCreate() override
{
return false;
}
/// reimplemented
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
private:
Ui::SpiralShapeConfigWidget widget;
SpiralShape *m_spiral;
};
#endif // SPIRALSHAPECONFIGWIDGET_H
diff --git a/plugins/flake/pathshapes/spiral/SpiralShapeFactory.h b/plugins/flake/pathshapes/spiral/SpiralShapeFactory.h
index 45eedbc470..d977c8e8a2 100644
--- a/plugins/flake/pathshapes/spiral/SpiralShapeFactory.h
+++ b/plugins/flake/pathshapes/spiral/SpiralShapeFactory.h
@@ -1,39 +1,39 @@
/* This file is part of the KDE project
Copyright (C) 2007 Rob Buis <buis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSPIRALSHAPEFACTORY_H
#define KOSPIRALSHAPEFACTORY_H
#include "KoShapeFactoryBase.h"
class KoShape;
/// Factory for spiral shapes
class SpiralShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
SpiralShapeFactory();
- ~SpiralShapeFactory() {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
- virtual QList<KoShapeConfigWidgetBase *> createShapeOptionPanels();
+ ~SpiralShapeFactory() override {}
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
+ QList<KoShapeConfigWidgetBase *> createShapeOptionPanels() override;
};
#endif /* KOSPIRALSHAPEFACTORY_H */
diff --git a/plugins/flake/pathshapes/star/StarShape.h b/plugins/flake/pathshapes/star/StarShape.h
index 78dc7fe9a2..a6740aca9d 100644
--- a/plugins/flake/pathshapes/star/StarShape.h
+++ b/plugins/flake/pathshapes/star/StarShape.h
@@ -1,150 +1,150 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSTARSHAPE_H
#define KOSTARSHAPE_H
#include <array>
#include <KoParameterShape.h>
#define StarShapeId "StarShape"
/**
* The star shape is a shape that can represent a star or
* a regular polygon. There a some properties which can
* be changed to control the appearance of the shape
* like the number of corners, the inner/outer radius
* and the corner roundness.
*/
class StarShape : public KoParameterShape
{
public:
StarShape();
- ~StarShape();
+ ~StarShape() override;
KoShape* cloneShape() const override;
/**
* Sets the number of corners.
*
* The minimum accepted number of corners is 3.
* If the star is set to be convex (like a regular polygon),
* the corner count equals the number of polygon points.
* For a real star it represents the number of legs the star has.
*
* @param cornerCount the new number of corners
*/
void setCornerCount(uint cornerCount);
/// Returns the number of corners
uint cornerCount() const;
/**
* Sets the radius of the base points.
* The base radius has no meaning if the star is set convex.
* @param baseRadius the new base radius
*/
void setBaseRadius(qreal baseRadius);
/// Returns the base radius
qreal baseRadius() const;
/**
* Sets the radius of the tip points.
* @param tipRadius the new tip radius
*/
void setTipRadius(qreal tipRadius);
/// Returns the tip radius
qreal tipRadius() const;
/**
* Sets the roundness at the base points.
*
* A roundness value of zero disables the roundness.
*
* @param baseRoundness the new base roundness
*/
void setBaseRoundness(qreal baseRoundness);
/**
* Sets the roundness at the tip points.
*
* A roundness value of zero disables the roundness.
*
* @param tipRoundness the new base roundness
*/
void setTipRoundness(qreal tipRoundness);
/**
* Sets the star to be convex, looking like a polygon.
* @param convex if true makes shape behave like regular polygon
*/
void setConvex(bool convex);
/// Returns if the star represents a regular polygon.
bool convex() const;
/**
* Returns the star center point in shape coordinates.
*
* The star center is the weight center of the star and not necessarily
* coincident with the shape center point.
*/
QPointF starCenter() const;
/// reimplemented
- virtual void setSize(const QSizeF &newSize);
+ void setSize(const QSizeF &newSize) override;
/// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
/// reimplemented
- virtual QString pathShapeId() const;
+ QString pathShapeId() const override;
protected:
StarShape(const StarShape &rhs);
- void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- void updatePath(const QSizeF &size);
+ void moveHandleAction(int handleId, const QPointF &point, Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
+ void updatePath(const QSizeF &size) override;
/// recreates the path points when the corner count or convexity changes
void createPoints(int requiredPointCount);
private:
/// Computes the star center point from the inner points
QPointF computeCenter() const;
/// Returns the default offset angle in radian
double defaultAngleRadian() const;
/// the handle types
enum Handles { tip = 0, base = 1 };
uint m_cornerCount; ///< number of corners
std::array<qreal, 2> m_radius; ///< the different radii
std::array<qreal, 2> m_angles; ///< the offset angles
qreal m_zoomX; ///< scaling in x
qreal m_zoomY; ///< scaling in y
std::array<qreal, 2> m_roundness; ///< the roundness at the handles
QPointF m_center; ///< the star center point
bool m_convex; ///< controls if the star is convex
};
#endif /* KOSTARSHAPE_H */
diff --git a/plugins/flake/pathshapes/star/StarShapeConfigCommand.h b/plugins/flake/pathshapes/star/StarShapeConfigCommand.h
index 368aebf4b5..405daf201f 100644
--- a/plugins/flake/pathshapes/star/StarShapeConfigCommand.h
+++ b/plugins/flake/pathshapes/star/StarShapeConfigCommand.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STARSHAPECONFIGCOMMAND_H
#define STARSHAPECONFIGCOMMAND_H
#include <kundo2command.h>
class StarShape;
/// The undo / redo command for configuring a star shape
class StarShapeConfigCommand : public KUndo2Command
{
public:
/**
* Configures a star shape
* @param star the star shape to configure
* @param cornerCount the number of corners to set
* @param innerRadius the inner radius
* @param outerRadius the outer radius
* @param convex indicates whether the star is convex or not
* @param parent the optional parent command
*/
StarShapeConfigCommand(StarShape *star, uint cornerCount, qreal innerRadius, qreal outerRadius, bool convex, KUndo2Command *parent = 0);
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
StarShape *m_star;
uint m_oldCornerCount;
qreal m_oldInnerRadius;
qreal m_oldOuterRadius;
bool m_oldConvex;
uint m_newCornerCount;
qreal m_newInnerRadius;
qreal m_newOuterRadius;
bool m_newConvex;
};
#endif // STARSHAPECONFIGCOMMAND_H
diff --git a/plugins/flake/pathshapes/star/StarShapeConfigWidget.h b/plugins/flake/pathshapes/star/StarShapeConfigWidget.h
index 98073ff4b5..ad7830d1f6 100644
--- a/plugins/flake/pathshapes/star/StarShapeConfigWidget.h
+++ b/plugins/flake/pathshapes/star/StarShapeConfigWidget.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STARSHAPECONFIGWIDGET_H
#define STARSHAPECONFIGWIDGET_H
#include <ui_StarShapeConfigWidget.h>
#include <KoShapeConfigWidgetBase.h>
class StarShape;
class StarShapeConfigWidget : public KoShapeConfigWidgetBase
{
Q_OBJECT
public:
StarShapeConfigWidget();
/// reimplemented
- virtual void open(KoShape *shape);
+ void open(KoShape *shape) override;
/// reimplemented
- virtual void save();
+ void save() override;
/// reimplemented
- virtual void setUnit(const KoUnit &unit);
+ void setUnit(const KoUnit &unit) override;
/// reimplemented
- virtual bool showOnShapeCreate()
+ bool showOnShapeCreate() override
{
return false;
}
/// reimplemented
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
private Q_SLOTS:
void typeChanged();
private:
Ui::StarShapeConfigWidget widget;
StarShape *m_star;
};
#endif // STARSHAPECONFIGWIDGET_H
diff --git a/plugins/flake/pathshapes/star/StarShapeFactory.h b/plugins/flake/pathshapes/star/StarShapeFactory.h
index fe4ad3ee23..304c88721b 100644
--- a/plugins/flake/pathshapes/star/StarShapeFactory.h
+++ b/plugins/flake/pathshapes/star/StarShapeFactory.h
@@ -1,40 +1,40 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSTARHAPEFACTORY_H
#define KOSTARHAPEFACTORY_H
#include <KoShapeFactoryBase.h>
class KoShape;
/// Factory for path shapes
class StarShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
StarShapeFactory();
- ~StarShapeFactory() {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
- virtual QList<KoShapeConfigWidgetBase *> createShapeOptionPanels();
+ ~StarShapeFactory() override {}
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
+ QList<KoShapeConfigWidgetBase *> createShapeOptionPanels() override;
};
#endif // KOSTARHAPEFACTORY_H
diff --git a/plugins/flake/textshape/AnnotationTextShape.h b/plugins/flake/textshape/AnnotationTextShape.h
index 367035d3b6..74bd033be7 100644
--- a/plugins/flake/textshape/AnnotationTextShape.h
+++ b/plugins/flake/textshape/AnnotationTextShape.h
@@ -1,88 +1,88 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ANNOTATIONTEXTSHAPE_H
#define ANNOTATIONTEXTSHAPE_H
#include "TextShape.h"
#include <KoShapeContainer.h>
#include <KoTextShapeData.h>
#include <QTextDocument>
#include <QPainter>
class KoInlineTextObjectManager;
class KoTextRangeManager;
#define AnnotationShape_SHAPEID "AnnotationTextShapeID"
class AnnotationTextShape : public TextShape
{
public:
// Some constants
static const qreal HeaderSpace; // The space needed for the annotation header.
static const qreal HeaderFontSize;
// For now we should give these parameters for TextShape.
AnnotationTextShape(KoInlineTextObjectManager *inlineTextObjectManager,
KoTextRangeManager *textRangeManager);
- virtual ~AnnotationTextShape();
+ ~AnnotationTextShape() override;
void setAnnotaionTextData(KoTextShapeData *textShape);
// reimplemented
void paintComponent(QPainter &painter, const KoViewConverter &converter,
- KoShapePaintingContext &paintcontext);
+ KoShapePaintingContext &paintcontext) override;
/**
* From KoShape reimplemented method to load the TextShape from ODF.
*
* This method redirects the call to the KoTextShapeData::loadOdf() method which
* in turn will call the KoTextLoader::loadBody() method that reads the element
* into a QTextCursor.
*
* @param element element which represents the shape in odf.
* @param context the KoShapeLoadingContext used for loading.
* @return false if loading failed.
*/
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/**
* From KoShape reimplemented method to store the TextShape data as ODF.
*
* @param context the KoShapeSavingContext used for saving.
*/
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
void setCreator(const QString &creator);
QString creator() const;
void setDate(const QString &date);
QString date() const;
void setDateString(const QString &date);
QString dateString() const;
private:
KoTextShapeData *m_textShapeData;
QString m_creator;
QString m_date;
QString m_dateString; // another wayof storing the date. Not sure when it is used.
};
#endif // ANNOTATIONTEXTSHAPE_H
diff --git a/plugins/flake/textshape/AnnotationTextShapeFactory.h b/plugins/flake/textshape/AnnotationTextShapeFactory.h
index 73fd2378cb..75f6591252 100644
--- a/plugins/flake/textshape/AnnotationTextShapeFactory.h
+++ b/plugins/flake/textshape/AnnotationTextShapeFactory.h
@@ -1,39 +1,39 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ANNOTATIONTEXTSHAPEFACTORY_H
#define ANNOTATIONTEXTSHAPEFACTORY_H
#include <KoShapeFactoryBase.h>
class KoShape;
class AnnotationTextShapeFactory : public KoShapeFactoryBase
{
public:
AnnotationTextShapeFactory();
- ~AnnotationTextShapeFactory() {}
+ ~AnnotationTextShapeFactory() override {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources) const;
- virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources) const override;
+ KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
};
#endif // ANNOTATIONTEXTSHAPEFACTORY_H
diff --git a/plugins/flake/textshape/FontFamilyAction.h b/plugins/flake/textshape/FontFamilyAction.h
index 0b887e01ad..b6440611f3 100644
--- a/plugins/flake/textshape/FontFamilyAction.h
+++ b/plugins/flake/textshape/FontFamilyAction.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2003 Andras Mantia <amantia@kde.org>
(C) 2005-2006 Hamish Rodda <rodda@kde.org>
(C) 2014 Dan Leinir Turthra Jensen
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
// This is a minorly modified version of the KFontAction class. It exists
// entirely because there's a hang bug on windows at the moment.
#ifndef KOFONTACTION_H
#define KOFONTACTION_H
#include <kselectaction.h>
class QIcon;
/**
* An action to select a font family.
* On a toolbar this will show a combobox with all the fonts on the system.
*/
class KoFontFamilyAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY(QString font READ font WRITE setFont)
public:
KoFontFamilyAction(uint fontListCriteria, QObject *parent);
explicit KoFontFamilyAction(QObject *parent);
KoFontFamilyAction(const QString &text, QObject *parent);
KoFontFamilyAction(const QIcon &icon, const QString &text, QObject *parent);
- virtual ~KoFontFamilyAction();
+ ~KoFontFamilyAction() override;
QString font() const;
void setFont(const QString &family);
- virtual QWidget *createWidget(QWidget *parent);
+ QWidget *createWidget(QWidget *parent) override;
private:
class KoFontFamilyActionPrivate;
KoFontFamilyActionPrivate *const d;
Q_PRIVATE_SLOT(d, void _ko_slotFontChanged(const QFont &))
};
#endif
diff --git a/plugins/flake/textshape/FontSizeAction.h b/plugins/flake/textshape/FontSizeAction.h
index 8611135621..6511e3f294 100644
--- a/plugins/flake/textshape/FontSizeAction.h
+++ b/plugins/flake/textshape/FontSizeAction.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2003 Andras Mantia <amantia@kde.org>
(C) 2005-2006 Hamish Rodda <rodda@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FONTSIZEACTION_H
#define FONTSIZEACTION_H
#include <kselectaction.h>
class QIcon;
/**
* An action to allow changing of the font size.
* This action will be shown as a combobox on a toolbar with a proper set of font sizes.
*
* NOTE: We do not use KFontSizeAction because it does not support font size
* values of type qreal.
*/
class FontSizeAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY(qreal fontSize READ fontSize WRITE setFontSize)
public:
explicit FontSizeAction(QObject *parent);
FontSizeAction(const QString &text, QObject *parent);
FontSizeAction(const QIcon &icon, const QString &text, QObject *parent);
- virtual ~FontSizeAction();
+ ~FontSizeAction() override;
qreal fontSize() const;
void setFontSize(qreal size);
Q_SIGNALS:
void fontSizeChanged(qreal);
protected Q_SLOTS:
/**
* This function is called whenever an action from the selections is triggered.
*/
- virtual void actionTriggered(QAction *action);
+ void actionTriggered(QAction *action) override;
private:
class Private;
Private *const d;
};
#endif
diff --git a/plugins/flake/textshape/ReferencesTool.h b/plugins/flake/textshape/ReferencesTool.h
index 4e01db1eb7..dfb382baed 100644
--- a/plugins/flake/textshape/ReferencesTool.h
+++ b/plugins/flake/textshape/ReferencesTool.h
@@ -1,136 +1,136 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2013 Aman Madaan <madaan.amanmadaan@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REFERENCESTOOL_H
#define REFERENCESTOOL_H
#include "TextTool.h"
#include <signal.h>
#include <QPointer>
#include <KoCanvasBase.h>
class TableOfContentsConfigure;
class SimpleTableOfContentsWidget;
class SimpleFootEndNotesWidget;
class SimpleCitationBibliographyWidget;
class KoInlineNote;
class KoTextEditor;
class KoBibliographyInfo;
class KoTableOfContentsGeneratorInfo;
class SimpleLinksWidget;
class LabeledWidget;
/// This tool is the ui for inserting Table of Contents, Citations/bibliography, footnotes, endnotes, index, table of illustrations etc
class ReferencesTool : public TextTool
{
Q_OBJECT
public:
explicit ReferencesTool(KoCanvasBase *canvas);
- virtual ~ReferencesTool();
+ ~ReferencesTool() override;
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes);
- virtual void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes) override;
+ void deactivate() override;
- virtual void createActions();
+ void createActions() override;
KoTextEditor *editor();
/// inserts a ToC and open a configure dialog for customization
void insertCustomToC(KoTableOfContentsGeneratorInfo *defaultTemplate);
/// insert a bibliography and open a configure dialog for customization
void insertCustomBibliography(KoBibliographyInfo *defaultTemplate);
protected:
/// reimplemented from superclass
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
private Q_SLOTS:
/// insert a citation
void insertCitation();
/// configure a bibliography
void configureBibliography();
/// format the table of contents template
void formatTableOfContents();
/// shows the configuration dialog for a ToC
void showConfigureDialog(QAction *action);
/// hides the configuration dialog for ToC
void hideCofigureDialog();
/// insert an autonumbered footnote
void insertAutoFootNote();
/// insert a labeled footnote
void insertLabeledFootNote(const QString &label);
/// insert an autonumbered endnote
void insertAutoEndNote();
/// insert a labeled endnote
void insertLabeledEndNote(const QString &label);
/// show the configuration dialog for footnotes
void showFootnotesConfigureDialog();
/// show the configuration dialog for endnotes
void showEndnotesConfigureDialog();
/// enable/disable buttons if cursor in notes' body or not
void updateButtons();
void customToCGenerated();
/// insert a Link
void insertLink();
///insert a bookmark
void insertBookmark(QString bookmarkName);
/// validate a bookmark
bool validateBookmark(QString bookmarkName);
private:
TableOfContentsConfigure *m_configure;
SimpleTableOfContentsWidget *m_stocw;
SimpleFootEndNotesWidget *m_sfenw;
KoInlineNote *m_note;
SimpleCitationBibliographyWidget *m_scbw;
SimpleLinksWidget *m_slw;
LabeledWidget *m_bmark;
QPointer<KoCanvasBase> m_canvas;
};
class QAction;
class QLineEdit;
class QLabel;
class LabeledWidget : public QWidget
{
Q_OBJECT
public:
enum LabelPosition {INLINE, ABOVE};
LabeledWidget(QAction *action, const QString &label, LabelPosition pos, bool warningLabelRequired);
void setWarningText(int pos, const QString &warning);
void clearLineEdit();
Q_SIGNALS:
void triggered(const QString &label);
void lineEditChanged(const QString &);
private Q_SLOTS:
void returnPressed();
protected:
- virtual void enterEvent(QEvent *event);
+ void enterEvent(QEvent *event) override;
private :
QLineEdit *m_lineEdit;
QLabel *m_warningLabel[2];
QAction *m_action;
};
#endif // REFERENCESTOOL_H
diff --git a/plugins/flake/textshape/ReferencesToolFactory.h b/plugins/flake/textshape/ReferencesToolFactory.h
index 5117a583e1..893513ab5c 100644
--- a/plugins/flake/textshape/ReferencesToolFactory.h
+++ b/plugins/flake/textshape/ReferencesToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REFERENCESTOOLFACTORY_H
#define REFERENCESTOOLFACTORY_H
#include <KoToolFactoryBase.h>
class ReferencesToolFactory : public KoToolFactoryBase
{
public:
ReferencesToolFactory();
- ~ReferencesToolFactory();
+ ~ReferencesToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/plugins/flake/textshape/ReviewTool.h b/plugins/flake/textshape/ReviewTool.h
index 17ded8cbf6..42d00db62b 100644
--- a/plugins/flake/textshape/ReviewTool.h
+++ b/plugins/flake/textshape/ReviewTool.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REVIEWTOOL_H
#define REVIEWTOOL_H
#include <QPointer>
#include <KoCanvasBase.h>
class KoPointerEvent;
class KoTextEditor;
class KoTextShapeData;
class KoViewConverter;
class TextShape;
class QAction;
class QPainter;
class QKeyEvent;
template <class T> class QVector;
/// This tool allows to manipulate the tracked changes of a document. You can accept or reject changes.
#include <TextTool.h>
class ReviewTool : public TextTool
{
Q_OBJECT
public:
explicit ReviewTool(KoCanvasBase *canvas);
- ~ReviewTool();
+ ~ReviewTool() override;
- virtual void mouseReleaseEvent(KoPointerEvent *event);
- virtual void mouseMoveEvent(KoPointerEvent *event);
- virtual void mousePressEvent(KoPointerEvent *event);
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes);
- virtual void deactivate();
- virtual void createActions();
+ void mouseReleaseEvent(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
+ void mousePressEvent(KoPointerEvent *event) override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes) override;
+ void deactivate() override;
+ void createActions() override;
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
public Q_SLOTS:
void removeAnnotation();
private:
KoTextEditor *m_textEditor;
KoTextShapeData *m_textShapeData;
QPointer<KoCanvasBase> m_canvas;
TextShape *m_textShape;
QAction *m_removeAnnotationAction;
KoShape *m_currentAnnotationShape;
};
#endif // REVIEWTOOL_H
diff --git a/plugins/flake/textshape/ReviewToolFactory.h b/plugins/flake/textshape/ReviewToolFactory.h
index 5f11eb59da..ac793f6c79 100644
--- a/plugins/flake/textshape/ReviewToolFactory.h
+++ b/plugins/flake/textshape/ReviewToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Pierre Stirnweiss \pierre.stirnweiss_calligra@gadz.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REVIEWTOOLFACTORY_H
#define REVIEWTOOLFACTORY_H
#include <KoToolFactoryBase.h>
class ReviewToolFactory : public KoToolFactoryBase
{
public:
ReviewToolFactory();
- ~ReviewToolFactory();
+ ~ReviewToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/plugins/flake/textshape/ShrinkToFitShapeContainer.h b/plugins/flake/textshape/ShrinkToFitShapeContainer.h
index 4f98c05377..897e0cffeb 100644
--- a/plugins/flake/textshape/ShrinkToFitShapeContainer.h
+++ b/plugins/flake/textshape/ShrinkToFitShapeContainer.h
@@ -1,119 +1,119 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2010 Sebastian Sauer <sebsauer@kdab.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SHRINKTOFITSHAPECONTAINER_H
#define SHRINKTOFITSHAPECONTAINER_H
#include <KoShape.h>
#include <KoShapeContainer.h>
#include <SimpleShapeContainerModel.h>
#include <KoXmlNS.h>
#include <KoXmlReader.h>
#include <KoOdfLoadingContext.h>
#include <KoTextShapeData.h>
#include <QObject>
#include <QPainter>
#include <KoShapeContainer_p.h>
#include <KoTextDocumentLayout.h>
#include <KoXmlNS.h>
#include <KoOdfLoadingContext.h>
#include <KoShapeLoadingContext.h>
#include <KoDocumentResourceManager.h>
/**
* \internal d-pointer class for the \a ShrinkToFitShapeContainer class.
*/
class ShrinkToFitShapeContainerPrivate : public KoShapeContainerPrivate
{
public:
explicit ShrinkToFitShapeContainerPrivate(KoShapeContainer *q, KoShape *childShape) : KoShapeContainerPrivate(q), childShape(childShape) {}
- virtual ~ShrinkToFitShapeContainerPrivate() {}
+ ~ShrinkToFitShapeContainerPrivate() override {}
KoShape *childShape; // the original shape not owned by us
};
/**
* Container that is used to wrap a shape and shrink a text-shape to fit the content.
*/
class ShrinkToFitShapeContainer : public KoShapeContainer
{
public:
explicit ShrinkToFitShapeContainer(KoShape *childShape, KoDocumentResourceManager *documentResources = 0);
- virtual ~ShrinkToFitShapeContainer();
+ ~ShrinkToFitShapeContainer() override;
// reimplemented
- virtual void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
// reimplemented
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
// reimplemented
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
/**
* Factory function to create and return a ShrinkToFitShapeContainer instance that wraps the \a shape with it.
*/
static ShrinkToFitShapeContainer *wrapShape(KoShape *shape, KoDocumentResourceManager *documentResourceManager = 0);
/**
* Try to load text-on-shape from \a element and wrap \a shape with it.
*/
static void tryWrapShape(KoShape *shape, const KoXmlElement &element, KoShapeLoadingContext &context);
/**
* Undo the wrapping done in the \a wrapShape method.
*/
void unwrapShape(KoShape *shape);
private:
Q_DECLARE_PRIVATE(ShrinkToFitShapeContainer)
};
/**
* The container-model class implements \a KoShapeContainerModel for the \a ShrinkToFitShapeContainer to
* to stuff once our container changes.
*/
class ShrinkToFitShapeContainerModel : public QObject, public SimpleShapeContainerModel
{
Q_OBJECT
friend class ShrinkToFitShapeContainer;
public:
ShrinkToFitShapeContainerModel(ShrinkToFitShapeContainer *q, ShrinkToFitShapeContainerPrivate *d);
// reimplemented
- virtual void containerChanged(KoShapeContainer *container, KoShape::ChangeType type);
+ void containerChanged(KoShapeContainer *container, KoShape::ChangeType type) override;
// reimplemented
- virtual bool inheritsTransform(const KoShape *child) const;
+ bool inheritsTransform(const KoShape *child) const override;
// reimplemented
- virtual bool isChildLocked(const KoShape *child) const;
+ bool isChildLocked(const KoShape *child) const override;
// reimplemented
- virtual bool isClipped(const KoShape *child) const;
+ bool isClipped(const KoShape *child) const override;
private Q_SLOTS:
void finishedLayout();
private:
ShrinkToFitShapeContainer *q;
ShrinkToFitShapeContainerPrivate *d;
qreal m_scale;
QSizeF m_shapeSize, m_documentSize;
int m_dirty;
bool m_maybeUpdate;
};
#endif
diff --git a/plugins/flake/textshape/SimpleRootAreaProvider.h b/plugins/flake/textshape/SimpleRootAreaProvider.h
index 6d02eda96b..ca8f79b941 100644
--- a/plugins/flake/textshape/SimpleRootAreaProvider.h
+++ b/plugins/flake/textshape/SimpleRootAreaProvider.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLEROOTAREAPROVIDER_H
#define SIMPLEROOTAREAPROVIDER_H
#include "KoTextLayoutRootAreaProvider.h"
class TextShape;
class KoTextShapeData;
class SimpleRootAreaProvider : public KoTextLayoutRootAreaProvider
{
public:
SimpleRootAreaProvider(KoTextShapeData *data, TextShape *textshape);
/// reimplemented
- virtual KoTextLayoutRootArea *provide(KoTextDocumentLayout *documentLayout, const RootAreaConstraint &constraints, int requestedPosition, bool *isNewRootArea);
+ KoTextLayoutRootArea *provide(KoTextDocumentLayout *documentLayout, const RootAreaConstraint &constraints, int requestedPosition, bool *isNewRootArea) override;
- virtual void releaseAllAfter(KoTextLayoutRootArea *afterThis);
+ void releaseAllAfter(KoTextLayoutRootArea *afterThis) override;
- virtual void doPostLayout(KoTextLayoutRootArea *rootArea, bool isNewRootArea);
+ void doPostLayout(KoTextLayoutRootArea *rootArea, bool isNewRootArea) override;
- virtual void updateAll();
+ void updateAll() override;
- virtual QRectF suggestRect(KoTextLayoutRootArea *rootArea);
+ QRectF suggestRect(KoTextLayoutRootArea *rootArea) override;
- virtual QList<KoTextLayoutObstruction *> relevantObstructions(KoTextLayoutRootArea *rootArea);
+ QList<KoTextLayoutObstruction *> relevantObstructions(KoTextLayoutRootArea *rootArea) override;
TextShape *m_textShape;
KoTextLayoutRootArea *m_area;
KoTextShapeData *m_textShapeData;
bool m_fixAutogrow;
};
#endif
diff --git a/plugins/flake/textshape/TextEditingPluginContainer.h b/plugins/flake/textshape/TextEditingPluginContainer.h
index 68e5151fcd..1f83252549 100644
--- a/plugins/flake/textshape/TextEditingPluginContainer.h
+++ b/plugins/flake/textshape/TextEditingPluginContainer.h
@@ -1,64 +1,64 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TEXTEDITINGPLUGINCONTAINER_H
#define TEXTEDITINGPLUGINCONTAINER_H
#include <QObject>
#include <QHash>
#include <QString>
#include <QVariant>
class KoTextEditingPlugin;
/// This class holds on to the text editing plugins.
/// the goal of this class is to have one plugin instance per calligra-document
/// instead of one per tool.
class TextEditingPluginContainer : public QObject
{
Q_OBJECT
public:
enum ResourceManagerId {
ResourceId = 345681743
};
explicit TextEditingPluginContainer(QObject *parent = 0);
- ~TextEditingPluginContainer();
+ ~TextEditingPluginContainer() override;
KoTextEditingPlugin *spellcheck() const;
KoTextEditingPlugin *plugin(const QString &pluginId) const
{
if (m_textEditingPlugins.contains(pluginId)) {
return m_textEditingPlugins.value(pluginId);
}
return 0;
}
QList<KoTextEditingPlugin *> values() const
{
return m_textEditingPlugins.values();
}
private:
QHash<QString, KoTextEditingPlugin *> m_textEditingPlugins;
};
Q_DECLARE_METATYPE(TextEditingPluginContainer *)
#endif
diff --git a/plugins/flake/textshape/TextPlugin.h b/plugins/flake/textshape/TextPlugin.h
index 17cf280ce2..fb5ce1b3ad 100644
--- a/plugins/flake/textshape/TextPlugin.h
+++ b/plugins/flake/textshape/TextPlugin.h
@@ -1,33 +1,33 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TEXTPLUGIN_H
#define TEXTPLUGIN_H
#include <QObject>
#include <QVariantList>
class TextPlugin : public QObject
{
Q_OBJECT
public:
TextPlugin(QObject *parent, const QVariantList &);
- ~TextPlugin() {}
+ ~TextPlugin() override {}
};
#endif
diff --git a/plugins/flake/textshape/TextShape.h b/plugins/flake/textshape/TextShape.h
index 9a1b0d840b..f4beb6921b 100644
--- a/plugins/flake/textshape/TextShape.h
+++ b/plugins/flake/textshape/TextShape.h
@@ -1,143 +1,143 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Pierre Stirnweiss \pierre.stirnweiss_calligra@gadz.org>
* Copyright (C) 2010 KO GmbH <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAPE_H
#define KOTEXTSHAPE_H
#include <KoShapeContainer.h>
#include <KoFrameShape.h>
#include <KoTextShapeData.h>
#include <KoTextDocument.h>
#include <QTextDocument>
#include <QPainter>
#define TextShape_SHAPEID "TextShapeID"
class KoInlineTextObjectManager;
class KoTextRangeManager;
class KoPageProvider;
class KoImageCollection;
class KoTextDocument;
class TextShape;
class KoTextDocumentLayout;
class KoParagraphStyle;
/**
* A text shape.
* The Text shape is capable of drawing structured text.
* @see KoTextShapeData
*/
class TextShape : public KoShapeContainer, public KoFrameShape
{
public:
TextShape(KoInlineTextObjectManager *inlineTextObjectManager, KoTextRangeManager *textRangeManager);
- virtual ~TextShape();
+ ~TextShape() override;
/// reimplemented
- void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paintComponent(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
/// reimplemented
- virtual void waitUntilReady(const KoViewConverter &converter, bool asynchronous) const;
+ void waitUntilReady(const KoViewConverter &converter, bool asynchronous) const override;
/// helper method.
QPointF convertScreenPos(const QPointF &point) const;
/// reimplemented
- QPainterPath outline() const;
+ QPainterPath outline() const override;
/// reimplemented
- QRectF outlineRect() const;
+ QRectF outlineRect() const override;
///reimplemented
- ChildZOrderPolicy childZOrderPolicy()
+ ChildZOrderPolicy childZOrderPolicy() override
{
return KoShape::ChildZPassThrough;
}
/// set the image collection which is needed to draw bullet from images
void setImageCollection(KoImageCollection *collection)
{
m_imageCollection = collection;
}
KoImageCollection *imageCollection();
/**
* From KoShape reimplemented method to load the TextShape from ODF.
*
* This method redirects the call to the KoTextShapeData::loadOdf() method which
* in turn will call the KoTextLoader::loadBody() method that reads the element
* into a QTextCursor.
*
* @param context the KoShapeLoadingContext used for loading.
* @param element element which represents the shape in odf.
* @return false if loading failed.
*/
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/**
* From KoShape reimplemented method to store the TextShape data as ODF.
*
* @param context the KoShapeSavingContext used for saving.
*/
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
KoTextShapeData *textShapeData()
{
return m_textShapeData;
}
void updateDocumentData();
- virtual void update() const;
- virtual void update(const QRectF &shape) const;
+ void update() const override;
+ void update(const QRectF &shape) const override;
// required for kpresenter hack
void setPageProvider(KoPageProvider *provider)
{
m_pageProvider = provider;
}
/// reimplemented
- virtual bool loadOdfFrame(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdfFrame(const KoXmlElement &element, KoShapeLoadingContext &context) override;
protected:
- virtual bool loadOdfFrameElement(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdfFrameElement(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// reimplemented
- virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context);
+ void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// reimplemented
- virtual QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
+ QString saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const override;
private:
- void shapeChanged(ChangeType type, KoShape *shape = 0);
+ void shapeChanged(ChangeType type, KoShape *shape = 0) override;
KoTextShapeData *m_textShapeData;
KoPageProvider *m_pageProvider;
KoImageCollection *m_imageCollection;
QRegion m_paintRegion;
bool m_clip;
KoTextDocumentLayout *m_layout;
};
#endif
diff --git a/plugins/flake/textshape/TextShapeFactory.h b/plugins/flake/textshape/TextShapeFactory.h
index 1b8cad20f9..60f750e41d 100644
--- a/plugins/flake/textshape/TextShapeFactory.h
+++ b/plugins/flake/textshape/TextShapeFactory.h
@@ -1,42 +1,42 @@
/* This file is part of the KDE project
* Copyright (C) 2006, 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TEXTSHAPEFACTORY_H
#define TEXTSHAPEFACTORY_H
#include <KoShapeFactoryBase.h>
class KoShape;
class TextShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
TextShapeFactory();
- ~TextShapeFactory() {}
+ ~TextShapeFactory() override {}
- virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
+ KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const override;
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
- virtual void newDocumentResourceManager(KoDocumentResourceManager *manager) const;
+ void newDocumentResourceManager(KoDocumentResourceManager *manager) const override;
};
#endif
diff --git a/plugins/flake/textshape/TextTool.h b/plugins/flake/textshape/TextTool.h
index 2205361ad3..b17bc1bba0 100644
--- a/plugins/flake/textshape/TextTool.h
+++ b/plugins/flake/textshape/TextTool.h
@@ -1,428 +1,428 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
* Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
* Copyright (C) 2008, 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
* Copyright (C) 2014 Denis Kuplyakov <dener.kup@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTTOOL_H
#define KOTEXTTOOL_H
#include "TextShape.h"
#include "KoPointedAt.h"
#include <KoToolBase.h>
#include <KoTextCommandBase.h>
#include <KoUnit.h>
#include <KoBorder.h>
#include <QClipboard>
#include <QHash>
#include <QTextBlock>
#include <QTextCursor>
#include <QTimer>
#include <QWeakPointer>
#include <QRectF>
#include <QPointer>
#include <TextEditingPluginContainer.h>
class InsertCharacter;
class KoChangeTracker;
class KoCharacterStyle;
class KoColor;
class KoColorPopupAction;
class KoParagraphStyle;
class KoStyleManager;
class KoTextEditor;
class UndoTextCommand;
class QAction;
class KActionMenu;
class KoFontFamilyAction;
class FontSizeAction;
class KUndo2Command;
class QDrag;
class QMimeData;
class QMenu;
class MockCanvas;
class TextToolSelection;
/**
* This is the tool for the text-shape (which is a flake-based plugin).
*/
class TextTool : public KoToolBase, public KoUndoableTool
{
Q_OBJECT
public:
explicit TextTool(KoCanvasBase *canvas);
#ifndef NDEBUG
explicit TextTool(MockCanvas *canvas);
#endif
- virtual ~TextTool();
+ ~TextTool() override;
/// reimplemented from superclass
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/// reimplemented from superclass
- virtual void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseTripleClickEvent(KoPointerEvent *event);
+ void mouseTripleClickEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mouseReleaseEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
/// reimplemented from superclass
- virtual void keyReleaseEvent(QKeyEvent *event);
+ void keyReleaseEvent(QKeyEvent *event) override;
/// reimplemented from superclass
- virtual void activate(ToolActivation activation, const QSet<KoShape *> &shapes);
+ void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
/// reimplemented from superclass
- virtual void deactivate();
+ void deactivate() override;
/// reimplemented from superclass
- virtual void copy() const;
+ void copy() const override;
/// reimplemented from KoUndoableTool
- virtual void setAddUndoCommandAllowed(bool allowed)
+ void setAddUndoCommandAllowed(bool allowed) override
{
m_allowAddUndoCommand = allowed;
}
///reimplemented
- virtual void deleteSelection();
+ void deleteSelection() override;
/// reimplemented from superclass
- virtual void cut();
+ void cut() override;
/// reimplemented from superclass
- virtual bool paste();
+ bool paste() override;
/// reimplemented from superclass
- virtual void dragMoveEvent(QDragMoveEvent *event, const QPointF &point);
+ void dragMoveEvent(QDragMoveEvent *event, const QPointF &point) override;
/// reimplemented from superclass
- void dragLeaveEvent(QDragLeaveEvent *event);
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
/// reimplemented from superclass
- virtual void dropEvent(QDropEvent *event, const QPointF &point);
+ void dropEvent(QDropEvent *event, const QPointF &point) override;
/// reimplemented from superclass
- virtual void repaintDecorations();
+ void repaintDecorations() override;
/// reimplemented from superclass
- virtual KoToolSelection *selection();
+ KoToolSelection *selection() override;
/// reimplemented from superclass
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
/// reimplemented from superclass
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query, const KoViewConverter &converter) const override;
/// reimplemented from superclass
- virtual void inputMethodEvent(QInputMethodEvent *event);
+ void inputMethodEvent(QInputMethodEvent *event) override;
/// The following two methods allow an undo/redo command to tell the tool, it will modify the QTextDocument and wants to be parent of the undo/redo commands resulting from these changes.
void startEditing(KUndo2Command *command);
void stopEditing();
void setShapeData(KoTextShapeData *data);
QRectF caretRect(QTextCursor *cursor, bool *upToDate = 0) const;
QRectF textRect(QTextCursor &cursor) const;
protected:
virtual void createActions();
TextShape *textShape()
{
return m_textShape;
}
friend class SimpleParagraphWidget;
friend class ParagraphSettingsDialog;
KoTextEditor *textEditor()
{
return m_textEditor.data();
}
public Q_SLOTS:
/// Insert comment to document.
void insertAnnotation();
/// start the textedit-plugin.
void startTextEditingPlugin(const QString &pluginId);
/// reimplemented from KoToolBase
- virtual void canvasResourceChanged(int key, const QVariant &res);
+ void canvasResourceChanged(int key, const QVariant &res) override;
Q_SIGNALS:
/// emitted every time a different styleManager is set.
void styleManagerChanged(KoStyleManager *manager);
/// emitted every time a caret move leads to a different character format being under the caret
void charFormatChanged(const QTextCharFormat &format, const QTextCharFormat &refBlockCharFormat);
/// emitted every time a caret move leads to a different paragraph format being under the caret
void blockFormatChanged(const QTextBlockFormat &format);
/// emitted every time a caret move leads to a different paragraph format being under the caret
void blockChanged(const QTextBlock &block);
private Q_SLOTS:
/// inserts new paragraph and includes it into the new section
void insertNewSection();
/// configures params of the current section
void configureSection();
/// inserts paragraph between sections bounds
void splitSections();
/// paste text from the clipboard without formatting
void pasteAsText();
/// make the selected text bold or not
void bold(bool);
/// make the selected text italic or not
void italic(bool);
/// underline of the selected text
void underline(bool underline);
/// strikethrough of the selected text
void strikeOut(bool strikeOut);
/// insert a non breaking space at the caret position
void nonbreakingSpace();
/// insert a non breaking hyphen at the caret position
void nonbreakingHyphen();
/// insert a soft hyphen at the caret position
void softHyphen();
/// insert a linebreak at the caret position
void lineBreak();
/// force the remainder of the text into the next page
void insertFrameBreak();
/// align all of the selected text left
void alignLeft();
/// align all of the selected text right
void alignRight();
/// align all of the selected text centered
void alignCenter();
/// align all of the selected text block-justified
void alignBlock();
/// make the selected text switch to be super-script
void superScript(bool);
/// make the selected text switch to be sub-script
void subScript(bool);
/// move the paragraph indent of the selected text to be less (left on LtR text)
void decreaseIndent();
/// move the paragraph indent of the selected text to be more (right on LtR text)
void increaseIndent();
/// Increase the font size. This will preserve eventual difference in font size within the selection.
void increaseFontSize();
/// Decrease font size. See above.
void decreaseFontSize();
/// Set font family
void setFontFamily(const QString &);
/// Set Font size
void setFontSize(qreal size);
/// see KoTextEditor::insertIndexMarker
void insertIndexMarker();
/// shows a dialog to insert a table
void insertTable();
/// insert a table of given dimensions
void insertTableQuick(int rows, int columns);
/// insert a row above
void insertTableRowAbove();
/// insert a row below
void insertTableRowBelow();
/// insert a column left
void insertTableColumnLeft();
/// insert a column right
void insertTableColumnRight();
/// delete a column
void deleteTableColumn();
/// delete a row
void deleteTableRow();
/// merge table cells
void mergeTableCells();
/// split previous merged table cells
void splitTableCells();
/// format the table border (enter table pen mode)
void setTableBorderData(const KoBorder::BorderData &data);
/// shows a dialog to alter the paragraph properties
void formatParagraph();
/// select all text in the current document.
void selectAll();
/// show the style manager
void showStyleManager(int styleId = -1);
/// change color of a selected text
void setTextColor(const KoColor &color);
/// change background color of a selected text
void setBackgroundColor(const KoColor &color);
/// Enable or disable grow-width-to-fit-text.
void setGrowWidthToFit(bool enabled);
/// Enable or disable grow-height-to-fit-text.
void setGrowHeightToFit(bool enabled);
/// Enable or disable shrink-to-fit-text.
void setShrinkToFit(bool enabled);
/// set Paragraph style of current selection. Existing style will be completely overridden.
void setStyle(KoParagraphStyle *syle);
/// set the characterStyle of the current selection. see above.
void setStyle(KoCharacterStyle *style);
/// set the level of current selected list
void setListLevel(int level);
/// slot to call when a series of commands is started that together need to become 1 undo action.
void startMacro(const QString &title);
/// slot to call when a series of commands has ended that together should be 1 undo action.
void stopMacro();
/// show the insert special character docker.
void insertSpecialCharacter();
/// insert string
void insertString(const QString &string);
/// returns the focus to canvas when styles are selected in the optionDocker
void returnFocusToCanvas();
void selectFont();
void shapeAddedToCanvas();
void blinkCaret();
void relayoutContent();
// called when the m_textShapeData has been deleted.
void shapeDataRemoved();
//Show tooltip with editing info
void showEditTip();
/// print debug about the details of the text document
void debugTextDocument();
/// print debug about the details of the styles on the current text document
void debugTextStyles();
void ensureCursorVisible(bool moveView = true);
void createStyleFromCurrentBlockFormat(const QString &name);
void createStyleFromCurrentCharFormat(const QString &name);
void testSlot(bool);
/// change block text direction
void textDirectionChanged();
void updateActions();
- QMenu* popupActionsMenu();
+ QMenu* popupActionsMenu() override;
private:
void repaintCaret();
void repaintSelection();
KoPointedAt hitTest(const QPointF &point) const;
void updateStyleManager();
void updateSelectedShape(const QPointF &point, bool noDocumentChange);
void updateSelectionHandler();
void editingPluginEvents();
void finishedWord();
void finishedParagraph();
void startingSimpleEdit();
void runUrl(KoPointerEvent *event, QString &url);
void useTableBorderCursor();
QMimeData *generateMimeData() const;
TextEditingPluginContainer *textEditingPluginContainer();
private:
friend class UndoTextCommand;
friend class ChangeTracker;
friend class TextCutCommand;
friend class ShowChangesCommand;
TextShape *m_textShape; // where caret of m_textEditor currently is
KoTextShapeData *m_textShapeData; // where caret of m_textEditor currently is
QWeakPointer<KoTextEditor> m_textEditor;
QWeakPointer<KoTextEditor> m_oldTextEditor;
KoChangeTracker *m_changeTracker;
KoUnit m_unit;
bool m_allowActions;
bool m_allowAddUndoCommand;
bool m_allowResourceManagerUpdates;
int m_prevCursorPosition; /// used by editingPluginEvents
int m_prevMouseSelectionStart, m_prevMouseSelectionEnd;
QTimer m_caretTimer;
bool m_caretTimerState;
QAction *m_actionPasteAsText;
QAction *m_actionFormatBold;
QAction *m_actionFormatItalic;
QAction *m_actionFormatUnderline;
QAction *m_actionFormatStrikeOut;
QAction *m_actionAlignLeft;
QAction *m_actionAlignRight;
QAction *m_actionAlignCenter;
QAction *m_actionAlignBlock;
QAction *m_actionFormatSuper;
QAction *m_actionFormatSub;
QAction *m_actionFormatIncreaseIndent;
QAction *m_actionFormatDecreaseIndent;
QAction *m_growWidthAction;
QAction *m_growHeightAction;
QAction *m_shrinkToFitAction;
QAction *m_actionChangeDirection;
QAction *m_actionInsertSection;
QAction *m_actionConfigureSection;
QAction *m_actionSplitSections;
KActionMenu *m_variableMenu;
FontSizeAction *m_actionFormatFontSize;
KoFontFamilyAction *m_actionFormatFontFamily;
KoColorPopupAction *m_actionFormatTextColor;
KoColorPopupAction *m_actionFormatBackgroundColor;
KUndo2Command *m_currentCommand; //this command will be the direct parent of undoCommands generated as the result of QTextDocument changes
bool m_currentCommandHasChildren;
InsertCharacter *m_specialCharacterDocker;
QPointer<TextEditingPluginContainer> m_textEditingPlugins;
bool m_textTyping;
bool m_textDeleting;
QTimer m_editTipTimer;
KoPointedAt m_editTipPointedAt;
QPoint m_editTipPos;
bool m_delayedEnsureVisible;
TextToolSelection *m_toolSelection;
KoPointedAt m_tableDragInfo;
bool m_tableDraggedOnce;
bool m_tableDragWithShift;
QPointF m_draggingOrigin;
qreal m_dx;
qreal m_dy;
bool m_tablePenMode;
KoBorder::BorderData m_tablePenBorderData;
mutable QRectF m_lastImMicroFocus;
bool m_clickWithinSelection;
QDrag *m_drag;
QAbstractTextDocumentLayout::Selection m_preDragSelection;
QScopedPointer<QMenu> m_contextMenu;
};
#endif
diff --git a/plugins/flake/textshape/TextToolFactory.h b/plugins/flake/textshape/TextToolFactory.h
index e83af806d3..fff7d2ba93 100644
--- a/plugins/flake/textshape/TextToolFactory.h
+++ b/plugins/flake/textshape/TextToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTTOOLFACTORY_H
#define KOTEXTTOOLFACTORY_H
#include <KoToolFactoryBase.h>
class TextToolFactory : public KoToolFactoryBase
{
public:
TextToolFactory();
- ~TextToolFactory();
+ ~TextToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/plugins/flake/textshape/commands/AcceptChangeCommand.h b/plugins/flake/textshape/commands/AcceptChangeCommand.h
index 85c56c8811..86fc865bc2 100644
--- a/plugins/flake/textshape/commands/AcceptChangeCommand.h
+++ b/plugins/flake/textshape/commands/AcceptChangeCommand.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Pierre Stirnweiss \pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ACCEPTCHANGECOMMAND_H
#define ACCEPTCHANGECOMMAND_H
#include <KoTextCommandBase.h>
#include <QPair>
class KoChangeTracker;
class QTextDocument;
class AcceptChangeCommand : public QObject, public KoTextCommandBase
{
Q_OBJECT
public:
AcceptChangeCommand(int changeId, const QList<QPair<int, int> > &changeRanges, QTextDocument *document, KUndo2Command *parent = 0);
- ~AcceptChangeCommand();
+ ~AcceptChangeCommand() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
Q_SIGNALS:
void acceptRejectChange();
private:
bool m_first;
int m_changeId;
QList<QPair<int, int> > m_changeRanges;
QTextDocument *m_document;
KoChangeTracker *m_changeTracker;
};
#endif // ACCEPTCHANGECOMMAND_H
diff --git a/plugins/flake/textshape/commands/AutoResizeCommand.h b/plugins/flake/textshape/commands/AutoResizeCommand.h
index 36b2a1b72c..a1fc1ef4c2 100644
--- a/plugins/flake/textshape/commands/AutoResizeCommand.h
+++ b/plugins/flake/textshape/commands/AutoResizeCommand.h
@@ -1,47 +1,47 @@
/*
* This file is part of the KDE project
* Copyright (C) 2010 Sebastian Sauer <sebsauer@kdab.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef AUTORESIZECOMMAND_H
#define AUTORESIZECOMMAND_H
#include <kundo2command.h>
#include <QPointer>
#include <TextTool.h>
#include <KoTextDocumentLayout.h>
class TextShape;
class AutoResizeCommand : public KUndo2Command
{
public:
AutoResizeCommand(KoTextShapeData *shapeData, KoTextShapeData::ResizeMethod resizeMethod, bool enable);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
KoTextShapeData *m_shapeData;
KoTextShapeData::ResizeMethod m_resizeMethod;
bool m_enabled;
bool m_first;
KoTextShapeData::ResizeMethod m_prevResizeMethod;
};
#endif // TEXTCUTCOMMAND_H
diff --git a/plugins/flake/textshape/commands/ChangeListLevelCommand.h b/plugins/flake/textshape/commands/ChangeListLevelCommand.h
index 46a706a14e..ecbd3f199a 100644
--- a/plugins/flake/textshape/commands/ChangeListLevelCommand.h
+++ b/plugins/flake/textshape/commands/ChangeListLevelCommand.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGELISTLEVELCOMMAND
#define CHANGELISTLEVELCOMMAND
#include "KoTextCommandBase.h"
#include <QTextBlock>
#include <QList>
#include <QHash>
class KoList;
/**
* This command is used the change level of a list-item.
*/
class ChangeListLevelCommand : public KoTextCommandBase
{
public:
enum CommandType {
IncreaseLevel,
DecreaseLevel,
SetLevel
};
/**
* Change the list property of 'block'.
* @param block the paragraph to change the list property of
* @param coef indicates by how many levels the list item should be displaced
* @param parent the parent undo command for macro functionality
*/
ChangeListLevelCommand(const QTextCursor &cursor, CommandType type, int coef, KUndo2Command *parent = 0);
- ~ChangeListLevelCommand();
+ ~ChangeListLevelCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
/// reimplemnted from KUndo2Command
- virtual int id() const
+ int id() const override
{
return 58450689;
}
/// reimplemnted from KUndo2Command
- virtual bool mergeWith(const KUndo2Command *other);
+ bool mergeWith(const KUndo2Command *other) override;
private:
int effectiveLevel(int level);
CommandType m_type;
int m_coefficient;
QList<QTextBlock> m_blocks;
QHash<int, KoList *> m_lists;
QHash<int, int> m_levels;
bool m_first;
};
#endif
diff --git a/plugins/flake/textshape/commands/RejectChangeCommand.h b/plugins/flake/textshape/commands/RejectChangeCommand.h
index 3b0d864f1d..5b8a6bb3a6 100644
--- a/plugins/flake/textshape/commands/RejectChangeCommand.h
+++ b/plugins/flake/textshape/commands/RejectChangeCommand.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Pierre Stirnweiss \pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REJECTCHANGECOMMAND_H
#define REJECTCHANGECOMMAND_H
#include <KoTextCommandBase.h>
#include <QPair>
class KoChangeTracker;
class KoTextDocumentLayout;
class QTextDocument;
class RejectChangeCommand : public QObject, public KoTextCommandBase
{
Q_OBJECT
public:
RejectChangeCommand(int changeId, const QList<QPair<int, int> > &changeRanges, QTextDocument *document, KUndo2Command *parent = 0);
- ~RejectChangeCommand();
+ ~RejectChangeCommand() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
Q_SIGNALS:
void acceptRejectChange();
private:
bool m_first;
int m_changeId;
QList<QPair<int, int> > m_changeRanges;
QTextDocument *m_document;
KoChangeTracker *m_changeTracker;
KoTextDocumentLayout *m_layout;
};
#endif // REJECTCHANGECOMMAND_H
diff --git a/plugins/flake/textshape/commands/ShowChangesCommand.h b/plugins/flake/textshape/commands/ShowChangesCommand.h
index 2ac4691bd4..dc46add039 100644
--- a/plugins/flake/textshape/commands/ShowChangesCommand.h
+++ b/plugins/flake/textshape/commands/ShowChangesCommand.h
@@ -1,70 +1,70 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Ganesh Paramasivam <ganesh@crystalfab.com>
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef SHOWCHANGECOMMAND_H
#define SHOWCHANGECOMMAND_H
#include "KoTextCommandBase.h"
#include <QObject>
#include <QPointer>
#include <QList>
#include <KoCanvasBase.h>
class KoChangeTracker;
class KoTextEditor;
class QTextDocument;
class ShowChangesCommand : public QObject, public KoTextCommandBase
{
Q_OBJECT
public:
ShowChangesCommand(bool showChanges, QTextDocument *document, KoCanvasBase *canvas, KUndo2Command *parent = 0);
- ~ShowChangesCommand();
+ ~ShowChangesCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
Q_SIGNALS:
void toggledShowChange(bool on);
private:
void enableDisableChanges();
void enableDisableStates(bool showChanges);
void insertDeletedChanges();
void checkAndAddAnchoredShapes(int position, int length);
void removeDeletedChanges();
void checkAndRemoveAnchoredShapes(int position, int length);
QTextDocument *m_document;
KoChangeTracker *m_changeTracker;
KoTextEditor *m_textEditor;
bool m_first;
bool m_showChanges;
QPointer<KoCanvasBase> m_canvas;
QList<KUndo2Command *> m_shapeCommands;
};
#endif // SHOWCHANGECOMMAND_H
diff --git a/plugins/flake/textshape/dialogs/BibliographyPreview.h b/plugins/flake/textshape/dialogs/BibliographyPreview.h
index 8ddfa99b92..8a88249729 100644
--- a/plugins/flake/textshape/dialogs/BibliographyPreview.h
+++ b/plugins/flake/textshape/dialogs/BibliographyPreview.h
@@ -1,68 +1,68 @@
#ifndef BIBLIOGRAPHYPREVIEW_H
#define BIBLIOGRAPHYPREVIEW_H
/* This file is part of the KDE project
* Copyright (C) 2011 Smit Patel <smitpatel24@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <KoZoomHandler.h>
#include <KoInlineTextObjectManager.h>
#include <KoTextRangeManager.h>
#include <QFrame>
#include <QPixmap>
class TextShape;
class KoBibliographyInfo;
class KoStyleManager;
class BibliographyPreview : public QFrame
{
Q_OBJECT
public:
explicit BibliographyPreview(QWidget *parent = 0);
- ~BibliographyPreview();
+ ~BibliographyPreview() override;
void setStyleManager(KoStyleManager *styleManager);
/// sets the size of the generated preview pixmap if not set then it takes the widget's size
void setPreviewSize(const QSize &size);
QPixmap previewPixmap();
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
Q_SIGNALS:
void pixmapGenerated();
public Q_SLOTS:
void updatePreview(KoBibliographyInfo *info);
private Q_SLOTS:
void finishedPreviewLayout();
private:
TextShape *m_textShape;
QPixmap *m_pm;
KoZoomHandler m_zoomHandler;
KoStyleManager *m_styleManager;
KoInlineTextObjectManager m_itom;
KoTextRangeManager m_tlm;
QSize m_previewPixSize;
void deleteTextShape();
};
#endif // BIBLIOGRAPHYPREVIEW_H
diff --git a/plugins/flake/textshape/dialogs/ChangeConfigureDialog.h b/plugins/flake/textshape/dialogs/ChangeConfigureDialog.h
index 48e274197d..b3ad7d6b55 100644
--- a/plugins/flake/textshape/dialogs/ChangeConfigureDialog.h
+++ b/plugins/flake/textshape/dialogs/ChangeConfigureDialog.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Ganesh Paramasivam <ganesh@crystalfab.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __CHANGE_CONFIGURE_DIALOG_H__
#define __CHANGE_CONFIGURE_DIALOG_H__
#include <QLabel>
#include <KoChangeTracker.h>
class ColorDisplayLabel: public QLabel
{
public:
explicit ColorDisplayLabel(QWidget *parent = 0);
- ~ColorDisplayLabel();
- void paintEvent(QPaintEvent *event);
+ ~ColorDisplayLabel() override;
+ void paintEvent(QPaintEvent *event) override;
const QColor &color() const;
void setColor(const QColor &color);
private:
QColor labelColor;
};
#include <ui_ChangeConfigureDialog.h>
class ChangeConfigureDialog: public QDialog
{
Q_OBJECT
typedef enum {
eInsert,
eDelete,
eFormatChange,
eChangeTypeNone
} ChangeType;
public:
ChangeConfigureDialog(const QColor &insertionColor, const QColor &deletionColor, const QColor &formatChangeColor, const QString &authorName, KoChangeTracker::ChangeSaveFormat changeSaveFormat, QWidget *parent = 0);
- ~ChangeConfigureDialog();
+ ~ChangeConfigureDialog() override;
const QColor &getInsertionBgColor();
const QColor &getDeletionBgColor();
const QColor &getFormatChangeBgColor();
const QString authorName();
KoChangeTracker::ChangeSaveFormat saveFormat();
private:
Ui::ChangeConfigureDialog ui;
void updatePreviewText();
void colorSelect(ChangeType type);
private Q_SLOTS:
void insertionColorSelect();
void deletionColorSelect();
void formatChangeColorSelect();
};
#endif
diff --git a/plugins/flake/textshape/dialogs/CharacterHighlighting.h b/plugins/flake/textshape/dialogs/CharacterHighlighting.h
index 31e3d2e5cf..2bb0573bf0 100644
--- a/plugins/flake/textshape/dialogs/CharacterHighlighting.h
+++ b/plugins/flake/textshape/dialogs/CharacterHighlighting.h
@@ -1,97 +1,97 @@
/* This file is part of the KDE project
Copyright (C) 2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
Copyright (C) 2006 Thomas Zander <zander@kde.org>
Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHARACTERHIGHLIGHTING_H
#define CHARACTERHIGHLIGHTING_H
#include <ui_CharacterHighlighting.h>
#include "KoCharacterStyle.h"
#include <kfontchooser.h>
class QColor;
class CharacterHighlighting : public QWidget
{
Q_OBJECT
public:
explicit CharacterHighlighting(bool uniqueFormat, QWidget *parent = 0);
- ~CharacterHighlighting() {}
+ ~CharacterHighlighting() override {}
void setDisplay(KoCharacterStyle *style);
void save(KoCharacterStyle *style);
QStringList capitalizationList();
QStringList fontLayoutPositionList();
Q_SIGNALS:
void underlineChanged(KoCharacterStyle::LineType, KoCharacterStyle::LineStyle, QColor);
void strikethroughChanged(KoCharacterStyle::LineType, KoCharacterStyle::LineStyle, QColor);
void capitalizationChanged(QFont::Capitalization);
void fontChanged(const QFont &font);
void textColorChanged(QColor);
void backgroundColorChanged(QColor);
void charStyleChanged();
private Q_SLOTS:
void underlineTypeChanged(int item);
void underlineStyleChanged(int item);
void underlineColorChanged(QColor color);
void strikethroughTypeChanged(int item);
void strikethroughStyleChanged(int item);
void strikethroughColorChanged(QColor color);
void capitalisationChanged(int item);
void positionChanged(int item);
void textToggled(bool state);
void backgroundToggled(bool state);
void clearTextColor();
void clearBackgroundColor();
void textColorChanged();
void backgroundColorChanged();
private:
KoCharacterStyle::LineType indexToLineType(int index);
KoCharacterStyle::LineStyle indexToLineStyle(int index);
int lineTypeToIndex(KoCharacterStyle::LineType type);
int lineStyleToIndex(KoCharacterStyle::LineStyle type);
Ui::CharacterHighlighting widget;
KFontChooser *m_fontChooser;
bool m_uniqueFormat;
bool m_underlineInherited;
bool m_strikeoutInherited;
bool m_mixedCaseInherited;
bool m_smallCapsInherited;
bool m_allUpperCaseInherited;
bool m_allLowerCaseInherited;
bool m_capitalizInherited;
bool m_positionInherited;
bool m_hyphenateInherited;
bool m_textColorChanged;
bool m_textColorReset;
bool m_backgroundColorChanged;
bool m_backgroundColorReset;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/DockerStylesComboModel.h b/plugins/flake/textshape/dialogs/DockerStylesComboModel.h
index 4419d1f1dd..2c2ee76199 100644
--- a/plugins/flake/textshape/dialogs/DockerStylesComboModel.h
+++ b/plugins/flake/textshape/dialogs/DockerStylesComboModel.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DOCKERSTYLESCOMBOMODEL_H
#define DOCKERSTYLESCOMBOMODEL_H
#include "StylesFilteredModelBase.h"
#include <QVector>
class KoCharacterStyle;
class KoStyleManager;
class DockerStylesComboModel : public StylesFilteredModelBase
{
Q_OBJECT
public:
enum CategoriesInternalIds {
UsedStyleId = -32000,
UnusedStyleId = -32001
};
explicit DockerStylesComboModel(QObject *parent = 0);
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const override;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void setStyleManager(KoStyleManager *sm);
void setInitialUsedStyles(QVector<int> usedStyles);
Q_SIGNALS:
public Q_SLOTS:
void styleApplied(const KoCharacterStyle *style);
protected:
- virtual void createMapping();
+ void createMapping() override;
private:
KoCharacterStyle *findStyle(int styleId) const;
KoStyleManager *m_styleManager;
QVector<int> m_usedStylesId;
QVector<int> m_usedStyles;
QVector<int> m_unusedStyles;
};
#endif // DOCKERSTYLESCOMBOMODEL_H
diff --git a/plugins/flake/textshape/dialogs/FontDecorations.h b/plugins/flake/textshape/dialogs/FontDecorations.h
index c0e2903562..3d39139902 100644
--- a/plugins/flake/textshape/dialogs/FontDecorations.h
+++ b/plugins/flake/textshape/dialogs/FontDecorations.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
Copyright (C) 2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FONTDECORATIONS_H
#define FONTDECORATIONS_H
#include <ui_FontDecorations.h>
#include <KoCharacterStyle.h>
class FontDecorations : public QWidget
{
Q_OBJECT
public:
explicit FontDecorations(bool uniqueFormat, QWidget *parent = 0);
- ~FontDecorations() {}
+ ~FontDecorations() override {}
void setDisplay(KoCharacterStyle *style);
void save(KoCharacterStyle *style) const;
private Q_SLOTS:
void hyphenateStateChanged();
private:
Ui::FontDecorations widget;
bool m_hyphenateInherited;
bool m_uniqueFormat;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/FormattingPreview.h b/plugins/flake/textshape/dialogs/FormattingPreview.h
index f5b4cf1faa..35ce5608a8 100644
--- a/plugins/flake/textshape/dialogs/FormattingPreview.h
+++ b/plugins/flake/textshape/dialogs/FormattingPreview.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
Copyright (C) 2008 Pierre Stirnweiss <pstirnweiss@googlemail.com>
Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FORMATTINGPREVIEW_H
#define FORMATTINGPREVIEW_H
#include <KoCharacterStyle.h>
#include <KoParagraphStyle.h>
#include <QFont>
#include <QFrame>
#include <QWidget>
class QString;
class KoStyleThumbnailer;
class FormattingPreview : public QFrame
{
Q_OBJECT
public:
explicit FormattingPreview(QWidget *parent = 0);
- ~FormattingPreview();
+ ~FormattingPreview() override;
public Q_SLOTS:
///Character properties
void setCharacterStyle(const KoCharacterStyle *style);
void setParagraphStyle(const KoParagraphStyle *style);
void setText(const QString &sampleText);
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
private:
QString m_sampleText;
KoCharacterStyle *m_characterStyle;
KoParagraphStyle *m_paragraphStyle;
KoStyleThumbnailer *m_thumbnailer;
bool m_previewLayoutRequired;
};
#endif //FORMATTINGPREVIEW_H
diff --git a/plugins/flake/textshape/dialogs/LanguageTab.h b/plugins/flake/textshape/dialogs/LanguageTab.h
index ff1fb78e4f..b42fc5ea3f 100644
--- a/plugins/flake/textshape/dialogs/LanguageTab.h
+++ b/plugins/flake/textshape/dialogs/LanguageTab.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
Copyright (C) 2001,2002,2003,2006 Montel Laurent <lmontel@mandrakesoft.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __kolanguagetab_h__
#define __kolanguagetab_h__
#include <ui_LanguageTab.h>
class KoCharacterStyle;
class LanguageTab : public QWidget
{
Q_OBJECT
public:
explicit LanguageTab(/*KSpell2::Loader::Ptr loader = KSpell2::Loader::Ptr()*/bool uniqueFormat, QWidget *parent = 0, Qt::WFlags fl = 0);
- ~LanguageTab();
+ ~LanguageTab() override;
QString language() const;
void setDisplay(KoCharacterStyle *style);
void save(KoCharacterStyle *style) const;
Q_SIGNALS:
void languageChanged();
private:
Ui::LanguageTab widget;
bool m_uniqueFormat;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/LinkInsertionDialog.h b/plugins/flake/textshape/dialogs/LinkInsertionDialog.h
index 254a6653b8..3d7ec2d355 100644
--- a/plugins/flake/textshape/dialogs/LinkInsertionDialog.h
+++ b/plugins/flake/textshape/dialogs/LinkInsertionDialog.h
@@ -1,84 +1,84 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Aman Madaan <madaan.amanmadaan@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LINKINSERTDIALOG
#define LINKINSERTDIALOG
#include <ui_LinkInsertionDialog.h>
#include <QDialog>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QWidget>
#include <QTimer>
#include <KoBookmarkManager.h>
#include <KoTextRangeManager.h>
#include <KoTextDocument.h>
#include <QListWidget>
#define FETCH_TIMEOUT 5000
class LinkInsertionDialog : public QDialog
{
Q_OBJECT
public :
explicit LinkInsertionDialog(KoTextEditor *editor, QWidget *parent = 0);
- virtual ~LinkInsertionDialog();
+ ~LinkInsertionDialog() override;
private Q_SLOTS:
void insertLink();
public Q_SLOTS:
void fetchTitleFromURL();
void replyFinished();
void fetchTitleError(QNetworkReply::NetworkError);
void updateTitleDownloadProgress(qint64, qint64);
void fetchTitleTimeout();
/**
* Verifies the text entered in the four line edits : Weblink URL, Weblink text,
* Bookmark name and Bookmark text. The "Ok" button is enabled only if the input
* is valid.
* @param text is the text to be verified.
*/
void enableDisableButtons(QString text);
/**
* Once all the line edits for a tab have been verified, the OK button is enabled.
* If the tab is switched, the validity of OK should be recalculated for the new tab.
* @param text is the current active tab.
*/
void checkInsertEnableValidity(int);
private :
Ui::LinkInsertionDialog dlg;
KoTextEditor *m_editor;
const KoBookmarkManager *m_bookmarkManager;
QStringList m_bookmarkList;
QNetworkReply *m_reply;
QNetworkAccessManager *m_networkAccessManager;
QUrl m_linkURL;
QTimer m_timeoutTimer;
- void accept();
+ void accept() override;
void sendRequest();
void insertBookmarkLink(const QString &URL, const QString &text);
void insertHyperlink(QString &linkURL, const QString &linkText);
void displayInlineWarning(const QString &title, QLabel *label) const;
bool exists(const QString &) const;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/ListLevelChooser.h b/plugins/flake/textshape/dialogs/ListLevelChooser.h
index 7a765d7bc5..7ffb1bf1ae 100644
--- a/plugins/flake/textshape/dialogs/ListLevelChooser.h
+++ b/plugins/flake/textshape/dialogs/ListLevelChooser.h
@@ -1,39 +1,39 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LISTLEVELCHOOSER_H
#define LISTLEVELCHOOSER_H
#include <QWidget>
#include <QPushButton>
class ListLevelChooser : public QPushButton
{
Q_OBJECT
public:
explicit ListLevelChooser(const int offset, QWidget *parent = 0);
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
private:
int m_offset;
};
#endif // LISTLEVELCHOOSER_H
diff --git a/plugins/flake/textshape/dialogs/ListsSpinBox.h b/plugins/flake/textshape/dialogs/ListsSpinBox.h
index 5ff520d689..b731d233c8 100644
--- a/plugins/flake/textshape/dialogs/ListsSpinBox.h
+++ b/plugins/flake/textshape/dialogs/ListsSpinBox.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef lISTSSPINBOX_H
#define lISTSSPINBOX_H
#include <KoListStyle.h>
#include <QSpinBox>
class ListsSpinBox : public QSpinBox
{
Q_OBJECT
public:
explicit ListsSpinBox(QWidget *parent = 0);
void setCounterType(KoListStyle::Style type);
- virtual QString textFromValue(int value) const;
+ QString textFromValue(int value) const override;
public Q_SLOTS:
void setLetterSynchronization(bool on)
{
m_letterSynchronization = on;
}
private:
- virtual int valueFromText(const QString &text) const;
+ int valueFromText(const QString &text) const override;
KoListStyle::Style m_type;
bool m_letterSynchronization;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/ParagraphDecorations.h b/plugins/flake/textshape/dialogs/ParagraphDecorations.h
index 7e8e88ceab..3bf1ea8231 100644
--- a/plugins/flake/textshape/dialogs/ParagraphDecorations.h
+++ b/plugins/flake/textshape/dialogs/ParagraphDecorations.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
Copyright (C) 2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PARAGRAPHDECORATIONS_H
#define PARAGRAPHDECORATIONS_H
#include <ui_ParagraphDecorations.h>
#include <KoParagraphStyle.h>
class ParagraphDecorations : public QWidget
{
Q_OBJECT
public:
explicit ParagraphDecorations(QWidget *parent = 0);
- ~ParagraphDecorations() {}
+ ~ParagraphDecorations() override {}
void setDisplay(KoParagraphStyle *style);
void save(KoParagraphStyle *style) const;
Q_SIGNALS:
void parStyleChanged();
private Q_SLOTS:
void clearBackgroundColor();
void slotBackgroundColorChanged();
private:
Ui::ParagraphDecorations widget;
bool m_backgroundColorChanged, m_backgroundColorReset;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/ParagraphSettingsDialog.h b/plugins/flake/textshape/dialogs/ParagraphSettingsDialog.h
index 89d8e39ae8..5b84b534f3 100644
--- a/plugins/flake/textshape/dialogs/ParagraphSettingsDialog.h
+++ b/plugins/flake/textshape/dialogs/ParagraphSettingsDialog.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PARAGRAPHSETTINGSDIALOG_H
#define PARAGRAPHSETTINGSDIALOG_H
#include <KoTextEditor.h>
#include <KoDialog.h>
class TextTool;
class ParagraphGeneral;
class KoImageCollection;
class KoUnit;
/// A dialog to show the settings for a paragraph
class ParagraphSettingsDialog : public KoDialog
{
Q_OBJECT
public:
explicit ParagraphSettingsDialog(TextTool *tool, KoTextEditor *editor, QWidget *parent = 0);
- ~ParagraphSettingsDialog();
+ ~ParagraphSettingsDialog() override;
void setUnit(const KoUnit &unit);
void setImageCollection(KoImageCollection *imageCollection);
protected Q_SLOTS:
void styleChanged(bool state = true);
void slotApply();
void slotOk();
private:
void initTabs();
ParagraphGeneral *m_paragraphGeneral;
TextTool *m_tool;
KoTextEditor *m_editor;
bool m_uniqueFormat;
bool m_styleChanged;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/SimpleCharacterWidget.h b/plugins/flake/textshape/dialogs/SimpleCharacterWidget.h
index c8d29a1306..3f19adb10c 100644
--- a/plugins/flake/textshape/dialogs/SimpleCharacterWidget.h
+++ b/plugins/flake/textshape/dialogs/SimpleCharacterWidget.h
@@ -1,84 +1,84 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2011-2012 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLECHARACTERWIDGET_H
#define SIMPLECHARACTERWIDGET_H
#include <ui_SimpleCharacterWidget.h>
#include <KoListStyle.h>
#include <QWidget>
#include <QTextBlock>
class TextTool;
class KoStyleManager;
class KoCharacterStyle;
class KoStyleThumbnailer;
class DockerStylesComboModel;
class StylesDelegate;
class StylesModel;
class SimpleCharacterWidget : public QWidget
{
Q_OBJECT
public:
explicit SimpleCharacterWidget(TextTool *tool, QWidget *parent = 0);
- virtual ~SimpleCharacterWidget();
+ ~SimpleCharacterWidget() override;
void setInitialUsedStyles(QVector<int> list);
public Q_SLOTS:
void setStyleManager(KoStyleManager *sm);
void setCurrentFormat(const QTextCharFormat &format, const QTextCharFormat &refBlockCharFormat);
void setCurrentBlockFormat(const QTextBlockFormat &format);
void slotCharacterStyleApplied(const KoCharacterStyle *style);
private Q_SLOTS:
void fontFamilyActivated(int index);
void fontSizeActivated(int index);
void styleSelected(int index);
void styleSelected(const QModelIndex &index);
void slotShowStyleManager(int index);
Q_SIGNALS:
void doneWithFocus();
void characterStyleSelected(KoCharacterStyle *);
void newStyleRequested(const QString &name);
void showStyleManager(int styleId);
private:
void clearUnsetProperties(QTextFormat &format);
Ui::SimpleCharacterWidget widget;
KoStyleManager *m_styleManager;
bool m_blockSignals;
bool m_comboboxHasBidiItems;
int m_lastFontFamilyIndex;
int m_lastFontSizeIndex;
TextTool *m_tool;
QTextCharFormat m_currentCharFormat;
QTextBlockFormat m_currentBlockFormat;
KoStyleThumbnailer *m_thumbnailer;
StylesModel *m_stylesModel;
DockerStylesComboModel *m_sortedStylesModel;
StylesDelegate *m_stylesDelegate;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.h b/plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.h
index 4903d3b7de..b82009aa7e 100644
--- a/plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.h
+++ b/plugins/flake/textshape/dialogs/SimpleCitationBibliographyWidget.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLECITATIONINDEXWIDGET_H
#define SIMPLECITATIONINDEXWIDGET_H
#include <ui_SimpleCitationBibliographyWidget.h>
#include <KoListStyle.h>
#include "FormattingButton.h"
#include <QWidget>
#include <QTextBlock>
class ReferencesTool;
class KoStyleManager;
class KoBibliographyInfo;
class BibliographyPreview;
class BibliographyTemplate;
class QSignalMapper;
class SimpleCitationBibliographyWidget : public QWidget
{
Q_OBJECT
public:
explicit SimpleCitationBibliographyWidget(ReferencesTool *tool, QWidget *parent = 0);
- ~SimpleCitationBibliographyWidget();
+ ~SimpleCitationBibliographyWidget() override;
public Q_SLOTS:
void setStyleManager(KoStyleManager *sm);
void prepareTemplateMenu();
void pixmapReady(int templateId);
private Q_SLOTS:
void applyTemplate(int templateId);
void insertCustomBibliography();
Q_SIGNALS:
void doneWithFocus();
private:
Ui::SimpleCitationBibliographyWidget widget;
KoStyleManager *m_styleManager;
bool m_blockSignals;
QTextBlock m_currentBlock;
ReferencesTool *m_referenceTool;
QList<KoBibliographyInfo *> m_templateList;
//each template in the template list will have have a previewGenerator that will be deleted after preview is generated
QList<BibliographyPreview *> m_previewGenerator;
QSignalMapper *m_signalMapper;
BibliographyTemplate *m_templateGenerator;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/SimpleLinksWidget.h b/plugins/flake/textshape/dialogs/SimpleLinksWidget.h
index 9f85eadeab..c13d13553a 100644
--- a/plugins/flake/textshape/dialogs/SimpleLinksWidget.h
+++ b/plugins/flake/textshape/dialogs/SimpleLinksWidget.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
* Copyright (C) 2001 David Faure <faure@kde.org>
* Copyright (C) 2005-2007, 2009, 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2010-2011 Boudewijn Rempt <boud@kogmbh.com>
* Copyright (C) 2013 Aman Madaan <madaan.amanmadaan@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLELINKSWIDGET_H
#define SIMPLELINKSWIDGET_H
#include <ui_SimpleLinksWidget.h>
#include "FormattingButton.h"
#include <QWidget>
#include <KoTextEditor.h>
class ReferencesTool;
class SimpleLinksWidget : public QWidget
{
Q_OBJECT
public:
explicit SimpleLinksWidget(ReferencesTool *tool, QWidget *parent = 0);
- virtual ~SimpleLinksWidget();
+ ~SimpleLinksWidget() override;
Q_SIGNALS:
void doneWithFocus();
public Q_SLOTS:
void preparePopUpMenu();
private Q_SLOTS:
void manageBookmarks();
private:
Ui::SimpleLinksWidget widget;
ReferencesTool *m_referenceTool;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/SimpleParagraphWidget.h b/plugins/flake/textshape/dialogs/SimpleParagraphWidget.h
index 3eb8a23406..e2bf68b1b3 100644
--- a/plugins/flake/textshape/dialogs/SimpleParagraphWidget.h
+++ b/plugins/flake/textshape/dialogs/SimpleParagraphWidget.h
@@ -1,95 +1,95 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
* Copyright (C) 2011-2012 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLEPARAGRAPHWIDGET_H
#define SIMPLEPARAGRAPHWIDGET_H
#include <ui_SimpleParagraphWidget.h>
#include <QWidget>
#include <QTextBlock>
class TextTool;
class KoStyleManager;
class KoParagraphStyle;
class KoStyleThumbnailer;
class StylesModel;
class DockerStylesComboModel;
class StylesDelegate;
class QSignalMapper;
class SimpleParagraphWidget : public QWidget
{
Q_OBJECT
public:
explicit SimpleParagraphWidget(TextTool *tool, QWidget *parent = 0);
- virtual ~SimpleParagraphWidget();
+ ~SimpleParagraphWidget() override;
void setInitialUsedStyles(QVector<int> list);
public Q_SLOTS:
void setCurrentBlock(const QTextBlock &block);
void setCurrentFormat(const QTextBlockFormat &format);
void setStyleManager(KoStyleManager *sm);
void slotShowStyleManager(int index);
void slotParagraphStyleApplied(const KoParagraphStyle *style);
Q_SIGNALS:
void doneWithFocus();
void paragraphStyleSelected(KoParagraphStyle *);
void newStyleRequested(const QString &name);
void showStyleManager(int styleId);
private Q_SLOTS:
void listStyleChanged(int id);
void styleSelected(int index);
void styleSelected(const QModelIndex &index);
void changeListLevel(int level);
private:
enum DirectionButtonState {
LTR,
RTL,
Auto
};
void updateDirection(DirectionButtonState state);
void fillListButtons();
Ui::SimpleParagraphWidget widget;
KoStyleManager *m_styleManager;
bool m_blockSignals;
QTextBlock m_currentBlock;
QTextBlockFormat m_currentBlockFormat;
TextTool *m_tool;
DirectionButtonState m_directionButtonState;
KoStyleThumbnailer *m_thumbnailer;
QSignalMapper *m_mapper;
StylesModel *m_stylesModel;
DockerStylesComboModel *m_sortedStylesModel;
StylesDelegate *m_stylesDelegate;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.h b/plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.h
index 1c6578b34e..cbac44a8b2 100644
--- a/plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.h
+++ b/plugins/flake/textshape/dialogs/SimpleSpellCheckingWidget.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Luke De Mouy <lukewolf101010devel@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLESPELLCHECKINGWIDGET_H
#define SIMPLESPELLCHECKINGWIDGET_H
#include <QWidget>
#include "ui_SimpleSpellCheckingWidget.h"
namespace Ui
{
class SimpleSpellCheckingWidget;
}
class ReviewTool;
class SimpleSpellCheckingWidget : public QWidget
{
Q_OBJECT
public:
explicit SimpleSpellCheckingWidget(ReviewTool *tool, QWidget *parent = 0);
- ~SimpleSpellCheckingWidget();
+ ~SimpleSpellCheckingWidget() override;
private:
Ui::SimpleSpellCheckingWidget *ui;
};
#endif // SIMPLESPELLCHECKINGWIDGET_H
diff --git a/plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.h b/plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.h
index 47d1f9adf3..6495267129 100644
--- a/plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.h
+++ b/plugins/flake/textshape/dialogs/SimpleTableOfContentsWidget.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SIMPLETABLEOFCONTENTSWIDGET_H
#define SIMPLETABLEOFCONTENTSWIDGET_H
#include <ui_SimpleTableOfContentsWidget.h>
#include <QWidget>
#include <QTextBlock>
#include <QList>
class ReferencesTool;
class KoStyleManager;
class KoTableOfContentsGeneratorInfo;
class TableOfContentsPreview;
class QSignalMapper;
class TableOfContentsTemplate;
class SimpleTableOfContentsWidget : public QWidget
{
Q_OBJECT
public:
explicit SimpleTableOfContentsWidget(ReferencesTool *tool, QWidget *parent = 0);
- ~SimpleTableOfContentsWidget();
+ ~SimpleTableOfContentsWidget() override;
public Q_SLOTS:
void setStyleManager(KoStyleManager *sm);
void prepareTemplateMenu();
void pixmapReady(int templateId);
Q_SIGNALS:
void doneWithFocus();
private Q_SLOTS:
void applyTemplate(int templateId);
void insertCustomToC();
private:
Ui::SimpleTableOfContentsWidget widget;
KoStyleManager *m_styleManager;
bool m_blockSignals;
QTextBlock m_currentBlock;
QList<KoTableOfContentsGeneratorInfo *> m_templateList;
//each template in the template list will have have a previewGenerator that will be deleted after preview is generated
QList<TableOfContentsPreview *> m_previewGenerator;
ReferencesTool *m_referenceTool;
QSignalMapper *m_signalMapper;
TableOfContentsTemplate *m_templateGenerator;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/StyleManager.h b/plugins/flake/textshape/dialogs/StyleManager.h
index 8885a44c24..1b36f2cb4d 100644
--- a/plugins/flake/textshape/dialogs/StyleManager.h
+++ b/plugins/flake/textshape/dialogs/StyleManager.h
@@ -1,88 +1,88 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2013 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLEMANAGER_H
#define STYLEMANAGER_H
#include <ui_StyleManager.h>
#include <QWidget>
class StylesManagerModel;
class StylesSortFilterProxyModel;
class KoStyleManager;
class KoStyleThumbnailer;
class KoParagraphStyle;
class KoCharacterStyle;
class QModelIndex;
class StyleManager : public QWidget
{
Q_OBJECT
public:
explicit StyleManager(QWidget *parent = 0);
- ~StyleManager();
+ ~StyleManager() override;
void setStyleManager(KoStyleManager *sm);
void setUnit(const KoUnit &unit);
//Check that the new name of style is unique or not
bool checkUniqueStyleName();
public Q_SLOTS:
void save();
void setParagraphStyle(KoParagraphStyle *style);
void setCharacterStyle(KoCharacterStyle *style, bool canDelete = false);
bool unappliedStyleChanges();
private Q_SLOTS:
void slotParagraphStyleSelected(const QModelIndex &index);
void slotCharacterStyleSelected(const QModelIndex &index);
void addParagraphStyle(KoParagraphStyle *);
void addCharacterStyle(KoCharacterStyle *);
void removeParagraphStyle(KoParagraphStyle *);
void removeCharacterStyle(KoCharacterStyle *);
void currentParagraphStyleChanged();
void currentParagraphNameChanged(const QString &name);
void currentCharacterStyleChanged();
void currentCharacterNameChanged(const QString &name);
void buttonNewPressed();
void tabChanged(int index);
private:
bool checkUniqueStyleName(int widgetIndex);
Ui::StyleManager widget;
KoStyleManager *m_styleManager;
QMap<KoParagraphStyle *, KoParagraphStyle *> m_modifiedParagraphStyles;
QMap<KoCharacterStyle *, KoCharacterStyle *> m_modifiedCharacterStyles;
StylesManagerModel *m_paragraphStylesModel;
StylesManagerModel *m_characterStylesModel;
StylesSortFilterProxyModel *m_paragraphProxyModel;
StylesSortFilterProxyModel *m_characterProxyModel;
KoStyleThumbnailer *m_thumbnailer;
bool m_unappliedStyleChanges;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/StyleManagerDialog.h b/plugins/flake/textshape/dialogs/StyleManagerDialog.h
index b6d195dbb0..0ecaf8e545 100644
--- a/plugins/flake/textshape/dialogs/StyleManagerDialog.h
+++ b/plugins/flake/textshape/dialogs/StyleManagerDialog.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLEMANAGERDIALOG_H
#define STYLEMANAGERDIALOG_H
#include <KoDialog.h>
#include <QCloseEvent>
class StyleManager;
class KoCharacterStyle;
class KoParagraphStyle;
class KoStyleManager;
class KoUnit;
class StyleManagerDialog : public KoDialog
{
Q_OBJECT
public:
explicit StyleManagerDialog(QWidget *parent);
- ~StyleManagerDialog();
+ ~StyleManagerDialog() override;
void setStyleManager(KoStyleManager *sm);
void setUnit(const KoUnit &unit);
public Q_SLOTS:
void setParagraphStyle(KoParagraphStyle *style);
void setCharacterStyle(KoCharacterStyle *style, bool canDelete = false);
private Q_SLOTS:
void applyClicked();
protected:
- void closeEvent(QCloseEvent *e);
+ void closeEvent(QCloseEvent *e) override;
private:
- void accept();
- void reject();
+ void accept() override;
+ void reject() override;
StyleManager *m_styleManagerWidget;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/StylesCombo.h b/plugins/flake/textshape/dialogs/StylesCombo.h
index 490990e3cb..beb85dc29a 100644
--- a/plugins/flake/textshape/dialogs/StylesCombo.h
+++ b/plugins/flake/textshape/dialogs/StylesCombo.h
@@ -1,107 +1,107 @@
/* This file is part of the KDE project
* Copyright (C) 2011-2012 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLESCOMBO_H
#define STYLESCOMBO_H
#include <QComboBox>
class QListView;
class AbstractStylesModel;
class StylesComboPreview;
/** This combo is specifically designed to allow choosing a text style, be it a character style or a paragraph style.
* The combo itself does not know what type of style it is dealing with. In that respect it follows pretty much the normal QComboBox paradigm.
* This is achieved by setting a @class StylesModel to the combo.
* The combo also creates and uses a @class StylesDelegate in order to paint the items as preview in the dropdown menu. This delegate also provide a button to call the style manager dialog directly.
* Additionally the combo display the style as a preview in its main area.
* The combo allows its user to specify if the current selected style should be considered as original or not. If the style has been modified, a + button appears in the main area. Pressing it will allow to change the name of the style. Focusing out, or pressing enter will send a signal for creating a new style. Escaping will prevent this signal to be sent and return to the preview.
*/
class StylesCombo : public QComboBox
{
Q_OBJECT
public:
explicit StylesCombo(QWidget *parent);
- ~StylesCombo();
+ ~StylesCombo() override;
/** Use this method to set the @param model of the combo. */
void setStylesModel(AbstractStylesModel *model);
/** This method is an override of QComboBox setLineEdit. We need to make it public since its Qt counterpart is public. However, this method is not supposed to be used (unless you know what you are doing). The StylesCombo relies on its own internal QLineEdit subclass for quite a lot of its functionnality. There is no guarantee that the whole thing will work in case the line edit is replaced */
void setLineEdit(QLineEdit *lineEdit);
/** Same as above */
void setEditable(bool editable);
/** This method is used to specify if the currently selected style is in its original state or is considered modified. In the later case, the + button will appear (see the class description) */
void setStyleIsOriginal(bool original);
- bool eventFilter(QObject *, QEvent *);
+ bool eventFilter(QObject *, QEvent *) override;
/** When we don't want edit icon for our items in combo */
void showEditIcon(bool show);
public Q_SLOTS:
/** This slot needs to be called if the preview in the main area needs to be updated for some reason */
void slotUpdatePreview();
Q_SIGNALS:
/** This is emitted when a selection is made (programatically or by user interaction). It is
* to be noted that this signal is also emitted when an item is selected again.
* @param index: the index of the selected item. */
void selected(int index);
void selected(const QModelIndex &index);
/** This is emitted when a selection is changed (programatically or by user interaction). It is
* to be noted that this signal is _not_ emitted when an item is selected again. Not even if it
* had been modified.
* @param index: the index of the selected item. */
void selectionChanged(int index);
/** This signal is emitted on validation of the name of a modified style (after pressing the + button). This validation happens on focus out or pressed enter key.
* @param name: the name by which the new style should be called */
void newStyleRequested(const QString &name);
/** This signal is emitted when the "show style manager" button is pressed in the dropdown list.
* @param index: the index of the item on which the button was pressed */
void showStyleManager(int index);
/** This signal is emitted when the "delete style" button is pressed in the dropdown list.
* @param index: the index of the item on which the button was pressed
* This is currently disabled */
void deleteStyle(int index);
private Q_SLOTS:
void slotDeleteStyle(const QModelIndex &);
void slotShowDia(const QModelIndex &);
void slotSelectionChanged(int index);
void slotItemClicked(const QModelIndex &);
void slotPreviewClicked();
void slotModelReset();
private:
AbstractStylesModel *m_stylesModel;
StylesComboPreview *m_preview;
QListView *m_view;
int m_selectedItem;
bool m_originalStyle;
QModelIndex m_currentIndex;
};
#endif //STYLESCOMBO_H
diff --git a/plugins/flake/textshape/dialogs/StylesComboPreview.h b/plugins/flake/textshape/dialogs/StylesComboPreview.h
index 13428cc8b0..f44a84a0fa 100644
--- a/plugins/flake/textshape/dialogs/StylesComboPreview.h
+++ b/plugins/flake/textshape/dialogs/StylesComboPreview.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLESCOMBOPREVIEW_H
#define STYLESCOMBOPREVIEW_H
#include <QLineEdit>
class QImage;
class QPushButton;
class QSize;
class QString;
/** This is an internal class, used for the preview of styles in the main area of the @class StylesCombo. */
class StylesComboPreview : public QLineEdit
{
Q_OBJECT
Q_PROPERTY(bool showAddButton READ isAddButtonShown WRITE setAddButtonShown)
public:
explicit StylesComboPreview(QWidget *parent = 0);
- ~StylesComboPreview();
+ ~StylesComboPreview() override;
QSize availableSize() const;
void setAddButtonShown(bool show);
bool isAddButtonShown() const;
void setPreview(const QImage &image);
Q_SIGNALS:
void resized();
void newStyleRequested(const QString &name);
void clicked();
protected:
- virtual void resizeEvent(QResizeEvent *event);
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void focusOutEvent(QFocusEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *event);
- virtual void paintEvent(QPaintEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void focusOutEvent(QFocusEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
private Q_SLOTS:
void addNewStyle();
private:
void init();
void updateAddButton();
bool m_renamingNewStyle;
bool m_shouldAddNewStyle;
QImage m_stylePreview;
QPushButton *m_addButton;
};
#endif // STYLESCOMBOPREVIEW_H
diff --git a/plugins/flake/textshape/dialogs/StylesDelegate.h b/plugins/flake/textshape/dialogs/StylesDelegate.h
index 875e281aff..82b07a72f8 100644
--- a/plugins/flake/textshape/dialogs/StylesDelegate.h
+++ b/plugins/flake/textshape/dialogs/StylesDelegate.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2011-2012 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLESDELEGATE_H
#define STYLESDELEGATE_H
#include <QStyledItemDelegate>
/** This is an internal class, used for the preview of styles in the dropdown of the @class StylesCombo.
* This class is also responsible for drawing and handling the buttons to call the style manager or to delete a style.
* NB. Deleting a style is currently not supported, therefore the button has been disabled. */
class StylesDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
StylesDelegate();
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
- virtual bool editorEvent(QEvent *event, QAbstractItemModel *model,
- const QStyleOptionViewItem &option, const QModelIndex &index);
+ bool editorEvent(QEvent *event, QAbstractItemModel *model,
+ const QStyleOptionViewItem &option, const QModelIndex &index) override;
void setEditButtonEnable(bool enable);
Q_SIGNALS:
void styleManagerButtonClicked(const QModelIndex &index);
void deleteStyleButtonClicked(const QModelIndex &index);
void needsUpdate(const QModelIndex &index);
void clickedInItem(const QModelIndex &index);
private:
bool m_editButtonPressed;
bool m_deleteButtonPressed;
bool m_enableEditButton;
int m_buttonSize;
int m_buttonDistance;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/StylesFilteredModelBase.h b/plugins/flake/textshape/dialogs/StylesFilteredModelBase.h
index 912813edd0..8ae4b56a81 100644
--- a/plugins/flake/textshape/dialogs/StylesFilteredModelBase.h
+++ b/plugins/flake/textshape/dialogs/StylesFilteredModelBase.h
@@ -1,102 +1,102 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLESFILTEREDMODELBASE_H
#define STYLESFILTEREDMODELBASE_H
#include "AbstractStylesModel.h"
#include <QVector>
/** This class serves as a base for filtering an @class AbstractStylesmodel. The base class implements a one to one mapping of the model.
* Reimplementing the method createMapping is sufficient for basic sorting/filtering.
*
* QSortFilterProxyModel implementation was a great source of inspiration.
*
* It is to be noted that this is in no way a full proxyModel. It is built with several assumptions:
* - it is used to filter a StylesModel which in turn is a flat list of items. There is only one level of items. (this also means that "parent" QModelIndexes are always invalid)
* - there is no header in the model.
* - the model has only one column
* - only the following methods are used when updating the underlying model's data: resetModel, insertRows, moveRows, removeRows (cf QAbstractItemModel)
*/
class StylesFilteredModelBase : public AbstractStylesModel
{
Q_OBJECT
public:
explicit StylesFilteredModelBase(QObject *parent = 0);
/** Re-implement from QAbstractItemModel. */
- virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
- virtual QModelIndex parent(const QModelIndex &child) const;
+ QModelIndex parent(const QModelIndex &child) const override;
- virtual int columnCount(const QModelIndex &parent) const;
+ int columnCount(const QModelIndex &parent) const override;
- virtual int rowCount(const QModelIndex &parent) const;
+ int rowCount(const QModelIndex &parent) const override;
- virtual QVariant data(const QModelIndex &index, int role) const;
+ QVariant data(const QModelIndex &index, int role) const override;
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
/** Specific methods of the AbstractStylesModel */
/** Sets the @class KoStyleThumbnailer of the model. It is required that a @param thumbnailer is set before using the model. */
- virtual void setStyleThumbnailer(KoStyleThumbnailer *thumbnailer);
+ void setStyleThumbnailer(KoStyleThumbnailer *thumbnailer) override;
/** Return a @class QModelIndex for the specified @param style.
* @param style may be either a character or paragraph style.
*/
- virtual QModelIndex indexOf(const KoCharacterStyle *style) const;
+ QModelIndex indexOf(const KoCharacterStyle *style) const override;
/** Returns a QImage which is a preview of the style specified by @param row of the given @param size.
* If size isn't specified, the default size of the given @class KoStyleThumbnailer is used.
*/
- virtual QImage stylePreview(int row, const QSize &size = QSize());
+ QImage stylePreview(int row, const QSize &size = QSize()) override;
// virtual QImage stylePreview(QModelIndex &index, const QSize &size = QSize());
- virtual AbstractStylesModel::Type stylesType() const;
+ AbstractStylesModel::Type stylesType() const override;
/** Specific methods of the StylesFiltermodelBase */
/** Sets the sourceModel. Setting the model will trigger the mapping.
*/
void setStylesModel(AbstractStylesModel *sourceModel);
protected Q_SLOTS:
void modelAboutToBeReset();
void modelReset();
void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow);
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
void rowsInserted(const QModelIndex &parent, int start, int end);
void rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow);
void rowsRemoved(const QModelIndex &parent, int start, int end);
protected:
virtual void createMapping();
AbstractStylesModel *m_sourceModel;
QVector<int> m_sourceToProxy;
QVector<int> m_proxyToSource;
};
#endif // STYLESFILTEREDMODELBASE_H
diff --git a/plugins/flake/textshape/dialogs/StylesManagerModel.h b/plugins/flake/textshape/dialogs/StylesManagerModel.h
index f002e12c06..6d585bb3ae 100644
--- a/plugins/flake/textshape/dialogs/StylesManagerModel.h
+++ b/plugins/flake/textshape/dialogs/StylesManagerModel.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLESMODELNEW_H
#define STYLESMODELNEW_H
#include <QAbstractListModel>
#include <QList>
class KoCharacterStyle;
class KoStyleThumbnailer;
class StylesManagerModel : public QAbstractListModel
{
public:
enum Roles {
StylePointer = Qt::UserRole + 1,
};
explicit StylesManagerModel(QObject *parent = 0);
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
void setStyleThumbnailer(KoStyleThumbnailer *thumbnailer);
void setStyles(const QList<KoCharacterStyle *> &styles);
void addStyle(KoCharacterStyle *style);
void removeStyle(KoCharacterStyle *style);
void replaceStyle(KoCharacterStyle *oldStyle, KoCharacterStyle *newStyle);
void updateStyle(KoCharacterStyle *style);
QModelIndex styleIndex(KoCharacterStyle *style);
private:
QList<KoCharacterStyle *> m_styles;
KoStyleThumbnailer *m_styleThumbnailer;
};
#endif /* STYLESMODELNEW_H */
diff --git a/plugins/flake/textshape/dialogs/StylesModel.h b/plugins/flake/textshape/dialogs/StylesModel.h
index 256c0dcedb..3bfe83fdba 100644
--- a/plugins/flake/textshape/dialogs/StylesModel.h
+++ b/plugins/flake/textshape/dialogs/StylesModel.h
@@ -1,171 +1,171 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2011-2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MODEL_H
#define MODEL_H
#include "AbstractStylesModel.h"
#include <QAbstractListModel>
#include <QSize>
class KoStyleThumbnailer;
class KoStyleManager;
class KoParagraphStyle;
class KoCharacterStyle;
class QImage;
class QSignalMapper;
/** This class is used to provide widgets (like the @class StylesCombo) the styles available to the document being worked on. The @class StylesModel can be of two types: character styles or paragraph styles type. This allows the widget to ignore the type of style it is handling.
* Character styles in ODF can be specified in two ways. First, a named character style, specifying character formatting properties. It is meant to be used on a couple of individual characters. Secondely, a paragraph style also specifies character formatting properties, which are to be considered the default for that particular paragraph.
* For this reason, the @class Stylesmodel, when of the type @value characterStyle, do not list the paragraph style names. Only the specific named chracter styles are listed. Additionally, as the first item, a virtual style "As paragraph" is provided. Selecting this "style" will set the character properties as specified by the paragraph style currently applied to the selection.
* This class requires that a @class KoStyleManager and a @class KoStyleThumbnailer be set. See below methods.
*
* The StylesModel re-implement the AbstractStylesModel interface. Several components assume the following properties:
* - the StylesModel is a flat list of items (this also means that "parent" QModelIndexes are always invalid)
* - the StylesModel has only one column
* - there is no header in the model
* - only the following methods are used when updating the underlying model's data: resetModel, insertRows, moveRows, removeRows
*/
class StylesModel : public AbstractStylesModel
{
Q_OBJECT
public:
enum CategoriesInternalIds {
NoneStyleId = -1
};
explicit StylesModel(KoStyleManager *styleManager, AbstractStylesModel::Type modelType, QObject *parent = 0);
- ~StylesModel();
+ ~StylesModel() override;
/** Re-implemented from QAbstractItemModel. */
- virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
- virtual int rowCount(const QModelIndex &parent) const;
+ int rowCount(const QModelIndex &parent) const override;
- virtual QVariant data(const QModelIndex &index, int role) const;
+ QVariant data(const QModelIndex &index, int role) const override;
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- virtual QModelIndex parent(const QModelIndex &child) const;
+ QModelIndex parent(const QModelIndex &child) const override;
- virtual int columnCount(const QModelIndex &parent) const;
+ int columnCount(const QModelIndex &parent) const override;
/** *********************************** */
/** Specific methods of the StylesModel */
/** ************************* */
/** Initialising of the model */
/** Specify if the combo should provide the virtual style None. This style is a virtual style which equates to no style. It is only relevant for character styles.
In case the "None" character style is selected, the character formatting properties of the paragraph style are used.
A @class StylesModel of the @enum Type ParagraphStyle always has this property set to false.
On the other hand, the default for a @class StylesModel of the @enum Type CharacterStyle is true.
It is important to set this before setting the stylemanager on the model. The flag is used when populating the styles from the KoStyleManager.
*/
void setProvideStyleNone(bool provide);
/** Sets the @class KoStyleManager of the model. Setting this will populate the styles. It is required that a @param manager is set before using the model.
* CAUTION: Populating the style will select the first inserted item. If this model is already set on a view, this might cause the view to emit an item selection changed signal.
*/
void setStyleManager(KoStyleManager *manager);
/** Sets the @class KoStyleThumbnailer of the model. It is required that a @param thumbnailer is set before using the model. */
- void setStyleThumbnailer(KoStyleThumbnailer *thumbnailer);
+ void setStyleThumbnailer(KoStyleThumbnailer *thumbnailer) override;
/** *************** */
/** Using the model */
/** Return a @class QModelIndex for the specified @param style.
* @param style may be either a character or paragraph style.
*/
- QModelIndex indexOf(const KoCharacterStyle *style) const;
+ QModelIndex indexOf(const KoCharacterStyle *style) const override;
/** Returns a QImage which is a preview of the style specified by @param row of the given @param size.
* If size isn't specified, the default size of the given @class KoStyleThumbnailer is used.
*/
- QImage stylePreview(int row, const QSize &size = QSize());
+ QImage stylePreview(int row, const QSize &size = QSize()) override;
// QImage stylePreview(QModelIndex &index, const QSize &size = QSize());
/** Specifies which paragraph style is currently the active one (on the current paragraph). This is used in order to properly preview the "As paragraph" virtual character style. */
void setCurrentParagraphStyle(int styleId);
/** Return the first index at list. */
QModelIndex firstStyleIndex();
/** Return style id list. */
QList<int> StyleList();
/** Return new styles and their ids. */
QHash<int, KoParagraphStyle *> draftParStyleList();
QHash<int, KoCharacterStyle *> draftCharStyleList();
/** Add a paragraph style to pargraph style list but this style is not applied. */
void addDraftParagraphStyle(KoParagraphStyle *style);
/** Add a character style to character style list but this style is not applied. */
void addDraftCharacterStyle(KoCharacterStyle *style);
/** we call this when we apply our unapplied styles and we clear our list. */
void clearDraftStyles();
/** We call this when we want a clear style model. */
void clearStyleModel();
/** Returns the type of styles in the model */
- AbstractStylesModel::Type stylesType() const;
+ AbstractStylesModel::Type stylesType() const override;
private Q_SLOTS:
void removeParagraphStyle(KoParagraphStyle *);
void removeCharacterStyle(KoCharacterStyle *);
void updateName(int styleId);
public Q_SLOTS:
void addParagraphStyle(KoParagraphStyle *);
void addCharacterStyle(KoCharacterStyle *);
private:
void updateParagraphStyles();
void updateCharacterStyles();
protected:
QList<int> m_styleList; // list of style IDs
QHash<int, KoParagraphStyle *> m_draftParStyleList; // list of new styles that are not applied
QHash<int, KoCharacterStyle *> m_draftCharStyleList;
private:
KoStyleManager *m_styleManager;
KoParagraphStyle *m_currentParagraphStyle;
KoCharacterStyle *m_defaultCharacterStyle;
QSignalMapper *m_styleMapper;
bool m_provideStyleNone;
};
#endif
diff --git a/plugins/flake/textshape/dialogs/StylesSortFilterProxyModel.h b/plugins/flake/textshape/dialogs/StylesSortFilterProxyModel.h
index f76c200875..36114ef679 100644
--- a/plugins/flake/textshape/dialogs/StylesSortFilterProxyModel.h
+++ b/plugins/flake/textshape/dialogs/StylesSortFilterProxyModel.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef STYLESSORTFILTERPROXYMODEL_H
#define STYLESSORTFILTERPROXYMODEL_H
#include <QSortFilterProxyModel>
class StylesSortFilterProxyModel : public QSortFilterProxyModel
{
public:
explicit StylesSortFilterProxyModel(QObject *parent = 0);
protected:
- virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
};
#endif /* STYLESSORTFILTERPROXYMODEL_H */
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsConfigure.h b/plugins/flake/textshape/dialogs/TableOfContentsConfigure.h
index af8e45632b..bc035583ca 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsConfigure.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsConfigure.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TABLEOFCONTENTSCONFIGURE_H
#define TABLEOFCONTENTSCONFIGURE_H
#include "ui_TableOfContentsConfigure.h"
#include <KoZoomHandler.h>
#include <QDialog>
#include <QTextBlock>
namespace Ui
{
class TableOfContentsConfigure;
}
class QTextBlock;
class TableOfContentsStyleConfigure;
class TableOfContentsEntryModel;
class TableOfContentsEntryDelegate;
class KoTableOfContentsGeneratorInfo;
class KoTextEditor;
class TableOfContentsConfigure : public QDialog
{
Q_OBJECT
public:
explicit TableOfContentsConfigure(KoTextEditor *editor, QTextBlock block, QWidget *parent = 0);
TableOfContentsConfigure(KoTextEditor *editor, KoTableOfContentsGeneratorInfo *info, QWidget *parent = 0);
- ~TableOfContentsConfigure();
+ ~TableOfContentsConfigure() override;
KoTableOfContentsGeneratorInfo *currentToCData();
public Q_SLOTS:
void setDisplay();
void save();
void cleanUp();
void updatePreview();
private Q_SLOTS:
void showStyleConfiguration();
void titleTextChanged(const QString &text);
void useOutline(int state);
void useIndexSourceStyles(int state);
private:
Ui::TableOfContentsConfigure ui;
KoTextEditor *m_textEditor;
TableOfContentsStyleConfigure *m_tocStyleConfigure;
KoTableOfContentsGeneratorInfo *m_tocInfo;
QTextBlock m_block;
QTextDocument *m_document;
TableOfContentsEntryModel *m_tocEntryStyleModel;
TableOfContentsEntryDelegate *m_tocEntryConfigureDelegate;
void init();
};
Q_DECLARE_METATYPE(QTextBlock)
#endif // TABLEOFCONTENTSCONFIGURE_H
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsEntryDelegate.h b/plugins/flake/textshape/dialogs/TableOfContentsEntryDelegate.h
index 433937c80f..55fe4981b5 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsEntryDelegate.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsEntryDelegate.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TABLEOFCONTENTSENTRYDELEGATE_H
#define TABLEOFCONTENTSENTRYDELEGATE_H
#include <QStyledItemDelegate>
class KoStyleManager;
class TableOfContentsEntryDelegate: public QStyledItemDelegate
{
public:
explicit TableOfContentsEntryDelegate(KoStyleManager *manager);
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const override;
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const;
+ const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ const QStyleOptionViewItem &option, const QModelIndex &index) const override;
private:
KoStyleManager *m_styleManager;
};
#endif // TABLEOFCONTENTSENTRYDELEGATE_H
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsEntryModel.h b/plugins/flake/textshape/dialogs/TableOfContentsEntryModel.h
index e81c6b1a96..18dcb3b76c 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsEntryModel.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsEntryModel.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TABLEOFCONTENTSENTYMODEL_H
#define TABLEOFCONTENTSENTYMODEL_H
#include <QAbstractTableModel>
#include <QStringList>
#include <QPair>
class KoStyleManager;
class KoTableOfContentsGeneratorInfo;
class TableOfContentsEntryModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum ModelColumns { Levels = 0, Styles = 1 };
TableOfContentsEntryModel(KoStyleManager *manager, KoTableOfContentsGeneratorInfo *info);
- virtual int rowCount(const QModelIndex &parent) const;
- virtual int columnCount(const QModelIndex &parent) const;
- virtual QVariant data(const QModelIndex &index, int role) const;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
- virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
void saveData();
Q_SIGNALS:
void tocEntryDataChanged();
private:
QList <QPair <QString, int> > m_tocEntries; //first contains the text that will appear in table view, and second one is the styleId
KoStyleManager *m_styleManager;
KoTableOfContentsGeneratorInfo *m_tocInfo;
};
#endif // TABLEOFCONTENTSENTYMODEL_H
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsPreview.h b/plugins/flake/textshape/dialogs/TableOfContentsPreview.h
index 6da43f9f49..2675bf8586 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsPreview.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsPreview.h
@@ -1,68 +1,68 @@
#ifndef TABLEOFCONTENTSPREVIEW_H
#define TABLEOFCONTENTSPREVIEW_H
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <KoZoomHandler.h>
#include <KoInlineTextObjectManager.h>
#include <KoTextRangeManager.h>
#include <QFrame>
#include <QPixmap>
class TextShape;
class KoTableOfContentsGeneratorInfo;
class KoStyleManager;
class TableOfContentsPreview : public QFrame
{
Q_OBJECT
public:
explicit TableOfContentsPreview(QWidget *parent = 0);
- ~TableOfContentsPreview();
+ ~TableOfContentsPreview() override;
void setStyleManager(KoStyleManager *styleManager);
/// sets the size of the generated preview pixmap if not set then it takes the widget's size
void setPreviewSize(const QSize &size);
QPixmap previewPixmap();
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
Q_SIGNALS:
void pixmapGenerated();
public Q_SLOTS:
void updatePreview(KoTableOfContentsGeneratorInfo *info);
private Q_SLOTS:
void finishedPreviewLayout();
private:
TextShape *m_textShape;
QPixmap *m_pm;
KoZoomHandler m_zoomHandler;
KoStyleManager *m_styleManager;
KoInlineTextObjectManager m_itom;
KoTextRangeManager m_tlm;
QSize m_previewPixSize;
void deleteTextShape();
};
#endif // TABLEOFCONTENTSPREVIEW_H
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsStyleConfigure.h b/plugins/flake/textshape/dialogs/TableOfContentsStyleConfigure.h
index 5b26161272..b9530c54c2 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsStyleConfigure.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsStyleConfigure.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TABLEOFCONTENTSSTYLECONFIGURE_H
#define TABLEOFCONTENTSSTYLECONFIGURE_H
#include "TableOfContentsStyleModel.h"
#include "TableOfContentsStyleDelegate.h"
#include <QDialog>
namespace Ui
{
class TableOfContentsStyleConfigure;
}
class QStandardItemModel;
class KoStyleManager;
class TableOfContentsStyleModel;
class KoTableOfContentsGeneratorInfo;
class TableOfContentsStyleConfigure : public QDialog
{
Q_OBJECT
public:
explicit TableOfContentsStyleConfigure(KoStyleManager *manager, QWidget *parent = 0);
- ~TableOfContentsStyleConfigure();
+ ~TableOfContentsStyleConfigure() override;
void initializeUi(KoTableOfContentsGeneratorInfo *info);
public Q_SLOTS:
void save();
void discardChanges();
private:
Ui::TableOfContentsStyleConfigure *ui;
QStandardItemModel *m_stylesTree;
KoStyleManager *m_styleManager;
KoTableOfContentsGeneratorInfo *m_tocInfo;
TableOfContentsStyleModel *m_stylesModel;
TableOfContentsStyleDelegate m_delegate;
};
#endif // TABLEOFCONTENTSSTYLECONFIGURE_H
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsStyleDelegate.h b/plugins/flake/textshape/dialogs/TableOfContentsStyleDelegate.h
index c5a9dc2db7..fd70bc2507 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsStyleDelegate.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsStyleDelegate.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TABLEOFCONTENTSSTYLEDELEGATE_H
#define TABLEOFCONTENTSSTYLEDELEGATE_H
#include <QStyledItemDelegate>
class TableOfContentsStyleDelegate: public QStyledItemDelegate
{
public:
TableOfContentsStyleDelegate();
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const override;
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const;
+ const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor,
- const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};
#endif // TABLEOFCONTENTSSTYLEDELEGATE_H
diff --git a/plugins/flake/textshape/dialogs/TableOfContentsStyleModel.h b/plugins/flake/textshape/dialogs/TableOfContentsStyleModel.h
index d0d1a1599f..3e5c869376 100644
--- a/plugins/flake/textshape/dialogs/TableOfContentsStyleModel.h
+++ b/plugins/flake/textshape/dialogs/TableOfContentsStyleModel.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TABLEOFCONTENTSSTYLEMODEL_H
#define TABLEOFCONTENTSSTYLEMODEL_H
#include <QAbstractTableModel>
class KoStyleManager;
class KoStyleThumbnailer;
class KoTableOfContentsGeneratorInfo;
class TableOfContentsStyleModel : public QAbstractTableModel
{
public:
TableOfContentsStyleModel(const KoStyleManager *manager, KoTableOfContentsGeneratorInfo *info);
- virtual int rowCount(const QModelIndex &parent) const;
- virtual int columnCount(const QModelIndex &parent) const;
- virtual QVariant data(const QModelIndex &index, int role) const;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
- virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
- virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent) const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
void saveData();
protected:
QList<int> m_styleList; // list of style IDs
QList<int> m_outlineLevel;
private:
const KoStyleManager *m_styleManager;
KoStyleThumbnailer *m_styleThumbnailer;
KoTableOfContentsGeneratorInfo *m_tocInfo;
int getOutlineLevel(int styleId);
void setOutlineLevel(int styleId, int outLineLevel);
};
#endif // TABLEOFCONTENTSSTYLEMODEL_H
diff --git a/plugins/flake/textshape/dialogs/TrackedChangeManager.h b/plugins/flake/textshape/dialogs/TrackedChangeManager.h
index 3235ad43e8..c5ca791edd 100644
--- a/plugins/flake/textshape/dialogs/TrackedChangeManager.h
+++ b/plugins/flake/textshape/dialogs/TrackedChangeManager.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2009-2010 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TRACKEDCHANGEMANAGER_H
#define TRACKEDCHANGEMANAGER_H
#include <ui_TrackedChangeManager.h>
//#include <KoDialog.h>
#include <QWidget>
class TrackedChangeModel;
class QModelIndex;
class TrackedChangeManager : public QWidget
{
Q_OBJECT
public:
explicit TrackedChangeManager(QWidget *parent = 0);
- ~TrackedChangeManager();
+ ~TrackedChangeManager() override;
void setModel(TrackedChangeModel *model);
void selectItem(const QModelIndex &newIndex);
Q_SIGNALS:
void currentChanged(const QModelIndex &newIndex);
private Q_SLOTS:
void currentChanged(const QModelIndex &newIndex, const QModelIndex &previousIndex);
private:
Ui::trackedChange widget;
TrackedChangeModel *m_model;
};
#endif // TRACKEDCHANGEMANAGER_H
diff --git a/plugins/flake/textshape/dialogs/TrackedChangeModel.h b/plugins/flake/textshape/dialogs/TrackedChangeModel.h
index 853df3a637..c7047aa3c3 100644
--- a/plugins/flake/textshape/dialogs/TrackedChangeModel.h
+++ b/plugins/flake/textshape/dialogs/TrackedChangeModel.h
@@ -1,112 +1,112 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TRACKEDCHANGEMODEL_H
#define TRACKEDCHANGEMODEL_H
#include <KoGenChange.h>
#include <QAbstractItemModel>
#include <QHash>
#include <QList>
#include <QMetaType>
#include <QObject>
#include <QPair>
class KoChangeTracker;
class KoTextDocumentLayout;
class QTextDocument;
struct ItemData {
int changeId;
QList<QPair<int, int> > changeRanges;
KoGenChange::Type changeType;
QString title;
QString author;
};
Q_DECLARE_METATYPE(ItemData)
class ModelItem
{
public:
explicit ModelItem(ModelItem *parent = 0);
~ModelItem();
void setChangeId(int changeId);
void setChangeType(KoGenChange::Type type);
void setChangeTitle(const QString &title);
void setChangeAuthor(const QString &author);
void appendChild(ModelItem *child);
ModelItem *child(int row);
QList<ModelItem *> children();
int childCount() const;
int row() const;
ModelItem *parent();
ItemData itemData();
void setChangeRange(int start, int end);
void removeChildren();
private:
QList<ModelItem *> m_childItems;
ModelItem *m_parentItem;
ItemData m_data;
};
class TrackedChangeModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit TrackedChangeModel(QTextDocument *document, QObject *parent = 0);
- ~TrackedChangeModel();
+ ~TrackedChangeModel() override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex indexForChangeId(int changeId);
- QModelIndex parent(const QModelIndex &index) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
ItemData changeItemData(const QModelIndex &index, int role = Qt::DisplayRole) const;
public Q_SLOTS:
void setupModel();
private:
void setupModelData(QTextDocument *document, ModelItem *parent);
QTextDocument *m_document;
ModelItem *m_rootItem;
KoChangeTracker *m_changeTracker;
KoTextDocumentLayout *m_layout;
QHash<int, int> m_changeOccurenceCounter;
QHash<int, ModelItem *> m_changeItems;
};
#endif // TRACKEDCHANGEMODEL_H
diff --git a/plugins/flake/textshape/dialogs/ValidParentStylesProxyModel.h b/plugins/flake/textshape/dialogs/ValidParentStylesProxyModel.h
index 1f1645d497..277a88f168 100644
--- a/plugins/flake/textshape/dialogs/ValidParentStylesProxyModel.h
+++ b/plugins/flake/textshape/dialogs/ValidParentStylesProxyModel.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef VALIDPARENTSTYLESPROXYMODEL_H
#define VALIDPARENTSTYLESPROXYMODEL_H
//#include "AbstractStylesModel.h"
#include "StylesFilteredModelBase.h"
#include <QVector>
class KoStyleManager;
class QModelIndex;
/** This class is acting as a proxy between a "real" StylesModel and views. It is used to filter out styles which would not make a valid parent of the given childStyle (see void setCurrentChildStyleId(int styleId) ).
*
* In that matter, QSortFilterProxyModel implementation was a great source of inspiration.
*
* It is to be noted that this is in no way a full proxyModel. It is built with several assumptions:
* - it is used to filter a StylesModel which in turn is a flat list of items. There is only one level of items. (this also means that "parent" QModelIndexes are always invalid)
* - there is no header in the model.
* - the model has only one column
* - only the following methods are used when updating the underlying model's data: resetModel, insertRows, moveRows, removeRows (cf QAbstractItemModel)
*/
class ValidParentStylesProxyModel : public StylesFilteredModelBase
{
Q_OBJECT
public:
explicit ValidParentStylesProxyModel(QObject *parent = 0);
void setStyleManager(KoStyleManager *manager); //it is needed to travel the style's parenting chain in order to assess if the currentChildStyle is suitable for being a parent
void setCurrentChildStyleId(int styleId);
protected:
- virtual void createMapping();
+ void createMapping() override;
private:
KoStyleManager *m_styleManager;
int m_currentChildStyleId;
};
#endif // VALIDPARENTSTYLESPROXYMODEL_H
diff --git a/plugins/flake/textshape/kotext/BibliographyGenerator.h b/plugins/flake/textshape/kotext/BibliographyGenerator.h
index aa48647f8b..bcd78a1ef5 100644
--- a/plugins/flake/textshape/kotext/BibliographyGenerator.h
+++ b/plugins/flake/textshape/kotext/BibliographyGenerator.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Smit Patel <smitpatel24@gmail.com>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BIBLIOGRAPHYGENERATOR_H
#define BIBLIOGRAPHYGENERATOR_H
#include <KoBibliographyInfo.h>
#include "kritatext_export.h"
#include <QTextBlock>
class KRITATEXT_EXPORT BibliographyGenerator : public QObject, public BibliographyGeneratorInterface
{
Q_OBJECT
public:
explicit BibliographyGenerator(QTextDocument *bibDocument, const QTextBlock &block, KoBibliographyInfo *bibInfo);
- virtual ~BibliographyGenerator();
+ ~BibliographyGenerator() override;
static QMap<QString, BibliographyEntryTemplate> defaultBibliographyEntryTemplates();
public Q_SLOTS:
void generate();
private:
QTextDocument *m_document;
QTextDocument *m_bibDocument;
KoBibliographyInfo *m_bibInfo;
QTextBlock m_block;
qreal m_maxTabPosition;
};
#endif
diff --git a/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h b/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h
index 7b527b2050..fd4542b133 100644
--- a/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h
+++ b/plugins/flake/textshape/kotext/InsertInlineObjectActionBase_p.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INSERTINLINEOBJECTACTIONBASE_H
#define INSERTINLINEOBJECTACTIONBASE_H
#include <QAction>
#include <QPointer>
#include <KoCanvasBase.h>
class KoInlineObject;
/**
* helper class
*/
class InsertInlineObjectActionBase : public QAction
{
Q_OBJECT
public:
InsertInlineObjectActionBase(KoCanvasBase *canvas, const QString &name);
- virtual ~InsertInlineObjectActionBase();
+ ~InsertInlineObjectActionBase() override;
private Q_SLOTS:
void activated();
protected:
virtual KoInlineObject *createInlineObject() = 0;
QPointer<KoCanvasBase> m_canvas;
};
#endif
diff --git a/plugins/flake/textshape/kotext/InsertNamedVariableAction_p.h b/plugins/flake/textshape/kotext/InsertNamedVariableAction_p.h
index 76d00b83c4..aa562f70a6 100644
--- a/plugins/flake/textshape/kotext/InsertNamedVariableAction_p.h
+++ b/plugins/flake/textshape/kotext/InsertNamedVariableAction_p.h
@@ -1,42 +1,42 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INSERTNAMEDVARIABLEACTION_H
#define INSERTNAMEDVARIABLEACTION_H
#include "InsertInlineObjectActionBase_p.h"
class KoInlineTextObjectManager;
/**
* helper class
*/
class InsertNamedVariableAction : public InsertInlineObjectActionBase
{
public:
InsertNamedVariableAction(KoCanvasBase *canvas, const KoInlineTextObjectManager *manager, const QString &name);
private:
- virtual KoInlineObject *createInlineObject();
+ KoInlineObject *createInlineObject() override;
const KoInlineTextObjectManager *m_manager;
QString m_name;
};
#endif
diff --git a/plugins/flake/textshape/kotext/InsertTextLocator_p.h b/plugins/flake/textshape/kotext/InsertTextLocator_p.h
index 7b037fa046..35cd3a6ae1 100644
--- a/plugins/flake/textshape/kotext/InsertTextLocator_p.h
+++ b/plugins/flake/textshape/kotext/InsertTextLocator_p.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INSERTTEXTLOCATOR_H
#define INSERTNAMEDVARIABLEACTION_H
#include "InsertInlineObjectActionBase_p.h"
/**
* helper class
*/
class InsertTextLocator : public InsertInlineObjectActionBase
{
public:
explicit InsertTextLocator(KoCanvasBase *canvas);
private:
- virtual KoInlineObject *createInlineObject();
+ KoInlineObject *createInlineObject() override;
};
#endif
diff --git a/plugins/flake/textshape/kotext/InsertTextReferenceAction_p.h b/plugins/flake/textshape/kotext/InsertTextReferenceAction_p.h
index e5a402ad80..0b66be6ef6 100644
--- a/plugins/flake/textshape/kotext/InsertTextReferenceAction_p.h
+++ b/plugins/flake/textshape/kotext/InsertTextReferenceAction_p.h
@@ -1,41 +1,41 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INSERTTEXTREFERENCEACTION_H
#define INSERTTEXTREFERENCEACTION_H
#include "InsertInlineObjectActionBase_p.h"
class KoInlineTextObjectManager;
/**
* helper class
*/
class InsertTextReferenceAction : public InsertInlineObjectActionBase
{
public:
InsertTextReferenceAction(KoCanvasBase *canvas, const KoInlineTextObjectManager *manager);
private:
- virtual KoInlineObject *createInlineObject();
+ KoInlineObject *createInlineObject() override;
const KoInlineTextObjectManager *m_manager;
};
#endif
diff --git a/plugins/flake/textshape/kotext/InsertVariableAction_p.h b/plugins/flake/textshape/kotext/InsertVariableAction_p.h
index 69954c0fcd..93e893ec28 100644
--- a/plugins/flake/textshape/kotext/InsertVariableAction_p.h
+++ b/plugins/flake/textshape/kotext/InsertVariableAction_p.h
@@ -1,44 +1,44 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INSERTVARIABLEACTION_H
#define INSERTVARIABLEACTION_H
#include "InsertInlineObjectActionBase_p.h"
class KoProperties;
class KoInlineObjectFactoryBase;
struct KoInlineObjectTemplate;
/// \internal
class InsertVariableAction : public InsertInlineObjectActionBase
{
public:
InsertVariableAction(KoCanvasBase *base, KoInlineObjectFactoryBase *factory, const KoInlineObjectTemplate &templ);
private:
- virtual KoInlineObject *createInlineObject();
+ KoInlineObject *createInlineObject() override;
KoInlineObjectFactoryBase *const m_factory;
const QString m_templateId;
const KoProperties *const m_properties;
QString m_templateName;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoAnchorInlineObject.h b/plugins/flake/textshape/kotext/KoAnchorInlineObject.h
index d2ae8b960e..6627ed228c 100644
--- a/plugins/flake/textshape/kotext/KoAnchorInlineObject.h
+++ b/plugins/flake/textshape/kotext/KoAnchorInlineObject.h
@@ -1,99 +1,99 @@
/* This file is part of the KDE project
* Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Matus Hanzes <matus.hanzes@ixonos.com>
* Copyright (C) 2013 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOANCHORINLINEOBJECT_H
#define KOANCHORINLINEOBJECT_H
#include "KoInlineObject.h"
#include "KoShapeAnchor.h"
#include "kritatext_export.h"
class KoAnchorInlineObjectPrivate;
/**
* This class connects KoShapeAnchor to an inline character in the text document.
*
* This class is used when the shape anchor is of type: as-char
*
* It has to be registered to the inlineobjectmanager and thus forms the connection between the text
* and the KoShapeAnchor and by extension the so called 'anchored-shape' (any kind of shape)
*
* The KoAnchorInlineObject is placed as a character in text. As such it will move and be
* editable like any other character, including deletion.
*
* Since this is a real character it will be positioned by the textlayout engine and anything that
* will change the position of the text will thus also change the KoAnchorInlineObject character.
*
* The anchored-shape can be repositioned on the canvas if the text is relayouted (for example after
* editing the text. This is dependent on how the text layout is implemented.
*
* Steps to use a KoAnchorInlineObject are; <ol>
* <li> Create KoShapeAnchor *anchor = new KoShapeAnchor(shape);
* <li> Use anchor->loadOdf() to load additional attributes like the "text:anchor-type"
* <li> if type is as-char create KoAnchorInlineObject *anchorObj = new KoAnchorInlineObject(anchor);
*/
class KRITATEXT_EXPORT KoAnchorInlineObject : public KoInlineObject, public KoShapeAnchor::TextLocation
{
Q_OBJECT
public:
/**
* Constructor for an as-char anchor.
* @param parent the shapeanchor.
*/
explicit KoAnchorInlineObject(KoShapeAnchor *parent);
- virtual ~KoAnchorInlineObject();
+ ~KoAnchorInlineObject() override;
/// returns the parent anchor
KoShapeAnchor *anchor() const;
/// returns the cursor position in the document where this anchor is positioned.
- int position() const;
+ int position() const override;
/// returns the document that this anchor is associated with.
- const QTextDocument *document() const;
+ const QTextDocument *document() const override;
/// reimplemented from KoInlineObject
- virtual void updatePosition(const QTextDocument *document,
- int posInDocument, const QTextCharFormat &format);
+ void updatePosition(const QTextDocument *document,
+ int posInDocument, const QTextCharFormat &format) override;
/// reimplemented from KoInlineObject
- virtual void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ void resize(const QTextDocument *document, QTextInlineObject &object,
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
/// reimplemented from KoInlineObject
- virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
qreal inlineObjectAscent() const;
qreal inlineObjectDescent() const;
/// reimplemented from KoInlineObject - should not do anything
- bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &);
+ bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) override;
/// reimplemented from KoInlineObject
- void saveOdf(KoShapeSavingContext &context);
+ void saveOdf(KoShapeSavingContext &context) override;
private:
Q_DECLARE_PRIVATE(KoAnchorInlineObject)
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoAnchorTextRange.h b/plugins/flake/textshape/kotext/KoAnchorTextRange.h
index d63e1d0310..f7528884a4 100644
--- a/plugins/flake/textshape/kotext/KoAnchorTextRange.h
+++ b/plugins/flake/textshape/kotext/KoAnchorTextRange.h
@@ -1,86 +1,86 @@
/* This file is part of the KDE project
* Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Matus Hanzes <matus.hanzes@ixonos.com>
* Copyright (C) 2013 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOANCHORTEXTRANGE_H
#define KOANCHORTEXTRANGE_H
#include "KoTextRange.h"
#include "KoShapeAnchor.h"
#include "kritatext_export.h"
class KoAnchorTextRangePrivate;
class QTextCursor;
/**
* This class connects KoShapeAnchor to a position in the text document.
*
* This class is used when the shape anchor is of type: char or paragraph
*
* It has to be registered to the textrange manager and thus forms the connection between the text
* and the KoShapeAnchor and by extension the so called 'anchored-shape' (any kind of shape)
*
* The KoAnchorTextRange is placed at a position in text. As with all KoTextRange it will change
* it's position in the text when the user edits text before it. The user is also able to delete it if
* deleting the text where it is positioned.
*
* The anchored-shape can be repositioned on the canvas if the text is relayouted (for example after
* editing the text. This is dependent on how the text layout is implemented.
*
* Steps to use a KoAnchorTextRange are; <ol>
* <li> Create KoShapeAnchor *anchor = new KoShapeAnchor(shape);
* <li> Use anchor->loadOdf() to load additional attributes like the "text:anchor-type"
* <li> if type is char or paragraph create KoAnchorTextRange *anchorRange = new KoAnchorTextRange(anchor);
*/
class KRITATEXT_EXPORT KoAnchorTextRange : public KoTextRange, public KoShapeAnchor::TextLocation
{
Q_OBJECT
public:
/**
* Constructor for a char or paragraph anchor.
* @param parent the shapeanchor.
*/
KoAnchorTextRange(KoShapeAnchor *parent, const QTextCursor &cursor);
- virtual ~KoAnchorTextRange();
+ ~KoAnchorTextRange() override;
/// returns the parent anchor
KoShapeAnchor *anchor() const;
/// reimplemented from KoShapeAnchor::TextLocation
- const QTextDocument *document() const;
+ const QTextDocument *document() const override;
/// reimplemented from KoShapeAnchor::TextLocation
- int position() const;
+ int position() const override;
void updateContainerModel();
/// reimplemented from KoTextRange - should not do anything
- bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &);
+ bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) override;
/// reimplemented from KoTextRange
- void saveOdf(KoShapeSavingContext &context, int position, KoTextRange::TagType tagType) const;
+ void saveOdf(KoShapeSavingContext &context, int position, KoTextRange::TagType tagType) const override;
private:
KoAnchorTextRangePrivate * const d_ptr;
Q_DECLARE_PRIVATE(KoAnchorTextRange)
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoAnnotation.h b/plugins/flake/textshape/kotext/KoAnnotation.h
index c8a543f851..a097e76c51 100644
--- a/plugins/flake/textshape/kotext/KoAnnotation.h
+++ b/plugins/flake/textshape/kotext/KoAnnotation.h
@@ -1,92 +1,92 @@
/* This file is part of the KDE project
* Copyright (C) 2007-2008 Fredy Yanardi <fyanardi@gmail.com>
* Copyright (C) 2011 Boudewijn Rempt <boud@kogmbh.com>
* Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOANNOTATION_H
#define KOANNOTATION_H
#include "KoTextRange.h"
#include "kritatext_export.h"
class KoShape;
class KoAnnotationManager;
/**
* An annotation is a note made by the user regarding a part of the
* text. The annotation refers to either a position or a range of
* text. The annotation location will be automatically updated if user
* alters the text in the document.
* An annotation is identified by it's name, and all annotations are
* managed by KoAnnotationManager. An annotation can be retrieved from
* the annotation manager by using name as identifier.
*
* @see KoAnnotationManager
*/
class KRITATEXT_EXPORT KoAnnotation : public KoTextRange
{
Q_OBJECT
public:
/**
* Constructor.
*
* By default an annotation has the SinglePosition type and an empty name.
* The name is set when the annotation is inserted into the annotation manager.
*
* @param document the text document where this annotation is located
*/
explicit KoAnnotation(const QTextCursor &);
- virtual ~KoAnnotation();
+ ~KoAnnotation() override;
/// reimplemented from super
- virtual void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const;
+ void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const override;
/**
* Set the new name for this annotation
* @param name the new name of the annotation
*/
void setName(const QString &name);
/// @return the name of this annotation
QString name() const;
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/**
* This is called to allow Cut and Paste of annotations. This
* method gives a correct, unique, name
*/
static QString createUniqueAnnotationName(const KoAnnotationManager* kam,
const QString &annotationName, bool isEndMarker);
void setAnnotationShape(KoShape *shape);
KoShape *annotationShape() const;
private:
class Private;
Private *const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoAnnotationManager.h b/plugins/flake/textshape/kotext/KoAnnotationManager.h
index 7228471ed7..accb285011 100644
--- a/plugins/flake/textshape/kotext/KoAnnotationManager.h
+++ b/plugins/flake/textshape/kotext/KoAnnotationManager.h
@@ -1,81 +1,81 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Fredy Yanardi <fyanardi@gmail.com>
* Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOANNOTATIONMANAGER_H
#define KOANNOTATIONMANAGER_H
#include "kritatext_export.h"
#include <QObject>
#include <QList>
class KoAnnotation;
class KoAnnotationManagerPrivate;
/**
* A manager for all annotations in a document. Every annotation is identified by a unique name.
* Note that only SinglePosition and StartAnnotation annotations can be retrieved from this
* manager. An end annotation should be retrieved from it's parent (StartAnnotation) using
* KoAnnotation::endAnnotation()
* This class also maintains a list of annotation names so that it can be easily used to
* show all available annotation.
*/
class KRITATEXT_EXPORT KoAnnotationManager : public QObject
{
Q_OBJECT
public:
/// constructor
KoAnnotationManager();
- ~KoAnnotationManager();
+ ~KoAnnotationManager() override;
/// @return an annotation with the specified name, or 0 if there is none
KoAnnotation *annotation(const QString &name) const;
/// @return a list of QString containing all annotation names
QList<QString> annotationNameList() const;
public Q_SLOTS:
/**
* Insert a new annotation to this manager. The name of the annotation
* will be set to @param name, no matter what name has been set on
* it.
* @param name the name of the annotation
* @param annotation the annotation object to insert
*/
void insert(const QString &name, KoAnnotation *annotation);
/**
* Remove an annotation from this manager.
* @param name the name of the annotation to remove
*/
void remove(const QString &name);
/**
* Rename an annotation
* @param oldName the old name of the annotation
* @param newName the new name of the annotation
*/
void rename(const QString &oldName, const QString &newName);
private:
KoAnnotationManagerPrivate * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoBookmark.h b/plugins/flake/textshape/kotext/KoBookmark.h
index 8e4f610986..114f464fbd 100644
--- a/plugins/flake/textshape/kotext/KoBookmark.h
+++ b/plugins/flake/textshape/kotext/KoBookmark.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE project
* Copyright (C) 2007-2008 Fredy Yanardi <fyanardi@gmail.com>
* Copyright (C) 2011 Boudewijn Rempt <boud@kogmbh.com>
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOBOOKMARK_H
#define KOBOOKMARK_H
#include "KoTextRange.h"
#include "kritatext_export.h"
class KoBookmarkManager;
/**
* A document can store a set of cursor positions/selected cursor locations which can be
* retrieved again later to go to those locations from any location in the document.
* The bookmark location will be automatically updated if user alters the text in the document.
* A bookmark is identified by it's name, and all bookmarks are managed by KoBookmarkManager. A
* bookmark can be retrieved from the bookmark manager by using name as identifier.
* @see KoBookmarkManager
*/
class KRITATEXT_EXPORT KoBookmark : public KoTextRange
{
Q_OBJECT
public:
/**
* Constructor.
*
* By default a bookmark has the SinglePosition type and an empty name.
* The name is set when the book is inserted into the bookmark manager.
*
* @param document the text document where this bookmark is located
*/
explicit KoBookmark(const QTextCursor &);
- virtual ~KoBookmark();
+ ~KoBookmark() override;
/// reimplemented from super
- void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const;
+ void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const override;
/**
* Set the new name for this bookmark
* @param name the new name of the bookmark
*/
void setName(const QString &name);
/// @return the name of this bookmark
QString name() const;
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/**
* This is called to allow Cut and Paste of bookmarks. This
* method gives a correct, unique, name
*/
static QString createUniqueBookmarkName(const KoBookmarkManager* bmm, QString bookmarkName, bool isEndMarker);
private:
class Private;
Private *const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoBookmarkManager.h b/plugins/flake/textshape/kotext/KoBookmarkManager.h
index ec46361aab..2e85445f63 100644
--- a/plugins/flake/textshape/kotext/KoBookmarkManager.h
+++ b/plugins/flake/textshape/kotext/KoBookmarkManager.h
@@ -1,82 +1,82 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Fredy Yanardi <fyanardi@gmail.com>
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOBOOKMARKMANAGER_H
#define KOBOOKMARKMANAGER_H
#include "kritatext_export.h"
#include <QObject>
#include <QList>
#include <QString>
class KoBookmark;
class KoBookmarkManagerPrivate;
/**
* A manager for all bookmarks in a document. Every bookmark is identified by a unique name.
* Note that only SinglePosition and StartBookmark bookmarks can be retrieved from this
* manager. An end bookmark should be retrieved from it's parent (StartBookmark) using
* KoBookmark::endBookmark()
* This class also maintains a list of bookmark names so that it can be easily used to
* show all available bookmark.
*/
class KRITATEXT_EXPORT KoBookmarkManager : public QObject
{
Q_OBJECT
public:
/// constructor
KoBookmarkManager();
- ~KoBookmarkManager();
+ ~KoBookmarkManager() override;
/// @return a bookmark with the specified name, or 0 if there is none
KoBookmark *bookmark(const QString &name) const;
/// @return a list of QString containing all bookmark names
QList<QString> bookmarkNameList() const;
public Q_SLOTS:
/**
* Insert a new bookmark to this manager. The name of the bookmark
* will be set to @param name, no matter what name has been set on
* it.
* @param name the name of the bookmark
* @param bookmark the bookmark object to insert
*/
void insert(const QString &name, KoBookmark *bookmark);
/**
* Remove a bookmark from this manager.
* @param name the name of the bookmark to remove
*/
void remove(const QString &name);
/**
* Rename a bookmark
* @param oldName the old name of the bookmark
* @param newName the new name of the bookmark
*/
void rename(const QString &oldName, const QString &newName);
private:
KoBookmarkManagerPrivate * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoDocumentRdfBase.h b/plugins/flake/textshape/kotext/KoDocumentRdfBase.h
index a961644312..96a737cc56 100644
--- a/plugins/flake/textshape/kotext/KoDocumentRdfBase.h
+++ b/plugins/flake/textshape/kotext/KoDocumentRdfBase.h
@@ -1,95 +1,95 @@
/* This file is part of the KDE project
Copyright (C) 2010 KO GmbH <ben.martin@kogmbh.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_DOCUMENT_Rdf_Base_H
#define KO_DOCUMENT_Rdf_Base_H
#include "kritatext_export.h"
#include <QObject>
#include <QMap>
#include <QString>
#include <QMetaType>
#include <QSharedPointer>
#include <KoDataCenterBase.h>
class KoDocumentResourceManager;
class QTextDocument;
class KoStore;
class KoXmlWriter;
///**
// * Dummy definition in case Soprano is not available.
// */
namespace Soprano
{
class Model;
}
/**
* A base class that provides the interface to many RDF features
* but will not do anything if Soprano support is not built.
* By having this "Base" class, code can call methods at points
* where RDF handling is desired and can avoid #ifdef conditionals
* because the base class interface is here and will be valid, even
* if impotent when Soprano support is not built.
*/
class KRITATEXT_EXPORT KoDocumentRdfBase : public QObject, public KoDataCenterBase
{
Q_OBJECT
public:
explicit KoDocumentRdfBase(QObject *parent = 0);
- virtual ~KoDocumentRdfBase();
+ ~KoDocumentRdfBase() override;
/**
* Get the Soprano::Model that contains all the Rdf
* You do not own the model, do not delete it.
*/
#ifdef SHOULD_BUILD_RDF
virtual QSharedPointer<Soprano::Model> model() const;
#endif
virtual void linkToResourceManager(KoDocumentResourceManager *rm);
virtual void updateInlineRdfStatements(const QTextDocument *qdoc);
virtual void updateXmlIdReferences(const QMap<QString, QString> &m);
/**
* idrefList queries soprano after loading and creates a list of all rdfid's that
* where found in the manifest.rdf document. This list is used to make sure we do not
* create more inline rdf objects than necessary
* @return a list of xml-id's
*/
virtual QStringList idrefList() const;
virtual bool loadOasis(KoStore *store);
virtual bool saveOasis(KoStore *store, KoXmlWriter *manifestWriter);
// reimplemented in komain/rdf/KoDocumentRdf
- virtual bool completeLoading(KoStore *store);
- virtual bool completeSaving(KoStore *store, KoXmlWriter *manifestWriter, KoShapeSavingContext *context);
+ bool completeLoading(KoStore *store) override;
+ bool completeSaving(KoStore *store, KoXmlWriter *manifestWriter, KoShapeSavingContext *context) override;
};
Q_DECLARE_METATYPE(KoDocumentRdfBase*)
#endif
diff --git a/plugins/flake/textshape/kotext/KoInlineCite.h b/plugins/flake/textshape/kotext/KoInlineCite.h
index 712eb8d85a..a0c538e0eb 100644
--- a/plugins/flake/textshape/kotext/KoInlineCite.h
+++ b/plugins/flake/textshape/kotext/KoInlineCite.h
@@ -1,211 +1,211 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Smit Patel <smitpatel24@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINLINECITE_H
#define KOINLINECITE_H
#include "KoInlineObject.h"
#include "kritatext_export.h"
/**
* This object is an inline object, which means it is anchored in the text-flow and it can hold
* bibliography-mark(citation).
*/
class KRITATEXT_EXPORT KoInlineCite : public KoInlineObject
{
Q_OBJECT
public:
enum Type {
Citation,
ClonedCitation //cloned from other citation in document
};
/**
* Construct a new cite to be inserted in the text using KoTextSelectionHandler::insertInlineObject() for example.
*/
explicit KoInlineCite(Type type);
- virtual ~KoInlineCite();
+ ~KoInlineCite() override;
bool operator!= (const KoInlineCite &cite) const;
KoInlineCite &operator= (const KoInlineCite &cite);
Type type() const; //return type of cite
void setType(Type t);
QString dataField(const QString &fieldName) const; //returns bibliography-data-field with name fieldName
bool hasSameData(KoInlineCite *cite) const;
void copyFrom(KoInlineCite *cite);
void setIdentifier(const QString &identifier);
void setBibliographyType(const QString &bibliographyType);
void setAddress (const QString &addr);
void setAnnotation (const QString &annotation);
void setAuthor (const QString &author);
void setBookTitle (const QString &booktitle);
void setChapter (const QString &chapter);
void setEdition (const QString &edition);
void setEditor (const QString &editor);
void setPublicationType (const QString &publicationType);
void setInstitution (const QString &institution);
void setJournal (const QString &journal);
void setLabel(const QString &label);
void setMonth (const QString &month);
void setNote (const QString &note);
void setNumber (const QString &number);
void setOrganisation (const QString &organisation);
void setPages (const QString &pages);
void setPublisher (const QString &publisher);
void setSchool (const QString &school);
void setSeries (const QString &series);
void setTitle (const QString &title);
void setReportType (const QString &reportType);
void setVolume (const QString &volume);
void setYear (const QString &year);
void setURL (const QString &url);
void setISBN (const QString &isbn);
void setISSN (const QString &issn);
void setCustom1 (const QString &custom1);
void setCustom2 (const QString &custom2);
void setCustom3 (const QString &custom3);
void setCustom4 (const QString &custom4);
void setCustom5 (const QString &custom5);
QString identifier() const;
QString address() const;
QString author() const;
QString bibliographyType() const;
QString annotation() const;
QString bookTitle() const;
QString chapter() const;
QString edition() const;
QString editor() const;
QString publicationType() const;
QString institution() const;
QString journal() const;
QString month() const;
QString note() const;
QString number() const;
QString organisations() const;
QString pages() const;
QString publisher() const;
QString school() const;
QString series() const;
QString title() const;
QString reportType() const;
QString volume() const;
QString year() const;
QString url() const;
QString isbn() const;
QString issn() const;
QString custom1() const;
QString custom2() const;
QString custom3() const;
QString custom4() const;
QString custom5() const;
int posInDocument() const;
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
///reimplemented
- void saveOdf(KoShapeSavingContext &context);
+ void saveOdf(KoShapeSavingContext &context) override;
protected:
/// reimplemented
- virtual void updatePosition(const QTextDocument *document, int posInDocument, const QTextCharFormat &format);
+ void updatePosition(const QTextDocument *document, int posInDocument, const QTextCharFormat &format) override;
/// reimplemented
- virtual void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ void resize(const QTextDocument *document, QTextInlineObject &object,
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
/// reimplemented
- virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
private:
class Private;
Private * const d;
};
#endif // KOINLINECITE_H
diff --git a/plugins/flake/textshape/kotext/KoInlineNote.h b/plugins/flake/textshape/kotext/KoInlineNote.h
index f1d0436430..8fd8806d73 100644
--- a/plugins/flake/textshape/kotext/KoInlineNote.h
+++ b/plugins/flake/textshape/kotext/KoInlineNote.h
@@ -1,117 +1,117 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINLINENOTE_H
#define KOINLINENOTE_H
#include "KoInlineObject.h"
#include "kritatext_export.h"
class QTextFrame;
/**
* This object is an inline object, which means it is anchored in the text-flow and it can hold note info.
* Typical notes that use this are Footnotes, Endnotes and Annotations (also known as comments).
*/
class KRITATEXT_EXPORT KoInlineNote : public KoInlineObject
{
Q_OBJECT
public:
/// The type of note specifies how the application will use the text from the note.
enum Type {
Footnote, ///< Notes of this type will have their text placed at the bottom of a shape.
Endnote, ///< Notes of this type are used as endnotes in applications that support it.
Annotation ///< Notes of this type will have their text placed in the document margin.
};
/**
* Construct a new note to be inserted in the text using KoTextEditor::insertInlineObject() for example.
* @param type the type of note, which specifies how the application will use the text from the new note.
*/
explicit KoInlineNote(Type type);
// destructor
- virtual ~KoInlineNote();
+ ~KoInlineNote() override;
/**
* Set the textframe where we will create our own textframe within
* Our textframe is the one containing the real note contents.
* @param text the new text
*/
void setMotherFrame(QTextFrame *text);
/**
* Set the label that is shown at the spot this inline note is inserted.
* @param text the new label
*/
void setLabel(const QString &text);
/**
* Indirectly set the label that is shown at the spot this inline note is inserted.
* @param autoNumber the number that the label will portray. 0 should be the first
*/
void setAutoNumber(int autoNumber);
/// return the current text
QTextFrame *textFrame() const;
/// return the current label
QString label() const;
/**
* @return whether the label should be automatically recreated or if the label is static.
*/
bool autoNumbering() const;
/**
* Set whether the label should be automatically recreated.
* @param on if true then changes in footnote-ordering will recalcualte the label.
*/
void setAutoNumbering(bool on);
/// return the type of note.
Type type() const;
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
///reimplemented
- void saveOdf(KoShapeSavingContext &context);
+ void saveOdf(KoShapeSavingContext &context) override;
int getPosInDocument() const;
protected:
/// reimplemented
- virtual void updatePosition(const QTextDocument *document,
- int posInDocument, const QTextCharFormat &format);
+ void updatePosition(const QTextDocument *document,
+ int posInDocument, const QTextCharFormat &format) override;
/// reimplemented
- virtual void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ void resize(const QTextDocument *document, QTextInlineObject &object,
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
/// reimplemented
- virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
private:
friend class InsertNoteCommand;
// only to be used on subsequent redo of insertion
void setTextFrame(QTextFrame *textFrame);
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoInlineObject.h b/plugins/flake/textshape/kotext/KoInlineObject.h
index 400cb3adbe..41d3449593 100644
--- a/plugins/flake/textshape/kotext/KoInlineObject.h
+++ b/plugins/flake/textshape/kotext/KoInlineObject.h
@@ -1,239 +1,239 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINLINEOBJECTBASE_H
#define KOINLINEOBJECTBASE_H
#include "kritatext_export.h"
#include <KoXmlReaderForward.h>
#include <QObject>
#include <QTextInlineObject>
class QVariant;
class QTextDocument;
class QTextCharFormat;
class QPaintDevice;
class QPainter;
class QRectF;
class KoInlineTextObjectManager;
class KoInlineObjectPrivate;
class KoShapeSavingContext;
class KoTextInlineRdf;
class KoShapeLoadingContext;
/**
* Base class for all inline-text-objects.
*
* In a TextShape you can insert objects that move with the text.
* They are essentially anchored to a specific position in the text, as
* one character.
*
* @see KoInlineTextObjectManager
*/
class KRITATEXT_EXPORT KoInlineObject : public QObject
{
Q_OBJECT
public:
enum Property {
DocumentURL,
PageCount,
AuthorName,
SenderEmail,
SenderCompany,
SenderPhoneWork,
SenderPhonePrivate,
SenderFax,
SenderCountry,
Title,
Keywords,
Subject,
Description,
Comments,
SenderPostalCode,
SenderCity,
SenderStreet,
SenderTitle,
SenderFirstname,
SenderLastname,
SenderPosition,
AuthorInitials,
Chapter, ///< Chapter (number, name, number and name, plain number, plain number and name) variables.
KarbonStart = 1000, ///< Base number for Karbon specific values.
KexiStart = 2000, ///< Base number for Kexi specific values.
FlowStart = 3000, ///< Base number for Flow specific values.
PlanStart = 4000, ///< Base number for Plan specific values.
StageStart = 5000, ///< Base number for Stage specific values.
KritaStart = 6000, ///< Base number for Krita specific values.
WordsStart = 7000, ///< Base number for Words specific values.
VariableManagerStart = 8000, ///< Start of numbers reserved for the KoVariableManager
UserGet = 12000, ///< User defined variable user-field-get
UserInput = 12001 ///< User defined variable user-field-input
};
/**
* constructor
* @param propertyChangeListener if set to true this instance will be notified of changes of properties.
* @see KoInlineTextObjectManager::setProperty()
* @see propertyChangeListener()
*/
explicit KoInlineObject(bool propertyChangeListener = false);
- virtual ~KoInlineObject();
+ ~KoInlineObject() override;
/**
* Will be called by the manager when this variable is added.
* Remember that inheriting classes should not use the manager() in the constructor, since it will be 0
* @param manager the object manager for this object.
*/
void setManager(KoInlineTextObjectManager *manager);
/**
* Return the object manager set on this inline object.
*/
KoInlineTextObjectManager *manager() const;
/**
* Just prior to the first time this object will be shown this method will be called.
* The object plugin should reimplement this to initialize the object after the manager
* has been set, but before the text has been layouted.
* The default implementation does nothing.
*/
virtual void setup() {}
/**
* Save this inlineObject as ODF
* @param context the context for saving.
*/
virtual void saveOdf(KoShapeSavingContext &context) = 0;
/**
* Update position of the inline object.
* This is called each time the paragraph this inline object is in is re-layouted giving you the opportunity
* to reposition your object based on the new information.
* @param document the text document this inline object is operating on.
* @param posInDocument the character position in the document (param document) this inline object is at.
* @param format the character format for the inline object.
*/
virtual void updatePosition(const QTextDocument *document, int posInDocument, const QTextCharFormat &format) = 0;
/**
* Update the size of the inline object.
* Each time the text is painted, as well as when the paragraph this variable is in, this method
* is called. You should alter the size of the object if the content has changed.
* Altering the size is done by altering the 'object' parameter using QTextInlineObject::setWidth(),
* QTextInlineObject::setAscent() and QTextInlineObject::setDescent() methods.
* Note that this method is called while painting; and thus is time sensitive; avoid doing anything time
* consuming.
* Note make sure that the width is 0 when there is nothing to be shown for the object.
* @param document the text document this inline object is operating on.
* @param object the inline object properties
* @param posInDocument the character position in the document (param document) this inline object is at.
* @param format the character format for the inline object.
* @param pd the postscript-paintdevice that all text is rendered on. Use this for QFont and related
* classes so the inline object can be reused on any paintdevice.
*/
virtual void resize(const QTextDocument *document, QTextInlineObject &object,
int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) = 0;
/**
* Paint the inline-object-base using the provided painter within the rectangle specified by rect.
* @param document the text document this inline object is operating on.
* @param object the inline object properties
* @param posInDocument the character position in the document (param document) this inline object is at.
* @param format the character format for the inline object.
* @param pd the postscript-paintdevice that all text is rendered on. Use this for QFont and related
* classes so the inline object can be reused on any paintdevice.
* @param painter the painting object to paint on. Note that unline many places in calligra painting
* should happen at the position indicated by the rect, not at top-left.
* @param rect the rectangle inside which the variable can paint itself. Painting outside the rect
* will give varous problems with regards to repainting issues.
*/
virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) = 0;
/**
* Overwrite this if you are interrested in propertychanges.
* @param property the property id that has been changed, one from the Property enum.
* You should ignore all properties you don't use as new properties can be added at any time.
* @param value the new value of the property wrapped in a QVariant. Properties can be a lot of
* different class types. Ints, bools, QStrings etc.
* example:
* @code
* void KoDateVariable::propertyChanged(Property key, const QVariant &value) {
* if(key == KoInlineObject::PageCount)
* setValue(QString::number(value.toInt()));
* }
* @endcode
* @see propertyChangeListener()
*/
virtual void propertyChanged(Property property, const QVariant &value);
/// return the inline-object Id that is assigned for this object.
int id() const;
/// Set the inline-object Id that is assigned for this object by the KoInlineTextObjectManager.
void setId(int id);
/**
* When true, notify this object of property changes.
* Each inlineObject can use properties like the PageCount or the document name.
* Only objects that actually have a need for such information be a listener to avoid unneeded
* overhead.
* When this returns true, the propertyChanged() method will be called.
* @see KoInlineTextObjectManager::setProperty()
*/
bool propertyChangeListener() const;
/**
* An inline object might have some Rdf metadata associated with it
* in content.xml
* Ownership of the rdf object is taken by this object, you should not
* delete it.
*/
void setInlineRdf(KoTextInlineRdf *rdf);
/**
* Get any Rdf which was stored in content.xml for this inline object
* This object continues to own the object, do not delete it.
*/
KoTextInlineRdf *inlineRdf() const;
/**
* Load a variable from odf.
*
* @param element element which represents the shape in odf
* @param context the KoShapeLoadingContext used for loading
*
* @return false if loading failed
*/
virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) = 0;
protected:
explicit KoInlineObject(KoInlineObjectPrivate &, bool propertyChangeListener = false);
KoInlineObjectPrivate *d_ptr;
private:
Q_DECLARE_PRIVATE(KoInlineObject)
friend KRITATEXT_EXPORT QDebug operator<<(QDebug, const KoInlineObject *);
};
KRITATEXT_EXPORT QDebug operator<<(QDebug dbg, const KoInlineObject *o);
#endif
diff --git a/plugins/flake/textshape/kotext/KoInlineObjectRegistry.h b/plugins/flake/textshape/kotext/KoInlineObjectRegistry.h
index 95de4fe126..6d11eba459 100644
--- a/plugins/flake/textshape/kotext/KoInlineObjectRegistry.h
+++ b/plugins/flake/textshape/kotext/KoInlineObjectRegistry.h
@@ -1,81 +1,81 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINLINEOBJECTREGISTRY_H
#define KOINLINEOBJECTREGISTRY_H
#include <KoGenericRegistry.h>
#include <KoInlineObjectFactoryBase.h>
#include <KoXmlReaderForward.h>
#include "kritatext_export.h"
#include <QList>
class KoCanvasBase;
class QAction;
class KoShapeLoadingContext;
/**
* This singleton class keeps a register of all available InlineObject factories.
* @see KoInlineObjectFactoryBase
* @see KoInlineTextObjectManager
* @see KoInlineObject
* @see KoVariable
*/
class KRITATEXT_EXPORT KoInlineObjectRegistry : public KoGenericRegistry<KoInlineObjectFactoryBase*>
{
public:
KoInlineObjectRegistry();
- ~KoInlineObjectRegistry();
+ ~KoInlineObjectRegistry() override;
/**
* Return an instance of the KoInlineObjectRegistry
* Creates an instance if that has never happened before and returns the singleton instance.
*/
static KoInlineObjectRegistry *instance();
/**
* Create a list of actions that can be used to plug into a menu, for example.
* This method will find all the InlineObjectFactories that are installed in the system and
* find out which object they provide. If a factory provides a variable, then all its
* templates will be added to the response.
* Each of thse actions, when executed, will insert the relevant variable in the current text-position.
* The actions assume that the text tool is selected, if thats not the case then they will silently fail.
* @param host the canvas for which these actions are created. Note that the actions will get these
* actions as a parent (for memory management purposes) as well.
* @see KoInlineTextObjectManager::createInsertVariableActions()
*/
QList<QAction*> createInsertVariableActions(KoCanvasBase *host) const;
/**
* Use the element to find out which variable plugin can load it, and returns the loaded
* variable. The element expected is one of 'text:subject', 'text:date' / etc.
*
* @returns the variable or 0 if no variable could be created
*/
KoInlineObject *createFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context) const;
private:
KoInlineObjectRegistry(const KoInlineObjectRegistry&);
KoInlineObjectRegistry operator=(const KoInlineObjectRegistry&);
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoInlineTextObjectManager.h b/plugins/flake/textshape/kotext/KoInlineTextObjectManager.h
index 511eae2998..739af39709 100644
--- a/plugins/flake/textshape/kotext/KoInlineTextObjectManager.h
+++ b/plugins/flake/textshape/kotext/KoInlineTextObjectManager.h
@@ -1,186 +1,186 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOINLINETEXTOBJECTMANAGER_H
#define KOINLINETEXTOBJECTMANAGER_H
#include "KoInlineObject.h"
#include "KoVariableManager.h"
#include "kritatext_export.h"
// Qt + kde
#include <QHash>
#include <QTextBlock>
class KoCanvasBase;
class KoTextLocator;
class KoInlineNote;
class KoInlineCite;
class QTextCharFormat;
class QAction;
/**
* A container to register all the inlineTextObjects with.
* Inserting an inline-object in a QTextDocument should be done via this manager which will
* insert a placeholder in the text and you should add the KoInlineTextObjectManager to the
* KoTextDocument.
*/
class KRITATEXT_EXPORT KoInlineTextObjectManager : public QObject
{
Q_OBJECT
public:
enum Properties {
InlineInstanceId = 577297549 // If you change this, don't forget to change KoCharacterStyle.h
};
/// Constructor
explicit KoInlineTextObjectManager(QObject *parent = 0);
- virtual ~KoInlineTextObjectManager();
+ ~KoInlineTextObjectManager() override;
/**
* Retrieve a formerly added inline object based on the format.
* @param format the textCharFormat
*/
KoInlineObject *inlineTextObject(const QTextCharFormat &format) const;
/**
* Retrieve a formerly added inline object based on the cursor position.
* @param cursor the cursor which position is used. The anchor is ignored.
*/
KoInlineObject *inlineTextObject(const QTextCursor &cursor) const;
/**
* Retrieve a formerly added inline object based on the KoInlineObject::id() of the object.
* @param id the id assigned to the inline text object when it was added.
*/
KoInlineObject *inlineTextObject(int id) const;
QList<KoInlineObject*> inlineTextObjects() const;
/**
* Insert a new inline object into the manager as well as the document.
* This method will cause a placeholder to be inserted into the text at cursor position,
* possibly replacing a selection. The object will then be used as an inline
* character and painted at the specified location in the text.
* @param cursor the cursor which indicated the document and the position in that document
* where the inline object will be inserted.
* @param object the inline object to insert.
*/
void insertInlineObject(QTextCursor &cursor, KoInlineObject *object);
/**
* Add inline object into the manager.
*
* This methods add the inline object into the manager. This is useful if you have a command
* that removes and adds a inline object to the manager. If the object already was inserted before
* (the object id is already set) it keeps the old id, otherwise a new id will be generated.
*
* @param object the inline object to insert.
*/
void addInlineObject(KoInlineObject* object);
/**
* Remove an inline object from this manager. The object will also be removed from
* the bookmarkmanager if it is a bookmark. This is not done smart: you might end up
* with dangling start or end bookmarks.
* Should really only be called by KoTextEditor's delete commands
* @param the object to be removed
*/
void removeInlineObject(KoInlineObject *object);
/**
* Set a property that may have changed which will be forwarded to all registered textObjects.
* If the key has changed then all registered InlineObject instances that have stated to want
* updates will get called with the change.
* The property will be stored to allow it to be retrieved via the intProperty() and friends.
* @see KoInlineObject::propertyChangeListener()
*/
void setProperty(KoInlineObject::Property key, const QVariant &value);
/// retrieve a propery
QVariant property(KoInlineObject::Property key) const;
/// retrieve an int property
int intProperty(KoInlineObject::Property key) const;
/// retrieve a bool property
bool boolProperty(KoInlineObject::Property key) const;
/// retrieve a string property
QString stringProperty(KoInlineObject::Property key) const;
/// remove a property from the store.
void removeProperty(KoInlineObject::Property key);
/**
* Return the variableManager.
*/
const KoVariableManager *variableManager() const;
/**
* Return the variableManager.
*/
KoVariableManager *variableManager();
/**
* Create a list of actions that can be used to plug into a menu, for example.
* This method internally uses KoInlineObjectRegistry::createInsertVariableActions() but extends
* the list with all registered variable-names.
* Each of these actions, when executed, will insert the relevant variable in the current text-position.
* The actions assume that the text tool is selected, if thats not the case then they will silently fail.
* @param host the canvas for which these actions are created. Note that the actions will get these
* actions as a parent (for memory management purposes) as well.
* @see KoVariableManager
*/
QList<QAction*> createInsertVariableActions(KoCanvasBase *host) const;
QList<KoTextLocator*> textLocators() const;
/**
* It returns a list of all end notes in the document
*/
QList<KoInlineNote*> endNotes() const;
QMap<QString, KoInlineCite*> citations(bool duplicatesEnabled = true) const;
QList<KoInlineCite*> citationsSortedByPosition(bool duplicatesEnabled = true,
QTextBlock block = QTextBlock()) const;
public Q_SLOTS:
void documentInformationUpdated(const QString &info, const QString &data);
Q_SIGNALS:
/**
* Emitted whenever a propery is set and it turns out to be changed.
*/
void propertyChanged(int, const QVariant &variant);
private:
void insertObject(KoInlineObject *object);
QHash<int, KoInlineObject*> m_objects;
QHash<int, KoInlineObject*> m_deletedObjects;
QList<KoInlineObject*> m_listeners; // holds objects also in m_objects, but which want propertyChanges
int m_lastObjectId;
QHash<int, QVariant> m_properties;
KoVariableManager m_variableManager;
};
Q_DECLARE_METATYPE(KoInlineTextObjectManager*)
#endif
diff --git a/plugins/flake/textshape/kotext/KoList.h b/plugins/flake/textshape/kotext/KoList.h
index 8b4d0b6748..3f05d8658a 100644
--- a/plugins/flake/textshape/kotext/KoList.h
+++ b/plugins/flake/textshape/kotext/KoList.h
@@ -1,99 +1,99 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOLIST_H
#define KOLIST_H
#include "styles/KoListStyle.h"
#include <QMetaType>
#include <QWeakPointer>
#include <QVector>
#include <QTextList>
class KoListPrivate;
/**
* This class represents an ODF list. An ODF list may have upto 10 levels
* Each of the levels is represented as a QTextList (QTextList does not support
* embedded lists). There is always an associated KoListStyle that holds the
* styling information for various level of the ODF list.
*/
class KRITATEXT_EXPORT KoList : public QObject
{
Q_OBJECT
public:
enum Type {
TextList,
NumberedParagraph
};
/// Constructor
KoList(const QTextDocument *document, KoListStyle *style, Type type = TextList);
/// Destructor
- ~KoList();
+ ~KoList() override;
/// Adds \a block to \a level of this list
void add(const QTextBlock &block, int level);
/// Removes \a block from any KoList the block is a part of
static void remove(const QTextBlock &block);
/**
* Adds \a block to a list that follows \a style at \a level. If the block is
* already a part of a list, it is removed from that list. If the block before
* or after this block is part of a list that follows \a style, this block is
* added to that list. If required a new KoList is created.
* Returns the KoList that this block was added to.
*/
static KoList *applyStyle(const QTextBlock &block, KoListStyle *style, int level);
/// Sets the style of this list
void setStyle(KoListStyle *style);
/// Returns the style of this list
KoListStyle *style() const;
/// Return true if this list contains \a textlist
bool contains(QTextList *textList) const;
/// Returns the QTextLists that form this list
QVector<QWeakPointer<QTextList> > textLists() const;
QVector<KoListStyle::ListIdType> textListIds() const;
static int level(const QTextBlock &block);
/// Update the stored QTextList pointer for the given block
void updateStoredList(const QTextBlock &block);
KoList *listContinuedFrom() const;
void setListContinuedFrom(KoList *list);
private:
KoListPrivate * const d;
Q_PRIVATE_SLOT(d, void styleChanged(int))
};
Q_DECLARE_METATYPE(KoList*)
Q_DECLARE_METATYPE(QList<KoList*>)
#endif // KOLIST_H
diff --git a/plugins/flake/textshape/kotext/KoNamedVariable.h b/plugins/flake/textshape/kotext/KoNamedVariable.h
index fe465e9d26..e43a1a0cc3 100644
--- a/plugins/flake/textshape/kotext/KoNamedVariable.h
+++ b/plugins/flake/textshape/kotext/KoNamedVariable.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KONAMEDVARIABLE_H
#define KONAMEDVARIABLE_H
#include "KoVariable.h"
#include "kritatext_export.h"
/**
* This inlineObject shows the curent value of a variable as registered in the KoVariableManager.
* The proper way to create a new class is to use KoVariableManager::createVariable()
*/
class KoNamedVariable : public KoVariable
{
public:
/// return the name of this named variable
QString name() const {
return m_name;
}
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
- virtual void saveOdf(KoShapeSavingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
+ void saveOdf(KoShapeSavingContext &context) override;
protected:
friend class KoVariableManager;
/**
* Constructor
* @param key the property that represents the named variable. As defined internally in the KoVariableManager
* @param name the name of the variable.
*/
KoNamedVariable(Property key, const QString &name);
private:
/// reimplemented method
- void propertyChanged(Property property, const QVariant &value);
+ void propertyChanged(Property property, const QVariant &value) override;
/// reimplemented method
- void setup();
+ void setup() override;
const QString m_name;
const Property m_key;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoSectionModel.h b/plugins/flake/textshape/kotext/KoSectionModel.h
index 813789e5cc..1f3706fee1 100644
--- a/plugins/flake/textshape/kotext/KoSectionModel.h
+++ b/plugins/flake/textshape/kotext/KoSectionModel.h
@@ -1,142 +1,142 @@
#ifndef KOSECTIONMODEL_H
#define KOSECTIONMODEL_H
#include <QTextDocument>
#include <QAbstractItemModel>
#include <QVector>
#include <QSet>
#include <KoSection.h>
#include <KoSectionEnd.h>
/**
* Used to handle all the sections in the document
*
* Now there actually two levels of section handling:
* 1) Formatting Level: on this level we should be sure, that
* pointers to KoSection and KoSectionEnd in the KoParagraphStyles
* properties SectionEndings and SectionStartings are consistent.
* Handling on this level is provided on the level of text editing
* commands: DeleteCommand, NewSectionCommand
* We can't move it to another place, because we should know the
* semantics of operation to handle it right way.
* 2) Model(Tree) Level: on this level we should update KoSectionModel
* right way, so it in any moment represents the actual tree
* of sections. Tree is builded easily:
* One section is son of another, if it is directly nested in it.
* As text editing commands have access to change Formatting Level,
* they are declared as friend classes of KoSectionModel to be able
* affect Model structure without changing something on Formatting
* Level. Also affected by RenameSectionCommand.
*
* Also we need to look at the consistency of some section properties:
*
* 1) Bounds. Those now are handled with QTextCursors that are placed
* on start and end of the section. In default state start cursor
* isn't moving if text inserted in its position, and end cursor
* moves. But in the case of initial document loading, it is necessary
* to make some end cursors stop moving, so we have:
* KoTextLoader -> calling -> KoSection::setKeepEndBound()
* KoTextLoader -> calling -> KoSectionModel::allowMovingEndBound()
* ^-- this needed to restore defaul behaviour after load
*
* 2) Level. Level means the depth of the section in tree. Root
* sections has 0 (zero) level. Now if you look at the possible
* text editing command affecting sections you may notice that
* level of section doesn't change in any case. Initial level
* is set in KoSection constructor as parent's level plus one.
* TODO: write about drag-n-drop here, when its implemented
*
* 3) Name. Each KoSection has a name that must be unique. We have
* two groups of KoSections in each moment of time: the first group
* consists of the sections that are present in document now,
* the second group consists of the sections that were deleted, but
* we still need them as they may be restored with "undo".
* This groups are stored in m_registeredSections and m_sectionNames.
*
* Sections are created through this newSection() and newSectionEnd()
* functions.
*
* This object is created for QTextDocument on the first query of it.
*/
class KRITATEXT_EXPORT KoSectionModel : public QAbstractItemModel
{
Q_OBJECT
public:
static const int PointerRole = Qt::UserRole;
explicit KoSectionModel(QTextDocument *doc);
- virtual ~KoSectionModel();
+ ~KoSectionModel() override;
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex &child) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
/// Creates KoSection in position of @param cursor with some allowed name
KoSection *createSection(const QTextCursor &cursor, KoSection *parent);
/// Creates KoSection in position of @param cursor with specified @param name
KoSection *createSection(const QTextCursor &cursor, KoSection *parent, const QString &name);
/// Creates KoSectionEnd in pair for a @param section
KoSectionEnd *createSectionEnd(KoSection *section);
/** Tries to set @param section name to @param name
* @return @c false if there is a section with such name
* and new name isn't accepted and @c true otherwise.
*/
bool setName(KoSection *section, const QString &name);
/**
* Returns pointer to the deepest KoSection that covers @p pos
* or 0 if there is no such section
*/
KoSection *sectionAtPosition(int pos);
/// Returns name for the new section.
QString possibleNewName();
/// Returns if this name is possible.
bool isValidNewName(const QString &name) const;
/// Setting all sections end bound cursor to move with text inserting.
void allowMovingEndBound();
/// Finds index of @param child inside his parent.
int findRowOfChild(KoSection *child) const;
private:
Q_DISABLE_COPY(KoSectionModel)
friend class DeleteCommand;
friend class NewSectionCommand;
/**
* Inserts @param section to it's parent (should be
* stored in @param section already) in position childIdx.
* Affects only Model Level(@see KoSectionModel).
*/
void insertToModel(KoSection* section, int childIdx);
/**
* Deletes @param section from it's parent (should be
* stored in @param section already).
* Affects only Model Level(@see KoSectionModel).
*/
void deleteFromModel(KoSection *section);
QTextDocument *m_doc;
QSet<KoSection *> m_registeredSections; ///< stores pointer to sections that sometime was registered
QHash<QString, KoSection *> m_sectionNames; ///< stores name -> pointer reference, for sections that are visible in document now
QHash<KoSection *, QPersistentModelIndex> m_modelIndex;
QVector<KoSection *> m_rootSections;
};
Q_DECLARE_METATYPE(KoSectionModel *)
#endif //KOSECTIONMODEL_H
diff --git a/plugins/flake/textshape/kotext/KoTextCommandBase.h b/plugins/flake/textshape/kotext/KoTextCommandBase.h
index 88abb45309..3c060f8cfe 100644
--- a/plugins/flake/textshape/kotext/KoTextCommandBase.h
+++ b/plugins/flake/textshape/kotext/KoTextCommandBase.h
@@ -1,88 +1,88 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Boudewijn Rempt <boud@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_TEXT_COMMAND_BASE_H
#define KO_TEXT_COMMAND_BASE_H
#include <kundo2command.h>
#include "kritatext_export.h"
class KRITATEXT_EXPORT KoUndoableTool {
public:
virtual ~KoUndoableTool(){}
virtual void setAddUndoCommandAllowed(bool allowed) = 0;
};
/**
* Base class for all commands that work together with a tool that needs to handle undo/redo
* in a tricky way.
* Due to the fact that QTextDocument has its own undo queue we need to do some trickery
* to integrate that into the apps.
* If your command in some way changes the document, it will create unwanted undo commands in the undoStack
* unless you inherit from this class and simply implement your undo and redo like this:
@code
void MyCommand::redo() {
TextCommandBase::redo();
UndoRedoFinalizer finalizer(m_tool);
// rest code
}
void MyCommand::undo() {
TextCommandBase::undo();
UndoRedoFinalizer finalizer(m_tool);
// rest code
}
@endcode
* @see TextTool::addCommand()
*/
class KRITATEXT_EXPORT KoTextCommandBase : public KUndo2Command
{
public:
/// constructor
explicit KoTextCommandBase(KUndo2Command *parent);
- virtual ~KoTextCommandBase();
+ ~KoTextCommandBase() override;
/// method called by the tool.
void setTool(KoUndoableTool *tool);
// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
/// Sets the m_allowAddUndoCommand of the associated tool
void setAllow(bool set);
protected:
class KRITATEXT_EXPORT UndoRedoFinalizer
{
public:
explicit UndoRedoFinalizer(KoTextCommandBase* parent) : m_parent(parent) {}
~UndoRedoFinalizer();
private:
KoTextCommandBase* m_parent;
};
KoUndoableTool *m_tool;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextEditingPlugin.h b/plugins/flake/textshape/kotext/KoTextEditingPlugin.h
index 48a6348097..608107aad3 100644
--- a/plugins/flake/textshape/kotext/KoTextEditingPlugin.h
+++ b/plugins/flake/textshape/kotext/KoTextEditingPlugin.h
@@ -1,144 +1,144 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTEDITINGPLUGIN_H
#define KOTEXTEDITINGPLUGIN_H
#include <QObject>
#include <QHash>
#include "kritatext_export.h"
class QAction;
class QTextDocument;
class QTextCursor;
class QString;
/**
* This is a base class for a text editing plugin as used by the text tool.
* When the user types text into the text shape text editing plugins will be notified of
* changes in the text document. The plugin is meant to be for altering or checking text as the user
* types it,
* To ensure a good user experience this plugin will only be called when it makes sense from
* a users perspective.
* The finishedWord() method will be called when the user makes at least one change to
* a word and then moves the cursor out of the word, a similar approach happens with the
* finishedParagraph(), it will only be called after the cursor has been moved out of the paragraph.
*/
class KRITATEXT_EXPORT KoTextEditingPlugin : public QObject
{
Q_OBJECT
public:
/// constructor
KoTextEditingPlugin();
- virtual ~KoTextEditingPlugin();
+ ~KoTextEditingPlugin() override;
/**
* This method will be called when the user makes at least one change to
* a word and then moves the cursor out of the word.
* You are free to alter the word via the textDocument. Be aware that operations should be done
* via a QTextCursor and should retain any formatting already present on the text.
* @param document the text document that was altered.
* @param cursorPosition the last altered position in the word.
*/
virtual void finishedWord(QTextDocument *document, int cursorPosition) = 0;
/**
* This method will be called when the user makes at least one change to
* a paragraph and then moves the cursor out of the paragraph.
* You are free to alter the paragraph via the textDocument. Be aware that operations should be done
* via a QTextCursor and should retain any formatting already present on the text.
* Note that finishedWord() is always called just prior to the call to this method.
* @param document the text document that was altered.
* @param cursorPosition the last altered position in the paragraph.
*/
virtual void finishedParagraph(QTextDocument *document, int cursorPosition) = 0;
/**
* This method will be called just before the user makes at simple manual change to
* the text. Such as inserting a single character.
* This is for information only. You should not make any corrections to the text at this point
* @param document the text document that was altered.
* @param cursorPosition the last altered position in the paragraph.
*/
virtual void startingSimpleEdit(QTextDocument *document, int cursorPosition) = 0;
/**
* This method will be called when the user selects a portion of text and selects this plugin
* to handle it.
* You are free to alter the text via the textDocument. Be aware that operations should be done
* via a QTextCursor and should retain any formatting already present on the text.
* @param document the text document that was altered.
* @param startPosition the position at the start of the selection
* @param endPosition the position at the end of the selection
*/
virtual void checkSection(QTextDocument *document, int startPosition, int endPosition);
/// can be called when this plugin needs the current position of the textcursor
virtual void setCurrentCursorPosition(QTextDocument *document, int cursorPosition);
/**
* Retrieves the entire collection of actions for the plugin
*/
QHash<QString, QAction*> actions() const;
Q_SIGNALS:
/// emitted when a series of commands is started that together need to become 1 undo action.
void startMacro(const QString &name);
/// emitted when a series of commands has ended that together should be 1 undo action.
void stopMacro();
protected:
/**
* Helper method that allows you to easily get the word out of the document.
* This method will create a selection on the parameter cursor where the altered word
* is selected.
* Example usage:
* @code
QTextCursor cursor(document);
selectWord(cursor, cursorPosition);
QString word = cursor.selectedText();
* @endcode
* @param cursor the cursor to alter.
* @param cursorPosition the position of the cursor somewhere in the word.
*/
void selectWord(QTextCursor &cursor, int cursorPosition) const;
/**
* Helper method that allows you to easily get the text of the paragraph which
* holds the cursor position.
* Please realize that altering of the paragraph text should be done on a
* QTextCursor and not by altering the returned string. Doing so would loose
* all text formatting of the paragraph.
* @param document the document.
* @param cursorPosition the position of the cursor somewhere in the word.
*/
QString paragraph(QTextDocument *document, int cursorPosition) const;
/**
* Add an action under the given name to the action collection.
*
* @param name The name by which the action be retrieved again from the collection.
* @param action The action to add.
*/
void addAction(const QString &name, QAction *action);
private:
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextEditingRegistry.h b/plugins/flake/textshape/kotext/KoTextEditingRegistry.h
index a56c6ab6e0..1d8efa487f 100644
--- a/plugins/flake/textshape/kotext/KoTextEditingRegistry.h
+++ b/plugins/flake/textshape/kotext/KoTextEditingRegistry.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTEDITINGREGISTRY_H
#define KOTEXTEDITINGREGISTRY_H
#include <KoGenericRegistry.h>
#include <KoTextEditingFactory.h>
/**
* This singleton class keeps a register of all available text editing plugins.
* The text editing plugins are all about handling user input while (s)he
* is editing the text. A plugin can do near everything with the typed text,
* including altering it and adding markup. The plugin gives events when a
* word and when a paragraph has been finished. Which is ideal for autocorrection
* and autoreplacement of text.
* @see KoTextEditingFactory
* @see KoTextEditingPlugin
*/
class KRITATEXT_EXPORT KoTextEditingRegistry : public KoGenericRegistry<KoTextEditingFactory*>
{
public:
/**
* Return an instance of the KoTextEditingRegistry
* Creates an instance if that has never happened before and returns the singleton instance.
*/
KoTextEditingRegistry() {}
- virtual ~KoTextEditingRegistry();
+ ~KoTextEditingRegistry() override;
static KoTextEditingRegistry *instance();
private:
void init();
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextEditor.h b/plugins/flake/textshape/kotext/KoTextEditor.h
index 0fdf6a146b..33a4de7453 100644
--- a/plugins/flake/textshape/kotext/KoTextEditor.h
+++ b/plugins/flake/textshape/kotext/KoTextEditor.h
@@ -1,561 +1,561 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
* Copyright (C) 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2011-2012 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2014 Denis Kuplyakov <dener.kup@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTEDITOR_H
#define KOTEXTEDITOR_H
#include "kritatext_export.h"
#include <kundo2magicstring.h>
#include <KoGenChange.h>
#include <KoBorder.h>
#include <KoSection.h>
#include <QMetaType>
#include <QTextCursor>
#include <QTextFrame>
class KoListLevelProperties;
class KoCharacterStyle;
class KoInlineObject;
class KoParagraphStyle;
class KoInlineNote;
class KoInlineCite;
class KoBibliographyInfo;
class KoCanvasBase;
class KoTableOfContentsGeneratorInfo;
class KoShapeAnchor;
class KoShape;
class KoBookmark;
class KoAnnotation;
class KoTextRangeManager;
class KoTextVisitor;
class KUndo2Command;
class QTextBlock;
class QTextCharFormat;
class QTextBlockFormat;
class QTextDocument;
class QTextDocumentFragment;
class QString;
class QMimeData;
/**
* KoTextEditor is a wrapper around QTextCursor. It handles undo/redo and change
* tracking for all editing commands.
*/
class KRITATEXT_EXPORT KoTextEditor: public QObject
{
Q_OBJECT
public:
enum ChangeListFlag {
NoFlags = 0,
ModifyExistingList = 1,
MergeWithAdjacentList = 2,
MergeExactly = 4,
CreateNumberedParagraph = 8,
AutoListStyle = 16,
DontUnsetIfSame = 32 /// do not unset the current list style if it is already been set the same
};
Q_DECLARE_FLAGS(ChangeListFlags, ChangeListFlag)
explicit KoTextEditor(QTextDocument *document);
- virtual ~KoTextEditor();
+ ~KoTextEditor() override;
/**
* Retrieves the texteditor for the document of the first text shape in the current
* set of selected shapes on the given canvas.
*
* @param canvas the canvas we will check for a suitable selected shape.
* @returns a texteditor, or 0 if there is no shape active that has a QTextDocument as
* userdata
*/
static KoTextEditor *getTextEditorFromCanvas(KoCanvasBase *canvas);
public: // KoToolSelection overloads
/// returns true if the wrapped QTextCursor has a selection.
bool hasSelection() const;
/** returns true if the current cursor position is protected from editing
* @param cached use cached value if available.
*/
bool isEditProtected(bool useCached = false) const;
public:
bool operator!=(const QTextCursor &other) const;
bool operator<(const QTextCursor &other) const;
bool operator<=(const QTextCursor &other) const;
bool operator==(const QTextCursor &other) const;
bool operator>(const QTextCursor &other) const;
bool operator>=(const QTextCursor &other) const;
const QTextCursor constCursor() const;
private:
// for the call to KoTextLoader::loadBody, which has a QTextCursor
friend class KoTextPaste;
// from KoTextEditor_p.h
friend class CharFormatVisitor;
// our commands can have access to us
friend class DeleteTableRowCommand;
friend class DeleteTableColumnCommand;
friend class InsertTableRowCommand;
friend class InsertTableColumnCommand;
friend class ChangeTrackedDeleteCommand;
friend class DeleteCommand;
friend class InsertInlineObjectCommand;
friend class InsertNoteCommand;
friend class ParagraphFormattingCommand;
friend class RenameSectionCommand;
friend class NewSectionCommand;
friend class SplitSectionsCommand;
// for unittests
friend class TestKoInlineTextObjectManager;
// temporary...
friend class TextShape;
friend class TextTool;
/**
* This should be used only as read-only cursor or within a KUndo2Command sub-class which
* will be added to the textEditor with addCommand. For examples of proper implementation of
* such undoCommands, see the TextShape commands.
*/
QTextCursor* cursor();
public Q_SLOTS:
/// This adds the \ref command to the calligra undo stack.
///
/// From this point forward all text manipulation is placed in the qt text systems internal
/// undostack while also adding representative subcommands to \ref command.
///
/// The \ref command is not redone as part of this process.
///
/// Note: Be aware that many KoTextEditor methods start their own commands thus terminating
/// the recording of this \ref command. Only use QTextCursor manipulation (with all the issues
/// that brings) or only use KoTextEditor methods that don't start their own command.
///
/// The recording is automatically terminated when another command is added, which as mentioned
/// can happen by executing some of the KoTextEditor methods.
void addCommand(KUndo2Command *command);
/// This instantly "redo" the command thus placing all the text manipulation the "redo" does
/// (should be implemented with a "first redo" pattern) in the qt text systems internal
/// undostack while also adding representative subcommands to \ref command.
///
/// When \ref command is done "redoing" no further text manipulation is added as subcommands.
///
/// \ref command is not put on the calligra undo stack. That is the responsibility of the
/// caller, or the caller can choose to quickly undo and then delete the \ref command.
void instantlyExecuteCommand(KUndo2Command *command);
void registerTrackedChange(QTextCursor &selection, KoGenChange::Type changeType, const KUndo2MagicString &title, QTextFormat &format, QTextFormat &prevFormat, bool applyToWholeBlock = false);
void bold(bool bold);
void italic(bool italic);
void underline(bool underline);
void strikeOut(bool strikeOut);
void setHorizontalTextAlignment(Qt::Alignment align);
void setVerticalTextAlignment(Qt::Alignment align);
void increaseIndent();
void decreaseIndent();
void increaseFontSize();
void decreaseFontSize();
void setFontFamily(const QString &font);
void setFontSize(qreal size);
void setTextColor(const QColor &color);
void setTextBackgroundColor(const QColor &color);
void setStyle(KoParagraphStyle *style);
void setStyle(KoCharacterStyle *style);
void mergeAutoStyle(const QTextCharFormat &deltaCharFormat);
void applyDirectFormatting(const QTextCharFormat &deltaCharFormat, const QTextBlockFormat &deltaBlockFormat, const KoListLevelProperties &llp);
/**
* Insert an inlineObject (such as a variable) at the current cursor position. Possibly replacing the selection.
* @param inliner the object to insert.
* @param cmd a parent command for the commands created by this methods. If present, the commands
* will not be added to the document's undo stack automatically.
*/
void insertInlineObject(KoInlineObject *inliner, KUndo2Command *parent = 0);
/**
* update the position of all inline objects from the given start point to the given end point.
* @param start start position for updating. If 0, we update from the start of the document
* @param end end position for updating. If -1, we update to the end of the document
*/
void updateInlineObjectPosition(int start = 0, int end = -1);
/**
* Remove the KoShapeAnchor objects from the document.
*
* NOTE: Call this method only when the shapes belonging to the anchors have been deleted.
*/
void removeAnchors(const QList<KoShapeAnchor *> &anchors, KUndo2Command *parent);
/**
* Remove the KoAnnotation objects from the document.
*
* NOTE: Call this method only when the shapes belonging to the annotations have been deleted.
* This is not the way to delete annotations directly - instead delete the shape or
* delete the text containing the annotation
*/
void removeAnnotations(const QList<KoAnnotation *> &annotations, KUndo2Command *parent);
/**
* At the current cursor position, insert a marker that marks the next word as being part of the index.
* @returns returns the index marker when successful, or 0 if failed. Failure can be because there is no word
* at the cursor position or there already is an index marker available.
*/
KoInlineObject *insertIndexMarker();
/// add a bookmark on current cursor location or current selection
KoBookmark *addBookmark(const QString &name);
/// Add an annotation at the current cursor location or the current selection.
KoAnnotation *addAnnotation(KoShape *annotationShape);
KoTextRangeManager *textRangeManager() const;
/**
* Insert a frame break at the cursor position, moving the rest of the text to the next frame.
*/
void insertFrameBreak();
/**
* paste the given mimedata object at the current position
* @param canvas the canvas we used when placing the shape.
* @param mimeData: the mimedata containing text, html or odf
* @param pasteAsText: if true, paste without formatting
*/
void paste(KoCanvasBase *canvas, const QMimeData *mimeData, bool pasteAsText=false);
/**
* @param numberingEnabled when true, we will enable numbering for the current paragraph (block).
*/
void toggleListNumbering(bool numberingEnabled);
/**
* change the current block's list properties
*/
void setListProperties(const KoListLevelProperties &llp,
ChangeListFlags flags = ChangeListFlags(ModifyExistingList | MergeWithAdjacentList), KUndo2Command *parent = 0);
// -------------------------------------------------------------
// Wrapped QTextCursor methods
// -------------------------------------------------------------
int anchor() const;
bool atBlockEnd() const;
bool atBlockStart() const;
bool atEnd() const;
bool atStart() const;
QTextBlock block() const;
QTextCharFormat blockCharFormat() const;
QTextBlockFormat blockFormat() const;
int blockNumber() const;
QTextCharFormat charFormat() const;
void clearSelection();
int columnNumber() const;
void deleteChar();
void deletePreviousChar();
QTextDocument *document() const;
/// Same as Qt, only to be used inside KUndo2Commands
KUndo2Command *beginEditBlock(const KUndo2MagicString &title = KUndo2MagicString());
void endEditBlock();
/**
* Delete one character in the specified direction or a selection.
* Warning: From the outside this method should only be used with a parent command
* and only if there is a selection
* @param previous should be true if act like backspace
*/
void deleteChar(bool previous, KUndo2Command *parent = 0);
bool hasComplexSelection() const;
/**
* Insert a table at the current cursor position.
* @param rows the number of rows in the created table.
* @param columns the number of columns in the created table.
*/
void insertTable(int rows, int columns);
/**
* Insert a table row above the current cursor position (if in a table).
*/
void insertTableRowAbove();
/**
* Insert a table row below the current cursor position (if in a table).
*/
void insertTableRowBelow();
/**
* Insert a table column to the left of the current cursor position (if in a table).
*/
void insertTableColumnLeft();
/**
* Insert a table column to the right of the current cursor position (if in a table).
*/
void insertTableColumnRight();
/**
* Delete a table column where the cursor is (if in a table).
*/
void deleteTableColumn();
/**
* Delete a table row where the cursor is (if in a table).
*/
void deleteTableRow();
/**
* Merge table cells (selected by the cursor).
*/
void mergeTableCells();
/**
* Split table cells (selected by the cursor) that were previously merged.
*/
void splitTableCells();
/**
* Sets the width of a table column.
* @param table is the table to be adjusted.
* @param column the column that is to be adjusted.
*/
void adjustTableColumnWidth(QTextTable *table, int column, qreal width, KUndo2Command *parentCommand = 0);
/**
* Sets the height of a table row.
* @param table is the table to be adjusted.
* @param row the row that is to be adjusted.
*/
void adjustTableRowHeight(QTextTable *table, int row, qreal height, KUndo2Command *parentCommand = 0);
/**
* Changes the width of a table by adjusting the margins.
* @param table is the table to be adjusted.
* @param dLeft delta value for the left margin.
* @param dRight delta value for the right margin.
*/
void adjustTableWidth(QTextTable *table, qreal dLeft, qreal dRight);
/**
* Sets the border formatting of a side in a table cell.
* @param table is the table to be adjusted.
* @param column the column coordinate of the cell that is to be adjusted.
* @param row the row coordinate of the cell that is to be adjusted.
*/
void setTableBorderData(QTextTable *table, int row, int column, KoBorder::BorderSide cellSide,
const KoBorder::BorderData &data);
/**
* Insert a footnote at the current cursor position
* @return a pointer to the inserted footnote
*/
KoInlineNote *insertFootNote();
/**
* Insert an endnote at the current cursor position
* @return a pointer to the inserted endnote
*/
KoInlineNote *insertEndNote();
/**
* Insert a table of Contents at the current cursor position.
*/
void insertTableOfContents(KoTableOfContentsGeneratorInfo *info);
/**
* Configures various values of a ToC to the one passed in info
*/
void setTableOfContentsConfig(KoTableOfContentsGeneratorInfo *info, const QTextBlock &block);
void insertBibliography(KoBibliographyInfo *info);
KoInlineCite *insertCitation();
/**
* Inserts the supplied text at the current cursor position. If the second argument is
* supplied, a link is inserted at the current cursor position with the hRef as given
* by the user. To test whether the supplied link destination is a web url or a bookmark,
* a regular expression ( \\S+://\\S+ ) is used.
* @param text is the text to be inserted
* @param hRef if supplied is the Hypertext reference
*/
void insertText(const QString &text, const QString &hRef = QString());
void insertHtml(const QString &html);
void mergeBlockFormat( const QTextBlockFormat &modifier);
bool movePosition(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor, int n = 1);
/**
* Inserts a new paragraph and warps it to new section
* Source:
* some|textP
* Result:
* someP
* [|textP]
*
* [] -- section bounds
* | -- cursor зщышешщт
* P -- paragraph sign
*/
void newSection();
/**
* Splits sections startings and inserts paragraph between them.
* Source: {sectionIdToInsertBefore == 1}
* [[[sometext...
* ^
* 012
* Result:
* [P
* [[sometext...
*
* [] -- section bounds
* P -- paragraph sign
*/
void splitSectionsStartings(int sectionIdToInsertBefore);
/**
* Splits section endings and insert paragraph between them.
* Source: {sectionIdToInsertAfter == 1}
* sometext]]]
* ^
* 012
* Result:
* sometext]]P
* P]
*
* [] -- section bounds
* P -- paragraph sign
*/
void splitSectionsEndings(int sectionIdToInsertAfter);
void renameSection(KoSection *section, const QString &newName);
void newLine();
bool isWithinSelection(int position) const;
int position() const;
void select(QTextCursor::SelectionType selection);
QString selectedText() const;
QTextDocumentFragment selection() const;
int selectionEnd() const;
int selectionStart() const;
void setBlockFormat(const QTextBlockFormat &format);
void setCharFormat(const QTextCharFormat &format);
void setPosition(int pos, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor);
void setVisualNavigation(bool on);
bool visualNavigation() const;
const QTextFrame *currentFrame () const;
const QTextList *currentList () const;
const QTextTable *currentTable () const;
Q_SIGNALS:
void cursorPositionChanged();
void textFormatChanged();
void characterStyleApplied(KoCharacterStyle *style);
void paragraphStyleApplied(KoParagraphStyle *style);
protected:
void recursivelyVisitSelection(QTextFrame::iterator it, KoTextVisitor &visitor) const;
private:
Q_PRIVATE_SLOT(d, void documentCommandAdded())
class Private;
friend class Private;
Private* const d;
};
Q_DECLARE_METATYPE(KoTextEditor*)
Q_DECLARE_METATYPE(bool *)
Q_DECLARE_OPERATORS_FOR_FLAGS(KoTextEditor::ChangeListFlags)
#endif // KOTEXTEDITOR_H
diff --git a/plugins/flake/textshape/kotext/KoTextInlineRdf.h b/plugins/flake/textshape/kotext/KoTextInlineRdf.h
index 570f8ea95f..d9d748afdc 100644
--- a/plugins/flake/textshape/kotext/KoTextInlineRdf.h
+++ b/plugins/flake/textshape/kotext/KoTextInlineRdf.h
@@ -1,165 +1,165 @@
/* This file is part of the KDE project
Copyright (C) 2010 KO GmbH <ben.martin@kogmbh.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KO_TEXT_INLINE_RDF_H
#define KO_TEXT_INLINE_RDF_H
#include "kritatext_export.h"
// komain
#include <KoXmlReaderForward.h>
#include <KoElementReference.h>
// Qt
#include <QPair>
#include <QMetaType>
#include <QObject>
class KoXmlWriter;
class KoShapeSavingContext;
class KoBookmark;
class KoAnnotation;
class KoTextMeta;
class KoTextEditor;
class KoSection;
class QTextDocument;
class QTextCursor;
class QTextFormat;
class QTextBlock;
class QTextTableCell;
/**
* @short Store information from xhtml:property etc which are for inline Rdf
*
* @author Ben Martin <ben.martin@kogmbh.com>
* @see KoDocumentRdf
*
* The easiest way to handle inline Rdf from content.xml is to attach these
* objects to the document's C++ objects. As you can see from the constructors
* there are methods which can attach to bookmarks, textmeta, table cells etc.
*
* The main reason why the inlineRdf wants these document objects
* passed in is so that object() can work out what the current value
* is from the document. For example, when a KoTextInlineRdf is
* attached to a bookmark-start, then when object() is called the
* bookmark is inspected to find out the value currently between
* bookmark-start and bookmark-end.
*
* The xmlId() method returns the xml:id that was associated with the
* inline Rdf if there was one. For example,
* <bookmark-start xml:id="foo" xhtml:property="uri:baba" ...>
* the KoTextInlineRdf object will be attached to the KoBookmark
* for the bookmark-start location and xmlId() will return foo.
*
* You can convert one of these to a Soprano::Statement using
* KoDocumentRdf::toStatement().
*
* The attach() and tryToGetInlineRdf() are used by the ODF load and
* save codepaths respectively. They associate an inlineRdf object
* with the cursor and fetch back the inline Rdf if one is associated
* with a text block.
*
* FIXME: createXmlId() should consult with the Calligra codebase when
* generating new xml:id values during save.
*/
class KRITATEXT_EXPORT KoTextInlineRdf : public QObject
{
Q_OBJECT
public:
KoTextInlineRdf(const QTextDocument *doc, const QTextBlock &b);
KoTextInlineRdf(const QTextDocument *doc, KoBookmark *b);
KoTextInlineRdf(const QTextDocument *doc, KoAnnotation *b);
KoTextInlineRdf(const QTextDocument *doc, KoTextMeta *b);
KoTextInlineRdf(const QTextDocument *doc, const QTextTableCell &b);
KoTextInlineRdf(const QTextDocument *doc, KoSection *s);
- virtual ~KoTextInlineRdf();
+ ~KoTextInlineRdf() override;
/**
* The attach() and tryToGetInlineRdf() are used by the ODF load and
* save codepaths respectively. They associate an inlineRdf object
* with the cursor and fetch back the inline Rdf if one is associated
* with a text block.
*/
static KoTextInlineRdf *tryToGetInlineRdf(QTextCursor &cursor);
static KoTextInlineRdf *tryToGetInlineRdf(const QTextFormat &tf);
static KoTextInlineRdf *tryToGetInlineRdf(KoTextEditor *handler);
/**
* The attach() and tryToGetInlineRdf() are used by the ODF load and
* save codepaths respectively. They associate an inlineRdf object
* with the cursor and fetch back the inline Rdf if one is associated
* with a text block.
*/
static void attach(KoTextInlineRdf *inlineRdf, QTextCursor &cursor);
bool loadOdf(const KoXmlElement &element);
bool saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer, KoElementReference id = KoElementReference()) const;
/**
* Get the RDF subject for this inline RDF
*/
QString subject() const;
/**
* Get the RDF predicate for this inline RDF
*/
QString predicate() const;
/**
* Get the RDF object for this inline RDF
*/
QString object() const;
/**
* Get the type of RDF node (bnode, literal, uri etc) for this inline RDF
*/
int sopranoObjectType() const;
/**
* Because RDF is linked to the xml id attribute of elements in
* content.xml the xml:id attribute that was read from the
* content.xml file is available here
*/
QString xmlId() const;
/**
* Find the start and end position of this inline RDF object in the
* document.
*/
QPair<int, int> findExtent() const;
/**
* Update the xml:id, using during cut and paste as well as document save.
*/
void setXmlId(const QString &id);
/**
* Create a new and unique xml:id
*/
static QString createXmlId();
private:
friend class KoRdfSemanticItem;
friend class KoDocumentRdf;
class Private;
Private* const d;
};
Q_DECLARE_METATYPE(KoTextInlineRdf*)
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextLocator.h b/plugins/flake/textshape/kotext/KoTextLocator.h
index b7ff309184..9eca5d4043 100644
--- a/plugins/flake/textshape/kotext/KoTextLocator.h
+++ b/plugins/flake/textshape/kotext/KoTextLocator.h
@@ -1,72 +1,72 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTLOCATOR_H
#define KOTEXTLOCATOR_H
#include "KoInlineObject.h"
#include "kritatext_export.h"
class KoTextReference;
/**
* This inline object can be inserted in text to mark it and to later get location information from.
* After inserting this locator you can request things like pageNumber() and chapter() for the
* place where the locator has been positioned in the document.
*/
class KRITATEXT_EXPORT KoTextLocator : public KoInlineObject
{
Q_OBJECT
public:
/// constructor
KoTextLocator();
- virtual ~KoTextLocator();
+ ~KoTextLocator() override;
/// reimplemented from super
- virtual void updatePosition(const QTextDocument *document,
- int posInDocument, const QTextCharFormat &format);
+ void updatePosition(const QTextDocument *document,
+ int posInDocument, const QTextCharFormat &format) override;
/// reimplemented from super
- virtual void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ void resize(const QTextDocument *document, QTextInlineObject &object,
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
/// reimplemented from super
- virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
/// returns the text of the paragraph that is the first chapter before the index.
QString chapter() const;
/// return the page number on which the locator is placed.
int pageNumber() const;
/// return the position in the text document at which the locator is inserted.
int indexPosition() const;
/// return the word in which the locator is inserted.
QString word() const;
/// Add a text reference that is interrested in knowing when this locator is laid-out in a differen position.
void addListener(KoTextReference *reference);
/// Remove a reference from the listeners.
void removeListener(KoTextReference *reference);
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
- virtual void saveOdf(KoShapeSavingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
+ void saveOdf(KoShapeSavingContext &context) override;
private:
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextMeta.h b/plugins/flake/textshape/kotext/KoTextMeta.h
index 1b449d7859..7d224feac7 100644
--- a/plugins/flake/textshape/kotext/KoTextMeta.h
+++ b/plugins/flake/textshape/kotext/KoTextMeta.h
@@ -1,81 +1,81 @@
/* This file is part of the KDE project
* Copyright (C) 2010 KO GmbH <ben.martin@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTMETA_H
#define KOTEXTMETA_H
#include "KoInlineObject.h"
#include "kritatext_export.h"
/**
* Used to indicate an ODF text:meta container. This is very similar to a KoBookmark
* in that a specific start-end is marked.
*/
class KRITATEXT_EXPORT KoTextMeta : public KoInlineObject
{
Q_OBJECT
public:
enum BookmarkType {
StartBookmark, ///< start position
EndBookmark ///< end position
};
/**
* Constructor
* @param name the name for this bookmark
* @param document the text document where this bookmark is located
*/
explicit KoTextMeta(const QTextDocument *document);
- virtual ~KoTextMeta();
+ ~KoTextMeta() override;
/// reimplemented from super
- void saveOdf(KoShapeSavingContext &context);
- bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ void saveOdf(KoShapeSavingContext &context) override;
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// reimplemented from super
- virtual void updatePosition(const QTextDocument *document,
- int posInDocument, const QTextCharFormat &format);
+ void updatePosition(const QTextDocument *document,
+ int posInDocument, const QTextCharFormat &format) override;
/// reimplemented from super
- virtual void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ void resize(const QTextDocument *document, QTextInlineObject &object,
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
/// reimplemented from super
- virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
void setType(BookmarkType type);
/// @return the current type of this bookmark
BookmarkType type() const;
void setEndBookmark(KoTextMeta *bookmark);
/// @return the end bookmark if the type is StartBookmark
KoTextMeta* endBookmark() const;
/// @return the exact cursor position of this bookmark in document
int position() const;
private:
class Private; // TODO share the private with super
Private *const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextOdfSaveHelper.h b/plugins/flake/textshape/kotext/KoTextOdfSaveHelper.h
index b982b99215..9d57ff50d3 100644
--- a/plugins/flake/textshape/kotext/KoTextOdfSaveHelper.h
+++ b/plugins/flake/textshape/kotext/KoTextOdfSaveHelper.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTODFSAVEHELPER_H
#define KOTEXTODFSAVEHELPER_H
#include <KoDragOdfSaveHelper.h>
#ifdef SHOULD_BUILD_RDF
#include <Soprano/Soprano>
#include <QSharedPointer>
#endif
#include "kritatext_export.h"
class QTextDocument;
class KoStyleManager;
class KRITATEXT_EXPORT KoTextOdfSaveHelper : public KoDragOdfSaveHelper
{
public:
KoTextOdfSaveHelper(const QTextDocument *document, int from, int to);
- virtual ~KoTextOdfSaveHelper();
+ ~KoTextOdfSaveHelper() override;
/// reimplemented
- virtual bool writeBody();
+ bool writeBody() override;
- virtual KoShapeSavingContext *context(KoXmlWriter *bodyWriter, KoGenStyles &mainStyles, KoEmbeddedDocumentSaver &embeddedSaver);
+ KoShapeSavingContext *context(KoXmlWriter *bodyWriter, KoGenStyles &mainStyles, KoEmbeddedDocumentSaver &embeddedSaver) override;
#ifdef SHOULD_BUILD_RDF
/**
* The Rdf Model ownership is not taken, you must still delete it,
* and you need to ensure that it lives longer than this object
* unless you reset the model to 0.
*/
void setRdfModel(QSharedPointer<Soprano::Model> m);
QSharedPointer<Soprano::Model> rdfModel() const;
#endif
KoStyleManager *styleManager() const;
private:
struct Private;
Private * const d;
};
#endif /* KOTEXTODFSAVEHELPER_H */
diff --git a/plugins/flake/textshape/kotext/KoTextRange.h b/plugins/flake/textshape/kotext/KoTextRange.h
index d0f1e40d70..05668f12f5 100644
--- a/plugins/flake/textshape/kotext/KoTextRange.h
+++ b/plugins/flake/textshape/kotext/KoTextRange.h
@@ -1,128 +1,128 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTRANGE_H
#define KOTEXTRANGE_H
#include "kritatext_export.h"
#include <QObject>
#include <KoXmlReaderForward.h>
class QTextDocument;
class QTextCursor;
class KoTextRangeManager;
class KoTextRangePrivate;
class KoShapeSavingContext;
class KoTextInlineRdf;
class KoShapeLoadingContext;
/**
* Base class for all text ranges.
*
* They are essentially anchored to a specific position or range in the text
*
* @see KoTextRangeManager
*/
class KRITATEXT_EXPORT KoTextRange : public QObject
{
Q_OBJECT
public:
enum TagType {StartTag = 0, EndTag = 1};
/**
* constructor
*/
explicit KoTextRange(const QTextCursor &cursor);
- virtual ~KoTextRange();
+ ~KoTextRange() override;
/**
* Will be called by the manager when this variable is added.
* Remember that inheriting classes should not use the manager() in the constructor, since it will be 0
* @param manager the object manager for this object.
*/
void setManager(KoTextRangeManager *manager);
/**
* Return the object manager set on this inline object.
*/
KoTextRangeManager *manager() const;
/**
* Return the textdocument the range points to.
*/
QTextDocument *document() const;
/**
* Save the part of this text range corresponding to position as ODF
* This may save a beginning tag, ending tag, or nothing at all
* @param context the context for saving.
* @param position a position in the qtextdocument we are currently saving for.
* @param tagType the type of tag we are interested in
*/
virtual void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const = 0;
bool positionOnlyMode() const;
void setPositionOnlyMode(bool m);
bool hasRange() const;
int rangeStart() const;
int rangeEnd() const;
void setRangeStart(int position);
void setRangeEnd(int position);
QString text() const;
/**
* A text range might have some Rdf metadata associated with it
* in content.xml
* Ownership of the rdf object is taken by the text range, and you should not
* delete it.
*/
void setInlineRdf(KoTextInlineRdf *rdf);
/**
* Get any Rdf which was stored in content.xml for this text range
*/
KoTextInlineRdf *inlineRdf() const;
/**
* Load a variable from odf.
*
* @param element element which represents the shape in odf
* @param context the KoShapeLoadingContext used for loading
*
* @return false if loading failed
*/
virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) = 0;
void snapshot();
void restore();
protected:
KoTextRangePrivate *d_ptr;
private:
Q_DECLARE_PRIVATE(KoTextRange)
};
KRITATEXT_EXPORT QDebug operator<<(QDebug dbg, const KoTextRange *o);
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextRangeManager.h b/plugins/flake/textshape/kotext/KoTextRangeManager.h
index 024833ae36..188d66818c 100644
--- a/plugins/flake/textshape/kotext/KoTextRangeManager.h
+++ b/plugins/flake/textshape/kotext/KoTextRangeManager.h
@@ -1,86 +1,86 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (c) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTRANGEMANAGER_H
#define KOTEXTRANGEMANAGER_H
#include "KoBookmarkManager.h"
#include "KoAnnotationManager.h"
#include "KoTextRange.h"
#include "kritatext_export.h"
// Qt + kde
#include <QMetaType>
#include <QHash>
#include <QSet>
/**
* A container to register all the text ranges with.
*/
class KRITATEXT_EXPORT KoTextRangeManager : public QObject
{
Q_OBJECT
public:
/// Constructor
explicit KoTextRangeManager(QObject *parent = 0);
- virtual ~KoTextRangeManager();
+ ~KoTextRangeManager() override;
QList<KoTextRange *> textRanges() const;
/**
* Insert a new text range into the manager.
* @param object the text range to be inserted.
*/
void insert(KoTextRange *object);
/**
* Remove a text range from this manager.
* @param range the text range to be removed
*/
void remove(KoTextRange *range);
/**
* Return the bookmark manager.
*/
const KoBookmarkManager *bookmarkManager() const;
/**
* Return the annotation manager.
*/
const KoAnnotationManager *annotationManager() const;
/**
* Return a multi hash of KoTextRange that have start or end points between first and last
* If the text range is a selection then the opposite end has to be within matchFirst and
* matchLast.
* Single position text ranges is only added once to the hash
*/
QHash<int, KoTextRange *> textRangesChangingWithin(const QTextDocument *, int first, int last, int matchFirst, int matchLast) const;
private:
QSet<KoTextRange *> m_textRanges;
QSet<KoTextRange *> m_deletedTextRanges; // kept around for undo purposes
KoBookmarkManager m_bookmarkManager;
KoAnnotationManager m_annotationManager;
};
Q_DECLARE_METATYPE(KoTextRangeManager *)
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextReference.h b/plugins/flake/textshape/kotext/KoTextReference.h
index 39ea4a4a2b..5fb2ccd5c3 100644
--- a/plugins/flake/textshape/kotext/KoTextReference.h
+++ b/plugins/flake/textshape/kotext/KoTextReference.h
@@ -1,58 +1,58 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTREFERENCE_H
#define KOTEXTREFERENCE_H
#include "KoVariable.h"
class KoTextLocator;
/**
* This variable displays information about a text reference.
* A user can insert characters that are called locators. And are represented by a KoTextLocator
* the user can then insert (several) KoTextReference variables that will update the textual description
* of the locator whenever text is re-layouted.
* This effectively means that the reference will print the page number (for example) of where the
* locator is and keep it updated automatically.
*/
class KoTextReference : public KoVariable
{
public:
/**
* Constructor; please don't use directly as the KoInlineTextObjectManager will supply an action
* to create one.
* @param indexId the index of the inline object that is the locator. See KoInlineObject::id()
*/
explicit KoTextReference(int indexId);
- ~KoTextReference();
+ ~KoTextReference() override;
- virtual void variableMoved(const QTextDocument *document, int posInDocument);
- virtual void setup();
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
- virtual void saveOdf(KoShapeSavingContext &context);
+ void variableMoved(const QTextDocument *document, int posInDocument) override;
+ void setup() override;
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
+ void saveOdf(KoShapeSavingContext &context) override;
private:
KoTextLocator *locator();
int m_indexId;
// TODO store a config of what we actually want to show. The hardcoded pagenumber is not enough.
// we want 'section' / chapter name/number and maybe word. All in a nice formatted text.
// see also the ODF spec.
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoTextShapeSavingContext.h b/plugins/flake/textshape/kotext/KoTextShapeSavingContext.h
index 16eb0dc1b6..4041fc90ad 100644
--- a/plugins/flake/textshape/kotext/KoTextShapeSavingContext.h
+++ b/plugins/flake/textshape/kotext/KoTextShapeSavingContext.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
Copyright (C) 2008 Pierre Stirnweiss \pierre.stirnweiss_calligra@gadz.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAPESAVINGCONTEXT_H
#define KOTEXTSHAPESAVINGCONTEXT_H
#include "kritatext_export.h"
#include <KoShapeSavingContext.h>
class KoGenChanges;
/**
* The set of data for the ODF file format used during saving of a shape.
*/
class KRITATEXT_EXPORT KoTextShapeSavingContext : public KoShapeSavingContext
{
public:
/**
* @brief Constructor
* @param xmlWriter used for writing the xml
* @param mainStyles for saving the styles
* @param embeddedSaver for saving embedded documents
* @param changes for saving the tracked changes
*/
KoTextShapeSavingContext(KoXmlWriter &xmlWriter, KoGenStyles& mainStyles,
KoEmbeddedDocumentSaver& embeddedSaver, KoGenChanges& changes);
- virtual ~KoTextShapeSavingContext();
+ ~KoTextShapeSavingContext() override;
/**
* @brief Get the changes (tracked)
*
* @return changes (tracked)
*/
KoGenChanges & changes();
private:
KoGenChanges& m_changes;
};
#endif // KOTEXTSHAPESAVINGCONTEXT_H
diff --git a/plugins/flake/textshape/kotext/KoTextSoftPageBreak.h b/plugins/flake/textshape/kotext/KoTextSoftPageBreak.h
index 9e96914127..62c4fe9a74 100644
--- a/plugins/flake/textshape/kotext/KoTextSoftPageBreak.h
+++ b/plugins/flake/textshape/kotext/KoTextSoftPageBreak.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSOFTPAGEBREAK_H
#define KOTEXTSOFTPAGEBREAK_H
#include "KoInlineObject.h"
#include "kritatext_export.h"
/**
* This class defines a soft page break as defined in odf
* <text:soft-page-break>
*
* The class does not have members as it's presence is enough.
*/
class KRITATEXT_EXPORT KoTextSoftPageBreak : public KoInlineObject
{
Q_OBJECT
public:
KoTextSoftPageBreak();
- virtual ~KoTextSoftPageBreak();
+ ~KoTextSoftPageBreak() override;
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
- virtual void saveOdf(KoShapeSavingContext &context);
+ void saveOdf(KoShapeSavingContext &context) override;
- virtual void updatePosition(const QTextDocument *document,
- int posInDocument, const QTextCharFormat &format);
+ void updatePosition(const QTextDocument *document,
+ int posInDocument, const QTextCharFormat &format) override;
- virtual void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ void resize(const QTextDocument *document, QTextInlineObject &object,
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
- virtual void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
};
#endif /* KOTEXTSOFTPAGEBREAK_H */
diff --git a/plugins/flake/textshape/kotext/KoTextTableTemplate.h b/plugins/flake/textshape/kotext/KoTextTableTemplate.h
index 821882d040..ab0e0f8957 100644
--- a/plugins/flake/textshape/kotext/KoTextTableTemplate.h
+++ b/plugins/flake/textshape/kotext/KoTextTableTemplate.h
@@ -1,118 +1,118 @@
/* This file is part of the KDE project
* Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTTABLETEMPLATE_H
#define KOTEXTTABLETEMPLATE_H
#include "kritatext_export.h"
#include <QObject>
#include <KoXmlReaderForward.h>
class KoXmlWriter;
class KoShapeLoadingContext;
class KoTextSharedSavingData;
class KRITATEXT_EXPORT KoTextTableTemplate : public QObject
{
public:
enum Property {
StyleId = 0,
BackGround,
Body,
EvenColumns,
EvenRows,
FirstColumn,
FirstRow,
LastColumn,
LastRow,
OddColumns,
OddRows
};
int background() const;
void setBackground(int styleId);
int body() const;
void setBody(int styleId);
int evenColumns() const;
void setEvenColumns(int styleId);
int evenRows() const;
void setEvenRows(int styleId);
int firstColumn() const;
void setFirstColumn(int styleId);
int firstRow() const;
void setFirstRow(int styleId);
int lastColumn() const;
void setLastColumn(int styleId);
int lastRow() const;
void setLastRow(int styleId);
int oddColumns() const;
void setOddColumns(int styleId);
int oddRows() const;
void setOddRows(int styleId);
/// Constructor
explicit KoTextTableTemplate(QObject *parent = 0);
/// Destructor
- ~KoTextTableTemplate();
+ ~KoTextTableTemplate() override;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/**
* Load the template style from the element
*
* @param context the odf loading context
* @param element the element containing the
*/
void loadOdf(const KoXmlElement *element, KoShapeLoadingContext &context);
/**
* save the table-template element
*/
void saveOdf(KoXmlWriter *writer, KoTextSharedSavingData *savingData) const;
private:
class Private;
Private * const d;
};
#endif //KOTEXTTABLETEMPLATE_H
diff --git a/plugins/flake/textshape/kotext/KoVariable.h b/plugins/flake/textshape/kotext/KoVariable.h
index e7bc5e9021..9c04f71038 100644
--- a/plugins/flake/textshape/kotext/KoVariable.h
+++ b/plugins/flake/textshape/kotext/KoVariable.h
@@ -1,110 +1,110 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __KOVARIABLE_H__
#define __KOVARIABLE_H__
// Calligra libs
#include "KoInlineObject.h"
#include "kritatext_export.h"
class KoProperties;
class QWidget;
class KoVariableManager;
class KoVariablePrivate;
/**
* Base class for in-text variables.
*
* A variable is a field inserted into the text and the content is set to a specific value that
* is used as text. This class is pretty boring in that it has just a setValue() to alter the
* text shown; we depend on plugin writers to create more exciting ways to update variables.
*/
class KRITATEXT_EXPORT KoVariable : public KoInlineObject
{
Q_OBJECT
public:
/**
* Constructor.
*/
explicit KoVariable(bool propertyChangeListener = false);
- virtual ~KoVariable();
+ ~KoVariable() override;
/**
* The new value this variable will show.
* Will be used at the next repaint.
* @param value the new value this variable shows.
*/
void setValue(const QString &value);
/// @return the current value of this variable.
QString value() const;
/**
* Shortly after instantiating this variable the factory should set the
* properties using this method.
* Note that the loading mechanism will fill this properties object with the
* attributes from the ODF file (if applicable), so it would be useful to synchronize
* the property names based on that.
*/
virtual void setProperties(const KoProperties *props) {
Q_UNUSED(props);
}
/**
* If this variable has user-editable options it should provide a widget that is capable
* of manipulating these options so the text-tool can use it to show that to the user.
* Note that all manipulations should have a direct effect on the variable itself.
*/
virtual QWidget *createOptionsWidget() {
return 0;
}
protected:
/**
* This hook is called whenever the variable gets a new position.
* If this is a type of variable that needs to change its value based on that
* you should implement this method and act on it.
*/
virtual void variableMoved(const QTextDocument *document, int posInDocument);
friend class KoVariableManager;
/**
* return the last known position in the document. Note that if the variable has not yet been layouted,
* it does not know the position.
*/
int positionInDocument() const;
/// reimplemented
void resize(const QTextDocument *document, QTextInlineObject &object,
- int posInDocument, const QTextCharFormat &format, QPaintDevice *pd);
+ int posInDocument, const QTextCharFormat &format, QPaintDevice *pd) override;
private:
void updatePosition(const QTextDocument *document,
- int posInDocument, const QTextCharFormat &format);
+ int posInDocument, const QTextCharFormat &format) override;
void paint(QPainter &painter, QPaintDevice *pd, const QTextDocument *document,
- const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format);
+ const QRectF &rect, const QTextInlineObject &object, int posInDocument, const QTextCharFormat &format) override;
private Q_SLOTS:
void documentDestroyed();
private:
Q_DECLARE_PRIVATE(KoVariable)
};
#endif
diff --git a/plugins/flake/textshape/kotext/KoVariableManager.h b/plugins/flake/textshape/kotext/KoVariableManager.h
index 6bdb5cbbe7..7b4de38fd0 100644
--- a/plugins/flake/textshape/kotext/KoVariableManager.h
+++ b/plugins/flake/textshape/kotext/KoVariableManager.h
@@ -1,126 +1,126 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2008, 2011 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2011 Robert Mathias Marmorstein <robert@narnia.homeunix.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOVARIABLEMANAGER_H
#define KOVARIABLEMANAGER_H
#include "kritatext_export.h"
#include <QObject>
#include <QString>
#include <KoXmlReaderForward.h>
class KoXmlWriter;
class KoVariable;
class KoInlineTextObjectManager;
class KoVariableManagerPrivate;
/**
* A document can maintain a list of name-value pairs, which we call variables.
* These initially exist solely in the variableManager as such name/value pairs
* and can be managed by setValue(), value() and remove().
* When the user chooses to use one of these pairs in the text-document they can create a
* new KoNamedVariable by calling KoVariableManager::createVariable()
* use that and insert that into the text-document.
* Changing the value will lead to directly change the value of all variables
* inserted into the document.
* @see KoInlineTextObjectManager::createInsertVariableActions()
* @see KoInlineTextObjectManager::variableManager()
*/
class KRITATEXT_EXPORT KoVariableManager : public QObject
{
Q_OBJECT
public:
/// constructor
explicit KoVariableManager(KoInlineTextObjectManager *inlineObjectManager);
- ~KoVariableManager();
+ ~KoVariableManager() override;
/**
* Set or create a variable to the new value.
* @param name the name of the variable.
* @param value the new value.
* @param type The type of the value. This is only set for user-defined variables.
* For non user defined variables the value is empty. If set then it should be one
* of the following values;
* \li string
* \li boolean
* \li currency
* \li date
* \li float
* \li percentage
* \li time
* \li void
* \li formula
*/
void setValue(const QString &name, const QString &value, const QString &type = QString());
/**
* Remove a variable from the store.
* Variables that were created and inserted into text will no longer get updated, but will keep
* showing the proper text.
* @see usageCount()
*/
void remove(const QString &name);
/**
* Return the value a named variable currently has. Or an empty string if none.
*/
QString value(const QString &name) const;
/**
* Return the type of a user defined variable. If the variable does not exist or
* is not a user defined variable then an empty string is returned.
*/
QString userType(const QString &name) const;
/**
* Create a new variable that can be inserted into the document using
* KoInlineTextObjectManager::insertInlineObject()
* This is a factory method that creates a visible variable object of an already existing
* name/value pair previously inserted into the manager.
* @param name the named variable.
* @return the new variable, or 0 when the name was not previously set on this manager
* @see setValue()
*/
KoVariable *createVariable(const QString &name) const;
/// return a list of all variable names.
QList<QString> variables() const;
/// return a list of all user defined variable names.
QList<QString> userVariables() const;
/**
* Load user defined variable declarations from the ODF body-element.
*/
void loadOdf(const KoXmlElement &bodyElement);
/**
* Save user defined variable declarations into the ODF writer.
*/
void saveOdf(KoXmlWriter *bodyWriter);
Q_SIGNALS:
void valueChanged();
private:
KoVariableManagerPrivate * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/OdfTextTrackStyles.h b/plugins/flake/textshape/kotext/OdfTextTrackStyles.h
index b6d174823c..82cc4a06ed 100644
--- a/plugins/flake/textshape/kotext/OdfTextTrackStyles.h
+++ b/plugins/flake/textshape/kotext/OdfTextTrackStyles.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGEFOLLOWER_H
#define CHANGEFOLLOWER_H
#include "commands/ChangeStylesMacroCommand.h"
#include <KoStyleManager.h>
#include <QObject>
#include <QWeakPointer>
#include <QSet>
#include <QTextDocument>
/**
* OdfTextTrackStyles is used to update a list of qtextdocument with
* any changes made in the style manager.
*
* It also creates undo commands and adds them to the undo stack
*
* Style changes affect a lot of qtextdocuments and we store the changes and apply
* the changes to every qtextdocument, so every KoTextDocument has to
* register their QTextDocument to us.
*
* We use the QObject principle of children getting deleted when the
* parent gets deleted. Thus we die when the KoStyleManager dies.
*/
class OdfTextTrackStyles : public QObject
{
Q_OBJECT
public:
static OdfTextTrackStyles *instance(KoStyleManager *manager);
private:
static QMap<QObject *, OdfTextTrackStyles *> instances;
OdfTextTrackStyles(KoStyleManager *manager);
/// Destructor, called when the parent is deleted.
- ~OdfTextTrackStyles();
+ ~OdfTextTrackStyles() override;
private Q_SLOTS:
void beginEdit();
void endEdit();
void recordStyleChange(int id, const KoParagraphStyle *origStyle, const KoParagraphStyle *newStyle);
void recordStyleChange(int id, const KoCharacterStyle *origStyle, const KoCharacterStyle *newStyle);
void styleManagerDied(QObject *manager);
void documentDied(QObject *manager);
public:
void registerDocument(QTextDocument *qDoc);
void unregisterDocument(QTextDocument *qDoc);
private:
QList<QTextDocument *> m_documents;
QWeakPointer<KoStyleManager> m_styleManager;
ChangeStylesMacroCommand *m_changeCommand;
};
#endif
diff --git a/plugins/flake/textshape/kotext/ToCBibGeneratorInfo.h b/plugins/flake/textshape/kotext/ToCBibGeneratorInfo.h
index f0e2a764b4..8fea2cd403 100644
--- a/plugins/flake/textshape/kotext/ToCBibGeneratorInfo.h
+++ b/plugins/flake/textshape/kotext/ToCBibGeneratorInfo.h
@@ -1,186 +1,186 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Smit Patel <smitpatel24@gmail.com>
* Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TOCBIBGENERATORINFO_H
#define TOCBIBGENERATORINFO_H
#include <KoText.h>
const int INVALID_OUTLINE_LEVEL = 0;
class KoXmlWriter;
class KRITATEXT_EXPORT IndexEntry
{
public:
enum IndexEntryName {UNKNOWN, LINK_START, CHAPTER, SPAN, TEXT, TAB_STOP, PAGE_NUMBER, LINK_END, BIBLIOGRAPHY};
explicit IndexEntry(const QString &_styleName, IndexEntryName _name = IndexEntry::UNKNOWN);
virtual IndexEntry *clone();
virtual ~IndexEntry();
virtual void addAttributes(KoXmlWriter * writer) const;
void saveOdf(KoXmlWriter * writer) const;
QString styleName;
IndexEntryName name;
};
class IndexEntryLinkStart : public IndexEntry
{
public:
explicit IndexEntryLinkStart(const QString &_styleName);
- IndexEntry *clone();
+ IndexEntry *clone() override;
};
class IndexEntryChapter : public IndexEntry
{
public:
explicit IndexEntryChapter(const QString &_styleName);
- IndexEntry *clone();
- virtual void addAttributes(KoXmlWriter* writer) const;
+ IndexEntry *clone() override;
+ void addAttributes(KoXmlWriter* writer) const override;
QString display;
int outlineLevel;
};
class KRITATEXT_EXPORT IndexEntrySpan : public IndexEntry
{
public:
explicit IndexEntrySpan(const QString &_styleName);
- IndexEntry *clone();
- virtual void addAttributes(KoXmlWriter* writer) const;
+ IndexEntry *clone() override;
+ void addAttributes(KoXmlWriter* writer) const override;
QString text;
};
class IndexEntryText : public IndexEntry
{
public:
explicit IndexEntryText(const QString &_styleName);
- IndexEntry *clone();
+ IndexEntry *clone() override;
};
class KRITATEXT_EXPORT IndexEntryTabStop : public IndexEntry
{
public:
explicit IndexEntryTabStop(const QString &_styleName);
- IndexEntry *clone();
- virtual void addAttributes(KoXmlWriter* writer) const;
+ IndexEntry *clone() override;
+ void addAttributes(KoXmlWriter* writer) const override;
// for saving let's save the original unit,
// for KoText::Tab we need to convert to PostScript points
void setPosition(const QString &position);
KoText::Tab tab;
QString m_position;
};
class IndexEntryPageNumber : public IndexEntry
{
public:
explicit IndexEntryPageNumber(const QString &_styleName);
- IndexEntry *clone();
+ IndexEntry *clone() override;
};
class IndexEntryLinkEnd : public IndexEntry
{
public:
explicit IndexEntryLinkEnd(const QString &_styleName);
- IndexEntry *clone();
+ IndexEntry *clone() override;
};
class KRITATEXT_EXPORT TocEntryTemplate
{
public:
TocEntryTemplate();
TocEntryTemplate(const TocEntryTemplate &other);
void saveOdf(KoXmlWriter * writer) const;
int outlineLevel;
QString styleName;
int styleId;
QList<IndexEntry*> indexEntries;
};
class KRITATEXT_EXPORT IndexTitleTemplate
{
public:
void saveOdf(KoXmlWriter * writer) const;
QString styleName;
int styleId;
QString text;
};
class KRITATEXT_EXPORT IndexSourceStyle
{
public:
IndexSourceStyle(const IndexSourceStyle& indexSourceStyle);
IndexSourceStyle();
void saveOdf(KoXmlWriter * writer) const;
QString styleName;
int styleId;
};
class KRITATEXT_EXPORT IndexSourceStyles
{
public:
IndexSourceStyles();
IndexSourceStyles(const IndexSourceStyles &indexSourceStyles);
void saveOdf(KoXmlWriter * writer) const;
int outlineLevel;
QList<IndexSourceStyle> styles;
};
class KRITATEXT_EXPORT IndexEntryBibliography : public IndexEntry
{
public:
explicit IndexEntryBibliography(const QString &_styleName);
- IndexEntry *clone();
- virtual void addAttributes(KoXmlWriter* writer) const;
+ IndexEntry *clone() override;
+ void addAttributes(KoXmlWriter* writer) const override;
QString dataField;
};
class KRITATEXT_EXPORT BibliographyEntryTemplate
{
public:
BibliographyEntryTemplate();
BibliographyEntryTemplate(const BibliographyEntryTemplate &other);
void saveOdf(KoXmlWriter * writer) const;
QString styleName;
int styleId;
QList<IndexEntry*> indexEntries;
QString bibliographyType;
};
Q_DECLARE_METATYPE(IndexEntry::IndexEntryName)
#endif // TOCBIBGENERATORINFO_H
diff --git a/plugins/flake/textshape/kotext/changetracker/KoChangeTracker.h b/plugins/flake/textshape/kotext/changetracker/KoChangeTracker.h
index 0447dc5c8a..850b51a039 100644
--- a/plugins/flake/textshape/kotext/changetracker/KoChangeTracker.h
+++ b/plugins/flake/textshape/kotext/changetracker/KoChangeTracker.h
@@ -1,134 +1,134 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Pierre Stirnweiss <pierre.stirnweiss_calligra@gadz.org>
* Copyright (C) 2011 Boudewijn Rempt <boud@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCHANGETRACKER_H
#define KOCHANGETRACKER_H
#include "kritatext_export.h"
#include <KoXmlReaderForward.h>
#include <QObject>
#include <QMetaType>
#include <QVector>
#include <KoGenChange.h>
class KUndo2MagicString;
class KoGenChanges;
class KoChangeTrackerElement;
class KoFormatChangeInformation;
class QTextCursor;
class QTextFormat;
class QString;
class QTextDocumentFragment;
class QTextList;
class KRITATEXT_EXPORT KoChangeTracker : public QObject
{
Q_OBJECT
public:
enum ChangeSaveFormat {
ODF_1_2 = 0,
DELTAXML,
UNKNOWN = 9999
};
explicit KoChangeTracker(QObject *parent = 0);
- ~KoChangeTracker();
+ ~KoChangeTracker() override;
void setRecordChanges(bool enabled);
bool recordChanges() const;
void setDisplayChanges(bool enabled);
bool displayChanges() const;
/// XXX: these three are called "getXXX" but do change the state of the change tracker
int getFormatChangeId(const KUndo2MagicString &title, const QTextFormat &format, const QTextFormat &prevFormat, int existingChangeId);
int getInsertChangeId(const KUndo2MagicString &title, int existingChangeId);
int getDeleteChangeId(const KUndo2MagicString &title, const QTextDocumentFragment &selection, int existingChangeId);
void setFormatChangeInformation(int formatChangeId, KoFormatChangeInformation *formatInformation);
KoFormatChangeInformation *formatChangeInformation(int formatChangeId) const;
KoChangeTrackerElement* elementById(int id) const;
bool removeById(int id, bool freeMemory = true);
//Returns all the deleted changes
int getDeletedChanges(QVector<KoChangeTrackerElement *>& deleteVector) const;
bool containsInlineChanges(const QTextFormat &format) const;
int mergeableId(KoGenChange::Type type, const KUndo2MagicString &title, int existingId) const;
QColor getInsertionBgColor() const;
QColor getDeletionBgColor() const;
QColor getFormatChangeBgColor() const;
void setInsertionBgColor(const QColor& bgColor);
void setDeletionBgColor(const QColor& color);
void setFormatChangeBgColor(const QColor& color);
/// Splits a changeElement. This creates a duplicate changeElement with a different changeId. This is used because we do not support overlapping change regions. The function returns the new changeId
int split(int changeId);
bool isParent(int testedParentId, int testedChildId) const;
void setParent(int child, int parent);
int parent(int changeId) const;
int createDuplicateChangeId(int existingChangeId);
bool isDuplicateChangeId(int duplicateChangeId) const;
int originalChangeId(int duplicateChangeId) const;
void acceptRejectChange(int changeId, bool set);
/// Load/save methods
bool saveInlineChange(int changeId, KoGenChange &change);
/**
* @brief saveInlineChanges saves all the changes in the internal map, except
* for the delete changes, which are changed independently using saveInlineChange.
* @return an updated table of numerical, internal changeid's to xml:id strings.
*/
QMap<int, QString> saveInlineChanges(QMap<int, QString> changeTransTable, KoGenChanges &genChanges);
void loadOdfChanges(const KoXmlElement& element);
int getLoadedChangeId(const QString &odfId) const;
static QTextDocumentFragment generateDeleteFragment(const QTextCursor& cursor);
static void insertDeleteFragment(QTextCursor &cursor);
static int fragmentLength(const QTextDocumentFragment &fragment);
QString authorName() const;
void setAuthorName(const QString &authorName);
ChangeSaveFormat saveFormat() const;
void setSaveFormat(ChangeSaveFormat saveFormat);
private:
static bool checkListDeletion(const QTextList &list, const QTextCursor &cursor);
class Private;
Private* const d;
};
Q_DECLARE_METATYPE(KoChangeTracker*)
#endif
diff --git a/plugins/flake/textshape/kotext/commands/AddAnnotationCommand.h b/plugins/flake/textshape/kotext/commands/AddAnnotationCommand.h
index 1cda8edfcf..cd108a8308 100644
--- a/plugins/flake/textshape/kotext/commands/AddAnnotationCommand.h
+++ b/plugins/flake/textshape/kotext/commands/AddAnnotationCommand.h
@@ -1,42 +1,42 @@
/*
* This file is part of the KDE project
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef ADDANNOTATIONCOMMAND_H
#define ADDANNOTATIONCOMMAND_H
#include "AddTextRangeCommand.h"
class KoAnnotation;
class KoShape;
class AddAnnotationCommand : public AddTextRangeCommand
{
public:
explicit AddAnnotationCommand(KoAnnotation *range, KUndo2Command *parent = 0);
- virtual ~AddAnnotationCommand();
+ ~AddAnnotationCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
KoAnnotation *m_annotation;
KoShape *m_shape;
};
#endif // ADDANNOTATIONCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/AddTextRangeCommand.h b/plugins/flake/textshape/kotext/commands/AddTextRangeCommand.h
index b895f685b3..64bba245e3 100644
--- a/plugins/flake/textshape/kotext/commands/AddTextRangeCommand.h
+++ b/plugins/flake/textshape/kotext/commands/AddTextRangeCommand.h
@@ -1,40 +1,40 @@
/*
* This file is part of the KDE project
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef ADDTEXTRANGECOMMAND_H
#define ADDTEXTRANGECOMMAND_H
#include <kundo2command.h>
class KoTextRange;
class AddTextRangeCommand : public KUndo2Command
{
public:
explicit AddTextRangeCommand(KoTextRange *range, KUndo2Command *parent = 0);
- virtual ~AddTextRangeCommand();
+ ~AddTextRangeCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
KoTextRange *m_range;
};
#endif // ADDTEXTRANGECOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/ChangeAnchorPropertiesCommand.h b/plugins/flake/textshape/kotext/commands/ChangeAnchorPropertiesCommand.h
index 18402234ae..7f807b590a 100644
--- a/plugins/flake/textshape/kotext/commands/ChangeAnchorPropertiesCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ChangeAnchorPropertiesCommand.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2012 C. Boemann <cbo@boemann.dk>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGEANCHORPROPERTIESCOMMAND_H
#define CHANGEANCHORPROPERTIESCOMMAND_H
#include <kundo2command.h>
#include "kritatext_export.h"
#include "KoShapeAnchor.h"
#include <QPointF>
class KoShapeContainer;
class KRITATEXT_EXPORT ChangeAnchorPropertiesCommand : public KUndo2Command
{
public:
ChangeAnchorPropertiesCommand(KoShapeAnchor *anchor, const KoShapeAnchor &newAnchorData, KoShapeContainer *newParent, KUndo2Command *parent);
- virtual ~ChangeAnchorPropertiesCommand();
+ ~ChangeAnchorPropertiesCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
void copyLayoutProperties(const KoShapeAnchor *from, KoShapeAnchor *to);
KoShapeAnchor *m_anchor;
KoShapeAnchor m_oldAnchor;
KoShapeAnchor m_newAnchor;
KoShapeContainer *m_oldParent;
KoShapeContainer *m_newParent;
QPointF m_oldAbsPos;
QPointF m_newAbsPos;
KoShapeAnchor::TextLocation *m_oldLocation;
KoShapeAnchor::TextLocation *m_newLocation;
bool m_first;
bool m_undone;
};
#endif // CHANGEANCHORPROPERTIESCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/ChangeListCommand.h b/plugins/flake/textshape/kotext/commands/ChangeListCommand.h
index 8581e6ad2f..32f49db85d 100644
--- a/plugins/flake/textshape/kotext/commands/ChangeListCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ChangeListCommand.h
@@ -1,106 +1,106 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGELISTCOMMAND
#define CHANGELISTCOMMAND
#include "KoTextCommandBase.h"
#include "KoListStyle.h"
#include "KoTextEditor.h"
#include "KoListLevelProperties.h"
#include <QTextBlock>
#include <QList>
#include <QHash>
class KoList;
/**
* This command is useful to alter the list-association of a single textBlock.
*/
class ChangeListCommand : public KoTextCommandBase
{
public:
//FIXME: following comments seems to describe another function
/**
* Change the list property of 'block'.
* @param block the paragraph to change the list property of
* @param style indicates which style to use.
* @param parent the parent undo command for macro functionality
*/
ChangeListCommand(const QTextCursor &cursor,
const KoListLevelProperties &levelProperties,
KoTextEditor::ChangeListFlags flags,
KUndo2Command *parent = 0);
/**
* Change the list property of 'block'.
* @param block the paragraph to change the list property of
* @param style the style to apply
* @param exact if true then the actual style 'style' should be set, if false we possibly merge with another similar style that is near the block
* @param parent the parent undo command for macro functionality
*/
ChangeListCommand(const QTextCursor &cursor, KoListStyle *style, int level,
KoTextEditor::ChangeListFlags flags,
KUndo2Command *parent = 0);
- ~ChangeListCommand();
+ ~ChangeListCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
/// reimplemnted from KUndo2Command
- virtual int id() const {
+ int id() const override {
return 58450687;
}
/// reimplemnted from KUndo2Command
- virtual bool mergeWith(const KUndo2Command *other);
+ bool mergeWith(const KUndo2Command *other) override;
private:
enum CommandAction {
CreateNew,
ModifyExisting,
ReparentList,
MergeList,
RemoveList
};
bool extractTextBlocks(const QTextCursor &cursor, int level, KoListStyle::Style newStyle = KoListStyle::None);
int detectLevel(const QTextBlock &block, int givenLevel);
void initList(KoListStyle *style);
bool formatsEqual(const KoListLevelProperties &llp, const QTextListFormat &format);
int m_flags;
bool m_first;
bool m_alignmentMode;
QList<QTextBlock> m_blocks;
QHash<int, KoListLevelProperties> m_formerProperties;
QHash<int, KoListLevelProperties> m_newProperties;
QHash<int, int> m_levels;
QHash<int, KoList*> m_list;
QHash<int, KoList*> m_oldList;
QHash<int, CommandAction> m_actions;
};
#endif
diff --git a/plugins/flake/textshape/kotext/commands/ChangeStylesCommand.h b/plugins/flake/textshape/kotext/commands/ChangeStylesCommand.h
index c291dc6096..0d781b8229 100644
--- a/plugins/flake/textshape/kotext/commands/ChangeStylesCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ChangeStylesCommand.h
@@ -1,80 +1,80 @@
/*
* Copyright (c) 2012 C. Boemann <cbo@boemann.dk>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGESTYLESCOMMAND_H
#define CHANGESTYLESCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include <QSet>
#include <QTextBlockFormat>
#include <QTextCharFormat>
class KoCharacterStyle;
class KoParagraphStyle;
class QTextDocument;
class ChangeStylesCommand : public KUndo2Command
{
public:
ChangeStylesCommand(QTextDocument *qDoc
, const QList<KoCharacterStyle *> &origCharacterStyles
, const QList<KoParagraphStyle *> &origParagraphStyles
, const QSet<int> &changedStyles
, KUndo2Command *parent);
- virtual ~ChangeStylesCommand();
+ ~ChangeStylesCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
/**
* Helper function for clearing common properties.
*
* Clears properties in @a firstFormat that have the same value in @a secondFormat.
*/
void clearCommonProperties(QTextFormat *firstFormat, const QTextFormat &secondFormat);
private:
struct Memento // documents all change to the textdocument by a single style change
{
QTextDocument *document;
int blockPosition;
int paragraphStyleId;
QTextBlockFormat blockDirectFormat;
QTextBlockFormat blockParentFormat;
QTextCharFormat blockDirectCharFormat;
QTextCharFormat blockParentCharFormat;
QList<QTextCharFormat> fragmentDirectFormats;
QList<QTextCursor> fragmentCursors;
QList<int> fragmentStyleId;
};
QList<Memento *> m_mementos;
private:
QList<KoCharacterStyle *> m_origCharacterStyles;
QList<KoParagraphStyle *> m_origParagraphStyles;
QSet<int> m_changedStyles;
QTextDocument *m_document;
bool m_first;
};
#endif // CHANGESTYLESCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/ChangeStylesMacroCommand.h b/plugins/flake/textshape/kotext/commands/ChangeStylesMacroCommand.h
index e1da183407..fff43364f6 100644
--- a/plugins/flake/textshape/kotext/commands/ChangeStylesMacroCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ChangeStylesMacroCommand.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2012 C. Boemann <cbo@boemann.dk>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGESTYLESMACROCOMMAND_H
#define CHANGESTYLESMACROCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include <QSet>
class QTextDocument;
class KoCharacterStyle;
class KoParagraphStyle;
class KoStyleManager;
class ChangeStylesMacroCommand : public KUndo2Command
{
public:
ChangeStylesMacroCommand(const QList<QTextDocument *> &documents, KoStyleManager *styleManager);
- virtual ~ChangeStylesMacroCommand();
+ ~ChangeStylesMacroCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
void changedStyle(KoCharacterStyle *s) {m_changedCharacterStyles.append(s);}
void origStyle(KoCharacterStyle *s) {m_origCharacterStyles.append(s);}
void changedStyle(KoParagraphStyle *s) {m_changedParagraphStyles.append(s);}
void origStyle(KoParagraphStyle *s) {m_origParagraphStyles.append(s);}
void changedStyle(int id) {m_changedStyles.insert(id);}
private:
QList<QTextDocument *> m_documents;
QList<KoCharacterStyle *> m_origCharacterStyles;
QList<KoCharacterStyle *> m_changedCharacterStyles;
QList<KoParagraphStyle *> m_origParagraphStyles;
QList<KoParagraphStyle *> m_changedParagraphStyles;
QSet<int> m_changedStyles;
KoStyleManager *m_styleManager;
bool m_first;
};
#endif // CHANGESTYLESMACROCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/DeleteAnchorsCommand.h b/plugins/flake/textshape/kotext/commands/DeleteAnchorsCommand.h
index 1cf238cf53..c9ad1a1961 100644
--- a/plugins/flake/textshape/kotext/commands/DeleteAnchorsCommand.h
+++ b/plugins/flake/textshape/kotext/commands/DeleteAnchorsCommand.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DELETEANCHORSCOMMAND_H
#define DELETEANCHORSCOMMAND_H
#include <kundo2command.h>
#include <QList>
class QTextDocument;
class KoShapeAnchor;
class KoAnchorInlineObject;
class KoAnchorTextRange;
class DeleteAnchorsCommand : public KUndo2Command
{
public:
DeleteAnchorsCommand(const QList<KoShapeAnchor *> &anchors, QTextDocument *document, KUndo2Command *parent);
- virtual ~DeleteAnchorsCommand();
+ ~DeleteAnchorsCommand() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
QList<KoAnchorInlineObject *> m_anchorObjects;
QList<KoAnchorTextRange *> m_anchorRanges;
QTextDocument *m_document;
bool m_first;
bool m_deleteAnchors;
};
#endif /* DELETEANCHORSCOMMAND_H */
diff --git a/plugins/flake/textshape/kotext/commands/DeleteAnnotationsCommand.h b/plugins/flake/textshape/kotext/commands/DeleteAnnotationsCommand.h
index 48048f10c2..8d891e4c03 100644
--- a/plugins/flake/textshape/kotext/commands/DeleteAnnotationsCommand.h
+++ b/plugins/flake/textshape/kotext/commands/DeleteAnnotationsCommand.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Thorsten Zachmann <zachmann@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DELETEANNOTATIONSCOMMAND_H
#define DELETEANNOTATIONSCOMMAND_H
#include <kundo2command.h>
#include <QList>
class QTextDocument;
class KoAnnotation;
class DeleteAnnotationsCommand : public KUndo2Command
{
public:
DeleteAnnotationsCommand(const QList<KoAnnotation *> &annotations, QTextDocument *document, KUndo2Command *parent);
- virtual ~DeleteAnnotationsCommand();
+ ~DeleteAnnotationsCommand() override;
- virtual void redo();
- virtual void undo();
+ void redo() override;
+ void undo() override;
private:
QList<KoAnnotation *> m_annotations;
QTextDocument *m_document;
bool m_deleteAnnotations;
};
#endif /* DELETEANNOTATIONSCOMMAND_H */
diff --git a/plugins/flake/textshape/kotext/commands/DeleteCommand.h b/plugins/flake/textshape/kotext/commands/DeleteCommand.h
index 5fa6d0620c..b1fb0cd25e 100644
--- a/plugins/flake/textshape/kotext/commands/DeleteCommand.h
+++ b/plugins/flake/textshape/kotext/commands/DeleteCommand.h
@@ -1,98 +1,98 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Ganesh Paramasivam <ganesh@crystalfab.com>
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
* Copyright (C) 2014-2015 Denis Kuplyakov <dener.kup@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef DELETECOMMAND_H
#define DELETECOMMAND_H
#include "KoTextCommandBase.h"
#include <QTextCharFormat>
#include <QHash>
#include <QSet>
#include <QWeakPointer>
class QTextDocument;
class KoShapeController;
class KoInlineObject;
class KoTextRange;
class KoSection;
class DeleteVisitor;
class DeleteCommand : public KoTextCommandBase
{
public:
enum DeleteMode {
PreviousChar,
NextChar
};
DeleteCommand(DeleteMode mode, QTextDocument *document, KoShapeController *shapeController, KUndo2Command* parent = 0);
- virtual ~DeleteCommand();
+ ~DeleteCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
- virtual int id() const;
- virtual bool mergeWith(const KUndo2Command *command);
+ int id() const override;
+ bool mergeWith(const KUndo2Command *command) override;
private:
friend class DeleteVisitor;
struct SectionDeleteInfo {
SectionDeleteInfo(KoSection *_section, int _childIdx)
: section(_section)
, childIdx(_childIdx)
{
}
bool operator<(const SectionDeleteInfo &other) const;
KoSection *section; ///< Section to remove
int childIdx; ///< Position of section in parent's children() list
};
QWeakPointer<QTextDocument> m_document;
KoShapeController *m_shapeController;
QSet<KoInlineObject *> m_invalidInlineObjects;
QList<QTextCursor> m_cursorsToWholeDeleteBlocks;
QHash<int, KoTextRange *> m_rangesToRemove;
QList<SectionDeleteInfo> m_sectionsToRemove;
bool m_first;
DeleteMode m_mode;
int m_position;
int m_length;
QTextCharFormat m_format;
bool m_mergePossible;
void doDelete();
void deleteInlineObject(KoInlineObject *object);
bool checkMerge(const KUndo2Command *command);
void updateListChanges();
void finalizeSectionHandling(QTextCursor *caret, DeleteVisitor &visitor);
void deleteSectionsFromModel();
void insertSectionsToModel();
};
#endif // DELETECOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/DeleteTableColumnCommand.h b/plugins/flake/textshape/kotext/commands/DeleteTableColumnCommand.h
index dfadcf252a..c11193d82a 100644
--- a/plugins/flake/textshape/kotext/commands/DeleteTableColumnCommand.h
+++ b/plugins/flake/textshape/kotext/commands/DeleteTableColumnCommand.h
@@ -1,49 +1,49 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
* Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef DELETETABLECOLUMNCOMMAND_H
#define DELETETABLECOLUMNCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include <KoTableColumnStyle.h>
class KoTextEditor;
class QTextTable;
class DeleteTableColumnCommand : public KUndo2Command
{
public:
DeleteTableColumnCommand(KoTextEditor *te, QTextTable *t, KUndo2Command *parent = 0);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first;
KoTextEditor *m_textEditor;
QTextTable *m_table;
int m_selectionColumn;
int m_selectionColumnSpan;
QList<KoTableColumnStyle> m_deletedStyles;
};
#endif // DELETETABLEROWCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/DeleteTableRowCommand.h b/plugins/flake/textshape/kotext/commands/DeleteTableRowCommand.h
index 4fe2a57f29..05892efdd5 100644
--- a/plugins/flake/textshape/kotext/commands/DeleteTableRowCommand.h
+++ b/plugins/flake/textshape/kotext/commands/DeleteTableRowCommand.h
@@ -1,49 +1,49 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
* Copyright (C) 2010 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef DELETETABLEROWCOMMAND_H
#define DELETETABLEROWCOMMAND_H
#include <kundo2command.h>
#include <QList>
#include <KoTableRowStyle.h>
class KoTextEditor;
class QTextTable;
class DeleteTableRowCommand : public KUndo2Command
{
public:
DeleteTableRowCommand(KoTextEditor *te, QTextTable *t, KUndo2Command *parent = 0);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first;
KoTextEditor *m_textEditor;
QTextTable *m_table;
int m_selectionRow;
int m_selectionRowSpan;
QList<KoTableRowStyle> m_deletedStyles;
};
#endif // DELETETABLEROWCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/InsertInlineObjectCommand.h b/plugins/flake/textshape/kotext/commands/InsertInlineObjectCommand.h
index 68c42270c5..9e24ad9b37 100644
--- a/plugins/flake/textshape/kotext/commands/InsertInlineObjectCommand.h
+++ b/plugins/flake/textshape/kotext/commands/InsertInlineObjectCommand.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2011 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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 library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INSERTINLINEOBJECTCOMMAND_H
#define INSERTINLINEOBJECTCOMMAND_H
#include <kundo2command.h>
class KoInlineObject;
class QTextDocument;
class InsertInlineObjectCommand : public KUndo2Command
{
public:
InsertInlineObjectCommand(KoInlineObject *inlineObject, QTextDocument *document, KUndo2Command *parent);
- virtual ~InsertInlineObjectCommand();
+ ~InsertInlineObjectCommand() override;
/// redo the command
- void redo();
+ void redo() override;
/// revert the actions done in redo
- void undo();
+ void undo() override;
private:
KoInlineObject *m_inlineObject;
QTextDocument *m_document;
bool m_deleteInlineObject;
bool m_first;
int m_position;
};
#endif // INSERTINLINEOBJECTCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/InsertNoteCommand.h b/plugins/flake/textshape/kotext/commands/InsertNoteCommand.h
index a6262de777..f34af2735c 100644
--- a/plugins/flake/textshape/kotext/commands/InsertNoteCommand.h
+++ b/plugins/flake/textshape/kotext/commands/InsertNoteCommand.h
@@ -1,49 +1,49 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Ganesh Paramasivam <ganesh@crystalfab.com>
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef INSERTNOTECOMMAND_H
#define INSERTNOTECOMMAND_H
#include "KoInlineNote.h"
#include <kundo2command.h>
#include <QWeakPointer>
class QTextDocument;
class InsertNoteCommand : public KUndo2Command
{
public:
InsertNoteCommand(KoInlineNote::Type type, QTextDocument *document);
- virtual ~InsertNoteCommand();
+ ~InsertNoteCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
KoInlineNote *m_inlineNote;
private:
QWeakPointer<QTextDocument> m_document;
bool m_first;
int m_framePosition; // a cursor position inside the frame at the time of creation
};
#endif // INSERTNODECOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/InsertTableColumnCommand.h b/plugins/flake/textshape/kotext/commands/InsertTableColumnCommand.h
index 4bb1a4c4c7..4f2d56f296 100644
--- a/plugins/flake/textshape/kotext/commands/InsertTableColumnCommand.h
+++ b/plugins/flake/textshape/kotext/commands/InsertTableColumnCommand.h
@@ -1,48 +1,48 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
* Copyright (C) 2010-2011 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef INSERTTABLECOLUMNCOMMAND_H
#define INSERTTABLECOLUMNCOMMAND_H
#include <kundo2command.h>
#include <KoTableColumnStyle.h>
class KoTextEditor;
class QTextTable;
class InsertTableColumnCommand : public KUndo2Command
{
public:
InsertTableColumnCommand(KoTextEditor *te, QTextTable *t, bool right, KUndo2Command *parent = 0);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first;
KoTextEditor *m_textEditor;
QTextTable *m_table;
int m_column;
bool m_right;
KoTableColumnStyle m_style;
};
#endif // INSERTTABLECOLUMNCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/InsertTableRowCommand.h b/plugins/flake/textshape/kotext/commands/InsertTableRowCommand.h
index 1448b36721..e7251cf0c5 100644
--- a/plugins/flake/textshape/kotext/commands/InsertTableRowCommand.h
+++ b/plugins/flake/textshape/kotext/commands/InsertTableRowCommand.h
@@ -1,48 +1,48 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
* Copyright (C) 2010-2011 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef INSERTTABLEROWCOMMAND_H
#define INSERTTABLEROWCOMMAND_H
#include <kundo2command.h>
#include <KoTableRowStyle.h>
class KoTextEditor;
class QTextTable;
class InsertTableRowCommand : public KUndo2Command
{
public:
InsertTableRowCommand(KoTextEditor *te, QTextTable *t, bool below, KUndo2Command *parent = 0);
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first;
KoTextEditor *m_textEditor;
QTextTable *m_table;
int m_row;
bool m_below;
KoTableRowStyle m_style;
};
#endif // INSERTTABLEROWCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/ListItemNumberingCommand.h b/plugins/flake/textshape/kotext/commands/ListItemNumberingCommand.h
index 3488e28e44..b2216fa8ad 100644
--- a/plugins/flake/textshape/kotext/commands/ListItemNumberingCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ListItemNumberingCommand.h
@@ -1,64 +1,64 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef LISTITEMNUMBERINGCOMMAND
#define LISTITEMNUMBERINGCOMMAND
#include "KoTextCommandBase.h"
#include <QTextBlock>
/**
* This command is useful to mark a block as numbered or unnumbered list-item.
*/
class ListItemNumberingCommand : public KoTextCommandBase
{
public:
/**
* Change the list property of 'block'.
* @param block the paragraph to change the list property of
* @param numbered indicates if the block is an numbered list item
* @param parent the parent undo command for macro functionality
*/
ListItemNumberingCommand(const QTextBlock &block, bool numbered, KUndo2Command *parent = 0);
- ~ListItemNumberingCommand();
+ ~ListItemNumberingCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
/// reimplemnted from KUndo2Command
- virtual int id() const {
+ int id() const override {
return 58450688;
}
/// reimplemnted from KUndo2Command
- virtual bool mergeWith(const KUndo2Command *other);
+ bool mergeWith(const KUndo2Command *other) override;
private:
void setNumbered(bool numbered);
QTextBlock m_block;
bool m_numbered;
bool m_wasNumbered;
bool m_first;
};
#endif
diff --git a/plugins/flake/textshape/kotext/commands/NewSectionCommand.h b/plugins/flake/textshape/kotext/commands/NewSectionCommand.h
index 6ef5986e60..81b6d51e4a 100644
--- a/plugins/flake/textshape/kotext/commands/NewSectionCommand.h
+++ b/plugins/flake/textshape/kotext/commands/NewSectionCommand.h
@@ -1,48 +1,48 @@
/*
* This file is part of the KDE project
* Copyright (C) 2014 Denis Kuplaykov <dener.kup@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef NEWSECTIONCOMMAND_H
#define NEWSECTIONCOMMAND_H
#include <kundo2command.h>
class KoSection;
class QTextDocument;
//FIXME: why it is not going from KoTextCommandBase?
// If it will be changed to KoTextCommandBase,
// don't forget to add UndoRedoFinalizer.
class NewSectionCommand : public KUndo2Command
{
public:
explicit NewSectionCommand(QTextDocument *document);
- virtual ~NewSectionCommand();
+ ~NewSectionCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first; ///< Checks first call of redo
QTextDocument *m_document; ///< Pointer to document
KoSection *m_section; ///< Inserted section
int m_childIdx; ///< Position of inserted section in parent, after inserting
};
#endif // NEWSECTIONCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/ParagraphFormattingCommand.h b/plugins/flake/textshape/kotext/commands/ParagraphFormattingCommand.h
index efc92130f1..0001e59927 100644
--- a/plugins/flake/textshape/kotext/commands/ParagraphFormattingCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ParagraphFormattingCommand.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (C) 2013 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PARAGRAPHFORMATTINGCOMMAND_H
#define PARAGRAPHFORMATTINGCOMMAND_H
#include <KoListLevelProperties.h>
#include "kundo2command.h"
class KoTextEditor;
class QTextCharFormat;
class QTextBlockFormat;
/**
* This command is used to apply paragraph settings
*/
class ParagraphFormattingCommand : public KUndo2Command
{
public:
ParagraphFormattingCommand(KoTextEditor *editor,
const QTextCharFormat &characterFormat,
const QTextBlockFormat &blockFormat,
const KoListLevelProperties &llp,
KUndo2Command *parent = 0);
- ~ParagraphFormattingCommand();
+ ~ParagraphFormattingCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
bool m_first;
KoTextEditor *m_editor;
QTextCharFormat m_charFormat;
QTextBlockFormat m_blockFormat;
KoListLevelProperties m_levelProperties;
};
#endif
diff --git a/plugins/flake/textshape/kotext/commands/RenameSectionCommand.h b/plugins/flake/textshape/kotext/commands/RenameSectionCommand.h
index cb2af79184..028cc5ea25 100644
--- a/plugins/flake/textshape/kotext/commands/RenameSectionCommand.h
+++ b/plugins/flake/textshape/kotext/commands/RenameSectionCommand.h
@@ -1,53 +1,53 @@
/*
* This file is part of the KDE project
* Copyright (C) 2014-2015 Denis Kuplaykov <dener.kup@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef RENAMESECTIONCOMMAND_H
#define RENAMESECTIONCOMMAND_H
#include <QString>
#include <kundo2qstack.h>
class QTextDocument;
class KoSection;
class KoSectionModel;
class RenameSectionCommand : public KUndo2Command
{
public:
RenameSectionCommand(KoSection *section, const QString &newName, QTextDocument *document);
- virtual ~RenameSectionCommand();
+ ~RenameSectionCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
- virtual bool mergeWith(const KUndo2Command *other);
- virtual int id() const;
+ bool mergeWith(const KUndo2Command *other) override;
+ int id() const override;
private:
KoSectionModel *m_sectionModel; ///< Pointer to document's KoSectionModel
KoSection *m_section; ///< Section to rename
QString m_newName; ///< New section name
QString m_oldName; ///< Old section name (needed to undo)
bool m_first; ///< Checks first call of redo
};
#endif // RENAMESECTIONCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/ResizeTableCommand.h b/plugins/flake/textshape/kotext/commands/ResizeTableCommand.h
index 0fdb5f4202..adea096f07 100644
--- a/plugins/flake/textshape/kotext/commands/ResizeTableCommand.h
+++ b/plugins/flake/textshape/kotext/commands/ResizeTableCommand.h
@@ -1,52 +1,52 @@
/*
This file is part of the KDE project
* Copyright (C) 2012 C. Boemann <cbo@boemann.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef RESIZETABLECOMMAND_H
#define RESIZETABLECOMMAND_H
#include <kundo2command.h>
class QTextDocument;
class QTextTable;
class KoTableColumnStyle;
class KoTableRowStyle;
class ResizeTableCommand : public KUndo2Command
{
public:
ResizeTableCommand(QTextTable *t, bool horizontal, int band, qreal size, KUndo2Command *parent = 0);
- virtual ~ResizeTableCommand();
+ ~ResizeTableCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first;
int m_tablePosition;
QTextDocument *m_document;
bool m_horizontal;
int m_band;
qreal m_size;
KoTableColumnStyle *m_oldColumnStyle;
KoTableColumnStyle *m_newColumnStyle;
KoTableRowStyle *m_oldRowStyle;
KoTableRowStyle *m_newRowStyle;
};
#endif // RESIZETABLECOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/SplitSectionsCommand.h b/plugins/flake/textshape/kotext/commands/SplitSectionsCommand.h
index 473b404eeb..ef38f2e9aa 100644
--- a/plugins/flake/textshape/kotext/commands/SplitSectionsCommand.h
+++ b/plugins/flake/textshape/kotext/commands/SplitSectionsCommand.h
@@ -1,53 +1,53 @@
/*
* This file is part of the KDE project
* Copyright (C) 2015 Denis Kuplaykov <dener.kup@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef SPLITSECTIONSCOMMAND_H
#define SPLITSECTIONSCOMMAND_H
#include <kundo2command.h>
class KoSection;
class QTextDocument;
//FIXME: why it is not going from KoTextCommandBase?
// If it will be changed to KoTextCommandBase,
// don't forget to add UndoRedoFinalizer.
class SplitSectionsCommand : public KUndo2Command
{
public:
enum SplitType
{
Startings,
Endings
};
explicit SplitSectionsCommand(QTextDocument *document, SplitType type, int splitPosition);
- virtual ~SplitSectionsCommand();
+ ~SplitSectionsCommand() override;
- virtual void undo();
- virtual void redo();
+ void undo() override;
+ void redo() override;
private:
bool m_first; ///< Checks first call of redo
QTextDocument *m_document; ///< Pointer to document
SplitType m_type; ///< Split type
int m_splitPosition; ///< Split position
};
#endif // SPLITSECTIONSCOMMAND_H
diff --git a/plugins/flake/textshape/kotext/commands/TextPasteCommand.h b/plugins/flake/textshape/kotext/commands/TextPasteCommand.h
index a9158dfdd0..7b5fce819f 100644
--- a/plugins/flake/textshape/kotext/commands/TextPasteCommand.h
+++ b/plugins/flake/textshape/kotext/commands/TextPasteCommand.h
@@ -1,58 +1,58 @@
/*
This file is part of the KDE project
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.*/
#ifndef TEXTPASTECOMMAND_H
#define TEXTPASTECOMMAND_H
#include <QPointer>
#include <QClipboard>
#include <QWeakPointer>
#include <kundo2command.h>
#include <KoCanvasBase.h>
class QTextDocument;
class KoDocumentRdfBase;
class KoShapeController;
class QMimeData;
class TextPasteCommand : public KUndo2Command
{
public:
TextPasteCommand(const QMimeData *mimeData,
QTextDocument *document,
KoShapeController *shapeController,
KoCanvasBase *canvas, KUndo2Command *parent = 0,
bool pasteAsText = false);
- virtual void undo();
+ void undo() override;
- virtual void redo();
+ void redo() override;
private:
const QMimeData *m_mimeData;
QWeakPointer<QTextDocument> m_document;
KoDocumentRdfBase *m_rdf;
KoShapeController *m_shapeController;
QPointer<KoCanvasBase> m_canvas;
bool m_pasteAsText;
bool m_first;
};
#endif // TEXTPASTECOMMAND_H
diff --git a/plugins/flake/textshape/kotext/opendocument/KoTextLoader.h b/plugins/flake/textshape/kotext/opendocument/KoTextLoader.h
index 2b74763c2b..2a4e9f9567 100644
--- a/plugins/flake/textshape/kotext/opendocument/KoTextLoader.h
+++ b/plugins/flake/textshape/kotext/opendocument/KoTextLoader.h
@@ -1,223 +1,223 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2001-2006 David Faure <faure@kde.org>
* Copyright (C) 2007 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2007 Pierre Ducroquet <pinaraf@gmail.com>
* Copyright (C) 2007-2009 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
* Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
* Copyright (C) 2010 KO GmbH <ben.martin@kogmbh.com>
* Copyright (C) 2011 Pavol Korinek <pavol.korinek@ixonos.com>
* Copyright (C) 2011 Lukáš Tvrdý <lukas.tvrdy@ixonos.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTLOADER_H
#define KOTEXTLOADER_H
#include <QObject>
#include "kritatext_export.h"
#include <KoXmlReaderForward.h>
class QTextCursor;
class QTextTable;
class QRect;
class KoShapeLoadingContext;
class KoShape;
/**
* The KoTextLoader loads is use to load text for one and only one textdocument or shape
* to the scribe text-engine using QTextCursor objects. So if you have two shapes 2 different
* KoTextLoader are used for that. Also if you have a frame with text inside a text a new
* KoTextLoader is used.
*
* If you want to use the KoTextLoader for text that needs styles from styles.xml. e.g.
* test shapes on master pages, you need to set KoOdfLoadingContext::setUseStylesAutoStyles( true ).
*
* Don't forget to unset it if you later want to load text that needs content.xml.
*/
class KRITATEXT_EXPORT KoTextLoader : public QObject
{
Q_OBJECT
public:
/**
* Normalizes the whitespaces in the string \p in according to the ODF ruleset
* for stripping whitespaces and returns the result. If \p leadingSpace is
* true a leading space is stripped too.
*
* This is different from QString::simplifyWhiteSpace() because that one removes
* leading and trailing whitespace, but such whitespace is significant in ODF.
* So we use this function to compress sequences of space characters into single
* spaces.
*/
static QString normalizeWhitespace(const QString &in, bool leadingSpace);
/**
* Constructor.
* Notice that despite this being a QObject there is no 'parent' available for
* memory management here.
*
* @param context The context the KoTextLoader is called in
*/
explicit KoTextLoader(KoShapeLoadingContext &context, KoShape *shape = 0);
/**
* Destructor.
*/
- ~KoTextLoader();
+ ~KoTextLoader() override;
enum LoadBodyMode
{
LoadMode,
PasteMode
};
/**
* Load the body from the \p element into the \p cursor .
*
* This method got called e.g. at the \a KoTextShapeData::loadOdf() method if a TextShape
* instance likes to load an ODF element.
*
* @param element the element to start loading at
* @param cursor the text cursor to insert the body after
* @param pasteMode does special handling of section needed, in case we are pasting text
*/
void loadBody(const KoXmlElement &element, QTextCursor &cursor, LoadBodyMode pasteMode = LoadMode);
Q_SIGNALS:
/**
* This signal is emitted during loading with a percentage within 1-100 range
* \param percent the progress as a percentage
*/
void sigProgress(int percent);
private:
/**
* Load the paragraph from the \p element into the \p cursor .
*/
void loadParagraph(const KoXmlElement &element, QTextCursor &cursor);
/**
* Load the heading from the \p element into the \p cursor .
*/
void loadHeading(const KoXmlElement &element, QTextCursor &cursor);
/**
* Load the list from the \p element into the \p cursor .
*/
void loadList(const KoXmlElement &element, QTextCursor &cursor);
/**
* Load a list-item into the cursor
*/
void loadListItem(const KoXmlElement &e, QTextCursor &cursor, int level);
/**
* Load the section from the \p element into the \p cursor .
*/
void loadSection(const KoXmlElement &element, QTextCursor &cursor);
/**
* Load the text into the \p cursor .
*/
void loadText(const QString &text, QTextCursor &cursor,
bool *stripLeadingSpace, bool isLastNode);
/**
* Load the span from the \p element into the \p cursor .
*/
void loadSpan(const KoXmlElement &element, QTextCursor &cursor, bool *leadingSpace);
/**
* Load the table from the \p element into the \p cursor.
*
* The table and its contents are placed in a new shape.
*/
void loadTable(const KoXmlElement &element, QTextCursor& cursor);
/**
* Loads a table column
*/
void loadTableColumn(const KoXmlElement &element, QTextTable *table, int &columns);
/**
* Loads a table-row into the cursor
*/
void loadTableRow(const KoXmlElement &element, QTextTable *table, QList<QRect> &spanStore, QTextCursor &cursor, int &rows);
/**
* Loads a table-cell into the cursor
*/
void loadTableCell(const KoXmlElement &element, QTextTable *table, QList<QRect> &spanStore, QTextCursor &cursor, int &currentCell);
/**
* Load a note \p element into the \p cursor.
*/
void loadNote(const KoXmlElement &element, QTextCursor& cursor);
/**
* Load a citation \p element into the \p cursor.
*/
void loadCite(const KoXmlElement &element, QTextCursor& cursor);
/**
* Load the shape element and assign hyperlink to it \p element into the \p cursor .
*/
void loadShapeWithHyperLink(const KoXmlElement &element, QTextCursor& cursor);
/**
* Load the shape element \p element into the \p cursor .
*/
KoShape *loadShape(const KoXmlElement &element, QTextCursor& cursor);
/**
* Load the table of content element \p element into the \p cursor .
*/
void loadTableOfContents(const KoXmlElement &element, QTextCursor& cursor);
/**
* Load the bibliography element \p element into the \p cursor .
*/
void loadBibliography(const KoXmlElement &element, QTextCursor& cursor);
/**
* This is called in loadBody before reading the body starts.
*/
void startBody(int total);
/**
* This is called in loadBody on each item that is read within the body.
*/
void processBody();
/**
* This is called in loadBody once the body was read.
*/
void endBody();
/// \internal d-pointer class.
class Private;
/// \internal d-pointer instance.
Private* const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/opendocument/KoTextSharedLoadingData.h b/plugins/flake/textshape/kotext/opendocument/KoTextSharedLoadingData.h
index c9f59988a4..cfdf13cdbf 100644
--- a/plugins/flake/textshape/kotext/opendocument/KoTextSharedLoadingData.h
+++ b/plugins/flake/textshape/kotext/opendocument/KoTextSharedLoadingData.h
@@ -1,257 +1,257 @@
/* This file is part of the KDE project
* Copyright (C) 2007-2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAREDLOADINGDATA_H
#define KOTEXTSHAREDLOADINGDATA_H
#include <KoSharedLoadingData.h>
#include <KoXmlReaderForward.h>
#include "kritatext_export.h"
#include <QList>
#include <QPair>
#include <QString>
class KoOdfLoadingContext;
class KoParagraphStyle;
class KoCharacterStyle;
class KoListStyle;
class KoTableStyle;
class KoTableColumnStyle;
class KoTableRowStyle;
class KoTableCellStyle;
class KoSectionStyle;
class KoStyleManager;
class KoShape;
class KoShapeLoadingContext;
class KoOdfNotesConfiguration;
class KoOdfBibliographyConfiguration;
class KoTextTableTemplate;
#define KOTEXT_SHARED_LOADING_ID "KoTextSharedLoadingId"
/**
* This class is used to cache the loaded styles so that they have to be loaded only once
* and can be used by all text shapes.
* When a text shape is loaded it checks if the KoTextSharedLoadingData is already there.
* If not it is created.
*/
class KRITATEXT_EXPORT KoTextSharedLoadingData : public KoSharedLoadingData
{
friend class KoTextLoader;
public:
KoTextSharedLoadingData();
- virtual ~KoTextSharedLoadingData();
+ ~KoTextSharedLoadingData() override;
/**
* Load the styles
*
* If your application uses a style manager call this function from you application with insertOfficeStyles = true
* to load the custom styles into the style manager before the rest of the loading is started.
*
* @param scontext The shape loading context.
* @param styleManager The style manager too use or 0 if you don't have a style manager.
*/
void loadOdfStyles(KoShapeLoadingContext &scontext, KoStyleManager *styleManager);
/**
* Get the paragraph style for the given name
*
* The name is the style:name given in the file
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The paragraph style for the given name or 0 if not found
*/
KoParagraphStyle *paragraphStyle(const QString &name, bool stylesDotXml) const;
/**
* Return all paragraph styles.
*
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return All paragraph styles from the given file
*/
QList<KoParagraphStyle *> paragraphStyles(bool stylesDotXml) const;
/**
* Get the character style for the given name
*
* The name is the style:name given in the file
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The character style for the given name or 0 if not found
*/
KoCharacterStyle *characterStyle(const QString &name, bool stylesDotXml) const;
/**
* Return all character styles.
*
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return All character styles from the given file
*/
QList<KoCharacterStyle*> characterStyles(bool stylesDotXml) const;
/**
* Get the list style for the given name
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The list style for the given name or 0 if not found
*/
KoListStyle *listStyle(const QString &name, bool stylesDotXml) const;
/**
* Get the table style for the given name
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The table style for the given name or 0 if not found
*/
KoTableStyle *tableStyle(const QString &name, bool stylesDotXml) const;
/**
* Get the table column style for the given name
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The table column style for the given name or 0 if not found
*/
KoTableColumnStyle *tableColumnStyle(const QString &name, bool stylesDotXml) const;
/**
* Get the table row style for the given name
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The table row style for the given name or 0 if not found
*/
KoTableRowStyle *tableRowStyle(const QString &name, bool stylesDotXml) const;
/**
* Get the table cell style for the given name
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The table cell style for the given name or 0 if not found
*/
KoTableCellStyle *tableCellStyle(const QString &name, bool stylesDotXml) const;
/**
* Get the section style for the given name
*
* @param name The name of the style to get
* @param stylesDotXml If set the styles from styles.xml are used, if unset styles from content.xml are used.
* @return The section style for the given name or 0 if not found
*/
KoSectionStyle *sectionStyle(const QString &name, bool stylesDotXml) const;
/**
* Get the document-wide configuration for bibliography this contains information
* about prefix, suffix, sort by position, sort algorithm etc.
*/
KoOdfBibliographyConfiguration bibliographyConfiguration() const;
/**
* Returns a list of shapes that should be inserted.
*/
QList<KoShape *> insertedShapes() const;
protected:
/**
* This method got called by kotext once a \a KoShape got inserted and an
* application can implement this to do additional things with shapes once
* they got inserted.
* @param shape a shape that has finished loading.
* @param element the xml element that represents the shape being inserted.
*/
virtual void shapeInserted(KoShape *shape, const KoXmlElement &element, KoShapeLoadingContext &context);
private:
enum StyleType {
ContentDotXml = 1,
StylesDotXml = 2
};
// helper functions for loading of paragraph styles
void addParagraphStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoParagraphStyle *> > loadParagraphStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements,
int styleTypes, KoStyleManager *manager = 0);
void addDefaultParagraphStyle(KoShapeLoadingContext &context, const KoXmlElement *styleElem, const KoXmlElement *appDefault, KoStyleManager *styleManager);
// helper functions for loading of character styles
void addCharacterStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
struct OdfCharStyle {
QString odfName;
QString parentStyle;
KoCharacterStyle *style;
};
QList<OdfCharStyle> loadCharacterStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements);
void addDefaultCharacterStyle(KoShapeLoadingContext &context, const KoXmlElement *styleElem, const KoXmlElement *appDefault, KoStyleManager *styleManager);
// helper functions for loading of list styles
void addListStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoListStyle *> > loadListStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements);
// helper functions for loading of table styles
void addTableStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoTableStyle *> > loadTableStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements);
// helper functions for loading of table column styles
void addTableColumnStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoTableColumnStyle *> > loadTableColumnStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements);
// helper functions for loading of table row styles
void addTableRowStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoTableRowStyle *> > loadTableRowStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements);
// helper functions for loading of table cell styles
void addTableCellStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoTableCellStyle *> > loadTableCellStyles(KoShapeLoadingContext &context, const QList<KoXmlElement*> &styleElements);
// helper functions for loading of section styles
void addSectionStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements, int styleTypes,
KoStyleManager *styleManager = 0);
QList<QPair<QString, KoSectionStyle *> > loadSectionStyles(KoOdfLoadingContext &context, const QList<KoXmlElement*> &styleElements);
void addOutlineStyle(KoShapeLoadingContext & context, KoStyleManager *styleManager);
void addNotesConfiguration(KoShapeLoadingContext &context, KoStyleManager *styleManager);
void addBibliographyConfiguration(KoShapeLoadingContext &context);
void addTableTemplate(KoShapeLoadingContext &context, KoStyleManager *styleManager);
QList<QPair<QString, KoTextTableTemplate *> > loadTableTemplates(KoShapeLoadingContext &context);
class Private;
Private * const d;
};
#endif /* KOTEXTSHAREDLOADINGDATA_H */
diff --git a/plugins/flake/textshape/kotext/opendocument/KoTextSharedSavingData.h b/plugins/flake/textshape/kotext/opendocument/KoTextSharedSavingData.h
index 4ecb9ca469..fef4b29889 100644
--- a/plugins/flake/textshape/kotext/opendocument/KoTextSharedSavingData.h
+++ b/plugins/flake/textshape/kotext/opendocument/KoTextSharedSavingData.h
@@ -1,93 +1,93 @@
/* This file is part of the KDE project
Copyright (C) 2004-2006 David Faure <faure@kde.org>
Copyright (C) 2007-2008 Thorsten Zachmann <zachmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAREDSAVINGDATA_H
#define KOTEXTSHAREDSAVINGDATA_H
#include <KoSharedSavingData.h>
#include "kritatext_export.h"
#include <QMap>
#include <QSharedPointer>
#define KOTEXT_SHARED_SAVING_ID "KoTextSharedSavingId"
class KoGenChanges;
namespace Soprano
{
class Model;
}
class QString;
class KRITATEXT_EXPORT KoTextSharedSavingData : public KoSharedSavingData
{
public:
KoTextSharedSavingData();
- virtual ~KoTextSharedSavingData();
+ ~KoTextSharedSavingData() override;
void setGenChanges(KoGenChanges &changes);
KoGenChanges& genChanges() const;
void addRdfIdMapping(const QString &oldid, const QString &newid);
QMap<QString, QString> getRdfIdMapping() const;
/**
* The Rdf Model ownership is not taken, you must still delete it,
* and you need to ensure that it lives longer than this object
* unless you reset the model to 0.
*/
#ifdef SHOULD_BUILD_RDF
void setRdfModel(QSharedPointer<Soprano::Model> m);
QSharedPointer<Soprano::Model> rdfModel() const;
#endif
/**
* Stores the name that written to the file for the style
*
* @param styleId the id of the style in KoStyleManger
* @param savedName the name that is written to the file
*/
void setStyleName(int styleId, const QString &name);
/**
* Style name of the style
*
* @param styleId the id of the style in KoStyleManager
* @return the saved name of the style
*/
QString styleName(int styleId) const;
/**
* @brief styleNames List of all names of the styles that are saved
* @return All the names of styles that are saved in the style manager
*/
QList<QString> styleNames() const;
private:
class Private;
QScopedPointer<Private> d;
};
#endif // KOTEXTSHAREDSAVINGDATA_H
diff --git a/plugins/flake/textshape/kotext/styles/KoCharacterStyle.h b/plugins/flake/textshape/kotext/styles/KoCharacterStyle.h
index a21ccadf29..4bf95beff0 100644
--- a/plugins/flake/textshape/kotext/styles/KoCharacterStyle.h
+++ b/plugins/flake/textshape/kotext/styles/KoCharacterStyle.h
@@ -1,556 +1,556 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2007 Pierre Ducroquet <pinaraf@gmail.com>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2008 Pierre Stirnweiss <pierre.stirnweiss_calligra@gadz.org>
* Copyright (C) 2011 Stuart Dickson <stuart@furkinfantasic.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCHARACTERSTYLE_H
#define KOCHARACTERSTYLE_H
#include <KoXmlReaderForward.h>
#include <QObject>
#include <QTextCharFormat>
#include "kritatext_export.h"
class QTextBlock;
class KoShapeLoadingContext;
class KoShadowStyle;
class KoGenStyle;
class QString;
class QChar;
class QVariant;
/**
* A container for all properties for a character style.
* A character style represents all character properties for a set of characters.
* Each character in the document will have a character style, most of the time
* shared with all the characters next to it that have the same style (see
* QTextFragment).
* In a document the instances of QTextCharFormat which are based on a
* KoCharacterStyle have a property StyleId with an integer as value which
* equals styleId() of that style.
* @see KoStyleManager
*/
class KRITATEXT_EXPORT KoCharacterStyle : public QObject
{
Q_OBJECT
public:
/// types of style
enum Type {
CharacterStyle,
ParagraphStyle
};
/// list of character style properties we can store in a QTextCharFormat
enum Property {
StyleId = QTextFormat::UserProperty + 1, ///< The id stored in the charFormat to link the text to this style.
HasHyphenation,
StrikeOutStyle,
StrikeOutType,
StrikeOutColor,
StrikeOutWidth,
StrikeOutWeight,
StrikeOutMode,
StrikeOutText,
OverlineStyle,
OverlineType,
OverlineColor,
OverlineWidth,
OverlineWeight,
OverlineMode,
UnderlineStyle,
UnderlineType,
UnderlineWidth,
UnderlineWeight,
UnderlineMode,
Language,
Country,
FontCharset,
TextRotationAngle,
TextRotationScale,
TextScale,
InlineRdf, ///< KoTextInlineRdf pointer
TextShadow,
FontRelief,
TextEmphasizeStyle,
TextEmphasizePosition,
TextCombine, ///< TextCombineType
TextCombineStartChar, ///< QChar
TextCombineEndChar, ///< QChar
HyphenationPushCharCount, ///< int
HyphenationRemainCharCount, ///< int
FontLetterSpacing, ///< qreal, not the same format as the FontLetterSpacing in QTextFormat
PercentageFontSize, //font-size can be in % and this stores that value
AdditionalFontSize, //font-size-rel can specify an addition to the parent value
UseWindowFontColor, //boolean, same as odf
Blink,
AnchorType, //valid only if QTextCharFormat::isAnchor() is true
InlineInstanceId = 577297549, // Internal: Reserved for KoInlineTextObjectManager
ChangeTrackerId = 577297550, // Internal: Reserved for ChangeTracker
FontYStretch = 577297551 // Internal: Ratio between Linux font pt size and Windows font height
};
/// List of possible combine mode
enum TextCombineType {
NoTextCombine,
TextCombineLetters,
TextCombineLines
};
/// list of possible line type : no line, single line, double line
enum LineType {
NoLineType,
SingleLine,
DoubleLine
};
/// List of possible font relief : none, embossed, engraved
enum ReliefType {
NoRelief,
Embossed,
Engraved
};
enum EmphasisStyle {
NoEmphasis,
AccentEmphasis,
CircleEmphasis,
DiscEmphasis,
DotEmphasis
};
enum EmphasisPosition {
EmphasisAbove,
EmphasisBelow
};
/// list of possible line style.
enum LineStyle {
NoLineStyle = Qt::NoPen,
SolidLine = Qt::SolidLine,
DottedLine = Qt::DotLine,
DashLine = Qt::DashLine,
DotDashLine = Qt::DashDotLine,
DotDotDashLine = Qt::DashDotDotLine,
LongDashLine,
WaveLine
};
enum LineWeight {
AutoLineWeight,
NormalLineWeight,
BoldLineWeight,
ThinLineWeight,
DashLineWeight, // ## ??what the heck does this mean??
MediumLineWeight,
ThickLineWeight,
PercentLineWeight,
LengthLineWeight
};
/// list of possible line modes.
enum LineMode {
NoLineMode,
ContinuousLineMode,
SkipWhiteSpaceLineMode
};
enum RotationScale {
Fixed,
LineHeight
};
enum AnchorTypes {
Bookmark,
Anchor // corresponds to text:a ODF element
};
/**
* Constructor. Initializes with standard size/font properties.
* @param parent the parent object for memory management purposes.
*/
explicit KoCharacterStyle(QObject *parent = 0);
/// Copy constructor
explicit KoCharacterStyle(const QTextCharFormat &format, QObject *parent = 0);
/// Destructor
- ~KoCharacterStyle();
+ ~KoCharacterStyle() override;
/// returns the type of style
virtual Type styleType() const;
/// set the default style this one inherits its unset properties from if no parent style.
void setDefaultStyle(KoCharacterStyle *parent);
/// set the parent style this one inherits its unset properties from.
void setParentStyle(KoCharacterStyle *parent);
/// return the parent style
KoCharacterStyle *parentStyle() const;
/// return the effective font for this style
QFont font() const;
/// See similar named method on QTextCharFormat
void setFontFamily(const QString &family);
/// See similar named method on QTextCharFormat
QString fontFamily() const;
/// See similar named method on QTextCharFormat
void setFontPointSize(qreal size);
/// remove the font point size attribute
void clearFontPointSize();
/// See similar named method on QTextCharFormat
qreal fontPointSize() const;
/// See similar named method on QTextCharFormat
void setFontWeight(int weight);
/// See similar named method on QTextCharFormat
int fontWeight() const;
/// See similar named method on QTextCharFormat
void setFontItalic(bool italic);
/// See similar named method on QTextCharFormat
bool fontItalic() const;
/*
/// See similar named method on QTextCharFormat
void setFontOverline(bool overline);
/// See similar named method on QTextCharFormat
bool fontOverline() const;
*/
/// See similar named method on QTextCharFormat
void setFontFixedPitch(bool fixedPitch);
/// See similar named method on QTextCharFormat
bool fontFixedPitch() const;
/// See similar named method on QTextCharFormat
void setVerticalAlignment(QTextCharFormat::VerticalAlignment alignment);
/// See similar named method on QTextCharFormat
QTextCharFormat::VerticalAlignment verticalAlignment() const;
/// See similar named method on QTextCharFormat
void setTextOutline(const QPen &pen);
/// See similar named method on QTextCharFormat
QPen textOutline() const;
/// See similar named method on QTextCharFormat
void setFontLetterSpacing(qreal spacing);
/// See similar named method on QTextCharFormat
qreal fontLetterSpacing() const;
/// See similar named method on QTextCharFormat
void setFontWordSpacing(qreal spacing);
/// See similar named method on QTextCharFormat
qreal fontWordSpacing() const;
/// Set the text capitalization
void setFontCapitalization(QFont::Capitalization capitalization);
/// Return how the text should be capitalized
QFont::Capitalization fontCapitalization() const;
/// Set font Y stretch
void setFontYStretch(qreal stretch);
/// Return font Y stretch (value relevant for MS compatibility)
qreal fontYStretch() const;
/// See similar named method on QTextCharFormat
void setFontStyleHint(QFont::StyleHint styleHint);
/// See similar named method on QTextCharFormat
QFont::StyleHint fontStyleHint() const;
/// See similar named method on QTextCharFormat
void setFontKerning(bool enable);
/// See similar named method on QTextCharFormat
bool fontKerning() const;
/// See similar named method on QTextCharFormat
void setBackground(const QBrush &brush);
/// See similar named method on QTextCharFormat
QBrush background() const;
/// See similar named method on QTextCharFormat
void clearBackground();
/// See similar named method on QTextCharFormat
void setForeground(const QBrush &brush);
/// See similar named method on QTextCharFormat
QBrush foreground() const;
/// See similar named method on QTextCharFormat
void clearForeground();
/// Set the boolean of using window font color (see odf spec)
void setFontAutoColor(bool use);
/// Apply a font strike out style to this KoCharacterStyle
void setStrikeOutStyle(LineStyle style);
/// Get the current font strike out style of this KoCharacterStyle
LineStyle strikeOutStyle() const;
/// Apply a font strike out width to this KoCharacterStyle
void setStrikeOutWidth(LineWeight weight, qreal width);
/// Get the current font strike out width of this KoCharacterStyle
void strikeOutWidth(LineWeight &weight, qreal &width) const;
/// Apply a font strike out color to this KoCharacterStyle
void setStrikeOutColor(const QColor &color);
/// Get the current font strike out color of this KoCharacterStyle
QColor strikeOutColor() const;
/// Apply a font strike out color to this KoCharacterStyle
void setStrikeOutType(LineType lineType);
/// Get the current font strike out color of this KoCharacterStyle
LineType strikeOutType() const;
/// Apply a strike out mode of this KoCharacterStyle
void setStrikeOutMode(LineMode lineMode);
/// Get the current strike out mode of this KoCharacterStyle
LineMode strikeOutMode() const;
/// Apply a strike out text of this KoCharacterStyle
void setStrikeOutText(const QString &text);
/// Get the current strike out text of this KoCharacterStyle
QString strikeOutText() const;
/// Apply a font overline style to this KoCharacterStyle
void setOverlineStyle(LineStyle style);
/// Get the current font overline style of this KoCharacterStyle
LineStyle overlineStyle() const;
/// Apply a font overline width to this KoCharacterStyle
void setOverlineWidth(LineWeight weight, qreal width);
/// Get the current font overline width of this KoCharacterStyle
void overlineWidth(LineWeight &weight, qreal &width) const;
/// Apply a font overline color to this KoCharacterStyle
void setOverlineColor(const QColor &color);
/// Get the current font overline color of this KoCharacterStyle
QColor overlineColor() const;
/// Apply a font overline color to this KoCharacterStyle
void setOverlineType(LineType lineType);
/// Get the current font overline color of this KoCharacterStyle
LineType overlineType() const;
/// Apply a overline mode to this KoCharacterStyle
void setOverlineMode(LineMode mode);
/// Get the current overline mode of this KoCharacterStyle
LineMode overlineMode() const;
/// Apply a font underline style to this KoCharacterStyle
void setUnderlineStyle(LineStyle style);
/// Get the current font underline style of this KoCharacterStyle
LineStyle underlineStyle() const;
/// Apply a font underline width to this KoCharacterStyle
void setUnderlineWidth(LineWeight weight, qreal width);
/// Get the current font underline width of this KoCharacterStyle
void underlineWidth(LineWeight &weight, qreal &width) const;
/// Apply a font underline color to this KoCharacterStyle
void setUnderlineColor(const QColor &color);
/// Get the current font underline color of this KoCharacterStyle
QColor underlineColor() const;
/// Apply a font underline color to this KoCharacterStyle
void setUnderlineType(LineType lineType);
/// Get the current font underline color of this KoCharacterStyle
LineType underlineType() const;
/// Apply a underline mode to this KoCharacterStyle
void setUnderlineMode(LineMode mode);
/// Get the current underline mode of this KoCharacterStyle
LineMode underlineMode() const;
/// Apply text rotation angle to this KoCharacterStyle
void setTextRotationAngle(qreal angle);
/// Get the current text rotation angle of this KoCharacterStyle
qreal textRotationAngle() const;
/**
* RotationScale pecifies whether for rotated text the width of the text
* should be scaled to fit into the current line height or the width of the text
* should remain fixed, therefore changing the current line height
*/
void setTextRotationScale(RotationScale scale);
/// Get the current text rotation scale of this KoCharacterStyle
RotationScale textRotationScale() const;
/// Apply text scale to this KoCharacterStyle
void setTextScale(int scale);
/// Get the current text scale of this KoCharacterStyle
int textScale() const;
KoShadowStyle textShadow() const;
void setTextShadow(const KoShadowStyle &shadow);
TextCombineType textCombine() const;
void setTextCombine(TextCombineType type);
QChar textCombineStartChar() const;
void setTextCombineStartChar(const QChar &character);
QChar textCombineEndChar() const;
void setTextCombineEndChar(const QChar &character);
ReliefType fontRelief() const;
void setFontRelief(ReliefType relief);
EmphasisStyle textEmphasizeStyle() const;
void setTextEmphasizeStyle(EmphasisStyle emphasis);
EmphasisPosition textEmphasizePosition() const;
void setTextEmphasizePosition(EmphasisPosition position);
/// Set the country
void setCountry(const QString &country);
/// Set the language
void setLanguage(const QString &language);
/// Get the country
QString country() const;
/// Get the language
QString language() const;
bool blinking() const;
void setBlinking(bool blink);
void setHasHyphenation(bool on);
bool hasHyphenation() const;
void setHyphenationPushCharCount(int count);
int hyphenationPushCharCount() const;
void setHyphenationRemainCharCount(int count);
int hyphenationRemainCharCount() const;
void setPercentageFontSize(qreal percent);
qreal percentageFontSize() const;
void setAdditionalFontSize(qreal percent);
qreal additionalFontSize() const;
/// set the anchor type, valid only if QTextCharFormat::isAnchor() is true
void setAnchorType(AnchorTypes anchorType);
/// returns the anchor type, valid only if QTextCharFormat::isAnchor() is true
AnchorTypes anchorType() const;
void copyProperties(const KoCharacterStyle *style);
void copyProperties(const QTextCharFormat &format);
KoCharacterStyle *clone(QObject *parent = 0) const;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
void unapplyStyle(QTextBlock &block) const;
void unapplyStyle(QTextCharFormat &format) const;
/**
* Apply this style to a blockFormat by copying all properties from this
* style to the target char format.
*/
void applyStyle(QTextCharFormat &format, bool emitSignal = true) const;
/**
* Apply this style to the textBlock by copying all properties from this
* style to the target block formats.
*/
void applyStyle(QTextBlock &block) const;
/**
* Reset any styles and apply this style on the whole selection.
*/
void applyStyle(QTextCursor *selection) const;
/// This should be called after all charFormat properties are merged.
void ensureMinimalProperties(QTextCharFormat &format) const;
/**
* Load the style form the element
*
* @param context the odf loading context
* @param element the element containing the
* @param loadParents true = use the stylestack, false = use just the element
*/
void loadOdf(const KoXmlElement *element, KoShapeLoadingContext &context,
bool loadParents = false);
/// return true if this style has a non-default value set for the Property
bool hasProperty(int key) const;
bool compareCharacterProperties(const KoCharacterStyle &other) const;
bool operator==(const KoCharacterStyle &other) const;
bool operator!=(const KoCharacterStyle &other) const;
/**
* Removes properties from this style that have the same value in other style.
*/
void removeDuplicates(const KoCharacterStyle &other);
/**
* Removes properties from this style that have the same value in other format.
*/
void removeDuplicates(const QTextCharFormat &other_format);
/**
* Create an autostyle out of the format and baseFormat
* @param format the format that is converted to an autostyle.
* @param baseFormat the format (typically a blockCharFormat) that is the basis of the format,
* but not itself part of the character style inheritance.
* @return pointer to autostyle that has this as parent style
*/
KoCharacterStyle *autoStyle(const QTextCharFormat &format, QTextCharFormat blockCharFormat) const;
void saveOdf(KoGenStyle &style) const;
/**
* Returns true if this style has no properties set. Else, returns false.
*/
bool isEmpty() const;
/** Returns true if the style is in use.
*/
bool isApplied() const;
/**
* Return the value of key as represented on this style.
* You should consider using the direct accessors for individual properties instead.
* @param key the Property to request.
* @returns a QVariant which holds the property value.
*/
QVariant value(int key) const;
/**
* Remove the hardcoded defaults from this style (SansSerif, 12 points, black).
* @internal - this method is a bit of an ugly workaround to make it easier to
* use KoTextLoader for loading richtext in kspread, normally styles with
* no font etc. set are not something you should want.
*/
void removeHardCodedDefaults();
void remove(int key);
Q_SIGNALS:
void nameChanged(const QString &newName);
void styleApplied(const KoCharacterStyle*) const;
protected:
/**
* Load the text properties from the \a KoStyleStack style stack using the
* OpenDocument format.
*/
void loadOdfProperties(KoShapeLoadingContext &context);
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoCharacterStyle *)
Q_DECLARE_METATYPE(const KoCharacterStyle *)
Q_DECLARE_METATYPE(QSharedPointer<KoCharacterStyle>)
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoListLevelProperties.h b/plugins/flake/textshape/kotext/styles/KoListLevelProperties.h
index 7b1946e1e7..3442a8d241 100644
--- a/plugins/flake/textshape/kotext/styles/KoListLevelProperties.h
+++ b/plugins/flake/textshape/kotext/styles/KoListLevelProperties.h
@@ -1,217 +1,217 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
* Copyright (C) 2010 Nandita Suri <suri.nandita@gmail.com>
* Copyright (C) 2011-2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOLISTLEVELPROPERTIES_H
#define KOLISTLEVELPROPERTIES_H
#include "KoListStyle.h"
#include <KoXmlReader.h>
class KoCharacterStyle;
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoXmlWriter;
class KoImageData;
class QTextList;
/**
* Properties per list level.
*/
class KRITATEXT_EXPORT KoListLevelProperties : public QObject
{
Q_OBJECT
public:
/// Constructor
explicit KoListLevelProperties();
/// Copy constructor
KoListLevelProperties(const KoListLevelProperties &other);
/// Destructor
- ~KoListLevelProperties();
+ ~KoListLevelProperties() override;
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/// set the style to be used for this list-level.
void setStyle(KoListStyle::Style style);
/// return the used style
KoListStyle::Style style() const;
/// set the string that will be shown before the counter in the list label
void setListItemPrefix(const QString &prefix);
/// return the string that will be shown before the counter in the list label
QString listItemPrefix() const;
/// set the string that will be shown after the counter in the list label
void setListItemSuffix(const QString &suffix);
/// return the string that will be shown after the counter in the list label
QString listItemSuffix() const;
/// set the index of the first value of this whole list.
void setStartValue(int value);
/// return the index of the first value of this whole list.
int startValue() const;
/// set the list level which is how deep the counter is nested below other lists (should be >=1)
void setLevel(int level);
/// return the list level which is how deep the counter is nested below other lists
int level() const;
/// set the amount of levels that will be shown in list items of this list.
void setDisplayLevel(int level);
/// return the amount of levels that will be shown in list items of this list.
int displayLevel() const;
/// set the styleId of the KoCharacterStyle to be used to layout the listitem
void setCharacterStyleId(int id);
/// return the styleId of the KoCharacterStyle to be used to layout the listitem
int characterStyleId() const;
/// set the style for the bullet or the number of the list
void setCharacterProperties(QSharedPointer<KoCharacterStyle> style);
/// return the KoCharacterStyle for the bullet or the number of the list
QSharedPointer<KoCharacterStyle> characterProperties() const;
/// set the character to be used as the counter of the listitem
void setBulletCharacter(QChar character);
/// return the character to be used as the counter of the listitem
QChar bulletCharacter() const;
/// set the size, in percent, of the bullet counter relative to the fontsize of the counter
void setRelativeBulletSize(int percent);
/// return the size, in percent, of the bullet counter relative to the fontsize of the counter
int relativeBulletSize() const;
/// set how the list label should be aligned in the width this list reserves for the listitems
void setAlignment(Qt::Alignment align);
/// return how the list label should be aligned in the width this list reserves for the listitems
Qt::Alignment alignment() const;
/// set the minimum width (in pt) of the list label for all items in this list
void setMinimumWidth(qreal width);
/// return the minimum width (in pt) of the list label for all items in this list
qreal minimumWidth() const;
/// set the width (in pt) of the image bullet
void setWidth(qreal width);
/// return the width (in pt) of the image bullet
qreal width() const;
/// set the height (in pt) of the image bullet
void setHeight(qreal height);
/// return the height (in pt) of the image bullet
qreal height() const;
/// set the bullet image key (as from the KoImageData)
void setBulletImage(KoImageData *imageData);
/// return the bullet image that is used in the list(as KoImageData)
KoImageData *bulletImage() const;
/// set the listId used by all list-styles that together make 1 user defined list in an ODF file.
void setListId(KoListStyle::ListIdType listId);
/// return the listId used by all list-styles that together make 1 user defined list in an ODF file.
KoListStyle::ListIdType listId() const;
/**
* For alpha-based lists numbers above the 'z' will increase the value of all characters at the same time.
* If true; we get the sequence 'aa', 'bb', 'cc'. If false; 'aa', 'ab', 'ac'.
* @return if letterSynchronization should be applied.
*/
bool letterSynchronization() const;
/**
* For alpha-based lists numbers above the 'z' will increase the value of all characters at the same time.
* If true; we get the sequence 'aa', 'bb', 'cc'. If false; 'aa', 'ab', 'ac'.
* @param on if letterSynchronization should be applied.
*/
void setLetterSynchronization(bool on);
/// sets the indentation of paragraph
void setIndent(qreal value);
/// returns the indentation of paragraphs
qreal indent() const;
/// sets the minimum distance between the counter and the text
void setMinimumDistance(qreal value);
/// returns the minimum distance between the counter and text
qreal minimumDistance() const;
/// sets the margin of the list
void setMargin(qreal vlaue);
/// returns the margin of the list
qreal margin() const;
/// sets the text indent of the list item
void setTextIndent(qreal value);
/// returns the text indent of the list item
qreal textIndent() const;
/// set the item that follows the label; this is used if alignmentMode() is true
void setLabelFollowedBy(KoListStyle::ListLabelFollowedBy value);
/// returns the item that follows the label; this is used if alignmentMode() is true
KoListStyle::ListLabelFollowedBy labelFollowedBy() const;
/// sets the value of tab stop that follows the label, it is used only if ListLabelFollowedBy is ListTab
void setTabStopPosition(qreal value);
/// returns the value of tab stop that follows the label, it is used only if ListLabelFollowedBy is ListTab
qreal tabStopPosition() const;
/// sets the alignment mode of the list isLabelAlignmentMode=true if ist-level-position-and-space-mode=label-alignment
void setAlignmentMode(bool isLabelAlignmentMode);
/// return the alignment mode of the list isLabelAlignmentMode=true if ist-level-position-and-space-mode=label-alignment
bool alignmentMode() const;
void setOutlineList(bool isOutline);
bool isOutlineList() const;
bool operator==(const KoListLevelProperties &other) const;
bool operator!=(const KoListLevelProperties &other) const;
KoListLevelProperties & operator=(const KoListLevelProperties &other);
/**
* Create a KoListLevelProperties object from a QTextList instance.
*/
static KoListLevelProperties fromTextList(QTextList *list);
/**
* Apply this style to a QTextListFormat by copying all properties from this style
* to the target list format.
*/
void applyStyle(QTextListFormat &format) const;
/**
* Load the properties from the \p style using the OpenDocument format.
*/
void loadOdf(KoShapeLoadingContext& scontext, const KoXmlElement& style);
/**
* Save the properties of the style using the OpenDocument format
*/
void saveOdf(KoXmlWriter *writer, KoShapeSavingContext &context) const;
public Q_SLOTS:
void onStyleChanged(int key);
Q_SIGNALS:
void styleChanged(int key);
private:
void setProperty(int key, const QVariant &value);
int propertyInt(int key) const;
uint propertyUInt(int key) const;
qulonglong propertyULongLong(int key) const;
bool propertyBoolean(int key) const;
qreal propertyDouble(int key) const;
QString propertyString(int key) const;
QColor propertyColor(int key) const;
QVariant property(int key) const;
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoListStyle.h b/plugins/flake/textshape/kotext/styles/KoListStyle.h
index d851db9942..4c50de5c01 100644
--- a/plugins/flake/textshape/kotext/styles/KoListStyle.h
+++ b/plugins/flake/textshape/kotext/styles/KoListStyle.h
@@ -1,281 +1,281 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2010 Nandita Suri <suri.nandita@gmail.com>
* Copyright (C) 2011 Lukáš Tvrdý <lukas.tvrdy@ixonos.com>
* Copyright (C) 2011-2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOLISTSTYLE_H
#define KOLISTSTYLE_H
#include "kritatext_export.h"
#include <QTextFormat>
#include <QTextListFormat>
#include <KoXmlReader.h>
class KoListLevelProperties;
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoGenStyle;
class QTextBlock;
/**
* This class groups all styling-options for lists.
* See KoParagraphStyle::setListStyle()
* The list-style represents several list-levels, where each level is represented by the
* KoListLevelProperties class. The top most list level is 1.
*
* list level1
* list level2
* list level2
* list level3
* list level1
*
* A list-style as such represents cross paragraph relations. The most obvious evidence of this
* is with a numbered list where a counter is automatically increased from one paragraph to the next.
*
* If the list is interrupted by a praragraph with another list-style the counting will start from
* fresh when the list resumes. However you can set the list to continue if you like.
*
* Following from the above you can use the same paragraph style for several paragraphs and the
* the counter will increase. If you want a paragraph to be on a sub level you do however need to
* create a new paragraph-style when another listLevel set.
*/
class KRITATEXT_EXPORT KoListStyle : public QObject
{
Q_OBJECT
Q_ENUMS(Style Property)
public:
// ListIdType will be 32-bit in 32 bit machines and 64 bit in 64 bit machines
typedef quintptr ListIdType;
/// This list is used to specify what kind of list-style to use
/// If you add a style to that list you also need to check if you need to update
/// KoListStyle::isNumberingStyle(int)
enum Style {
/// Draw a square
SquareItem = QTextListFormat::ListSquare,
/// Draw a disc (filled circle) (aka bullet)
DiscItem = QTextListFormat::ListDisc,
/// Draw a disc (non-filled disk)
CircleItem = QTextListFormat::ListCircle,
/// use arabic numbering (1, 2, 3, ...)
DecimalItem = QTextListFormat::ListDecimal,
/// use alpha numbering (a, b, c, ... aa, ab, ...)
AlphaLowerItem = QTextListFormat::ListLowerAlpha,
/// use alpha numbering (A, B, C, ... AA, AB, ...)
UpperAlphaItem = QTextListFormat::ListUpperAlpha,
/// List style with no numbering
None = 1,
/// use lower roman counting. (i, ii, iii, iv, ...)
RomanLowerItem,
/// use upper roman counting. (I, II, III, IV, ...)
UpperRomanItem,
/// bullet, a small circle Unicode char U+2022
Bullet,
/// black circle, a large circle Unicode char U+25CF
BlackCircle,
/// draw a box
BoxItem,
/// rhombus, like a SquareItem but rotated by 45 degree
RhombusItem,
/// a check mark
HeavyCheckMarkItem,
/// a ballot x
BallotXItem,
/// heavy wide-headed rightwards arrow
RightArrowItem,
/// three-d top-lighted rightwards arrowhead
RightArrowHeadItem,
/// use an unicode char for the bullet
CustomCharItem,
Bengali, ///< Bengali characters for normal 10-base counting
Gujarati, ///< Gujarati characters for normal 10-base counting
Gurumukhi, ///< Gurumukhi characters for normal 10-base counting
Kannada, ///< Kannada characters for normal 10-base counting
Malayalam, ///< Malayalam characters for normal 10-base counting
Oriya, ///< Oriya characters for normal 10-base counting
Tamil, ///< Tamil characters for normal 10-base counting
Telugu, ///< Telugu characters for normal 10-base counting
Tibetan, ///< Tibetan characters for normal 10-base counting
Thai, ///< Thai characters for normal 10-base counting
Abjad, ///< Abjad sequence.
AbjadMinor, ///< A lesser known version of the Abjad sequence.
ArabicAlphabet, ///< Arabic alphabet.
/// an image for the bullet
ImageItem
// TODO look at css 3 for things like hebrew counters
};
/// further properties
enum Property {
ListItemPrefix = QTextFormat::UserProperty + 1000, ///< The text to be printed before the listItem
ListItemSuffix, ///< The text to be printed after the listItem
StartValue, ///< First value to use
Level, ///< list nesting level, is 1 or higher, or zero when implied
DisplayLevel, ///< show this many levels. Is always lower than the (implied) level.
CharacterStyleId,///< CharacterStyle used for markup of the counter
CharacterProperties, ///< This stores the character properties of the list style
BulletCharacter,///< an int with the unicode value of the character (for CustomCharItem)
RelativeBulletSize, ///< size in percent relative to the height of the text
Alignment, ///< Alignment of the counter
MinimumWidth, ///< The minimum width, in pt, of the listItem including the prefix/suffix.
ListId, ///< A group of lists together are called 1 (user intended) list in ODF. Store the listId here
IsOutline, ///< If true then this list is an outline list (for header paragraphs)
LetterSynchronization, ///< If letters are used for numbering, when true increment all at the same time. (aa, bb)
StyleId, ///< The id stored in the listFormat to link the list to this style.
Indent, ///< The space (margin) to include for all paragraphs
MinimumDistance, ///< The minimum distance, in pt, between the counter and the text
Width, ///< The width, in pt, of a picture bullet.
Height, ///< The height, in pt, of a picture bullet.
BulletImage, ///< Bullet image stored as a key for lookup in the imageCollection
Margin, ///< Stores the margin of the list
TextIndent, ///< Stores the text indent of list item
AlignmentMode, ///< Is true if list-level-position-and-space-mode=label-alignment
LabelFollowedBy, ///< Label followed by one of the enums ListLabelFollowedBy
TabStopPosition ///< Specifies the additional tab stops
};
enum ListLabelFollowedBy
{
ListTab, ///< Label is followed by a list tab
Space, ///< Label followed by a Space
Nothing ///< Nothing is present between label and the text
};
/**
* Constructor
* Create a new list style which uses numbered (KoListStyle::ListDecimal) listitems.
*/
explicit KoListStyle(QObject *parent = 0);
/// Destructor
- ~KoListStyle();
+ ~KoListStyle() override;
/// creates a clone of this style with the specified parent
KoListStyle *clone(QObject *parent = 0);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/**
* Return the properties for the specified list level.
* A list style can contain properties for more than one level, when a paragraph is added to this list
* it will be added at a certain level and it will then be using the properties of that level.
* The gain from using one list style for multiple levels is in allowing a way to format the list label.
* A list item which is of level '4' will be able to have a display level of up to 4, which means that not
* only is the counter of the current level displayed, the counters of the higher levels can be displayed as
* well.
* Adding level properties for lower levels will have the effect that the counter of that level will be displayed
* in the specified format instead of being inherited from the list style at the higher level.
*/
KoListLevelProperties levelProperties(int level) const;
/**
* Set the properties for a level.
* @param properties the new properties for the level, including the level number.
* @see level()
*/
void setLevelProperties(const KoListLevelProperties &properties);
/**
* @return if there are the properties for a level set.
* @param level the level for which to check
* @see level()
*/
bool hasLevelProperties(int level) const;
/**
* Remove any properties that were set for a level.
* @param level the level for which to remove
* @see level()
*/
void removeLevelProperties(int level);
/// return a QTextListFormat that contains formatting information for the level.
QTextListFormat listFormat(int level) const;
/// return the configured list levels that hasLevelProperties would return true to.
QList<int> listLevels() const;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/**
* Apply this style to a block by adding the block to the proper list.
*/
void applyStyle(const QTextBlock &block, int level = 0);
bool operator==(const KoListStyle &other) const;
bool operator!=(const KoListStyle &other) const;
/**
* Load the style from the \a KoStyleStack style stack using the
* OpenDocument format.
*/
void loadOdf(KoShapeLoadingContext& context, const KoXmlElement& style = KoXmlElement());
/**
* Save the style to a KoGenStyle object using the OpenDocument format
*/
void saveOdf(KoGenStyle &style, KoShapeSavingContext &context) const;
/// copy all the properties from the other style to this style, effectively duplicating it.
void copyProperties(KoListStyle *other);
/**
* Check if list has numbering in one of it's list levels
*/
bool isNumberingStyle() const;
/**
* Returns true if this list style is a outline style
*/
bool isOulineStyle() const;
/// returns true if style is a numbering style
static bool isNumberingStyle(int style);
static int bulletCharacter(int style);
Q_SIGNALS:
void nameChanged(const QString &newName);
void styleChanged(int level);
private:
friend class ChangeListCommand;
friend class ChangeListLevelCommand;
void refreshLevelProperties(const KoListLevelProperties &properties);
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoListStyle *)
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoParagraphStyle.h b/plugins/flake/textshape/kotext/styles/KoParagraphStyle.h
index 4e958701c2..41bfbc4258 100644
--- a/plugins/flake/textshape/kotext/styles/KoParagraphStyle.h
+++ b/plugins/flake/textshape/kotext/styles/KoParagraphStyle.h
@@ -1,745 +1,745 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2007,2008 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2007-2011 Pierre Ducroquet <pinaraf@gmail.com>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOPARAGRAPHSTYLE_H
#define KOPARAGRAPHSTYLE_H
#include "KoCharacterStyle.h"
#include "KoText.h"
#include "kritatext_export.h"
#include <KoXmlReaderForward.h>
#include <KoBorder.h>
#include <QVariant>
#include <QTextFormat>
extern QVariant val;
class KoShadowStyle;
class KoListStyle;
class QTextBlock;
class KoGenStyle;
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoList;
/**
* A container for all properties for the paragraph wide style.
* Each paragraph in the main text either is based on a parag style, or its not. Where
* it is based on a paragraph style this is indecated that it has a property 'StyleId'
* with an integer as value. The integer value corresponds to the styleId() output of
* a specific KoParagraphStyle.
* @see KoStyleManager
*/
class KRITATEXT_EXPORT KoParagraphStyle : public KoCharacterStyle
{
Q_OBJECT
public:
enum Property {
// Every 10 properties, the decimal number shown indicates the decimal offset over the QTextFormat::UserProperty enum value
StyleId = QTextFormat::UserProperty + 1,
// Linespacing properties
PercentLineHeight, ///< this propery is used for a percentage of the highest character on that line
FixedLineHeight, ///< this propery is used to use a non-default line height
MinimumLineHeight, ///< this property is used to have a minimum line spacing
LineSpacing, ///< Hard leader height.
LineSpacingFromFont, ///< if false, use fontsize (in pt) solely, otherwise respect font settings
AlignLastLine, ///< When the paragraph is justified, what to do with the last word line
WidowThreshold, ///< If 'keep together'=false, amount of lines to keep it anyway.
OrphanThreshold, ///< If 'keep together'=false, amount of lines to keep it anyway.
DropCaps, /*10*/ ///< defines if a paragraph renders its first char(s) with drop-caps
DropCapsLength, ///< Number of glyphs to show as drop-caps
DropCapsLines, ///< Number of lines that the drop-caps span
DropCapsDistance, ///< Distance between drop caps and text
DropCapsTextStyle, ///< Text style of dropped chars.
FollowDocBaseline, ///< If true the baselines will be aligned with the doc-wide grid
// border stuff
HasLeftBorder, ///< If true, paint a border on the left
HasTopBorder, ///< If true, paint a border on the top
HasRightBorder, ///< If true, paint a border on the right
HasBottomBorder,///< If true, paint a border on the bottom
BorderLineWidth, /*20*/ ///< Thickness of inner-border
SecondBorderLineWidth, ///< Thickness of outer-border
DistanceToSecondBorder, ///< Distance between inner and outer border
LeftPadding, ///< distance between text and border
TopPadding, ///< distance between text and border
RightPadding, ///< distance between text and border
BottomPadding, ///< distance between text and border
LeftBorderWidth, ///< The thickness of the border, or 0 if there is no border
LeftInnerBorderWidth, ///< In case of style being 'double' the thickness of the inner border line
LeftBorderSpacing, ///< In case of style being 'double' the space between the inner and outer border lines
LeftBorderStyle, /*30*/ ///< The border style. (see BorderStyle)
LeftBorderColor, ///< The border Color
TopBorderWidth, ///< The thickness of the border, or 0 if there is no border
TopInnerBorderWidth, ///< In case of style being 'double' the thickness of the inner border line
TopBorderSpacing, ///< In case of style being 'double' the space between the inner and outer border lines
TopBorderStyle, ///< The border style. (see BorderStyle)
TopBorderColor, ///< The border Color
RightBorderWidth, ///< The thickness of the border, or 0 if there is no border
RightInnerBorderWidth, ///< In case of style being 'double' the thickness of the inner border line
RightBorderSpacing, ///< In case of style being 'double' the space between the inner and outer border lines
RightBorderStyle, /*40*/ ///< The border style. (see BorderStyle)
RightBorderColor, ///< The border Color
BottomBorderWidth, ///< The thickness of the border, or 0 if there is no border
BottomInnerBorderWidth, ///< In case of style being 'double' the thickness of the inner border line
BottomBorderSpacing, ///< In case of style being 'double' the space between the inner and outer border lines
BottomBorderStyle, ///< The border style. (see BorderStyle)
BottomBorderColor, ///< The border Color
// lists
ListStyleId, ///< Style Id of associated list style
ListStartValue, ///< Int with the list-value that that parag will have. Ignored if this is not a list.
RestartListNumbering, ///< boolean to indicate that this paragraph will have numbering restart at the list-start. Ignored if this is not a list.
ListLevel, /*50*/ ///< int with the list-level that the paragraph will get when this is a list (numbered paragraphs)
IsListHeader, ///< bool, if true the paragraph shows up as a list item, but w/o a list label.
UnnumberedListItem, ///< bool. if true this paragraph is part of a list but is not numbered
AutoTextIndent, ///< bool, says whether the paragraph is auto-indented or not
TabStopDistance, ///< Double, Length. specifies that there's a tab stop every n inches
///< (after the last of the TabPositions, if any)
TabPositions, ///< A list of tab positions
TextProgressionDirection,
MasterPageName, ///< Optional name of the master-page
OutlineLevel, ///< Outline level for headings
DefaultOutlineLevel,
// numbering
LineNumbering, /*60*/ ///< bool, specifies whether lines should be numbered in this paragraph
LineNumberStartValue, ///< integer value that specifies the number for the first line in the paragraph
SectionStartings, ///< list of section definitions
SectionEndings, ///< list <end of a named section>
// do 15.5.24
// continue at 15.5.28
ForceDisablingList, ///< bool, for compatibility with the weird text:enable-numbering attribute not used anymore by OpenOffice.org
// other properties
BackgroundTransparency, ///< qreal between 0 and 1, background transparency
SnapToLayoutGrid, ///< bool, snap the paragraph to the layout grid of the page
JoinBorder, ///< bool, whether a border for one paragraph is to be extended around the following paragraph
RegisterTrue, ///< bool, align lines on both sides of a printed text
StrictLineBreak, ///< bool, if true, line breaks are forbidden between some characters
JustifySingleWord, ///< bool, if true, a single word will be justified
BreakBefore, ///< KoText::TextBreakProperty, whether there is a page/column break before the paragraphs
BreakAfter, ///< KoText::TextBreakProperty, whether there is a page/column break after the paragraphs
AutomaticWritingMode, ///< bool
PageNumber, ///< int, 0 means auto (ie. previous page number + 1), N sets up a new page number
TextAutoSpace, ///< AutoSpace, indicating whether to add space between portions of Asian, Western and complex texts
KeepWithNext, ///< Try to keep this block with its following block on the same page
KeepHyphenation, ///< bool, whether both parts of a hyphenated word shall lie within a single page
HyphenationLadderCount, ///< int, 0 means no limit, else limit the number of successive hyphenated line areas in a block
PunctuationWrap, ///< bool, whether a punctuation mark can be at the end of a full line (false) or not (true)
VerticalAlignment, ///< KoParagraphStyle::VerticalAlign, the alignment of this paragraph text
HiddenByTable, ///< don't let this paragraph have any height
NormalLineHeight, ///< bool, internal property for reserved usage
BibliographyData,
TableOfContentsData, // set when block is instead a TableOfContents
GeneratedDocument, // set when block is instead a generated document
Shadow, //< KoShadowStyle, the shadow of this paragraph
NextStyle, ///< holds the styleId of the style to be used on a new paragraph
ParagraphListStyleId, ///< this holds the listStyleId of the list got from style:list-style-name property from ODF 1.2
EndCharStyle // QSharedPointer<KoCharacterStyle> used when final line is empty
};
enum AutoSpace {
NoAutoSpace, ///< space should not be added between portions of Asian, Western and complex texts
IdeographAlpha ///< space should be added between portions of Asian, Western and complex texts
};
enum VerticalAlign {
VAlignAuto,
VAlignBaseline,
VAlignBottom,
VAlignMiddle,
VAlignTop
};
/// Constructor
KoParagraphStyle(QObject *parent = 0);
/// Creates a KoParagrahStyle with the given block format, the block character format and \a parent
KoParagraphStyle(const QTextBlockFormat &blockFormat, const QTextCharFormat &blockCharFormat, QObject *parent = 0);
/// Destructor
- ~KoParagraphStyle();
+ ~KoParagraphStyle() override;
- virtual KoCharacterStyle::Type styleType() const;
+ KoCharacterStyle::Type styleType() const override;
/// Creates a KoParagraphStyle that represents the formatting of \a block.
static KoParagraphStyle *fromBlock(const QTextBlock &block, QObject *parent = 0);
/// creates a clone of this style with the specified parent
KoParagraphStyle *clone(QObject *parent = 0) const;
// ***** Linespacing
/**
* Sets the line height as a percentage of the highest character on that line.
* A good typographically correct value would be 120%
* Note that lineSpacing() is added to this.
* You should consider doing a remove(KoParagraphStyle::LineSpacing); because if set, it will
* be used instead of this value.
* @see setLineSpacingFromFont
*/
void setLineHeightPercent(qreal lineHeight);
/// @see setLineHeightPercent
qreal lineHeightPercent() const;
/**
* Sets the line height to a specific pt-based height, ignoring the font size.
* Setting this will ignore the lineHeightPercent() and lineSpacing() values.
*/
void setLineHeightAbsolute(qreal height);
/// @see setLineHeightAbsolute
qreal lineHeightAbsolute() const;
/**
* Sets the line height to have a minimum height in pt.
* You should consider doing a remove(KoParagraphStyle::FixedLineHeight); because if set, it will
* be used instead of this value.
*/
void setMinimumLineHeight(const QTextLength &height);
/// @see setMinimumLineHeight
qreal minimumLineHeight() const;
/**
* Sets the space between two lines to be a specific height. The total linespacing will become
* the line height + this height. Where the line height is dependent on the font.
* You should consider doing a remove(KoParagraphStyle::FixedLineHeight) and a
* remove(KoParagraphStyle::PercentLineHeight); because if set, they will be used instead of this value.
*/
void setLineSpacing(qreal spacing);
/// @see setLineSpacing
qreal lineSpacing() const;
/**
* Set the line-height to "normal". This overwrites a line-height set before either
* with \a setLineHeightAbsolute or \a setMinimumLineHeight . If set then a value
* set with \a setLineSpacing will be ignored.
*/
void setNormalLineHeight();
/// @see setNormalLineHeight
bool hasNormalLineHeight() const;
/**
* If set to true the font-encoded height will be used instead of the font-size propery
* This property influences setLineHeightPercent() behavior.
* When off (default) a font of 12pt will always have a linespacing of 12pt times the
* current linespacing percentage. When on the linespacing embedded in the font
* is used which can differ for various fonts, even if they are the same pt-size.
*/
void setLineSpacingFromFont(bool on);
/**
* @see setLineSpacingFromFont
*/
bool lineSpacingFromFont() const;
/**
* For paragraphs that are justified the last line alignment is specified here.
* There are only 3 valid options, Left, Center and Justified. (where Left will
* be right aligned for RTL text).
*/
void setAlignLastLine(Qt::Alignment alignment);
/**
* @see setAlignLastLine
*/
Qt::Alignment alignLastLine() const;
/**
* Paragraphs that are broken across two frames are normally broken at the bottom
* of the frame. Using this property we can set the minimum number of lines that should
* appear in the second frame to avoid really short paragraphs standing alone (also called
* widows). So, if a 10 line parag is broken in a way that only one line is in the second
* frame, setting a widowThreshold of 4 will break at 6 lines instead to leave the
* requested 4 lines.
*/
void setWidowThreshold(int lines);
/**
* @see setWidowThreshold
*/
int widowThreshold() const;
/**
* Paragraphs that are broken across two frames are normally broken at the bottom
* of the frame. Using this property we can set the minimum number of lines that should
* appear in the first frame to avoid really short paragraphs standing alone (also called
* orphans). So, if a paragraph is broken so only 2 line is left in the first frame
* setting the orphanThreshold to something greater than 2 will move the whole paragraph
* to the second frame.
*/
void setOrphanThreshold(int lines);
/**
* @see setOrphanThreshold
*/
int orphanThreshold() const;
/**
* If true, make the first character span multiple lines.
* @see setDropCapsLength
* @see setDropCapsLines
* @see dropCapsDistance
*/
void setDropCaps(bool on);
/**
* @see setDropCaps
*/
bool dropCaps() const;
/**
* Set the number of glyphs to show as drop-caps
* @see setDropCaps
* @see setDropCapsLines
* @see dropCapsDistance
*/
void setDropCapsLength(int characters);
/**
* set dropCaps Length in characters
* @see setDropCapsLength
*/
int dropCapsLength() const;
/**
* Set the number of lines that the drop-caps span
* @see setDropCapsLength
* @see setDropCaps
* @see dropCapsDistance
*/
void setDropCapsLines(int lines);
/**
* The dropCapsLines
* @see setDropCapsLines
*/
int dropCapsLines() const;
/**
* set the distance between drop caps and text in pt
* @see setDropCapsLength
* @see setDropCaps
* @see setDropCapsLines
*/
void setDropCapsDistance(qreal distance);
/**
* The dropCaps distance
* @see setDropCapsDistance
*/
qreal dropCapsDistance() const;
/**
* Set the style id of the text style used for dropcaps
* @see setDropCapsDistance
*/
void setDropCapsTextStyleId(int id);
/**
* The style id of the text style used for dropcaps
* @see setDropCapsTextStyleId
*/
int dropCapsTextStyleId() const;
/**
* If true the baselines will be aligned with the doc-wide grid
*/
void setFollowDocBaseline(bool on);
/**
* return if baseline alignment is used
* @see setFollowDocBaseline
*/
bool followDocBaseline() const;
/// See similar named method on QTextBlockFormat
void setBackground(const QBrush &brush);
/// See similar named method on QTextBlockFormat
QBrush background() const;
/// See similar named method on QTextBlockFormat
void clearBackground();
qreal backgroundTransparency() const;
void setBackgroundTransparency(qreal transparency);
bool snapToLayoutGrid() const;
void setSnapToLayoutGrid(bool value);
bool registerTrue() const;
void setRegisterTrue(bool value);
bool strictLineBreak() const;
void setStrictLineBreak(bool value);
bool justifySingleWord() const;
void setJustifySingleWord(bool value);
bool automaticWritingMode() const;
void setAutomaticWritingMode(bool value);
void setPageNumber(int pageNumber);
int pageNumber() const;
void setKeepWithNext(bool value);
bool keepWithNext() const;
void setPunctuationWrap(bool value);
bool punctuationWrap() const;
void setTextAutoSpace(AutoSpace value);
AutoSpace textAutoSpace() const;
void setKeepHyphenation(bool value);
bool keepHyphenation() const;
void setHyphenationLadderCount(int value);
int hyphenationLadderCount() const;
VerticalAlign verticalAlignment() const;
void setVerticalAlignment(VerticalAlign value);
void setBreakBefore(KoText::KoTextBreakProperty value);
KoText::KoTextBreakProperty breakBefore() const;
void setBreakAfter(KoText::KoTextBreakProperty value);
KoText::KoTextBreakProperty breakAfter() const;
void setLeftPadding(qreal padding);
qreal leftPadding() const;
void setTopPadding(qreal padding);
qreal topPadding() const;
void setRightPadding(qreal padding);
qreal rightPadding() const;
void setBottomPadding(qreal padding);
qreal bottomPadding() const;
void setPadding(qreal padding);
void setLeftBorderWidth(qreal width);
qreal leftBorderWidth() const;
void setLeftInnerBorderWidth(qreal width);
qreal leftInnerBorderWidth() const;
void setLeftBorderSpacing(qreal width);
qreal leftBorderSpacing() const;
void setLeftBorderStyle(KoBorder::BorderStyle style);
KoBorder::BorderStyle leftBorderStyle() const;
void setLeftBorderColor(const QColor &color);
QColor leftBorderColor() const;
void setTopBorderWidth(qreal width);
qreal topBorderWidth() const;
void setTopInnerBorderWidth(qreal width);
qreal topInnerBorderWidth() const;
void setTopBorderSpacing(qreal width);
qreal topBorderSpacing() const;
void setTopBorderStyle(KoBorder::BorderStyle style);
KoBorder::BorderStyle topBorderStyle() const;
void setTopBorderColor(const QColor &color);
QColor topBorderColor() const;
void setRightBorderWidth(qreal width);
qreal rightBorderWidth() const;
void setRightInnerBorderWidth(qreal width);
qreal rightInnerBorderWidth() const;
void setRightBorderSpacing(qreal width);
qreal rightBorderSpacing() const;
void setRightBorderStyle(KoBorder::BorderStyle style);
KoBorder::BorderStyle rightBorderStyle() const;
void setRightBorderColor(const QColor &color);
QColor rightBorderColor() const;
void setBottomBorderWidth(qreal width);
qreal bottomBorderWidth() const;
void setBottomInnerBorderWidth(qreal width);
qreal bottomInnerBorderWidth() const;
void setBottomBorderSpacing(qreal width);
qreal bottomBorderSpacing() const;
void setBottomBorderStyle(KoBorder::BorderStyle style);
KoBorder::BorderStyle bottomBorderStyle() const;
void setBottomBorderColor(const QColor &color);
QColor bottomBorderColor() const;
bool joinBorder() const;
void setJoinBorder(bool value);
KoText::Direction textProgressionDirection() const;
void setTextProgressionDirection(KoText::Direction dir);
// ************ properties from QTextBlockFormat
/// duplicated property from QTextBlockFormat
void setTopMargin(QTextLength topMargin);
/// duplicated property from QTextBlockFormat
qreal topMargin() const;
/// duplicated property from QTextBlockFormat
void setBottomMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal bottomMargin() const;
/// duplicated property from QTextBlockFormat
void setLeftMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal leftMargin() const;
/// duplicated property from QTextBlockFormat
void setRightMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal rightMargin() const;
/// set the margin around the paragraph, making the margin on all sides equal.
void setMargin(QTextLength margin);
void setIsListHeader(bool on);
bool isListHeader() const;
/// duplicated property from QTextBlockFormat
void setAlignment(Qt::Alignment alignment);
/// duplicated property from QTextBlockFormat
Qt::Alignment alignment() const;
/// duplicated property from QTextBlockFormat
void setTextIndent(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal textIndent() const;
/// Custom KoParagraphStyle property for auto-text-indent
void setAutoTextIndent(bool on);
bool autoTextIndent() const;
/// duplicated property from QTextBlockFormat
void setNonBreakableLines(bool on);
/// duplicated property from QTextBlockFormat
bool nonBreakableLines() const;
/// set the default style this one inherits its unset properties from if no parent style.
void setDefaultStyle(KoParagraphStyle *parent);
/// set the parent style this one inherits its unset properties from.
void setParentStyle(KoParagraphStyle *parent);
/// return the parent style
KoParagraphStyle *parentStyle() const;
/// the 'next' style is the one used when the user creates a new paragraph after this one.
void setNextStyle(int next);
/// the 'next' style is the one used when the user creates a new paragraph after this one.
int nextStyle() const;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/// return the optional name of the master-page or a QString() if this paragraph isn't attached to a master-page.
QString masterPageName() const;
/// Set the name of the master-page.
void setMasterPageName(const QString &name);
/// Set the list start value
void setListStartValue(int value);
/// Returns the list start value
int listStartValue() const;
/// Set to true if this paragraph is marked to start the list numbering from the first entry.
void setRestartListNumbering(bool on);
/// return if this paragraph is marked to start the list numbering from the first entry.
bool restartListNumbering();
/// Set the tab stop distance for this paragraph style.
void setTabStopDistance(qreal value);
/// return the tab stop distance for this paragraph style
qreal tabStopDistance() const;
/// Set the tab data for this paragraph style.
void setTabPositions(const QList<KoText::Tab> &tabs);
/// return the tabs data for this paragraph style
QList<KoText::Tab> tabPositions() const;
/// If this style is a list, then this sets the nested-ness (aka level) of this paragraph. A H2 has level 2.
void setListLevel(int value);
/// return the list level.
int listLevel() const;
/**
* Return the outline level of this block, or 0 if it's not a heading.
* This information is here and not in the styles because the OpenDocument specification says so.
* See ODF Spec 1.1, §14.1, Outline Numbering Level, but also other parts of the specification.
*/
int outlineLevel() const;
/**
* Change this block outline level
*/
void setOutlineLevel(int outline);
/**
* Return the default outline level of this style, or 0 if there is none.
*/
int defaultOutlineLevel() const;
/**
* Change the default outline level for this style.
*/
void setDefaultOutlineLevel(int outline);
/**
* 15.5.30: The text:number-lines attribute controls whether or not lines are numbered
*/
bool lineNumbering() const;
void setLineNumbering(bool lineNumbering);
/**
* 15.5.31:
* The text:line-number property specifies a new start value for line numbering. The attribute is
* only recognized if there is also a text:number-lines attribute with a value of true in the
* same properties element.
*/
int lineNumberStartValue() const;
void setLineNumberStartValue(int lineNumberStartValue);
/**
* 20.349 style:shadow
* The style:shadow attribute specifies a shadow effect.
* The defined values for this attribute are those defined in §7.16.5 of [XSL], except the value
* inherit.
* The shadow effect is not applied to the text content of an element, but depending on the element
* where the attribute appears, to a paragraph, a text box, a page body, a header, a footer, a table
* or a table cell.
*/
KoShadowStyle shadow() const;
void setShadow (const KoShadowStyle &shadow);
/// copy all the properties from the other style to this style, effectively duplicating it.
void copyProperties(const KoParagraphStyle *style);
void unapplyStyle(QTextBlock &block) const;
/**
* Apply this style to a blockFormat by copying all properties from this, and parent
* styles to the target block format. Note that the character format will not be applied
* using this method, use the other applyStyle() method for that.
*/
void applyStyle(QTextBlockFormat &format) const;
/**
* Apply this style to the textBlock by copying all properties from this, parent and
* the character style (where relevant) to the target block formats.
*/
void applyStyle(QTextBlock &block, bool applyListStyle = true) const;
/*
/// return the character "properties" for this paragraph style, Note it does not inherit
KoCharacterStyle *characterStyle();
/// return the character "properties" for this paragraph style, Note it does not inherit
const KoCharacterStyle *characterStyle() const;
/// set the character "properties" for this paragraph style
void setCharacterStyle(KoCharacterStyle *style);
*/
/**
* Returns the list style for this paragraph style.
* @see KoListStyle::isValid()
* @see setListStyle()
* @see removeListStyle()
*/
KoListStyle *listStyle() const;
/**
* Set a new liststyle on this paragraph style, making all paragraphs that use this style
* automatically be part of the list.
* @see setListStyle()
* @see removeListStyle()
*/
void setListStyle(KoListStyle *style);
void remove(int key);
/// Compare the paragraph, character and list properties of this style with the other
bool operator==(const KoParagraphStyle &other) const;
/// Compare the paragraph properties of this style with other
bool compareParagraphProperties(const KoParagraphStyle &other) const;
void removeDuplicates(const KoParagraphStyle &other);
/**
* Load the style form the element
*
* @param context the odf loading context
* @param element the element containing the style
* @param loadParents true = use the stylestack, false = use just the element
*/
void loadOdf(const KoXmlElement *element, KoShapeLoadingContext &context,
bool loadParents = false);
void saveOdf(KoGenStyle &style, KoShapeSavingContext &context) const;
/**
* Returns true if this paragraph style has the property set.
* Note that this method does not delegate to the parent style.
* @param key the key as found in the Property enum
*/
bool hasProperty(int key) const;
/**
* Set a property with key to a certain value, overriding the value from the parent style.
* If the value set is equal to the value of the parent style, the key will be removed instead.
* @param key the Property to set.
* @param value the new value to set on this style.
* @see hasProperty(), value()
*/
void setProperty(int key, const QVariant &value);
/**
* Return the value of key as represented on this style, taking into account parent styles.
* You should consider using the direct accessors for individual properties instead.
* @param key the Property to request.
* @returns a QVariant which holds the property value.
*/
QVariant value(int key) const;
/**
* Returns true if this pragraph style has default properties
* Note that the value of StyleId property is not considered
*/
bool hasDefaults() const;
KoList *list() const;
void applyParagraphListStyle(QTextBlock &block, const QTextBlockFormat &blockFormat) const;
/** Returns true if the style is in use.
*/
bool isApplied() const;
Q_SIGNALS:
void nameChanged(const QString &newName);
void styleApplied(const KoParagraphStyle*) const;
private:
/**
* Load the style from the \a KoStyleStack style stack using the
* OpenDocument format.
*/
void loadOdfProperties(KoShapeLoadingContext &scontext);
qreal propertyDouble(int key) const;
QTextLength propertyLength(int key) const;
int propertyInt(int key) const;
bool propertyBoolean(int key) const;
QColor propertyColor(int key) const;
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoParagraphStyle *)
Q_DECLARE_METATYPE(const KoParagraphStyle *)
Q_DECLARE_METATYPE(QSharedPointer<KoParagraphStyle>)
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoSectionStyle.h b/plugins/flake/textshape/kotext/styles/KoSectionStyle.h
index 65e390615c..5bbe9d9cd3 100644
--- a/plugins/flake/textshape/kotext/styles/KoSectionStyle.h
+++ b/plugins/flake/textshape/kotext/styles/KoSectionStyle.h
@@ -1,216 +1,216 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSECTIONSTYLE_H
#define KOSECTIONSTYLE_H
#include "KoColumns.h"
#include "KoText.h"
#include "kritatext_export.h"
#include <QObject>
#include <QTextFormat>
class QTextFrame;
class QTextFrameFormat;
class KoGenStyle;
class KoOdfLoadingContext;
class QString;
class QVariant;
/**
* A container for all properties for the section wide style.
* Each section in the main text either is based on a section style, or its not. Where
* it is based on a section style this is indecated that it has a property 'StyleId'
* with an integer as value. The integer value corresponds to the styleId() output of
* a specific KoSectionStyle.
* @see KoStyleManager
*/
class KRITATEXT_EXPORT KoSectionStyle : public QObject
{
Q_OBJECT
public:
enum Property {
StyleId = QTextFormat::UserProperty + 1,
TextProgressionDirection,
ColumnCount,
ColumnData,
ColumnGapWidth,
SeparatorStyle,
SeparatorColor,
SeparatorVerticalAlignment,
SeparatorWidth,
SeparatorHeight
};
/// Constructor
explicit KoSectionStyle(QObject *parent = 0);
/// Creates a KoSectionStyle with the given frame format and \a parent
explicit KoSectionStyle(const QTextFrameFormat &frameFormat, QObject *parent = 0);
/// Destructor
- ~KoSectionStyle();
+ ~KoSectionStyle() override;
/// creates a clone of this style with the specified parent
KoSectionStyle *clone(QObject *parent = 0) const;
/// duplicated property from QTextBlockFormat
void setLeftMargin(qreal margin);
/// duplicated property from QTextBlockFormat
qreal leftMargin() const;
/// duplicated property from QTextBlockFormat
void setRightMargin(qreal margin);
/// duplicated property from QTextBlockFormat
qreal rightMargin() const;
KoText::Direction textProgressionDirection() const;
void setTextProgressionDirection(KoText::Direction dir);
/// See similar named method on QTextBlockFormat
void setBackground(const QBrush &brush);
/// See similar named method on QTextBlockFormat
QBrush background() const;
/// See similar named method on QTextBlockFormat
void clearBackground();
#if 0
as this is a duplicate of leftMargin, lets make it very clear we are using that one.
/// duplicated property from QTextBlockFormat
void setIndent(int indent);
/// duplicated property from QTextBlockFormat
int indent() const;
#endif
void setColumnCount(int columnCount);
int columnCount() const;
void setColumnGapWidth(qreal columnGapWidth);
qreal columnGapWidth() const;
void setColumnData(const QList<KoColumns::ColumnDatum> &columnData);
QList<KoColumns::ColumnDatum> columnData() const;
void setSeparatorStyle(KoColumns::SeparatorStyle separatorStyle);
KoColumns::SeparatorStyle separatorStyle() const;
void setSeparatorColor(const QColor &separatorColor);
QColor separatorColor() const;
void setSeparatorVerticalAlignment(KoColumns::SeparatorVerticalAlignment separatorVerticalAlignment);
KoColumns::SeparatorVerticalAlignment separatorVerticalAlignment() const;
void setSeparatorWidth(qreal separatorWidth);
qreal separatorWidth() const;
void setSeparatorHeight(int separatorHeight);
int separatorHeight() const;
/// set the parent style this one inherits its unset properties from.
void setParentStyle(KoSectionStyle *parent);
/// return the parent style
KoSectionStyle *parentStyle() const;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/// copy all the properties from the other style to this style, effectively duplicating it.
void copyProperties(const KoSectionStyle *style);
void unapplyStyle(QTextFrame &section) const;
/**
* Apply this style to a frameFormat by copying all properties from this, and parent
* styles to the target frame format. Note that the character format will not be applied
* using this method, use the other applyStyle() method for that.
*/
void applyStyle(QTextFrameFormat &format) const;
/**
* Apply this style to the section (QTextFrame) by copying all properties from this and parent
* to the target frame formats.
*/
void applyStyle(QTextFrame &section) const;
void remove(int key);
/// Compare the section of this style with the other
bool operator==(const KoSectionStyle &other) const;
/// Compare the section properties of this style with other
bool compareSectionProperties(const KoSectionStyle &other) const;
void removeDuplicates(const KoSectionStyle &other);
/**
* Load the style form the element
*
* @param context the odf loading context
* @param element the element containing the
*/
void loadOdf(const KoXmlElement *element, KoOdfLoadingContext &context);
void saveOdf(KoGenStyle &style);
/**
* Returns true if this section style has the property set.
* Note that this method does not delegate to the parent style.
* @param key the key as found in the Property enum
*/
bool hasProperty(int key) const;
/**
* Set a property with key to a certain value, overriding the value from the parent style.
* If the value set is equal to the value of the parent style, the key will be removed instead.
* @param key the Property to set.
* @param value the new value to set on this style.
* @see hasProperty(), value()
*/
void setProperty(int key, const QVariant &value);
/**
* Return the value of key as represented on this style, taking into account parent styles.
* You should consider using the direct accessors for individual properties instead.
* @param key the Property to request.
* @returns a QVariant which holds the property value.
*/
QVariant value(int key) const;
Q_SIGNALS:
void nameChanged(const QString &newName);
private:
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoSectionStyle *)
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoStyleManager.h b/plugins/flake/textshape/kotext/styles/KoStyleManager.h
index ec1af7ddce..7021fa6601 100644
--- a/plugins/flake/textshape/kotext/styles/KoStyleManager.h
+++ b/plugins/flake/textshape/kotext/styles/KoStyleManager.h
@@ -1,551 +1,551 @@
/* This file is part of the KDE project
* Copyright (C) 2006 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSTYLEMANAGER_H
#define KOSTYLEMANAGER_H
#include "kritatext_export.h"
#include "KoOdfNotesConfiguration.h"
#include <QObject>
#include <QMetaType>
#include <QVector>
class KoCharacterStyle;
class KoParagraphStyle;
class KoListStyle;
class KoTableStyle;
class KoTableColumnStyle;
/// This signal is to allow listener to make an undo command out of it
class KoTableRowStyle;
class KoTableCellStyle;
class KoSectionStyle;
class KoShapeSavingContext;
class KoTextShapeData;
class KoTextTableTemplate;
class KoOdfBibliographyConfiguration;
/**
* Manages all character, paragraph, table and table cell styles for any number
* of documents.
*/
class KRITATEXT_EXPORT KoStyleManager : public QObject
{
Q_OBJECT
public:
/**
* Create a new style manager.
* @param parent pass a parent to use qobject memory management
*/
explicit KoStyleManager(QObject *parent = 0);
/**
* Destructor.
*/
- virtual ~KoStyleManager();
+ ~KoStyleManager() override;
/**
* Mark the beginning of a sequence of style changes, additions, and deletions
*
* Important: This method must be called even if only working on a single style.
*
* See also \ref endEdit
*/
void beginEdit();
/**
* Mark the end of a sequence of style changes, additions, and deletions.
*
* Manipulation to the styles happen immidiately, but calling this method
* will allow applications to put a command on the stack for undo, and for qtextdocments
* to reflect the style changes.
*
* Important: This method must be called even if only working on a single style.
*
* See also \ref beginEdit
*/
void endEdit();
// load is not needed as it is done in KoTextSharedLoadingData
/**
* Save document styles
*/
void saveOdf(KoShapeSavingContext &context);
/**
* Save document styles that are being referred to but not yet saved
*/
void saveReferredStylesToOdf(KoShapeSavingContext &context);
/**
* Save the default-style styles
*/
void saveOdfDefaultStyles(KoShapeSavingContext &context);
/**
* Add a new style, automatically giving it a new styleId.
*/
void add(KoCharacterStyle *style);
/**
* Add a new style, automatically giving it a new styleId.
*/
void add(KoParagraphStyle *style);
/**
* Add a new list style, automatically giving it a new styleId.
*/
void add(KoListStyle *style);
/**
* Add a new table style, automatically giving it a new styleId.
*/
void add(KoTableStyle *style);
/**
* Add a new table column style, automatically giving it a new styleId.
*/
void add(KoTableColumnStyle *style);
/**
* Add a new table row style, automatically giving it a new styleId.
*/
void add(KoTableRowStyle *style);
/**
* Add a new table cell style, automatically giving it a new styleId.
*/
void add(KoTableCellStyle *style);
/**
* Add a new section style, automatically giving it a new styleId.
*/
void add(KoSectionStyle *style);
/**
* Add a table template, automatically giving it a new styleId.
*/
void add(KoTextTableTemplate *tableTemplate);
/**
* set the notes configuration of the document
*/
void setNotesConfiguration(KoOdfNotesConfiguration *notesConfiguration);
/**
* set the notes configuration of the document
*/
void setBibliographyConfiguration(KoOdfBibliographyConfiguration *bibliographyConfiguration);
/**
* Remove a style.
*/
void remove(KoCharacterStyle *style);
/**
* Remove a style.
*/
void remove(KoParagraphStyle *style);
/**
* Remove a list style.
*/
void remove(KoListStyle *style);
/**
* Remove a table style.
*/
void remove(KoTableStyle *style);
/**
* Remove a table column style.
*/
void remove(KoTableColumnStyle *style);
/**
* Remove a table row style.
*/
void remove(KoTableRowStyle *style);
/**
* Remove a table cell style.
*/
void remove(KoTableCellStyle *style);
/**
* Remove a section style.
*/
void remove(KoSectionStyle *style);
/**
* Return a characterStyle by its id.
* From documents you can retrieve the id out of each QTextCharFormat
* by requesting the KoCharacterStyle::StyleId property.
* @param id the unique Id to search for.
* @see KoCharacterStyle::styleId()
*/
KoCharacterStyle *characterStyle(int id) const;
/**
* Return a paragraphStyle by its id.
* From documents you can retrieve the id out of each QTextBlockFormat
* by requesting the KoParagraphStyle::StyleId property.
* @param id the unique Id to search for.
* @see KoParagraphStyle::styleId()
*/
KoParagraphStyle *paragraphStyle(int id) const;
/**
* Return a list style by its id.
*/
KoListStyle *listStyle(int id) const;
/**
* Return a tableStyle by its id.
* From documents you can retrieve the id out of each QTextTableFormat
* by requesting the KoTableStyle::StyleId property.
* @param id the unique Id to search for.
* @see KoTableStyle::styleId()
*/
KoTableStyle *tableStyle(int id) const;
/**
* Return a tableColumnStyle by its id.
* From documents you can retrieve the id out of the KoTableRowandColumnStyleManager
* @param id the unique Id to search for.
* @see KoTableColumnStyle::styleId()
*/
KoTableColumnStyle *tableColumnStyle(int id) const;
/**
* Return a tableRowStyle by its id.
* From documents you can retrieve the id out of the KoTableRowandColumnStyleManager
* @param id the unique Id to search for.
* @see KoTableRowStyle::styleId()
*/
KoTableRowStyle *tableRowStyle(int id) const;
/**
* Return a tableCellStyle by its id.
* From documents you can retrieve the id out of each QTextTableCellFormat
* by requesting the KoTableCellStyle::StyleId property.
* @param id the unique Id to search for.
* @see KoTableCellStyle::styleId()
*/
KoTableCellStyle *tableCellStyle(int id) const;
/**
* Return a tableTemplate by its id.
* From documents you can retrieve the id out of each QTextTableFormat
* by requesting the KoTextTableTemplate::StyleId property.
* @param id the unique Id to search for.
* @see KoTextTableTemplate::styleId()
*/
KoTextTableTemplate *tableTemplate(int id) const;
/**
* Return a sectionStyle by its id.
* From documents you can retrieve the id out of each QTextFrameFormat
* by requesting the KoSectionStyle::StyleId property.
* @param id the unique Id to search for.
* @see KoSectionStyle::styleId()
*/
KoSectionStyle *sectionStyle(int id) const;
/**
* Return the first characterStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see characterStyle(id);
*/
KoCharacterStyle *characterStyle(const QString &name) const;
/**
* Return the first paragraphStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see paragraphStyle(id);
*/
KoParagraphStyle *paragraphStyle(const QString &name) const;
/**
* Returns the first listStyle ith the param use-visible-name.
*/
KoListStyle *listStyle(const QString &name) const;
/**
* Return the first tableStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see tableStyle(id);
*/
KoTableStyle *tableStyle(const QString &name) const;
/**
* Return the first tableColumnStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see tableColumnStyle(id);
*/
KoTableColumnStyle *tableColumnStyle(const QString &name) const;
/**
* Return the first tableRowStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see tableRowStyle(id);
*/
KoTableRowStyle *tableRowStyle(const QString &name) const;
/**
* Return the first tableCellStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see tableCellStyle(id);
*/
KoTableCellStyle *tableCellStyle(const QString &name) const;
/**
* Return the first tableTemplate with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see tableTemplate(id);
*/
KoTextTableTemplate *tableTemplate(const QString &name) const;
/**
* Return the first sectionStyle with the param user-visible-name.
* Since the name does not have to be unique there can be multiple
* styles registered with that name, only the first is returned
* @param name the name of the style.
* @see sectionStyle(id);
*/
KoSectionStyle *sectionStyle(const QString &name) const;
/**
* Return the default character style that will always be present in each
* document. You can alter the style, but you can never delete it.
* The default is suppost to stay invisible to the user and its called
* i18n("Default") for that reason. Applications should not
* show this style in their document-level configure dialogs.
*/
KoCharacterStyle *defaultCharacterStyle() const;
/**
* Return the default paragraph style that will always be present in each
* document. You can alter the style, but you can never delete it.
* The default is suppost to stay invisible to the user and its called
* i18n("Default") for that reason. Applications should not
* show this style in their document-level configure dialogs.
*/
KoParagraphStyle *defaultParagraphStyle() const;
/**
* @return the notes configuration
*/
KoOdfNotesConfiguration *notesConfiguration(KoOdfNotesConfiguration::NoteClass noteClass) const;
/**
* @return the bibliography configuration
*/
KoOdfBibliographyConfiguration *bibliographyConfiguration() const;
/**
* Returns the default list style to be used for lists, headers, paragraphs
* that do not specify a list-style
*/
KoListStyle *defaultListStyle() const;
/**
* Returns the default outline style to be used if outline-style is not specified in the document
* that do not specify a list-style
*/
KoListStyle *defaultOutlineStyle() const;
/**
* Sets the outline style to be used for headers that are not specified as lists
*/
void setOutlineStyle(KoListStyle *listStyle);
/**
* Returns the outline style to be used for headers that are not specified as lists
*/
KoListStyle *outlineStyle() const;
/// return all the characterStyles registered.
QList<KoCharacterStyle*> characterStyles() const;
/// return all the paragraphStyles registered.
QList<KoParagraphStyle*> paragraphStyles() const;
/// return all the listStyles registered.
QList<KoListStyle*> listStyles() const;
/// return all the tableStyles registered.
QList<KoTableStyle*> tableStyles() const;
/// return all the tableColumnStyles registered.
QList<KoTableColumnStyle*> tableColumnStyles() const;
/// return all the tableRowStyles registered.
QList<KoTableRowStyle*> tableRowStyles() const;
/// return all the tableCellStyles registered.
QList<KoTableCellStyle*> tableCellStyles() const;
/// return all the sectionStyles registered.
QList<KoSectionStyle*> sectionStyles() const;
/// returns the default style for the ToC entries for the specified outline level
KoParagraphStyle *defaultTableOfContentsEntryStyle(int outlineLevel) const;
/// returns the default style for the ToC title
KoParagraphStyle *defaultTableOfcontentsTitleStyle() const;
/// returns the default style for the Bibliography entries for the specified bibliography type
KoParagraphStyle *defaultBibliographyEntryStyle(const QString &bibType);
/// returns the default style for the Bibliography title
KoParagraphStyle *defaultBibliographyTitleStyle() const;
/// adds a paragraph style to unused paragraph style list
void addUnusedStyle(KoParagraphStyle *style);
/// moves a style from the unused list to the used list i.e paragStyles list
void moveToUsedStyles(int id);
KoParagraphStyle *unusedStyle(int id) const;
QVector<int> usedCharacterStyles() const;
QVector<int> usedParagraphStyles() const;
Q_SIGNALS:
void styleAdded(KoParagraphStyle*);
void styleAdded(KoCharacterStyle*);
void styleAdded(KoListStyle*);
void styleAdded(KoTableStyle*);
void styleAdded(KoTableColumnStyle*);
void styleAdded(KoTableRowStyle*);
void styleAdded(KoTableCellStyle*);
void styleAdded(KoSectionStyle*);
void styleRemoved(KoParagraphStyle*);
void styleRemoved(KoCharacterStyle*);
void styleRemoved(KoListStyle*);
void styleRemoved(KoTableStyle*);
void styleRemoved(KoTableColumnStyle*);
void styleRemoved(KoTableRowStyle*);
void styleRemoved(KoTableCellStyle*);
void styleRemoved(KoSectionStyle*);
/// This signal is emitted whenever the style has been applied to a qtextdocument
/// This allows listeners to know which styles are in use
void styleApplied(const KoCharacterStyle*);
/// This signal is emitted whenever the style has been applied to a qtextdocument
/// This allows listeners to know which styles are in use
void styleApplied(const KoParagraphStyle*);
/// This signal is to allow listener to start an undo command
void editHasBegun();
/// This signal is to allow listener to end an undo command, and add it to the undo stack
void editHasEnded();
/// This signal is to allow listener to record into an undo command and apply to text
/// It's emitted when someone calls alteredStyle (not paragraph or character)
void styleHasChanged(int);
/// This signal is to allow listener to record into an undo command and apply to text
/// It's emitted when someone calls alteredStyle on a paragraph style
void styleHasChanged(int, const KoParagraphStyle*, const KoParagraphStyle*);
/// This signal is to allow listener to record into an undo command and apply to text
/// It's emitted when someone calls alteredStyle on a character style
void styleHasChanged(int, const KoCharacterStyle*, const KoCharacterStyle*);
public Q_SLOTS:
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoParagraphStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoCharacterStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoListStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoTableStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoTableColumnStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoTableRowStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoTableCellStyle *style);
/**
* Slot that should be called whenever a style is changed. This will update
* all documents with the style.
* Note that successive calls are aggregated.
*/
void alteredStyle(const KoSectionStyle *style);
void slotAppliedStyle(const KoCharacterStyle*);
void slotAppliedStyle(const KoParagraphStyle*);
private:
friend class KoTextSharedLoadingData;
void addAutomaticListStyle(KoListStyle *listStyle);
friend class KoTextShapeData;
friend class KoTextShapeDataPrivate;
KoListStyle *listStyle(int id, bool *automatic) const;
private:
class Private;
Private* const d;
};
Q_DECLARE_METATYPE(KoStyleManager*)
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoTableCellStyle.h b/plugins/flake/textshape/kotext/styles/KoTableCellStyle.h
index d299088f28..e23d7c9c58 100644
--- a/plugins/flake/textshape/kotext/styles/KoTableCellStyle.h
+++ b/plugins/flake/textshape/kotext/styles/KoTableCellStyle.h
@@ -1,376 +1,376 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTABLECELLSTYLE_H
#define KOTABLECELLSTYLE_H
#include "KoText.h"
#include "kritatext_export.h"
#include <KoXmlReaderForward.h>
#include <KoBorder.h>
#include <KoShadowStyle.h>
#include <QColor>
#include <QObject>
struct Property;
class QTextTableCell;
class QRectF;
class KoStyleStack;
class KoGenStyle;
class KoParagraphStyle;
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoTableCellStylePrivate;
class QString;
class QVariant;
/**
* A container for all properties for the table cell style.
* Each tablecell in the main text either is based on a table cell style, or its not. Where
* it is based on a table cell style this is indecated that it has a property 'StyleId'
* with an integer as value. The integer value corresponds to the styleId() output of
* a specific KoTableCellStyle.
* @see KoStyleManager
*/
class KRITATEXT_EXPORT KoTableCellStyle : public QObject
{
Q_OBJECT
public:
enum CellProtectionFlag {
NoProtection,
HiddenAndProtected,
Protected,
FormulaHidden,
ProtectedAndFormulaHidden
};
enum CellTextDirection {
Default = 0,
LeftToRight,
TopToBottom
};
enum RotationAlignment {
RAlignNone,
RAlignBottom,
RAlignTop,
RAlignCenter
};
enum Property {
StyleId = QTextTableCellFormat::UserProperty + 7001,
ShrinkToFit, ///< Shrink the cell content to fit the size
Wrap, ///< Wrap the text within the cell
CellProtection, ///< The cell protection when the table is protected
PrintContent, ///< Should the content of this cell be printed
RepeatContent, ///< Display the cell content as many times as possible
DecimalPlaces, ///< Count the maximum number of decimal places to display
AlignFromType, ///< Should the alignment property be respected or should the alignment be based on the value type
RotationAngle, ///< Rotation angle of the cell content, in degrees
Direction, ///< The direction of the text in the cell. This is a CellTextDirection.
RotationAlign, ///< How the edge of the text is aligned after rotation. This is a RotationAlignment
TextWritingMode, ///< KoText::Direction, the direction for writing text in the cell
VerticalGlyphOrientation, ///< bool, specify whether this feature is enabled or not
CellBackgroundBrush, ///< the cell background brush, as QTextFormat::BackgroundBrush is used by paragraphs
VerticalAlignment, ///< the vertical alignment oinside the cell
MasterPageName, ///< Optional name of the master-page
InlineRdf, ///< Optional KoTextInlineRdf object
Borders, ///< KoBorder, the borders of this cell
Shadow, ///< KoShadowStyle, the shadow of this cell
CellIsProtected ///< boolean, if true, the cell is protected against edits
/// It's not really a property of KoTableCellStyle but defined here for convenience
,LastCellStyleProperty
};
/// Constructor
explicit KoTableCellStyle(QObject *parent = 0);
/// Creates a KoTableCellStyle with the given table cell format, and \a parent
explicit KoTableCellStyle(const QTextTableCellFormat &tableCellFormat, QObject *parent = 0);
KoTableCellStyle(const KoTableCellStyle &other);
KoTableCellStyle& operator=(const KoTableCellStyle &other);
/// Destructor
- ~KoTableCellStyle();
+ ~KoTableCellStyle() override;
/// Creates a KoTableCellStyle that represents the formatting of \a block.
static KoTableCellStyle *fromTableCell(const QTextTableCell &table, QObject *parent = 0);
/// Creates a clean QTextCharFormat, but keeps all the table cell properties.
/// This is needed since block.charformat doubles as the QTextTableCellFormat
/// This method works even if \a charFormat is not a QTextTableCellFormat
static QTextCharFormat cleanCharFormat(const QTextCharFormat &charFormat);
/// creates a clone of this style with the specified parent
KoTableCellStyle *clone(QObject *parent = 0);
/**
* Adjust the bounding rectange \boundingRect according to the paddings and margins
* of this border data. The inverse of this function is boundingRect().
*
* \sa boundingRect()
*
* @param the bounding rectangle.
* @return the adjusted rectangle.
*/
QRectF contentRect(const QRectF &boundingRect) const;
/**
* Get the bounding rect given a content rect, this is the inverse of contentRect().
*
* \sa contentRect()
*
* @param contentRect the content rectange.
* @return the bounding rectange.
*/
QRectF boundingRect(const QRectF &contentRect) const;
void setBackground(const QBrush &brush);
/// See similar named method on QTextBlockFormat
QBrush background() const;
/// See similar named method on QTextBlockFormat
void clearBackground();
/**
* Get the paragraph style for this cell style
*
* @return the paragraph style
*/
KoParagraphStyle *paragraphStyle() const;
bool shrinkToFit() const;
void setShrinkToFit(bool state);
bool repeatContent() const;
void setRepeatContent(bool state);
void setLeftPadding(qreal padding);
void setTopPadding(qreal padding);
void setRightPadding(qreal padding);
void setBottomPadding(qreal padding);
void setPadding(qreal padding);
qreal leftPadding() const;
qreal rightPadding() const;
qreal topPadding() const;
qreal bottomPadding() const;
void setAlignment(Qt::Alignment alignment);
Qt::Alignment alignment() const;
KoText::Direction textDirection() const;
void setTextDirection (KoText::Direction value);
void setWrap(bool state);
bool wrap() const;
CellProtectionFlag cellProtection() const;
void setCellProtection (CellProtectionFlag protection);
void setPrintContent(bool state);
bool printContent() const;
void setDecimalPlaces(int places);
int decimalPlaces() const;
void setAlignFromType(bool state);
bool alignFromType() const;
void setRotationAngle(qreal value);
qreal rotationAngle() const;
void setDirection(CellTextDirection direction);
CellTextDirection direction() const;
void setRotationAlignment(RotationAlignment align);
RotationAlignment rotationAlignment () const;
void setVerticalGlyphOrientation(bool state);
bool verticalGlyphOrientation() const;
void setBorders(const KoBorder &borders);
KoBorder borders() const;
void setShadow (const KoShadowStyle &shadow);
KoShadowStyle shadow() const;
/// set the parent style this one inherits its unset properties from.
void setParentStyle(KoTableCellStyle *parent);
/// return the parent style
KoTableCellStyle *parentStyle() const;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/// return the optional name of the master-page or a QString() if this paragraph isn't attached to a master-page.
QString masterPageName() const;
/// Set the name of the master-page.
void setMasterPageName(const QString &name);
/// copy all the properties from the other style to this style, effectively duplicating it.
void copyProperties(const KoTableCellStyle *style);
/**
* Apply this style to a textTableCellFormat by copying all properties from this, and parent
* styles to the target textTableCellFormat. Note that the paragraph format will not be applied
* using this method, use the other method for that.
* No default values are applied.
*/
void applyStyle(QTextTableCellFormat &format) const;
void applyStyle(QTextTableCell &cell) const;
void remove(int key);
/// Compare the paragraph, character and list properties of this style with the other
bool operator==(const KoTableCellStyle &other) const;
void removeDuplicates(const KoTableCellStyle &other);
/**
* Load the style form the element
*
* @param context the odf loading context
* @param element the element containing the
*/
void loadOdf(const KoXmlElement *element, KoShapeLoadingContext &context);
void saveOdf(KoGenStyle &style, KoShapeSavingContext &context);
/**
* Returns true if this paragraph style has the property set.
* Note that this method does not delegate to the parent style.
* @param key the key as found in the Property enum
*/
bool hasProperty(int key) const;
/**
* Set a property with key to a certain value, overriding the value from the parent style.
* If the value set is equal to the value of the parent style, the key will be removed instead.
* @param key the Property to set.
* @param value the new value to set on this style.
* @see hasProperty(), value()
*/
void setProperty(int key, const QVariant &value);
/**
* Return the value of key as represented on this style, taking into account parent styles.
* You should consider using the direct accessors for individual properties instead.
* @param key the Property to request.
* @returns a QVariant which holds the property value.
*/
QVariant value(int key) const;
/**
* Set the properties of an edge.
*
* @param side defines which edge this is for.
* @param style the border style for this side.
* @param totalWidth the thickness of the border. Sum of outerwidth, spacing and innerwidth for double borders
* @param color the color of the border line(s).
*/
void setEdge(KoBorder::BorderSide side, KoBorder::BorderStyle style,
qreal totalWidth, const QColor &color);
/**
* Set the properties of a double border.
* Note: you need to set the edge first or that would overwrite these values.
*
* The values will not be set if the border doesn't have a double style
*
* @param side defines which edge this is for.
* @param space the amount of spacing between the outer border and the inner border in case of style being double
* @param innerWidth the thickness of the inner border line in case of style being double
*/
void setEdgeDoubleBorderValues(KoBorder::BorderSide side, qreal innerWidth, qreal space);
/**
* Check if the border data has any borders.
*
* @return true if there has been at least one border set.
*/
bool hasBorders() const;
qreal leftBorderWidth() const;
qreal rightBorderWidth() const;
qreal topBorderWidth() const;
qreal bottomBorderWidth() const;
qreal leftInnerBorderWidth() const;
qreal rightInnerBorderWidth() const;
qreal topInnerBorderWidth() const;
qreal bottomInnerBorderWidth() const;
qreal leftOuterBorderWidth() const;
qreal rightOuterBorderWidth() const;
qreal topOuterBorderWidth() const;
qreal bottomOuterBorderWidth() const;
KoBorder::BorderData getEdge(KoBorder::BorderSide side) const;
KoBorder::BorderStyle getBorderStyle(KoBorder::BorderSide side) const;
Q_SIGNALS:
void nameChanged(const QString &newName);
protected:
KoTableCellStylePrivate * const d_ptr;
private:
/**
* Load the style from the \a KoStyleStack style stack using the
* OpenDocument format.
*/
void loadOdfProperties(KoShapeLoadingContext &context, KoStyleStack &styleStack);
qreal propertyDouble(int key) const;
QPen propertyPen(int key) const;
int propertyInt(int key) const;
bool propertyBoolean(int key) const;
QColor propertyColor(int key) const;
/**
* Set the format properties from an Edge structure
*
* @param side defines which edge this is for.
* @param style the border style for this side.
* @param edge the Edge that hold the properties values
*/
void setEdge(KoBorder::BorderSide side, const KoBorder::BorderData &edge, KoBorder::BorderStyle style);
Q_DECLARE_PRIVATE(KoTableCellStyle)
};
Q_DECLARE_METATYPE(KoTableCellStyle *)
#endif
diff --git a/plugins/flake/textshape/kotext/styles/KoTableStyle.h b/plugins/flake/textshape/kotext/styles/KoTableStyle.h
index 1581b48971..cb468d7cd7 100644
--- a/plugins/flake/textshape/kotext/styles/KoTableStyle.h
+++ b/plugins/flake/textshape/kotext/styles/KoTableStyle.h
@@ -1,258 +1,258 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
* Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
* Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
* Copyright (C) 2011 Pierre Ducroquet <pinaraf@pinaraf.info>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTABLESTYLE_H
#define KOTABLESTYLE_H
#include "KoText.h"
#include "kritatext_export.h"
#include <KoXmlReaderForward.h>
#include <QObject>
class KoStyleStack;
class KoGenStyle;
class KoShadowStyle;
class KoOdfLoadingContext;
class QTextTable;
class QVariant;
/**
* A container for all properties for the table wide style.
* Each table in the main text either is based on a table style, or its not. Where
* it is based on a table style this is indecated that it has a property 'StyleId'
* with an integer as value. The integer value corresponds to the styleId() output of
* a specific KoTableStyle.
* @see KoStyleManager
*/
class KRITATEXT_EXPORT KoTableStyle : public QObject
{
Q_OBJECT
public:
enum Property {
StyleId = QTextTableFormat::UserProperty + 100,
// Linespacing properties
KeepWithNext, ///< If true, keep table with next paragraph
BreakBefore, ///< If true, insert a frame break before this table
BreakAfter, ///< If true, insert a frame break after this table
MayBreakBetweenRows, ///< If true, then the table is allowed to break between rows
ColumnAndRowStyleManager, ///< QVariant of a KoColumnAndRowStyleManager
/// It's not really a property of KoTableStyle but defined here for convenience
CollapsingBorders, ///< If true, then the table has collapsing border model
MasterPageName, ///< Optional name of the master-page
NumberHeadingRows, ///< Count the number of heading rows
Visible, ///< If true, the table is visible
PageNumber, ///< The page number that is applied after the page break
TextProgressionDirection, ///< The direction of the text in the table
TableIsProtected, ///< boolean, if true, the table is protected against edits
/// It's not really a property of KoTableStyle but defined here for convenience
Shadow, ///< KoShadowStyle, the table shadow
TableTemplate, ///< KoTextTableTemplate, template for the table
UseBandingColumnStyles, ///< table:use-banding-column-styles ODF 1.2 19.736
UseBandingRowStyles, ///< table:use-banding-row-styles ODF 1.2 19.737
UseFirstColumnStyles, ///< table:use-first-column-styles ODF 1.2 19.738
UseFirstRowStyles, ///< table:use-first-row-styles ODF 1.2 19.739
UseLastColumnStyles, ///< table:use-last-column-styles ODF 1.2 19.740
UseLastRowStyles ///< table:use-last-row-styles ODF 1.2 19.741
};
/// Constructor
explicit KoTableStyle(QObject *parent = 0);
/// Creates a KoTableStyle with the given table format, and \a parent
explicit KoTableStyle(const QTextTableFormat &blockFormat, QObject *parent = 0);
/// Destructor
- ~KoTableStyle();
+ ~KoTableStyle() override;
/// Creates a KoTableStyle that represents the formatting of \a table.
static KoTableStyle *fromTable(const QTextTable &table, QObject *parent = 0);
/// creates a clone of this style with the specified parent
KoTableStyle *clone(QObject *parent = 0);
/// See similar named method on QTextFrameFormat
void setWidth(const QTextLength &width);
/// The property specifies if the table should be kept together with the next paragraph
void setKeepWithNext(bool keep);
bool keepWithNext() const;
/// This property describe the shadow of the table, if any
void setShadow (const KoShadowStyle &shadow);
KoShadowStyle shadow() const;
/// The property specifies if the table should allow it to be break. Break within a row is specified per row
void setMayBreakBetweenRows(bool allow);
bool mayBreakBetweenRows() const;
/// See similar named method on QTextBlockFormat
void setBackground(const QBrush &brush);
/// See similar named method on QTextBlockFormat
QBrush background() const;
/// See similar named method on QTextBlockFormat
void clearBackground();
int pageNumber() const;
void setPageNumber (int page);
void setBreakBefore(KoText::KoTextBreakProperty state);
KoText::KoTextBreakProperty breakBefore() const;
void setBreakAfter(KoText::KoTextBreakProperty state);
KoText::KoTextBreakProperty breakAfter() const;
void setVisible(bool on);
bool visible() const;
void setCollapsingBorderModel(bool on);
bool collapsingBorderModel() const;
KoText::Direction textDirection() const;
void setTextDirection(KoText::Direction direction);
// ************ properties from QTextTableFormat
/// duplicated property from QTextBlockFormat
void setTopMargin(QTextLength topMargin);
/// duplicated property from QTextBlockFormat
qreal topMargin() const;
/// duplicated property from QTextBlockFormat
void setBottomMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal bottomMargin() const;
/// duplicated property from QTextBlockFormat
void setLeftMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal leftMargin() const;
/// duplicated property from QTextBlockFormat
void setRightMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
qreal rightMargin() const;
/// set the margin around the table, making the margin on all sides equal.
void setMargin(QTextLength margin);
/// duplicated property from QTextBlockFormat
void setAlignment(Qt::Alignment alignment);
/// duplicated property from QTextBlockFormat
Qt::Alignment alignment() const;
/// set the parent style this one inherits its unset properties from.
void setParentStyle(KoTableStyle *parent);
/// return the parent style
KoTableStyle *parentStyle() const;
/// return the name of the style.
QString name() const;
/// set a user-visible name on the style.
void setName(const QString &name);
/// each style has a unique ID (non persistent) given out by the styleManager
int styleId() const;
/// each style has a unique ID (non persistent) given out by the styleManager
void setStyleId(int id);
/// return the optional name of the master-page or a QString() if this paragraph isn't attached to a master-page.
QString masterPageName() const;
/// Set the name of the master-page.
void setMasterPageName(const QString &name);
/// copy all the properties from the other style to this style, effectively duplicating it.
void copyProperties(const KoTableStyle *style);
/**
* Apply this style to a tableFormat by copying all properties from this, and parent
* styles to the target table format.
*/
void applyStyle(QTextTableFormat &format) const;
void remove(int key);
/// Compare the properties of this style with the other
bool operator==(const KoTableStyle &other) const;
void removeDuplicates(const KoTableStyle &other);
/// return true when there are keys defined for this style
bool isEmpty() const;
/**
* Load the style form the element
*
* @param context the odf loading context
* @param element the element containing the
*/
void loadOdf(const KoXmlElement *element, KoOdfLoadingContext &context);
void saveOdf(KoGenStyle &style);
/**
* Returns true if this table style has the property set.
* Note that this method does not delegate to the parent style.
* @param key the key as found in the Property enum
*/
bool hasProperty(int key) const;
/**
* Set a property with key to a certain value, overriding the value from the parent style.
* If the value set is equal to the value of the parent style, the key will be removed instead.
* @param key the Property to set.
* @param value the new value to set on this style.
* @see hasProperty(), value()
*/
void setProperty(int key, const QVariant &value);
/**
* Return the value of key as represented on this style, taking into account parent styles.
* You should consider using the direct accessors for individual properties instead.
* @param key the Property to request.
* @returns a QVariant which holds the property value.
*/
QVariant value(int key) const;
Q_SIGNALS:
void nameChanged(const QString &newName);
private:
/**
* Load the style from the \a KoStyleStack style stack using the
* OpenDocument format.
*/
void loadOdfProperties(KoStyleStack &styleStack);
static Qt::Alignment alignmentFromString(const QString &align);
static QString alignmentToString(Qt::Alignment alignment);
qreal propertyDouble(int key) const;
QTextLength propertyLength(int key) const;
int propertyInt(int key) const;
bool propertyBoolean(int key) const;
QColor propertyColor(int key) const;
class Private;
Private * const d;
};
Q_DECLARE_METATYPE(KoTableStyle *)
#endif
diff --git a/plugins/flake/textshape/textlayout/AnchorStrategy.h b/plugins/flake/textshape/textlayout/AnchorStrategy.h
index 3c165f5e76..c210a90dda 100644
--- a/plugins/flake/textshape/textlayout/AnchorStrategy.h
+++ b/plugins/flake/textshape/textlayout/AnchorStrategy.h
@@ -1,112 +1,112 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Matus Hanzes <matus.hanzes@ixonos.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ANCHORSTRATEGY_H_
#define ANCHORSTRATEGY_H_
#include "KoShapeAnchor.h"
#include <QRectF>
class KoTextShapeContainerModel;
class KoTextLayoutRootArea;
class AnchorStrategy : public KoShapeAnchor::PlacementStrategy
{
public:
AnchorStrategy(KoShapeAnchor *anchor, KoTextLayoutRootArea *rootArea);
- virtual ~AnchorStrategy();
+ ~AnchorStrategy() override;
/**
* Moves the subject to it's right position.
*
* @return true if subject was moved to a new position (or it it couldn't be calculated yet)
*/
virtual bool moveSubject() = 0;
- virtual void detachFromModel();
+ void detachFromModel() override;
/**
* Reparent the anchored shape under the rootArea's container this AnchorStrategy acts for
.*
* If needed changes the parent KoShapeContainerModel and KoShapeContainer of the anchored shape.
* It is changed so the anchored shape is now under the rootArea
*/
- virtual void updateContainerModel();
+ void updateContainerModel() override;
/// get page rectangle coordinates to which this text anchor is anchored (needed for HPage)
QRectF pageRect() const;
/// set page rectangle coordinates to which this text anchor is anchored (needed for HPage)
void setPageRect(const QRectF &pageRect);
/// get content rectangle coordinates to which this text anchor is anchored (needed for
/// HPageContent)
QRectF pageContentRect() const;
/// set content rectangle coordinates to which this text anchor is anchored (needed for
/// HPageContent)
void setPageContentRect(const QRectF &marginRect);
/// get paragraph rectangle coordinates to which this text anchor is anchored (needed for
/// HParagraphContent, HParagraphStartMargin, HParagraphEndMargin, VParagraph)
QRectF paragraphRect() const;
/// set paragraph rectangle to which this text anchor is anchored (needed for HParagraphContent,
/// HParagraphStartMargin, HParagraphEndMargin, VParagraph)
void setParagraphRect(const QRectF &paragraphRect);
/// get paragraph rectangle coordinates to which this text anchor is anchored (needed for
/// HParagraphContent, HParagraphStartMargin, HParagraphEndMargin)
QRectF paragraphContentRect() const;
/// set paragraph rectangle to which this text anchor is anchored (needed for HParagraphContent,
/// HParagraphStartMargin, HParagraphEndMargin)
void setParagraphContentRect(const QRectF &paragraphContentRect);
/// get layout environment rectangle @see odf attribute style:flow-with-text
QRectF layoutEnvironmentRect() const;
/// set layout environment rect @see odf attribute style:flow-with-text
void setLayoutEnvironmentRect(const QRectF &layoutEnvironmentRect);
/// get number of page to which this text anchor is anchored (needed for HOutside, HInside,
/// HFromInside)
int pageNumber() const;
/// set number of page to which this text anchor is anchored (needed for HOutside, HInside,
/// HFromInside)
void setPageNumber(int pageNumber);
protected:
KoShapeAnchor * const m_anchor;
KoTextLayoutRootArea *m_rootArea;
private:
KoTextShapeContainerModel *m_model;
QRectF m_pageRect;
QRectF m_pageContentRect;
QRectF m_paragraphRect;
QRectF m_paragraphContentRect;
QRectF m_layoutEnvironmentRect;
int m_pageNumber;
};
#endif /* ANCHORSTRATEGY_H_ */
diff --git a/plugins/flake/textshape/textlayout/DummyDocumentLayout.h b/plugins/flake/textshape/textlayout/DummyDocumentLayout.h
index ccedf22657..daf1febd14 100644
--- a/plugins/flake/textshape/textlayout/DummyDocumentLayout.h
+++ b/plugins/flake/textshape/textlayout/DummyDocumentLayout.h
@@ -1,78 +1,78 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DUMMYDOCUMENTLAYOUT_H
#define DUMMYDOCUMENTLAYOUT_H
#include "kritatextlayout_export.h"
#include <QAbstractTextDocumentLayout>
/**
* Dummy TextLayouter that does nothing really, but without it the Table of Contents/Bibliography
* can not be layout.TextLayouter
* The real layout of the ToC/Bib still happens by the KoTextLayoutArea as part of
* KoTextDocumentLayout of the main document
*
* You really shouldn't add anything to this class
*/
class KRITATEXTLAYOUT_EXPORT DummyDocumentLayout : public QAbstractTextDocumentLayout
{
Q_OBJECT
public:
/// constructor
explicit DummyDocumentLayout(QTextDocument *doc);
- virtual ~DummyDocumentLayout();
+ ~DummyDocumentLayout() override;
/// Returns the bounding rectangle of block.
- virtual QRectF blockBoundingRect(const QTextBlock & block) const;
+ QRectF blockBoundingRect(const QTextBlock & block) const override;
/**
* Returns the total size of the document. This is useful to display
* widgets since they can use to information to update their scroll bars
* correctly
*/
- virtual QSizeF documentSize() const;
+ QSizeF documentSize() const override;
/// Draws the layout on the given painter with the given context.
- virtual void draw(QPainter * painter, const QAbstractTextDocumentLayout::PaintContext & context);
+ void draw(QPainter * painter, const QAbstractTextDocumentLayout::PaintContext & context) override;
- virtual QRectF frameBoundingRect(QTextFrame*) const;
+ QRectF frameBoundingRect(QTextFrame*) const override;
/// reimplemented DO NOT CALL - USE HITTEST IN THE ROOTAREAS INSTEAD
- virtual int hitTest(const QPointF & point, Qt::HitTestAccuracy accuracy) const;
+ int hitTest(const QPointF & point, Qt::HitTestAccuracy accuracy) const override;
/// reimplemented to always return 1
- virtual int pageCount() const;
+ int pageCount() const override;
/// reimplemented from QAbstractTextDocumentLayout
- virtual void documentChanged(int position, int charsRemoved, int charsAdded);
+ void documentChanged(int position, int charsRemoved, int charsAdded) override;
/*
protected:
/// reimplemented
virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int position, const QTextFormat &format);
/// reimplemented
virtual void positionInlineObject(QTextInlineObject item, int position, const QTextFormat &format);
/// reimplemented
virtual void resizeInlineObject(QTextInlineObject item, int position, const QTextFormat &format);
*/
};
#endif
diff --git a/plugins/flake/textshape/textlayout/FloatingAnchorStrategy.h b/plugins/flake/textshape/textlayout/FloatingAnchorStrategy.h
index c3e9ebf2e5..48ec11ee73 100644
--- a/plugins/flake/textshape/textlayout/FloatingAnchorStrategy.h
+++ b/plugins/flake/textshape/textlayout/FloatingAnchorStrategy.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2007, 2009, 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Matus Hanzes <matus.hanzes@ixonos.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FLOATINGANCHORSTRATEGY_H
#define FLOATINGANCHORSTRATEGY_H
#include "AnchorStrategy.h"
class KoTextLayoutRootArea;
class KoTextShapeData;
class QTextBlock;
class QTextLayout;
class KoTextLayoutObstruction;
class KoAnchorTextRange;
class FloatingAnchorStrategy : public AnchorStrategy
{
public:
FloatingAnchorStrategy(KoAnchorTextRange *anchor, KoTextLayoutRootArea *rootArea);
- ~FloatingAnchorStrategy();
+ ~FloatingAnchorStrategy() override;
/**
* This moves the subject (i.e. shape when used with flake) of the anchor.
*
* @return true if subject was moved
*/
- virtual bool moveSubject();
+ bool moveSubject() override;
private:
inline bool countHorizontalRel(QRectF &anchorBoundingRect, const QRectF &containerBoundingRect,
QTextBlock &block, QTextLayout *layout);
inline void countHorizontalPos(QPointF &newPosition, const QRectF &anchorBoundingRect);
inline bool countVerticalRel(QRectF &anchorBoundingRect, const QRectF &containerBoundingRect,
KoTextShapeData *data, QTextBlock &block, QTextLayout *layout);
inline void countVerticalPos(QPointF &newPosition, const QRectF &anchorBoundingRect);
//check the layout evironment and move the shape back to have it within
inline void checkLayoutEnvironment(QPointF &newPosition, KoTextShapeData *data);
//check the border of page and move the shape back to have it visible
inline void checkPageBorder(QPointF &newPosition);
//check stacking and reorder to proper position objects according to there z-index
inline void checkStacking(QPointF &newPosition);
void updateObstruction(qreal documentOffset);
KoTextLayoutObstruction *m_obstruction; // the obstruction representation of the subject
KoAnchorTextRange *m_anchorRange;
};
#endif // FLOATINGANCHORSTRATEGY_H
diff --git a/plugins/flake/textshape/textlayout/IndexGeneratorManager.h b/plugins/flake/textshape/textlayout/IndexGeneratorManager.h
index c54992a346..5acd96c03a 100644
--- a/plugins/flake/textshape/textlayout/IndexGeneratorManager.h
+++ b/plugins/flake/textshape/textlayout/IndexGeneratorManager.h
@@ -1,73 +1,73 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Ko GmbH <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INDEXGENERATORMANAGER_H
#define INDEXGENERATORMANAGER_H
#include <QObject>
#include <QMetaType>
#include <QHash>
#include <QTimer>
class QTextDocument;
class KoTextDocumentLayout;
class KoTableOfContentsGeneratorInfo;
class ToCGenerator;
class IndexGeneratorManager : public QObject
{
Q_OBJECT
private:
explicit IndexGeneratorManager(QTextDocument *document);
public:
- virtual ~IndexGeneratorManager();
+ ~IndexGeneratorManager() override;
static IndexGeneratorManager *instance(QTextDocument *document);
bool generate();
public Q_SLOTS:
void requestGeneration();
void startDoneTimer();
private Q_SLOTS:
void layoutDone();
void timeout();
private:
enum State {
Resting, // We are not doing anything, and don't need to either
FirstRunNeeded, // We would like to update the indexes, with dummy pg nums
FirstRun, // Updating indexes, so prevent layout and ignore documentChanged()
FirstRunLayouting, // KoTextDocumentLayout is layouting so sit still
SecondRunNeeded, // Would like to update the indexes, getting pg nums right
SecondRun, // Updating indexes, so prevent layout and ignore documentChanged()
SecondRunLayouting // KoTextDocumentLayout is layouting so sit still
};
QTextDocument *m_document;
KoTextDocumentLayout *m_documentLayout;
QHash<KoTableOfContentsGeneratorInfo *, ToCGenerator *> m_generators;
State m_state;
QTimer m_updateTimer;
QTimer m_doneTimer;
};
Q_DECLARE_METATYPE(IndexGeneratorManager *)
#endif
diff --git a/plugins/flake/textshape/textlayout/InlineAnchorStrategy.h b/plugins/flake/textshape/textlayout/InlineAnchorStrategy.h
index b64f487d94..07b094c577 100644
--- a/plugins/flake/textshape/textlayout/InlineAnchorStrategy.h
+++ b/plugins/flake/textshape/textlayout/InlineAnchorStrategy.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Matus Hanzes <matus.hanzes@ixonos.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INLINEANCHORSTRATEGY_H_
#define INLINEANCHORSTRATEGY_H_
#include "AnchorStrategy.h"
class KoTextLayoutRootArea;
class KoTextShapeData;
class QTextBlock;
class QTextLayout;
class KoAnchorInlineObject;
class InlineAnchorStrategy : public AnchorStrategy
{
public:
InlineAnchorStrategy(KoAnchorInlineObject *anchor, KoTextLayoutRootArea *rootArea);
- virtual ~InlineAnchorStrategy();
+ ~InlineAnchorStrategy() override;
- virtual bool moveSubject();
+ bool moveSubject() override;
private:
inline bool countHorizontalPos(QPointF &newPosition, QTextBlock &block, QTextLayout *layout);
inline bool countVerticalPos(QPointF &newPosition, KoTextShapeData *data, QTextBlock &block, QTextLayout *layout);
//check the border of the parent shape an move the shape back to have it inside the parent shape
inline void checkParentBorder(QPointF &newPosition);
KoAnchorInlineObject *m_anchorObject;
};
#endif /* INLINEANCHORSTRATEGY_H_ */
diff --git a/plugins/flake/textshape/textlayout/KoTextDocumentLayout.h b/plugins/flake/textshape/textlayout/KoTextDocumentLayout.h
index f95d08231e..d5bba00a11 100644
--- a/plugins/flake/textshape/textlayout/KoTextDocumentLayout.h
+++ b/plugins/flake/textshape/textlayout/KoTextDocumentLayout.h
@@ -1,329 +1,329 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007, 2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2006, 2011 Sebastian Sauer <mail@dipe.org>
* Copyright (C) 2011 C. Boemann <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTDOCUMENTLAYOUT_H
#define KOTEXTDOCUMENTLAYOUT_H
#include "kritatextlayout_export.h"
#include <QAbstractTextDocumentLayout>
#include <QList>
#include <QTextFrame>
class KoShape;
class KoStyleManager;
class KoChangeTracker;
class KoTextRangeManager;
class KoInlineTextObjectManager;
class KoViewConverter;
class KoImageCollection;
class KoShapeAnchor;
class KoTextLayoutRootArea;
class KoTextLayoutRootAreaProvider;
class KoTextLayoutObstruction;
class QRectF;
class QSizeF;
class KRITATEXTLAYOUT_EXPORT KoInlineObjectExtent
{
public:
explicit KoInlineObjectExtent(qreal ascent = 0, qreal descent = 0);
qreal m_ascent;
qreal m_descent;
};
/**
* Text layouter that allows text to flow in multiple root area and around
* obstructions.
*/
class KRITATEXTLAYOUT_EXPORT KoTextDocumentLayout : public QAbstractTextDocumentLayout
{
Q_OBJECT
public:
/// This struct is a helper for painting of kotext texts.
struct PaintContext {
PaintContext()
: viewConverter(0)
, imageCollection(0)
, showFormattingCharacters(false)
, showSectionBounds(false)
, showSpellChecking(false)
, showSelections(true)
, background(Qt::white)
{
}
/// the QText context
QAbstractTextDocumentLayout::PaintContext textContext;
/// A view converter, when set, is used to find out when the zoom is so low that painting of text is unneeded
const KoViewConverter *viewConverter;
KoImageCollection *imageCollection;
bool showFormattingCharacters;
bool showTableBorders;
bool showSectionBounds;
bool showSpellChecking;
bool showSelections;
QColor background;
};
/// constructor
explicit KoTextDocumentLayout(QTextDocument *doc, KoTextLayoutRootAreaProvider *provider = 0);
- virtual ~KoTextDocumentLayout();
+ ~KoTextDocumentLayout() override;
/// return the rootAreaProvider.
KoTextLayoutRootAreaProvider *provider() const;
/// return the currently set manager, or 0 if none is set.
KoInlineTextObjectManager *inlineTextObjectManager() const;
void setInlineTextObjectManager(KoInlineTextObjectManager *manager);
/// return the currently set manager, or 0 if none is set.
KoTextRangeManager *textRangeManager() const;
void setTextRangeManager(KoTextRangeManager *manager);
/// return the currently set changeTracker, or 0 if none is set.
KoChangeTracker *changeTracker() const;
void setChangeTracker(KoChangeTracker *tracker);
/// return the currently set styleManager, or 0 if none is set.
KoStyleManager *styleManager() const;
void setStyleManager(KoStyleManager *manager);
/// Returns the bounding rectangle of block.
- QRectF blockBoundingRect(const QTextBlock &block) const;
+ QRectF blockBoundingRect(const QTextBlock &block) const override;
/**
* Returns the total size of the document. This is useful to display
* widgets since they can use to information to update their scroll bars
* correctly
*/
- virtual QSizeF documentSize() const;
+ QSizeF documentSize() const override;
- virtual QRectF frameBoundingRect(QTextFrame*) const;
+ QRectF frameBoundingRect(QTextFrame*) const override;
/// the default tab size for this document
qreal defaultTabSpacing() const;
/// set default tab size for this document
void setTabSpacing(qreal spacing);
/// set if this is for a word processor (slight changes in layout may occur)
void setWordprocessingMode();
/// is it for a word processor (slight changes in layout may occur)
bool wordprocessingMode() const;
/// are the tabs relative to indent or not
bool relativeTabs(const QTextBlock &block) const;
/// visualize inline objects during paint
void showInlineObjectVisualization(bool show);
/// Calc a bounding box rect of the selection
QRectF selectionBoundingBox(QTextCursor &cursor) const;
/// Draws the layout on the given painter with the given context.
- virtual void draw(QPainter * painter, const QAbstractTextDocumentLayout::PaintContext & context);
+ void draw(QPainter * painter, const QAbstractTextDocumentLayout::PaintContext & context) override;
/// reimplemented DO NOT CALL - USE HITTEST IN THE ROOTAREAS INSTEAD
- virtual int hitTest(const QPointF & point, Qt::HitTestAccuracy accuracy) const;
+ int hitTest(const QPointF & point, Qt::HitTestAccuracy accuracy) const override;
/// reimplemented to always return 1
- virtual int pageCount() const;
+ int pageCount() const override;
QList<KoShapeAnchor *> textAnchors() const;
/**
* Register the anchored obstruction for run around
*
* We have the concept of Obstructions which text has to run around in various ways.
* We maintain two collections of obstructions. The free which are tied to just a position
* (tied to pages), and the anchored obstructions which are each anchored to a KoShapeAnchor
*
* The free obstructions are collected from the KoTextLayoutRootAreaProvider during layout
*
* The anchored obstructions are created in the FloatingAnchorStrategy and registered using
* this method.
*/
void registerAnchoredObstruction(KoTextLayoutObstruction *obstruction);
/**
* Anchors are special InlineObjects that we detect in positionInlineObject()
* We save those for later so we can position them during layout instead.
* During KoTextLayoutArea::layout() we call positionAnchoredObstructions()
*/
/// remove all anchors and associated obstructions and set up for collecting new ones
void beginAnchorCollecting(KoTextLayoutRootArea *rootArea);
/// allow positionInlineObject() to do anything (incl saving anchors)
void allowPositionInlineObject(bool allow);
/// Sets the paragraph rect that will be applied to anchorStrategies being created in
/// positionInlineObject()
void setAnchoringParagraphRect(const QRectF &paragraphRect);
/// Sets the paragraph content rect that will be applied to anchorStrategies being created in
/// positionInlineObject()
void setAnchoringParagraphContentRect(const QRectF &paragraphContentRect);
/// Sets the layoutEnvironment rect that will be applied to anchorStrategies being created in
/// positionInlineObject()
void setAnchoringLayoutEnvironmentRect(const QRectF &layoutEnvironmentRect);
/// Calculates the maximum y of anchored obstructions
qreal maxYOfAnchoredObstructions(int firstCursorPosition, int lastCursorPosition) const;
int anchoringSoftBreak() const;
/// Positions all anchored obstructions
/// the paragraphRect should be in textDocument coords and not global/document coords
void positionAnchoredObstructions();
/// remove inline object
void removeInlineObject(KoShapeAnchor *textAnchor);
void clearInlineObjectRegistry(const QTextBlock& block);
KoInlineObjectExtent inlineObjectExtent(const QTextFragment&);
/**
* We allow a text document to be distributed onto a sequence of KoTextLayoutRootArea;
* which brings up the need to figure out which KoTextLayoutRootArea is used for a certain
* text.
* @param position the position of the character in the text document we want to locate.
* @return the KoTextLayoutRootArea the text is laid-out in. Or 0 if there is no shape for that text character.
*/
KoTextLayoutRootArea *rootAreaForPosition(int position) const;
KoTextLayoutRootArea *rootAreaForPoint(const QPointF &point) const;
/**
* Remove the root-areas \p rootArea from the list of \a rootAreas() .
* \param rootArea root-area to remove. If 0 then all root-areas are removed.
*/
void removeRootArea(KoTextLayoutRootArea *rootArea = 0);
/// reimplemented from QAbstractTextDocumentLayout
- virtual void documentChanged(int position, int charsRemoved, int charsAdded);
+ void documentChanged(int position, int charsRemoved, int charsAdded) override;
void setContinuationObstruction(KoTextLayoutObstruction *continuationObstruction);
/// Return a list of obstructions intersecting current root area (during layout)
QList<KoTextLayoutObstruction *> currentObstructions();
QList<KoTextLayoutRootArea *> rootAreas() const;
QList<KoShape*> shapes() const;
/// Set should layout be continued when done with current root area
void setContinuousLayout(bool continuous);
/// Set \a layout() to be blocked (no layouting will happen)
void setBlockLayout(bool block);
bool layoutBlocked() const;
/// Set \a documentChanged() to be blocked (changes will not result in root-areas being marked dirty)
void setBlockChanges(bool block);
bool changesBlocked() const;
KoTextDocumentLayout* referencedLayout() const;
void setReferencedLayout(KoTextDocumentLayout *layout);
/**
* To be called during layout by KoTextLayoutArea - similar to how qt calls positionInlineObject
*
* It searches for anchor text ranges in the given span
*/
void positionAnchorTextRanges(int pos, int length, const QTextDocument *effectiveDocument);
Q_SIGNALS:
/**
* Signal that is emitted during layouting to inform about the progress done so far.
*/
void layoutProgressChanged(int percent);
/**
* Signal is emitted every time a layout run has completely finished (all text is positioned).
*/
void finishedLayout();
/**
* Signal is emitted when emitLayoutIsDirty() is called which happens at
* least when a root area is marked as dirty.
* @see emitLayoutIsDirty
*/
void layoutIsDirty();
void foundAnnotation(KoShape *annotationShape, const QPointF &refPosition);
public Q_SLOTS:
/**
* Does the layout of the text.
* This method will layout the text into sections, tables and textlines,
* chunk by chunk.
* It may interrupt itself, @see contiuousLayout
* calling this method when the layout is not dirty, doesn't take that much
* time as it doesn't do much, although it does check every root area
*/
virtual void layout();
/**
* Schedules a \a layout call for later using a QTimer::singleShot. Multiple calls
* to this slot will be compressed into one layout-call to prevent calling layouting
* to much. Also if meanwhile \a layout was called then the scheduled layout won't
* be executed.
*/
virtual void scheduleLayout();
/**
* Emits the \a layoutIsDirty signal.
*/
void emitLayoutIsDirty();
private Q_SLOTS:
/// Called by \a scheduleLayout to start a \a layout run if not done already meanwhile.
void executeScheduledLayout();
protected:
/// reimplemented
- virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int position, const QTextFormat &format);
+ void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int position, const QTextFormat &format) override;
/// reimplemented
- virtual void positionInlineObject(QTextInlineObject item, int position, const QTextFormat &format);
+ void positionInlineObject(QTextInlineObject item, int position, const QTextFormat &format) override;
/// reimplemented
- virtual void resizeInlineObject(QTextInlineObject item, int position, const QTextFormat &format);
+ void resizeInlineObject(QTextInlineObject item, int position, const QTextFormat &format) override;
/// should we continue layout when done with current root area
bool continuousLayout() const;
void registerInlineObject(const QTextInlineObject &inlineObject);
private:
class Private;
Private * const d;
bool doLayout();
void updateProgress(const QTextFrame::iterator &it);
};
#endif
diff --git a/plugins/flake/textshape/textlayout/KoTextLayoutEndNotesArea.h b/plugins/flake/textshape/textlayout/KoTextLayoutEndNotesArea.h
index 83bf78ac60..667793ceb1 100644
--- a/plugins/flake/textshape/textlayout/KoTextLayoutEndNotesArea.h
+++ b/plugins/flake/textshape/textlayout/KoTextLayoutEndNotesArea.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTLAYOUTENDNOTESAREA_H
#define KOTEXTLAYOUTENDNOTESAREA_H
#include "kritatextlayout_export.h"
#include "KoTextLayoutArea.h"
class QRectF;
/**
* When laying out text it happens in areas that can occupy space of various size.
*/
class KRITATEXTLAYOUT_EXPORT KoTextLayoutEndNotesArea : public KoTextLayoutArea
{
public:
/// constructor
explicit KoTextLayoutEndNotesArea(KoTextLayoutArea *parent, KoTextDocumentLayout *documentLayout);
- virtual ~KoTextLayoutEndNotesArea();
+ ~KoTextLayoutEndNotesArea() override;
/// Layouts as much as it can
/// Returns true if it has reached the end of the frame
bool layout(FrameIterator *cursor);
KoPointedAt hitTest(const QPointF &p, Qt::HitTestAccuracy accuracy) const;
QRectF selectionBoundingBox(QTextCursor &cursor) const;
void paint(QPainter *painter, const KoTextDocumentLayout::PaintContext &context);
private:
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/textlayout/KoTextLayoutNoteArea.h b/plugins/flake/textshape/textlayout/KoTextLayoutNoteArea.h
index dab76befbd..13d9c86fdd 100644
--- a/plugins/flake/textshape/textlayout/KoTextLayoutNoteArea.h
+++ b/plugins/flake/textshape/textlayout/KoTextLayoutNoteArea.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (C) 2011 Brijesh Patel <brijesh3105@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTLAYOUTNOTEAREA_H
#define KOTEXTLAYOUTNOTEAREA_H
#include "KoTextLayoutArea.h"
#include <KoTextDocumentLayout.h>
class KoInlineNote;
class KRITATEXTLAYOUT_EXPORT KoTextLayoutNoteArea : public KoTextLayoutArea
{
public:
explicit KoTextLayoutNoteArea(KoInlineNote *note, KoTextLayoutArea *parent, KoTextDocumentLayout *documentLayout);
- virtual ~KoTextLayoutNoteArea();
+ ~KoTextLayoutNoteArea() override;
void paint(QPainter *painter, const KoTextDocumentLayout::PaintContext &context);
bool layout(FrameIterator *cursor);
void setAsContinuedArea(bool isContinuedArea);
KoPointedAt hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const;
QRectF selectionBoundingBox(QTextCursor &cursor) const;
private:
class Private;
Private * const d;
};
#endif // KOTEXTLAYOUTNOTEAREA_H
diff --git a/plugins/flake/textshape/textlayout/KoTextLayoutRootArea.h b/plugins/flake/textshape/textlayout/KoTextLayoutRootArea.h
index 80673e5f8d..fe319e68c6 100644
--- a/plugins/flake/textshape/textlayout/KoTextLayoutRootArea.h
+++ b/plugins/flake/textshape/textlayout/KoTextLayoutRootArea.h
@@ -1,78 +1,78 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTLAYOUTROOTAREA_H
#define KOTEXTLAYOUTROOTAREA_H
#include "kritatextlayout_export.h"
#include "KoTextLayoutArea.h"
class KoShape;
class KoTextPage;
/**
* When laying out text it happens in areas that can occupy space of various size.
*/
class KRITATEXTLAYOUT_EXPORT KoTextLayoutRootArea : public KoTextLayoutArea
{
public:
/// constructor
explicit KoTextLayoutRootArea(KoTextDocumentLayout *documentLayout);
- virtual ~KoTextLayoutRootArea();
+ ~KoTextLayoutRootArea() override;
/// Layouts as much as it can
/// Returns true if it has reached the end of the frame
bool layoutRoot(FrameIterator *cursor);
/// Sets an associated shape which can be retrieved with associatedShape()
/// KoTextLayoutRootArea doesn't use it for anything.
void setAssociatedShape(KoShape *shape);
/// Retruns the shape set with setAssociatedShape()
KoShape *associatedShape() const;
/**
* Set the \p page this root area is on.
*
* The root-area takes over the ownership of the KoTextPage and will take
* care to delete the KoTextPage if not needed any longer.
*/
void setPage(KoTextPage *textpage);
/// Returns the page this root area is on.
KoTextPage *page() const;
void setDirty();
bool isDirty() const;
/// Returns the cursor position of the following root frame
FrameIterator *nextStartOfArea() const;
- virtual KoText::Direction parentTextDirection() const;
+ KoText::Direction parentTextDirection() const override;
void setBottom(qreal b);
private:
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/textlayout/KoTextLayoutTableArea.h b/plugins/flake/textshape/textlayout/KoTextLayoutTableArea.h
index cd9d242a6e..d376804cbc 100644
--- a/plugins/flake/textshape/textlayout/KoTextLayoutTableArea.h
+++ b/plugins/flake/textshape/textlayout/KoTextLayoutTableArea.h
@@ -1,69 +1,69 @@
/* This file is part of the KDE project
* Copyright (C) 2011 C. Boemann <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTLAYOUTTABLEAREA_H
#define KOTEXTLAYOUTTABLEAREA_H
#include "kritatextlayout_export.h"
#include "KoTextLayoutArea.h"
#include <QVector>
class KoPointedAt;
class TableIterator;
class QTextTableCell;
class QLineF;
/**
* This class represent a (full width) piece of a table
*/
class KRITATEXTLAYOUT_EXPORT KoTextLayoutTableArea : public KoTextLayoutArea
{
public:
/// constructor
explicit KoTextLayoutTableArea(QTextTable *table, KoTextLayoutArea *parent, KoTextDocumentLayout *documentLayout);
- virtual ~KoTextLayoutTableArea();
+ ~KoTextLayoutTableArea() override;
/// Layouts as much as it can
/// Returns true if it has reached the end of the table
bool layoutTable(TableIterator *cursor);
void paint(QPainter *painter, const KoTextDocumentLayout::PaintContext &context);
KoPointedAt hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const;
/// Calc a bounding box rect of the selection
QRectF selectionBoundingBox(QTextCursor &cursor) const;
private:
void layoutColumns();
void collectBorderThicknesss(int row, qreal &topBorderWidth, qreal &bottomBorderWidth);
void nukeRow(TableIterator *cursor);
bool layoutRow(TableIterator *cursor, qreal topBorderWidth, qreal bottomBorderWidth);
bool layoutMergedCellsNotEnding(TableIterator *cursor, qreal topBorderWidth, qreal bottomBorderWidth, qreal rowBottom);
QRectF cellBoundingRect(const QTextTableCell &cell) const;
void paintCell(QPainter *painter, const KoTextDocumentLayout::PaintContext &context, const QTextTableCell &tableCell, KoTextLayoutArea *frameArea);
void paintCellBorders(QPainter *painter, const KoTextDocumentLayout::PaintContext &context, const QTextTableCell &tableCell, bool topRow, int maxRow, QVector<QLineF> *accuBlankBorders);
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/textlayout/KoTextShapeContainerModel.h b/plugins/flake/textshape/textlayout/KoTextShapeContainerModel.h
index bb3634dd3e..dbc8b5afb2 100644
--- a/plugins/flake/textshape/textlayout/KoTextShapeContainerModel.h
+++ b/plugins/flake/textshape/textlayout/KoTextShapeContainerModel.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAPECONTAINERMODEL_H
#define KOTEXTSHAPECONTAINERMODEL_H
#include <KoShapeContainerModel.h>
#include "kritatextlayout_export.h"
class KoShapeAnchor;
class KoShapeContainer;
/**
* A model to position children of the text shape.
* All anchored frames are children of the text shape, and they get positioned
* by the text layouter.
*/
class KRITATEXTLAYOUT_EXPORT KoTextShapeContainerModel : public KoShapeContainerModel
{
public:
/// constructor
KoTextShapeContainerModel();
- ~KoTextShapeContainerModel();
+ ~KoTextShapeContainerModel() override;
/// reimplemented from KoShapeContainerModel
- virtual void add(KoShape *child);
+ void add(KoShape *child) override;
/// reimplemented from KoShapeContainerModel
- virtual void remove(KoShape *child);
+ void remove(KoShape *child) override;
/// reimplemented from KoShapeContainerModel
- virtual void setClipped(const KoShape *child, bool clipping);
+ void setClipped(const KoShape *child, bool clipping) override;
/// reimplemented from KoShapeContainerModel
- virtual bool isClipped(const KoShape *child) const;
+ bool isClipped(const KoShape *child) const override;
/// reimplemented from KoShapeContainerModel
- virtual int count() const;
+ int count() const override;
/// reimplemented from KoShapeContainerModel
- virtual QList<KoShape*> shapes() const;
+ QList<KoShape*> shapes() const override;
/// reimplemented from KoShapeContainerModel
- virtual void containerChanged(KoShapeContainer *container, KoShape::ChangeType type);
+ void containerChanged(KoShapeContainer *container, KoShape::ChangeType type) override;
/// reimplemented from KoShapeContainerModel
- virtual void proposeMove(KoShape *child, QPointF &move);
+ void proposeMove(KoShape *child, QPointF &move) override;
/// reimplemented from KoShapeContainerModel
- virtual void childChanged(KoShape *child, KoShape::ChangeType type);
+ void childChanged(KoShape *child, KoShape::ChangeType type) override;
/// reimplemented from KoShapeContainerModel
- virtual bool isChildLocked(const KoShape *child) const;
+ bool isChildLocked(const KoShape *child) const override;
/// reimplemented from KoShapeContainerModel
- virtual void setInheritsTransform(const KoShape *shape, bool inherit);
+ void setInheritsTransform(const KoShape *shape, bool inherit) override;
/// reimplemented from KoShapeContainerModel
- virtual bool inheritsTransform(const KoShape *shape) const;
+ bool inheritsTransform(const KoShape *shape) const override;
/// each child that is added due to being anchored in the text has an anchor; register it for rules based placement.
void addAnchor(KoShapeAnchor *anchor);
/// When a shape is removed or stops being anchored, remove it.
void removeAnchor(KoShapeAnchor *anchor);
private:
// reset child position and relayout shape to which this shape is linked
void relayoutInlineObject(KoShape *child);
class Private;
Private * const d;
};
#endif
diff --git a/plugins/flake/textshape/textlayout/KoTextShapeData.h b/plugins/flake/textshape/textlayout/KoTextShapeData.h
index 379ac57ffd..ffdbca958d 100644
--- a/plugins/flake/textshape/textlayout/KoTextShapeData.h
+++ b/plugins/flake/textshape/textlayout/KoTextShapeData.h
@@ -1,147 +1,147 @@
/* This file is part of the KDE project
* Copyright (C) 2006, 2009-2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOTEXTSHAPEDATA_H
#define KOTEXTSHAPEDATA_H
#include "KoText.h"
#include "kritatextlayout_export.h"
#include <KoTextShapeDataBase.h>
#include <KoXmlReaderForward.h>
class QTextDocument;
class KoShapeLoadingContext;
class KoShapeSavingContext;
class KoTextShapeDataPrivate;
class KoDocumentRdfBase;
class KoTextLayoutRootArea;
/**
* The data store that is held by each TextShape instance.
* This is a separate object to allow Words proper to use this class' API and
* access the internals of the text shape.
*
* This class holds a QTextDocument pointer and is built so multiple shapes (and thus
* multiple instances of this shape data) can share one QTextDocument by providing a
* different view on (a different part of) the QTextDocument.
*/
class KRITATEXTLAYOUT_EXPORT KoTextShapeData : public KoTextShapeDataBase
{
Q_OBJECT
public:
/// constructor
KoTextShapeData();
- virtual ~KoTextShapeData();
+ ~KoTextShapeData() override;
KoShapeUserData* clone() const override;
/**
* Replace the QTextDocument this shape will render.
* @param document the new document. If there was an old document owned, it will be deleted.
* @param transferOwnership if true then the document will be considered the responsibility
* of this data and the doc will be deleted when this shapeData dies.
*/
void setDocument(QTextDocument *document);
/**
* return the amount of points into the document (y) this shape will display.
*/
qreal documentOffset() const;
/// mark shape as dirty triggering a re-layout of its text.
void setDirty();
/// return if the shape is marked dirty and its text content needs to be relayout
bool isDirty() const;
/// Set the rootArea that is associated to the textshape
void setRootArea(KoTextLayoutRootArea *rootArea);
/// the rootArea that is associated to the textshape
KoTextLayoutRootArea *rootArea();
void setLeftPadding(qreal padding);
qreal leftPadding() const;
void setTopPadding(qreal padding);
qreal topPadding() const;
void setRightPadding(qreal padding);
qreal rightPadding() const;
void setBottomPadding(qreal padding);
qreal bottomPadding() const;
void setPadding(qreal padding);
/**
* Load the TextShape from ODF.
*
* @see the @a TextShape::loadOdf() method which calls this method.
* @see the @a KoTextLoader::loadBody() method which got called by this method
* to load the ODF.
*/
bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context, KoDocumentRdfBase *rdfData, KoShape *shape = 0);
/**
* Load the TextShape from ODF.
* Overloaded method provided for your convenience.
*/
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) {
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override {
return loadOdf(element, context, 0);
}
/**
* Store the TextShape data as ODF.
* @see TextShape::saveOdf()
*/
void saveOdf(KoShapeSavingContext &context, KoDocumentRdfBase *rdfData, int from = 0, int to = -1) const;
/**
* Store the TextShape data as ODF.
* Overloaded method provided for your convenience.
*/
- virtual void saveOdf(KoShapeSavingContext &context, int from = 0, int to = -1) const {
+ void saveOdf(KoShapeSavingContext &context, int from = 0, int to = -1) const override {
saveOdf(context, 0, from, to);
}
// reimplemented
- virtual void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context);
+ void loadStyle(const KoXmlElement &element, KoShapeLoadingContext &context) override;
// reimplemented
- virtual void saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
+ void saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const override;
/**
* Set the page direction.
* The page direction will determine behavior on the insertion of new text and those
* new paragraphs default direction.
*/
void setPageDirection(KoText::Direction direction);
/**
* Return the direction set on the page.
* The page direction will determine behavior on the insertion of new text and those
* new paragraphs default direction.
*/
KoText::Direction pageDirection() const;
private:
KoTextShapeData(KoTextShapeDataPrivate *dd);
private:
Q_DECLARE_PRIVATE(KoTextShapeData)
};
#endif
diff --git a/plugins/flake/textshape/textlayout/ToCGenerator.h b/plugins/flake/textshape/textlayout/ToCGenerator.h
index b1ddb14c10..5634288935 100644
--- a/plugins/flake/textshape/textlayout/ToCGenerator.h
+++ b/plugins/flake/textshape/textlayout/ToCGenerator.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2011 Pavol Korinek <pavol.korinek@ixonos.com>
* Copyright (C) 2011 Lukáš Tvrdý <lukas.tvrdy@ixonos.com>
* Copyright (C) 2011 Ko GmbH <cbo@kogmbh.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef TOCGENERATOR_H
#define TOCGENERATOR_H
#include <QTextBlock>
#include <QObject>
class KoTextRangeManager;
class KoTextDocumentLayout;
class KoTableOfContentsGeneratorInfo;
class QTextDocument;
class ToCGenerator : public QObject
{
Q_OBJECT
public:
explicit ToCGenerator(QTextDocument *tocDocument, KoTableOfContentsGeneratorInfo *tocInfo);
- virtual ~ToCGenerator();
+ ~ToCGenerator() override;
virtual void setBlock(const QTextBlock &block);
bool generate();
private:
QString resolvePageNumber(const QTextBlock &headingBlock);
void generateEntry(int outlineLevel, QTextCursor &cursor, QTextBlock &block, int &blockId);
QTextDocument *m_ToCDocument;
KoTableOfContentsGeneratorInfo *m_ToCInfo;
QTextBlock m_block;
QTextDocument *m_document;
KoTextDocumentLayout *m_documentLayout;
bool m_success;
bool m_preservePagebreak;
// Return the ref (name) of the first KoBookmark in the block, if KoBookmark not found, null QString is returned
QString fetchBookmarkRef(const QTextBlock &block, KoTextRangeManager *textRangeManager);
};
#endif
diff --git a/plugins/flake/vectorshape/ChangeVectorDataCommand.h b/plugins/flake/vectorshape/ChangeVectorDataCommand.h
index 7dea11017c..9614e6588c 100644
--- a/plugins/flake/vectorshape/ChangeVectorDataCommand.h
+++ b/plugins/flake/vectorshape/ChangeVectorDataCommand.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
Copyright 2009 Thorsten Zachmann <zachmann@kde.org>
Copyright 2011 Boudewijn Rempt <boud@valdyas.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef CHANGEVECTORDATACOMMAND_H
#define CHANGEVECTORDATACOMMAND_H
#include <kundo2command.h>
#include <QByteArray>
#include "VectorShape.h"
class ChangeVectorDataCommand : public KUndo2Command
{
public:
ChangeVectorDataCommand(VectorShape *shape, const QByteArray &newImageData, VectorShape::VectorType newVectorType,
KUndo2Command *parent = 0);
- virtual ~ChangeVectorDataCommand();
+ ~ChangeVectorDataCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
VectorShape *m_shape;
QByteArray m_oldImageData;
VectorShape::VectorType m_oldVectorType;
QByteArray m_newImageData;
VectorShape::VectorType m_newVectorType;
};
#endif /* CHANGEVECTORDATACOMMAND_H */
diff --git a/plugins/flake/vectorshape/VectorShape.h b/plugins/flake/vectorshape/VectorShape.h
index e1cd4f306f..9f0d5e6d18 100644
--- a/plugins/flake/vectorshape/VectorShape.h
+++ b/plugins/flake/vectorshape/VectorShape.h
@@ -1,125 +1,125 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009-2011 Inge Wallin <inge@lysator.liu.se>
* Copyright (C) 2011 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef VECTORSHAPE_H
#define VECTORSHAPE_H
// Qt
#include <QByteArray>
#include <QCache>
#include <QSize>
#include <QRunnable>
#include <QMutex>
// Calligra
#include <KoShape.h>
#include <KoFrameShape.h>
#define DEBUG_VECTORSHAPE 0
class QPainter;
class VectorShape;
#define VectorShape_SHAPEID "VectorShapeID"
class VectorShape : public QObject, public KoShape, public KoFrameShape
{
Q_OBJECT
public:
// Type of vector file. Add here when we get support for more.
enum VectorType {
VectorTypeNone, // Uninitialized
VectorTypeWmf, // Windows MetaFile
VectorTypeEmf, // Extended MetaFile
VectorTypeSvm, // StarView Metafile
VectorTypeSvg // Scalable Vector Graphics
// ... more here later
};
VectorShape();
- virtual ~VectorShape();
+ ~VectorShape() override;
// reimplemented methods.
/// reimplemented from KoShape
- void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext);
+ void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override;
/// reimplemented from KoShape
- virtual void saveOdf(KoShapeSavingContext &context) const;
+ void saveOdf(KoShapeSavingContext &context) const override;
/// reimplemented from KoShape
- virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
+ bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
/// Load the real contents of the frame shape. reimplemented from KoFrameShape
- virtual bool loadOdfFrameElement(const KoXmlElement &frameElement,
- KoShapeLoadingContext &context);
+ bool loadOdfFrameElement(const KoXmlElement &frameElement,
+ KoShapeLoadingContext &context) override;
/// reimplemented from KoShape
- virtual void waitUntilReady(const KoViewConverter &converter, bool asynchronous = true) const;
+ void waitUntilReady(const KoViewConverter &converter, bool asynchronous = true) const override;
// Methods specific to the vector shape.
QByteArray compressedContents() const;
VectorType vectorType() const;
void setCompressedContents(const QByteArray &newContents, VectorType vectorType);
static VectorShape::VectorType vectorType(const QByteArray &contents);
private Q_SLOTS:
void renderFinished(QSize boundingSize, QImage *image);
private:
static bool isWmf(const QByteArray &bytes);
static bool isEmf(const QByteArray &bytes);
static bool isSvm(const QByteArray &bytes);
static bool isSvg(const QByteArray &bytes);
// Member variables
mutable VectorType m_type;
mutable QByteArray m_contents;
mutable bool m_isRendering;
mutable QMutex m_mutex;
QCache<int, QImage> m_cache;
QImage *render(const KoViewConverter &converter, bool asynchronous, bool useCache) const;
};
class RenderThread : public QObject, public QRunnable
{
Q_OBJECT
public:
RenderThread(const QByteArray &contents, VectorShape::VectorType type,
const QSizeF &size, const QSize &boundingSize, qreal zoomX, qreal zoomY);
- virtual ~RenderThread();
- virtual void run();
+ ~RenderThread() override;
+ void run() override;
Q_SIGNALS:
void finished(QSize boundingSize, QImage *image);
private:
void draw(QPainter &painter);
void drawNull(QPainter &painter) const;
void drawWmf(QPainter &painter) const;
void drawEmf(QPainter &painter) const;
void drawSvm(QPainter &painter) const;
void drawSvg(QPainter &painter) const;
private:
const QByteArray m_contents;
VectorShape::VectorType m_type;
QSizeF m_size;
QSize m_boundingSize;
qreal m_zoomX, m_zoomY;
};
#endif
diff --git a/plugins/flake/vectorshape/VectorShapeConfigWidget.h b/plugins/flake/vectorshape/VectorShapeConfigWidget.h
index 22847da8f1..b01571d949 100644
--- a/plugins/flake/vectorshape/VectorShapeConfigWidget.h
+++ b/plugins/flake/vectorshape/VectorShapeConfigWidget.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
* Copyright 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef VECTORSHAPECONFIGWIDGET_H
#define VECTORSHAPECONFIGWIDGET_H
#include <KoShapeConfigWidgetBase.h>
#include <QWidget>
class VectorShape;
class KisFileNameRequester;
class VectorShapeConfigWidget : public KoShapeConfigWidgetBase
{
Q_OBJECT
public:
VectorShapeConfigWidget();
- ~VectorShapeConfigWidget();
+ ~VectorShapeConfigWidget() override;
/// reimplemented from KoShapeConfigWidgetBase
- virtual void open(KoShape *shape);
+ void open(KoShape *shape) override;
/// reimplemented from KoShapeConfigWidgetBase
- virtual void save();
+ void save() override;
/// reimplemented from KoShapeConfigWidgetBase
- virtual bool showOnShapeCreate();
+ bool showOnShapeCreate() override;
/// reimplemented from KoShapeConfigWidgetBase
- virtual bool showOnShapeSelect();
+ bool showOnShapeSelect() override;
private:
VectorShape *m_shape;
KisFileNameRequester *m_fileWidget;
};
#endif //VECTORSHAPECONFIGWIDGET_H
diff --git a/plugins/flake/vectorshape/VectorShapeFactory.h b/plugins/flake/vectorshape/VectorShapeFactory.h
index 68b89183ed..0e3930643e 100644
--- a/plugins/flake/vectorshape/VectorShapeFactory.h
+++ b/plugins/flake/vectorshape/VectorShapeFactory.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef VECTORSHAPE_FACTORY_H
#define VECTORSHAPE_FACTORY_H
// Calligra
#include <KoShapeFactoryBase.h>
class KoShape;
class VectorShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
VectorShapeFactory();
- ~VectorShapeFactory() {}
+ ~VectorShapeFactory() override {}
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
/// Reimplemented
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
- QList<KoShapeConfigWidgetBase *> createShapeOptionPanels();
+ QList<KoShapeConfigWidgetBase *> createShapeOptionPanels() override;
};
#endif
diff --git a/plugins/flake/vectorshape/VectorShapePlugin.h b/plugins/flake/vectorshape/VectorShapePlugin.h
index 377d0c5af5..dcc1258748 100644
--- a/plugins/flake/vectorshape/VectorShapePlugin.h
+++ b/plugins/flake/vectorshape/VectorShapePlugin.h
@@ -1,37 +1,37 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009 Inge Wallin <inge@lysator.liu.se>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef VECTORSHAPE_PLUGIN_H
#define VECTORSHAPE_PLUGIN_H
// Qt
#include <QObject>
#include <QVariantList>
class VectorShapePlugin : public QObject
{
Q_OBJECT
public:
VectorShapePlugin(QObject *parent, const QVariantList &);
- ~VectorShapePlugin() {}
+ ~VectorShapePlugin() override {}
};
#endif
diff --git a/plugins/flake/vectorshape/VectorTool.h b/plugins/flake/vectorshape/VectorTool.h
index 68f65ba5d3..b1ff16b2f4 100644
--- a/plugins/flake/vectorshape/VectorTool.h
+++ b/plugins/flake/vectorshape/VectorTool.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
Copyright 2011 Boudewijn Rempt <boud@valdyas.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef VECTOR_TOOL
#define VECTOR_TOOL
#include <KoToolBase.h>
class VectorShape;
class VectorTool : public KoToolBase
{
Q_OBJECT
public:
explicit VectorTool(KoCanvasBase *canvas);
/// reimplemented from KoToolBase
- virtual void paint(QPainter &, const KoViewConverter &) {}
+ void paint(QPainter &, const KoViewConverter &) override {}
/// reimplemented from KoToolBase
- virtual void mousePressEvent(KoPointerEvent *) {}
+ void mousePressEvent(KoPointerEvent *) override {}
/// reimplemented from superclass
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
/// reimplemented from KoToolBase
- virtual void mouseMoveEvent(KoPointerEvent *) {}
+ void mouseMoveEvent(KoPointerEvent *) override {}
/// reimplemented from KoToolBase
- virtual void mouseReleaseEvent(KoPointerEvent *) {}
+ void mouseReleaseEvent(KoPointerEvent *) override {}
/// reimplemented from KoToolBase
- virtual void activate(ToolActivation activation, const QSet<KoShape *> &shapes);
+ void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
/// reimplemented from KoToolBase
- virtual void deactivate();
+ void deactivate() override;
protected:
/// reimplemented from KoToolBase
- virtual QWidget *createOptionWidget();
+ QWidget *createOptionWidget() override;
private Q_SLOTS:
void changeUrlPressed();
private:
VectorShape *m_shape;
};
#endif
diff --git a/plugins/flake/vectorshape/VectorToolFactory.h b/plugins/flake/vectorshape/VectorToolFactory.h
index d1582f4130..b54a4cbc15 100644
--- a/plugins/flake/vectorshape/VectorToolFactory.h
+++ b/plugins/flake/vectorshape/VectorToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
Copyright 2007 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef VECTOR_TOOL_FACTORY
#define VECTOR_TOOL_FACTORY
#include <KoToolFactoryBase.h>
class VectorToolFactory : public KoToolFactoryBase
{
public:
VectorToolFactory();
- ~VectorToolFactory();
+ ~VectorToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/plugins/generators/pattern/kis_wdg_pattern.h b/plugins/generators/pattern/kis_wdg_pattern.h
index 62fc4a54c9..771186fd6f 100644
--- a/plugins/generators/pattern/kis_wdg_pattern.h
+++ b/plugins/generators/pattern/kis_wdg_pattern.h
@@ -1,45 +1,45 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_PATTERN_H
#define KIS_WDG_PATTERN_H
#include <kis_config_widget.h>
class Ui_WdgPatternOptions;
class KisWdgPattern : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgPattern(QWidget* parent = 0);
- ~KisWdgPattern();
+ ~KisWdgPattern() override;
public:
inline const Ui_WdgPatternOptions* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgPatternOptions* m_widget;
};
#endif
diff --git a/plugins/generators/pattern/patterngenerator.h b/plugins/generators/pattern/patterngenerator.h
index 3dbe8dddb4..806e71d574 100644
--- a/plugins/generators/pattern/patterngenerator.h
+++ b/plugins/generators/pattern/patterngenerator.h
@@ -1,59 +1,59 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PATTERN_GENERATOR_H
#define PATTERN_GENERATOR_H
#include <QObject>
#include <QVariant>
#include "generator/kis_generator.h"
class KisConfigWidget;
class KritaPatternGenerator : public QObject
{
Q_OBJECT
public:
KritaPatternGenerator(QObject *parent, const QVariantList &);
- virtual ~KritaPatternGenerator();
+ ~KritaPatternGenerator() override;
};
class KoPatternGenerator : public KisGenerator
{
public:
KoPatternGenerator();
using KisGenerator::generate;
void generate(KisProcessingInformation dst,
const QSize& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("pattern", i18n("Pattern"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
#endif
diff --git a/plugins/generators/solid/colorgenerator.h b/plugins/generators/solid/colorgenerator.h
index abd8ef1f3a..f8d6b4763c 100644
--- a/plugins/generators/solid/colorgenerator.h
+++ b/plugins/generators/solid/colorgenerator.h
@@ -1,59 +1,59 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COLOR_GENERATOR_H
#define COLOR_GENERATOR_H
#include <QObject>
#include <QVariant>
#include "generator/kis_generator.h"
class KisConfigWidget;
class KritaColorGenerator : public QObject
{
Q_OBJECT
public:
KritaColorGenerator(QObject *parent, const QVariantList &);
- virtual ~KritaColorGenerator();
+ ~KritaColorGenerator() override;
};
class KisColorGenerator : public KisGenerator
{
public:
KisColorGenerator();
using KisGenerator::generate;
void generate(KisProcessingInformation dst,
const QSize& size,
const KisFilterConfigurationSP config,
KoUpdater* progressUpdater
- ) const;
+ ) const override;
static inline KoID id() {
return KoID("color", i18n("Color"));
}
- virtual KisFilterConfigurationSP factoryConfiguration() const;
- virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const;
+ KisFilterConfigurationSP factoryConfiguration() const override;
+ KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const override;
};
#endif
diff --git a/plugins/generators/solid/kis_wdg_color.h b/plugins/generators/solid/kis_wdg_color.h
index cb36459337..0498a6b573 100644
--- a/plugins/generators/solid/kis_wdg_color.h
+++ b/plugins/generators/solid/kis_wdg_color.h
@@ -1,48 +1,48 @@
/*
* This file is part of Krita
*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_WDG_COLOR_H
#define KIS_WDG_COLOR_H
#include <kis_config_widget.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
class Ui_WdgColorOptions;
class KisWdgColor : public KisConfigWidget
{
Q_OBJECT
public:
KisWdgColor(QWidget* parent = 0, const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8());
- ~KisWdgColor();
+ ~KisWdgColor() override;
public:
inline const Ui_WdgColorOptions* widget() const {
return m_widget;
}
- virtual void setConfiguration(const KisPropertiesConfigurationSP);
- virtual KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
Ui_WdgColorOptions* m_widget;
const KoColorSpace *m_cs;
};
#endif
diff --git a/plugins/impex/CMakeLists.txt b/plugins/impex/CMakeLists.txt
index f91943f646..eb2a2e8f8b 100644
--- a/plugins/impex/CMakeLists.txt
+++ b/plugins/impex/CMakeLists.txt
@@ -1,48 +1,48 @@
project(kritafilters)
add_subdirectory(libkra)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_definitions( -DCPU_32_BITS )
endif()
if(JPEG_FOUND AND HAVE_LCMS2)
add_subdirectory(jpeg)
endif()
if(TIFF_FOUND)
add_subdirectory(tiff)
endif()
if(PNG_FOUND)
add_subdirectory(png)
add_subdirectory(csv)
endif()
if(OPENEXR_FOUND)
add_subdirectory(exr)
endif()
-if(POPPLER_FOUND)
+if(Poppler_Qt5_FOUND)
add_subdirectory(pdf)
endif()
if(LIBRAW_FOUND)
add_subdirectory(raw)
endif()
add_subdirectory(svg)
add_subdirectory(bmp)
add_subdirectory(ora)
add_subdirectory(ppm)
add_subdirectory(xcf)
add_subdirectory(psd)
add_subdirectory(odg)
add_subdirectory(qml)
add_subdirectory(tga)
add_subdirectory(heightmap)
add_subdirectory(brush)
add_subdirectory(spriter)
add_subdirectory(video)
add_subdirectory(kra)
diff --git a/plugins/impex/bmp/kis_bmp_export.h b/plugins/impex/bmp/kis_bmp_export.h
index 62f7151e22..1615667c88 100644
--- a/plugins/impex/bmp/kis_bmp_export.h
+++ b/plugins/impex/bmp/kis_bmp_export.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BMP_EXPORT_H_
#define _KIS_BMP_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisBMPExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisBMPExport(QObject *parent, const QVariantList &);
- virtual ~KisBMPExport();
+ ~KisBMPExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/bmp/kis_bmp_import.h b/plugins/impex/bmp/kis_bmp_import.h
index 978c29836d..3be3b495d5 100644
--- a/plugins/impex/bmp/kis_bmp_import.h
+++ b/plugins/impex/bmp/kis_bmp_import.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BMP_IMPORT_H_
#define _KIS_BMP_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisBMPImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisBMPImport(QObject *parent, const QVariantList &);
- virtual ~KisBMPImport();
+ ~KisBMPImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/brush/KisAnimatedBrushAnnotation.h b/plugins/impex/brush/KisAnimatedBrushAnnotation.h
index 7e57e625c7..23ede68c78 100644
--- a/plugins/impex/brush/KisAnimatedBrushAnnotation.h
+++ b/plugins/impex/brush/KisAnimatedBrushAnnotation.h
@@ -1,36 +1,36 @@
/*
* This file is part of the KDE project
*
* Copyright (c) 2015 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISANIMATEDBRUSHANNOTATION_H
#define KISANIMATEDBRUSHANNOTATION_H
#include <kis_annotation.h>
class KisPipeBrushParasite;
class KisAnimatedBrushAnnotation : public KisAnnotation
{
public:
KisAnimatedBrushAnnotation(const KisPipeBrushParasite &parasite);
- virtual KisAnnotation* clone() const Q_DECL_OVERRIDE {
+ KisAnnotation* clone() const Q_DECL_OVERRIDE {
return new KisAnimatedBrushAnnotation(*this);
}
};
#endif // KISANIMATEDBRUSHANNOTATION_H
diff --git a/plugins/impex/brush/kis_brush_export.h b/plugins/impex/brush/kis_brush_export.h
index 9de2e6a44f..ba0c4077ed 100644
--- a/plugins/impex/brush/kis_brush_export.h
+++ b/plugins/impex/brush/kis_brush_export.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_Brush_EXPORT_H_
#define _KIS_Brush_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
#include <ui_wdg_export_gih.h>
#include <kis_config_widget.h>
#include <kis_properties_configuration.h>
class KisWdgOptionsBrush : public KisConfigWidget, public Ui::WdgExportGih
{
Q_OBJECT
public:
KisWdgOptionsBrush(QWidget *parent)
: KisConfigWidget(parent)
{
setupUi(this);
}
- void setConfiguration(const KisPropertiesConfigurationSP cfg);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
+ KisPropertiesConfigurationSP configuration() const override;
};
class KisBrushExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisBrushExport(QObject *parent, const QVariantList &);
- virtual ~KisBrushExport();
- virtual bool supportsIO() const { return false; }
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
+ ~KisBrushExport() override;
+ bool supportsIO() const override { return false; }
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
- void initializeCapabilities();
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/brush/kis_brush_import.h b/plugins/impex/brush/kis_brush_import.h
index 6d084b5d22..ee4f870acd 100644
--- a/plugins/impex/brush/kis_brush_import.h
+++ b/plugins/impex/brush/kis_brush_import.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_Brush_IMPORT_H_
#define _KIS_Brush_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisBrushImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisBrushImport(QObject *parent, const QVariantList &);
- virtual ~KisBrushImport();
+ ~KisBrushImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/csv/csv_loader.h b/plugins/impex/csv/csv_loader.h
index 941c8232c2..1b419aa031 100644
--- a/plugins/impex/csv/csv_loader.h
+++ b/plugins/impex/csv/csv_loader.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2016 Laszlo Fazekas <mneko@freemail.hu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CSV_LOADER_H_
#define CSV_LOADER_H_
#include <QObject>
#include <QFileInfo>
#include "kis_image.h"
#include "kritaui_export.h"
#include <KisImageBuilderResult.h>
class KisDocument;
#include "csv_layer_record.h"
class CSVLoader : public QObject {
Q_OBJECT
public:
CSVLoader(KisDocument* doc, bool batchMode);
- virtual ~CSVLoader();
+ ~CSVLoader() override;
KisImageBuilder_Result buildAnimation(QIODevice *io, const QString &filename);
KisImageSP image();
private:
KisImageBuilder_Result decode(QIODevice *io, const QString &filename);
KisImageBuilder_Result setLayer(CSVLayerRecord* , KisDocument* ,const QString &);
KisImageBuilder_Result createNewImage(int, int, float, const QString &);
QString convertBlending(const QString &);
QString validPath(const QString &, const QString &);
private Q_SLOTS:
void cancel();
private:
KisImageSP m_image;
KisDocument* m_doc;
bool m_batchMode;
bool m_stop;
};
#endif
diff --git a/plugins/impex/csv/csv_saver.h b/plugins/impex/csv/csv_saver.h
index edfeb37efe..395f84ef23 100644
--- a/plugins/impex/csv/csv_saver.h
+++ b/plugins/impex/csv/csv_saver.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2016 Laszlo Fazekas <mneko@freemail.hu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CSV_SAVER_H_
#define CSV_SAVER_H_
#include <QObject>
#include <QIODevice>
#include "kis_types.h"
#include "kis_raster_keyframe_channel.h"
#include "kis_png_converter.h"
/* The KisImageBuilder_Result definitions come from kis_png_converter.h here */
#include "csv_layer_record.h"
class KisDocument;
class CSVSaver : public QObject {
Q_OBJECT
public:
CSVSaver(KisDocument* doc, bool batchMode);
- virtual ~CSVSaver();
+ ~CSVSaver() override;
KisImageBuilder_Result buildAnimation(QIODevice *io);
KisImageSP image();
private:
KisImageBuilder_Result encode(QIODevice *io);
KisImageBuilder_Result getLayer(CSVLayerRecord* , KisDocument* , KisKeyframeSP, const QString &, int, int);
void createTempImage(KisDocument* );
QString convertToBlending(const QString &);
private Q_SLOTS:
void cancel();
private:
KisImageSP m_image;
KisDocument* m_doc;
bool m_batchMode;
bool m_stop;
};
#endif
diff --git a/plugins/impex/csv/kis_csv_export.h b/plugins/impex/csv/kis_csv_export.h
index 401af7e3ba..f2063884fb 100644
--- a/plugins/impex/csv/kis_csv_export.h
+++ b/plugins/impex/csv/kis_csv_export.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2016 Laszlo Fazekas <mneko@freemail.hu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CSV_EXPORT_H_
#define _KIS_CSV_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisCSVExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisCSVExport(QObject *parent, const QVariantList &);
- virtual ~KisCSVExport();
+ ~KisCSVExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/csv/kis_csv_import.h b/plugins/impex/csv/kis_csv_import.h
index d945a5a45f..dd342f05e4 100644
--- a/plugins/impex/csv/kis_csv_import.h
+++ b/plugins/impex/csv/kis_csv_import.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2016 Laszlo Fazekas <mneko@freemail.hu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_CSV_IMPORT_H_
#define _KIS_CSV_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisCSVImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisCSVImport(QObject *parent, const QVariantList &);
- virtual ~KisCSVImport();
+ ~KisCSVImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/exr/exr_converter.h b/plugins/impex/exr/exr_converter.h
index b92d2ebd96..d1d264f1dc 100644
--- a/plugins/impex/exr/exr_converter.h
+++ b/plugins/impex/exr/exr_converter.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _EXR_CONVERTER_H_
#define _EXR_CONVERTER_H_
#include <stdio.h>
#include <QObject>
#include "kis_types.h"
#include <KisImageBuilderResult.h>
class KisDocument;
class EXRConverter : public QObject
{
Q_OBJECT
public:
EXRConverter(KisDocument *doc, bool showNotifications);
- virtual ~EXRConverter();
+ ~EXRConverter() override;
public:
KisImageBuilder_Result buildImage(const QString &filename);
KisImageBuilder_Result buildFile(const QString &filename, KisPaintLayerSP layer);
KisImageBuilder_Result buildFile(const QString &filename, KisGroupLayerSP layer);
/**
* Retrieve the constructed image
*/
KisImageSP image();
QString errorMessage() const;
private:
KisImageBuilder_Result decode(const QString &filename);
public Q_SLOTS:
virtual void cancel();
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif
diff --git a/plugins/impex/exr/exr_export.h b/plugins/impex/exr/exr_export.h
index c58f139944..11a501ea19 100644
--- a/plugins/impex/exr/exr_export.h
+++ b/plugins/impex/exr/exr_export.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _EXR_EXPORT_H_
#define _EXR_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
#include <kis_config_widget.h>
#include "ui_exr_export_widget.h"
class KisWdgOptionsExr : public KisConfigWidget, public Ui::ExrExportWidget
{
Q_OBJECT
public:
KisWdgOptionsExr(QWidget *parent)
: KisConfigWidget(parent)
{
setupUi(this);
}
- void setConfiguration(const KisPropertiesConfigurationSP cfg);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
+ KisPropertiesConfigurationSP configuration() const override;
};
class EXRExport : public KisImportExportFilter
{
Q_OBJECT
public:
EXRExport(QObject *parent, const QVariantList &);
- virtual ~EXRExport();
- virtual bool supportsIO() const { return false; }
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
- void initializeCapabilities();
+ ~EXRExport() override;
+ bool supportsIO() const override { return false; }
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/exr/exr_import.h b/plugins/impex/exr/exr_import.h
index 52adab72b7..f009c2b341 100644
--- a/plugins/impex/exr/exr_import.h
+++ b/plugins/impex/exr/exr_import.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef EXR_IMPORT_H_
#define EXR_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class exrImport : public KisImportExportFilter
{
Q_OBJECT
public:
exrImport(QObject *parent, const QVariantList &);
- virtual ~exrImport();
- virtual bool supportsIO() const { return false; }
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ ~exrImport() override;
+ bool supportsIO() const override { return false; }
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/heightmap/kis_heightmap_export.h b/plugins/impex/heightmap/kis_heightmap_export.h
index e994135479..0e669f1547 100644
--- a/plugins/impex/heightmap/kis_heightmap_export.h
+++ b/plugins/impex/heightmap/kis_heightmap_export.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_HeightMap_EXPORT_H_
#define _KIS_HeightMap_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
#include <kis_config_widget.h>
#include "ui_kis_wdg_options_heightmap.h"
class KisWdgOptionsHeightmap : public KisConfigWidget, public Ui::WdgOptionsHeightMap
{
Q_OBJECT
public:
KisWdgOptionsHeightmap(QWidget *parent)
: KisConfigWidget(parent)
{
setupUi(this);
}
- void setConfiguration(const KisPropertiesConfigurationSP cfg);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
+ KisPropertiesConfigurationSP configuration() const override;
};
class KisHeightMapExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisHeightMapExport(QObject *parent, const QVariantList &);
- virtual ~KisHeightMapExport();
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
- void initializeCapabilities();
+ ~KisHeightMapExport() override;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
+ void initializeCapabilities() override;
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/heightmap/kis_heightmap_import.h b/plugins/impex/heightmap/kis_heightmap_import.h
index 64b5bb7fb0..518298fb59 100644
--- a/plugins/impex/heightmap/kis_heightmap_import.h
+++ b/plugins/impex/heightmap/kis_heightmap_import.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2014 Boudewijn Rempt <boud@valdyas.org>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_HeightMap_IMPORT_H_
#define _KIS_HeightMap_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisHeightMapImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisHeightMapImport(QObject *parent, const QVariantList &);
- virtual ~KisHeightMapImport();
+ ~KisHeightMapImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/jpeg/kis_jpeg_converter.cc b/plugins/impex/jpeg/kis_jpeg_converter.cc
index f6ddbb7c46..6435bf0d4f 100644
--- a/plugins/impex/jpeg/kis_jpeg_converter.cc
+++ b/plugins/impex/jpeg/kis_jpeg_converter.cc
@@ -1,731 +1,732 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kis_jpeg_converter.h"
#include <stdio.h>
#include <stdint.h>
#include <KoConfig.h>
#ifdef HAVE_LCMS2
# include <lcms2.h>
#else
# include <lcms.h>
#endif
extern "C" {
#include <iccjpeg.h>
}
#include <exiv2/jpgimage.hpp>
#include <QFile>
#include <QBuffer>
#include <QApplication>
#include <klocalizedstring.h>
#include <QFileInfo>
#include <KoDocumentInfo.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorProfile.h>
#include <KoColor.h>
#include <KoUnit.h>
#include "KoColorModelStandardIds.h"
#include <kis_painter.h>
#include <KisDocument.h>
#include <kis_image.h>
#include <kis_paint_layer.h>
#include <kis_transaction.h>
#include <kis_group_layer.h>
#include <metadata/kis_meta_data_entry.h>
#include <metadata/kis_meta_data_value.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_io_backend.h>
#include <kis_paint_device.h>
#include <kis_transform_worker.h>
#include <kis_jpeg_source.h>
#include <kis_jpeg_destination.h>
#include "kis_iterator_ng.h"
#include <KoColorModelStandardIds.h>
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
#define MAX_BYTES_IN_MARKER 65533 /* maximum data len of a JPEG marker */
#define MAX_DATA_BYTES_IN_MARKER (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
const char photoshopMarker[] = "Photoshop 3.0\0";
//const char photoshopBimId_[] = "8BIM";
const uint16_t photoshopIptc = 0x0404;
const char xmpMarker[] = "http://ns.adobe.com/xap/1.0/\0";
const QByteArray photoshopIptc_((char*)&photoshopIptc, 2);
namespace
{
void jpegErrorExit ( j_common_ptr cinfo )
{
char jpegLastErrorMsg[JMSG_LENGTH_MAX];
/* Create the message */
( *( cinfo->err->format_message ) ) ( cinfo, jpegLastErrorMsg );
/* Jump to the setjmp point */
throw std::runtime_error( jpegLastErrorMsg ); // or your preffered exception ...
}
J_COLOR_SPACE getColorTypeforColorSpace(const KoColorSpace * cs)
{
if (KoID(cs->id()) == KoID("GRAYA") || cs->id() == "GRAYAU16" || cs->id() == "GRAYA16") {
return JCS_GRAYSCALE;
}
if (KoID(cs->id()) == KoID("RGBA") || KoID(cs->id()) == KoID("RGBA16")) {
return JCS_RGB;
}
if (KoID(cs->id()) == KoID("CMYK") || KoID(cs->id()) == KoID("CMYKAU16")) {
return JCS_CMYK;
}
return JCS_UNKNOWN;
}
QString getColorSpaceModelForColorType(J_COLOR_SPACE color_type)
{
dbgFile << "color_type =" << color_type;
if (color_type == JCS_GRAYSCALE) {
return GrayAColorModelID.id();
} else if (color_type == JCS_RGB) {
return RGBAColorModelID.id();
} else if (color_type == JCS_CMYK) {
return CMYKAColorModelID.id();
}
return "";
}
}
struct KisJPEGConverter::Private
{
Private(KisDocument *doc, bool batchMode)
: doc(doc),
stop(false),
batchMode(batchMode)
{}
KisImageSP image;
KisDocument *doc;
bool stop;
bool batchMode;
};
KisJPEGConverter::KisJPEGConverter(KisDocument *doc, bool batchMode)
: m_d(new Private(doc, batchMode))
{
}
KisJPEGConverter::~KisJPEGConverter()
{
}
KisImageBuilder_Result KisJPEGConverter::decode(QIODevice *io)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jerr.error_exit = jpegErrorExit;
try {
jpeg_create_decompress(&cinfo);
KisJPEGSource::setSource(&cinfo, io);
jpeg_save_markers(&cinfo, JPEG_COM, 0xFFFF);
/* Save APP0..APP15 markers */
for (int m = 0; m < 16; m++)
jpeg_save_markers(&cinfo, JPEG_APP0 + m, 0xFFFF);
// setup_read_icc_profile(&cinfo);
// read header
jpeg_read_header(&cinfo, (boolean)true);
// start reading
jpeg_start_decompress(&cinfo);
// Get the colorspace
QString modelId = getColorSpaceModelForColorType(cinfo.out_color_space);
if (modelId.isEmpty()) {
dbgFile << "unsupported colorspace :" << cinfo.out_color_space;
jpeg_destroy_decompress(&cinfo);
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
uchar* profile_data;
uint profile_len;
const KoColorProfile* profile = 0;
QByteArray profile_rawdata;
if (read_icc_profile(&cinfo, &profile_data, &profile_len)) {
profile_rawdata.resize(profile_len);
memcpy(profile_rawdata.data(), profile_data, profile_len);
cmsHPROFILE hProfile = cmsOpenProfileFromMem(profile_data, profile_len);
if (hProfile != (cmsHPROFILE) 0) {
profile = KoColorSpaceRegistry::instance()->createColorProfile(modelId, Integer8BitsColorDepthID.id(), profile_rawdata);
Q_CHECK_PTR(profile);
dbgFile <<"profile name:" << profile->name() <<" product information:" << profile->info();
if (!profile->isSuitableForOutput()) {
dbgFile << "the profile is not suitable for output and therefore cannot be used in krita, we need to convert the image to a standard profile"; // TODO: in ko2 popup a selection menu to inform the user
}
}
}
+ const QString colorSpaceId =
+ KoColorSpaceRegistry::instance()->colorSpaceId(modelId, Integer8BitsColorDepthID.id());
+
// Check that the profile is used by the color space
- if (profile && !KoColorSpaceRegistry::instance()->colorSpaceFactory(
- KoColorSpaceRegistry::instance()->colorSpaceId(
- modelId, Integer8BitsColorDepthID.id()))->profileIsCompatible(profile)) {
+ if (profile && !KoColorSpaceRegistry::instance()->profileIsCompatible(profile, colorSpaceId)) {
warnFile << "The profile " << profile->name() << " is not compatible with the color space model " << modelId;
profile = 0;
}
// Retrieve a pointer to the colorspace
const KoColorSpace* cs;
if (profile && profile->isSuitableForOutput()) {
dbgFile << "image has embedded profile:" << profile -> name() << "";
cs = KoColorSpaceRegistry::instance()->colorSpace(modelId, Integer8BitsColorDepthID.id(), profile);
} else
cs = KoColorSpaceRegistry::instance()->colorSpace(modelId, Integer8BitsColorDepthID.id(), "");
if (cs == 0) {
dbgFile << "unknown colorspace";
jpeg_destroy_decompress(&cinfo);
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
// TODO fixit
// Create the cmsTransform if needed
KoColorTransformation* transform = 0;
if (profile && !profile->isSuitableForOutput()) {
transform = KoColorSpaceRegistry::instance()->colorSpace(modelId, Integer8BitsColorDepthID.id(), profile)->createColorConverter(cs, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
}
// Apparently an invalid transform was created from the profile. See bug https://bugs.kde.org/show_bug.cgi?id=255451.
// After 2.3: warn the user!
if (transform && !transform->isValid()) {
delete transform;
transform = 0;
}
// Creating the KisImageSP
if (!m_d->image) {
m_d->image = new KisImage(m_d->doc->createUndoStore(), cinfo.image_width, cinfo.image_height, cs, "built image");
Q_CHECK_PTR(m_d->image);
}
// Set resolution
double xres = 72, yres = 72;
if (cinfo.density_unit == 1) {
xres = cinfo.X_density;
yres = cinfo.Y_density;
} else if (cinfo.density_unit == 2) {
xres = cinfo.X_density * 2.54;
yres = cinfo.Y_density * 2.54;
}
if (xres < 72) {
xres = 72;
}
if (yres < 72) {
yres = 72;
}
m_d->image->setResolution(POINT_TO_INCH(xres), POINT_TO_INCH(yres)); // It is the "invert" macro because we convert from pointer-per-inchs to points
// Create layer
KisPaintLayerSP layer = KisPaintLayerSP(new KisPaintLayer(m_d->image.data(), m_d->image -> nextLayerName(), quint8_MAX));
// Read data
JSAMPROW row_pointer = new JSAMPLE[cinfo.image_width*cinfo.num_components];
for (; cinfo.output_scanline < cinfo.image_height;) {
KisHLineIteratorSP it = layer->paintDevice()->createHLineIteratorNG(0, cinfo.output_scanline, cinfo.image_width);
jpeg_read_scanlines(&cinfo, &row_pointer, 1);
quint8 *src = row_pointer;
switch (cinfo.out_color_space) {
case JCS_GRAYSCALE:
do {
quint8 *d = it->rawData();
d[0] = *(src++);
if (transform) transform->transform(d, d, 1);
d[1] = quint8_MAX;
} while (it->nextPixel());
break;
case JCS_RGB:
do {
quint8 *d = it->rawData();
d[2] = *(src++);
d[1] = *(src++);
d[0] = *(src++);
if (transform) transform->transform(d, d, 1);
d[3] = quint8_MAX;
} while (it->nextPixel());
break;
case JCS_CMYK:
do {
quint8 *d = it->rawData();
d[0] = quint8_MAX - *(src++);
d[1] = quint8_MAX - *(src++);
d[2] = quint8_MAX - *(src++);
d[3] = quint8_MAX - *(src++);
if (transform) transform->transform(d, d, 1);
d[4] = quint8_MAX;
} while (it->nextPixel());
break;
default:
return KisImageBuilder_RESULT_UNSUPPORTED;
}
}
m_d->image->addNode(KisNodeSP(layer.data()), m_d->image->rootLayer().data());
// Read exif information
dbgFile << "Looking for exif information";
for (jpeg_saved_marker_ptr marker = cinfo.marker_list; marker != 0; marker = marker->next) {
dbgFile << "Marker is" << marker->marker;
if (marker->marker != (JOCTET)(JPEG_APP0 + 1)
|| marker->data_length < 14) {
continue; /* Exif data is in an APP1 marker of at least 14 octets */
}
if (GETJOCTET(marker->data[0]) != (JOCTET) 0x45 ||
GETJOCTET(marker->data[1]) != (JOCTET) 0x78 ||
GETJOCTET(marker->data[2]) != (JOCTET) 0x69 ||
GETJOCTET(marker->data[3]) != (JOCTET) 0x66 ||
GETJOCTET(marker->data[4]) != (JOCTET) 0x00 ||
GETJOCTET(marker->data[5]) != (JOCTET) 0x00)
continue; /* no Exif header */
dbgFile << "Found exif information of length :" << marker->data_length;
KisMetaData::IOBackend* exifIO = KisMetaData::IOBackendRegistry::instance()->value("exif");
Q_ASSERT(exifIO);
QByteArray byteArray((const char*)marker->data + 6, marker->data_length - 6);
QBuffer buf(&byteArray);
exifIO->loadFrom(layer->metaData(), &buf);
// Interpret orientation tag
if (layer->metaData()->containsEntry("http://ns.adobe.com/tiff/1.0/", "Orientation")) {
KisMetaData::Entry& entry = layer->metaData()->getEntry("http://ns.adobe.com/tiff/1.0/", "Orientation");
if (entry.value().type() == KisMetaData::Value::Variant) {
switch (entry.value().asVariant().toInt()) {
case 2:
KisTransformWorker::mirrorY(layer->paintDevice());
break;
case 3:
image()->rotateImage(M_PI);
break;
case 4:
KisTransformWorker::mirrorX(layer->paintDevice());
break;
case 5:
image()->rotateImage(M_PI / 2);
KisTransformWorker::mirrorY(layer->paintDevice());
break;
case 6:
image()->rotateImage(M_PI / 2);
break;
case 7:
image()->rotateImage(M_PI / 2);
KisTransformWorker::mirrorX(layer->paintDevice());
break;
case 8:
image()->rotateImage(-M_PI / 2 + M_PI*2);
break;
default:
break;
}
}
entry.value().setVariant(1);
}
break;
}
dbgFile << "Looking for IPTC information";
for (jpeg_saved_marker_ptr marker = cinfo.marker_list; marker != 0; marker = marker->next) {
dbgFile << "Marker is" << marker->marker;
if (marker->marker != (JOCTET)(JPEG_APP0 + 13) || marker->data_length < 14) {
continue; /* IPTC data is in an APP13 marker of at least 16 octets */
}
if (memcmp(marker->data, photoshopMarker, 14) != 0) {
for (int i = 0; i < 14; i++) {
dbgFile << (int)(*(marker->data + i)) << "" << (int)(photoshopMarker[i]);
}
dbgFile << "No photoshop marker";
continue; /* No IPTC Header */
}
dbgFile << "Found Photoshop information of length :" << marker->data_length;
KisMetaData::IOBackend* iptcIO = KisMetaData::IOBackendRegistry::instance()->value("iptc");
Q_ASSERT(iptcIO);
const Exiv2::byte *record = 0;
uint32_t sizeIptc = 0;
uint32_t sizeHdr = 0;
// Find actual Iptc data within the APP13 segment
if (!Exiv2::Photoshop::locateIptcIrb((Exiv2::byte*)(marker->data + 14),
marker->data_length - 14, &record, &sizeHdr, &sizeIptc)) {
if (sizeIptc) {
// Decode the IPTC data
QByteArray byteArray((const char*)(record + sizeHdr), sizeIptc);
iptcIO->loadFrom(layer->metaData(), new QBuffer(&byteArray));
} else {
dbgFile << "IPTC Not found in Photoshop marker";
}
}
break;
}
dbgFile << "Looking for XMP information";
for (jpeg_saved_marker_ptr marker = cinfo.marker_list; marker != 0; marker = marker->next) {
dbgFile << "Marker is" << marker->marker;
if (marker->marker != (JOCTET)(JPEG_APP0 + 1) || marker->data_length < 31) {
continue; /* XMP data is in an APP1 marker of at least 31 octets */
}
if (memcmp(marker->data, xmpMarker, 29) != 0) {
dbgFile << "Not XMP marker";
continue; /* No xmp Header */
}
dbgFile << "Found XMP Marker of length " << marker->data_length;
QByteArray byteArray((const char*)marker->data + 29, marker->data_length - 29);
KisMetaData::IOBackend* xmpIO = KisMetaData::IOBackendRegistry::instance()->value("xmp");
Q_ASSERT(xmpIO);
xmpIO->loadFrom(layer->metaData(), new QBuffer(&byteArray));
break;
}
// Dump loaded metadata
layer->metaData()->debugDump();
// Check whether the metadata has resolution info, too...
if (cinfo.density_unit == 0 && layer->metaData()->containsEntry("tiff:XResolution") && layer->metaData()->containsEntry("tiff:YResolution")) {
double xres = layer->metaData()->getEntry("tiff:XResolution").value().asDouble();
double yres = layer->metaData()->getEntry("tiff:YResolution").value().asDouble();
if (xres != 0 && yres != 0) {
m_d->image->setResolution(POINT_TO_INCH(xres), POINT_TO_INCH(yres)); // It is the "invert" macro because we convert from pointer-per-inchs to points
}
}
// Finish decompression
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
delete [] row_pointer;
return KisImageBuilder_RESULT_OK;
}
catch( std::runtime_error &e) {
jpeg_destroy_decompress(&cinfo);
return KisImageBuilder_RESULT_FAILURE;
}
}
KisImageBuilder_Result KisJPEGConverter::buildImage(QIODevice *io)
{
return decode(io);
}
KisImageSP KisJPEGConverter::image()
{
return m_d->image;
}
KisImageBuilder_Result KisJPEGConverter::buildFile(QIODevice *io, KisPaintLayerSP layer, KisJPEGOptions options, KisMetaData::Store* metaData)
{
if (!layer)
return KisImageBuilder_RESULT_INVALID_ARG;
KisImageSP image = KisImageSP(layer->image());
if (!image)
return KisImageBuilder_RESULT_EMPTY;
const KoColorSpace * cs = layer->colorSpace();
J_COLOR_SPACE color_type = getColorTypeforColorSpace(cs);
if (color_type == JCS_UNKNOWN) {
KUndo2Command *tmp = layer->paintDevice()->convertTo(KoColorSpaceRegistry::instance()->rgb8(), KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
delete tmp;
cs = KoColorSpaceRegistry::instance()->rgb8();
color_type = JCS_RGB;
}
if (options.forceSRGB) {
const KoColorSpace* dst = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(), layer->colorSpace()->colorDepthId().id(), "sRGB built-in - (lcms internal)");
KUndo2Command *tmp = layer->paintDevice()->convertTo(dst);
delete tmp;
cs = dst;
color_type = JCS_RGB;
}
uint height = image->height();
uint width = image->width();
// Initialize structure
struct jpeg_compress_struct cinfo;
// Initialize error output
struct jpeg_error_mgr jerr;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
// Initialize output stream
KisJPEGDestination::setDestination(&cinfo, io);
cinfo.image_width = width; // image width and height, in pixels
cinfo.image_height = height;
cinfo.input_components = cs->colorChannelCount(); // number of color channels per pixel */
cinfo.in_color_space = color_type; // colorspace of input image
// Set default compression parameters
jpeg_set_defaults(&cinfo);
// Customize them
jpeg_set_quality(&cinfo, options.quality, (boolean)options.baseLineJPEG);
if (options.progressive) {
jpeg_simple_progression(&cinfo);
}
// Optimize ?
cinfo.optimize_coding = (boolean)options.optimize;
// Smoothing
cinfo.smoothing_factor = (boolean)options.smooth;
// Subsampling
switch (options.subsampling) {
default:
case 0: {
cinfo.comp_info[0].h_samp_factor = 2;
cinfo.comp_info[0].v_samp_factor = 2;
cinfo.comp_info[1].h_samp_factor = 1;
cinfo.comp_info[1].v_samp_factor = 1;
cinfo.comp_info[2].h_samp_factor = 1;
cinfo.comp_info[2].v_samp_factor = 1;
}
break;
case 1: {
cinfo.comp_info[0].h_samp_factor = 2;
cinfo.comp_info[0].v_samp_factor = 1;
cinfo.comp_info[1].h_samp_factor = 1;
cinfo.comp_info[1].v_samp_factor = 1;
cinfo.comp_info[2].h_samp_factor = 1;
cinfo.comp_info[2].v_samp_factor = 1;
}
break;
case 2: {
cinfo.comp_info[0].h_samp_factor = 1;
cinfo.comp_info[0].v_samp_factor = 2;
cinfo.comp_info[1].h_samp_factor = 1;
cinfo.comp_info[1].v_samp_factor = 1;
cinfo.comp_info[2].h_samp_factor = 1;
cinfo.comp_info[2].v_samp_factor = 1;
}
break;
case 3: {
cinfo.comp_info[0].h_samp_factor = 1;
cinfo.comp_info[0].v_samp_factor = 1;
cinfo.comp_info[1].h_samp_factor = 1;
cinfo.comp_info[1].v_samp_factor = 1;
cinfo.comp_info[2].h_samp_factor = 1;
cinfo.comp_info[2].v_samp_factor = 1;
}
break;
}
// Save resolution
cinfo.X_density = INCH_TO_POINT(image->xRes()); // It is the "invert" macro because we convert from pointer-per-inchs to points
cinfo.Y_density = INCH_TO_POINT(image->yRes()); // It is the "invert" macro because we convert from pointer-per-inchs to points
cinfo.density_unit = 1;
cinfo.write_JFIF_header = (boolean)true;
// Start compression
jpeg_start_compress(&cinfo, (boolean)true);
// Save exif and iptc information if any available
if (metaData && !metaData->empty()) {
metaData->applyFilters(options.filters);
// Save EXIF
if (options.exif) {
dbgFile << "Trying to save exif information";
KisMetaData::IOBackend* exifIO = KisMetaData::IOBackendRegistry::instance()->value("exif");
Q_ASSERT(exifIO);
QBuffer buffer;
exifIO->saveTo(metaData, &buffer, KisMetaData::IOBackend::JpegHeader);
dbgFile << "Exif information size is" << buffer.data().size();
QByteArray data = buffer.data();
if (data.size() < MAX_DATA_BYTES_IN_MARKER) {
jpeg_write_marker(&cinfo, JPEG_APP0 + 1, (const JOCTET*)data.data(), data.size());
} else {
dbgFile << "EXIF information could not be saved."; // TODO: warn the user ?
}
}
// Save IPTC
if (options.iptc) {
dbgFile << "Trying to save exif information";
KisMetaData::IOBackend* iptcIO = KisMetaData::IOBackendRegistry::instance()->value("iptc");
Q_ASSERT(iptcIO);
QBuffer buffer;
iptcIO->saveTo(metaData, &buffer, KisMetaData::IOBackend::JpegHeader);
dbgFile << "IPTC information size is" << buffer.data().size();
QByteArray data = buffer.data();
if (data.size() < MAX_DATA_BYTES_IN_MARKER) {
jpeg_write_marker(&cinfo, JPEG_APP0 + 13, (const JOCTET*)data.data(), data.size());
} else {
dbgFile << "IPTC information could not be saved."; // TODO: warn the user ?
}
}
// Save XMP
if (options.xmp) {
dbgFile << "Trying to save XMP information";
KisMetaData::IOBackend* xmpIO = KisMetaData::IOBackendRegistry::instance()->value("xmp");
Q_ASSERT(xmpIO);
QBuffer buffer;
xmpIO->saveTo(metaData, &buffer, KisMetaData::IOBackend::JpegHeader);
dbgFile << "XMP information size is" << buffer.data().size();
QByteArray data = buffer.data();
if (data.size() < MAX_DATA_BYTES_IN_MARKER) {
jpeg_write_marker(&cinfo, JPEG_APP0 + 14, (const JOCTET*)data.data(), data.size());
} else {
dbgFile << "XMP information could not be saved."; // TODO: warn the user ?
}
}
}
KisPaintDeviceSP dev = new KisPaintDevice(layer->colorSpace());
KoColor c(options.transparencyFillColor, layer->colorSpace());
dev->fill(QRect(0, 0, width, height), c);
KisPainter gc(dev);
gc.bitBlt(QPoint(0, 0), layer->paintDevice(), QRect(0, 0, width, height));
gc.end();
if (options.saveProfile) {
const KoColorProfile* colorProfile = layer->colorSpace()->profile();
QByteArray colorProfileData = colorProfile->rawData();
write_icc_profile(& cinfo, (uchar*) colorProfileData.data(), colorProfileData.size());
}
// Write data information
JSAMPROW row_pointer = new JSAMPLE[width*cinfo.input_components];
int color_nb_bits = 8 * layer->paintDevice()->pixelSize() / layer->paintDevice()->channelCount();
for (; cinfo.next_scanline < height;) {
KisHLineConstIteratorSP it = dev->createHLineConstIteratorNG(0, cinfo.next_scanline, width);
quint8 *dst = row_pointer;
switch (color_type) {
case JCS_GRAYSCALE:
if (color_nb_bits == 16) {
do {
//const quint16 *d = reinterpret_cast<const quint16 *>(it->oldRawData());
const quint8 *d = it->oldRawData();
*(dst++) = cs->scaleToU8(d, 0);//d[0] / quint8_MAX;
} while (it->nextPixel());
} else {
do {
const quint8 *d = it->oldRawData();
*(dst++) = d[0];
} while (it->nextPixel());
}
break;
case JCS_RGB:
if (color_nb_bits == 16) {
do {
//const quint16 *d = reinterpret_cast<const quint16 *>(it->oldRawData());
const quint8 *d = it->oldRawData();
*(dst++) = cs->scaleToU8(d, 2); //d[2] / quint8_MAX;
*(dst++) = cs->scaleToU8(d, 1); //d[1] / quint8_MAX;
*(dst++) = cs->scaleToU8(d, 0); //d[0] / quint8_MAX;
} while (it->nextPixel());
} else {
do {
const quint8 *d = it->oldRawData();
*(dst++) = d[2];
*(dst++) = d[1];
*(dst++) = d[0];
} while (it->nextPixel());
}
break;
case JCS_CMYK:
if (color_nb_bits == 16) {
do {
//const quint16 *d = reinterpret_cast<const quint16 *>(it->oldRawData());
const quint8 *d = it->oldRawData();
*(dst++) = quint8_MAX - cs->scaleToU8(d, 0);//quint8_MAX - d[0] / quint8_MAX;
*(dst++) = quint8_MAX - cs->scaleToU8(d, 1);//quint8_MAX - d[1] / quint8_MAX;
*(dst++) = quint8_MAX - cs->scaleToU8(d, 2);//quint8_MAX - d[2] / quint8_MAX;
*(dst++) = quint8_MAX - cs->scaleToU8(d, 3);//quint8_MAX - d[3] / quint8_MAX;
} while (it->nextPixel());
} else {
do {
const quint8 *d = it->oldRawData();
*(dst++) = quint8_MAX - d[0];
*(dst++) = quint8_MAX - d[1];
*(dst++) = quint8_MAX - d[2];
*(dst++) = quint8_MAX - d[3];
} while (it->nextPixel());
}
break;
default:
delete [] row_pointer;
jpeg_destroy_compress(&cinfo);
return KisImageBuilder_RESULT_UNSUPPORTED;
}
jpeg_write_scanlines(&cinfo, &row_pointer, 1);
}
// Writing is over
jpeg_finish_compress(&cinfo);
delete [] row_pointer;
// Free memory
jpeg_destroy_compress(&cinfo);
return KisImageBuilder_RESULT_OK;
}
void KisJPEGConverter::cancel()
{
m_d->stop = true;
}
diff --git a/plugins/impex/jpeg/kis_jpeg_converter.h b/plugins/impex/jpeg/kis_jpeg_converter.h
index d11648017b..ea4841ef08 100644
--- a/plugins/impex/jpeg/kis_jpeg_converter.h
+++ b/plugins/impex/jpeg/kis_jpeg_converter.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_JPEG_CONVERTER_H_
#define _KIS_JPEG_CONVERTER_H_
#include <stdio.h>
extern "C" {
#include <jpeglib.h>
}
#include <QColor>
#include <QVector>
#include <QColor>
#include "kis_types.h"
#include "kis_annotation.h"
#include <KisImageBuilderResult.h>
class KisDocument;
namespace KisMetaData
{
class Filter;
}
struct KisJPEGOptions {
int quality;
bool progressive;
bool optimize;
int smooth;
bool baseLineJPEG;
int subsampling;
bool exif;
bool iptc;
bool xmp;
QList<const KisMetaData::Filter*> filters;
QColor transparencyFillColor;
bool forceSRGB;
bool saveProfile;
};
namespace KisMetaData
{
class Store;
}
class KisJPEGConverter : public QObject
{
Q_OBJECT
public:
KisJPEGConverter(KisDocument *doc, bool batchMode = false);
- virtual ~KisJPEGConverter();
+ ~KisJPEGConverter() override;
public:
KisImageBuilder_Result buildImage(QIODevice *io);
KisImageBuilder_Result buildFile(QIODevice *io, KisPaintLayerSP layer, KisJPEGOptions options, KisMetaData::Store* metaData);
/** Retrieve the constructed image
*/
KisImageSP image();
public Q_SLOTS:
virtual void cancel();
private:
KisImageBuilder_Result decode(QIODevice *io);
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/impex/jpeg/kis_jpeg_export.h b/plugins/impex/jpeg/kis_jpeg_export.h
index 231018b45e..fdc12da1e7 100644
--- a/plugins/impex/jpeg/kis_jpeg_export.h
+++ b/plugins/impex/jpeg/kis_jpeg_export.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_JPEG_EXPORT_H_
#define _KIS_JPEG_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
#include <kis_config_widget.h>
#include "ui_kis_wdg_options_jpeg.h"
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_filter_registry_model.h>
class KisWdgOptionsJPEG : public KisConfigWidget, public Ui::WdgOptionsJPEG
{
Q_OBJECT
public:
KisWdgOptionsJPEG(QWidget *parent);
- void setConfiguration(const KisPropertiesConfigurationSP cfg);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
KisMetaData::FilterRegistryModel m_filterRegistryModel;
};
class KisJPEGExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisJPEGExport(QObject *parent, const QVariantList &);
- virtual ~KisJPEGExport();
+ ~KisJPEGExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/jpeg/kis_jpeg_import.h b/plugins/impex/jpeg/kis_jpeg_import.h
index f4f0cc9291..598237b859 100644
--- a/plugins/impex/jpeg/kis_jpeg_import.h
+++ b/plugins/impex/jpeg/kis_jpeg_import.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_JPEG_IMPORT_H_
#define _KIS_JPEG_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisJPEGImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisJPEGImport(QObject *parent, const QVariantList &);
- virtual ~KisJPEGImport();
+ ~KisJPEGImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/kra/kra_converter.h b/plugins/impex/kra/kra_converter.h
index 75bb789758..bbcec68ca4 100644
--- a/plugins/impex/kra/kra_converter.h
+++ b/plugins/impex/kra/kra_converter.h
@@ -1,80 +1,80 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KRA_CONVERTER_H_
#define _KRA_CONVERTER_H_
#include <stdio.h>
#include <QObject>
#include <QDomDocument>
#include <KoStore.h>
#include <kis_png_converter.h>
#include <kis_types.h>
#include <kis_kra_saver.h>
#include <kis_kra_loader.h>
class KisDocument;
class KraConverter : public QObject
{
Q_OBJECT
public:
KraConverter(KisDocument *doc);
- virtual ~KraConverter();
+ ~KraConverter() override;
KisImageBuilder_Result buildImage(QIODevice *io);
KisImageBuilder_Result buildFile(QIODevice *io);
/**
* Retrieve the constructed image
*/
KisImageSP image();
vKisNodeSP activeNodes();
QList<KisPaintingAssistantSP> assistants();
public Q_SLOTS:
virtual void cancel();
private:
bool saveRootDocuments(KoStore *store);
bool saveToStream(QIODevice *dev);
QDomDocument createDomDocument();
bool savePreview(KoStore *store);
bool oldLoadAndParse(KoStore *store, const QString &filename, KoXmlDocument &xmldoc);
bool loadXML(const KoXmlDocument &doc, KoStore *store);
bool completeLoading(KoStore *store);
KisDocument *m_doc {0};
KisImageSP m_image;
vKisNodeSP m_activeNodes;
QList<KisPaintingAssistantSP> m_assistants;
bool m_stop {false};
KoStore *m_store {0};
KisKraSaver *m_kraSaver {0};
KisKraLoader *m_kraLoader {0};
};
#endif
diff --git a/plugins/impex/kra/kra_export.h b/plugins/impex/kra/kra_export.h
index 349f68b0b6..2dc08f2cb7 100644
--- a/plugins/impex/kra/kra_export.h
+++ b/plugins/impex/kra/kra_export.h
@@ -1,39 +1,39 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KRA_EXPORT_H_
#define _KRA_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KraExport : public KisImportExportFilter
{
Q_OBJECT
public:
KraExport(QObject *parent, const QVariantList &);
- virtual ~KraExport();
+ ~KraExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/kra/kra_import.h b/plugins/impex/kra/kra_import.h
index 377bd42f32..f5eb04a2db 100644
--- a/plugins/impex/kra/kra_import.h
+++ b/plugins/impex/kra/kra_import.h
@@ -1,37 +1,37 @@
/*
* Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KRA_IMPORT_H_
#define KRA_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KraImport : public KisImportExportFilter
{
Q_OBJECT
public:
KraImport(QObject *parent, const QVariantList &);
- virtual ~KraImport();
+ ~KraImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/libkra/kis_kra_load_visitor.h b/plugins/impex/libkra/kis_kra_load_visitor.h
index 6d7392c3f3..9bf3706c46 100644
--- a/plugins/impex/libkra/kis_kra_load_visitor.h
+++ b/plugins/impex/libkra/kis_kra_load_visitor.h
@@ -1,98 +1,98 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_KRA_LOAD_VISITOR_H_
#define KIS_KRA_LOAD_VISITOR_H_
#include <QRect>
#include <QStringList>
// kritaimage
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kritalibkra_export.h"
class KisFilterConfiguration;
class KoStore;
class KRITALIBKRA_EXPORT KisKraLoadVisitor : public KisNodeVisitor
{
public:
KisKraLoadVisitor(KisImageSP image,
KoStore *store,
QMap<KisNode *, QString> &layerFilenames,
QMap<KisNode *, QString> &keyframeFilenames,
const QString & name,
int syntaxVersion);
public:
void setExternalUri(const QString &uri);
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisExternalLayer *);
- bool visit(KisPaintLayer *layer);
- bool visit(KisGroupLayer *layer);
- bool visit(KisAdjustmentLayer* layer);
- bool visit(KisGeneratorLayer* layer);
- bool visit(KisCloneLayer *layer);
- bool visit(KisFilterMask *mask);
- bool visit(KisTransformMask *mask);
- bool visit(KisTransparencyMask *mask);
- bool visit(KisSelectionMask *mask);
- bool visit(KisColorizeMask *mask);
+ bool visit(KisExternalLayer *) override;
+ bool visit(KisPaintLayer *layer) override;
+ bool visit(KisGroupLayer *layer) override;
+ bool visit(KisAdjustmentLayer* layer) override;
+ bool visit(KisGeneratorLayer* layer) override;
+ bool visit(KisCloneLayer *layer) override;
+ bool visit(KisFilterMask *mask) override;
+ bool visit(KisTransformMask *mask) override;
+ bool visit(KisTransparencyMask *mask) override;
+ bool visit(KisSelectionMask *mask) override;
+ bool visit(KisColorizeMask *mask) override;
QStringList errorMessages() const;
QStringList warningMessages() const;
private:
bool loadPaintDevice(KisPaintDeviceSP device, const QString& location);
template<class DevicePolicy>
bool loadPaintDeviceFrame(KisPaintDeviceSP device, const QString &location, DevicePolicy policy);
bool loadProfile(KisPaintDeviceSP device, const QString& location);
bool loadFilterConfiguration(KisFilterConfigurationSP kfc, const QString& location);
bool loadMetaData(KisNode* node);
void initSelectionForMask(KisMask *mask);
bool loadSelection(const QString& location, KisSelectionSP dstSelection);
QString getLocation(KisNode* node, const QString& suffix = QString());
QString getLocation(const QString &filename, const QString &suffix = QString());
void loadNodeKeyframes(KisNode *node);
private:
KisImageSP m_image;
KoStore *m_store;
bool m_external;
QString m_uri;
QMap<KisNode *, QString> m_layerFilenames;
QMap<KisNode *, QString> m_keyframeFilenames;
QString m_name;
int m_syntaxVersion;
QStringList m_errorMessages;
QStringList m_warningMessages;
};
#endif // KIS_KRA_LOAD_VISITOR_H_
diff --git a/plugins/impex/libkra/kis_kra_loader.cpp b/plugins/impex/libkra/kis_kra_loader.cpp
index d9fac5a1e8..164d72da9a 100644
--- a/plugins/impex/libkra/kis_kra_loader.cpp
+++ b/plugins/impex/libkra/kis_kra_loader.cpp
@@ -1,1153 +1,1154 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2007
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kis_kra_loader.h"
#include <QApplication>
#include <QStringList>
#include <QMessageBox>
#include <QUrl>
#include <QBuffer>
#include <KoStore.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpaceEngine.h>
#include <KoColorProfile.h>
#include <KoDocumentInfo.h>
#include <KoFileDialog.h>
#include <KisImportExportManager.h>
#include <KoXmlReader.h>
#include <KoStoreDevice.h>
#include <filter/kis_filter.h>
#include <filter/kis_filter_registry.h>
#include <generator/kis_generator.h>
#include <generator/kis_generator_layer.h>
#include <generator/kis_generator_registry.h>
#include <kis_adjustment_layer.h>
#include <kis_annotation.h>
#include <kis_base_node.h>
#include <kis_clone_layer.h>
#include <kis_debug.h>
#include <kis_assert.h>
#include <kis_external_layer_iface.h>
#include <kis_filter_mask.h>
#include <kis_transform_mask.h>
#include "lazybrush/kis_colorize_mask.h"
#include <kis_group_layer.h>
#include <kis_image.h>
#include <kis_layer.h>
#include <kis_name_server.h>
#include <kis_paint_layer.h>
#include <kis_selection.h>
#include <kis_selection_mask.h>
#include <kis_shape_layer.h>
#include <kis_transparency_mask.h>
#include <kis_layer_composition.h>
#include <kis_file_layer.h>
#include <kis_psd_layer_style.h>
#include <kis_psd_layer_style_resource.h>
#include "kis_resource_server_provider.h"
#include "kis_keyframe_channel.h"
#include <kis_filter_configuration.h>
#include "KisDocument.h"
#include "kis_config.h"
#include "kis_kra_tags.h"
#include "kis_kra_utils.h"
#include "kis_kra_load_visitor.h"
#include "kis_dom_utils.h"
#include "kis_image_animation_interface.h"
#include "kis_time_range.h"
#include "kis_grid_config.h"
#include "kis_guides_config.h"
#include "kis_image_config.h"
#include "KisProofingConfiguration.h"
#include "kis_layer_properties_icons.h"
#include "kis_node_view_color_scheme.h"
/*
Color model id comparison through the ages:
2.4 2.5 2.6 ideal
ALPHA ALPHA ALPHA ALPHAU8
CMYK CMYK CMYK CMYKAU8
CMYKAF32 CMYKAF32
CMYKA16 CMYKAU16 CMYKAU16
GRAYA GRAYA GRAYA GRAYAU8
GrayF32 GRAYAF32 GRAYAF32
GRAYA16 GRAYAU16 GRAYAU16
LABA LABA LABA LABAU16
LABAF32 LABAF32
LABAU8 LABAU8
RGBA RGBA RGBA RGBAU8
RGBA16 RGBA16 RGBA16 RGBAU16
RgbAF32 RGBAF32 RGBAF32
RgbAF16 RgbAF16 RGBAF16
XYZA16 XYZA16 XYZA16 XYZAU16
XYZA8 XYZA8 XYZAU8
XyzAF16 XyzAF16 XYZAF16
XyzAF32 XYZAF32 XYZAF32
YCbCrA YCBCRA8 YCBCRA8 YCBCRAU8
YCbCrAU16 YCBCRAU16 YCBCRAU16
YCBCRF32 YCBCRF32
*/
using namespace KRA;
struct KisKraLoader::Private
{
public:
KisDocument* document;
QString imageName; // used to be stored in the image, is now in the documentInfo block
QString imageComment; // used to be stored in the image, is now in the documentInfo block
QMap<KisNode*, QString> layerFilenames; // temp storage during loading
int syntaxVersion; // version of the fileformat we are loading
vKisNodeSP selectedNodes; // the nodes that were active when saving the document.
QMap<QString, QString> assistantsFilenames;
QList<KisPaintingAssistantSP> assistants;
QMap<KisNode*, QString> keyframeFilenames;
QStringList errorMessages;
QStringList warningMessages;
};
void convertColorSpaceNames(QString &colorspacename, QString &profileProductName) {
if (colorspacename == "Grayscale + Alpha") {
colorspacename = "GRAYA";
profileProductName.clear();
}
else if (colorspacename == "RgbAF32") {
colorspacename = "RGBAF32";
profileProductName.clear();
}
else if (colorspacename == "RgbAF16") {
colorspacename = "RGBAF16";
profileProductName.clear();
}
else if (colorspacename == "CMYKA16") {
colorspacename = "CMYKAU16";
}
else if (colorspacename == "GrayF32") {
colorspacename = "GRAYAF32";
profileProductName.clear();
}
else if (colorspacename == "GRAYA16") {
colorspacename = "GRAYAU16";
}
else if (colorspacename == "XyzAF16") {
colorspacename = "XYZAF16";
profileProductName.clear();
}
else if (colorspacename == "XyzAF32") {
colorspacename = "XYZAF32";
profileProductName.clear();
}
else if (colorspacename == "YCbCrA") {
colorspacename = "YCBCRA8";
}
else if (colorspacename == "YCbCrAU16") {
colorspacename = "YCBCRAU16";
}
}
KisKraLoader::KisKraLoader(KisDocument * document, int syntaxVersion)
: m_d(new Private())
{
m_d->document = document;
m_d->syntaxVersion = syntaxVersion;
}
KisKraLoader::~KisKraLoader()
{
delete m_d;
}
KisImageSP KisKraLoader::loadXML(const KoXmlElement& element)
{
QString attr;
KisImageSP image = 0;
QString name;
qint32 width;
qint32 height;
QString profileProductName;
double xres;
double yres;
QString colorspacename;
const KoColorSpace * cs;
if ((attr = element.attribute(MIME)) == NATIVE_MIMETYPE) {
if ((m_d->imageName = element.attribute(NAME)).isNull()) {
m_d->errorMessages << i18n("Image does not have a name.");
return KisImageSP(0);
}
if ((attr = element.attribute(WIDTH)).isNull()) {
m_d->errorMessages << i18n("Image does not specify a width.");
return KisImageSP(0);
}
width = KisDomUtils::toInt(attr);
if ((attr = element.attribute(HEIGHT)).isNull()) {
m_d->errorMessages << i18n("Image does not specify a height.");
return KisImageSP(0);
}
height = KisDomUtils::toInt(attr);
m_d->imageComment = element.attribute(DESCRIPTION);
xres = 100.0 / 72.0;
if (!(attr = element.attribute(X_RESOLUTION)).isNull()) {
qreal value = KisDomUtils::toDouble(attr);
if (value > 1.0) {
xres = value / 72.0;
}
}
yres = 100.0 / 72.0;
if (!(attr = element.attribute(Y_RESOLUTION)).isNull()) {
qreal value = KisDomUtils::toDouble(attr);
if (value > 1.0) {
yres = value / 72.0;
}
}
if ((colorspacename = element.attribute(COLORSPACE_NAME)).isNull()) {
// An old file: take a reasonable default.
// Krita didn't support anything else in those
// days anyway.
colorspacename = "RGBA";
}
profileProductName = element.attribute(PROFILE);
// A hack for an old colorspacename
convertColorSpaceNames(colorspacename, profileProductName);
QString colorspaceModel = KoColorSpaceRegistry::instance()->colorSpaceColorModelId(colorspacename).id();
QString colorspaceDepth = KoColorSpaceRegistry::instance()->colorSpaceColorDepthId(colorspacename).id();
if (profileProductName.isNull()) {
// no mention of profile so get default profile";
cs = KoColorSpaceRegistry::instance()->colorSpace(colorspaceModel, colorspaceDepth, "");
} else {
cs = KoColorSpaceRegistry::instance()->colorSpace(colorspaceModel, colorspaceDepth, profileProductName);
}
if (cs == 0) {
// try once more without the profile
cs = KoColorSpaceRegistry::instance()->colorSpace(colorspaceModel, colorspaceDepth, "");
if (cs == 0) {
m_d->errorMessages << i18n("Image specifies an unsupported color model: %1.", colorspacename);
return KisImageSP(0);
}
}
KisImageConfig cfgImage;
KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
if (!(attr = element.attribute(PROOFINGPROFILENAME)).isNull()) {
proofingConfig->proofingProfile = attr;
}
if (!(attr = element.attribute(PROOFINGMODEL)).isNull()) {
proofingConfig->proofingModel = attr;
}
if (!(attr = element.attribute(PROOFINGDEPTH)).isNull()) {
proofingConfig->proofingDepth = attr;
}
if (!(attr = element.attribute(PROOFINGINTENT)).isNull()) {
proofingConfig->intent = (KoColorConversionTransformation::Intent) KisDomUtils::toInt(attr);
}
if (!(attr = element.attribute(PROOFINGADAPTATIONSTATE)).isNull()) {
proofingConfig->adaptationState = KisDomUtils::toDouble(attr);
}
if (m_d->document) {
image = new KisImage(m_d->document->createUndoStore(), width, height, cs, name);
}
else {
image = new KisImage(0, width, height, cs, name);
}
image->setResolution(xres, yres);
loadNodes(element, image, const_cast<KisGroupLayer*>(image->rootLayer().data()));
KoXmlNode child;
for (child = element.lastChild(); !child.isNull(); child = child.previousSibling()) {
KoXmlElement e = child.toElement();
if(e.tagName() == CANVASPROJECTIONCOLOR) {
if (e.hasAttribute(COLORBYTEDATA)) {
QByteArray colorData = QByteArray::fromBase64(e.attribute(COLORBYTEDATA).toLatin1());
KoColor color((const quint8*)colorData.data(), image->colorSpace());
image->setDefaultProjectionColor(color);
}
}
if(e.tagName()== PROOFINGWARNINGCOLOR) {
QDomDocument dom;
KoXml::asQDomElement(dom, e);
QDomElement eq = dom.firstChildElement();
proofingConfig->warningColor = KoColor::fromXML(eq.firstChildElement(), Integer8BitsColorDepthID.id());
}
if (e.tagName().toLower() == "animation") {
loadAnimationMetadata(e, image);
}
}
image->setProofingConfiguration(proofingConfig);
for (child = element.lastChild(); !child.isNull(); child = child.previousSibling()) {
KoXmlElement e = child.toElement();
if(e.tagName() == "compositions") {
loadCompositions(e, image);
}
}
}
KoXmlNode child;
for (child = element.lastChild(); !child.isNull(); child = child.previousSibling()) {
KoXmlElement e = child.toElement();
if (e.tagName() == "grid") {
loadGrid(e);
} else if (e.tagName() == "guides") {
loadGuides(e);
} else if (e.tagName() == "assistants") {
loadAssistantsList(e);
} else if (e.tagName() == "audio") {
loadAudio(e, image);
}
}
return image;
}
void KisKraLoader::loadBinaryData(KoStore * store, KisImageSP image, const QString & uri, bool external)
{
// icc profile: if present, this overrides the profile product name loaded in loadXML.
QString location = external ? QString() : uri;
location += m_d->imageName + ICC_PATH;
if (store->hasFile(location)) {
if (store->open(location)) {
QByteArray data; data.resize(store->size());
bool res = (store->read(data.data(), store->size()) > -1);
store->close();
if (res) {
const KoColorProfile *profile = KoColorSpaceRegistry::instance()->createColorProfile(image->colorSpace()->colorModelId().id(), image->colorSpace()->colorDepthId().id(), data);
if (profile && profile->valid()) {
res = image->assignImageProfile(profile);
}
if (!res) {
- profile = KoColorSpaceRegistry::instance()->profileByName(KoColorSpaceRegistry::instance()->colorSpaceFactory(image->colorSpace()->id())->defaultProfile());
+ const QString defaultProfileId = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(image->colorSpace()->id());
+ profile = KoColorSpaceRegistry::instance()->profileByName(defaultProfileId);
Q_ASSERT(profile && profile->valid());
image->assignImageProfile(profile);
}
}
}
}
//load the embed proofing profile, it only needs to be loaded into Krita, not assigned.
location = external ? QString() : uri;
location += m_d->imageName + ICC_PROOFING_PATH;
if (store->hasFile(location)) {
if (store->open(location)) {
QByteArray proofingData;
proofingData.resize(store->size());
bool proofingProfileRes = (store->read(proofingData.data(), store->size())>-1);
store->close();
if (proofingProfileRes)
{
const KoColorProfile *proofingProfile = KoColorSpaceRegistry::instance()->createColorProfile(image->proofingConfiguration()->proofingModel, image->proofingConfiguration()->proofingDepth, proofingData);
if (proofingProfile->valid()){
//if (KoColorSpaceEngineRegistry::instance()->get("icc")) {
// KoColorSpaceEngineRegistry::instance()->get("icc")->addProfile(proofingProfile->fileName());
//}
KoColorSpaceRegistry::instance()->addProfile(proofingProfile);
}
}
}
}
// Load the layers data: if there is a profile associated with a layer it will be set now.
KisKraLoadVisitor visitor(image, store, m_d->layerFilenames, m_d->keyframeFilenames, m_d->imageName, m_d->syntaxVersion);
if (external) {
visitor.setExternalUri(uri);
}
image->rootLayer()->accept(visitor);
if (!visitor.errorMessages().isEmpty()) {
m_d->errorMessages.append(visitor.errorMessages());
}
if (!visitor.warningMessages().isEmpty()) {
m_d->warningMessages.append(visitor.warningMessages());
}
// annotations
// exif
location = external ? QString() : uri;
location += m_d->imageName + EXIF_PATH;
if (store->hasFile(location)) {
QByteArray data;
store->open(location);
data = store->read(store->size());
store->close();
image->addAnnotation(KisAnnotationSP(new KisAnnotation("exif", "", data)));
}
// layer styles
location = external ? QString() : uri;
location += m_d->imageName + LAYER_STYLES_PATH;
if (store->hasFile(location)) {
KisPSDLayerStyleCollectionResource *collection =
new KisPSDLayerStyleCollectionResource("Embedded Styles.asl");
collection->setName(i18nc("Auto-generated layer style collection name for embedded styles (collection)", "<%1> (embedded)", m_d->imageName));
KIS_ASSERT_RECOVER_NOOP(!collection->valid());
store->open(location);
{
KoStoreDevice device(store);
device.open(QIODevice::ReadOnly);
/**
* ASL loading code cannot work with non-sequential IO devices,
* so convert the device beforehand!
*/
QByteArray buf = device.readAll();
QBuffer raDevice(&buf);
raDevice.open(QIODevice::ReadOnly);
collection->loadFromDevice(&raDevice);
}
store->close();
if (collection->valid()) {
KoResourceServer<KisPSDLayerStyleCollectionResource> *server = KisResourceServerProvider::instance()->layerStyleCollectionServer();
server->addResource(collection, false);
collection->assignAllLayerStyles(image->root());
} else {
warnKrita << "WARNING: Couldn't load layer styles library from .kra!";
delete collection;
}
}
if (m_d->document && m_d->document->documentInfo()->aboutInfo("title").isNull())
m_d->document->documentInfo()->setAboutInfo("title", m_d->imageName);
if (m_d->document && m_d->document->documentInfo()->aboutInfo("comment").isNull())
m_d->document->documentInfo()->setAboutInfo("comment", m_d->imageComment);
loadAssistants(store, uri, external);
}
vKisNodeSP KisKraLoader::selectedNodes() const
{
return m_d->selectedNodes;
}
QList<KisPaintingAssistantSP> KisKraLoader::assistants() const
{
return m_d->assistants;
}
QStringList KisKraLoader::errorMessages() const
{
return m_d->errorMessages;
}
QStringList KisKraLoader::warningMessages() const
{
return m_d->warningMessages;
}
void KisKraLoader::loadAssistants(KoStore *store, const QString &uri, bool external)
{
QString file_path;
QString location;
QMap<int ,KisPaintingAssistantHandleSP> handleMap;
KisPaintingAssistant* assistant = 0;
QMap<QString,QString>::const_iterator loadedAssistant = m_d->assistantsFilenames.constBegin();
while (loadedAssistant != m_d->assistantsFilenames.constEnd()){
const KisPaintingAssistantFactory* factory = KisPaintingAssistantFactoryRegistry::instance()->get(loadedAssistant.value());
if (factory) {
assistant = factory->createPaintingAssistant();
location = external ? QString() : uri;
location += m_d->imageName + ASSISTANTS_PATH;
file_path = location + loadedAssistant.key();
assistant->loadXml(store, handleMap, file_path);
//If an assistant has too few handles than it should according to it's own setup, just don't load it//
if (assistant->handles().size()==assistant->numHandles()){
m_d->assistants.append(toQShared(assistant));
}
}
loadedAssistant++;
}
}
void KisKraLoader::loadAnimationMetadata(const KoXmlElement &element, KisImageSP image)
{
QDomDocument qDom;
KoXml::asQDomElement(qDom, element);
QDomElement qElement = qDom.firstChildElement();
float framerate;
KisTimeRange range;
int currentTime;
KisImageAnimationInterface *animation = image->animationInterface();
if (KisDomUtils::loadValue(qElement, "framerate", &framerate)) {
animation->setFramerate(framerate);
}
if (KisDomUtils::loadValue(qElement, "range", &range)) {
animation->setFullClipRange(range);
}
if (KisDomUtils::loadValue(qElement, "currentTime", &currentTime)) {
animation->switchCurrentTimeAsync(currentTime);
}
}
KisNodeSP KisKraLoader::loadNodes(const KoXmlElement& element, KisImageSP image, KisNodeSP parent)
{
KoXmlNode node = element.firstChild();
KoXmlNode child;
if (!node.isNull()) {
if (node.isElement()) {
if (node.nodeName().toUpper() == LAYERS.toUpper() || node.nodeName().toUpper() == MASKS.toUpper()) {
for (child = node.lastChild(); !child.isNull(); child = child.previousSibling()) {
KisNodeSP node = loadNode(child.toElement(), image, parent);
if (node) {
image->nextLayerName(); // Make sure the nameserver is current with the number of nodes.
image->addNode(node, parent);
if (node->inherits("KisLayer") && child.childNodesCount() > 0) {
loadNodes(child.toElement(), image, node);
}
}
}
}
}
}
return parent;
}
KisNodeSP KisKraLoader::loadNode(const KoXmlElement& element, KisImageSP image, KisNodeSP parent)
{
// Nota bene: If you add new properties to layers, you should
// ALWAYS define a default value in case the property is not
// present in the layer definition: this helps a LOT with backward
// compatibility.
QString name = element.attribute(NAME, "No Name");
QUuid id = QUuid(element.attribute(UUID, QUuid().toString()));
qint32 x = element.attribute(X, "0").toInt();
qint32 y = element.attribute(Y, "0").toInt();
qint32 opacity = element.attribute(OPACITY, QString::number(OPACITY_OPAQUE_U8)).toInt();
if (opacity < OPACITY_TRANSPARENT_U8) opacity = OPACITY_TRANSPARENT_U8;
if (opacity > OPACITY_OPAQUE_U8) opacity = OPACITY_OPAQUE_U8;
const KoColorSpace* colorSpace = 0;
if ((element.attribute(COLORSPACE_NAME)).isNull()) {
dbgFile << "No attribute color space for layer: " << name;
colorSpace = image->colorSpace();
}
else {
QString colorspacename = element.attribute(COLORSPACE_NAME);
QString profileProductName;
convertColorSpaceNames(colorspacename, profileProductName);
QString colorspaceModel = KoColorSpaceRegistry::instance()->colorSpaceColorModelId(colorspacename).id();
QString colorspaceDepth = KoColorSpaceRegistry::instance()->colorSpaceColorDepthId(colorspacename).id();
dbgFile << "Searching color space: " << colorspacename << colorspaceModel << colorspaceDepth << " for layer: " << name;
// use default profile - it will be replaced later in completeLoading
colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorspaceModel, colorspaceDepth, "");
dbgFile << "found colorspace" << colorSpace;
if (!colorSpace) {
m_d->warningMessages << i18n("Layer %1 specifies an unsupported color model: %2.", name, colorspacename);
return 0;
}
}
const bool visible = element.attribute(VISIBLE, "1") == "0" ? false : true;
const bool locked = element.attribute(LOCKED, "0") == "0" ? false : true;
const bool collapsed = element.attribute(COLLAPSED, "0") == "0" ? false : true;
int colorLabelIndex = element.attribute(COLOR_LABEL, "0").toInt();
QVector<QColor> labels = KisNodeViewColorScheme::instance()->allColorLabels();
if (colorLabelIndex >= labels.size()) {
colorLabelIndex = labels.size() - 1;
}
// Now find out the layer type and do specific handling
QString nodeType;
if (m_d->syntaxVersion == 1) {
nodeType = element.attribute("layertype");
if (nodeType.isEmpty()) {
nodeType = PAINT_LAYER;
}
}
else {
nodeType = element.attribute(NODE_TYPE);
}
if (nodeType.isEmpty()) {
m_d->warningMessages << i18n("Layer %1 has an unsupported type.", name);
return 0;
}
KisNodeSP node = 0;
if (nodeType == PAINT_LAYER)
node = loadPaintLayer(element, image, name, colorSpace, opacity);
else if (nodeType == GROUP_LAYER)
node = loadGroupLayer(element, image, name, colorSpace, opacity);
else if (nodeType == ADJUSTMENT_LAYER)
node = loadAdjustmentLayer(element, image, name, colorSpace, opacity);
else if (nodeType == SHAPE_LAYER)
node = loadShapeLayer(element, image, name, colorSpace, opacity);
else if (nodeType == GENERATOR_LAYER)
node = loadGeneratorLayer(element, image, name, colorSpace, opacity);
else if (nodeType == CLONE_LAYER)
node = loadCloneLayer(element, image, name, colorSpace, opacity);
else if (nodeType == FILTER_MASK)
node = loadFilterMask(element, parent);
else if (nodeType == TRANSFORM_MASK)
node = loadTransformMask(element, parent);
else if (nodeType == TRANSPARENCY_MASK)
node = loadTransparencyMask(element, parent);
else if (nodeType == SELECTION_MASK)
node = loadSelectionMask(image, element, parent);
else if (nodeType == COLORIZE_MASK)
node = loadColorizeMask(image, element, parent, colorSpace);
else if (nodeType == FILE_LAYER) {
node = loadFileLayer(element, image, name, opacity);
}
else {
m_d->warningMessages << i18n("Layer %1 has an unsupported type: %2.", name, nodeType);
return 0;
}
// Loading the node went wrong. Return empty node and leave to
// upstream to complain to the user
if (!node) {
m_d->warningMessages << i18n("Failure loading layer %1 of type: %2.", name, nodeType);
return 0;
}
node->setVisible(visible, true);
node->setUserLocked(locked);
node->setCollapsed(collapsed);
node->setColorLabelIndex(colorLabelIndex);
node->setX(x);
node->setY(y);
node->setName(name);
if (! id.isNull()) // if no uuid in file, new one has been generated already
node->setUuid(id);
if (node->inherits("KisLayer") || node->inherits("KisColorizeMask")) {
QString compositeOpName = element.attribute(COMPOSITE_OP, "normal");
node->setCompositeOpId(compositeOpName);
}
if (node->inherits("KisLayer")) {
KisLayer* layer = qobject_cast<KisLayer*>(node.data());
QBitArray channelFlags = stringToFlags(element.attribute(CHANNEL_FLAGS, ""), colorSpace->channelCount());
layer->setChannelFlags(channelFlags);
if (element.hasAttribute(LAYER_STYLE_UUID)) {
QString uuidString = element.attribute(LAYER_STYLE_UUID);
QUuid uuid(uuidString);
if (!uuid.isNull()) {
KisPSDLayerStyleSP dumbLayerStyle(new KisPSDLayerStyle());
dumbLayerStyle->setUuid(uuid);
layer->setLayerStyle(dumbLayerStyle);
} else {
warnKrita << "WARNING: Layer style for layer" << layer->name() << "contains invalid UUID" << uuidString;
}
}
}
if (node->inherits("KisGroupLayer")) {
if (element.hasAttribute(PASS_THROUGH_MODE)) {
bool value = element.attribute(PASS_THROUGH_MODE, "0") != "0";
KisGroupLayer *group = qobject_cast<KisGroupLayer*>(node.data());
group->setPassThroughMode(value);
}
}
if (node->inherits("KisPaintLayer")) {
KisPaintLayer* layer = qobject_cast<KisPaintLayer*>(node.data());
QBitArray channelLockFlags = stringToFlags(element.attribute(CHANNEL_LOCK_FLAGS, ""), colorSpace->channelCount());
layer->setChannelLockFlags(channelLockFlags);
bool onionEnabled = element.attribute(ONION_SKIN_ENABLED, "0") == "0" ? false : true;
layer->setOnionSkinEnabled(onionEnabled);
bool timelineEnabled = element.attribute(VISIBLE_IN_TIMELINE, "0") == "0" ? false : true;
layer->setUseInTimeline(timelineEnabled);
}
if (element.attribute(FILE_NAME).isNull()) {
m_d->layerFilenames[node.data()] = name;
}
else {
m_d->layerFilenames[node.data()] = element.attribute(FILE_NAME);
}
if (element.hasAttribute("selected") && element.attribute("selected") == "true") {
m_d->selectedNodes.append(node);
}
if (element.hasAttribute(KEYFRAME_FILE)) {
m_d->keyframeFilenames.insert(node.data(), element.attribute(KEYFRAME_FILE));
}
return node;
}
KisNodeSP KisKraLoader::loadPaintLayer(const KoXmlElement& element, KisImageSP image,
const QString& name, const KoColorSpace* cs, quint32 opacity)
{
Q_UNUSED(element);
KisPaintLayer* layer;
layer = new KisPaintLayer(image, name, opacity, cs);
Q_CHECK_PTR(layer);
return layer;
}
KisNodeSP KisKraLoader::loadFileLayer(const KoXmlElement& element, KisImageSP image, const QString& name, quint32 opacity)
{
QString filename = element.attribute("source", QString());
if (filename.isNull()) return 0;
bool scale = (element.attribute("scale", "true") == "true");
int scalingMethod = element.attribute("scalingmethod", "-1").toInt();
if (scalingMethod < 0) {
if (scale) {
scalingMethod = KisFileLayer::ToImagePPI;
}
else {
scalingMethod = KisFileLayer::None;
}
}
QString documentPath;
if (m_d->document) {
documentPath = m_d->document->url().toLocalFile();
}
QFileInfo info(documentPath);
QString basePath = info.absolutePath();
QString fullPath = basePath + QDir::separator() + filename;
// Entering the event loop to show the messagebox will delete the image, so up the ref by one
image->ref();
if (!QFileInfo(fullPath).exists()) {
qApp->setOverrideCursor(Qt::ArrowCursor);
QString msg = i18nc(
"@info",
"The file associated to a file layer with the name \"%1\" is not found.\n\n"
"Expected path:\n"
"%2\n\n"
"Do you want to locate it manually?", name, fullPath);
int result = QMessageBox::warning(0, i18nc("@title:window", "File not found"), msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (result == QMessageBox::Yes) {
KoFileDialog dialog(0, KoFileDialog::OpenFile, "OpenDocument");
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setDefaultDir(basePath);
QString url = dialog.filename();
if (!QFileInfo(basePath).exists()) {
filename = url;
} else {
QDir d(basePath);
filename = d.relativeFilePath(url);
}
}
qApp->restoreOverrideCursor();
}
KisLayer *layer = new KisFileLayer(image, basePath, filename, (KisFileLayer::ScalingMethod)scalingMethod, name, opacity);
Q_CHECK_PTR(layer);
return layer;
}
KisNodeSP KisKraLoader::loadGroupLayer(const KoXmlElement& element, KisImageSP image,
const QString& name, const KoColorSpace* cs, quint32 opacity)
{
Q_UNUSED(element);
Q_UNUSED(cs);
QString attr;
KisGroupLayer* layer;
layer = new KisGroupLayer(image, name, opacity);
Q_CHECK_PTR(layer);
return layer;
}
KisNodeSP KisKraLoader::loadAdjustmentLayer(const KoXmlElement& element, KisImageSP image,
const QString& name, const KoColorSpace* cs, quint32 opacity)
{
// XXX: do something with filterversion?
Q_UNUSED(cs);
QString attr;
KisAdjustmentLayer* layer;
QString filtername;
if ((filtername = element.attribute(FILTER_NAME)).isNull()) {
// XXX: Invalid adjustmentlayer! We should warn about it!
warnFile << "No filter in adjustment layer";
return 0;
}
KisFilterSP f = KisFilterRegistry::instance()->value(filtername);
if (!f) {
warnFile << "No filter for filtername" << filtername << "";
return 0; // XXX: We don't have this filter. We should warn about it!
}
KisFilterConfigurationSP kfc = f->defaultConfiguration();
// We'll load the configuration and the selection later.
layer = new KisAdjustmentLayer(image, name, kfc, 0);
Q_CHECK_PTR(layer);
layer->setOpacity(opacity);
return layer;
}
KisNodeSP KisKraLoader::loadShapeLayer(const KoXmlElement& element, KisImageSP image,
const QString& name, const KoColorSpace* cs, quint32 opacity)
{
Q_UNUSED(element);
Q_UNUSED(cs);
QString attr;
KoShapeBasedDocumentBase * shapeController = 0;
if (m_d->document) {
shapeController = m_d->document->shapeController();
}
KisShapeLayer* layer = new KisShapeLayer(shapeController, image, name, opacity);
Q_CHECK_PTR(layer);
return layer;
}
KisNodeSP KisKraLoader::loadGeneratorLayer(const KoXmlElement& element, KisImageSP image,
const QString& name, const KoColorSpace* cs, quint32 opacity)
{
Q_UNUSED(cs);
// XXX: do something with generator version?
KisGeneratorLayer* layer;
QString generatorname = element.attribute(GENERATOR_NAME);
if (generatorname.isNull()) {
// XXX: Invalid generator layer! We should warn about it!
warnFile << "No generator in generator layer";
return 0;
}
KisGeneratorSP generator = KisGeneratorRegistry::instance()->value(generatorname);
if (!generator) {
warnFile << "No generator for generatorname" << generatorname << "";
return 0; // XXX: We don't have this generator. We should warn about it!
}
KisFilterConfigurationSP kgc = generator->defaultConfiguration();
// We'll load the configuration and the selection later.
layer = new KisGeneratorLayer(image, name, kgc, 0);
Q_CHECK_PTR(layer);
layer->setOpacity(opacity);
return layer;
}
KisNodeSP KisKraLoader::loadCloneLayer(const KoXmlElement& element, KisImageSP image,
const QString& name, const KoColorSpace* cs, quint32 opacity)
{
Q_UNUSED(cs);
KisCloneLayerSP layer = new KisCloneLayer(0, image, name, opacity);
KisCloneInfo info;
if (! (element.attribute(CLONE_FROM_UUID)).isNull()) {
info = KisCloneInfo(QUuid(element.attribute(CLONE_FROM_UUID)));
} else {
if ((element.attribute(CLONE_FROM)).isNull()) {
return 0;
} else {
info = KisCloneInfo(element.attribute(CLONE_FROM));
}
}
layer->setCopyFromInfo(info);
if ((element.attribute(CLONE_TYPE)).isNull()) {
return 0;
} else {
layer->setCopyType((CopyLayerType) element.attribute(CLONE_TYPE).toInt());
}
return layer;
}
KisNodeSP KisKraLoader::loadFilterMask(const KoXmlElement& element, KisNodeSP parent)
{
Q_UNUSED(parent);
QString attr;
KisFilterMask* mask;
QString filtername;
// XXX: should we check the version?
if ((filtername = element.attribute(FILTER_NAME)).isNull()) {
// XXX: Invalid filter layer! We should warn about it!
warnFile << "No filter in filter layer";
return 0;
}
KisFilterSP f = KisFilterRegistry::instance()->value(filtername);
if (!f) {
warnFile << "No filter for filtername" << filtername << "";
return 0; // XXX: We don't have this filter. We should warn about it!
}
KisFilterConfigurationSP kfc = f->defaultConfiguration();
// We'll load the configuration and the selection later.
mask = new KisFilterMask();
mask->setFilter(kfc);
Q_CHECK_PTR(mask);
return mask;
}
KisNodeSP KisKraLoader::loadTransformMask(const KoXmlElement& element, KisNodeSP parent)
{
Q_UNUSED(element);
Q_UNUSED(parent);
KisTransformMask* mask;
/**
* We'll load the transform configuration later on a stage
* of binary data loading
*/
mask = new KisTransformMask();
Q_CHECK_PTR(mask);
return mask;
}
KisNodeSP KisKraLoader::loadTransparencyMask(const KoXmlElement& element, KisNodeSP parent)
{
Q_UNUSED(element);
Q_UNUSED(parent);
KisTransparencyMask* mask = new KisTransparencyMask();
Q_CHECK_PTR(mask);
return mask;
}
KisNodeSP KisKraLoader::loadSelectionMask(KisImageSP image, const KoXmlElement& element, KisNodeSP parent)
{
Q_UNUSED(parent);
KisSelectionMaskSP mask = new KisSelectionMask(image);
bool active = element.attribute(ACTIVE, "1") == "0" ? false : true;
mask->setActive(active);
Q_CHECK_PTR(mask);
return mask;
}
KisNodeSP KisKraLoader::loadColorizeMask(KisImageSP image, const KoXmlElement& element, KisNodeSP parent, const KoColorSpace *colorSpace)
{
Q_UNUSED(parent);
KisColorizeMaskSP mask = new KisColorizeMask();
bool editKeystrokes = element.attribute(COLORIZE_EDIT_KEYSTROKES, "1") == "0" ? false : true;
bool showColoring = element.attribute(COLORIZE_SHOW_COLORING, "1") == "0" ? false : true;
KisLayerPropertiesIcons::setNodeProperty(mask, KisLayerPropertiesIcons::colorizeEditKeyStrokes, editKeystrokes, image);
KisLayerPropertiesIcons::setNodeProperty(mask, KisLayerPropertiesIcons::colorizeShowColoring, showColoring, image);
delete mask->setColorSpace(colorSpace);
mask->setImage(image);
return mask;
}
void KisKraLoader::loadCompositions(const KoXmlElement& elem, KisImageSP image)
{
KoXmlNode child;
for (child = elem.firstChild(); !child.isNull(); child = child.nextSibling()) {
KoXmlElement e = child.toElement();
QString name = e.attribute("name");
bool exportEnabled = e.attribute("exportEnabled", "1") == "0" ? false : true;
KisLayerCompositionSP composition(new KisLayerComposition(image, name));
composition->setExportEnabled(exportEnabled);
KoXmlNode value;
for (value = child.lastChild(); !value.isNull(); value = value.previousSibling()) {
KoXmlElement e = value.toElement();
QUuid uuid(e.attribute("uuid"));
bool visible = e.attribute("visible", "1") == "0" ? false : true;
composition->setVisible(uuid, visible);
bool collapsed = e.attribute("collapsed", "1") == "0" ? false : true;
composition->setCollapsed(uuid, collapsed);
}
image->addComposition(composition);
}
}
void KisKraLoader::loadAssistantsList(const KoXmlElement &elem)
{
KoXmlNode child;
int count = 0;
for (child = elem.firstChild(); !child.isNull(); child = child.nextSibling()) {
KoXmlElement e = child.toElement();
QString type = e.attribute("type");
QString file_name = e.attribute("filename");
m_d->assistantsFilenames.insert(file_name,type);
count++;
}
}
void KisKraLoader::loadGrid(const KoXmlElement& elem)
{
QDomDocument dom;
KoXml::asQDomElement(dom, elem);
QDomElement domElement = dom.firstChildElement();
KisGridConfig config;
config.loadDynamicDataFromXml(domElement);
config.loadStaticData();
m_d->document->setGridConfig(config);
}
void KisKraLoader::loadGuides(const KoXmlElement& elem)
{
QDomDocument dom;
KoXml::asQDomElement(dom, elem);
QDomElement domElement = dom.firstChildElement();
KisGuidesConfig guides;
guides.loadFromXml(domElement);
m_d->document->setGuidesConfig(guides);
}
void KisKraLoader::loadAudio(const KoXmlElement& elem, KisImageSP image)
{
QDomDocument dom;
KoXml::asQDomElement(dom, elem);
QDomElement qElement = dom.firstChildElement();
QString fileName;
if (KisDomUtils::loadValue(qElement, "masterChannelPath", &fileName)) {
fileName = QDir::toNativeSeparators(fileName);
QDir baseDirectory = QFileInfo(m_d->document->localFilePath()).absoluteDir();
fileName = baseDirectory.absoluteFilePath(fileName);
QFileInfo info(fileName);
if (!info.exists()) {
qApp->setOverrideCursor(Qt::ArrowCursor);
QString msg = i18nc(
"@info",
"Audio channel file \"%1\" doesn't exist!\n\n"
"Expected path:\n"
"%2\n\n"
"Do you want to locate it manually?", info.fileName(), info.absoluteFilePath());
int result = QMessageBox::warning(0, i18nc("@title:window", "File not found"), msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (result == QMessageBox::Yes) {
info.setFile(KisImportExportManager::askForAudioFileName(info.absolutePath(), 0));
}
qApp->restoreOverrideCursor();
}
if (info.exists()) {
image->animationInterface()->setAudioChannelFileName(info.absoluteFilePath());
}
}
bool audioMuted = false;
if (KisDomUtils::loadValue(qElement, "audioMuted", &audioMuted)) {
image->animationInterface()->setAudioMuted(audioMuted);
}
qreal audioVolume = 0.5;
if (KisDomUtils::loadValue(qElement, "audioVolume", &audioVolume)) {
image->animationInterface()->setAudioVolume(audioVolume);
}
}
diff --git a/plugins/impex/libkra/kis_kra_save_visitor.h b/plugins/impex/libkra/kis_kra_save_visitor.h
index 93163722aa..587066d663 100644
--- a/plugins/impex/libkra/kis_kra_save_visitor.h
+++ b/plugins/impex/libkra/kis_kra_save_visitor.h
@@ -1,99 +1,99 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_KRA_SAVE_VISITOR_H_
#define KIS_KRA_SAVE_VISITOR_H_
#include <QRect>
#include <QStringList>
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kis_image.h"
#include "kritalibkra_export.h"
class KisPaintDeviceWriter;
class KoStore;
class KRITALIBKRA_EXPORT KisKraSaveVisitor : public KisNodeVisitor
{
public:
KisKraSaveVisitor(KoStore *store, const QString & name, QMap<const KisNode*, QString> nodeFileNames);
- virtual ~KisKraSaveVisitor();
+ ~KisKraSaveVisitor() override;
using KisNodeVisitor::visit;
public:
void setExternalUri(const QString &uri);
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisExternalLayer *);
+ bool visit(KisExternalLayer *) override;
- bool visit(KisPaintLayer *layer);
+ bool visit(KisPaintLayer *layer) override;
- bool visit(KisGroupLayer *layer);
+ bool visit(KisGroupLayer *layer) override;
- bool visit(KisAdjustmentLayer* layer);
+ bool visit(KisAdjustmentLayer* layer) override;
- bool visit(KisGeneratorLayer * layer);
+ bool visit(KisGeneratorLayer * layer) override;
- bool visit(KisCloneLayer *layer);
+ bool visit(KisCloneLayer *layer) override;
- bool visit(KisFilterMask *mask);
+ bool visit(KisFilterMask *mask) override;
- bool visit(KisTransformMask *mask);
+ bool visit(KisTransformMask *mask) override;
- bool visit(KisTransparencyMask *mask);
+ bool visit(KisTransparencyMask *mask) override;
- bool visit(KisSelectionMask *mask);
+ bool visit(KisSelectionMask *mask) override;
- bool visit(KisColorizeMask *mask);
+ bool visit(KisColorizeMask *mask) override;
/// @return a list with everything that went wrong while saving
QStringList errorMessages() const;
private:
bool savePaintDevice(KisPaintDeviceSP device, QString location);
template<class DevicePolicy>
bool savePaintDeviceFrame(KisPaintDeviceSP device, QString location, DevicePolicy policy);
bool saveAnnotations(KisLayer* layer);
bool saveSelection(KisNode* node);
bool saveFilterConfiguration(KisNode* node);
bool saveMetaData(KisNode* node);
QString getLocation(KisNode* node, const QString& suffix = QString());
QString getLocation(const QString &filename, const QString &suffix = QString());
private:
KoStore *m_store;
bool m_external;
QString m_uri;
QString m_name;
QMap<const KisNode*, QString> m_nodeFileNames;
KisPaintDeviceWriter *m_writer;
QStringList m_errorMessages;
};
#endif // KIS_KRA_SAVE_VISITOR_H_
diff --git a/plugins/impex/libkra/kis_kra_savexml_visitor.h b/plugins/impex/libkra/kis_kra_savexml_visitor.h
index 4bb3272c5e..40bfaa2aaf 100644
--- a/plugins/impex/libkra/kis_kra_savexml_visitor.h
+++ b/plugins/impex/libkra/kis_kra_savexml_visitor.h
@@ -1,96 +1,96 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_KRA_SAVEXML_VISITOR_H_
#define KIS_KRA_SAVEXML_VISITOR_H_
#include <QDomDocument>
#include <QDomElement>
#include <QStringList>
#include "kis_node_visitor.h"
#include "kis_types.h"
#include "kritalibkra_export.h"
class KRITALIBKRA_EXPORT KisSaveXmlVisitor : public KisNodeVisitor
{
public:
KisSaveXmlVisitor(QDomDocument doc, const QDomElement & element, quint32 &count, const QString &url, bool root);
void setSelectedNodes(vKisNodeSP selectedNodes);
using KisNodeVisitor::visit;
QStringList errorMessages() const;
public:
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisExternalLayer *);
- bool visit(KisPaintLayer *layer);
- bool visit(KisGroupLayer *layer);
- bool visit(KisAdjustmentLayer* layer);
- bool visit(KisGeneratorLayer *layer);
- bool visit(KisCloneLayer *layer);
- bool visit(KisFilterMask *mask);
- bool visit(KisTransformMask *mask);
- bool visit(KisTransparencyMask *mask);
- bool visit(KisSelectionMask *mask);
- bool visit(KisColorizeMask *mask);
+ bool visit(KisExternalLayer *) override;
+ bool visit(KisPaintLayer *layer) override;
+ bool visit(KisGroupLayer *layer) override;
+ bool visit(KisAdjustmentLayer* layer) override;
+ bool visit(KisGeneratorLayer *layer) override;
+ bool visit(KisCloneLayer *layer) override;
+ bool visit(KisFilterMask *mask) override;
+ bool visit(KisTransformMask *mask) override;
+ bool visit(KisTransparencyMask *mask) override;
+ bool visit(KisSelectionMask *mask) override;
+ bool visit(KisColorizeMask *mask) override;
QMap<const KisNode*, QString> nodeFileNames() {
return m_nodeFileNames;
}
QMap<const KisNode*, QString> keyframeFileNames() {
return m_keyframeFileNames;
}
public:
QDomElement savePaintLayerAttributes(KisPaintLayer *layer, QDomDocument &doc);
// used by EXR to save properties of Krita layers inside .exr
static void loadPaintLayerAttributes(const QDomElement &el, KisPaintLayer *layer);
private:
static void loadLayerAttributes(const QDomElement &el, KisLayer *layer);
private:
void saveLayer(QDomElement & el, const QString & layerType, const KisLayer * layer);
void saveMask(QDomElement & el, const QString & maskType, const KisMaskSP mask);
bool saveMasks(KisNode * node, QDomElement & layerElement);
void saveNodeKeyframes(const KisNode *node, QString filename, QDomElement& el);
friend class KisKraSaveXmlVisitorTest;
vKisNodeSP m_selectedNodes;
QMap<const KisNode*, QString> m_nodeFileNames;
QMap<const KisNode*, QString> m_keyframeFileNames;
QDomDocument m_doc;
QDomElement m_elem;
quint32 &m_count;
QString m_url;
bool m_root;
QStringList m_errorMessages;
};
#endif
diff --git a/plugins/impex/odg/kis_odg_import.h b/plugins/impex/odg/kis_odg_import.h
index 90a1b98291..f4d43ac3b4 100644
--- a/plugins/impex/odg/kis_odg_import.h
+++ b/plugins/impex/odg/kis_odg_import.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2010 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ODG_IMPORT_H_
#define _KIS_ODG_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisODGImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisODGImport(QObject *parent, const QVariantList &);
- virtual ~KisODGImport();
+ ~KisODGImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/ora/kis_open_raster_stack_save_visitor.h b/plugins/impex/ora/kis_open_raster_stack_save_visitor.h
index 530c28a03f..a2f2ea2a42 100644
--- a/plugins/impex/ora/kis_open_raster_stack_save_visitor.h
+++ b/plugins/impex/ora/kis_open_raster_stack_save_visitor.h
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_OPEN_RASTER_STACK_SAVE_VISITOR_H_
#define KIS_OPEN_RASTER_STACK_SAVE_VISITOR_H_
#include <QSet>
#include "kis_global.h"
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kis_layer.h"
class KisOpenRasterSaveContext;
class KisAdjustmentLayer;
class KisGroupLayer;
class KisPaintLayer;
class KisGeneratorLayer;
class QDomElement;
class KisOpenRasterStackSaveVisitor : public KisNodeVisitor
{
public:
KisOpenRasterStackSaveVisitor(KisOpenRasterSaveContext*, vKisNodeSP activeNodes);
- virtual ~KisOpenRasterStackSaveVisitor();
+ ~KisOpenRasterStackSaveVisitor() override;
using KisNodeVisitor::visit;
public:
- bool visit(KisPaintLayer *layer);
- bool visit(KisGroupLayer *layer);
- bool visit(KisAdjustmentLayer *layer);
- bool visit(KisGeneratorLayer * layer);
+ bool visit(KisPaintLayer *layer) override;
+ bool visit(KisGroupLayer *layer) override;
+ bool visit(KisAdjustmentLayer *layer) override;
+ bool visit(KisGeneratorLayer * layer) override;
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisCloneLayer*);
+ bool visit(KisCloneLayer*) override;
- bool visit(KisFilterMask*) {
+ bool visit(KisFilterMask*) override {
return true;
}
- bool visit(KisTransformMask*) {
+ bool visit(KisTransformMask*) override {
return true;
}
- bool visit(KisTransparencyMask*) {
+ bool visit(KisTransparencyMask*) override {
return true;
}
- bool visit(KisSelectionMask*) {
+ bool visit(KisSelectionMask*) override {
return true;
}
- bool visit(KisColorizeMask*) {
+ bool visit(KisColorizeMask*) override {
return true;
}
- bool visit(KisExternalLayer*);
+ bool visit(KisExternalLayer*) override;
private:
bool saveLayer(KisLayer *layer);
void saveLayerInfo(QDomElement& elt, KisLayer* layer);
struct Private;
Private* const d;
};
#endif // KIS_LAYER_VISITOR_H_
diff --git a/plugins/impex/ora/ora_converter.h b/plugins/impex/ora/ora_converter.h
index e86599129d..33f8c12d8c 100644
--- a/plugins/impex/ora/ora_converter.h
+++ b/plugins/impex/ora/ora_converter.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ORA_CONVERTER_H_
#define _ORA_CONVERTER_H_
#include <stdio.h>
#include <QObject>
#include "kis_png_converter.h"
#include "kis_types.h"
class KisDocument;
class OraConverter : public QObject
{
Q_OBJECT
public:
OraConverter(KisDocument *doc);
- virtual ~OraConverter();
+ ~OraConverter() override;
public:
KisImageBuilder_Result buildImage(QIODevice *io);
KisImageBuilder_Result buildFile(QIODevice *io, KisImageSP image, vKisNodeSP activeNodes);
/**
* Retrieve the constructed image
*/
KisImageSP image();
vKisNodeSP activeNodes();
public Q_SLOTS:
virtual void cancel();
private:
KisImageSP m_image;
KisDocument *m_doc;
vKisNodeSP m_activeNodes;
bool m_stop;
};
#endif
diff --git a/plugins/impex/ora/ora_export.h b/plugins/impex/ora/ora_export.h
index 1e15e46563..a3a614475c 100644
--- a/plugins/impex/ora/ora_export.h
+++ b/plugins/impex/ora/ora_export.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ORA_EXPORT_H_
#define _ORA_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class OraExport : public KisImportExportFilter
{
Q_OBJECT
public:
OraExport(QObject *parent, const QVariantList &);
- virtual ~OraExport();
+ ~OraExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/ora/ora_import.h b/plugins/impex/ora/ora_import.h
index ed27b63519..bc40596deb 100644
--- a/plugins/impex/ora/ora_import.h
+++ b/plugins/impex/ora/ora_import.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef ORA_IMPORT_H_
#define ORA_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class OraImport : public KisImportExportFilter
{
Q_OBJECT
public:
OraImport(QObject *parent, const QVariantList &);
- virtual ~OraImport();
+ ~OraImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/ora/ora_load_context.h b/plugins/impex/ora/ora_load_context.h
index fde5f7140c..a190c2c131 100644
--- a/plugins/impex/ora/ora_load_context.h
+++ b/plugins/impex/ora/ora_load_context.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ORA_LOAD_CONTEXT_H_
#define _ORA_LOAD_CONTEXT_H_
#include <kis_open_raster_load_context.h>
class KoStore;
class OraLoadContext : public KisOpenRasterLoadContext
{
public:
OraLoadContext(KoStore* _store);
- virtual ~OraLoadContext();
- virtual KisImageSP loadDeviceData(const QString & fileName);
- virtual QDomDocument loadStack();
+ ~OraLoadContext() override;
+ KisImageSP loadDeviceData(const QString & fileName) override;
+ QDomDocument loadStack() override;
private:
KoStore* m_store;
};
#endif
diff --git a/plugins/impex/ora/ora_save_context.h b/plugins/impex/ora/ora_save_context.h
index d7cd62b7cf..947ea9104b 100644
--- a/plugins/impex/ora/ora_save_context.h
+++ b/plugins/impex/ora/ora_save_context.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ORA_SAVE_CONTEXT_H_
#define _ORA_SAVE_CONTEXT_H_
class KoStore;
#include <metadata/kis_meta_data_entry.h>
#include "kis_open_raster_save_context.h"
class OraSaveContext : public KisOpenRasterSaveContext
{
public:
OraSaveContext(KoStore* _store);
- virtual ~OraSaveContext(){}
- virtual QString saveDeviceData(KisPaintDeviceSP dev, KisMetaData::Store *metaData, const QRect &imageRect, const qreal xRes, const qreal yRes);
- virtual void saveStack(const QDomDocument& doc);
+ ~OraSaveContext() override{}
+ QString saveDeviceData(KisPaintDeviceSP dev, KisMetaData::Store *metaData, const QRect &imageRect, const qreal xRes, const qreal yRes) override;
+ void saveStack(const QDomDocument& doc) override;
private:
int m_id;
KoStore* m_store;
};
#endif
diff --git a/plugins/impex/pdf/CMakeLists.txt b/plugins/impex/pdf/CMakeLists.txt
index 535c0f67fc..d3ada35792 100644
--- a/plugins/impex/pdf/CMakeLists.txt
+++ b/plugins/impex/pdf/CMakeLists.txt
@@ -1,12 +1,10 @@
-include_directories( ${POPPLER_INCLUDE_DIR} )
-
set(kritapdfimport_SOURCES kis_pdf_import.cpp kis_pdf_import_widget.cpp )
ki18n_wrap_ui(kritapdfimport_SOURCES pdfimportwidgetbase.ui )
add_library(kritapdfimport MODULE ${kritapdfimport_SOURCES})
-target_link_libraries(kritapdfimport kritaui ${POPPLER_LIBRARY} )
+target_link_libraries(kritapdfimport kritaui Poppler::Qt5)
install(TARGETS kritapdfimport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
install(PROGRAMS krita_pdf.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
diff --git a/plugins/impex/png/kis_png_export.h b/plugins/impex/png/kis_png_export.h
index ea32d8c544..0d13e6f2a9 100644
--- a/plugins/impex/png/kis_png_export.h
+++ b/plugins/impex/png/kis_png_export.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PNG_EXPORT_H_
#define _KIS_PNG_EXPORT_H_
#include "ui_kis_wdg_options_png.h"
#include <KisImportExportFilter.h>
#include <kis_config_widget.h>
class KisWdgOptionsPNG : public KisConfigWidget, public Ui::KisWdgOptionsPNG
{
Q_OBJECT
public:
KisWdgOptionsPNG(QWidget *parent)
: KisConfigWidget(parent)
{
setupUi(this);
}
- void setConfiguration(const KisPropertiesConfigurationSP config);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
+ KisPropertiesConfigurationSP configuration() const override;
private Q_SLOTS:
void on_alpha_toggled(bool checked);
};
class KisPNGExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisPNGExport(QObject *parent, const QVariantList &);
- virtual ~KisPNGExport();
+ ~KisPNGExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
- void initializeCapabilities();
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/png/kis_png_import.h b/plugins/impex/png/kis_png_import.h
index 1e04cef107..51d0ac7134 100644
--- a/plugins/impex/png/kis_png_import.h
+++ b/plugins/impex/png/kis_png_import.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PNG_IMPORT_H_
#define _KIS_PNG_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisPNGImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisPNGImport(QObject *parent, const QVariantList &);
- virtual ~KisPNGImport();
+ ~KisPNGImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/ppm/kis_ppm_export.h b/plugins/impex/ppm/kis_ppm_export.h
index 010061659f..7689305acb 100644
--- a/plugins/impex/ppm/kis_ppm_export.h
+++ b/plugins/impex/ppm/kis_ppm_export.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PPM_EXPORT_H_
#define _KIS_PPM_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
#include <kis_config_widget.h>
#include "ui_kis_wdg_options_ppm.h"
class KisWdgOptionsPPM : public KisConfigWidget, public Ui::WdgOptionsPPM
{
Q_OBJECT
public:
KisWdgOptionsPPM(QWidget *parent)
: KisConfigWidget(parent)
{
setupUi(this);
}
- void setConfiguration(const KisPropertiesConfigurationSP cfg);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP cfg) override;
+ KisPropertiesConfigurationSP configuration() const override;
};
class KisPPMExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisPPMExport(QObject *parent, const QVariantList &);
- virtual ~KisPPMExport();
+ ~KisPPMExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/ppm/kis_ppm_import.h b/plugins/impex/ppm/kis_ppm_import.h
index c3796712c5..f3921fece6 100644
--- a/plugins/impex/ppm/kis_ppm_import.h
+++ b/plugins/impex/ppm/kis_ppm_import.h
@@ -1,40 +1,40 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_PPM_IMPORT_H_
#define _KIS_PPM_IMPORT_H_
#include <QVariant>
#include <QIODevice>
#include <KisImportExportFilter.h>
class KisDocument;
class KisPPMImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisPPMImport(QObject *parent, const QVariantList &);
- virtual ~KisPPMImport();
+ ~KisPPMImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/psd/psd_export.h b/plugins/impex/psd/psd_export.h
index 2a368771de..0d66e19571 100644
--- a/plugins/impex/psd/psd_export.h
+++ b/plugins/impex/psd/psd_export.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PSD_EXPORT_H_
#define _PSD_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class psdExport : public KisImportExportFilter {
Q_OBJECT
public:
psdExport(QObject *parent, const QVariantList &);
- virtual ~psdExport();
+ ~psdExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/psd/psd_import.h b/plugins/impex/psd/psd_import.h
index 88766f5175..a522c7d5a0 100644
--- a/plugins/impex/psd/psd_import.h
+++ b/plugins/impex/psd/psd_import.h
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PSD_IMPORT_H_
#define PSD_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class psdImport : public KisImportExportFilter {
Q_OBJECT
public:
psdImport(QObject *parent, const QVariantList &);
- virtual ~psdImport();
+ ~psdImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/psd/psd_layer_record.cpp b/plugins/impex/psd/psd_layer_record.cpp
index c503f9c855..e04539e7af 100644
--- a/plugins/impex/psd/psd_layer_record.cpp
+++ b/plugins/impex/psd/psd_layer_record.cpp
@@ -1,776 +1,777 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "psd_layer_record.h"
#include <QtEndian>
#include <QIODevice>
#include <QBuffer>
#include <QDataStream>
#include <QStringList>
#include <KoColor.h>
#include <kis_debug.h>
#include <kis_node.h>
#include "kis_iterator_ng.h"
#include <kis_paint_layer.h>
#include "psd_utils.h"
#include "psd_header.h"
#include "compression.h"
#include <KoColorSpace.h>
#include <KoColorSpaceMaths.h>
#include <KoColorSpaceTraits.h>
#include <KoColorSpaceRegistry.h>
#include <asl/kis_offset_keeper.h>
#include <asl/kis_asl_writer_utils.h>
#include <asl/kis_asl_reader_utils.h>
#include "psd_pixel_utils.h"
+#include <kundo2command.h>
// Just for pretty debug messages
QString channelIdToChannelType(int channelId, psd_color_mode colormode)
{
switch(channelId) {
case -3:
return "Real User Supplied Layer Mask (when both a user mask and a vector mask are present";
case -2:
return "User Supplied Layer Mask";
case -1:
return "Transparency mask";
case 0:
switch(colormode) {
case Bitmap:
case Indexed:
return QString("bitmap or indexed: %1").arg(channelId);
case Grayscale:
case Gray16:
return "gray";
case RGB:
case RGB48:
return "red";
case Lab:
case Lab48:
return "L";
case CMYK:
case CMYK64:
return "cyan";
case MultiChannel:
case DeepMultichannel:
return QString("multichannel channel %1").arg(channelId);
case DuoTone:
case Duotone16:
return QString("duotone channel %1").arg(channelId);
default:
return QString("unknown: %1").arg(channelId);
};
case 1:
switch(colormode) {
case Bitmap:
case Indexed:
return QString("WARNING bitmap or indexed: %1").arg(channelId);
case Grayscale:
case Gray16:
return QString("WARNING: %1").arg(channelId);
case RGB:
case RGB48:
return "green";
case Lab:
case Lab48:
return "a";
case CMYK:
case CMYK64:
return "Magenta";
case MultiChannel:
case DeepMultichannel:
return QString("multichannel channel %1").arg(channelId);
case DuoTone:
case Duotone16:
return QString("duotone channel %1").arg(channelId);
default:
return QString("unknown: %1").arg(channelId);
};
case 2:
switch(colormode) {
case Bitmap:
case Indexed:
return QString("WARNING bitmap or indexed: %1").arg(channelId);
case Grayscale:
case Gray16:
return QString("WARNING: %1").arg(channelId);
case RGB:
case RGB48:
return "blue";
case Lab:
case Lab48:
return "b";
case CMYK:
case CMYK64:
return "yellow";
case MultiChannel:
case DeepMultichannel:
return QString("multichannel channel %1").arg(channelId);
case DuoTone:
case Duotone16:
return QString("duotone channel %1").arg(channelId);
default:
return QString("unknown: %1").arg(channelId);
};
case 3:
switch(colormode) {
case Bitmap:
case Indexed:
return QString("WARNING bitmap or indexed: %1").arg(channelId);
case Grayscale:
case Gray16:
return QString("WARNING: %1").arg(channelId);
case RGB:
case RGB48:
return QString("alpha: %1").arg(channelId);
case Lab:
case Lab48:
return QString("alpha: %1").arg(channelId);
case CMYK:
case CMYK64:
return "Key";
case MultiChannel:
case DeepMultichannel:
return QString("multichannel channel %1").arg(channelId);
case DuoTone:
case Duotone16:
return QString("duotone channel %1").arg(channelId);
default:
return QString("unknown: %1").arg(channelId);
};
default:
return QString("unknown: %1").arg(channelId);
};
}
PSDLayerRecord::PSDLayerRecord(const PSDHeader& header)
: top(0)
, left(0)
, bottom(0)
, right(0)
, nChannels(0)
, opacity(0)
, clipping(0)
, transparencyProtected(false)
, visible(true)
, irrelevant(false)
, layerName("UNINITIALIZED")
, infoBlocks(header)
, m_transparencyMaskSizeOffset(0)
, m_header(header)
{
}
bool PSDLayerRecord::read(QIODevice* io)
{
dbgFile << "Going to read layer record. Pos:" << io->pos();
if (!psdread(io, &top) ||
!psdread(io, &left) ||
!psdread(io, &bottom) ||
!psdread(io, &right) ||
!psdread(io, &nChannels)) {
error = "could not read layer record";
return false;
}
dbgFile << "\ttop" << top << "left" << left << "bottom" << bottom << "right" << right << "number of channels" << nChannels;
Q_ASSERT(top <= bottom);
Q_ASSERT(left <= right);
Q_ASSERT(nChannels > 0);
switch(m_header.colormode) {
case(Bitmap):
case(Indexed):
case(DuoTone):
case(Grayscale):
case(MultiChannel):
if (nChannels < 1) {
error = QString("Not enough channels. Got: %1").arg(nChannels);
return false;
}
break;
case(RGB):
case(CMYK):
case(Lab):
default:
if (nChannels < 3) {
error = QString("Not enough channels. Got: %1").arg(nChannels);
return false;
}
break;
};
if (nChannels > MAX_CHANNELS) {
error = QString("Too many channels. Got: %1").arg(nChannels);
return false;
}
for (int i = 0; i < nChannels; ++i) {
if (io->atEnd()) {
error = "Could not read enough data for channels";
return false;
}
ChannelInfo* info = new ChannelInfo;
if (!psdread(io, &info->channelId)) {
error = "could not read channel id";
delete info;
return false;
}
bool r;
if (m_header.version == 1) {
quint32 channelDataLength;
r = psdread(io, &channelDataLength);
info->channelDataLength = (quint64)channelDataLength;
}
else {
r = psdread(io, &info->channelDataLength);
}
if (!r) {
error = "Could not read length for channel data";
delete info;
return false;
}
dbgFile << "\tchannel" << i << "id"
<< channelIdToChannelType(info->channelId, m_header.colormode)
<< "length" << info->channelDataLength
<< "start" << info->channelDataStart
<< "offset" << info->channelOffset
<< "channelInfoPosition" << info->channelInfoPosition;
channelInfoRecords << info;
}
if (!psd_read_blendmode(io, blendModeKey)) {
error = QString("Could not read blend mode key. Got: %1").arg(blendModeKey);
return false;
}
dbgFile << "\tBlend mode" << blendModeKey << "pos" << io->pos();
if (!psdread(io, &opacity)) {
error = "Could not read opacity";
return false;
}
dbgFile << "\tOpacity" << opacity << io->pos();
if (!psdread(io, &clipping)) {
error = "Could not read clipping";
return false;
}
dbgFile << "\tclipping" << clipping << io->pos();
quint8 flags;
if (!psdread(io, &flags)) {
error = "Could not read flags";
return false;
}
dbgFile << "\tflags" << flags << io->pos();
transparencyProtected = flags & 1 ? true : false;
dbgFile << "\ttransparency protected" << transparencyProtected;
visible = flags & 2 ? false : true;
dbgFile << "\tvisible" << visible;
if (flags & 8) {
irrelevant = flags & 16 ? true : false;
}
else {
irrelevant = false;
}
dbgFile << "\tirrelevant" << irrelevant;
dbgFile << "\tfiller at " << io->pos();
quint8 filler;
if (!psdread(io, &filler) || filler != 0) {
error = "Could not read padding";
return false;
}
dbgFile << "\tGoing to read extra data length" << io->pos();
quint32 extraDataLength;
if (!psdread(io, &extraDataLength) || io->bytesAvailable() < extraDataLength) {
error = QString("Could not read extra layer data: %1 at pos %2").arg(extraDataLength).arg(io->pos());
return false;
}
dbgFile << "\tExtra data length" << extraDataLength;
if (extraDataLength > 0) {
dbgFile << "Going to read extra data field. Bytes available: "
<< io->bytesAvailable()
<< "pos" << io->pos();
quint32 layerMaskLength = 1; // invalid...
if (!psdread(io, &layerMaskLength) ||
io->bytesAvailable() < layerMaskLength ||
!(layerMaskLength == 0 || layerMaskLength == 20 || layerMaskLength == 36)) {
error = QString("Could not read layer mask length: %1").arg(layerMaskLength);
return false;
}
memset(&layerMask, 0, sizeof(LayerMaskData));
if (layerMaskLength == 20 || layerMaskLength == 36) {
if (!psdread(io, &layerMask.top) ||
!psdread(io, &layerMask.left) ||
!psdread(io, &layerMask.bottom) ||
!psdread(io, &layerMask.right) ||
!psdread(io, &layerMask.defaultColor) ||
!psdread(io, &flags)) {
error = "could not read mask record";
return false;
}
}
if (layerMaskLength == 20) {
quint16 padding;
if (!psdread(io, &padding)) {
error = "Could not read layer mask padding";
return false;
}
}
if (layerMaskLength == 36 ) {
if (!psdread(io, &flags) ||
!psdread(io, &layerMask.defaultColor) ||
!psdread(io, &layerMask.top) ||
!psdread(io, &layerMask.left) ||
!psdread(io, &layerMask.bottom) ||
!psdread(io, &layerMask.top)) {
error = "could not read 'real' mask record";
return false;
}
}
layerMask.positionedRelativeToLayer = flags & 1 ? true : false;
layerMask.disabled = flags & 2 ? true : false;
layerMask.invertLayerMaskWhenBlending = flags & 4 ? true : false;
dbgFile << "\tRead layer mask/adjustment layer data. Length of block:"
<< layerMaskLength << "pos" << io->pos();
// layer blending thingies
quint32 blendingDataLength;
if (!psdread(io, &blendingDataLength) || io->bytesAvailable() < blendingDataLength) {
error = "Could not read extra blending data.";
return false;
}
//dbgFile << "blending block data length" << blendingDataLength << ", pos" << io->pos();
blendingRanges.data = io->read(blendingDataLength);
if ((quint32)blendingRanges.data.size() != blendingDataLength) {
error = QString("Got %1 bytes for the blending range block, needed %2").arg(blendingRanges.data.size(), blendingDataLength);
}
/*
// XXX: reading this block correctly failed, I have more channel ranges than I'd expected.
if (!psdread(io, &blendingRanges.blackValues[0]) ||
!psdread(io, &blendingRanges.blackValues[1]) ||
!psdread(io, &blendingRanges.whiteValues[0]) ||
!psdread(io, &blendingRanges.whiteValues[1]) ||
!psdread(io, &blendingRanges.compositeGrayBlendDestinationRange)) {
error = "Could not read blending black/white values";
return false;
}
for (int i = 0; i < nChannels; ++i) {
quint32 src;
quint32 dst;
if (!psdread(io, &src) || !psdread(io, &dst)) {
error = QString("could not read src/dst range for channel %1").arg(i);
return false;
}
dbgFile << "\tread range " << src << "to" << dst << "for channel" << i;
blendingRanges.sourceDestinationRanges << QPair<quint32, quint32>(src, dst);
}
*/
dbgFile << "\tGoing to read layer name at" << io->pos();
quint8 layerNameLength;
if (!psdread(io, &layerNameLength)) {
error = "Could not read layer name length";
return false;
}
dbgFile << "\tlayer name length unpadded" << layerNameLength << "pos" << io->pos();
layerNameLength = ((layerNameLength + 1 + 3) & ~0x03) - 1;
dbgFile << "\tlayer name length padded" << layerNameLength << "pos" << io->pos();
layerName = io->read(layerNameLength);
dbgFile << "\tlayer name" << layerName << io->pos();
if (!infoBlocks.read(io)) {
error = infoBlocks.error;
return false;
}
if (infoBlocks.keys.contains("luni") && !infoBlocks.unicodeLayerName.isEmpty()) {
layerName = infoBlocks.unicodeLayerName;
}
}
return valid();
}
void PSDLayerRecord::write(QIODevice* io,
KisPaintDeviceSP layerContentDevice,
KisNodeSP onlyTransparencyMask,
const QRect &maskRect,
psd_section_type sectionType,
const QDomDocument &stylesXmlDoc)
{
dbgFile << "writing layer info record" << "at" << io->pos();
m_layerContentDevice = layerContentDevice;
m_onlyTransparencyMask = onlyTransparencyMask;
m_onlyTransparencyMaskRect = maskRect;
dbgFile << "saving layer record for " << layerName << "at pos" << io->pos();
dbgFile << "\ttop" << top << "left" << left << "bottom" << bottom << "right" << right << "number of channels" << nChannels;
Q_ASSERT(left <= right);
Q_ASSERT(top <= bottom);
Q_ASSERT(nChannels > 0);
try {
const QRect layerRect(left, top, right - left, bottom - top);
KisAslWriterUtils::writeRect(layerRect, io);
{
quint16 realNumberOfChannels = nChannels + bool(m_onlyTransparencyMask);
SAFE_WRITE_EX(io, realNumberOfChannels);
}
Q_FOREACH (ChannelInfo *channel, channelInfoRecords) {
SAFE_WRITE_EX(io, (quint16)channel->channelId);
channel->channelInfoPosition = io->pos();
// to be filled in when we know how big channel block is
const quint32 fakeChannelSize = 0;
SAFE_WRITE_EX(io, fakeChannelSize);
}
if (m_onlyTransparencyMask) {
const quint16 userSuppliedMaskChannelId = -2;
SAFE_WRITE_EX(io, userSuppliedMaskChannelId);
m_transparencyMaskSizeOffset = io->pos();
const quint32 fakeTransparencyMaskSize = 0;
SAFE_WRITE_EX(io, fakeTransparencyMaskSize);
}
// blend mode
dbgFile << ppVar(blendModeKey) << ppVar(io->pos());
KisAslWriterUtils::writeFixedString("8BIM", io);
KisAslWriterUtils::writeFixedString(blendModeKey, io);
SAFE_WRITE_EX(io, opacity);
SAFE_WRITE_EX(io, clipping); // unused
// visibility and protection
quint8 flags = 0;
if (transparencyProtected) flags |= 1;
if (!visible) flags |= 2;
if (irrelevant) {
flags |= (1 << 3) | (1 << 4);
}
SAFE_WRITE_EX(io, flags);
{
quint8 padding = 0;
SAFE_WRITE_EX(io, padding);
}
{
// extra fields with their own length tag
KisAslWriterUtils::OffsetStreamPusher<quint32> extraDataSizeTag(io);
if (m_onlyTransparencyMask) {
{
const quint32 layerMaskDataSize = 20; // support simple case only
SAFE_WRITE_EX(io, layerMaskDataSize);
}
KisAslWriterUtils::writeRect(m_onlyTransparencyMaskRect, io);
{
// NOTE: in PSD the default color of the mask is stored in 1 byte value!
// Even when the mask is actually 16/32 bit! I have no idea how it is
// actually treated in this case.
KIS_ASSERT_RECOVER_NOOP(m_onlyTransparencyMask->paintDevice()->pixelSize() == 1);
const quint8 defaultPixel = *m_onlyTransparencyMask->paintDevice()->defaultPixel().data();
SAFE_WRITE_EX(io, defaultPixel);
}
{
const quint8 maskFlags = 0; // nothing serious
SAFE_WRITE_EX(io, maskFlags);
const quint16 padding = 0; // 2-byte padding
SAFE_WRITE_EX(io, padding);
}
} else {
const quint32 nullLayerMaskDataSize = 0;
SAFE_WRITE_EX(io, nullLayerMaskDataSize);
}
{
// blending ranges are not implemented yet
const quint32 nullBlendingRangesSize = 0;
SAFE_WRITE_EX(io, nullBlendingRangesSize);
}
// layer name: Pascal string, padded to a multiple of 4 bytes.
psdwrite_pascalstring(io, layerName, 4);
PsdAdditionalLayerInfoBlock additionalInfoBlock(m_header);
// write 'luni' data block
additionalInfoBlock.writeLuniBlockEx(io, layerName);
// write 'lsct' data block
if (sectionType != psd_other) {
additionalInfoBlock.writeLsctBlockEx(io, sectionType, isPassThrough, blendModeKey);
}
// write 'lfx2' data block
if (!stylesXmlDoc.isNull()) {
additionalInfoBlock.writeLfx2BlockEx(io, stylesXmlDoc);
}
}
} catch (KisAslWriterUtils::ASLWriteException &e) {
throw KisAslWriterUtils::ASLWriteException(PREPEND_METHOD(e.what()));
}
}
KisPaintDeviceSP PSDLayerRecord::convertMaskDeviceIfNeeded(KisPaintDeviceSP dev)
{
KisPaintDeviceSP result = dev;
if (m_header.channelDepth == 16) {
result = new KisPaintDevice(*dev);
delete result->convertTo(KoColorSpaceRegistry::instance()->alpha16());
} else if (m_header.channelDepth == 32) {
result = new KisPaintDevice(*dev);
delete result->convertTo(KoColorSpaceRegistry::instance()->alpha32f());
}
return result;
}
void PSDLayerRecord::writeTransparencyMaskPixelData(QIODevice *io)
{
if (m_onlyTransparencyMask) {
KisPaintDeviceSP device = convertMaskDeviceIfNeeded(m_onlyTransparencyMask->paintDevice());
QByteArray buffer(device->pixelSize() * m_onlyTransparencyMaskRect.width() * m_onlyTransparencyMaskRect.height(), 0);
device->readBytes((quint8*)buffer.data(), m_onlyTransparencyMaskRect);
PsdPixelUtils::writeChannelDataRLE(io, (quint8*)buffer.data(), device->pixelSize(), m_onlyTransparencyMaskRect, m_transparencyMaskSizeOffset, -1, true);
}
}
void PSDLayerRecord::writePixelData(QIODevice *io)
{
try {
writePixelDataImpl(io);
} catch (KisAslWriterUtils::ASLWriteException &e) {
throw KisAslWriterUtils::ASLWriteException(PREPEND_METHOD(e.what()));
}
}
void PSDLayerRecord::writePixelDataImpl(QIODevice *io)
{
dbgFile << "writing pixel data for layer" << layerName << "at" << io->pos();
KisPaintDeviceSP dev = m_layerContentDevice;
const QRect rc(left, top, right - left, bottom - top);
if (rc.isEmpty()) {
dbgFile << "Layer is empty! Writing placeholder information.";
for (int i = 0; i < nChannels; i++) {
const ChannelInfo *channelInfo = channelInfoRecords[i];
KisAslWriterUtils::OffsetStreamPusher<quint32> channelBlockSizeExternalTag(io, 0, channelInfo->channelInfoPosition);
SAFE_WRITE_EX(io, (quint16)Compression::Uncompressed);
}
writeTransparencyMaskPixelData(io);
return;
}
// now write all the channels in display order
dbgFile << "layer" << layerName;
const int channelSize = m_header.channelDepth / 8;
const psd_color_mode colorMode = m_header.colormode;
QVector<PsdPixelUtils::ChannelWritingInfo> writingInfoList;
Q_FOREACH (const ChannelInfo *channelInfo, channelInfoRecords) {
writingInfoList <<
PsdPixelUtils::ChannelWritingInfo(channelInfo->channelId,
channelInfo->channelInfoPosition);
}
PsdPixelUtils::writePixelDataCommon(io, dev, rc, colorMode, channelSize, true, true, writingInfoList);
writeTransparencyMaskPixelData(io);
}
bool PSDLayerRecord::valid()
{
// XXX: check validity!
return true;
}
bool PSDLayerRecord::readPixelData(QIODevice *io, KisPaintDeviceSP device)
{
dbgFile << "Reading pixel data for layer" << layerName << "pos" << io->pos();
const int channelSize = m_header.channelDepth / 8;
const QRect layerRect = QRect(left,
top,
right - left,
bottom - top);
try {
PsdPixelUtils::readChannels(io, device, m_header.colormode, channelSize, layerRect, channelInfoRecords);
} catch (KisAslReaderUtils::ASLParseException &e) {
device->clear();
error = e.what();
return false;
}
return true;
}
QRect PSDLayerRecord::channelRect(ChannelInfo *channel) const
{
QRect result;
if (channel->channelId < -1) {
result = QRect(layerMask.left,
layerMask.top,
layerMask.right - layerMask.left,
layerMask.bottom - layerMask.top);
} else {
result = QRect(left,
top,
right - left,
bottom - top);
}
return result;
}
bool PSDLayerRecord::readMask(QIODevice *io, KisPaintDeviceSP dev, ChannelInfo *channelInfo)
{
KIS_ASSERT_RECOVER(channelInfo->channelId < -1) { return false; }
dbgFile << "Going to read" << channelIdToChannelType(channelInfo->channelId, m_header.colormode) << "mask";
QRect maskRect = channelRect(channelInfo);
if (maskRect.isEmpty()) {
dbgFile << "Empty Channel";
return true;
}
// the device must be a pixel selection
KIS_ASSERT_RECOVER(dev->pixelSize() == 1) { return false; }
dev->setDefaultPixel(KoColor(&layerMask.defaultColor, dev->colorSpace()));
const int pixelSize =
m_header.channelDepth == 16 ? 2 :
m_header.channelDepth == 32 ? 4 : 1;
QVector<ChannelInfo*> infoRecords;
infoRecords << channelInfo;
PsdPixelUtils::readAlphaMaskChannels(io, dev, pixelSize, maskRect, infoRecords);
return true;
}
QDebug operator<<(QDebug dbg, const PSDLayerRecord &layer)
{
#ifndef NODEBUG
dbg.nospace() << "valid: " << const_cast<PSDLayerRecord*>(&layer)->valid();
dbg.nospace() << ", name: " << layer.layerName;
dbg.nospace() << ", top: " << layer.top;
dbg.nospace() << ", left:" << layer.left;
dbg.nospace() << ", bottom: " << layer.bottom;
dbg.nospace() << ", right: " << layer.right;
dbg.nospace() << ", number of channels: " << layer.nChannels;
dbg.nospace() << ", blendModeKey: " << layer.blendModeKey;
dbg.nospace() << ", opacity: " << layer.opacity;
dbg.nospace() << ", clipping: " << layer.clipping;
dbg.nospace() << ", transparency protected: " << layer.transparencyProtected;
dbg.nospace() << ", visible: " << layer.visible;
dbg.nospace() << ", irrelevant: " << layer.irrelevant << "\n";
Q_FOREACH (const ChannelInfo* channel, layer.channelInfoRecords) {
dbg.space() << channel;
}
#endif
return dbg.nospace();
}
QDebug operator<<(QDebug dbg, const ChannelInfo &channel)
{
#ifndef NODEBUG
dbg.nospace() << "\tChannel type" << channel.channelId
<< "size: " << channel.channelDataLength
<< "compression type" << channel.compressionType << "\n";
#endif
return dbg.nospace();
}
diff --git a/plugins/impex/psd/psd_loader.h b/plugins/impex/psd/psd_loader.h
index 0b587a5f43..0618f803f5 100644
--- a/plugins/impex/psd/psd_loader.h
+++ b/plugins/impex/psd/psd_loader.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PSD_LOADER_H_
#define _PSD_LOADER_H_
#include <stdio.h>
#include <QObject>
#include <QFileInfo>
#include "kis_types.h"
#include <KisImageBuilderResult.h>
class KisDocument;
class PSDLoader : public QObject {
Q_OBJECT
public:
PSDLoader(KisDocument *doc);
- virtual ~PSDLoader();
+ ~PSDLoader() override;
KisImageBuilder_Result buildImage(QIODevice *io);
KisImageSP image();
public Q_SLOTS:
virtual void cancel();
private:
KisImageBuilder_Result decode(QIODevice *io);
private:
KisImageSP m_image;
KisDocument *m_doc;
bool m_stop;
};
#endif
diff --git a/plugins/impex/psd/psd_resource_block.h b/plugins/impex/psd/psd_resource_block.h
index 00eb574ab1..af4838c1dc 100644
--- a/plugins/impex/psd/psd_resource_block.h
+++ b/plugins/impex/psd/psd_resource_block.h
@@ -1,761 +1,761 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PSD_RESOURCE_BLOCK_H
#define PSD_RESOURCE_BLOCK_H
class QIODevice;
#include <klocalizedstring.h>
#include <kis_debug.h>
#include <QString>
#include <QBuffer>
#include <kis_annotation.h>
#include <kis_debug.h>
#include "psd.h"
#include "psd_utils.h"
#include "psd_resource_section.h"
/**
* @brief The PSDResourceInterpreter struct interprets the data in a psd resource block
*/
class PSDInterpretedResource
{
public:
virtual ~PSDInterpretedResource() {}
virtual bool interpretBlock(QByteArray /*data*/) { return true; }
virtual bool createBlock(QByteArray & /*data*/) { return true; }
virtual bool valid() { return true; }
virtual QString displayText() { return QString(); }
QString error;
protected:
void startBlock(QBuffer &buf, PSDImageResourceSection::PSDResourceID id, quint32 size) {
if (!buf.isOpen()) {
buf.open(QBuffer::WriteOnly);
}
buf.write("8BIM", 4);
psdwrite(&buf, (quint16)id);
psdwrite(&buf, (quint16)0); // We simply never save out the name, for now
psdwrite(&buf, (quint32)size);
}
};
/**
* Contains the unparsed contents of the image resource blocks
*/
class PSDResourceBlock : public KisAnnotation
{
public:
PSDResourceBlock();
- ~PSDResourceBlock()
+ ~PSDResourceBlock() override
{
delete resource;
}
KisAnnotation* clone() const Q_DECL_OVERRIDE {
// HACK ALERT: we are evil! use notmal copying instead!
PSDResourceBlock *copied = new PSDResourceBlock();
QBuffer buffer;
write(&buffer);
copied->read(&buffer);
return copied;
}
- QString displayText() const {
+ QString displayText() const override {
if (resource) {
return resource->displayText();
}
return i18n("Unparsed Resource Block");
}
bool read(QIODevice* io);
bool write(QIODevice* io) const;
bool valid();
quint16 identifier;
QString name;
quint32 dataSize;
QByteArray data;
PSDInterpretedResource *resource;
mutable QString error;
};
/* 0x03e9 - Optional - Mac print manager print info record */
struct MAC_PRINT_INFO_1001 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading MAC_PRINT_INFO_1001";
return true;
}
};
/* 0x03ed - ResolutionInfo structure */
struct RESN_INFO_1005 : public PSDInterpretedResource
{
// XXX: Krita only uses INCH internally
enum PSDUnit {
PSD_UNIT_INCH = 1, /* inches */
PSD_UNIT_CM = 2, /* cm */
PSD_UNIT_POINT = 3, /* points (72 points = 1 inch) */
PSD_UNIT_PICA = 4, /* pica ( 6 pica = 1 inch) */
PSD_UNIT_COLUMN = 5 /* columns ( column defined in ps prefs, default = 2.5 inches) */
};
RESN_INFO_1005()
: hRes(300)
, hResUnit(PSD_UNIT_INCH)
, widthUnit(PSD_UNIT_INCH)
, vRes(300)
, vResUnit(PSD_UNIT_INCH)
, heightUnit(PSD_UNIT_INCH)
{}
- virtual bool interpretBlock(QByteArray data);
- virtual bool createBlock(QByteArray & data);
+ bool interpretBlock(QByteArray data) override;
+ bool createBlock(QByteArray & data) override;
Fixed hRes;
quint16 hResUnit;
quint16 widthUnit;
Fixed vRes;
quint16 vResUnit;
quint16 heightUnit;
};
/* 0x03ee - Alpha channel names */
struct ALPHA_NAMES_1006 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading ALPHA_NAMES_1006";
return true;
}
};
/* 0x03ef - DisplayInfo structure */
struct DISPLAY_INFO_1007 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading DISPLAY_INFO_1007";
return true;
}
};
/* 0x03f0 - Optional - Caption string */
struct CAPTION_1008 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading CAPTION_1008";
return true;
}
};
/* 0x03f1 - Border info */
struct BORDER_INFO_1009 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading BORDER_INFO_1009";
return true;
}
};
/* 0x03f2 - Background colour */
struct BACKGROUND_COL_1010 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading BACKGROUND_COL_1010";
return true;
}
};
/* 0x03f3 - Print flags */
struct PRINT_FLAGS_1011 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading PRINT_FLAGS_1011";
return true;
}
};
/* 0x03f4 - Greyscale and multichannel halftoning info */
struct GREY_HALFTONE_1012 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading GREY_HALFTONE_1012";
return true;
}
};
/* 0x03f5 - Colour halftoning info */
struct COLOR_HALFTONE_1013 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading COLOR_HALFTONE_1013";
return true;
}
};
/* 0x03f6 - Duotone halftoning info */
struct DUOTONE_HALFTONE_1014 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading DUOTONE_HALFTONE_1014";
return true;
}
};
/* 0x03f7 - Greyscale and multichannel transfer functions */
struct GREY_XFER_1015 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading GREY_XFER_1015";
return true;
}
};
/* 0x03f8 - Colour transfer functions */
struct COLOR_XFER_1016 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading COLOR_XFER_1016";
return true;
}
};
/* 0x03f9 - Duotone transfer functions */
struct DUOTONE_XFER_1017 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading DUOTONE_XFER_1017";
return true;
}
};
/* 0x03fa - Duotone image information */
struct DUOTONE_INFO_1018 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading DUOTONE_INFO_1018";
return true;
}
};
/* 0x03fb - Effective black & white values for dot range */
struct EFFECTIVE_BW_1019 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading EFFECTIVE_BW_1019";
return true;
}
};
/* 0x03fd - EPS options */
struct EPS_OPT_1021 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading EPS_OPT_1021";
return true;
}
};
/* 0x03fe - Quick mask info */
struct QUICK_MASK_1022 : public PSDInterpretedResource
-{ bool interpretBlock(QByteArray /*data*/)
+{ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading QUICK_MASK_1022";
return true;
}
};
/* 0x0400 - Layer state info */
struct LAYER_STATE_1024 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading LAYER_STATE_1024";
return true;
}
};
/* 0x0401 - Working path (not saved) */
struct WORKING_PATH_1025 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading WORKING_PATH_1025";
return true;
}
};
/* 0x0402 - Layers group info */
struct LAYER_GROUP_1026 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading LAYER_GROUP_1026";
return true;
}
};
/* 0x0404 - IPTC-NAA record (IMV4.pdf) */
struct IPTC_NAA_DATA_1028 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading IPTC_NAA_DATA_1028";
return true;
}
};
/* 0x0405 - Image mode for raw format files */
struct IMAGE_MODE_RAW_1029 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading IMAGE_MODE_RAW_1029";
return true;
}
};
/* 0x0406 - JPEG quality */
struct JPEG_QUAL_1030 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading JPEG_QUAL_1030";
return true;
}
};
/* 0x0408 - Grid & guide info */
struct GRID_GUIDE_1032 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading GRID_GUIDE_1032";
return true;
}
};
/* 0x0409 - Thumbnail resource */
struct THUMB_RES_1033 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading THUMB_RES_1033";
return true;
}
};
/* 0x040a - Copyright flag */
struct COPYRIGHT_FLG_1034 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading COPYRIGHT_FLG_1034";
return true;
}
};
/* 0x040b - URL string */
struct URL_1035 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading URL_1035";
return true;
}
};
/* 0x040c - Thumbnail resource */
struct THUMB_RES2_1036 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading THUMB_RES2_1036";
return true;
}
};
/* 0x040d - Global angle */
struct GLOBAL_ANGLE_1037 : public PSDInterpretedResource
{
GLOBAL_ANGLE_1037()
: angle(30)
{}
- bool interpretBlock(QByteArray data)
+ bool interpretBlock(QByteArray data) override
{
dbgFile << "Reading GLOBAL_ANGLE_1037";
QDataStream ds(data);
ds.setByteOrder(QDataStream::BigEndian);
ds >> angle;
return true;
}
- virtual bool createBlock(QByteArray & data)
+ bool createBlock(QByteArray & data) override
{
QBuffer buf(&data);
startBlock(buf, PSDImageResourceSection::GLOBAL_ANGLE, 4);
psdwrite(&buf, (quint32)angle);
return true;
}
- virtual bool valid() { return true; }
+ bool valid() override { return true; }
- virtual QString displayText() { return QString("Global Angle: %1").arg(angle); }
+ QString displayText() override { return QString("Global Angle: %1").arg(angle); }
qint32 angle;
};
/* 0x040e - Colour samplers resource */
struct COLOR_SAMPLER_1038 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading COLOR_SAMPLER_1038";
return true;
}
};
/* 0x040f - ICC Profile */
struct ICC_PROFILE_1039 : public PSDInterpretedResource
{
- virtual bool interpretBlock(QByteArray data);
- virtual bool createBlock(QByteArray & data);
+ bool interpretBlock(QByteArray data) override;
+ bool createBlock(QByteArray & data) override;
QByteArray icc;
};
/* 0x0410 - Watermark */
struct WATERMARK_1040 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading WATERMARK_1040";
return true;
}
};
/* 0x0411 - Do not use ICC profile flag */
struct ICC_UNTAGGED_1041 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading ICC_UNTAGGED_1041";
return true;
}
};
/* 0x0412 - Show / hide all effects layers */
struct EFFECTS_VISIBLE_1042 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading EFFECTS_VISIBLE_1042";
return true;
}
};
/* 0x0413 - Spot halftone */
struct SPOT_HALFTONE_1043 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading SPOT_HALFTONE_1043";
return true;
}
};
/* 0x0414 - Document specific IDs */
struct DOC_IDS_1044 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading DOC_IDS_1044";
return true;
}
};
/* 0x0415 - Unicode alpha names */
struct ALPHA_NAMES_UNI_1045 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading ALPHA_NAMES_UNI_1045";
return true;
}
};
/* 0x0416 - Indexed colour table count */
struct IDX_COL_TAB_CNT_1046 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading IDX_COL_TAB_CNT_1046";
return true;
}
};
/* 0x0417 - Index of transparent colour (if any) */
struct IDX_TRANSPARENT_1047 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading IDX_TRANSPARENT_1047";
return true;
}
};
/* 0x0419 - Global altitude */
struct GLOBAL_ALT_1049 : public PSDInterpretedResource
{
GLOBAL_ALT_1049()
: altitude(30)
{}
- bool interpretBlock(QByteArray data)
+ bool interpretBlock(QByteArray data) override
{
dbgFile << "Reading GLOBAL_ALT_1049";
QDataStream ds(data);
ds.setByteOrder(QDataStream::BigEndian);
ds >> altitude;
return true;
}
- virtual bool createBlock(QByteArray & data)
+ bool createBlock(QByteArray & data) override
{
QBuffer buf(&data);
startBlock(buf, PSDImageResourceSection::GLOBAL_ALT, 4);
psdwrite(&buf, (quint32)altitude);
return true;
}
- virtual bool valid() { return true; }
+ bool valid() override { return true; }
- virtual QString displayText() { return QString("Global Altitude: %1").arg(altitude); }
+ QString displayText() override { return QString("Global Altitude: %1").arg(altitude); }
qint32 altitude;
};
/* 0x041a - Slices */
struct SLICES_1050 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading SLICES_1050";
return true;
}
};
/* 0x041b - Workflow URL - Unicode string */
struct WORKFLOW_URL_UNI_1051 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading WORKFLOW_URL_UNI_1051";
return true;
}
};
/* 0x041c - Jump to XPEP (?) */
struct JUMP_TO_XPEP_1052 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "JUMP_TO_XPEP_1052";
return true;
}
};
/* 0x041d - Alpha IDs */
struct ALPHA_ID_1053 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "ALPHA_ID_1053";
return true;
}
};
/* 0x041e - URL list - unicode */
struct URL_LIST_UNI_1054 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "URL_LIST_UNI_1054";
return true;
}
};
/* 0x0421 - Version info */
struct VERSION_INFO_1057 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "VERSION_INFO_1057";
return true;
}
};
/* 0x0422 - Exif data block */
struct EXIF_DATA_1058 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading EXIF_DATA_1058";
return true;
}
};
/* 0x0424 - XMP data block */
struct XMP_DATA_1060 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading XMP_DATA_1060";
return true;
}
};
/* 0x07d0 - First path info block */
struct PATH_INFO_FIRST_2000 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "PATH_INFO_FIRST_2000";
return true;
}
};
/* 0x0bb6 - Last path info block */
struct PATH_INFO_LAST_2998 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "PATH_INFO_LAST_2998";
return true;
}
};
/* 0x0bb7 - Name of clipping path */
struct CLIPPING_PATH_2999 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading CLIPPING_PATH_2999";
return true;
}
};
/* 0x2710 - Print flags */
struct PRINT_FLAGS_2_10000 : public PSDInterpretedResource
{
- bool interpretBlock(QByteArray /*data*/)
+ bool interpretBlock(QByteArray /*data*/) override
{
dbgFile << "Reading PRINT_FLAGS_2_10000";
return true;
}
};
#endif // PSD_RESOURCE_BLOCK_H
diff --git a/plugins/impex/psd/psd_saver.h b/plugins/impex/psd/psd_saver.h
index 15cceaab22..bf142d5128 100644
--- a/plugins/impex/psd/psd_saver.h
+++ b/plugins/impex/psd/psd_saver.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PSD_CONVERTER_H_
#define _PSD_CONVERTER_H_
#include <stdio.h>
#include <QObject>
#include <QFileInfo>
#include "kis_types.h"
#include <KisImageBuilderResult.h>
class KisDocument;
class PSDSaver : public QObject {
Q_OBJECT
public:
PSDSaver(KisDocument *doc);
- virtual ~PSDSaver();
+ ~PSDSaver() override;
public:
KisImageBuilder_Result buildFile(QIODevice *io);
KisImageSP image();
public Q_SLOTS:
virtual void cancel();
private:
KisImageSP m_image;
KisDocument *m_doc;
bool m_stop;
};
#endif
diff --git a/plugins/impex/qml/qml_converter.h b/plugins/impex/qml/qml_converter.h
index 32224a20aa..e70aa3e176 100644
--- a/plugins/impex/qml/qml_converter.h
+++ b/plugins/impex/qml/qml_converter.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _QML_CONVERTER_H_
#define _QML_CONVERTER_H_
#include <stdio.h>
#include <QObject>
#include <QFileInfo>
#include "kis_types.h"
#include <KisImageBuilderResult.h>
class QMLConverter : public QObject
{
Q_OBJECT
public:
QMLConverter();
- virtual ~QMLConverter();
+ ~QMLConverter() override;
public:
KisImageBuilder_Result buildFile(const QString &filename, const QString &realFilename, QIODevice *io, KisImageSP image);
private:
void writeString(QTextStream& out, int spacing, const QString& setting, const QString& value);
void writeInt(QTextStream& out, int spacing, const QString& setting, int value);
};
#endif
diff --git a/plugins/impex/qml/qml_export.h b/plugins/impex/qml/qml_export.h
index 3fddabd1f5..1cf9b0038d 100644
--- a/plugins/impex/qml/qml_export.h
+++ b/plugins/impex/qml/qml_export.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _QML_EXPORT_H_
#define _QML_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class QMLExport : public KisImportExportFilter
{
Q_OBJECT
public:
QMLExport(QObject *parent, const QVariantList &);
- virtual ~QMLExport();
+ ~QMLExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/dcrawsettingswidget.h b/plugins/impex/raw/3rdparty/libkdcraw/src/dcrawsettingswidget.h
index 31d5676907..1370cae405 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/dcrawsettingswidget.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/dcrawsettingswidget.h
@@ -1,126 +1,126 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2006-09-13
* @brief LibRaw settings widgets
*
* @author Copyright (C) 2006-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2011 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
* @author Copyright (C) 2007-2008 by Guillaume Castagnino
* <a href="mailto:casta at xwing dot info">casta at xwing dot info</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef DCRAW_SETTINGS_WIDGET_H
#define DCRAW_SETTINGS_WIDGET_H
// Qt includes
#include <QtCore/QString>
// KDE includes
#include <kconfiggroup.h>
// Local includes
#include "rawdecodingsettings.h"
#include "rexpanderbox.h"
#include "rwidgetutils.h"
namespace KDcrawIface
{
class DcrawSettingsWidget : public RExpanderBox
{
Q_OBJECT
public:
enum AdvancedSettingsOptions
{
SIXTEENBITS = 0x00000001,
COLORSPACE = 0x00000002,
POSTPROCESSING = 0x00000004,
BLACKWHITEPOINTS = 0x00000008
};
enum SettingsTabs
{
DEMOSAICING = 0,
WHITEBALANCE,
CORRECTIONS,
COLORMANAGEMENT
};
public:
/**
* @param advSettings the default value is COLORSPACE
*/
explicit DcrawSettingsWidget(QWidget* const parent, int advSettings = COLORSPACE);
- virtual ~DcrawSettingsWidget();
+ ~DcrawSettingsWidget() override;
RFileSelector* inputProfileUrlEdit() const;
RFileSelector* outputProfileUrlEdit() const;
void setup(int advSettings);
void setEnabledBrightnessSettings(bool b);
bool brightnessSettingsIsEnabled() const;
void updateMinimumWidth();
void resetToDefault();
void setSettings(const RawDecodingSettings& settings);
RawDecodingSettings settings() const;
- void readSettings(KConfigGroup& group);
- void writeSettings(KConfigGroup& group);
+ void readSettings(KConfigGroup& group) override;
+ void writeSettings(KConfigGroup& group) override;
Q_SIGNALS:
void signalSixteenBitsImageToggled(bool);
void signalSettingsChanged();
private Q_SLOTS:
void slotWhiteBalanceToggled(int);
void slotsixteenBitsImageToggled(bool);
void slotUnclipColorActivated(int);
void slotNoiseReductionChanged(int);
void slotCACorrectionToggled(bool);
void slotExposureCorrectionToggled(bool);
void slotAutoCAToggled(bool);
void slotInputColorSpaceChanged(int);
void slotOutputColorSpaceChanged(int);
void slotRAWQualityChanged(int);
void slotExpoCorrectionShiftChanged(double);
private:
class Private;
Private* const d;
};
} // NameSpace KDcrawIface
#endif /* DCRAW_SETTINGS_WIDGET_H */
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.h b/plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.h
index 4ff71d2ada..61f7471f5b 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/kdcraw.h
@@ -1,267 +1,267 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2006-12-09
* @brief a tread-safe libraw C++ program interface
*
* @author Copyright (C) 2006-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2013 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
* @author Copyright (C) 2007-2008 by Guillaume Castagnino
* <a href="mailto:casta at xwing dot info">casta at xwing dot info</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef KDCRAW_H
#define KDCRAW_H
// C++ includes
#include <cmath>
// Qt includes
#include <QtCore/QBuffer>
#include <QtCore/QString>
#include <QtCore/QObject>
#include <QtGui/QImage>
// Local includes
#include "rawdecodingsettings.h"
#include "dcrawinfocontainer.h"
/** @brief Main namespace of libKDcraw
*/
namespace KDcrawIface
{
class KDcraw : public QObject
{
Q_OBJECT
public:
/** Standard constructor.
*/
KDcraw();
/** Standard destructor.
*/
- virtual ~KDcraw();
+ ~KDcraw() override;
public:
/** Return a string version of libkdcraw release
*/
static QString version();
/** Get the preview of RAW picture as a QImage.
It tries loadEmbeddedPreview() first and if it fails, calls loadHalfPreview().
*/
static bool loadRawPreview(QImage& image, const QString& path);
/** Get the preview of RAW picture as a QByteArray holding JPEG data.
It tries loadEmbeddedPreview() first and if it fails, calls loadHalfPreview().
*/
static bool loadRawPreview(QByteArray& imgData, const QString& path);
/** Get the preview of RAW picture passed in QBuffer as a QByteArray holding JPEG data.
It tries loadEmbeddedPreview() first and if it fails, calls loadHalfPreview().
*/
static bool loadRawPreview(QByteArray& imgData, const QBuffer& inBuffer);
/** Get the embedded JPEG preview image from RAW picture as a QByteArray which will include Exif Data.
This is fast and non cancelable. This method does not require a class instance to run.
*/
static bool loadEmbeddedPreview(QByteArray& imgData, const QString& path);
/** Get the embedded JPEG preview image from RAW picture as a QImage. This is fast and non cancelable
This method does not require a class instance to run.
*/
static bool loadEmbeddedPreview(QImage& image, const QString& path);
/** Get the embedded JPEG preview image from RAW image passed in QBuffer as a QByteArray which will include Exif Data.
This is fast and non cancelable. This method does not require a class instance to run.
*/
static bool loadEmbeddedPreview(QByteArray& imgData, const QBuffer& inBuffer);
/** Get the half decoded RAW picture. This is slower than loadEmbeddedPreview() method
and non cancelable. This method does not require a class instance to run.
*/
static bool loadHalfPreview(QImage& image, const QString& path);
/** Get the half decoded RAW picture as JPEG data in QByteArray. This is slower than loadEmbeddedPreview()
method and non cancelable. This method does not require a class instance to run.
*/
static bool loadHalfPreview(QByteArray& imgData, const QString& path);
/** Get the half decoded RAW picture passed in QBuffer as JPEG data in QByteArray. This is slower than loadEmbeddedPreview()
method and non cancelable. This method does not require a class instance to run.
*/
static bool loadHalfPreview(QByteArray& imgData, const QBuffer& inBuffer);
/** Get the full decoded RAW picture. This is a more slower than loadHalfPreview() method
and non cancelable. This method does not require a class instance to run.
*/
static bool loadFullImage(QImage& image, const QString& path, const RawDecodingSettings& settings = RawDecodingSettings());
/** Get the camera settings witch have taken RAW file. Look into dcrawinfocontainer.h
for more details. This is a fast and non cancelable method witch do not require
a class instance to run.
*/
static bool rawFileIdentify(DcrawInfoContainer& identify, const QString& path);
/** Return the string of all RAW file type mime supported.
*/
static const char* rawFiles();
/** Return the list of all RAW file type mime supported,
as a QStringList, without wildcard and suffix dot.
*/
static QStringList rawFilesList();
/** Returns a version number for the list of supported RAW file types.
This version is incremented if the list of supported formats has changed
between library releases.
*/
static int rawFilesVersion();
/** Provide a list of supported RAW Camera name.
*/
static QStringList supportedCamera();
/** Return LibRaw version string.
*/
static QString librawVersion();
/** Return true or false if LibRaw use parallel demosaicing or not (libgomp support).
* Return -1 if undefined.
*/
static int librawUseGomp();
/** Return true or false if LibRaw use RawSpeed codec or not.
* Return -1 if undefined.
*/
static int librawUseRawSpeed();
/** Return true or false if LibRaw use Demosaic Pack GPL2 or not.
* Return -1 if undefined.
*/
static int librawUseGPL2DemosaicPack();
/** Return true or false if LibRaw use Demosaic Pack GPL3 or not.
* Return -1 if undefined.
*/
static int librawUseGPL3DemosaicPack();
public:
/** Extract Raw image data undemosaiced and without post processing from 'filePath' picture file.
This is a cancelable method which require a class instance to run because RAW pictures loading
can take a while.
This method return:
- A byte array container 'rawData' with raw data.
- All info about Raw image into 'identify' container.
- 'false' is returned if loadding failed, else 'true'.
*/
bool extractRAWData(const QString& filePath, QByteArray& rawData, DcrawInfoContainer& identify, unsigned int shotSelect=0);
/** Extract a small size of decode RAW data from 'filePath' picture file using
'rawDecodingSettings' settings. This is a cancelable method which require
a class instance to run because RAW pictures decoding can take a while.
This method return:
- A byte array container 'imageData' with picture data. Pixels order is RGB.
Color depth can be 8 or 16. In 8 bits you can access to color component
using (uchar*), in 16 bits using (ushort*).
- Size size of image in number of pixels ('width' and 'height').
- The max average of RGB components from decoded picture.
- 'false' is returned if decoding failed, else 'true'.
*/
bool decodeHalfRAWImage(const QString& filePath, const RawDecodingSettings& rawDecodingSettings,
QByteArray& imageData, int& width, int& height, int& rgbmax);
/** Extract a full size of RAW data from 'filePath' picture file using
'rawDecodingSettings' settings. This is a cancelable method which require
a class instance to run because RAW pictures decoding can take a while.
This method return:
- A byte array container 'imageData' with picture data. Pixels order is RGB.
Color depth can be 8 or 16. In 8 bits you can access to color component
using (uchar*), in 16 bits using (ushort*).
- Size size of image in number of pixels ('width' and 'height').
- The max average of RGB components from decoded picture.
- 'false' is returned if decoding failed, else 'true'.
*/
bool decodeRAWImage(const QString& filePath, const RawDecodingSettings& rawDecodingSettings,
QByteArray& imageData, int& width, int& height, int& rgbmax);
/** To cancel 'decodeHalfRAWImage' and 'decodeRAWImage' methods running
in a separate thread.
*/
void cancel();
protected:
/** Used internally to cancel RAW decoding operation. Normally, you don't need to use it
directly, excepted if you derivated this class. Usual way is to use cancel() method
*/
bool m_cancel;
/** The settings container used to perform RAW pictures decoding. See 'rawdecodingsetting.h'
for details.
*/
RawDecodingSettings m_rawDecodingSettings;
protected:
/** Re-implement this method to control the cancelisation of loop witch wait data
from RAW decoding process with your propers envirronement.
By default, this method check if m_cancel is true.
*/
virtual bool checkToCancelWaitingData();
/** Re-implement this method to control the pseudo progress value during RAW decoding (when dcraw run with an
internal loop without feedback) with your proper environment. By default, this method does nothing.
Progress value average for this stage is 0%-n%, with 'n' == 40% max (see setWaitingDataProgress() method).
*/
virtual void setWaitingDataProgress(double value);
public:
// Declared public to be called externally by callbackForLibRaw() static method.
class Private;
private:
Private* const d;
friend class Private;
};
} // namespace KDcrawIface
#endif /* KDCRAW_H */
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/ractionjob.h b/plugins/impex/raw/3rdparty/libkdcraw/src/ractionjob.h
index b047c09ce8..7dd60915c5 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/ractionjob.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/ractionjob.h
@@ -1,93 +1,93 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2014-15-11
* @brief QRunnable job extended with QObject features
*
* @author Copyright (C) 2011-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2014 by Veaceslav Munteanu
* <a href="mailto:veaceslav dot munteanu90 at gmail dot com">veaceslav dot munteanu90 at gmail dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef RACTIONJOB_H
#define RACTIONJOB_H
// Qt includes
#include <QObject>
#include <QRunnable>
// Local includes
namespace KDcrawIface
{
class RActionJob : public QObject,
public QRunnable
{
Q_OBJECT
public:
/** Constructor which delegate deletion of QRunnable instance to RActionThreadBase, not QThreadPool.
*/
RActionJob();
/** Re-implement destructor in you implementation. Don't forget to cancel job.
*/
- virtual ~RActionJob();
+ ~RActionJob() override;
Q_SIGNALS:
/** Use this signal in your implementation to inform RActionThreadBase manager that job is started
*/
void signalStarted();
/** Use this signal in your implementation to inform RActionThreadBase manager the job progress
*/
void signalProgress(int);
/** Use this signal in your implementation to inform RActionThreadBase manager the job is done.
*/
void signalDone();
public Q_SLOTS:
/** Call this method to cancel job.
*/
void cancel();
protected:
/** You can use this boolean in your implementation to know if job must be canceled.
*/
bool m_cancel;
};
/** Define a map of job/priority to process by RActionThreadBase manager.
* Priority value can be used to control the run queue's order of execution.
* Zero priority want mean to process job with higher priority.
*/
typedef QMap<RActionJob*, int> RJobCollection;
} // namespace KDcrawIface
#endif // RACTIONJOB_H
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/ractionthreadbase.h b/plugins/impex/raw/3rdparty/libkdcraw/src/ractionthreadbase.h
index 864a03a7c6..8f1f653615 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/ractionthreadbase.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/ractionthreadbase.h
@@ -1,98 +1,98 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2011-12-28
* @brief re-implementation of action thread using threadweaver
*
* @author Copyright (C) 2011-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2014 by Veaceslav Munteanu
* <a href="mailto:veaceslav dot munteanu90 at gmail dot com">veaceslav dot munteanu90 at gmail dot com</a>
* @author Copyright (C) 2011-2012 by A Janardhan Reddy
* <a href="annapareddyjanardhanreddy at gmail dot com">annapareddyjanardhanreddy at gmail dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef RACTION_THREAD_BASE_H
#define RACTION_THREAD_BASE_H
// Qt includes
#include <QtCore/QThread>
// Local includes
#include "ractionjob.h"
namespace KDcrawIface
{
class RActionThreadBase : public QThread
{
Q_OBJECT
public:
RActionThreadBase(QObject* const parent=0);
- virtual ~RActionThreadBase();
+ ~RActionThreadBase() override;
/** Adjust maximum number of threads used to parallelize collection of job processing.
*/
void setMaximumNumberOfThreads(int n);
/** Return the maximum number of threads used to parallelize collection of job processing.
*/
int maximumNumberOfThreads() const;
/** Reset maximum number of threads used to parallelize collection of job processing to max core detected on computer.
* This method is called in contructor.
*/
void defaultMaximumNumberOfThreads();
/** Cancel processing of current jobs under progress.
*/
void cancel();
protected:
/** Main thread loop used to process jobs in todo list.
*/
- void run();
+ void run() override;
/** Append a collection of jobs to process into QThreadPool.
* Jobs are add to pending lists and will be deleted by RActionThreadBase, not QThreadPool.
*/
void appendJobs(const RJobCollection& jobs);
/** Return true if list of pending jobs to process is empty.
*/
bool isEmpty() const;
protected Q_SLOTS:
void slotJobFinished();
private:
class Private;
Private* const d;
};
} // namespace KDcrawIface
#endif // RACTION_THREAD_BASE_H
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/rcombobox.h b/plugins/impex/raw/3rdparty/libkdcraw/src/rcombobox.h
index 77bb1cef4d..0dd29d2e3c 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/rcombobox.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/rcombobox.h
@@ -1,86 +1,86 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-08-16
* @brief a combo box widget re-implemented with a
* reset button to switch to a default item
*
* @author Copyright (C) 2008-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef RCOMBOBOX_H
#define RCOMBOBOX_H
// Qt includes
#include <QWidget>
#include <QComboBox>
// Local includes
namespace KDcrawIface
{
class RComboBox : public QWidget
{
Q_OBJECT
public:
RComboBox(QWidget* const parent=0);
- ~RComboBox();
+ ~RComboBox() override;
void setCurrentIndex(int d);
int currentIndex() const;
void setDefaultIndex(int d);
int defaultIndex() const;
QComboBox* combo() const;
void addItem(const QString& t, int index = -1);
void insertItem(int index, const QString& t);
Q_SIGNALS:
void reset();
void activated(int);
void currentIndexChanged(int);
public Q_SLOTS:
void slotReset();
private Q_SLOTS:
void slotItemActivated(int);
void slotCurrentIndexChanged(int);
private:
class Private;
Private* const d;
};
} // namespace KDcrawIface
#endif /* RCOMBOBOX_H */
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/rexpanderbox.h b/plugins/impex/raw/3rdparty/libkdcraw/src/rexpanderbox.h
index 32c468f00b..8cd0675b57 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/rexpanderbox.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/rexpanderbox.h
@@ -1,299 +1,299 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-03-14
* @brief A widget to host settings as expander box
*
* @author Copyright (C) 2008-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2008-2013 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
* @author Copyright (C) 2010 by Manuel Viet
* <a href="mailto:contact at 13zenrv dot fr">contact at 13zenrv dot fr</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef REXPANDERBOX_H
#define REXPANDERBOX_H
// Qt includes
#include <QObject>
#include <QPixmap>
#include <QLabel>
#include <QWidget>
#include <QScrollArea>
// KDE includes
#include <kconfiggroup.h>
// Local includes
#include "rwidgetutils.h"
namespace KDcrawIface
{
class RClickLabel : public QLabel
{
Q_OBJECT
public:
RClickLabel(QWidget* const parent = 0);
explicit RClickLabel(const QString& text, QWidget* const parent = 0);
- ~RClickLabel();
+ ~RClickLabel() override;
Q_SIGNALS:
/// Emitted when activated by left mouse click
void leftClicked();
/// Emitted when activated, by mouse or key press
void activated();
protected:
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
- virtual void keyPressEvent(QKeyEvent* event);
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
+ void keyPressEvent(QKeyEvent* event) override;
};
// -------------------------------------------------------------------------
class RSqueezedClickLabel : public RAdjustableLabel
{
Q_OBJECT
public:
RSqueezedClickLabel(QWidget* const parent = 0);
explicit RSqueezedClickLabel(const QString& text, QWidget* const parent = 0);
- ~RSqueezedClickLabel();
+ ~RSqueezedClickLabel() override;
Q_SIGNALS:
void leftClicked();
void activated();
protected:
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
- virtual void keyPressEvent(QKeyEvent* event);
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
+ void keyPressEvent(QKeyEvent* event) override;
};
// -------------------------------------------------------------------------
class RArrowClickLabel : public QWidget
{
Q_OBJECT
public:
RArrowClickLabel(QWidget* const parent = 0);
- ~RArrowClickLabel();
+ ~RArrowClickLabel() override;
void setArrowType(Qt::ArrowType arrowType);
Qt::ArrowType arrowType() const;
- virtual QSize sizeHint () const;
+ QSize sizeHint () const override;
Q_SIGNALS:
void leftClicked();
protected:
- virtual void mousePressEvent(QMouseEvent* event);
- virtual void mouseReleaseEvent(QMouseEvent* event);
- virtual void paintEvent(QPaintEvent* event);
+ void mousePressEvent(QMouseEvent* event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override;
+ void paintEvent(QPaintEvent* event) override;
protected:
Qt::ArrowType m_arrowType;
int m_size;
int m_margin;
};
// -------------------------------------------------------------------------
class RLabelExpander : public QWidget
{
Q_OBJECT
public:
RLabelExpander(QWidget* const parent = 0);
- ~RLabelExpander();
+ ~RLabelExpander() override;
void setCheckBoxVisible(bool b);
bool checkBoxIsVisible() const;
void setChecked(bool b);
bool isChecked() const;
void setLineVisible(bool b);
bool lineIsVisible() const;
void setText(const QString& txt);
QString text() const;
void setIcon(const QIcon &icon);
QIcon icon() const;
void setWidget(QWidget* const widget);
QWidget* widget() const;
void setExpanded(bool b);
bool isExpanded() const;
void setExpandByDefault(bool b);
bool isExpandByDefault() const;
Q_SIGNALS:
void signalExpanded(bool);
void signalToggled(bool);
private Q_SLOTS:
void slotToggleContainer();
private:
- bool eventFilter(QObject* obj, QEvent* ev);
+ bool eventFilter(QObject* obj, QEvent* ev) override;
private:
class Private;
Private* const d;
};
// -------------------------------------------------------------------------
class RExpanderBox : public QScrollArea
{
Q_OBJECT
public:
RExpanderBox(QWidget* const parent = 0);
- ~RExpanderBox();
+ ~RExpanderBox() override;
/** Add RLabelExpander item at end of box layout with these settings :
'w' : the widget hosted by RLabelExpander.
'pix' : pixmap used as icon to item title.
'txt' : text used as item title.
'objName' : item object name used to read/save expanded settings to rc file.
'expandBydefault' : item state by default (expanded or not).
*/
void addItem(QWidget* const w, const QIcon &icon, const QString& txt,
const QString& objName, bool expandBydefault);
void addItem(QWidget* const w, const QString& txt,
const QString& objName, bool expandBydefault);
/** Insert RLabelExpander item at box layout index with these settings :
'w' : the widget hosted by RLabelExpander.
'pix' : pixmap used as icon to item title.
'txt' : text used as item title.
'objName' : item object name used to read/save expanded settings to rc file.
'expandBydefault' : item state by default (expanded or not).
*/
void insertItem(int index, QWidget* const w, const QIcon &icon, const QString& txt,
const QString& objName, bool expandBydefault);
void insertItem(int index, QWidget* const w, const QString& txt,
const QString& objName, bool expandBydefault);
void removeItem(int index);
void setCheckBoxVisible(int index, bool b);
bool checkBoxIsVisible(int index) const;
void setChecked(int index, bool b);
bool isChecked(int index) const;
void setItemText(int index, const QString& txt);
QString itemText (int index) const;
void setItemIcon(int index, const QIcon &icon);
QIcon itemIcon(int index) const;
void setItemToolTip(int index, const QString& tip);
QString itemToolTip(int index) const;
void setItemEnabled(int index, bool enabled);
bool isItemEnabled(int index) const;
void addStretch();
void insertStretch(int index);
void setItemExpanded(int index, bool b);
bool isItemExpanded(int index) const;
int count() const;
RLabelExpander* widget(int index) const;
int indexOf(RLabelExpander* const widget) const;
virtual void readSettings(KConfigGroup& group);
virtual void writeSettings(KConfigGroup& group);
Q_SIGNALS:
void signalItemExpanded(int index, bool b);
void signalItemToggled(int index, bool b);
private Q_SLOTS:
void slotItemExpanded(bool b);
void slotItemToggled(bool b);
private:
class Private;
Private* const d;
};
// -------------------------------------------------------------------------
class RExpanderBoxExclusive : public RExpanderBox
{
Q_OBJECT
public:
RExpanderBoxExclusive(QWidget* const parent = 0);
- ~RExpanderBoxExclusive();
+ ~RExpanderBoxExclusive() override;
/** Show one expander open at most */
void setIsToolBox(bool b);
bool isToolBox() const;
private Q_SLOTS:
void slotItemExpanded(bool b);
private:
bool m_toolbox;
};
} // namespace KDcrawIface
#endif // REXPANDERBOX_H
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/rnuminput.h b/plugins/impex/raw/3rdparty/libkdcraw/src/rnuminput.h
index dfc3e9afab..cb18e58339 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/rnuminput.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/rnuminput.h
@@ -1,121 +1,121 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-08-16
* @brief Integer and double num input widget
* re-implemented with a reset button to switch to
* a default value
*
* @author Copyright (C) 2008-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef RNUMINPUT_H
#define RNUMINPUT_H
// Qt includes
#include <QWidget>
// Local includes
namespace KDcrawIface
{
class RIntNumInput : public QWidget
{
Q_OBJECT
public:
RIntNumInput(QWidget* const parent=0);
- ~RIntNumInput();
+ ~RIntNumInput() override;
void setRange(int min, int max, int step);
void setDefaultValue(int d);
int defaultValue() const;
int value() const;
void setSuffix(const QString& suffix);
Q_SIGNALS:
void reset();
void valueChanged(int);
public Q_SLOTS:
void setValue(int d);
void slotReset();
private Q_SLOTS:
void slotValueChanged(int);
private:
class Private;
Private* const d;
};
// ---------------------------------------------------------
class RDoubleNumInput : public QWidget
{
Q_OBJECT
public:
RDoubleNumInput(QWidget* const parent=0);
- ~RDoubleNumInput();
+ ~RDoubleNumInput() override;
void setDecimals(int p);
void setRange(double min, double max, double step);
void setDefaultValue(double d);
double defaultValue() const;
double value() const;
void setSuffix(const QString& suffix);
Q_SIGNALS:
void reset();
void valueChanged(double);
public Q_SLOTS:
void setValue(double d);
void slotReset();
private Q_SLOTS:
void slotValueChanged(double);
private:
class Private;
Private* const d;
};
} // namespace KDcrawIface
#endif /* RNUMINPUT_H */
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/rsliderspinbox.h b/plugins/impex/raw/3rdparty/libkdcraw/src/rsliderspinbox.h
index 4a37712338..d1a1377647 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/rsliderspinbox.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/rsliderspinbox.h
@@ -1,183 +1,183 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2014-11-30
* @brief Save space slider widget
*
* @author Copyright (C) 2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2010 by Justin Noel
* <a href="mailto:justin at ics dot com">justin at ics dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef RSLIDERSPINBOX_H
#define RSLIDERSPINBOX_H
// Qt includes
#include <QWidget>
#include <QString>
#include <QRect>
#include <QStyleOptionSpinBox>
#include <QStyleOptionProgressBar>
namespace KDcrawIface
{
class RAbstractSliderSpinBoxPrivate;
class RSliderSpinBoxPrivate;
class RDoubleSliderSpinBoxPrivate;
/**
* TODO: when inactive, also show the progress bar part as inactive!
*/
class RAbstractSliderSpinBox : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(RAbstractSliderSpinBox)
Q_DECLARE_PRIVATE(RAbstractSliderSpinBox)
protected:
explicit RAbstractSliderSpinBox(QWidget* const parent, RAbstractSliderSpinBoxPrivate* const q);
public:
- virtual ~RAbstractSliderSpinBox();
+ ~RAbstractSliderSpinBox() override;
void showEdit();
void hideEdit();
void setSuffix(const QString& suffix);
void setExponentRatio(double dbl);
protected:
- virtual void paintEvent(QPaintEvent* e);
- virtual void mousePressEvent(QMouseEvent* e);
- virtual void mouseReleaseEvent(QMouseEvent* e);
- virtual void mouseMoveEvent(QMouseEvent* e);
- virtual void keyPressEvent(QKeyEvent* e);
- virtual void wheelEvent(QWheelEvent *);
- virtual bool eventFilter(QObject* recv, QEvent* e);
+ void paintEvent(QPaintEvent* e) override;
+ void mousePressEvent(QMouseEvent* e) override;
+ void mouseReleaseEvent(QMouseEvent* e) override;
+ void mouseMoveEvent(QMouseEvent* e) override;
+ void keyPressEvent(QKeyEvent* e) override;
+ void wheelEvent(QWheelEvent *) override;
+ bool eventFilter(QObject* recv, QEvent* e) override;
- virtual QSize sizeHint() const;
- virtual QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
QStyleOptionSpinBox spinBoxOptions() const;
QStyleOptionProgressBar progressBarOptions() const;
QRect editRect(const QStyleOptionSpinBox& spinBoxOptions) const;
QRect progressRect(const QStyleOptionProgressBar& progressBarOptions) const;
QRect upButtonRect(const QStyleOptionSpinBox& spinBoxOptions) const;
QRect downButtonRect(const QStyleOptionSpinBox& spinBoxOptions) const;
int valueForX(int x, Qt::KeyboardModifiers modifiers = Qt::NoModifier) const;
virtual QString valueString() const = 0;
virtual void setInternalValue(int value) = 0;
protected Q_SLOTS:
- void contextMenuEvent(QContextMenuEvent* event);
+ void contextMenuEvent(QContextMenuEvent* event) override;
void editLostFocus();
protected:
RAbstractSliderSpinBoxPrivate* const d_ptr;
};
// ---------------------------------------------------------------------------------
class RSliderSpinBox : public RAbstractSliderSpinBox
{
Q_OBJECT
Q_DECLARE_PRIVATE(RSliderSpinBox)
Q_PROPERTY( int minimum READ minimum WRITE setMinimum )
Q_PROPERTY( int maximum READ maximum WRITE setMaximum )
public:
RSliderSpinBox(QWidget* const parent = 0);
- ~RSliderSpinBox();
+ ~RSliderSpinBox() override;
void setRange(int minimum, int maximum);
int minimum() const;
void setMinimum(int minimum);
int maximum() const;
void setMaximum(int maximum);
int fastSliderStep() const;
void setFastSliderStep(int step);
int value() const;
void setValue(int value);
void setSingleStep(int value);
void setPageStep(int value);
Q_SIGNALS:
void valueChanged(int value);
protected:
- virtual QString valueString() const;
- virtual void setInternalValue(int value);
+ QString valueString() const override;
+ void setInternalValue(int value) override;
};
// ---------------------------------------------------------------------------------
class RDoubleSliderSpinBox : public RAbstractSliderSpinBox
{
Q_OBJECT
Q_DECLARE_PRIVATE(RDoubleSliderSpinBox)
public:
RDoubleSliderSpinBox(QWidget* const parent = 0);
- ~RDoubleSliderSpinBox();
+ ~RDoubleSliderSpinBox() override;
void setRange(double minimum, double maximum, int decimals = 0);
double minimum() const;
void setMinimum(double minimum);
double maximum() const;
void setMaximum(double maximum);
double fastSliderStep() const;
void setFastSliderStep(double step);
double value() const;
void setValue(double value);
void setSingleStep(double value);
Q_SIGNALS:
void valueChanged(double value);
protected:
- virtual QString valueString() const;
- virtual void setInternalValue(int val);
+ QString valueString() const override;
+ void setInternalValue(int val) override;
};
} // namespace KDcrawIface
#endif // RSLIDERSPINBOX_H
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/rwidgetutils.h b/plugins/impex/raw/3rdparty/libkdcraw/src/rwidgetutils.h
index c17300fc89..d17b0690e5 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/rwidgetutils.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/rwidgetutils.h
@@ -1,256 +1,256 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2014-09-12
* @brief Simple helpher widgets collection
*
* @author Copyright (C) 2014-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef RWIDGETUTILS_H
#define RWIDGETUTILS_H
// Qt includes
#include <QLabel>
#include <QFileInfo>
#include <QString>
#include <QFrame>
#include <QLineEdit>
#include <QSize>
#include <QPixmap>
#include <QFileDialog>
#include <QColor>
#include <QPushButton>
// Local includes
namespace KDcrawIface
{
/** A widget to host an image into a label with an active url which can be
* open to default web browser using simple mouse click.
*/
class RActiveLabel : public QLabel
{
Q_OBJECT
public:
explicit RActiveLabel(const QUrl& url=QUrl(), const QString& imgPath=QString(), QWidget* const parent=0);
- virtual ~RActiveLabel();
+ ~RActiveLabel() override;
void updateData(const QUrl& url, const QImage& img);
};
// ------------------------------------------------------------------------------------
/**
* A widget to show an horizontal or vertical line separator
**/
class RLineWidget : public QFrame
{
Q_OBJECT
public:
explicit RLineWidget(Qt::Orientation orientation, QWidget* const parent=0);
- virtual ~RLineWidget();
+ ~RLineWidget() override;
};
// ------------------------------------------------------------------------------------
/** An Horizontal widget to host children widgets
*/
class RHBox : public QFrame
{
Q_OBJECT
Q_DISABLE_COPY(RHBox)
public:
explicit RHBox(QWidget* const parent=0);
- virtual ~RHBox();
+ ~RHBox() override;
void setMargin(int margin);
void setSpacing(int space);
void setStretchFactor(QWidget* const widget, int stretch);
- virtual QSize sizeHint() const;
- virtual QSize minimumSizeHint() const;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
protected:
RHBox(bool vertical, QWidget* const parent);
- virtual void childEvent(QChildEvent* e);
+ void childEvent(QChildEvent* e) override;
};
// ------------------------------------------------------------------------------------
/** A Vertical widget to host children widgets
*/
class RVBox : public RHBox
{
Q_OBJECT
Q_DISABLE_COPY(RVBox)
public:
explicit RVBox(QWidget* const parent=0);
- virtual ~RVBox();
+ ~RVBox() override;
};
// ------------------------------------------------------------------------------------
/** A label to show text adjusted to widget size
*/
class RAdjustableLabel : public QLabel
{
Q_OBJECT
public:
explicit RAdjustableLabel(QWidget* const parent=0);
- virtual ~RAdjustableLabel();
+ ~RAdjustableLabel() override;
- QSize minimumSizeHint() const;
- QSize sizeHint() const;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
void setAlignment(Qt::Alignment align);
void setElideMode(Qt::TextElideMode mode);
QString adjustedText() const;
public Q_SLOTS:
void setAdjustedText(const QString& text=QString());
private:
- void resizeEvent(QResizeEvent*);
+ void resizeEvent(QResizeEvent*) override;
void adjustTextToLabel();
// Disabled methods from QLabel
QString text() const { return QString(); }; // Use adjustedText() instead.
void setText(const QString&) {}; // Use setAdjustedText(text) instead.
void clear() {}; // Use setdjustedText(QString()) instead.
private:
class Private;
Private* const d;
};
// ------------------------------------------------------------------------------------
/** A widget to chosse a single local file or path.
* Use line edit and file dialog properties to customize operation modes.
*/
class RFileSelector : public RHBox
{
Q_OBJECT
public:
explicit RFileSelector(QWidget* const parent=0);
- virtual ~RFileSelector();
+ ~RFileSelector() override;
QLineEdit* lineEdit() const;
void setFileDlgMode(QFileDialog::FileMode mode);
void setFileDlgFilter(const QString& filter);
void setFileDlgTitle(const QString& title);
void setFileDlgOptions(QFileDialog::Options opts);
Q_SIGNALS:
void signalOpenFileDialog();
void signalUrlSelected(const QUrl&);
private Q_SLOTS:
void slotBtnClicked();
private:
class Private;
Private* const d;
};
// --------------------------------------------------------------------------------------
/** A widget to draw progress wheel indicator over thumbnails.
*/
class WorkingPixmap
{
public:
explicit WorkingPixmap();
~WorkingPixmap();
bool isEmpty() const;
QSize frameSize() const;
int frameCount() const;
QPixmap frameAt(int index) const;
private:
QVector<QPixmap> m_frames;
};
// ------------------------------------------------------------------------------------
/** A widget to chosse a color from a palette.
*/
class RColorSelector : public QPushButton
{
Q_OBJECT
public:
explicit RColorSelector(QWidget* const parent=0);
- virtual ~RColorSelector();
+ ~RColorSelector() override;
void setColor(const QColor& color);
QColor color() const;
Q_SIGNALS:
void signalColorSelected(const QColor&);
private Q_SLOTS:
void slotBtnClicked();
private:
- void paintEvent(QPaintEvent*);
+ void paintEvent(QPaintEvent*) override;
private:
class Private;
Private* const d;
};
} // namespace KDcrawIface
#endif // RWIDGETUTILS_H
diff --git a/plugins/impex/raw/3rdparty/libkdcraw/src/squeezedcombobox.h b/plugins/impex/raw/3rdparty/libkdcraw/src/squeezedcombobox.h
index 296a04306c..9aadc9e97d 100644
--- a/plugins/impex/raw/3rdparty/libkdcraw/src/squeezedcombobox.h
+++ b/plugins/impex/raw/3rdparty/libkdcraw/src/squeezedcombobox.h
@@ -1,165 +1,165 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-08-21
* @brief a combo box with a width not depending of text
* content size
*
* @author Copyright (C) 2006-2015 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2008 by Andi Clemens
* <a href="mailto:andi dot clemens at googlemail dot com">andi dot clemens at googlemail dot com</a>
* @author Copyright (C) 2005 by Tom Albers
* <a href="mailto:tomalbers at kde dot nl">tomalbers at kde dot nl</a>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef SQUEEZEDCOMBOBOX_H
#define SQUEEZEDCOMBOBOX_H
// Qt includes
#include <QComboBox>
// Local includes
namespace KDcrawIface
{
/** @class SqueezedComboBox
*
* This widget is a QComboBox, but then a little bit
* different. It only shows the right part of the items
* depending on de size of the widget. When it is not
* possible to show the complete item, it will be shortened
* and "..." will be prepended.
*/
class SqueezedComboBox : public QComboBox
{
Q_OBJECT
public:
/**
* Constructor
* @param parent parent widget
* @param name name to give to the widget
*/
explicit SqueezedComboBox(QWidget* const parent = 0, const char* name = 0 );
/**
* destructor
*/
- virtual ~SqueezedComboBox();
+ ~SqueezedComboBox() override;
/**
*
* Returns true if the combobox contains the original (not-squeezed)
* version of text.
* @param text the original (not-squeezed) text to check for
*/
bool contains(const QString& text) const;
/**
* This inserts a item to the list. See QComboBox::insertItem()
* for details. Please do not use QComboBox::insertItem() to this
* widget, as that will fail.
* @param newItem the original (long version) of the item which needs
* to be added to the combobox
* @param index the position in the widget.
* @param userData custom meta-data assigned to new item.
*/
void insertSqueezedItem(const QString& newItem, int index,
const QVariant& userData=QVariant());
/**
* This inserts items to the list. See QComboBox::insertItems()
* for details. Please do not use QComboBox:: insertItems() to this
* widget, as that will fail.
* @param newItems the originals (long version) of the items which needs
* to be added to the combobox
* @param index the position in the widget.
*/
void insertSqueezedList(const QStringList& newItems, int index);
/**
* Append an item.
* @param newItem the original (long version) of the item which needs
* to be added to the combobox
* @param userData custom meta-data assigned to new item.
*/
void addSqueezedItem(const QString& newItem,
const QVariant& userData=QVariant());
/**
* Set the current item to the one matching the given text.
*
* @param itemText the original (long version) of the item text
*/
void setCurrent(const QString& itemText);
/**
* This method returns the full text (not squeezed) of the currently
* highlighted item.
* @return full text of the highlighted item
*/
QString itemHighlighted() const;
/**
* This method returns the full text (not squeezed) for the index.
* @param index the position in the widget.
* @return full text of the item
*/
QString item(int index) const;
/**
* Sets the sizeHint() of this widget.
*/
- virtual QSize sizeHint() const;
+ QSize sizeHint() const override;
private Q_SLOTS:
void slotTimeOut();
void slotUpdateToolTip(int index);
private:
- void resizeEvent(QResizeEvent*);
+ void resizeEvent(QResizeEvent*) override;
QString squeezeText(const QString& original) const;
// Prevent these from being used.
QString currentText() const;
void setCurrentText(const QString& itemText);
void insertItem(const QString& text);
void insertItem(qint32 index, const QString& text);
void insertItem(int index, const QIcon& icon, const QString& text, const QVariant& userData=QVariant());
void insertItems(int index, const QStringList& list);
void addItem(const QString& text);
void addItem(const QIcon& icon, const QString& text, const QVariant& userData=QVariant());
void addItems(const QStringList& texts);
QString itemText(int index) const;
private:
class Private;
Private* const d;
};
} // namespace KDcrawIface
#endif // SQUEEZEDCOMBOBOX_H
diff --git a/plugins/impex/raw/kis_raw_import.h b/plugins/impex/raw/kis_raw_import.h
index 3686c157eb..0e5843580e 100644
--- a/plugins/impex/raw/kis_raw_import.h
+++ b/plugins/impex/raw/kis_raw_import.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_RAW_IMPORT_H_
#define KIS_RAW_IMPORT_H_
#include <KisImportExportFilter.h>
#include "ui_wdgrawimport.h"
class KoDialog;
class WdgRawImport;
namespace KDcrawIface
{
class RawDecodingSettings;
}
class KisRawImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisRawImport(QObject *parent, const QVariantList &);
- virtual ~KisRawImport();
+ ~KisRawImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
private Q_SLOTS:
void slotUpdatePreview();
private:
KDcrawIface::RawDecodingSettings rawDecodingSettings();
private:
Ui::WdgRawImport m_rawWidget;
KoDialog* m_dialog;
};
#endif // KIS_RAW_IMPORT_H_
diff --git a/plugins/impex/spriter/kis_spriter_export.h b/plugins/impex/spriter/kis_spriter_export.h
index 04f9632a7d..a4c4b24ceb 100644
--- a/plugins/impex/spriter/kis_spriter_export.h
+++ b/plugins/impex/spriter/kis_spriter_export.h
@@ -1,135 +1,135 @@
/*
* Copyright (c) 2016 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SPRITER_EXPORT_H_
#define _KIS_SPRITER_EXPORT_H_
#include <QVariant>
#include <QDomDocument>
#include <QList>
#include <KisImportExportFilter.h>
#include <kis_types.h>
struct SpriterFile {
qreal id;
QString name;
QString pathName;
QString baseName;
QString layerName;
qreal width;
qreal height;
qreal x;
qreal y;
};
struct Folder {
qreal id;
QString name;
QString pathName;
QString baseName;
QString groupName;
QList<SpriterFile> files;
};
struct Bone {
qreal id;
const Bone *parentBone;
QString name;
qreal x;
qreal y;
qreal width;
qreal height;
qreal localX;
qreal localY;
qreal localAngle;
qreal localScaleX;
qreal localScaleY;
qreal fixLocalX;
qreal fixLocalY;
qreal fixLocalAngle;
qreal fixLocalScaleX;
qreal fixLocalScaleY;
QList<Bone*> bones;
~Bone() {
qDeleteAll(bones);
bones.clear();;
}
};
struct SpriterSlot {
QString name;
bool defaultAttachmentFlag;
};
struct SpriterObject {
qreal id;
qreal folderId;
qreal fileId;
Bone *bone;
SpriterSlot *slot;
qreal x;
qreal y;
qreal localX;
qreal localY;
qreal localAngle;
qreal localScaleX;
qreal localScaleY;
qreal fixLocalX;
qreal fixLocalY;
qreal fixLocalAngle;
qreal fixLocalScaleX;
qreal fixLocalScaleY;
~SpriterObject() {
delete slot;
}
};
class KisSpriterExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisSpriterExport(QObject *parent, const QVariantList &);
- virtual ~KisSpriterExport();
- virtual bool supportsIO() const { return false; }
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ ~KisSpriterExport() override;
+ bool supportsIO() const override { return false; }
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
private:
bool savePaintDevice(KisPaintDeviceSP dev, const QString &fileName);
void parseFolder(KisGroupLayerSP parentGroup, const QString &folderName, const QString &basePath, int *folderId = 0);
Bone *parseBone(const Bone *parent, KisGroupLayerSP groupLayer);
void fixBone(Bone *bone);
void fillScml(QDomDocument &scml, const QString &entityName);
void writeBoneRef(const Bone *bone, QDomElement &mainline, QDomDocument &scml);
void writeBone(const Bone *bone, QDomElement &timeline, QDomDocument &scml);
KisImageSP m_image;
qreal m_timelineid;
QList<Folder> m_folders;
Bone *m_rootBone;
QList<SpriterObject> m_objects;
KisGroupLayerSP m_rootLayer; // Not the image's root later, but the one that is named "root"
KisLayerSP m_boneLayer;
};
#endif
diff --git a/plugins/impex/svg/kis_svg_import.h b/plugins/impex/svg/kis_svg_import.h
index 056ca619e7..a4d185566e 100644
--- a/plugins/impex/svg/kis_svg_import.h
+++ b/plugins/impex/svg/kis_svg_import.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_SVG_IMPORT_H_
#define _KIS_SVG_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisSVGImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisSVGImport(QObject *parent, const QVariantList &);
- virtual ~KisSVGImport();
+ ~KisSVGImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration) override;
};
#endif
diff --git a/plugins/impex/tga/kis_tga_export.h b/plugins/impex/tga/kis_tga_export.h
index d625cfa7b9..a10414659e 100644
--- a/plugins/impex/tga/kis_tga_export.h
+++ b/plugins/impex/tga/kis_tga_export.h
@@ -1,38 +1,38 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TGA_EXPORT_H_
#define _KIS_TGA_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisTGAExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisTGAExport(QObject *parent, const QVariantList &);
- virtual ~KisTGAExport();
+ ~KisTGAExport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- void initializeCapabilities();
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/tga/kis_tga_import.h b/plugins/impex/tga/kis_tga_import.h
index 0fc03e3fe9..d8ea64383d 100644
--- a/plugins/impex/tga/kis_tga_import.h
+++ b/plugins/impex/tga/kis_tga_import.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TGA_IMPORT_H_
#define _KIS_TGA_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisTGAImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisTGAImport(QObject *parent, const QVariantList &);
- virtual ~KisTGAImport();
+ ~KisTGAImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/tiff/kis_buffer_stream.h b/plugins/impex/tiff/kis_buffer_stream.h
index 6b9e9bb9dd..9b888c1cf7 100644
--- a/plugins/impex/tiff/kis_buffer_stream.h
+++ b/plugins/impex/tiff/kis_buffer_stream.h
@@ -1,97 +1,97 @@
/*
* Copyright (c) 2005-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_BUFFER_STREAM_H_
#define _KIS_BUFFER_STREAM_H_
#ifdef _MSC_VER
#define KDEWIN_STDIO_H // Remove KDEWIN extensions to stdio.h
#include <stdio.h>
#endif
#include <tiffio.h>
class KisBufferStreamBase
{
public:
KisBufferStreamBase(uint16 depth) : m_depth(depth) {}
virtual uint32 nextValue() = 0;
virtual void restart() = 0;
virtual void moveToLine(uint32 lineNumber) = 0;
virtual ~KisBufferStreamBase() {}
protected:
uint16 m_depth;
};
class KisBufferStreamContigBase : public KisBufferStreamBase
{
public:
KisBufferStreamContigBase(uint8* src, uint16 depth, uint32 lineSize);
- virtual void restart();
- virtual void moveToLine(uint32 lineNumber);
- virtual ~KisBufferStreamContigBase() {}
+ void restart() override;
+ void moveToLine(uint32 lineNumber) override;
+ ~KisBufferStreamContigBase() override {}
protected:
uint8* m_src;
uint8* m_srcIt;
uint8 m_posinc;
uint32 m_lineSize;
};
class KisBufferStreamContigBelow16 : public KisBufferStreamContigBase
{
public:
KisBufferStreamContigBelow16(uint8* src, uint16 depth, uint32 lineSize) : KisBufferStreamContigBase(src, depth, lineSize) { }
public:
- virtual ~KisBufferStreamContigBelow16() {}
- virtual uint32 nextValue();
+ ~KisBufferStreamContigBelow16() override {}
+ uint32 nextValue() override;
};
class KisBufferStreamContigBelow32 : public KisBufferStreamContigBase
{
public:
KisBufferStreamContigBelow32(uint8* src, uint16 depth, uint32 lineSize) : KisBufferStreamContigBase(src, depth, lineSize) { }
public:
- virtual ~KisBufferStreamContigBelow32() {}
- virtual uint32 nextValue();
+ ~KisBufferStreamContigBelow32() override {}
+ uint32 nextValue() override;
};
class KisBufferStreamContigAbove32 : public KisBufferStreamContigBase
{
public:
KisBufferStreamContigAbove32(uint8* src, uint16 depth, uint32 lineSize) : KisBufferStreamContigBase(src, depth, lineSize) { }
public:
- virtual ~KisBufferStreamContigAbove32() {}
- virtual uint32 nextValue();
+ ~KisBufferStreamContigAbove32() override {}
+ uint32 nextValue() override;
};
class KisBufferStreamSeperate : public KisBufferStreamBase
{
public:
KisBufferStreamSeperate(uint8** srcs, uint8 nb_samples , uint16 depth, uint32* lineSize);
- virtual ~KisBufferStreamSeperate();
- virtual uint32 nextValue();
- virtual void restart();
- virtual void moveToLine(uint32 lineNumber);
+ ~KisBufferStreamSeperate() override;
+ uint32 nextValue() override;
+ void restart() override;
+ void moveToLine(uint32 lineNumber) override;
private:
KisBufferStreamContigBase** streams;
uint8 m_current_sample, m_nb_samples;
};
#endif
diff --git a/plugins/impex/tiff/kis_tiff_converter.cc b/plugins/impex/tiff/kis_tiff_converter.cc
index bc91421bbb..9899c1e938 100644
--- a/plugins/impex/tiff/kis_tiff_converter.cc
+++ b/plugins/impex/tiff/kis_tiff_converter.cc
@@ -1,743 +1,745 @@
/*
* Copyright (c) 2005-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kis_tiff_converter.h"
#include <stdio.h>
#include <QFile>
#include <QApplication>
#include <QFileInfo>
#include <KoDocumentInfo.h>
#include <KoUnit.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorSpace.h>
#include <KoColorModelStandardIds.h>
#include <KisDocument.h>
#include <kis_image.h>
#include <kis_layer.h>
#include <KoColorProfile.h>
#include <kis_group_layer.h>
#include <kis_paint_layer.h>
#include <kis_transaction.h>
#include "kis_tiff_reader.h"
#include "kis_tiff_ycbcr_reader.h"
#include "kis_buffer_stream.h"
#include "kis_tiff_writer_visitor.h"
#if TIFFLIB_VERSION < 20111221
typedef size_t tmsize_t;
#endif
namespace
{
QPair<QString, QString> getColorSpaceForColorType(uint16 sampletype, uint16 color_type, uint16 color_nb_bits, TIFF *image, uint16 &nbchannels, uint16 &extrasamplescount, uint8 &destDepth)
{
if (color_type == PHOTOMETRIC_MINISWHITE || color_type == PHOTOMETRIC_MINISBLACK) {
if (nbchannels == 0) nbchannels = 1;
extrasamplescount = nbchannels - 1; // FIX the extrasamples count in case of
if (sampletype == SAMPLEFORMAT_IEEEFP) {
if (color_nb_bits == 16) {
destDepth = 16;
return QPair<QString, QString>(GrayAColorModelID.id(), Float16BitsColorDepthID.id());
}
else if (color_nb_bits == 32) {
destDepth = 32;
return QPair<QString, QString>(GrayAColorModelID.id(), Float32BitsColorDepthID.id());
}
}
if (color_nb_bits <= 8) {
destDepth = 8;
return QPair<QString, QString>(GrayAColorModelID.id(), Integer8BitsColorDepthID.id());
}
else {
destDepth = 16;
return QPair<QString, QString>(GrayAColorModelID.id(), Integer16BitsColorDepthID.id());
}
} else if (color_type == PHOTOMETRIC_RGB /*|| color_type == */) {
if (nbchannels == 0) nbchannels = 3;
extrasamplescount = nbchannels - 3; // FIX the extrasamples count in case of
if (sampletype == SAMPLEFORMAT_IEEEFP) {
if (color_nb_bits == 16) {
destDepth = 16;
return QPair<QString, QString>(RGBAColorModelID.id(), Float16BitsColorDepthID.id());
}
else if (color_nb_bits == 32) {
destDepth = 32;
return QPair<QString, QString>(RGBAColorModelID.id(), Float32BitsColorDepthID.id());
}
return QPair<QString, QString>();
}
else {
if (color_nb_bits <= 8) {
destDepth = 8;
return QPair<QString, QString>(RGBAColorModelID.id(), Integer8BitsColorDepthID.id());
}
else {
destDepth = 16;
return QPair<QString, QString>(RGBAColorModelID.id(), Integer16BitsColorDepthID.id());
}
}
} else if (color_type == PHOTOMETRIC_YCBCR) {
if (nbchannels == 0) nbchannels = 3;
extrasamplescount = nbchannels - 3; // FIX the extrasamples count in case of
if (color_nb_bits <= 8) {
destDepth = 8;
return QPair<QString, QString>(YCbCrAColorModelID.id(), Integer8BitsColorDepthID.id());
}
else {
destDepth = 16;
return QPair<QString, QString>(YCbCrAColorModelID.id(), Integer16BitsColorDepthID.id());
}
}
else if (color_type == PHOTOMETRIC_SEPARATED) {
if (nbchannels == 0) nbchannels = 4;
// SEPARATED is in general CMYK but not always, so we check
uint16 inkset;
if ((TIFFGetField(image, TIFFTAG_INKSET, &inkset) == 0)) {
dbgFile << "Image does not define the inkset.";
inkset = 2;
}
if (inkset != INKSET_CMYK) {
dbgFile << "Unsupported inkset (right now, only CMYK is supported)";
char** ink_names;
uint16 numberofinks;
if (TIFFGetField(image, TIFFTAG_INKNAMES, &ink_names) == 1 && TIFFGetField(image, TIFFTAG_NUMBEROFINKS, &numberofinks) == 1) {
dbgFile << "Inks are :";
for (uint i = 0; i < numberofinks; i++) {
dbgFile << ink_names[i];
}
}
else {
dbgFile << "inknames are not defined !";
// To be able to read stupid adobe files, if there are no information about inks and four channels, then it's a CMYK file :
if (nbchannels - extrasamplescount != 4) {
return QPair<QString, QString>();
}
}
}
if (color_nb_bits <= 8) {
destDepth = 8;
return QPair<QString, QString>(CMYKAColorModelID.id(), Integer8BitsColorDepthID.id());
}
else {
destDepth = 16;
return QPair<QString, QString>(CMYKAColorModelID.id(), Integer16BitsColorDepthID.id());
}
}
else if (color_type == PHOTOMETRIC_CIELAB || color_type == PHOTOMETRIC_ICCLAB) {
destDepth = 16;
if (nbchannels == 0) nbchannels = 3;
extrasamplescount = nbchannels - 3; // FIX the extrasamples count
return QPair<QString, QString>(LABAColorModelID.id(), Integer16BitsColorDepthID.id());
}
else if (color_type == PHOTOMETRIC_PALETTE) {
destDepth = 16;
if (nbchannels == 0) nbchannels = 2;
extrasamplescount = nbchannels - 2; // FIX the extrasamples count
// <-- we will convert the index image to RGBA16 as the palette is always on 16bits colors
return QPair<QString, QString>(RGBAColorModelID.id(), Integer16BitsColorDepthID.id());
}
return QPair<QString, QString>();
}
}
KisPropertiesConfigurationSP KisTIFFOptions::toProperties() const
{
QHash<int, int> compToIndex;
compToIndex[COMPRESSION_NONE] = 0;
compToIndex[COMPRESSION_JPEG] = 1;
compToIndex[COMPRESSION_DEFLATE] = 2;
compToIndex[COMPRESSION_LZW] = 3;
compToIndex[COMPRESSION_JP2000] = 4;
compToIndex[COMPRESSION_CCITTRLE] = 5;
compToIndex[COMPRESSION_CCITTFAX3] = 6;
compToIndex[COMPRESSION_CCITTFAX4] = 7;
compToIndex[COMPRESSION_PIXARLOG] = 8;
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
cfg->setProperty("compressiontype", compToIndex.value(compressionType, 0));
cfg->setProperty("predictor", predictor - 1);
cfg->setProperty("alpha", alpha);
cfg->setProperty("flatten", flatten);
cfg->setProperty("quality", jpegQuality);
cfg->setProperty("deflate", deflateCompress);
cfg->setProperty("faxmode", faxMode - 1);
cfg->setProperty("pixarlog", pixarLogCompress);
cfg->setProperty("saveProfile", saveProfile);
return cfg;
}
void KisTIFFOptions::fromProperties(KisPropertiesConfigurationSP cfg)
{
QHash<int, int> indexToComp;
indexToComp[0] = COMPRESSION_NONE;
indexToComp[1] = COMPRESSION_JPEG;
indexToComp[2] = COMPRESSION_DEFLATE;
indexToComp[3] = COMPRESSION_LZW;
indexToComp[4] = COMPRESSION_JP2000;
indexToComp[5] = COMPRESSION_CCITTRLE;
indexToComp[6] = COMPRESSION_CCITTFAX3;
indexToComp[7] = COMPRESSION_CCITTFAX4;
indexToComp[8] = COMPRESSION_PIXARLOG;
compressionType =
indexToComp.value(
cfg->getInt("compressiontype", 0),
COMPRESSION_NONE);
predictor = cfg->getInt("predictor", 0) + 1;
alpha = cfg->getBool("alpha", true);
flatten = cfg->getBool("flatten", true);
jpegQuality = cfg->getInt("quality", 80);
deflateCompress = cfg->getInt("deflate", 6);
faxMode = cfg->getInt("faxmode", 0) + 1;
pixarLogCompress = cfg->getInt("pixarlog", 6);
saveProfile = cfg->getBool("saveProfile", true);
}
KisTIFFConverter::KisTIFFConverter(KisDocument *doc)
{
m_doc = doc;
m_stop = false;
TIFFSetWarningHandler(0);
TIFFSetErrorHandler(0);
}
KisTIFFConverter::~KisTIFFConverter()
{
}
KisImageBuilder_Result KisTIFFConverter::decode(const QString &filename)
{
dbgFile << "Start decoding TIFF File";
// Opent the TIFF file
TIFF *image = 0;
if ((image = TIFFOpen(QFile::encodeName(filename), "r")) == 0) {
dbgFile << "Could not open the file, either it does not exist, either it is not a TIFF :" << filename;
return (KisImageBuilder_RESULT_BAD_FETCH);
}
do {
dbgFile << "Read new sub-image";
KisImageBuilder_Result result = readTIFFDirectory(image);
if (result != KisImageBuilder_RESULT_OK) {
return result;
}
} while (TIFFReadDirectory(image));
// Freeing memory
TIFFClose(image);
return KisImageBuilder_RESULT_OK;
}
KisImageBuilder_Result KisTIFFConverter::readTIFFDirectory(TIFF* image)
{
// Read information about the tiff
uint32 width, height;
if (TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width) == 0) {
dbgFile << "Image does not define its width";
TIFFClose(image);
return KisImageBuilder_RESULT_INVALID_ARG;
}
if (TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height) == 0) {
dbgFile << "Image does not define its height";
TIFFClose(image);
return KisImageBuilder_RESULT_INVALID_ARG;
}
float xres;
if (TIFFGetField(image, TIFFTAG_XRESOLUTION, &xres) == 0) {
dbgFile << "Image does not define x resolution";
// but we don't stop
xres = 100;
}
float yres;
if (TIFFGetField(image, TIFFTAG_YRESOLUTION, &yres) == 0) {
dbgFile << "Image does not define y resolution";
// but we don't stop
yres = 100;
}
uint16 depth;
if ((TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &depth) == 0)) {
dbgFile << "Image does not define its depth";
depth = 1;
}
uint16 sampletype;
if ((TIFFGetField(image, TIFFTAG_SAMPLEFORMAT, &sampletype) == 0)) {
dbgFile << "Image does not define its sample type";
sampletype = SAMPLEFORMAT_UINT;
}
// Determine the number of channels (useful to know if a file has an alpha or not
uint16 nbchannels;
if (TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &nbchannels) == 0) {
dbgFile << "Image has an undefined number of samples per pixel";
nbchannels = 0;
}
// Get the number of extrasamples and information about them
uint16 *sampleinfo = 0, extrasamplescount;
if (TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extrasamplescount, &sampleinfo) == 0) {
extrasamplescount = 0;
}
// Determine the colorspace
uint16 color_type;
if (TIFFGetField(image, TIFFTAG_PHOTOMETRIC, &color_type) == 0) {
dbgFile << "Image has an undefined photometric interpretation";
color_type = PHOTOMETRIC_MINISWHITE;
}
uint8 dstDepth = 0;
- QPair<QString, QString> colorSpaceId = getColorSpaceForColorType(sampletype, color_type, depth, image, nbchannels, extrasamplescount, dstDepth);
- if (colorSpaceId.first.isEmpty()) {
+ QPair<QString, QString> colorSpaceIdTag = getColorSpaceForColorType(sampletype, color_type, depth, image, nbchannels, extrasamplescount, dstDepth);
+ if (colorSpaceIdTag.first.isEmpty()) {
dbgFile << "Image has an unsupported colorspace :" << color_type << " for this depth :" << depth;
TIFFClose(image);
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
- dbgFile << "Colorspace is :" << colorSpaceId.first << colorSpaceId.second << " with a depth of" << depth << " and with a nb of channels of" << nbchannels;
+ dbgFile << "Colorspace is :" << colorSpaceIdTag.first << colorSpaceIdTag.second << " with a depth of" << depth << " and with a nb of channels of" << nbchannels;
// Read image profile
dbgFile << "Reading profile";
const KoColorProfile* profile = 0;
quint32 EmbedLen;
quint8* EmbedBuffer;
if (TIFFGetField(image, TIFFTAG_ICCPROFILE, &EmbedLen, &EmbedBuffer) == 1) {
dbgFile << "Profile found";
QByteArray rawdata;
rawdata.resize(EmbedLen);
memcpy(rawdata.data(), EmbedBuffer, EmbedLen);
- profile = KoColorSpaceRegistry::instance()->createColorProfile(colorSpaceId.first, colorSpaceId.second, rawdata);
+ profile = KoColorSpaceRegistry::instance()->createColorProfile(colorSpaceIdTag.first, colorSpaceIdTag.second, rawdata);
}
- // Check that the profile is used by the color space
+ const QString colorSpaceId =
+ KoColorSpaceRegistry::instance()->colorSpaceId(colorSpaceIdTag.first, colorSpaceIdTag.second);
- if (profile && !KoColorSpaceRegistry::instance()->colorSpaceFactory(KoColorSpaceRegistry::instance()->colorSpaceId(colorSpaceId.first, colorSpaceId.second))->profileIsCompatible(profile)) {
- dbgFile << "The profile " << profile->name() << " is not compatible with the color space model " << colorSpaceId.first << " " << colorSpaceId.second;
+ // Check that the profile is used by the color space
+ if (profile && !KoColorSpaceRegistry::instance()->profileIsCompatible(profile, colorSpaceId)) {
+ dbgFile << "The profile " << profile->name() << " is not compatible with the color space model " << colorSpaceIdTag.first << " " << colorSpaceIdTag.second;
profile = 0;
}
// Do not use the linear gamma profile for 16 bits/channel by default, tiff files are usually created with
// gamma correction. XXX: Should we ask the user?
- if (!profile && colorSpaceId.first == RGBAColorModelID.id() && colorSpaceId.second == Integer16BitsColorDepthID.id()) {
+ if (!profile && colorSpaceIdTag.first == RGBAColorModelID.id() && colorSpaceIdTag.second == Integer16BitsColorDepthID.id()) {
profile = KoColorSpaceRegistry::instance()->profileByName("sRGB-elle-V2-srgbtrc.icc");
dbgFile << "Getting srgb profile" << profile;
}
// Retrieve a pointer to the colorspace
const KoColorSpace* cs = 0;
if (profile && profile->isSuitableForOutput()) {
dbgFile << "image has embedded profile:" << profile -> name() << "";
- cs = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId.first, colorSpaceId.second, profile);
+ cs = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceIdTag.first, colorSpaceIdTag.second, profile);
}
else {
- cs = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId.first, colorSpaceId.second, 0);
+ cs = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceIdTag.first, colorSpaceIdTag.second, 0);
}
if (cs == 0) {
- dbgFile << "Colorspace" << colorSpaceId.first << colorSpaceId.second << " is not available, please check your installation.";
+ dbgFile << "Colorspace" << colorSpaceIdTag.first << colorSpaceIdTag.second << " is not available, please check your installation.";
TIFFClose(image);
return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
}
// Create the cmsTransform if needed
KoColorTransformation* transform = 0;
if (profile && !profile->isSuitableForOutput()) {
dbgFile << "The profile can't be used in krita, need conversion";
- transform = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceId.first, colorSpaceId.second, profile)->createColorConverter(cs, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
+ transform = KoColorSpaceRegistry::instance()->colorSpace(colorSpaceIdTag.first, colorSpaceIdTag.second, profile)->createColorConverter(cs, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
}
// Check if there is an alpha channel
int8 alphapos = -1; // <- no alpha
// Check which extra is alpha if any
dbgFile << "There are" << nbchannels << " channels and" << extrasamplescount << " extra channels";
if (sampleinfo) { // index images don't have any sampleinfo, and therefor sampleinfo == 0
for (int i = 0; i < extrasamplescount; i ++) {
dbgFile << i << "" << extrasamplescount << "" << (cs->colorChannelCount()) << nbchannels << "" << sampleinfo[i];
if (sampleinfo[i] == EXTRASAMPLE_ASSOCALPHA) {
// XXX: dangelo: the color values are already multiplied with
// the alpha value. This needs to be reversed later (postprocessor?)
alphapos = i;
}
if (sampleinfo[i] == EXTRASAMPLE_UNASSALPHA) {
// color values are not premultiplied with alpha, and can be used as they are.
alphapos = i;
}
}
}
dbgFile << "Alpha pos:" << alphapos;
// Read META Information
KoDocumentInfo * info = m_doc->documentInfo();
char* text;
if (TIFFGetField(image, TIFFTAG_ARTIST, &text) == 1) {
info->setAuthorInfo("creator", text);
}
if (TIFFGetField(image, TIFFTAG_DOCUMENTNAME, &text) == 1) {
info->setAboutInfo("title", text);
}
if (TIFFGetField(image, TIFFTAG_IMAGEDESCRIPTION, &text) == 1) {
info->setAboutInfo("description", text);
}
// Get the planar configuration
uint16 planarconfig;
if (TIFFGetField(image, TIFFTAG_PLANARCONFIG, &planarconfig) == 0) {
dbgFile << "Plannar configuration is not define";
TIFFClose(image);
return KisImageBuilder_RESULT_INVALID_ARG;
}
// Creating the KisImageSP
if (! m_image) {
m_image = new KisImage(m_doc->createUndoStore(), width, height, cs, "built image");
m_image->setResolution( POINT_TO_INCH(xres), POINT_TO_INCH(yres )); // It is the "invert" macro because we convert from pointer-per-inchs to points
Q_CHECK_PTR(m_image);
}
else {
if (m_image->width() < (qint32)width || m_image->height() < (qint32)height) {
quint32 newwidth = (m_image->width() < (qint32)width) ? width : m_image->width();
quint32 newheight = (m_image->height() < (qint32)height) ? height : m_image->height();
m_image->resizeImage(QRect(0,0,newwidth, newheight));
}
}
KisPaintLayer* layer = new KisPaintLayer(m_image.data(), m_image -> nextLayerName(), quint8_MAX);
tdata_t buf = 0;
tdata_t* ps_buf = 0; // used only for planar configuration separated
KisBufferStreamBase* tiffstream;
KisTIFFReaderBase* tiffReader = 0;
quint8 poses[5];
KisTIFFPostProcessor* postprocessor = 0;
// Configure poses
uint8 nbcolorsamples = nbchannels - extrasamplescount;
switch (color_type) {
case PHOTOMETRIC_MINISWHITE: {
poses[0] = 0; poses[1] = 1;
postprocessor = new KisTIFFPostProcessorInvert(nbcolorsamples);
}
break;
case PHOTOMETRIC_MINISBLACK: {
poses[0] = 0; poses[1] = 1;
postprocessor = new KisTIFFPostProcessor(nbcolorsamples);
}
break;
case PHOTOMETRIC_CIELAB: {
poses[0] = 0; poses[1] = 1; poses[2] = 2; poses[3] = 3;
postprocessor = new KisTIFFPostProcessorCIELABtoICCLAB(nbcolorsamples);
}
break;
case PHOTOMETRIC_ICCLAB: {
poses[0] = 0; poses[1] = 1; poses[2] = 2; poses[3] = 3;
postprocessor = new KisTIFFPostProcessor(nbcolorsamples);
}
break;
case PHOTOMETRIC_RGB: {
if (sampletype == SAMPLEFORMAT_IEEEFP)
{
poses[2] = 2; poses[1] = 1; poses[0] = 0; poses[3] = 3;
} else {
poses[0] = 2; poses[1] = 1; poses[2] = 0; poses[3] = 3;
}
postprocessor = new KisTIFFPostProcessor(nbcolorsamples);
}
break;
case PHOTOMETRIC_SEPARATED: {
poses[0] = 0; poses[1] = 1; poses[2] = 2; poses[3] = 3; poses[4] = 4;
postprocessor = new KisTIFFPostProcessor(nbcolorsamples);
}
break;
default:
break;
}
// Initisalize tiffReader
uint16 * lineSizeCoeffs = new uint16[nbchannels];
uint16 vsubsampling = 1;
uint16 hsubsampling = 1;
for (uint i = 0; i < nbchannels; i++) {
lineSizeCoeffs[i] = 1;
}
if (color_type == PHOTOMETRIC_PALETTE) {
uint16 *red; // No need to free them they are free by libtiff
uint16 *green;
uint16 *blue;
if ((TIFFGetField(image, TIFFTAG_COLORMAP, &red, &green, &blue)) == 0) {
dbgFile << "Indexed image does not define a palette";
TIFFClose(image);
delete [] lineSizeCoeffs;
return KisImageBuilder_RESULT_INVALID_ARG;
}
tiffReader = new KisTIFFReaderFromPalette(layer->paintDevice(), red, green, blue, poses, alphapos, depth, sampletype, nbcolorsamples, extrasamplescount, transform, postprocessor);
} else if (color_type == PHOTOMETRIC_YCBCR) {
TIFFGetFieldDefaulted(image, TIFFTAG_YCBCRSUBSAMPLING, &hsubsampling, &vsubsampling);
lineSizeCoeffs[1] = hsubsampling;
lineSizeCoeffs[2] = hsubsampling;
uint16 position;
TIFFGetFieldDefaulted(image, TIFFTAG_YCBCRPOSITIONING, &position);
if (dstDepth == 8) {
tiffReader = new KisTIFFYCbCrReaderTarget8Bit(layer->paintDevice(), layer->image()->width(), layer->image()->height(), poses, alphapos, depth, sampletype, nbcolorsamples, extrasamplescount, transform, postprocessor, hsubsampling, vsubsampling, (KisTIFFYCbCr::Position)position);
}
else if (dstDepth == 16) {
tiffReader = new KisTIFFYCbCrReaderTarget16Bit(layer->paintDevice(), layer->image()->width(), layer->image()->height(), poses, alphapos, depth, sampletype, nbcolorsamples, extrasamplescount, transform, postprocessor, hsubsampling, vsubsampling, (KisTIFFYCbCr::Position)position);
}
}
else if (dstDepth == 8) {
tiffReader = new KisTIFFReaderTarget8bit(layer->paintDevice(), poses, alphapos, depth, sampletype, nbcolorsamples, extrasamplescount, transform, postprocessor);
}
else if (dstDepth == 16) {
uint16 alphaValue;
if (sampletype == SAMPLEFORMAT_IEEEFP)
{
alphaValue = 15360; // representation of 1.0 in half
} else {
alphaValue = quint16_MAX;
}
tiffReader = new KisTIFFReaderTarget16bit(layer->paintDevice(), poses, alphapos, depth, sampletype, nbcolorsamples, extrasamplescount, transform, postprocessor, alphaValue);
}
else if (dstDepth == 32) {
union {
float f;
uint32 i;
} alphaValue;
if (sampletype == SAMPLEFORMAT_IEEEFP)
{
alphaValue.f = 1.0f;
} else {
alphaValue.i = quint32_MAX;
}
tiffReader = new KisTIFFReaderTarget32bit(layer->paintDevice(), poses, alphapos, depth, sampletype, nbcolorsamples, extrasamplescount, transform, postprocessor, alphaValue.i);
}
if (!tiffReader) {
delete postprocessor;
delete[] lineSizeCoeffs;
TIFFClose(image);
dbgFile << "Image has an invalid/unsupported color type: " << color_type;
return KisImageBuilder_RESULT_INVALID_ARG;
}
if (TIFFIsTiled(image)) {
dbgFile << "tiled image";
uint32 tileWidth, tileHeight;
uint32 x, y;
TIFFGetField(image, TIFFTAG_TILEWIDTH, &tileWidth);
TIFFGetField(image, TIFFTAG_TILELENGTH, &tileHeight);
uint32 linewidth = (tileWidth * depth * nbchannels) / 8;
if (planarconfig == PLANARCONFIG_CONTIG) {
buf = _TIFFmalloc(TIFFTileSize(image));
if (depth < 16) {
tiffstream = new KisBufferStreamContigBelow16((uint8*)buf, depth, linewidth);
}
else if (depth < 32) {
tiffstream = new KisBufferStreamContigBelow32((uint8*)buf, depth, linewidth);
}
else {
tiffstream = new KisBufferStreamContigAbove32((uint8*)buf, depth, linewidth);
}
}
else {
ps_buf = new tdata_t[nbchannels];
uint32 * lineSizes = new uint32[nbchannels];
tmsize_t baseSize = TIFFTileSize(image) / nbchannels;
for (uint i = 0; i < nbchannels; i++) {
ps_buf[i] = _TIFFmalloc(baseSize);
lineSizes[i] = tileWidth; // baseSize / lineSizeCoeffs[i];
}
tiffstream = new KisBufferStreamSeperate((uint8**) ps_buf, nbchannels, depth, lineSizes);
delete [] lineSizes;
}
dbgFile << linewidth << "" << nbchannels << "" << layer->paintDevice()->colorSpace()->colorChannelCount();
for (y = 0; y < height; y += tileHeight) {
for (x = 0; x < width; x += tileWidth) {
dbgFile << "Reading tile x =" << x << " y =" << y;
if (planarconfig == PLANARCONFIG_CONTIG) {
TIFFReadTile(image, buf, x, y, 0, (tsample_t) - 1);
}
else {
for (uint i = 0; i < nbchannels; i++) {
TIFFReadTile(image, ps_buf[i], x, y, 0, i);
}
}
uint32 realTileWidth = (x + tileWidth) < width ? tileWidth : width - x;
for (uint yintile = 0; y + yintile < height && yintile < tileHeight / vsubsampling;) {
tiffReader->copyDataToChannels(x, y + yintile , realTileWidth, tiffstream);
yintile += 1;
tiffstream->moveToLine(yintile);
}
tiffstream->restart();
}
}
}
else {
dbgFile << "striped image";
tsize_t stripsize = TIFFStripSize(image);
uint32 rowsPerStrip;
TIFFGetFieldDefaulted(image, TIFFTAG_ROWSPERSTRIP, &rowsPerStrip);
dbgFile << rowsPerStrip << "" << height;
rowsPerStrip = qMin(rowsPerStrip, height); // when TIFFNumberOfStrips(image) == 1 it might happen that rowsPerStrip is incorrectly set
if (planarconfig == PLANARCONFIG_CONTIG) {
buf = _TIFFmalloc(stripsize);
if (depth < 16) {
tiffstream = new KisBufferStreamContigBelow16((uint8*)buf, depth, stripsize / rowsPerStrip);
}
else if (depth < 32) {
tiffstream = new KisBufferStreamContigBelow32((uint8*)buf, depth, stripsize / rowsPerStrip);
}
else {
tiffstream = new KisBufferStreamContigAbove32((uint8*)buf, depth, stripsize / rowsPerStrip);
}
}
else {
ps_buf = new tdata_t[nbchannels];
uint32 scanLineSize = stripsize / rowsPerStrip;
dbgFile << " scanLineSize for each plan =" << scanLineSize;
uint32 * lineSizes = new uint32[nbchannels];
for (uint i = 0; i < nbchannels; i++) {
ps_buf[i] = _TIFFmalloc(stripsize);
lineSizes[i] = scanLineSize / lineSizeCoeffs[i];
}
tiffstream = new KisBufferStreamSeperate((uint8**) ps_buf, nbchannels, depth, lineSizes);
delete [] lineSizes;
}
dbgFile << "Scanline size =" << TIFFRasterScanlineSize(image) << " / strip size =" << TIFFStripSize(image) << " / rowsPerStrip =" << rowsPerStrip << " stripsize/rowsPerStrip =" << stripsize / rowsPerStrip;
uint32 y = 0;
dbgFile << " NbOfStrips =" << TIFFNumberOfStrips(image) << " rowsPerStrip =" << rowsPerStrip << " stripsize =" << stripsize;
for (uint32 strip = 0; y < height; strip++) {
if (planarconfig == PLANARCONFIG_CONTIG) {
TIFFReadEncodedStrip(image, TIFFComputeStrip(image, y, 0) , buf, (tsize_t) - 1);
}
else {
for (uint i = 0; i < nbchannels; i++) {
TIFFReadEncodedStrip(image, TIFFComputeStrip(image, y, i), ps_buf[i], (tsize_t) - 1);
}
}
for (uint32 yinstrip = 0 ; yinstrip < rowsPerStrip && y < height ;) {
uint linesread = tiffReader->copyDataToChannels(0, y, width, tiffstream);
y += linesread;
yinstrip += linesread;
tiffstream->moveToLine(yinstrip);
}
tiffstream->restart();
}
}
tiffReader->finalize();
delete[] lineSizeCoeffs;
delete tiffReader;
delete tiffstream;
if (planarconfig == PLANARCONFIG_CONTIG) {
_TIFFfree(buf);
} else {
for (uint i = 0; i < nbchannels; i++) {
_TIFFfree(ps_buf[i]);
}
delete[] ps_buf;
}
m_image->addNode(KisNodeSP(layer), m_image->rootLayer().data());
return KisImageBuilder_RESULT_OK;
}
KisImageBuilder_Result KisTIFFConverter::buildImage(const QString &filename)
{
return decode(filename);
}
KisImageSP KisTIFFConverter::image()
{
return m_image;
}
KisImageBuilder_Result KisTIFFConverter::buildFile(const QString &filename, KisImageSP kisimage, KisTIFFOptions options)
{
dbgFile << "Start writing TIFF File";
if (!kisimage)
return KisImageBuilder_RESULT_EMPTY;
// Open file for writing
TIFF *image;
if ((image = TIFFOpen(QFile::encodeName(filename), "w")) == 0) {
dbgFile << "Could not open the file for writing" << filename;
TIFFClose(image);
return (KisImageBuilder_RESULT_FAILURE);
}
// Set the document information
KoDocumentInfo * info = m_doc->documentInfo();
QString title = info->aboutInfo("title");
if (!title.isEmpty()) {
TIFFSetField(image, TIFFTAG_DOCUMENTNAME, title.toLatin1().constData());
}
QString abstract = info->aboutInfo("description");
if (!abstract.isEmpty()) {
TIFFSetField(image, TIFFTAG_IMAGEDESCRIPTION, abstract.toLatin1().constData());
}
QString author = info->authorInfo("creator");
if (!author.isEmpty()) {
TIFFSetField(image, TIFFTAG_ARTIST, author.toLatin1().constData());
}
dbgFile << "xres: " << INCH_TO_POINT(kisimage->xRes()) << " yres: " << INCH_TO_POINT(kisimage->yRes());
TIFFSetField(image, TIFFTAG_XRESOLUTION, INCH_TO_POINT(kisimage->xRes())); // It is the "invert" macro because we convert from pointer-per-inchs to points
TIFFSetField(image, TIFFTAG_YRESOLUTION, INCH_TO_POINT(kisimage->yRes()));
KisGroupLayer* root = dynamic_cast<KisGroupLayer*>(kisimage->rootLayer().data());
if (root == 0) {
TIFFClose(image);
return KisImageBuilder_RESULT_FAILURE;
}
KisTIFFWriterVisitor* visitor = new KisTIFFWriterVisitor(image, &options);
if (!visitor->visit(root)) {
TIFFClose(image);
return KisImageBuilder_RESULT_FAILURE;
}
TIFFClose(image);
return KisImageBuilder_RESULT_OK;
}
void KisTIFFConverter::cancel()
{
m_stop = true;
}
diff --git a/plugins/impex/tiff/kis_tiff_converter.h b/plugins/impex/tiff/kis_tiff_converter.h
index 6bffa66ab4..0373c5ea94 100644
--- a/plugins/impex/tiff/kis_tiff_converter.h
+++ b/plugins/impex/tiff/kis_tiff_converter.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2005-2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TIFF_CONVERTER_H_
#define _KIS_TIFF_CONVERTER_H_
#include <stdio.h>
#include <tiffio.h>
#include <QVector>
#include "kis_types.h"
#include "kis_global.h"
#include "kis_annotation.h"
#include <KisImageBuilderResult.h>
class KisDocument;
struct KisTIFFOptions {
quint16 compressionType = 0;
quint16 predictor = 1;
bool alpha = true;
bool flatten = true;
quint16 jpegQuality = 80;
quint16 deflateCompress = 6;
quint16 faxMode = 1;
quint16 pixarLogCompress = 6;
bool saveProfile = true;
KisPropertiesConfigurationSP toProperties() const;
void fromProperties(KisPropertiesConfigurationSP cfg);
};
class KisTIFFConverter : public QObject
{
Q_OBJECT
public:
KisTIFFConverter(KisDocument *doc);
- virtual ~KisTIFFConverter();
+ ~KisTIFFConverter() override;
public:
KisImageBuilder_Result buildImage(const QString &filename);
KisImageBuilder_Result buildFile(const QString &filename, KisImageSP layer, KisTIFFOptions);
/** Retrieve the constructed image
*/
KisImageSP image();
public Q_SLOTS:
virtual void cancel();
private:
KisImageBuilder_Result decode(const QString &filename);
KisImageBuilder_Result readTIFFDirectory(TIFF* image);
private:
KisImageSP m_image;
KisDocument *m_doc;
bool m_stop;
};
#endif
diff --git a/plugins/impex/tiff/kis_tiff_export.h b/plugins/impex/tiff/kis_tiff_export.h
index 1798e59170..7a3d024719 100644
--- a/plugins/impex/tiff/kis_tiff_export.h
+++ b/plugins/impex/tiff/kis_tiff_export.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TIFF_EXPORT_H_
#define _KIS_TIFF_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
#include <kis_config_widget.h>
class KisTIFFExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisTIFFExport(QObject *parent, const QVariantList &);
- virtual ~KisTIFFExport();
- virtual bool supportsIO() const { return false; }
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
- void initializeCapabilities();
+ ~KisTIFFExport() override;
+ bool supportsIO() const override { return false; }
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
+ void initializeCapabilities() override;
};
#endif
diff --git a/plugins/impex/tiff/kis_tiff_import.h b/plugins/impex/tiff/kis_tiff_import.h
index 78b85bd6ef..03d54f6be8 100644
--- a/plugins/impex/tiff/kis_tiff_import.h
+++ b/plugins/impex/tiff/kis_tiff_import.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TIFF_IMPORT_H_
#define _KIS_TIFF_IMPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisTIFFImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisTIFFImport(QObject *parent, const QVariantList &);
- virtual ~KisTIFFImport();
- virtual bool supportsIO() const { return false; }
+ ~KisTIFFImport() override;
+ bool supportsIO() const override { return false; }
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/impex/tiff/kis_tiff_reader.h b/plugins/impex/tiff/kis_tiff_reader.h
index 50a1879a6f..36ae3237d0 100644
--- a/plugins/impex/tiff/kis_tiff_reader.h
+++ b/plugins/impex/tiff/kis_tiff_reader.h
@@ -1,244 +1,244 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TIFF_READER_H_
#define _KIS_TIFF_READER_H_
// On some platforms, tiffio.h #defines 0 in a bad
// way for C++, as (void *)0 instead of using the correct
// C++ value 0. Include stdio.h first to get the right one.
#include <stdio.h>
#include <tiffio.h>
#include <kis_paint_device.h>
#include <kis_types.h>
#include <kis_global.h>
#define quint32_MAX 4294967295u
class KisBufferStreamBase;
class KisTIFFPostProcessor
{
public:
KisTIFFPostProcessor(uint8 nbcolorssamples) : m_nbcolorssamples(nbcolorssamples) { }
virtual ~KisTIFFPostProcessor() {}
public:
virtual void postProcess8bit(quint8*) { }
virtual void postProcess16bit(quint16*) { }
virtual void postProcess32bit(quint32*) { }
protected:
inline uint8 nbColorsSamples() {
return m_nbcolorssamples;
}
private:
uint8 m_nbcolorssamples;
};
class KisTIFFPostProcessorInvert : public KisTIFFPostProcessor
{
public:
KisTIFFPostProcessorInvert(uint8 nbcolorssamples) : KisTIFFPostProcessor(nbcolorssamples) {}
- virtual ~KisTIFFPostProcessorInvert() {}
+ ~KisTIFFPostProcessorInvert() override {}
public:
- virtual void postProcess8bit(quint8* data) {
+ void postProcess8bit(quint8* data) override {
for (int i = 0; i < nbColorsSamples(); i++) {
data[i] = quint8_MAX - data[i];
}
}
- virtual void postProcess16bit(quint16* data) {
+ void postProcess16bit(quint16* data) override {
quint16* d = (quint16*) data;
for (int i = 0; i < nbColorsSamples(); i++) {
d[i] = quint16_MAX - d[i];
}
}
- virtual void postProcess32bit(quint32* data) {
+ void postProcess32bit(quint32* data) override {
quint32* d = (quint32*) data;
for (int i = 0; i < nbColorsSamples(); i++) {
d[i] = quint32_MAX - d[i];
}
}
};
class KisTIFFPostProcessorCIELABtoICCLAB : public KisTIFFPostProcessor
{
public:
KisTIFFPostProcessorCIELABtoICCLAB(uint8 nbcolorssamples) : KisTIFFPostProcessor(nbcolorssamples) {}
- virtual ~KisTIFFPostProcessorCIELABtoICCLAB() {}
+ ~KisTIFFPostProcessorCIELABtoICCLAB() override {}
public:
- void postProcess8bit(quint8* data) {
+ void postProcess8bit(quint8* data) override {
qint8* ds = (qint8*) data;
for (int i = 1; i < nbColorsSamples(); i++) {
ds[i] = data[i] + quint8_MAX / 2;
}
}
- void postProcess16bit(quint16* data) {
+ void postProcess16bit(quint16* data) override {
quint16* d = (quint16*) data;
qint16* ds = (qint16*) data;
for (int i = 1; i < nbColorsSamples(); i++) {
ds[i] = d[i] + quint16_MAX / 2;
}
}
- void postProcess32bit(quint32* data) {
+ void postProcess32bit(quint32* data) override {
quint32* d = (quint32*) data;
qint32* ds = (qint32*) data;
for (int i = 1; i < nbColorsSamples(); i++) {
ds[i] = d[i] + quint32_MAX / 2;
}
}
};
class KisTIFFReaderBase
{
public:
KisTIFFReaderBase(KisPaintDeviceSP device, quint8* poses, int8 alphapos, uint8 sourceDepth,
uint16 sample_format, uint8 nbcolorssamples, uint8 extrasamplescount,
KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor)
: m_device(device)
, m_alphapos(alphapos)
, m_sourceDepth(sourceDepth)
, m_sample_format(sample_format)
, m_nbcolorssamples(nbcolorssamples)
, m_nbextrasamples(extrasamplescount)
, m_poses(poses)
, m_transformProfile(transformProfile)
, m_postprocess(postprocessor)
{
}
virtual ~KisTIFFReaderBase() {}
public:
/**
* This function copy data from the tiff stream to the paint device starting at the given position.
* @param x horizontal start position
* @param y vertical start position
* @param dataWidth width of the data to copy
* @param tiffstream source of data
*
* @return the number of line which were copied
*/
virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) = 0;
/**
* This function is called when all data has been read and should be used for any postprocessing.
*/
virtual void finalize() { }
protected:
inline KisPaintDeviceSP paintDevice() {
return m_device;
}
inline quint8 alphaPos() {
return m_alphapos;
}
inline quint8 sourceDepth() {
return m_sourceDepth;
}
inline uint16 sampleFormat() {
return m_sample_format;
}
inline quint8 nbColorsSamples() {
return m_nbcolorssamples;
}
inline quint8 nbExtraSamples() {
return m_nbextrasamples;
}
inline quint8* poses() {
return m_poses;
}
inline KoColorTransformation* transform() {
return m_transformProfile;
}
inline KisTIFFPostProcessor* postProcessor() {
return m_postprocess;
}
private:
KisPaintDeviceSP m_device;
qint8 m_alphapos;
quint8 m_sourceDepth;
uint16 m_sample_format;
quint8 m_nbcolorssamples;
quint8 m_nbextrasamples;
quint8* m_poses;
KoColorTransformation* m_transformProfile;
KisTIFFPostProcessor* m_postprocess;
};
class KisTIFFReaderTarget8bit : public KisTIFFReaderBase
{
public:
KisTIFFReaderTarget8bit(KisPaintDeviceSP device, quint8* poses, int8 alphapos, uint8 sourceDepth, uint16 sample_format, uint8 nbcolorssamples, uint8 extrasamplescount, KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor)
: KisTIFFReaderBase(device, poses, alphapos, sourceDepth, sample_format, nbcolorssamples, extrasamplescount, transformProfile, postprocessor)
{
}
public:
- virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream);
+ uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) override;
};
class KisTIFFReaderTarget16bit : public KisTIFFReaderBase
{
public:
KisTIFFReaderTarget16bit(KisPaintDeviceSP device, quint8* poses, int8 alphapos, uint8 sourceDepth, uint16 sample_format, uint8 nbcolorssamples, uint8 extrasamplescount, KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor, uint16 _alphaValue)
: KisTIFFReaderBase(device, poses, alphapos, sourceDepth, sample_format, nbcolorssamples, extrasamplescount, transformProfile, postprocessor),
m_alphaValue(_alphaValue)
{
}
public:
- virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) ;
+ uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) override ;
private:
uint16 m_alphaValue;
};
class KisTIFFReaderTarget32bit : public KisTIFFReaderBase
{
public:
KisTIFFReaderTarget32bit(KisPaintDeviceSP device, quint8* poses, int8 alphapos, uint8 sourceDepth, uint16 sample_format, uint8 nbcolorssamples, uint8 extrasamplescount, KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor, uint32 _alphaValue)
: KisTIFFReaderBase(device, poses, alphapos, sourceDepth, sample_format, nbcolorssamples, extrasamplescount, transformProfile, postprocessor),
m_alphaValue(_alphaValue)
{
}
public:
- virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) ;
+ uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) override ;
private:
uint32 m_alphaValue;
};
class KisTIFFReaderFromPalette : public KisTIFFReaderBase
{
public:
KisTIFFReaderFromPalette(KisPaintDeviceSP device, uint16 *red, uint16 *green, uint16 *blue, quint8* poses, int8 alphapos, uint8 sourceDepth, uint16 sample_format, uint8 nbcolorssamples, uint8 extrasamplescount, KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor)
: KisTIFFReaderBase(device, poses, alphapos, sourceDepth, sample_format, nbcolorssamples, extrasamplescount, transformProfile, postprocessor), m_red(red), m_green(green), m_blue(blue)
{
}
public:
- virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) ;
+ uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) override ;
private:
uint16 *m_red, *m_green, *m_blue;
};
#endif
diff --git a/plugins/impex/tiff/kis_tiff_writer_visitor.h b/plugins/impex/tiff/kis_tiff_writer_visitor.h
index a41c9f14ea..0c1604dd12 100644
--- a/plugins/impex/tiff/kis_tiff_writer_visitor.h
+++ b/plugins/impex/tiff/kis_tiff_writer_visitor.h
@@ -1,120 +1,120 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TIFF_WRITER_VISITOR_H
#define KIS_TIFF_WRITER_VISITOR_H
#include <kis_node_visitor.h>
#include "kis_types.h"
#include <tiffio.h>
#include <kis_annotation.h>
#include <kis_paint_device.h>
#include <kis_group_layer.h>
#include <kis_generator_layer.h>
#include <kis_clone_layer.h>
#include <kis_external_layer_iface.h>
#include <kis_adjustment_layer.h>
#include <kis_image.h>
#include <kis_paint_layer.h>
#include <kis_types.h>
#include <generator/kis_generator_layer.h>
#include "kis_tiff_converter.h"
#include <kis_iterator_ng.h>
#include <kis_shape_layer.h>
struct KisTIFFOptions;
/**
@author Cyrille Berger <cberger@cberger.net>
*/
class KisTIFFWriterVisitor : public KisNodeVisitor
{
public:
using KisNodeVisitor::visit;
KisTIFFWriterVisitor(TIFF*image, KisTIFFOptions* options);
- ~KisTIFFWriterVisitor();
+ ~KisTIFFWriterVisitor() override;
public:
- bool visit(KisNode*) {
+ bool visit(KisNode*) override {
return true;
}
- bool visit(KisPaintLayer *layer) {
+ bool visit(KisPaintLayer *layer) override {
return saveLayerProjection(layer);
}
- bool visit(KisGroupLayer *layer) {
+ bool visit(KisGroupLayer *layer) override {
dbgFile << "Visiting on grouplayer" << layer->name() << "";
return visitAll(layer, true);
}
- bool visit(KisGeneratorLayer *layer) {
+ bool visit(KisGeneratorLayer *layer) override {
return saveLayerProjection(layer);
}
- bool visit(KisCloneLayer *layer) {
+ bool visit(KisCloneLayer *layer) override {
return saveLayerProjection(layer);
}
- bool visit(KisExternalLayer *layer) {
+ bool visit(KisExternalLayer *layer) override {
return saveLayerProjection(layer);
}
- bool visit(KisAdjustmentLayer *layer) {
+ bool visit(KisAdjustmentLayer *layer) override {
return saveLayerProjection(layer);
}
- bool visit(KisFilterMask*) {
+ bool visit(KisFilterMask*) override {
return true;
}
- bool visit(KisTransformMask*) {
+ bool visit(KisTransformMask*) override {
return true;
}
- bool visit(KisTransparencyMask*) {
+ bool visit(KisTransparencyMask*) override {
return true;
}
- bool visit(KisSelectionMask*) {
+ bool visit(KisSelectionMask*) override {
return true;
}
- bool visit(KisColorizeMask*) {
+ bool visit(KisColorizeMask*) override {
return true;
}
private:
inline TIFF* image() {
return m_image;
}
bool copyDataToStrips(KisHLineConstIteratorSP it, tdata_t buff, uint8 depth, uint16 sample_format, uint8 nbcolorssamples, quint8* poses);
bool saveLayerProjection(KisLayer *);
private:
TIFF* m_image;
KisTIFFOptions* m_options;
};
#endif
diff --git a/plugins/impex/tiff/kis_tiff_ycbcr_reader.h b/plugins/impex/tiff/kis_tiff_ycbcr_reader.h
index 93a19d5233..a56f25ba32 100644
--- a/plugins/impex/tiff/kis_tiff_ycbcr_reader.h
+++ b/plugins/impex/tiff/kis_tiff_ycbcr_reader.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TIFF_YCBCR_READER_H_
#define _KIS_TIFF_YCBCR_READER_H_
#include "kis_tiff_reader.h"
namespace KisTIFFYCbCr
{
enum Position {
POSITION_CENTERED = 1,
POSITION_COSITED = 2
};
}
class KisTIFFYCbCrReaderTarget8Bit : public KisTIFFReaderBase
{
public:
/**
* @param hsub horizontal subsampling of Cb and Cr
* @param hsub vertical subsampling of Cb and Cr
*/
KisTIFFYCbCrReaderTarget8Bit(KisPaintDeviceSP device, quint32 width, quint32 height, quint8* poses,
int8 alphapos, uint8 sourceDepth, uint16 sampleformat, uint8 nbcolorssamples, uint8 extrasamplescount,
KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor, uint16 hsub, uint16 vsub,
KisTIFFYCbCr::Position position);
- ~KisTIFFYCbCrReaderTarget8Bit();
- virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream);
- virtual void finalize();
+ ~KisTIFFYCbCrReaderTarget8Bit() override;
+ uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) override;
+ void finalize() override;
private:
quint8* m_bufferCb;
quint8* m_bufferCr;
quint32 m_bufferWidth, m_bufferHeight;
uint16 m_hsub;
uint16 m_vsub;
KisTIFFYCbCr::Position m_position;
quint32 m_imageWidth, m_imageHeight;
};
class KisTIFFYCbCrReaderTarget16Bit : public KisTIFFReaderBase
{
public:
/**
* @param hsub horizontal subsampling of Cb and Cr
* @param hsub vertical subsampling of Cb and Cr
*/
KisTIFFYCbCrReaderTarget16Bit(KisPaintDeviceSP device, quint32 width, quint32 height, quint8* poses,
int8 alphapos, uint8 sourceDepth, uint16 sampleformat, uint8 nbcolorssamples, uint8 extrasamplescount,
KoColorTransformation* transformProfile, KisTIFFPostProcessor* postprocessor, uint16 hsub, uint16 vsub,
KisTIFFYCbCr::Position position);
- ~KisTIFFYCbCrReaderTarget16Bit();
- virtual uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream);
- virtual void finalize();
+ ~KisTIFFYCbCrReaderTarget16Bit() override;
+ uint copyDataToChannels(quint32 x, quint32 y, quint32 dataWidth, KisBufferStreamBase* tiffstream) override;
+ void finalize() override;
private:
quint16* m_bufferCb;
quint16* m_bufferCr;
quint32 m_bufferWidth, m_bufferHeight;
uint16 m_hsub;
uint16 m_vsub;
KisTIFFYCbCr::Position m_position;
quint32 m_imageWidth, m_imageHeight;
};
#endif
diff --git a/plugins/impex/video/kis_video_export.h b/plugins/impex/video/kis_video_export.h
index c844c23a49..8d20e68692 100644
--- a/plugins/impex/video/kis_video_export.h
+++ b/plugins/impex/video/kis_video_export.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_VIDEO_EXPORT_H_
#define _KIS_VIDEO_EXPORT_H_
#include <QVariant>
#include <KisImportExportFilter.h>
class KisVideoExport : public KisImportExportFilter
{
Q_OBJECT
public:
KisVideoExport(QObject *parent, const QVariantList &);
- virtual ~KisVideoExport();
+ ~KisVideoExport() override;
public:
- virtual bool supportsIO() const { return false; }
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ bool supportsIO() const override { return false; }
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
- KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from, const QByteArray& to) const;
- KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
+ KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from, const QByteArray& to) const override;
+ KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const override;
};
#endif
diff --git a/plugins/impex/video/video_export_options_dialog.h b/plugins/impex/video/video_export_options_dialog.h
index 4bc0763567..72b624b430 100644
--- a/plugins/impex/video/video_export_options_dialog.h
+++ b/plugins/impex/video/video_export_options_dialog.h
@@ -1,70 +1,70 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef VIDEO_EXPORT_OPTIONS_DIALOG_H
#define VIDEO_EXPORT_OPTIONS_DIALOG_H
#include <kis_config_widget.h>
#include <kis_properties_configuration.h>
#include "video_saver.h"
#include <QScopedPointer>
namespace Ui {
class VideoExportOptionsDialog;
}
class VideoExportOptionsDialog : public KisConfigWidget
{
Q_OBJECT
public:
enum CodecIndex {
CODEC_H264 = 0,
CODEC_THEORA
};
public:
explicit VideoExportOptionsDialog(QWidget *parent = 0);
- ~VideoExportOptionsDialog();
+ ~VideoExportOptionsDialog() override;
void setCodec(CodecIndex index);
QStringList customUserOptions() const;
- void setConfiguration(const KisPropertiesConfigurationSP config);
- KisPropertiesConfigurationSP configuration() const;
+ void setConfiguration(const KisPropertiesConfigurationSP config) override;
+ KisPropertiesConfigurationSP configuration() const override;
private Q_SLOTS:
void slotCustomLineToggled(bool value);
void slotSaveCustomLine();
void slotResetCustomLine();
private:
Ui::VideoExportOptionsDialog *ui;
private:
QStringList generateCustomLine() const;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif // VIDEO_EXPORT_OPTIONS_DIALOG_H
diff --git a/plugins/impex/video/video_saver.cpp b/plugins/impex/video/video_saver.cpp
index c1d88794b5..475cb8eb2b 100644
--- a/plugins/impex/video/video_saver.cpp
+++ b/plugins/impex/video/video_saver.cpp
@@ -1,330 +1,331 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "video_saver.h"
#include <QDebug>
#include <QFileInfo>
#include <KisDocument.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorModelStandardIds.h>
#include <KoResourcePaths.h>
#include <kis_image.h>
#include <kis_image_animation_interface.h>
#include <kis_time_range.h>
#include "kis_config.h"
#include "kis_animation_exporter.h"
#include <QFileSystemWatcher>
#include <QProcess>
#include <QProgressDialog>
#include <QEventLoop>
#include <QTemporaryFile>
#include <QTemporaryDir>
#include <QTime>
#include "KisPart.h"
class KisFFMpegProgressWatcher : public QObject {
Q_OBJECT
public:
KisFFMpegProgressWatcher(QFile &progressFile, int totalFrames)
: m_progressFile(progressFile),
m_totalFrames(totalFrames)
{
connect(&m_progressWatcher, SIGNAL(fileChanged(QString)), SLOT(slotFileChanged()));
m_progressWatcher.addPath(m_progressFile.fileName());
}
private Q_SLOTS:
void slotFileChanged() {
int currentFrame = -1;
bool isEnded = false;
while(!m_progressFile.atEnd()) {
QString line = QString(m_progressFile.readLine()).remove(QChar('\n'));
QStringList var = line.split("=");
if (var[0] == "frame") {
currentFrame = var[1].toInt();
} else if (var[0] == "progress") {
isEnded = var[1] == "end";
}
}
if (isEnded) {
emit sigProgressChanged(100);
emit sigProcessingFinished();
} else {
emit sigProgressChanged(100 * currentFrame / m_totalFrames);
}
}
Q_SIGNALS:
void sigProgressChanged(int percent);
void sigProcessingFinished();
private:
QFileSystemWatcher m_progressWatcher;
QFile &m_progressFile;
int m_totalFrames;
};
class KisFFMpegRunner
{
public:
KisFFMpegRunner(const QString &ffmpegPath)
: m_cancelled(false),
m_ffmpegPath(ffmpegPath) {}
public:
KisImageBuilder_Result runFFMpeg(const QStringList &specialArgs,
const QString &actionName,
const QString &logPath,
int totalFrames)
{
dbgFile << "runFFMpeg: specialArgs" << specialArgs
<< "actionName" << actionName
<< "logPath" << logPath
<< "totalFrames" << totalFrames;
QTemporaryFile progressFile(QDir::tempPath() + QDir::separator() + "KritaFFmpegProgress.XXXXXX");
progressFile.open();
m_process.setStandardOutputFile(logPath);
m_process.setProcessChannelMode(QProcess::MergedChannels);
QStringList args;
args << "-v" << "debug"
<< "-nostdin"
<< "-progress" << progressFile.fileName()
<< specialArgs;
qDebug() << "\t" << m_ffmpegPath << args.join(" ");
m_cancelled = false;
m_process.start(m_ffmpegPath, args);
return waitForFFMpegProcess(actionName, progressFile, m_process, totalFrames);
}
void cancel() {
m_cancelled = true;
m_process.kill();
}
private:
KisImageBuilder_Result waitForFFMpegProcess(const QString &message,
QFile &progressFile,
QProcess &ffmpegProcess,
int totalFrames)
{
KisFFMpegProgressWatcher watcher(progressFile, totalFrames);
QProgressDialog progress(message, "", 0, 0, KisPart::instance()->currentMainwindow());
progress.setWindowModality(Qt::ApplicationModal);
progress.setCancelButton(0);
progress.setMinimumDuration(0);
progress.setValue(0);
progress.setRange(0, 100);
QEventLoop loop;
loop.connect(&watcher, SIGNAL(sigProcessingFinished()), SLOT(quit()));
loop.connect(&ffmpegProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(quit()));
loop.connect(&watcher, SIGNAL(sigProgressChanged(int)), &progress, SLOT(setValue(int)));
loop.exec();
// wait for some errorneous case
ffmpegProcess.waitForFinished(5000);
KisImageBuilder_Result retval = KisImageBuilder_RESULT_OK;
if (ffmpegProcess.state() != QProcess::NotRunning) {
// sorry...
ffmpegProcess.kill();
retval = KisImageBuilder_RESULT_FAILURE;
} else if (m_cancelled) {
retval = KisImageBuilder_RESULT_CANCEL;
} else if (ffmpegProcess.exitCode()) {
retval = KisImageBuilder_RESULT_FAILURE;
}
return retval;
}
private:
QProcess m_process;
bool m_cancelled;
QString m_ffmpegPath;
};
VideoSaver::VideoSaver(KisDocument *doc, const QString &ffmpegPath, bool batchMode)
: m_image(doc->image())
, m_doc(doc)
, m_batchMode(batchMode)
, m_ffmpegPath(ffmpegPath)
, m_runner(new KisFFMpegRunner(ffmpegPath))
{
}
VideoSaver::~VideoSaver()
{
}
KisImageSP VideoSaver::image()
{
return m_image;
}
bool VideoSaver::hasFFMpeg() const
{
return !m_ffmpegPath.isEmpty();
}
KisImageBuilder_Result VideoSaver::encode(const QString &filename, KisPropertiesConfigurationSP configuration)
{
qDebug() << "ffmpeg" << m_ffmpegPath << "filename" << filename << "configuration" << configuration->toXML();
if (m_ffmpegPath.isEmpty()) {
m_ffmpegPath = configuration->getString("ffmpeg_path");
if (!QFileInfo(m_ffmpegPath).exists()) {
return KisImageBuilder_RESULT_FAILURE;
}
}
KisImageBuilder_Result result = KisImageBuilder_RESULT_OK;
KisImageAnimationInterface *animation = m_image->animationInterface();
const KisTimeRange fullRange = animation->fullClipRange();
const int frameRate = animation->framerate();
KIS_SAFE_ASSERT_RECOVER_NOOP(configuration->hasProperty("first_frame"));
KIS_SAFE_ASSERT_RECOVER_NOOP(configuration->hasProperty("last_frame"));
KIS_SAFE_ASSERT_RECOVER_NOOP(configuration->hasProperty("include_audio"));
+ KIS_SAFE_ASSERT_RECOVER_NOOP(configuration->hasProperty("directory"));
const KisTimeRange clipRange(configuration->getInt("first_frame", fullRange.start()), configuration->getInt("last_frame", fullRange.end()));
const bool includeAudio = configuration->getBool("include_audio", true);
const QDir framesDir(configuration->getString("directory"));
QString resultFile;
if (QFileInfo(filename).isAbsolute()) {
resultFile = filename;
}
else {
resultFile = framesDir.absolutePath() + "/" + filename;
}
const QFileInfo info(resultFile);
const QString suffix = info.suffix().toLower();
const QString palettePath = framesDir.filePath("palette.png");
const QString savedFilesMask = configuration->getString("savedFilesMask");
const QStringList additionalOptionsList = configuration->getString("customUserOptions").split(' ', QString::SkipEmptyParts);
if (suffix == "gif") {
{
QStringList args;
args << "-r" << QString::number(frameRate)
<< "-start_number" << QString::number(clipRange.start())
<< "-i" << savedFilesMask
<< "-vf" << "palettegen"
<< "-y" << palettePath;
KisImageBuilder_Result result =
m_runner->runFFMpeg(args, i18n("Fetching palette..."),
framesDir.filePath("log_generate_palette_gif.log"),
clipRange.duration());
if (result != KisImageBuilder_RESULT_OK) {
return result;
}
}
{
QStringList args;
args << "-r" << QString::number(frameRate)
<< "-start_number" << QString::number(clipRange.start())
<< "-i" << savedFilesMask
<< "-i" << palettePath
<< "-lavfi" << "[0:v][1:v] paletteuse"
<< additionalOptionsList
<< "-y" << resultFile;
dbgFile << "savedFilesMask" << savedFilesMask << "start" << QString::number(clipRange.start()) << "duration" << clipRange.duration();
KisImageBuilder_Result result =
m_runner->runFFMpeg(args, i18n("Encoding frames..."),
framesDir.filePath("log_encode_gif.log"),
clipRange.duration());
if (result != KisImageBuilder_RESULT_OK) {
return result;
}
}
} else {
QStringList args;
args << "-r" << QString::number(frameRate)
<< "-start_number" << QString::number(clipRange.start())
<< "-i" << savedFilesMask;
QFileInfo audioFileInfo = animation->audioChannelFileName();
if (includeAudio && audioFileInfo.exists()) {
const int msecStart = clipRange.start() * 1000 / animation->framerate();
const int msecDuration = clipRange.duration() * 1000 / animation->framerate();
const QTime startTime = QTime::fromMSecsSinceStartOfDay(msecStart);
const QTime durationTime = QTime::fromMSecsSinceStartOfDay(msecDuration);
const QString ffmpegTimeFormat("H:m:s.zzz");
args << "-ss" << startTime.toString(ffmpegTimeFormat);
args << "-t" << durationTime.toString(ffmpegTimeFormat);
args << "-i" << audioFileInfo.absoluteFilePath();
}
args << additionalOptionsList
<< "-y" << resultFile;
result = m_runner->runFFMpeg(args, i18n("Encoding frames..."),
framesDir.filePath("log_encode.log"),
clipRange.duration());
}
return result;
}
void VideoSaver::cancel()
{
m_runner->cancel();
}
#include "video_saver.moc"
diff --git a/plugins/impex/video/video_saver.h b/plugins/impex/video/video_saver.h
index c94e01eb45..65acbd4332 100644
--- a/plugins/impex/video/video_saver.h
+++ b/plugins/impex/video/video_saver.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef VIDEO_SAVER_H_
#define VIDEO_SAVER_H_
#include <QObject>
#include "kis_types.h"
#include <kis_properties_configuration.h>
#include "KisImageBuilderResult.h"
#include "kritavideoexport_export.h"
class KisFFMpegRunner;
/* The KisImageBuilder_Result definitions come from kis_png_converter.h here */
class KisDocument;
class KRITAVIDEOEXPORT_EXPORT VideoSaver : public QObject {
Q_OBJECT
public:
VideoSaver(KisDocument* doc, const QString &ffmpegPath, bool batchMode);
- virtual ~VideoSaver();
+ ~VideoSaver() override;
KisImageSP image();
KisImageBuilder_Result encode(const QString &filename, KisPropertiesConfigurationSP configuration);
bool hasFFMpeg() const;
private Q_SLOTS:
void cancel();
private:
KisImageSP m_image;
KisDocument* m_doc;
bool m_batchMode;
QString m_ffmpegPath;
QScopedPointer<KisFFMpegRunner> m_runner;
};
#endif
diff --git a/plugins/impex/xcf/3rdparty/xcftools/pixels.c b/plugins/impex/xcf/3rdparty/xcftools/pixels.c
index 4247d94da9..d7037937c9 100644
--- a/plugins/impex/xcf/3rdparty/xcftools/pixels.c
+++ b/plugins/impex/xcf/3rdparty/xcftools/pixels.c
@@ -1,490 +1,491 @@
/* Pixel and tile functions for xcftools
*
* This file was written by Henning Makholm <henning@makholm.net>
* It is hereby in the public domain.
- *
+ *
* In jurisdictions that do not recognise grants of copyright to the
* public domain: I, the author and (presumably, in those jurisdictions)
* copyright holder, hereby permit anyone to distribute and use this code,
* in source code or binary form, with or without modifications. This
* permission is world-wide and irrevocable.
*
* Of course, I will not be liable for any errors or shortcomings in the
* code, since I give it away without asking any compenstations.
*
* If you use or distribute this code, I would appreciate receiving
* credit for writing it, in whichever way you find proper and customary.
*/
#define DEBUG
#include "xcftools.h"
#include "pixels.h"
#include <assert.h>
#include <string.h>
rgba colormap[256] ;
unsigned colormapLength=0 ;
int
degrayPixel(rgba pixel)
{
if( ((pixel >> RED_SHIFT) & 255) == ((pixel >> GREEN_SHIFT) & 255) &&
((pixel >> RED_SHIFT) & 255) == ((pixel >> BLUE_SHIFT) & 255) )
return (pixel >> RED_SHIFT) & 255 ;
return -1 ;
}
/* ****************************************************************** */
typedef const struct _convertParams {
int bpp ;
int shift[4] ;
uint32_t base_pixel ;
const rgba *lookup ;
} convertParams ;
#define RGB_SHIFT RED_SHIFT, GREEN_SHIFT, BLUE_SHIFT
#define OPAQUE (255 << ALPHA_SHIFT)
static convertParams convertRGB = { 3, {RGB_SHIFT}, OPAQUE, 0 };
static convertParams convertRGBA = { 4, {RGB_SHIFT, ALPHA_SHIFT}, 0,0 };
static convertParams convertGRAY = { 1, {-1}, OPAQUE, graytable };
static convertParams convertGRAYA = { 2, {-1,ALPHA_SHIFT}, 0, graytable };
static convertParams convertINDEXED = { 1, {-1}, OPAQUE, colormap };
static convertParams convertINDEXEDA = { 2, {-1,ALPHA_SHIFT}, 0, colormap };
static convertParams convertColormap = { 3, {RGB_SHIFT}, 0, 0 };
static convertParams convertChannel = { 1, {ALPHA_SHIFT}, 0, 0 };
/* ****************************************************************** */
static int
tileDirectoryOneLevel(struct tileDimensions *dim,uint32_t ptr)
{
if( ptr == 0 )
return 0 ;
if( xcfL(ptr ) != dim->c.r - dim->c.l ||
xcfL(ptr+4) != dim->c.b - dim->c.t )
FatalBadXCF("Drawable size mismatch at %" PRIX32, ptr);
return ptr += 8 ;
}
static void
initTileDirectory(struct tileDimensions *dim,struct xcfTiles *tiles,
const char *type)
{
uint32_t ptr ;
uint32_t data ;
ptr = tiles->hierarchy ;
tiles->hierarchy = 0 ;
if( (ptr = tileDirectoryOneLevel(dim,ptr)) == 0 ) return ;
if( tiles->params == &convertChannel ) {
/* A layer mask is a channel.
* Skip a name and a property list.
*/
xcfString(ptr,&ptr);
while( xcfNextprop(&ptr,&data) != PROP_END )
;
ptr = xcfOffset(ptr,4*4);
if( (ptr = tileDirectoryOneLevel(dim,ptr)) == 0 ) return ;
}
/* The XCF format has a dummy "hierarchy" level which was
* once meant to mean something, but never happened. It contains
* the bpp value and a list of "level" pointers; but only the
* first level actually contains data.
*/
data = xcfL(ptr) ;
if( xcfL(ptr) != tiles->params->bpp )
FatalBadXCF("%"PRIu32" bytes per pixel for %s drawable",xcfL(ptr),type);
ptr = xcfOffset(ptr+4,3*4) ;
if( (ptr = tileDirectoryOneLevel(dim,ptr)) == 0 ) return ;
xcfCheckspace(ptr,dim->ntiles*4+4,"Tile directory at %" PRIX32,ptr);
- if( xcfL(ptr + dim->ntiles*4) != 0 )
- FatalBadXCF("Wrong sized tile directory at %" PRIX32,ptr);
+/* if( xcfL(ptr + dim->ntiles*4) != 0 )
+ FatalBadXCF("Wrong sized tile directory at %" PRIX32,ptr);*/
+
#define REUSE_RAW_DATA tiles->tileptrs = (uint32_t*)(xcf_file + ptr)
#if defined(WORDS_BIGENDIAN) && defined(CAN_DO_UNALIGNED_WORDS)
REUSE_RAW_DATA;
#else
# if defined(WORDS_BIGENDIAN)
if( (ptr&3) == 0 ) REUSE_RAW_DATA; else
# endif
{
unsigned i ;
tiles->tileptrs = xcfmalloc(dim->ntiles * sizeof(uint32_t)) ;
for( i = 0 ; i < dim->ntiles ; i++ )
tiles->tileptrs[i] = xcfL(ptr+i*4);
}
#endif
}
void
initLayer(struct xcfLayer *layer) {
if( layer->dim.ntiles == 0 ||
(layer->pixels.hierarchy == 0 && layer->mask.hierarchy == 0) )
return ;
switch(layer->type) {
#define DEF(X) case GIMP_##X##_IMAGE: layer->pixels.params = &convert##X; break
DEF(RGB);
DEF(RGBA);
DEF(GRAY);
DEF(GRAYA);
DEF(INDEXED);
DEF(INDEXEDA);
default:
FatalUnsupportedXCF(_("Layer type %s"),_(showGimpImageType(layer->type)));
}
initTileDirectory(&layer->dim,&layer->pixels,
_(showGimpImageType(layer->type)));
layer->mask.params = &convertChannel ;
initTileDirectory(&layer->dim,&layer->mask,"layer mask");
}
static void copyStraightPixels(rgba *dest,unsigned npixels,
uint32_t ptr,convertParams *params);
void
initColormap(void) {
uint32_t ncolors ;
if( XCF.colormapptr == 0 ) {
colormapLength = 0 ;
return ;
}
ncolors = xcfL(XCF.colormapptr) ;
if( ncolors > 256 )
FatalUnsupportedXCF(_("Color map has more than 256 entries"));
copyStraightPixels(colormap,ncolors,XCF.colormapptr+4,&convertColormap);
colormapLength = ncolors ;
#ifdef xDEBUG
{
unsigned j ;
fprintf(stderr,"Colormap decoding OK\n");
for( j = 0 ; j < ncolors ; j++ ) {
if( j % 8 == 0 ) fprintf(stderr,"\n");
fprintf(stderr," %08x",colormap[j]);
}
fprintf(stderr,"\n");
}
#endif
}
/* ****************************************************************** */
struct Tile *
newTile(struct rect r)
{
unsigned npixels = (unsigned)(r.b-r.t) * (unsigned)(r.r-r.l) ;
struct Tile *data
= xcfmalloc(sizeof(struct Tile) -
sizeof(rgba)*(TILE_HEIGHT*TILE_WIDTH - npixels)) ;
data->count = npixels ;
data->refcount = 1 ;
data->summary = 0 ;
return data ;
}
struct Tile *
forkTile(struct Tile* tile)
{
if( ++tile->refcount <= 0 )
FatalUnsupportedXCF(_("Unbelievably many layers?\n"
"More likely to be a bug in %s"),progname);
return tile ;
}
void
freeTile(struct Tile* tile)
{
if( --tile->refcount == 0 )
xcffree(tile) ;
}
summary_t
tileSummary(struct Tile *tile)
{
unsigned i ;
summary_t summary ;
if( (tile->summary & TILESUMMARY_UPTODATE) != 0 )
return tile->summary ;
summary = TILESUMMARY_ALLNULL + TILESUMMARY_ALLFULL + TILESUMMARY_CRISP ;
for( i=0; summary && i<tile->count; i++ ) {
if( FULLALPHA(tile->pixels[i]) )
summary &= ~TILESUMMARY_ALLNULL ;
else if( NULLALPHA(tile->pixels[i]) )
summary &= ~TILESUMMARY_ALLFULL ;
else
summary = 0 ;
}
summary += TILESUMMARY_UPTODATE ;
tile->summary = summary ;
return summary ;
}
-
+
void
fillTile(struct Tile *tile,rgba data)
{
unsigned i ;
for( i = 0 ; i < tile->count ; i++ )
tile->pixels[i] = data ;
if( FULLALPHA(data) )
tile->summary = TILESUMMARY_UPTODATE+TILESUMMARY_ALLFULL+TILESUMMARY_CRISP;
else if (NULLALPHA(data) )
tile->summary = TILESUMMARY_UPTODATE+TILESUMMARY_ALLNULL+TILESUMMARY_CRISP;
else
tile->summary = TILESUMMARY_UPTODATE ;
}
/* ****************************************************************** */
static void
copyStraightPixels(rgba *dest,unsigned npixels,
uint32_t ptr,convertParams *params)
{
unsigned bpp = params->bpp;
const rgba *lookup = params->lookup;
rgba base_pixel = params->base_pixel ;
uint8_t *bp = xcf_file + ptr ;
xcfCheckspace(ptr,bpp*npixels,
"pixel array (%u x %d bpp) at %"PRIX32,npixels,bpp,ptr);
while( npixels-- ) {
rgba pixel = base_pixel ;
unsigned i ;
for( i = 0 ; i < bpp ; i++ ) {
if( params->shift[i] < 0 ) {
pixel += lookup[*bp++] ;
} else {
pixel += *bp++ << params->shift[i] ;
}
}
*dest++ = pixel ;
}
}
static void
copyRLEpixels(rgba *dest,unsigned npixels,uint32_t ptr,convertParams *params)
{
unsigned i,j ;
rgba base_pixel = params->base_pixel ;
#ifdef xDEBUG
fprintf(stderr,"RLE stream at %x, want %u x %u pixels, base %x\n",
ptr,params->bpp,npixels,base_pixel);
#endif
-
+
/* This algorithm depends on the indexed byte always being the first one */
if( params->shift[0] < -1 )
base_pixel = 0 ;
for( j = npixels ; j-- ; )
dest[j] = base_pixel ;
for( i = 0 ; i < params->bpp ; i++ ) {
int shift = params->shift[i] ;
if( shift < 0 )
shift = 0 ;
for( j = 0 ; j < npixels ; ) {
int countspec ;
unsigned count ;
xcfCheckspace(ptr,2,"RLE data stream");
countspec = (int8_t) xcf_file[ptr++] ;
count = countspec >= 0 ? countspec+1 : -countspec ;
if( count == 128 ) {
xcfCheckspace(ptr,3,"RLE long count");
count = xcf_file[ptr++] << 8 ;
count += xcf_file[ptr++] ;
}
if( j + count > npixels )
FatalBadXCF("Overlong RLE run at %"PRIX32" (plane %u, %u left)",
ptr,i,npixels-j);
if( countspec >= 0 ) {
rgba data = (uint32_t) xcf_file[ptr++] << shift ;
while( count-- )
dest[j++] += data ;
} else {
while( count-- )
dest[j++] += (uint32_t) xcf_file[ptr++] << shift ;
}
}
if( i == 0 && params->shift[0] < 0 ) {
const rgba *lookup = params->lookup ;
base_pixel = params->base_pixel ;
for( j = npixels ; j-- ; ) {
dest[j] = lookup[dest[j]-base_pixel] + base_pixel ;
}
}
}
#ifdef xDEBUG
fprintf(stderr,"RLE decoding OK at %"PRIX32"\n",ptr);
/*
for( j = 0 ; j < npixels ; j++ ) {
if( j % 8 == 0 ) fprintf(stderr,"\n");
fprintf(stderr," %8x",dest[j]);
}
fprintf(stderr,"\n");
*/
#endif
}
static void
copyTilePixels(struct Tile *dest, uint32_t ptr,convertParams *params)
{
if( FULLALPHA(params->base_pixel) )
dest->summary = TILESUMMARY_UPTODATE+TILESUMMARY_ALLFULL+TILESUMMARY_CRISP;
else
dest->summary = 0 ;
switch( XCF.compression ) {
case COMPRESS_NONE:
copyStraightPixels(dest->pixels,dest->count,ptr,params);
break ;
case COMPRESS_RLE:
copyRLEpixels(dest->pixels,dest->count,ptr,params);
break ;
default:
FatalUnsupportedXCF(_("%s compression"),
_(showXcfCompressionType(XCF.compression)));
}
}
struct Tile *
getMaskOrLayerTile(struct tileDimensions *dim, struct xcfTiles *tiles,
struct rect want)
{
struct Tile *tile = newTile(want);
assert( want.l < want.r && want.t < want.b );
if( tiles->tileptrs == 0 ) {
fillTile(tile,0);
return tile ;
}
-
+
#ifdef xDEBUG
fprintf(stderr,"getMaskOrLayer: (%d-%d),(%d-%d)\n",left,right,top,bottom);
#endif
-
+
if( isSubrect(want,dim->c) &&
(want.l - dim->c.l) % TILE_WIDTH == 0 &&
(want.t - dim->c.t) % TILE_HEIGHT == 0 ) {
int tx = TILE_NUM(want.l - dim->c.l);
int ty = TILE_NUM(want.t - dim->c.t);
if( want.r == TILEXn(*dim,tx+1) && want.b == TILEYn(*dim,ty+1) ) {
/* The common case? An entire single tile from the layer */
copyTilePixels(tile,tiles->tileptrs[tx + ty*dim->tilesx],tiles->params);
return tile ;
}
}
/* OK, we must construct the wanted tile as a jigsaw */
{
unsigned width = want.r-want.l ;
rgba *pixvert = tile->pixels ;
rgba *pixhoriz ;
int y, ty, l0, l1 ;
int x, tx, c0, c1 ;
unsigned lstart, lnum ;
unsigned cstart, cnum ;
-
+
if( !isSubrect(want,dim->c) ) {
if( want.l < dim->c.l ) pixvert += (dim->c.l - want.l),
want.l = dim->c.l ;
if( want.r > dim->c.r ) want.r = dim->c.r ;
if( want.t < dim->c.t ) pixvert += (dim->c.t - want.t) * width,
want.t = dim->c.t ;
if( want.b > dim->c.b ) want.b = dim->c.b ;
fillTile(tile,0);
} else {
tile->summary = -1 ; /* I.e. whatever the jigsaw pieces say */
}
#ifdef xDEBUG
fprintf(stderr,"jig0 (%d-%d),(%d-%d)\n",left,right,top,bottom);
#endif
for( y=want.t, ty=TILE_NUM(want.t-dim->c.t), l0=TILEYn(*dim,ty);
y<want.b;
pixvert += lnum*width, ty++, y=l0=l1 ) {
l1 = TILEYn(*dim,ty+1) ;
lstart = y - l0 ;
lnum = (l1 > want.b ? want.b : l1) - y ;
-
+
pixhoriz = pixvert ;
for( x=want.l, tx=TILE_NUM(want.l-dim->c.l), c0=TILEXn(*dim,tx);
x<want.r;
pixhoriz += cnum, tx++, x=c0=c1 ) {
c1 = TILEXn(*dim,tx+1);
cstart = x - c0 ;
cnum = (c1 > want.r ? want.r : c1) - x ;
{
static struct Tile tmptile ;
unsigned dwidth = c1-c0 ;
unsigned i, j ;
tmptile.count = (c1-c0)*(l1-l0) ;
#ifdef xDEBUG
fprintf(stderr,"jig ty=%u(%u-%u-%u)(%u+%u) tx=%u(%u-%u-%u)(%u+%u)\n",
ty,l0,y,l1,lstart,lnum,
tx,c0,x,c1,cstart,cnum);
#endif
copyTilePixels(&tmptile,
tiles->tileptrs[tx+ty*dim->tilesx],tiles->params);
for(i=0; i<lnum; i++)
for(j=0; j<cnum; j++)
pixhoriz[i*width+j]
= tmptile.pixels[(i+lstart)*dwidth+(j+cstart)];
tile->summary &= tmptile.summary ;
}
}
}
}
return tile ;
}
void
applyMask(struct Tile *tile, struct Tile *mask)
{
unsigned i ;
assertTileCompatibility(tile,mask);
assert( tile->count == mask->count );
INIT_SCALETABLE_IF(1);
invalidateSummary(tile,0);
for( i=0; i < tile->count ;i++ )
tile->pixels[i] = NEWALPHA(tile->pixels[i],
scaletable[mask->pixels[i]>>ALPHA_SHIFT]
[ALPHA(tile->pixels[i])]);
freeTile(mask);
}
struct Tile *
getLayerTile(struct xcfLayer *layer,const struct rect *where)
{
struct Tile *data ;
#ifdef xDEBUG
fprintf(stderr,"getLayerTile(%s): (%d-%d),(%d-%d)\n",
layer->name,where->l,where->r,where->t,where->b);
#endif
if( disjointRects(*where,layer->dim.c) ||
layer->opacity == 0 ) {
data = newTile(*where);
fillTile(data,0);
return data ;
}
-
+
data = getMaskOrLayerTile(&layer->dim,&layer->pixels,*where);
if( (data->summary & TILESUMMARY_ALLNULL) != 0 )
return data ;
if( layer->hasMask ) {
struct Tile *mask = getMaskOrLayerTile(&layer->dim,&layer->mask,*where);
applyMask(data,mask);
}
if( layer->opacity < 255 ) {
const uint8_t *ourtable ;
int i ;
invalidateSummary(data,~(TILESUMMARY_CRISP | TILESUMMARY_ALLFULL));
INIT_SCALETABLE_IF(1);
ourtable = scaletable[layer->opacity] ;
for( i=0; i < data->count; i++ )
data->pixels[i]
= NEWALPHA(data->pixels[i],ourtable[ALPHA(data->pixels[i])]) ;
}
return data ;
}
-
+
diff --git a/plugins/impex/xcf/kis_xcf_import.h b/plugins/impex/xcf/kis_xcf_import.h
index 978a69dc33..cfbe32ebf6 100644
--- a/plugins/impex/xcf/kis_xcf_import.h
+++ b/plugins/impex/xcf/kis_xcf_import.h
@@ -1,40 +1,40 @@
/*
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_XCF_IMPORT_H_
#define _KIS_XCF_IMPORT_H_
#include <QVariant>
#include <QIODevice>
#include <KisImportExportFilter.h>
class KisDocument;
class KisXCFImport : public KisImportExportFilter
{
Q_OBJECT
public:
KisXCFImport(QObject *parent, const QVariantList &);
- virtual ~KisXCFImport();
+ ~KisXCFImport() override;
public:
- virtual KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0);
+ KisImportExportFilter::ConversionStatus convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override;
};
#endif
diff --git a/plugins/paintops/chalk/chalk_paintop_plugin.h b/plugins/paintops/chalk/chalk_paintop_plugin.h
index dd85561873..0d78033afd 100644
--- a/plugins/paintops/chalk/chalk_paintop_plugin.h
+++ b/plugins/paintops/chalk/chalk_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CHALK_PAINTOP_PLUGIN_H_
#define CHALK_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class ChalkPaintOpPlugin : public QObject
{
Q_OBJECT
public:
ChalkPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~ChalkPaintOpPlugin();
+ ~ChalkPaintOpPlugin() override;
};
#endif // CHALK_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/chalk/kis_chalk_paintop.h b/plugins/paintops/chalk/kis_chalk_paintop.h
index 0597a9118f..b94d4bdbef 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop.h
+++ b/plugins/paintops/chalk/kis_chalk_paintop.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008, 2009 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CHALK_PAINTOP_H_
#define KIS_CHALK_PAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "chalk_brush.h"
#include "kis_chalk_paintop_settings.h"
class KisPainter;
class KisChalkPaintOp : public KisPaintOp
{
public:
KisChalkPaintOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image);
- virtual ~KisChalkPaintOp();
+ ~KisChalkPaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
KisPaintDeviceSP m_dab;
ChalkBrush * m_chalkBrush;
KisPressureOpacityOption m_opacityOption;
ChalkProperties m_properties;
};
#endif // KIS_CHALK_PAINTOP_H_
diff --git a/plugins/paintops/chalk/kis_chalk_paintop_settings.h b/plugins/paintops/chalk/kis_chalk_paintop_settings.h
index 5140925880..808d8c5c66 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop_settings.h
+++ b/plugins/paintops/chalk/kis_chalk_paintop_settings.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2008,2009 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CHALK_PAINTOP_SETTINGS_H_
#define KIS_CHALK_PAINTOP_SETTINGS_H_
#include <brushengine/kis_paintop_settings.h>
#include <kis_types.h>
#include "kis_chalk_paintop_settings_widget.h"
#include <kis_pressure_opacity_option.h>
class KisChalkPaintOpSettings : public KisPaintOpSettings
{
public:
KisChalkPaintOpSettings();
- virtual ~KisChalkPaintOpSettings() {}
+ ~KisChalkPaintOpSettings() override {}
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
void setPaintOpSize(qreal value) override;
qreal paintOpSize() const override;
bool paintIncremental() override;
bool isAirbrushing() const override;
int rate() const override;
};
#endif
diff --git a/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h b/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
index aa0a318343..a0663ab2f0 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
+++ b/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CHALKPAINTOP_SETTINGS_WIDGET_H_
#define KIS_CHALKPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
#include "ui_wdgchalkoptions.h"
class KisChalkOpOption;
class KisChalkPaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisChalkPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisChalkPaintOpSettingsWidget();
+ ~KisChalkPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
KisChalkOpOption* m_chalkOption;
};
#endif
diff --git a/plugins/paintops/chalk/kis_chalkop_option.h b/plugins/paintops/chalk/kis_chalkop_option.h
index 8b4a614f09..98a123dea1 100644
--- a/plugins/paintops/chalk/kis_chalkop_option.h
+++ b/plugins/paintops/chalk/kis_chalkop_option.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2008,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CHALKOP_OPTION_H
#define KIS_CHALKOP_OPTION_H
#include <kis_paintop_option.h>
const QString CHALK_RADIUS = "Chalk/radius";
const QString CHALK_INK_DEPLETION = "Chalk/inkDepletion";
const QString CHALK_USE_OPACITY = "Chalk/opacity";
const QString CHALK_USE_SATURATION = "Chalk/saturation";
class KisChalkOpOptionsWidget;
class KisChalkOpOption : public KisPaintOpOption
{
public:
KisChalkOpOption();
- ~KisChalkOpOption();
+ ~KisChalkOpOption() override;
void setRadius(int radius) const;
int radius() const;
bool inkDepletion() const;
bool saturation() const;
bool opacity() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisChalkOpOptionsWidget * m_options;
};
class ChalkProperties : public KisBaseOption
{
public:
int radius;
bool inkDepletion;
bool useOpacity;
bool useSaturation;
- void readOptionSettingImpl(const KisPropertiesConfiguration *settings) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration *settings) override {
radius = settings->getInt(CHALK_RADIUS);
inkDepletion = settings->getBool(CHALK_INK_DEPLETION);
useOpacity = settings->getBool(CHALK_USE_OPACITY);
useSaturation = settings->getBool(CHALK_USE_SATURATION);
}
- void writeOptionSettingImpl(KisPropertiesConfiguration* settings) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration* settings) const override {
settings->setProperty(CHALK_RADIUS, radius);
settings->setProperty(CHALK_INK_DEPLETION, inkDepletion);
settings->setProperty(CHALK_USE_OPACITY, useOpacity);
settings->setProperty(CHALK_USE_SATURATION, useSaturation);
}
};
#endif
diff --git a/plugins/paintops/colorsmudge/colorsmudge_paintop_plugin.h b/plugins/paintops/colorsmudge/colorsmudge_paintop_plugin.h
index e711874867..81175b0702 100644
--- a/plugins/paintops/colorsmudge/colorsmudge_paintop_plugin.h
+++ b/plugins/paintops/colorsmudge/colorsmudge_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _COLORSMUDGE_PAINTOP_PLUGIN_H_
#define _COLORSMUDGE_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class ColorSmudgePaintOpPlugin: public QObject
{
Q_OBJECT
public:
ColorSmudgePaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~ColorSmudgePaintOpPlugin();
+ ~ColorSmudgePaintOpPlugin() override;
};
#endif // _COLORSMUDGE_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/colorsmudge/kis_colorsmudgeop.h b/plugins/paintops/colorsmudge/kis_colorsmudgeop.h
index b851426a00..c6f15fbf8f 100644
--- a/plugins/paintops/colorsmudge/kis_colorsmudgeop.h
+++ b/plugins/paintops/colorsmudge/kis_colorsmudgeop.h
@@ -1,80 +1,80 @@
/*
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_COLORSMUDGEOP_H_
#define _KIS_COLORSMUDGEOP_H_
#include <QRect>
#include <kis_brush_based_paintop.h>
#include <kis_types.h>
#include <kis_pressure_size_option.h>
#include <kis_pressure_opacity_option.h>
#include <kis_pressure_spacing_option.h>
#include <kis_pressure_rotation_option.h>
#include <kis_pressure_scatter_option.h>
#include <kis_pressure_gradient_option.h>
#include "kis_overlay_mode_option.h"
#include "kis_rate_option.h"
#include "kis_smudge_option.h"
#include "kis_smudge_radius_option.h"
class QPointF;
class KoAbstractGradient;
class KisBrushBasedPaintOpSettings;
class KisPainter;
class KisColorSmudgeOp: public KisBrushBasedPaintOp
{
public:
KisColorSmudgeOp(const KisPaintOpSettingsSP settings, KisPainter* painter, KisNodeSP node, KisImageSP image);
- virtual ~KisColorSmudgeOp();
+ ~KisColorSmudgeOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
// Sets the m_maskDab _and m_maskDabRect
void updateMask(const KisPaintInformation& info, double scale, double rotation, const QPointF &cursorPoint);
inline void getTopLeftAligned(const QPointF &pos, const QPointF &hotSpot, qint32 *x, qint32 *y);
private:
bool m_firstRun;
KisImageWSP m_image;
KisPaintDeviceSP m_tempDev;
KisPainter* m_backgroundPainter;
KisPainter* m_smudgePainter;
KisPainter* m_colorRatePainter;
const KoAbstractGradient* m_gradient;
KisPressureSizeOption m_sizeOption;
KisPressureOpacityOption m_opacityOption;
KisPressureSpacingOption m_spacingOption;
KisSmudgeOption m_smudgeRateOption;
KisRateOption m_colorRateOption;
KisSmudgeRadiusOption m_smudgeRadiusOption;
KisOverlayModeOption m_overlayModeOption;
KisPressureRotationOption m_rotationOption;
KisPressureScatterOption m_scatterOption;
KisPressureGradientOption m_gradientOption;
QRect m_dstDabRect;
KisFixedPaintDeviceSP m_maskDab;
QPointF m_lastPaintPos;
};
#endif // _KIS_COLORSMUDGEOP_H_
diff --git a/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings.h b/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings.h
index 2c4f990450..5bef9202ae 100644
--- a/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings.h
+++ b/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_COLORSMUDGEOP_SETTINGS_H
#define __KIS_COLORSMUDGEOP_SETTINGS_H
#include <QScopedPointer>
#include <kis_brush_based_paintop_settings.h>
class KisColorSmudgeOpSettings : public KisBrushBasedPaintOpSettings
{
public:
KisColorSmudgeOpSettings();
- ~KisColorSmudgeOpSettings();
+ ~KisColorSmudgeOpSettings() override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
typedef KisSharedPtr<KisColorSmudgeOpSettings> KisColorSmudgeOpSettingsSP;
#endif /* __KIS_COLORSMUDGEOP_SETTINGS_H */
diff --git a/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.h b/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.h
index 43b361d452..3b56793ad7 100644
--- a/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.h
+++ b/plugins/paintops/colorsmudge/kis_colorsmudgeop_settings_widget.h
@@ -1,45 +1,45 @@
/*
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLORSMUDGEOP_SETTINGS_WIDGET_H_
#define KIS_COLORSMUDGEOP_SETTINGS_WIDGET_H_
#include <kis_brush_based_paintop_options_widget.h>
class KisSmudgeOptionWidget;
class KisColorSmudgeOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisColorSmudgeOpSettingsWidget(QWidget* parent = 0);
- ~KisColorSmudgeOpSettingsWidget();
+ ~KisColorSmudgeOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
protected:
- void notifyPageChanged();
+ void notifyPageChanged() override;
private:
KisSmudgeOptionWidget *m_smudgeOptionWidget;
};
#endif // KIS_COLORSMUDGEOP_SETTINGS_WIDGET_H_
diff --git a/plugins/paintops/colorsmudge/kis_overlay_mode_option.h b/plugins/paintops/colorsmudge/kis_overlay_mode_option.h
index 94342f15dd..fc4fb8392f 100644
--- a/plugins/paintops/colorsmudge/kis_overlay_mode_option.h
+++ b/plugins/paintops/colorsmudge/kis_overlay_mode_option.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_OVERLAYMODE_OPTION_H_
#define _KIS_OVERLAYMODE_OPTION_H_
#include <QLabel>
#include <kis_paintop_option.h>
#include <brushengine/kis_paintop_lod_limitations.h>
class KisOverlayModeOption : public KisPaintOpOption
{
public:
KisOverlayModeOption():
KisPaintOpOption(KisPaintOpOption::GENERAL, false)
{
setObjectName("KisOverlayModeOption");
}
- virtual bool isCheckable() const {
+ bool isCheckable() const override {
return true;
}
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const {
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override {
setting->setProperty("MergedPaint", isChecked());
}
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting) {
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override {
bool enabled = setting->getBool("MergedPaint");
setChecked(enabled);
}
- virtual void lodLimitations(KisPaintopLodLimitations *l) const {
+ void lodLimitations(KisPaintopLodLimitations *l) const override {
l->blockers << KoID("colorsmudge-overlay", i18nc("PaintOp instant preview limitation", "Overlay Option"));
}
};
class KisOverlayModeOptionWidget: public KisOverlayModeOption
{
public:
KisOverlayModeOptionWidget() {
QLabel* label = new QLabel(
i18n("Paints on the current layer\n\
but uses all layers that are currently visible for smudge input\n\
NOTE: This mode is only able to work correctly with a fully opaque background")
);
label->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
setConfigurationPage(label);
}
};
#endif // _KIS_OVERLAYMODE_OPTION_H_
diff --git a/plugins/paintops/colorsmudge/kis_smudge_option.h b/plugins/paintops/colorsmudge/kis_smudge_option.h
index b8c10f1b2a..e3de54aad4 100644
--- a/plugins/paintops/colorsmudge/kis_smudge_option.h
+++ b/plugins/paintops/colorsmudge/kis_smudge_option.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
*
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SMUDGE_OPTION_H
#define KIS_SMUDGE_OPTION_H
#include "kis_rate_option.h"
#include <brushengine/kis_paint_information.h>
#include <kis_types.h>
// static const QString SMUDGE_MODE = "SmudgeMode";
class KisPropertiesConfiguration;
class KisPainter;
class KisSmudgeOption: public KisRateOption
{
public:
KisSmudgeOption();
enum Mode { SMEARING_MODE, DULLING_MODE };
/**
* Set the opacity of the painter based on the rate
* and the curve (if checked)
*/
void apply(KisPainter& painter, const KisPaintInformation& info, qreal scaleMin = 0.0, qreal scaleMax = 1.0, qreal multiplicator = 1.0) const;
Mode getMode() {
return m_mode;
}
void setMode(Mode mode) {
m_mode = mode;
}
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
Mode m_mode;
};
#endif // KIS_SMUDGE_OPTION_H
diff --git a/plugins/paintops/colorsmudge/kis_smudge_option_widget.h b/plugins/paintops/colorsmudge/kis_smudge_option_widget.h
index 4aa9030a9c..6f0552340f 100644
--- a/plugins/paintops/colorsmudge/kis_smudge_option_widget.h
+++ b/plugins/paintops/colorsmudge/kis_smudge_option_widget.h
@@ -1,44 +1,44 @@
/*
Copyright 2012 Silvio Heinrich <plassy@web.de>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KIS_SMUDGE_OPTION_WIDGET_H
#define KIS_SMUDGE_OPTION_WIDGET_H
#include <kis_curve_option_widget.h>
class QComboBox;
class KisSmudgeOptionWidget: public KisCurveOptionWidget
{
Q_OBJECT
public:
KisSmudgeOptionWidget();
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
void updateBrushPierced(bool pierced);
private Q_SLOTS:
void slotCurrentIndexChanged(int index);
private:
QComboBox* mCbSmudgeMode;
};
#endif // KIS_SMUDGE_OPTION_WIDGET_H
diff --git a/plugins/paintops/colorsmudge/kis_smudge_radius_option.h b/plugins/paintops/colorsmudge/kis_smudge_radius_option.h
index a74e4ea0ea..16a7dd1a9c 100644
--- a/plugins/paintops/colorsmudge/kis_smudge_radius_option.h
+++ b/plugins/paintops/colorsmudge/kis_smudge_radius_option.h
@@ -1,49 +1,49 @@
/*
* Copyright (C) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SMUDGE_RADIUS_OPTION_H
#define KIS_SMUDGE_RADIUS_OPTION_H
#include "kis_rate_option.h"
#include <brushengine/kis_paint_information.h>
#include <kis_types.h>
class KisPropertiesConfiguration;
class KisPainter;
class KisSmudgeRadiusOption: public KisRateOption
{
public:
KisSmudgeRadiusOption();
/**
* Set the opacity of the painter based on the rate
* and the curve (if checked)
*/
void apply(KisPainter& painter,
const KisPaintInformation& info,
qreal diameter,
qreal posx,
qreal posy,
KisPaintDeviceSP dev) const;
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
};
#endif // KIS_SMUDGE_RADIUS_OPTION_H
diff --git a/plugins/paintops/curvebrush/curve_paintop_plugin.h b/plugins/paintops/curvebrush/curve_paintop_plugin.h
index 418f8d010c..1fcfe7d6d6 100644
--- a/plugins/paintops/curvebrush/curve_paintop_plugin.h
+++ b/plugins/paintops/curvebrush/curve_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef CURVE_PAINTOP_PLUGIN_H_
#define CURVE_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class CurvePaintOpPlugin : public QObject
{
Q_OBJECT
public:
CurvePaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~CurvePaintOpPlugin();
+ ~CurvePaintOpPlugin() override;
};
#endif // CURVE_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/curvebrush/kis_curve_line_option.h b/plugins/paintops/curvebrush/kis_curve_line_option.h
index ecf7e266d8..bda1c4bb9f 100644
--- a/plugins/paintops/curvebrush/kis_curve_line_option.h
+++ b/plugins/paintops/curvebrush/kis_curve_line_option.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVE_LINE_OPTION_H
#define KIS_CURVE_LINE_OPTION_H
#include <kis_paintop_option.h>
class KisCurveOpOptionsWidget;
// new rewrite
const QString CURVE_LINE_WIDTH = "Curve/lineWidth"; // same as in sketch
const QString CURVE_PAINT_CONNECTION_LINE = "Curve/makeConnection"; // same as in sketch
const QString CURVE_STROKE_HISTORY_SIZE = "Curve/strokeHistorySize";
const QString CURVE_SMOOTHING = "Curve/smoothing";
const QString CURVE_CURVES_OPACITY = "Curve/curvesOpacity";
class KisCurveOpOption : public KisPaintOpOption
{
public:
KisCurveOpOption();
- ~KisCurveOpOption();
+ ~KisCurveOpOption() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisCurveOpOptionsWidget * m_options;
};
class CurveOption : public KisBaseOption
{
public:
bool curve_paint_connection_line;
bool curve_smoothing;
int curve_stroke_history_size;
int curve_line_width;
qreal curve_curves_opacity;
- void readOptionSettingImpl(const KisPropertiesConfiguration *config) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration *config) override {
curve_paint_connection_line = config->getBool(CURVE_PAINT_CONNECTION_LINE);
curve_smoothing = config->getBool(CURVE_SMOOTHING);
curve_stroke_history_size = config->getInt(CURVE_STROKE_HISTORY_SIZE);
curve_line_width = config->getInt(CURVE_LINE_WIDTH);
curve_curves_opacity = config->getDouble(CURVE_CURVES_OPACITY);
}
- void writeOptionSettingImpl(KisPropertiesConfiguration *config) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration *config) const override {
config->setProperty(CURVE_PAINT_CONNECTION_LINE, curve_paint_connection_line);
config->setProperty(CURVE_SMOOTHING, curve_smoothing);
config->setProperty(CURVE_STROKE_HISTORY_SIZE, curve_stroke_history_size);
config->setProperty(CURVE_LINE_WIDTH, curve_line_width);
config->setProperty(CURVE_CURVES_OPACITY, curve_curves_opacity);
}
};
#endif
diff --git a/plugins/paintops/curvebrush/kis_curve_paintop.h b/plugins/paintops/curvebrush/kis_curve_paintop.h
index baca8df083..b195f85471 100644
--- a/plugins/paintops/curvebrush/kis_curve_paintop.h
+++ b/plugins/paintops/curvebrush/kis_curve_paintop.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2008-2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVEPAINTOP_H_
#define KIS_CURVEPAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "curve_brush.h"
#include "kis_curve_line_option.h"
#include "kis_curve_paintop_settings.h"
#include <kis_pressure_opacity_option.h>
#include "kis_linewidth_option.h"
#include "kis_curves_opacity_option.h"
class KisPainter;
class KisCurvePaintOp : public KisPaintOp
{
public:
KisCurvePaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- virtual ~KisCurvePaintOp();
+ ~KisCurvePaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
private:
void paintLine(KisPaintDeviceSP dab, const KisPaintInformation &pi1, const KisPaintInformation &pi2);
private:
KisPaintDeviceSP m_dab;
KisPaintDeviceSP m_dev;
CurveOption m_curveProperties;
KisPressureOpacityOption m_opacityOption;
KisLineWidthOption m_lineWidthOption;
KisCurvesOpacityOption m_curvesOpacityOption;
QList<QPointF> m_points;
KisPainter * m_painter;
};
#endif // KIS_CURVEPAINTOP_H_
diff --git a/plugins/paintops/curvebrush/kis_curve_paintop_settings.h b/plugins/paintops/curvebrush/kis_curve_paintop_settings.h
index acf8aeb552..1e7128fa2d 100644
--- a/plugins/paintops/curvebrush/kis_curve_paintop_settings.h
+++ b/plugins/paintops/curvebrush/kis_curve_paintop_settings.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVE_PAINTOP_SETTINGS_H_
#define KIS_CURVE_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
#include <brushengine/kis_paintop_settings.h>
class KisCurvePaintOpSettings : public KisPaintOpSettings
{
public:
KisCurvePaintOpSettings();
- virtual ~KisCurvePaintOpSettings();
+ ~KisCurvePaintOpSettings() override;
void setPaintOpSize(qreal value) override;
qreal paintOpSize() const override;
- virtual bool paintIncremental();
+ bool paintIncremental() override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/paintops/curvebrush/kis_curve_paintop_settings_widget.h b/plugins/paintops/curvebrush/kis_curve_paintop_settings_widget.h
index a4244a6562..065652710e 100644
--- a/plugins/paintops/curvebrush/kis_curve_paintop_settings_widget.h
+++ b/plugins/paintops/curvebrush/kis_curve_paintop_settings_widget.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2008,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVE_PAINTOP_SETTINGS_WIDGET_H_
#define KIS_CURVE_PAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisCurveOpOption;
class KisPropertiesConfiguration;
class KisCurvePaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisCurvePaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisCurvePaintOpSettingsWidget();
+ ~KisCurvePaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
private:
KisCurveOpOption *m_curveOption;
};
#endif
diff --git a/plugins/paintops/defaultpaintops/brush/kis_brushop.h b/plugins/paintops/defaultpaintops/brush/kis_brushop.h
index ac0771f4bb..473e318284 100644
--- a/plugins/paintops/defaultpaintops/brush/kis_brushop.h
+++ b/plugins/paintops/defaultpaintops/brush/kis_brushop.h
@@ -1,77 +1,77 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSHOP_H_
#define KIS_BRUSHOP_H_
#include "kis_brush_based_paintop.h"
#include <kis_pressure_darken_option.h>
#include <kis_pressure_flow_opacity_option.h>
#include <kis_pressure_size_option.h>
#include <kis_pressure_ratio_option.h>
#include <kis_pressure_flow_option.h>
#include <kis_pressure_rotation_option.h>
#include <kis_pressure_mix_option.h>
#include <kis_pressure_hsv_option.h>
#include <kis_pressure_scatter_option.h>
#include <kis_pressure_softness_option.h>
#include <kis_pressure_sharpness_option.h>
#include <kis_color_source_option.h>
#include <kis_pressure_spacing_option.h>
#include <kis_brush_based_paintop_settings.h>
class KisPainter;
class KisColorSource;
class KisBrushOp : public KisBrushBasedPaintOp
{
public:
KisBrushOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- ~KisBrushOp();
+ ~KisBrushOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
private:
KisColorSource *m_colorSource;
KisPressureSizeOption m_sizeOption;
KisPressureRatioOption m_ratioOption;
KisPressureSpacingOption m_spacingOption;
KisPressureFlowOption m_flowOption;
KisFlowOpacityOption m_opacityOption;
KisPressureSoftnessOption m_softnessOption;
KisPressureSharpnessOption m_sharpnessOption;
KisPressureDarkenOption m_darkenOption;
KisPressureRotationOption m_rotationOption;
KisPressureMixOption m_mixOption;
KisPressureScatterOption m_scatterOption;
QList<KisPressureHSVOption*> m_hsvOptions;
KoColorTransformation *m_hsvTransformation;
KisPaintDeviceSP m_lineCacheDevice;
KisPaintDeviceSP m_colorSourceDevice;
};
#endif // KIS_BRUSHOP_H_
diff --git a/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.h b/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.h
index eec4da46bd..0bff308245 100644
--- a/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.h
+++ b/plugins/paintops/defaultpaintops/brush/kis_brushop_settings_widget.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSHOP_SETTINGS_WIDGET_H_
#define KIS_BRUSHOP_SETTINGS_WIDGET_H_
#include <kis_brush_based_paintop_options_widget.h>
class KisBrushOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisBrushOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisBrushOpSettingsWidget();
+ ~KisBrushOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
};
#endif // KIS_BRUSHOP_SETTINGS_WIDGET_H_
diff --git a/plugins/paintops/defaultpaintops/defaultpaintops_plugin.h b/plugins/paintops/defaultpaintops/defaultpaintops_plugin.h
index 43aebc47b0..8698edacbb 100644
--- a/plugins/paintops/defaultpaintops/defaultpaintops_plugin.h
+++ b/plugins/paintops/defaultpaintops/defaultpaintops_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2005 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DEFAULT_PAINTOPS_PLUGIN_H_
#define DEFAULT_PAINTOPS_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class DefaultPaintOpsPlugin : public QObject
{
Q_OBJECT
public:
DefaultPaintOpsPlugin(QObject *parent, const QVariantList &);
- virtual ~DefaultPaintOpsPlugin();
+ ~DefaultPaintOpsPlugin() override;
};
#endif // DEFAULT_PAINTOPSGRAY_PLUGIN_H_
diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.h b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.h
index 1aa1206d11..2c626ec976 100644
--- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.h
+++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DUPLICATEOP_H_
#define KIS_DUPLICATEOP_H_
#include "kis_brush_based_paintop.h"
#include <klocalizedstring.h>
#include <kis_types.h>
#include <brushengine/kis_paintop_factory.h>
#include <brushengine/kis_paintop_settings.h>
#include <kis_pressure_size_option.h>
#include "kis_duplicateop_settings.h"
class KisPaintInformation;
class QPointF;
class KisPainter;
class KisDuplicateOp : public KisBrushBasedPaintOp
{
public:
KisDuplicateOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image);
- ~KisDuplicateOp();
+ ~KisDuplicateOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
qreal minimizeEnergy(const qreal* m, qreal* sol, int w, int h);
private:
KisImageSP m_image;
KisNodeSP m_node;
KisDuplicateOpSettingsSP m_settings;
KisPaintDeviceSP m_srcdev;
KisPaintDeviceSP m_target;
QPointF m_duplicateStart;
bool m_duplicateStartIsSet;
KisPressureSizeOption m_sizeOption;
bool m_healing;
bool m_perspectiveCorrection;
bool m_moveSourcePoint;
bool m_cloneFromProjection;
};
#endif // KIS_DUPLICATEOP_H_
diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.h b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.h
index 84abb35096..32416ac65a 100644
--- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.h
+++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_option.h
@@ -1,83 +1,83 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DUPLICATEOP_OPTION_H
#define KIS_DUPLICATEOP_OPTION_H
#include <kis_paintop_option.h>
const QString DUPLICATE_HEALING = "Duplicateop/Healing";
const QString DUPLICATE_CORRECT_PERSPECTIVE = "Duplicateop/CorrectPerspective";
const QString DUPLICATE_MOVE_SOURCE_POINT = "Duplicateop/MoveSourcePoint";
const QString DUPLICATE_CLONE_FROM_PROJECTION = "Duplicateop/CloneFromProjection";
class KisDuplicateOpOptionsWidget;
class KisDuplicateOpOption : public KisPaintOpOption
{
public:
KisDuplicateOpOption();
- ~KisDuplicateOpOption();
+ ~KisDuplicateOpOption() override;
private:
bool healing() const;
void setHealing(bool healing);
bool correctPerspective() const;
void setPerspective(bool perspective);
bool moveSourcePoint() const;
void setMoveSourcePoint(bool move);
bool cloneFromProjection() const;
void setCloneFromProjection(bool cloneFromProjection);
public:
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
- void setImage(KisImageWSP image);
+ void setImage(KisImageWSP image) override;
private:
KisDuplicateOpOptionsWidget * m_optionWidget;
};
struct DuplicateOption : public KisBaseOption
{
bool duplicate_healing;
bool duplicate_correct_perspective;
bool duplicate_move_source_point;
bool duplicate_clone_from_projection;
- void readOptionSettingImpl(const KisPropertiesConfiguration* setting) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration* setting) override {
duplicate_healing = setting->getBool(DUPLICATE_HEALING, false);
duplicate_correct_perspective = setting->getBool(DUPLICATE_CORRECT_PERSPECTIVE, false);
duplicate_move_source_point = setting->getBool(DUPLICATE_MOVE_SOURCE_POINT, true);
duplicate_clone_from_projection = setting->getBool(DUPLICATE_CLONE_FROM_PROJECTION, false);
}
- void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override {
setting->setProperty(DUPLICATE_HEALING, duplicate_healing);
setting->setProperty(DUPLICATE_CORRECT_PERSPECTIVE, duplicate_correct_perspective);
setting->setProperty(DUPLICATE_MOVE_SOURCE_POINT, duplicate_move_source_point);
setting->setProperty(DUPLICATE_CLONE_FROM_PROJECTION, duplicate_clone_from_projection);
}
};
#endif
diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.h b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.h
index d313be5c4e..07298c2489 100644
--- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.h
+++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.h
@@ -1,73 +1,73 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DUPLICATEOP_SETTINGS_H_
#define KIS_DUPLICATEOP_SETTINGS_H_
#include <kis_brush_based_paintop_settings.h>
#include <kis_types.h>
#include <QPointF>
class QDomElement;
class KisDuplicateOpSettings : public KisBrushBasedPaintOpSettings
{
public:
using KisPaintOpSettings::fromXML;
using KisPaintOpSettings::toXML;
KisDuplicateOpSettings();
- virtual ~KisDuplicateOpSettings();
- bool paintIncremental();
- QString indirectPaintingCompositeOp() const;
+ ~KisDuplicateOpSettings() override;
+ bool paintIncremental() override;
+ QString indirectPaintingCompositeOp() const override;
QPointF offset() const;
QPointF position() const;
- virtual bool mousePressEvent(const KisPaintInformation& pos, Qt::KeyboardModifiers modifiers, KisNodeWSP currentNode);
- void activate();
+ bool mousePressEvent(const KisPaintInformation& pos, Qt::KeyboardModifiers modifiers, KisNodeWSP currentNode) override;
+ void activate() override;
- void fromXML(const QDomElement& elt);
- void toXML(QDomDocument& doc, QDomElement& rootElt) const;
+ void fromXML(const QDomElement& elt) override;
+ void toXML(QDomDocument& doc, QDomElement& rootElt) const override;
- KisPaintOpSettingsSP clone() const;
+ KisPaintOpSettingsSP clone() const override;
using KisBrushBasedPaintOpSettings::brushOutline;
- QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode);
+ QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
KisNodeWSP sourceNode() const;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
public:
Q_DISABLE_COPY(KisDuplicateOpSettings)
QPointF m_offset;
bool m_isOffsetNotUptodate;
QPointF m_position; // Give the position of the last alt-click
KisNodeWSP m_sourceNode;
QList<KisUniformPaintOpPropertyWSP> m_uniformProperties;
};
typedef KisSharedPtr<KisDuplicateOpSettings> KisDuplicateOpSettingsSP;
#endif // KIS_DUPLICATEOP_SETTINGS_H_
diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings_widget.h b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings_widget.h
index 3780816327..5a2a1accc8 100644
--- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings_widget.h
+++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings_widget.h
@@ -1,57 +1,57 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DUPLICATEOP_SETTINGS_WIDGET_H_
#define KIS_DUPLICATEOP_SETTINGS_WIDGET_H_
#include <kis_brush_based_paintop_options_widget.h>
#include <kis_image.h>
class KisDuplicateOpOption;
class KisPaintopLodLimitations;
class KisDuplicateOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisDuplicateOpSettingsWidget(QWidget* parent = 0);
- ~KisDuplicateOpSettingsWidget();
+ ~KisDuplicateOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
- KisPaintopLodLimitations lodLimitations() const;
+ KisPropertiesConfigurationSP configuration() const override;
+ KisPaintopLodLimitations lodLimitations() const override;
- virtual bool supportScratchBox() {
+ bool supportScratchBox() override {
return false;
}
public:
KisDuplicateOpOption* m_duplicateOption;
};
#endif // KIS_DUPLICATEOP_SETTINGS_WIDGET_H_
diff --git a/plugins/paintops/deform/deform_brush.h b/plugins/paintops/deform/deform_brush.h
index 8ef4139360..33d71abcb8 100644
--- a/plugins/paintops/deform/deform_brush.h
+++ b/plugins/paintops/deform/deform_brush.h
@@ -1,252 +1,252 @@
/*
* Copyright (c) 2008, 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _DEFORM_BRUSH_H_
#define _DEFORM_BRUSH_H_
#include <kis_paint_device.h>
#include <brushengine/kis_paint_information.h>
#include <kis_brush_size_option.h>
#include <kis_deform_option.h>
#include <time.h>
#if defined(_WIN32) || defined(_WIN64)
#define srand48 srand
inline double drand48()
{
return double(rand()) / RAND_MAX;
}
#endif
enum DeformModes {GROW, SHRINK, SWIRL_CW, SWIRL_CCW, MOVE, LENS_IN, LENS_OUT, DEFORM_COLOR};
class DeformProperties
{
public:
int action;
qreal deformAmount;
bool useBilinear;
bool useCounter;
bool useOldData;
};
class DeformBase
{
public:
DeformBase() {}
virtual ~DeformBase() {}
virtual void transform(qreal * x, qreal * y, qreal distance) {
Q_UNUSED(x);
Q_UNUSED(y);
Q_UNUSED(distance);
}
};
/// Inverse weighted inverse scaling - grow&shrink
class DeformScale : public DeformBase
{
public:
void setFactor(qreal factor) {
m_factor = factor;
}
qreal factor() {
return m_factor;
}
- virtual void transform(qreal* x, qreal* y, qreal distance) {
+ void transform(qreal* x, qreal* y, qreal distance) override {
qreal scaleFactor = (1.0 - distance) * m_factor + distance;
*x = *x / scaleFactor;
*y = *y / scaleFactor;
}
private:
qreal m_factor;
};
/// Inverse weighted rotation - swirlCW&&swirlCWW
class DeformRotation : public DeformBase
{
public:
void setAlpha(qreal alpha) {
m_alpha = alpha;
}
- virtual void transform(qreal* maskX, qreal* maskY, qreal distance) {
+ void transform(qreal* maskX, qreal* maskY, qreal distance) override {
distance = 1.0 - distance;
qreal rotX = cos(-m_alpha * distance) * (*maskX) - sin(-m_alpha * distance) * (*maskY);
qreal rotY = sin(-m_alpha * distance) * (*maskX) + cos(-m_alpha * distance) * (*maskY);
*maskX = rotX;
*maskY = rotY;
}
private:
qreal m_alpha;
};
/// Inverse move
class DeformMove : public DeformBase
{
public:
void setFactor(qreal factor) {
m_factor = factor;
}
void setDistance(qreal dx, qreal dy) {
m_dx = dx;
m_dy = dy;
}
- virtual void transform(qreal* maskX, qreal* maskY, qreal distance) {
+ void transform(qreal* maskX, qreal* maskY, qreal distance) override {
*maskX -= m_dx * m_factor * (1.0 - distance);
*maskY -= m_dy * m_factor * (1.0 - distance);
}
private:
qreal m_dx;
qreal m_dy;
qreal m_factor;
};
/// Inverse lens distortion
class DeformLens : public DeformBase
{
public:
void setLensFactor(qreal k1, qreal k2) {
m_k1 = k1;
m_k2 = k2;
}
void setMaxDistance(qreal maxX, qreal maxY) {
m_maxX = maxX;
m_maxY = maxY;
}
void setMode(bool out) {
m_out = out;
}
- virtual void transform(qreal* maskX, qreal* maskY, qreal distance) {
+ void transform(qreal* maskX, qreal* maskY, qreal distance) override {
Q_UNUSED(distance);
//normalize
qreal normX = *maskX / m_maxX;
qreal normY = *maskY / m_maxY;
qreal radius_2 = normX * normX + normY * normY;
qreal radius_4 = radius_2 * radius_2;
if (m_out) {
*maskX = normX * (1.0 + m_k1 * radius_2 + m_k2 * radius_4);
*maskY = normY * (1.0 + m_k1 * radius_2 + m_k2 * radius_4);
}
else {
*maskX = normX / (1.0 + m_k1 * radius_2 + m_k2 * radius_4);
*maskY = normY / (1.0 + m_k1 * radius_2 + m_k2 * radius_4);
}
*maskX = m_maxX * (*maskX);
*maskY = m_maxY * (*maskY);
}
private:
qreal m_k1, m_k2;
qreal m_maxX, m_maxY;
bool m_out;
};
/// Randomly disturb the pixels
class DeformColor : public DeformBase
{
public:
DeformColor() {
srand48(time(0));
}
void setFactor(qreal factor) {
m_factor = factor;
}
- virtual void transform(qreal* x, qreal* y, qreal distance) {
+ void transform(qreal* x, qreal* y, qreal distance) override {
Q_UNUSED(distance);
qreal randomX = m_factor * ((drand48() * 2.0) - 1.0);
qreal randomY = m_factor * ((drand48() * 2.0) - 1.0);
*x += randomX;
*y += randomY;
}
private:
qreal m_factor;
};
class DeformBrush
{
public:
DeformBrush();
~DeformBrush();
KisFixedPaintDeviceSP paintMask(KisFixedPaintDeviceSP dab, KisPaintDeviceSP layer,
qreal scale, qreal rotation, QPointF pos,
qreal subPixelX, qreal subPixelY, int dabX, int dabY);
void setSizeProperties(BrushSizeOption * properties) {
m_sizeProperties = properties;
}
void setProperties(DeformOption * properties) {
m_properties = properties;
}
void initDeformAction();
QPointF hotSpot(qreal scale, qreal rotation);
private:
// return true if can paint
bool setupAction(
DeformModes mode, const QPointF& pos, QTransform const& rotation);
void debugColor(const quint8* data, KoColorSpace * cs);
qreal maskWidth(qreal scale) {
return m_sizeProperties->brush_diameter * scale;
}
qreal maskHeight(qreal scale) {
return m_sizeProperties->brush_diameter * m_sizeProperties->brush_aspect * scale;
}
inline qreal norme(qreal x, qreal y) {
return x * x + y * y;
}
private:
KisRandomSubAccessorSP m_srcAcc;
bool m_firstPaint;
qreal m_prevX, m_prevY;
int m_counter;
QRectF m_maskRect;
DeformBase * m_deformAction;
DeformOption * m_properties;
BrushSizeOption * m_sizeProperties;
};
#endif
diff --git a/plugins/paintops/deform/deform_paintop_plugin.h b/plugins/paintops/deform/deform_paintop_plugin.h
index dd0f4ce564..27ae87eaa1 100644
--- a/plugins/paintops/deform/deform_paintop_plugin.h
+++ b/plugins/paintops/deform/deform_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DEFORM_PAINTOP_PLUGIN_H_
#define DEFORM_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class DeformPaintOpPlugin : public QObject
{
Q_OBJECT
public:
DeformPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~DeformPaintOpPlugin();
+ ~DeformPaintOpPlugin() override;
};
#endif // DEFORM_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/deform/kis_brush_size_option.h b/plugins/paintops/deform/kis_brush_size_option.h
index a555b94d10..edcec35ba4 100644
--- a/plugins/paintops/deform/kis_brush_size_option.h
+++ b/plugins/paintops/deform/kis_brush_size_option.h
@@ -1,98 +1,98 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SIZE_OPTION_H_
#define KIS_SIZE_OPTION_H_
#include <cmath>
#include <QtGlobal>
#include <kis_paintop_option.h>
class KisBrushSizeOptionsWidget;
const QString BRUSH_SHAPE = "Brush/shape";
const QString BRUSH_DIAMETER = "Brush/diameter";
const QString BRUSH_ASPECT = "Brush/aspect";
const QString BRUSH_SCALE = "Brush/scale";
const QString BRUSH_ROTATION = "Brush/rotation";
const QString BRUSH_SPACING = "Brush/spacing";
const QString BRUSH_DENSITY = "Brush/density";
const QString BRUSH_JITTER_MOVEMENT = "Brush/jitterMovement";
const QString BRUSH_JITTER_MOVEMENT_ENABLED = "Brush/jitterMovementEnabled";
class KisBrushSizeOption : public KisPaintOpOption
{
public:
KisBrushSizeOption();
- ~KisBrushSizeOption();
+ ~KisBrushSizeOption() override;
int diameter() const;
void setDiameter(int diameter);
void setSpacing(qreal spacing);
qreal spacing() const;
qreal brushAspect() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisBrushSizeOptionsWidget * m_options;
};
class BrushSizeOption : public KisBaseOption
{
public:
qreal brush_diameter;
qreal brush_aspect;
qreal brush_rotation;
qreal brush_scale;
qreal brush_spacing;
qreal brush_density;
qreal brush_jitter_movement;
bool brush_jitter_movement_enabled;
public:
- void readOptionSettingImpl(const KisPropertiesConfiguration *setting) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration *setting) override {
brush_diameter = setting->getDouble(BRUSH_DIAMETER);
brush_aspect = setting->getDouble(BRUSH_ASPECT);
brush_rotation = setting->getDouble(BRUSH_ROTATION);
brush_scale = setting->getDouble(BRUSH_SCALE);
brush_spacing = setting->getDouble(BRUSH_SPACING);
brush_density = setting->getDouble(BRUSH_DENSITY);
brush_jitter_movement = setting->getDouble(BRUSH_JITTER_MOVEMENT);
brush_jitter_movement_enabled = setting->getBool(BRUSH_JITTER_MOVEMENT_ENABLED);
}
- void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override {
setting->setProperty(BRUSH_DIAMETER, brush_diameter);
setting->setProperty(BRUSH_ASPECT, brush_aspect);
setting->setProperty(BRUSH_ROTATION, brush_rotation);
setting->setProperty(BRUSH_SCALE, brush_scale);
setting->setProperty(BRUSH_SPACING, brush_spacing);
setting->setProperty(BRUSH_DENSITY, brush_density);
setting->setProperty(BRUSH_JITTER_MOVEMENT, brush_jitter_movement);
setting->setProperty(BRUSH_JITTER_MOVEMENT_ENABLED, brush_jitter_movement_enabled);
}
};
#endif
diff --git a/plugins/paintops/deform/kis_deform_option.h b/plugins/paintops/deform/kis_deform_option.h
index c99f4b94c1..ade30d5849 100644
--- a/plugins/paintops/deform/kis_deform_option.h
+++ b/plugins/paintops/deform/kis_deform_option.h
@@ -1,81 +1,81 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DEFORM_OPTION_H
#define KIS_DEFORM_OPTION_H
#include <kis_paintop_option.h>
class KisDeformOptionsWidget;
class KisPaintopLodLimitations;
const QString DEFORM_AMOUNT = "Deform/deformAmount";
const QString DEFORM_ACTION = "Deform/deformAction";
const QString DEFORM_USE_BILINEAR = "Deform/bilinear";
const QString DEFORM_USE_MOVEMENT_PAINT = "Deform/useMovementPaint";
const QString DEFORM_USE_COUNTER = "Deform/useCounter";
const QString DEFORM_USE_OLD_DATA = "Deform/useOldData";
class KisDeformOption : public KisPaintOpOption
{
public:
KisDeformOption();
- ~KisDeformOption();
+ ~KisDeformOption() override;
double deformAmount() const;
int deformAction() const;
bool bilinear() const;
bool useMovementPaint() const;
bool useCounter() const;
bool useOldData() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
KisDeformOptionsWidget * m_options;
};
struct DeformOption {
qreal deform_amount;
bool deform_use_bilinear;
bool deform_use_counter;
bool deform_use_old_data;
int deform_action;
void readOptionSetting(const KisPropertiesConfigurationSP config) {
deform_amount = config->getDouble(DEFORM_AMOUNT);
deform_use_bilinear = config->getBool(DEFORM_USE_BILINEAR);
deform_use_counter = config->getBool(DEFORM_USE_COUNTER);
deform_use_old_data = config->getBool(DEFORM_USE_OLD_DATA);
deform_action = config->getInt(DEFORM_ACTION);
}
void writeOptionSetting(KisPropertiesConfigurationSP config) const {
config->setProperty(DEFORM_AMOUNT, deform_amount);
config->setProperty(DEFORM_ACTION, deform_action);
config->setProperty(DEFORM_USE_BILINEAR, deform_use_bilinear);
config->setProperty(DEFORM_USE_COUNTER, deform_use_counter);
config->setProperty(DEFORM_USE_OLD_DATA, deform_use_old_data);
}
};
#endif
diff --git a/plugins/paintops/deform/kis_deform_paintop.h b/plugins/paintops/deform/kis_deform_paintop.h
index 7ab4fc2d28..b2e80cd08d 100644
--- a/plugins/paintops/deform/kis_deform_paintop.h
+++ b/plugins/paintops/deform/kis_deform_paintop.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2008,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DEFORMPAINTOP_H_
#define KIS_DEFORMPAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include <kis_pressure_size_option.h>
#include <kis_pressure_opacity_option.h>
#include <kis_pressure_rotation_option.h>
#include "deform_brush.h"
#include "kis_deform_paintop_settings.h"
#include "kis_deform_option.h"
class KisPainter;
class KisDeformPaintOp : public KisPaintOp
{
public:
KisDeformPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- virtual ~KisDeformPaintOp();
+ ~KisDeformPaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
KisPaintDeviceSP m_dab;
KisPaintDeviceSP m_dev;
DeformBrush m_deformBrush;
DeformOption m_properties;
BrushSizeOption m_sizeProperties;
KisPressureSizeOption m_sizeOption;
KisPressureOpacityOption m_opacityOption;
KisPressureRotationOption m_rotationOption;
qreal m_xSpacing;
qreal m_ySpacing;
qreal m_spacing;
};
#endif // KIS_DEFORMPAINTOP_H_
diff --git a/plugins/paintops/deform/kis_deform_paintop_settings.h b/plugins/paintops/deform/kis_deform_paintop_settings.h
index d13399886d..76484b2748 100644
--- a/plugins/paintops/deform/kis_deform_paintop_settings.h
+++ b/plugins/paintops/deform/kis_deform_paintop_settings.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008,2009 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DEFORM_PAINTOP_SETTINGS_H_
#define KIS_DEFORM_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
#include <brushengine/kis_paintop_settings.h>
#include <kis_types.h>
#include <kis_outline_generation_policy.h>
class KisDeformPaintOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSettings>
{
public:
KisDeformPaintOpSettings();
- ~KisDeformPaintOpSettings();
+ ~KisDeformPaintOpSettings() override;
void setPaintOpSize(qreal value) override;
qreal paintOpSize() const override;
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
- bool paintIncremental();
- bool isAirbrushing() const;
- int rate() const;
+ bool paintIncremental() override;
+ bool isAirbrushing() const override;
+ int rate() const override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/paintops/deform/kis_deform_paintop_settings_widget.h b/plugins/paintops/deform/kis_deform_paintop_settings_widget.h
index fcfd1f2b45..63292d045b 100644
--- a/plugins/paintops/deform/kis_deform_paintop_settings_widget.h
+++ b/plugins/paintops/deform/kis_deform_paintop_settings_widget.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2008,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DEFORM_PAINTOP_SETTINGS_WIDGET_H_
#define KIS_DEFORM_PAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisDeformOption;
class KisBrushSizeOption;
class KisDeformPaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisDeformPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisDeformPaintOpSettingsWidget();
+ ~KisDeformPaintOpSettingsWidget() override;
- virtual KisPropertiesConfigurationSP configuration() const override;
+ KisPropertiesConfigurationSP configuration() const override;
private:
KisDeformOption * m_deformOption;
KisBrushSizeOption * m_brushSizeOption;
};
#endif
diff --git a/plugins/paintops/dynadraw/dyna_paintop_plugin.h b/plugins/paintops/dynadraw/dyna_paintop_plugin.h
index b16a927feb..51f04cd98d 100644
--- a/plugins/paintops/dynadraw/dyna_paintop_plugin.h
+++ b/plugins/paintops/dynadraw/dyna_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2009 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DYNA_PAINTOP_PLUGIN_H_
#define DYNA_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class DynaPaintOpPlugin : public QObject
{
Q_OBJECT
public:
DynaPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~DynaPaintOpPlugin();
+ ~DynaPaintOpPlugin() override;
};
#endif // DYNA_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/dynadraw/kis_dyna_paintop.h b/plugins/paintops/dynadraw/kis_dyna_paintop.h
index 21cd132bbd..f9be4aea7e 100644
--- a/plugins/paintops/dynadraw/kis_dyna_paintop.h
+++ b/plugins/paintops/dynadraw/kis_dyna_paintop.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2009-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DYNA_PAINTOP_H_
#define KIS_DYNA_PAINTOP_H_
#include <klocalizedstring.h>
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "dyna_brush.h"
class KisPainter;
class KisDynaPaintOpSettings;
class KisDynaPaintOp : public KisPaintOp
{
public:
KisDynaPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- ~KisDynaPaintOp();
+ ~KisDynaPaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
virtual bool incremental() const {
return true;
}
private:
KisDynaProperties m_properties;
KisPaintDeviceSP m_dab;
DynaBrush m_dynaBrush;
};
#endif // KIS_DYNA_PAINTOP_H_
diff --git a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
index f3ba57d889..d2fb762e51 100644
--- a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
+++ b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2009-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DYNA_PAINTOP_SETTINGS_H_
#define KIS_DYNA_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
#include <brushengine/kis_paintop_settings.h>
class KisDynaPaintOpSettings : public KisPaintOpSettings
{
public:
KisDynaPaintOpSettings();
- ~KisDynaPaintOpSettings();
+ ~KisDynaPaintOpSettings() override;
void setPaintOpSize(qreal value) override;
qreal paintOpSize() const override;
bool paintIncremental() override;
bool isAirbrushing() const override;
int rate() const override;
QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/paintops/dynadraw/kis_dyna_paintop_settings_widget.h b/plugins/paintops/dynadraw/kis_dyna_paintop_settings_widget.h
index 4aab1dc441..608487a809 100644
--- a/plugins/paintops/dynadraw/kis_dyna_paintop_settings_widget.h
+++ b/plugins/paintops/dynadraw/kis_dyna_paintop_settings_widget.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2009-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DYNAPAINTOP_SETTINGS_WIDGET_H_
#define KIS_DYNAPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisDynaPaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisDynaPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisDynaPaintOpSettingsWidget();
+ ~KisDynaPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
};
#endif
diff --git a/plugins/paintops/dynadraw/kis_dynaop_option.h b/plugins/paintops/dynadraw/kis_dynaop_option.h
index 15b110401e..46c12190fd 100644
--- a/plugins/paintops/dynadraw/kis_dynaop_option.h
+++ b/plugins/paintops/dynadraw/kis_dynaop_option.h
@@ -1,119 +1,119 @@
/*
* Copyright (c) 2009-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DYNAOP_OPTION_H
#define KIS_DYNAOP_OPTION_H
#include <kis_paintop_option.h>
const QString DYNA_DIAMETER = "Dyna/diameter";
const QString DYNA_WIDTH = "Dyna/width";
const QString DYNA_MASS = "Dyna/mass";
const QString DYNA_DRAG = "Dyna/drag";
const QString DYNA_USE_FIXED_ANGLE = "Dyna/useFixedAngle";
const QString DYNA_ANGLE = "Dyna/angle";
const QString DYNA_WIDTH_RANGE = "Dyna/widthRange";
const QString DYNA_ACTION = "Dyna/action";
const QString DYNA_USE_TWO_CIRCLES = "Dyna/useTwoCirles";
const QString DYNA_ENABLE_LINE = "Dyna/enableLine";
const QString DYNA_LINE_COUNT = "Dyna/lineCount";
const QString DYNA_LINE_SPACING = "Dyna/lineSpacing";
class KisDynaOpOptionsWidget;
class KisPaintopLodLimitations;
class KisDynaOpOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisDynaOpOption();
- ~KisDynaOpOption();
+ ~KisDynaOpOption() override;
qreal initWidth() const;
qreal mass() const;
qreal drag() const;
bool useFixedAngle() const;
qreal widthRange() const;
int action() const;
bool enableLine() const;
bool useTwoCircles() const;
int lineCount() const;
qreal lineSpacing() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
KisDynaOpOptionsWidget * m_options;
};
struct DynaOption : public KisBaseOption
{
int dyna_action;
qreal dyna_width;
qreal dyna_mass;
qreal dyna_drag;
qreal dyna_angle;
qreal dyna_width_range;
int dyna_diameter;
int dyna_line_count;
qreal dyna_line_spacing;
bool dyna_enable_line;
bool dyna_use_two_circles;
bool dyna_use_fixed_angle;
- void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override {
setting->setProperty(DYNA_WIDTH, dyna_width);
setting->setProperty(DYNA_MASS, dyna_mass);
setting->setProperty(DYNA_DRAG, dyna_drag);
setting->setProperty(DYNA_USE_FIXED_ANGLE, dyna_use_fixed_angle);
setting->setProperty(DYNA_ANGLE, dyna_angle);
setting->setProperty(DYNA_WIDTH_RANGE, dyna_width_range);
setting->setProperty(DYNA_ACTION, dyna_action);
setting->setProperty(DYNA_DIAMETER, dyna_diameter);
setting->setProperty(DYNA_ENABLE_LINE, dyna_enable_line);
setting->setProperty(DYNA_USE_TWO_CIRCLES, dyna_use_two_circles);
setting->setProperty(DYNA_LINE_COUNT, dyna_line_count);
setting->setProperty(DYNA_LINE_SPACING, dyna_line_spacing);
}
- void readOptionSettingImpl(const KisPropertiesConfiguration *setting) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration *setting) override {
dyna_action = setting->getInt(DYNA_ACTION);
dyna_width = setting->getDouble(DYNA_WIDTH);
dyna_mass = setting->getDouble(DYNA_MASS);
dyna_drag = setting->getDouble(DYNA_DRAG);
dyna_angle = setting->getDouble(DYNA_ANGLE);
dyna_width_range = setting->getDouble(DYNA_WIDTH_RANGE);
dyna_diameter = setting->getInt(DYNA_DIAMETER);
dyna_line_count = setting->getInt(DYNA_LINE_COUNT);
dyna_line_spacing = setting->getDouble(DYNA_LINE_SPACING);
dyna_enable_line = setting->getBool(DYNA_ENABLE_LINE);
dyna_use_two_circles = setting->getBool(DYNA_USE_TWO_CIRCLES);
dyna_use_fixed_angle = setting->getBool(DYNA_USE_FIXED_ANGLE);
}
};
#endif
diff --git a/plugins/paintops/experiment/experiment_paintop_plugin.h b/plugins/paintops/experiment/experiment_paintop_plugin.h
index e17e00c63b..98eac05330 100644
--- a/plugins/paintops/experiment/experiment_paintop_plugin.h
+++ b/plugins/paintops/experiment/experiment_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef EXPERIMENT_PAINTOP_PLUGIN_H_
#define EXPERIMENT_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class ExperimentPaintOpPlugin : public QObject
{
Q_OBJECT
public:
ExperimentPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~ExperimentPaintOpPlugin();
+ ~ExperimentPaintOpPlugin() override;
};
#endif // EXPERIMENT_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/experiment/kis_experiment_paintop.h b/plugins/paintops/experiment/kis_experiment_paintop.h
index 0a8dc4f42f..2fa232836f 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop.h
+++ b/plugins/paintops/experiment/kis_experiment_paintop.h
@@ -1,86 +1,86 @@
/*
* Copyright (c) 2010-2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_EXPERIMENT_PAINTOP_H_
#define KIS_EXPERIMENT_PAINTOP_H_
#include <klocalizedstring.h>
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "kis_experiment_paintop_settings.h"
#include "kis_experimentop_option.h"
class QPointF;
class KisPainter;
class KisExperimentPaintOp : public KisPaintOp
{
public:
KisExperimentPaintOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image);
- ~KisExperimentPaintOp();
+ ~KisExperimentPaintOp() override;
- void paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, KisDistanceInformation *currentDistance);
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ void paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, KisDistanceInformation *currentDistance) override;
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
void paintRegion(const QRegion &changedRegion);
QPointF speedCorrectedPosition(const KisPaintInformation& pi1,
const KisPaintInformation& pi2);
static qreal simplifyThreshold(const QRectF &bounds);
static QPointF getAngle(const QPointF& p1, const QPointF& p2, qreal distance);
static QPainterPath applyDisplace(const QPainterPath& path, int speed);
bool m_displaceEnabled;
int m_displaceCoeff;
QPainterPath m_lastPaintedPath;
bool m_windingFill;
bool m_hardEdge;
bool m_speedEnabled;
int m_speedMultiplier;
qreal m_savedSpeedCoeff;
QPointF m_savedSpeedPoint;
bool m_smoothingEnabled;
int m_smoothingThreshold;
QPointF m_savedSmoothingPoint;
int m_savedSmoothingDistance;
int m_savedUpdateDistance;
QVector<QPointF> m_savedPoints;
int m_lastPaintTime;
bool m_firstRun;
QPointF m_center;
QPainterPath m_path;
ExperimentOption m_experimentOption;
bool m_useMirroring;
KisPainter *m_originalPainter;
KisPaintDeviceSP m_originalDevice;
};
#endif // KIS_EXPERIMENT_PAINTOP_H_
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings.h b/plugins/paintops/experiment/kis_experiment_paintop_settings.h
index 90075981c0..b75459080c 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings.h
+++ b/plugins/paintops/experiment/kis_experiment_paintop_settings.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_EXPERIMENT_PAINTOP_SETTINGS_H_
#define KIS_EXPERIMENT_PAINTOP_SETTINGS_H_
#include <brushengine/kis_no_size_paintop_settings.h>
#include <QScopedPointer>
class KisExperimentPaintOpSettings : public KisNoSizePaintOpSettings
{
public:
KisExperimentPaintOpSettings();
- virtual ~KisExperimentPaintOpSettings();
+ ~KisExperimentPaintOpSettings() override;
- bool paintIncremental();
- QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode);
+ bool paintIncremental() override;
+ QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
index 0234ada683..2dcedbc868 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
@@ -1,35 +1,35 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
#define KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisExperimentPaintOpSettingsWidget();
+ ~KisExperimentPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
};
#endif
diff --git a/plugins/paintops/experiment/kis_experimentop_option.h b/plugins/paintops/experiment/kis_experimentop_option.h
index 18dc154e26..3de4897c69 100644
--- a/plugins/paintops/experiment/kis_experimentop_option.h
+++ b/plugins/paintops/experiment/kis_experimentop_option.h
@@ -1,98 +1,98 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_EXPERIMENTOP_OPTION_H
#define KIS_EXPERIMENTOP_OPTION_H
#include <kis_paintop_option.h>
class KisPaintopLodLimitations;
const QString EXPERIMENT_DISPLACEMENT_ENABLED = "Experiment/displacementEnabled";
const QString EXPERIMENT_DISPLACEMENT_VALUE = "Experiment/displacement";
const QString EXPERIMENT_SMOOTHING_ENABLED = "Experiment/smoothing";
const QString EXPERIMENT_SMOOTHING_VALUE = "Experiment/smoothingValue";
const QString EXPERIMENT_SPEED_ENABLED = "Experiment/speedEnabled";
const QString EXPERIMENT_SPEED_VALUE = "Experiment/speed";
const QString EXPERIMENT_WINDING_FILL = "Experiment/windingFill";
const QString EXPERIMENT_HARD_EDGE = "Experiment/hardEdge";
class KisExperimentOpOptionsWidget;
class KisExperimentOpOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisExperimentOpOption();
- ~KisExperimentOpOption();
+ ~KisExperimentOpOption() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private Q_SLOTS:
void enableSpeed(qreal value);
void enableSmooth(qreal value);
void enableDisplacement(qreal value);
private:
KisExperimentOpOptionsWidget * m_options;
};
class ExperimentOption
{
public:
bool isDisplacementEnabled;
qreal displacement;
bool isSpeedEnabled;
qreal speed;
bool isSmoothingEnabled;
qreal smoothing;
bool windingFill;
bool hardEdge;
void readOptionSetting(const KisPropertiesConfigurationSP setting) {
isDisplacementEnabled = setting->getBool(EXPERIMENT_DISPLACEMENT_ENABLED);
displacement = setting->getDouble(EXPERIMENT_DISPLACEMENT_VALUE, 50.0);
isSpeedEnabled = setting->getBool(EXPERIMENT_SPEED_ENABLED);
speed = setting->getDouble(EXPERIMENT_SPEED_VALUE, 50.0);
isSmoothingEnabled = setting->getBool(EXPERIMENT_SMOOTHING_ENABLED);
smoothing = setting->getDouble(EXPERIMENT_SMOOTHING_VALUE, 20.0);
windingFill = setting->getBool(EXPERIMENT_WINDING_FILL);
hardEdge = setting->getBool(EXPERIMENT_HARD_EDGE);
}
void writeOptionSetting(KisPropertiesConfigurationSP setting) const {
setting->setProperty(EXPERIMENT_DISPLACEMENT_ENABLED, isDisplacementEnabled);
setting->setProperty(EXPERIMENT_DISPLACEMENT_VALUE, displacement);
setting->setProperty(EXPERIMENT_SPEED_ENABLED, isSpeedEnabled);
setting->setProperty(EXPERIMENT_SPEED_VALUE, speed);
setting->setProperty(EXPERIMENT_SMOOTHING_ENABLED, isSmoothingEnabled);
setting->setProperty(EXPERIMENT_SMOOTHING_VALUE, smoothing);
setting->setProperty(EXPERIMENT_WINDING_FILL, windingFill);
setting->setProperty(EXPERIMENT_HARD_EDGE, hardEdge);
}
};
#endif
diff --git a/plugins/paintops/filterop/filterop.h b/plugins/paintops/filterop/filterop.h
index 975244efbd..3dccdedcce 100644
--- a/plugins/paintops/filterop/filterop.h
+++ b/plugins/paintops/filterop/filterop.h
@@ -1,33 +1,33 @@
/*
* Copyright (c) 2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _FILTEROP_H_
#define _FILTEROP_H_
#include <QObject>
#include <QVariant>
class FilterOp : public QObject
{
Q_OBJECT
public:
FilterOp(QObject *parent, const QVariantList &);
- virtual ~FilterOp();
+ ~FilterOp() override;
};
#endif
diff --git a/plugins/paintops/filterop/kis_filterop.h b/plugins/paintops/filterop/kis_filterop.h
index c152b39795..ce4960ac34 100644
--- a/plugins/paintops/filterop/kis_filterop.h
+++ b/plugins/paintops/filterop/kis_filterop.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILTEROP_H_
#define KIS_FILTEROP_H_
#include "kis_brush_based_paintop.h"
#include <kis_pressure_size_option.h>
#include <kis_pressure_rotation_option.h>
class KisFilterConfiguration;
class KisFilterOpSettings;
class KisPaintInformation;
class KisPainter;
class KisFilterOp : public KisBrushBasedPaintOp
{
public:
KisFilterOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- ~KisFilterOp();
+ ~KisFilterOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
KisPaintDeviceSP m_tmpDevice;
KisPressureSizeOption m_sizeOption;
KisPressureRotationOption m_rotationOption;
KisFilterSP m_filter;
KisFilterConfigurationSP m_filterConfiguration;
bool m_smudgeMode;
};
#endif // KIS_FILTEROP_H_
diff --git a/plugins/paintops/filterop/kis_filterop_settings.h b/plugins/paintops/filterop/kis_filterop_settings.h
index 8dcee32fc5..a50b005773 100644
--- a/plugins/paintops/filterop/kis_filterop_settings.h
+++ b/plugins/paintops/filterop/kis_filterop_settings.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILTEROP_SETTINGS_H_
#define KIS_FILTEROP_SETTINGS_H_
#include <kis_brush_based_paintop_settings.h>
#include <kis_types.h>
#include "kis_filterop_settings_widget.h"
class QDomElement;
class KisFilterConfiguration;
class KisFilterOpSettings : public KisBrushBasedPaintOpSettings
{
public:
KisFilterOpSettings();
- virtual ~KisFilterOpSettings();
- bool paintIncremental();
+ ~KisFilterOpSettings() override;
+ bool paintIncremental() override;
KisFilterConfigurationSP filterConfig() const;
using KisPaintOpSettings::toXML;
- void toXML(QDomDocument& doc, QDomElement& root) const;
+ void toXML(QDomDocument& doc, QDomElement& root) const override;
using KisPaintOpSettings::fromXML;
- void fromXML(const QDomElement& e);
+ void fromXML(const QDomElement& e) override;
};
#endif // KIS_FILTEROP_SETTINGS_H_
diff --git a/plugins/paintops/filterop/kis_filterop_settings_widget.h b/plugins/paintops/filterop/kis_filterop_settings_widget.h
index 176fd000f8..69d5deff47 100644
--- a/plugins/paintops/filterop/kis_filterop_settings_widget.h
+++ b/plugins/paintops/filterop/kis_filterop_settings_widget.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004-2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILTEROP_SETTINGS_WIDGET_H_
#define KIS_FILTEROP_SETTINGS_WIDGET_H_
#include <kis_brush_based_paintop_options_widget.h>
#include <kis_image.h>
class KisFilterOption;
class KisFilterOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisFilterOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisFilterOpSettingsWidget();
+ ~KisFilterOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
KisFilterOption* m_filterOption;
};
#endif // KIS_FILTEROP_SETTINGS_WIDGET_H_
diff --git a/plugins/paintops/gridbrush/grid_paintop_plugin.h b/plugins/paintops/gridbrush/grid_paintop_plugin.h
index 41518cd1f9..0b9244d233 100644
--- a/plugins/paintops/gridbrush/grid_paintop_plugin.h
+++ b/plugins/paintops/gridbrush/grid_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2009 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef GRID_PAINTOP_PLUGIN_H_
#define GRID_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class GridPaintOpPlugin : public QObject
{
Q_OBJECT
public:
GridPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~GridPaintOpPlugin();
+ ~GridPaintOpPlugin() override;
};
#endif // GRID_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop.h b/plugins/paintops/gridbrush/kis_grid_paintop.h
index 52ba7e3272..ab0afccb86 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop.h
+++ b/plugins/paintops/gridbrush/kis_grid_paintop.h
@@ -1,82 +1,82 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRID_PAINTOP_H_
#define KIS_GRID_PAINTOP_H_
//#define BENCHMARK
#include <klocalizedstring.h>
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include <kis_color_option.h>
#include "kis_grid_paintop_settings.h"
class KisPainter;
class KisGridProperties
{
public:
quint16 gridWidth;
quint16 gridHeight;
quint16 divisionLevel;
bool pressureDivision;
bool randomBorder;
qreal scale;
qreal vertBorder;
qreal horizBorder;
quint8 shape;
public:
void readOptionSetting(const KisPropertiesConfigurationSP setting);
void writeOptionSetting(KisPropertiesConfigurationSP setting);
};
class KisGridPaintOp : public KisPaintOp
{
public:
KisGridPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- ~KisGridPaintOp();
+ ~KisGridPaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
KisGridPaintOpSettingsSP m_settings;
KisImageWSP m_image;
KisPaintDeviceSP m_dab;
KisPainter* m_painter;
qreal m_xSpacing;
qreal m_ySpacing;
qreal m_spacing;
KisGridProperties m_properties;
KisColorProperties m_colorProperties;
KisNodeSP m_node;
#ifdef BENCHMARK
int m_total;
int m_count;
#endif
};
#endif // KIS_GRID_PAINTOP_H_
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop_settings.h b/plugins/paintops/gridbrush/kis_grid_paintop_settings.h
index ed56955792..db8d1d9b5d 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop_settings.h
+++ b/plugins/paintops/gridbrush/kis_grid_paintop_settings.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRID_PAINTOP_SETTINGS_H_
#define KIS_GRID_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
#include <brushengine/kis_paintop_settings.h>
#include <kis_types.h>
#include <kis_outline_generation_policy.h>
#include "kis_grid_paintop_settings_widget.h"
class KisGridPaintOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSettings>
{
public:
KisGridPaintOpSettings();
- ~KisGridPaintOpSettings();
+ ~KisGridPaintOpSettings() override;
void setPaintOpSize(qreal value) override;
qreal paintOpSize() const override;
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
bool paintIncremental() override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
typedef KisSharedPtr<KisGridPaintOpSettings> KisGridPaintOpSettingsSP;
#endif
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h b/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
index ff427b5045..d51851488c 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
+++ b/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2009 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRIDPAINTOP_SETTINGS_WIDGET_H_
#define KIS_GRIDPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisGridOpOption;
class KisGridShapeOption;
class KisColorOption;
class KisGridPaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisGridPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisGridPaintOpSettingsWidget();
+ ~KisGridPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
KisGridOpOption *m_gridOption;
KisGridShapeOption *m_gridShapeOption;
KisColorOption *m_ColorOption;
};
#endif
diff --git a/plugins/paintops/gridbrush/kis_grid_shape_option.h b/plugins/paintops/gridbrush/kis_grid_shape_option.h
index 4e178b5e35..9493427b28 100644
--- a/plugins/paintops/gridbrush/kis_grid_shape_option.h
+++ b/plugins/paintops/gridbrush/kis_grid_shape_option.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRID_SHAPE_OPTION_H
#define KIS_GRID_SHAPE_OPTION_H
#include <kis_paintop_option.h>
const QString GRIDSHAPE_SHAPE = "GridShape/shape";
class KisShapeOptionsWidget;
class KisGridShapeOption : public KisPaintOpOption
{
public:
KisGridShapeOption();
- ~KisGridShapeOption();
+ ~KisGridShapeOption() override;
/// Ellipse, rectangle, line, pixel, anti-aliased pixel
int shape() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisShapeOptionsWidget * m_options;
};
#endif // KIS_GRID_SHAPE_OPTION_H
diff --git a/plugins/paintops/gridbrush/kis_gridop_option.h b/plugins/paintops/gridbrush/kis_gridop_option.h
index 1fd56624f7..63d772b979 100644
--- a/plugins/paintops/gridbrush/kis_gridop_option.h
+++ b/plugins/paintops/gridbrush/kis_gridop_option.h
@@ -1,100 +1,100 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_GRIDOP_OPTION_H
#define KIS_GRIDOP_OPTION_H
#include <kis_paintop_option.h>
const QString GRID_WIDTH = "Grid/gridWidth";
const QString GRID_HEIGHT = "Grid/gridHeight";
const QString GRID_DIVISION_LEVEL = "Grid/divisionLevel";
const QString GRID_PRESSURE_DIVISION = "Grid/pressureDivision";
const QString GRID_SCALE = "Grid/scale";
const QString GRID_VERTICAL_BORDER = "Grid/verticalBorder";
const QString GRID_HORIZONTAL_BORDER = "Grid/horizontalBorder";
const QString GRID_RANDOM_BORDER = "Grid/randomBorder";
class KisGridOpOptionsWidget;
class KisGridOpOption : public KisPaintOpOption
{
public:
KisGridOpOption();
- ~KisGridOpOption();
+ ~KisGridOpOption() override;
int gridWidth() const;
void setWidth(int width) const;
int gridHeight() const;
void setHeight(int height) const;
int divisionLevel() const;
bool pressureDivision() const;
qreal scale() const;
qreal vertBorder() const;
qreal horizBorder() const;
bool randomBorder() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisGridOpOptionsWidget * m_options;
};
struct GridOption : public KisBaseOption
{
int grid_width;
int grid_height;
int grid_division_level;
bool grid_pressure_division;
qreal grid_scale;
qreal grid_vertical_border;
qreal grid_horizontal_border;
bool grid_random_border;
- void readOptionSettingImpl(const KisPropertiesConfiguration *setting) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration *setting) override {
grid_width = qMax(1, setting->getInt(GRID_WIDTH));
grid_height = qMax(1, setting->getInt(GRID_HEIGHT));
grid_division_level = setting->getInt(GRID_DIVISION_LEVEL);
grid_pressure_division = setting->getBool(GRID_PRESSURE_DIVISION);
grid_scale = setting->getDouble(GRID_SCALE);
grid_vertical_border = setting->getDouble(GRID_VERTICAL_BORDER);
grid_horizontal_border = setting->getDouble(GRID_HORIZONTAL_BORDER);
grid_random_border = setting->getBool(GRID_RANDOM_BORDER);
}
- void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override {
setting->setProperty(GRID_WIDTH, qMax(1, grid_width));
setting->setProperty(GRID_HEIGHT, qMax(1, grid_height));
setting->setProperty(GRID_DIVISION_LEVEL, grid_division_level);
setting->setProperty(GRID_PRESSURE_DIVISION, grid_pressure_division);
setting->setProperty(GRID_SCALE, grid_scale);
setting->setProperty(GRID_VERTICAL_BORDER, grid_vertical_border);
setting->setProperty(GRID_HORIZONTAL_BORDER, grid_horizontal_border);
setting->setProperty(GRID_RANDOM_BORDER, grid_random_border);
}
};
#endif
diff --git a/plugins/paintops/hairy/hairy_paintop_plugin.h b/plugins/paintops/hairy/hairy_paintop_plugin.h
index 077db94c2c..845fc0ce1a 100644
--- a/plugins/paintops/hairy/hairy_paintop_plugin.h
+++ b/plugins/paintops/hairy/hairy_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef HAIRY_PAINTOP_PLUGIN_H_
#define HAIRY_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class HairyPaintOpPlugin : public QObject
{
Q_OBJECT
public:
HairyPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~HairyPaintOpPlugin();
+ ~HairyPaintOpPlugin() override;
};
#endif // HAIRY_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/hairy/kis_hairy_bristle_option.h b/plugins/paintops/hairy/kis_hairy_bristle_option.h
index a9b162e467..6b6966fe12 100644
--- a/plugins/paintops/hairy/kis_hairy_bristle_option.h
+++ b/plugins/paintops/hairy/kis_hairy_bristle_option.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HAIRY_BRISTLE_OPTION_H
#define KIS_HAIRY_BRISTLE_OPTION_H
#include <kis_paintop_option.h>
class KisPaintopLodLimitations;
const QString HAIRY_BRISTLE_USE_MOUSEPRESSURE = "HairyBristle/useMousePressure";
const QString HAIRY_BRISTLE_SCALE = "HairyBristle/scale";
const QString HAIRY_BRISTLE_SHEAR = "HairyBristle/shear";
const QString HAIRY_BRISTLE_RANDOM = "HairyBristle/random";
const QString HAIRY_BRISTLE_DENSITY = "HairyBristle/density";
const QString HAIRY_BRISTLE_THRESHOLD = "HairyBristle/threshold";
const QString HAIRY_BRISTLE_ANTI_ALIASING = "HairyBristle/antialias";
const QString HAIRY_BRISTLE_USE_COMPOSITING = "HairyBristle/useCompositing";
const QString HAIRY_BRISTLE_CONNECTED = "HairyBristle/isConnected";
class KisBristleOptionsWidget;
class KisHairyBristleOption : public KisPaintOpOption
{
public:
KisHairyBristleOption();
- ~KisHairyBristleOption();
+ ~KisHairyBristleOption() override;
void setScaleFactor(qreal scale) const;
bool useMousePressure() const;
double scaleFactor() const;
double shearFactor() const;
double randomFactor() const;
- void writeOptionSetting(KisPropertiesConfigurationSP config) const;
- void readOptionSetting(const KisPropertiesConfigurationSP config);
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP config) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP config) override;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
KisBristleOptionsWidget * m_options;
};
#endif // KIS_HAIRY_BRISTLE_OPTION_H
diff --git a/plugins/paintops/hairy/kis_hairy_ink_option.h b/plugins/paintops/hairy/kis_hairy_ink_option.h
index 39a2680170..71a0f79d6a 100644
--- a/plugins/paintops/hairy/kis_hairy_ink_option.h
+++ b/plugins/paintops/hairy/kis_hairy_ink_option.h
@@ -1,63 +1,63 @@
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HAIRY_INK_OPTION_H
#define KIS_HAIRY_INK_OPTION_H
#include <kis_paintop_option.h>
const QString HAIRY_INK_DEPLETION_ENABLED = "HairyInk/enabled";
const QString HAIRY_INK_AMOUNT = "HairyInk/inkAmount";
const QString HAIRY_INK_USE_SATURATION = "HairyInk/useSaturation";
const QString HAIRY_INK_USE_OPACITY = "HairyInk/useOpacity";
const QString HAIRY_INK_USE_WEIGHTS = "HairyInk/useWeights";
const QString HAIRY_INK_PRESSURE_WEIGHT = "HairyInk/pressureWeights";
const QString HAIRY_INK_BRISTLE_LENGTH_WEIGHT = "HairyInk/bristleLengthWeights";
const QString HAIRY_INK_BRISTLE_INK_AMOUNT_WEIGHT = "HairyInk/bristleInkAmountWeight";
const QString HAIRY_INK_DEPLETION_WEIGHT = "HairyInk/inkDepletionWeight";
const QString HAIRY_INK_DEPLETION_CURVE = "HairyInk/inkDepletionCurve";
const QString HAIRY_INK_SOAK = "HairyInk/soak";
class KisInkOptionsWidget;
class KisHairyInkOption : public KisPaintOpOption
{
public:
KisHairyInkOption();
- ~KisHairyInkOption();
+ ~KisHairyInkOption() override;
int inkAmount() const;
QList<float> curve() const;
bool useSaturation() const;
bool useOpacity() const;
bool useWeights() const;
int pressureWeight() const;
int bristleLengthWeight() const;
int bristleInkAmountWeight() const;
int inkDepletionWeight() const;
int m_curveSamples;
- void writeOptionSetting(KisPropertiesConfigurationSP config) const;
- void readOptionSetting(const KisPropertiesConfigurationSP config);
+ void writeOptionSetting(KisPropertiesConfigurationSP config) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP config) override;
private:
KisInkOptionsWidget * m_options;
};
#endif // KIS_HAIRY_SHAPE_OPTION_H
diff --git a/plugins/paintops/hairy/kis_hairy_paintop.h b/plugins/paintops/hairy/kis_hairy_paintop.h
index 0396fdf1a0..620e8e4c17 100644
--- a/plugins/paintops/hairy/kis_hairy_paintop.h
+++ b/plugins/paintops/hairy/kis_hairy_paintop.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HAIRYPAINTOP_H_
#define KIS_HAIRYPAINTOP_H_
#include <klocalizedstring.h>
#include <brushengine/kis_paintop.h>
#include <brushengine/kis_paintop_factory.h>
#include <kis_types.h>
#include "hairy_brush.h"
#include <kis_pressure_size_option.h>
#include <kis_pressure_rotation_option.h>
#include <kis_pressure_opacity_option.h>
class KisPainter;
class KisBrushBasedPaintOpSettings;
class KisHairyPaintOp : public KisPaintOp
{
public:
KisHairyPaintOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image);
- KisSpacingInformation paintAt(const KisPaintInformation& info);
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
private:
KisHairyProperties m_properties;
KisPaintDeviceSP m_dab;
KisPaintDeviceSP m_dev;
HairyBrush m_brush;
KisPressureRotationOption m_rotationOption;
KisPressureSizeOption m_sizeOption;
KisPressureOpacityOption m_opacityOption;
void loadSettings(const KisBrushBasedPaintOpSettings* settings);
};
#endif // KIS_HAIRYPAINTOP_H_
diff --git a/plugins/paintops/hairy/kis_hairy_paintop_settings.h b/plugins/paintops/hairy/kis_hairy_paintop_settings.h
index 63e786ebf9..83cdb0c272 100644
--- a/plugins/paintops/hairy/kis_hairy_paintop_settings.h
+++ b/plugins/paintops/hairy/kis_hairy_paintop_settings.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HAIRYPAINTOP_SETTINGS_H_
#define KIS_HAIRYPAINTOP_SETTINGS_H_
#include <QList>
#include <kis_brush_based_paintop_settings.h>
#include <kis_types.h>
class KisHairyPaintOpSettings : public KisBrushBasedPaintOpSettings
{
public:
using KisPaintOpSettings::fromXML;
KisHairyPaintOpSettings();
using KisBrushBasedPaintOpSettings::brushOutline;
- QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode);
+ QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
};
#endif
diff --git a/plugins/paintops/hairy/kis_hairy_paintop_settings_widget.h b/plugins/paintops/hairy/kis_hairy_paintop_settings_widget.h
index 5216f8e370..9bbd64c2e5 100644
--- a/plugins/paintops/hairy/kis_hairy_paintop_settings_widget.h
+++ b/plugins/paintops/hairy/kis_hairy_paintop_settings_widget.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008-2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HAIRYPAINTOP_SETTINGS_WIDGET_H_
#define KIS_HAIRYPAINTOP_SETTINGS_WIDGET_H_
#include <kis_brush_based_paintop_options_widget.h>
class KisHairyPaintOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisHairyPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisHairyPaintOpSettingsWidget();
+ ~KisHairyPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
};
#endif
diff --git a/plugins/paintops/hatching/hatching_paintop_plugin.h b/plugins/paintops/hatching/hatching_paintop_plugin.h
index ee8049b0e5..3a964905b5 100644
--- a/plugins/paintops/hatching/hatching_paintop_plugin.h
+++ b/plugins/paintops/hatching/hatching_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef HATCHING_PAINTOP_PLUGIN_H_
#define HATCHING_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class HatchingPaintOpPlugin : public QObject
{
Q_OBJECT
public:
HatchingPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~HatchingPaintOpPlugin();
+ ~HatchingPaintOpPlugin() override;
};
#endif // HATCHING_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/hatching/kis_hatching_options.h b/plugins/paintops/hatching/kis_hatching_options.h
index 2f3d75c1bc..37042095b0 100644
--- a/plugins/paintops/hatching/kis_hatching_options.h
+++ b/plugins/paintops/hatching/kis_hatching_options.h
@@ -1,93 +1,93 @@
/*
* Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HATCHING_OPTIONS_H
#define KIS_HATCHING_OPTIONS_H
#include <kis_paintop_option.h>
class KisPaintopLodLimitations;
class KisHatchingOptionsWidget;
class KisHatchingOptions : public KisPaintOpOption
{
public:
KisHatchingOptions();
- ~KisHatchingOptions();
+ ~KisHatchingOptions() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
KisHatchingOptionsWidget *m_options;
};
struct HatchingOption {
qreal angle;
qreal separation;
qreal thickness;
qreal origin_x;
qreal origin_y;
bool bool_nocrosshatching;
bool bool_perpendicular;
bool bool_minusthenplus;
bool bool_plusthenminus;
bool bool_moirepattern;
int separationintervals;
void writeOptionSetting(KisPropertiesConfigurationSP setting) const {
setting->setProperty("Hatching/angle", angle);
setting->setProperty("Hatching/separation", separation);
setting->setProperty("Hatching/thickness", thickness);
setting->setProperty("Hatching/origin_x", origin_x);
setting->setProperty("Hatching/origin_y", origin_y);
setting->setProperty("Hatching/bool_nocrosshatching", bool_nocrosshatching);
setting->setProperty("Hatching/bool_perpendicular", bool_perpendicular);
setting->setProperty("Hatching/bool_minusthenplus", bool_minusthenplus);
setting->setProperty("Hatching/bool_plusthenminus", bool_plusthenminus);
setting->setProperty("Hatching/bool_moirepattern", bool_moirepattern);
setting->setProperty("Hatching/separationintervals", separationintervals);
}
void readOptionSetting(const KisPropertiesConfigurationSP setting) {
angle = setting->getDouble("Hatching/angle");
separation = setting->getDouble("Hatching/separation");
thickness = setting->getDouble("Hatching/thickness");
origin_x = setting->getDouble("Hatching/origin_x");
origin_y = setting->getDouble("Hatching/origin_y");
bool_nocrosshatching = setting->getBool("Hatching/bool_nocrosshatching");
bool_perpendicular = setting->getBool("Hatching/bool_perpendicular");
bool_minusthenplus = setting->getBool("Hatching/bool_minusthenplus");
bool_plusthenminus = setting->getBool("Hatching/bool_plusthenminus");
bool_moirepattern = setting->getBool("Hatching/bool_moirepattern");
separationintervals = setting->getInt("Hatching/separationintervals");
}
};
#endif
diff --git a/plugins/paintops/hatching/kis_hatching_paintop.h b/plugins/paintops/hatching/kis_hatching_paintop.h
index e1b37a8fd0..11ad002487 100644
--- a/plugins/paintops/hatching/kis_hatching_paintop.h
+++ b/plugins/paintops/hatching/kis_hatching_paintop.h
@@ -1,104 +1,104 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008, 2009 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2010 José Luis Vergara Toloza <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HATCHING_PAINTOP_H_
#define KIS_HATCHING_PAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_brush_based_paintop.h>
#include <kis_types.h>
#include "hatching_brush.h"
#include "kis_hatching_paintop_settings.h"
#include <kis_hatching_pressure_crosshatching_option.h>
#include <kis_hatching_pressure_separation_option.h>
#include <kis_hatching_pressure_thickness_option.h>
#include <kis_pressure_opacity_option.h>
#include <kis_pressure_size_option.h>
class KisPainter;
class KisHatchingPaintOp : public KisBrushBasedPaintOp
{
public:
KisHatchingPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- virtual ~KisHatchingPaintOp();
+ ~KisHatchingPaintOp() override;
/**
* Paint a hatched dab around the mouse cursor according to
* sensor settings and user preferences.
*/
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
/**
* Returns a number between -90 and 90, and corresponds to the
* angle that results from adding angle 'spin' to 'm_settings->angle',
* corrected to coincide with the way the GUI operates.
*/
double spinAngle(double spin);
private:
KisHatchingPaintOpSettingsSP m_settings;
KisImageWSP m_image;
HatchingBrush *m_hatchingBrush;
/**
* PaintDevice that will be filled with a single pass of
* hatching by HatchingBrush::hatch
*/
KisPaintDeviceSP m_hatchedDab;
/**
* Curve to control the intensity of crosshatching
* according to user preferences set in the GUI
*/
KisHatchingPressureCrosshatchingOption m_crosshatchingOption;
/**
* Curve to control the dynamics of separation with
* device input
*/
KisHatchingPressureSeparationOption m_separationOption;
/**
* Curve to control the thickness of the hatching lines
* with device input
*/
KisHatchingPressureThicknessOption m_thicknessOption;
/**
* Curve to control the opacity of the entire dab
* with device input
*/
KisPressureOpacityOption m_opacityOption;
/**
* Curve to control the size of the entire dab
* with device input
*/
KisPressureSizeOption m_sizeOption;
};
#endif // KIS_HATCHING_PAINTOP_H_
diff --git a/plugins/paintops/hatching/kis_hatching_paintop_settings.h b/plugins/paintops/hatching/kis_hatching_paintop_settings.h
index c8c8b3ec2e..b154931b90 100644
--- a/plugins/paintops/hatching/kis_hatching_paintop_settings.h
+++ b/plugins/paintops/hatching/kis_hatching_paintop_settings.h
@@ -1,87 +1,87 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2010 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HATCHING_PAINTOP_SETTINGS_H_
#define KIS_HATCHING_PAINTOP_SETTINGS_H_
#include <brushengine/kis_paintop_settings.h>
#include <kis_brush_based_paintop_settings.h>
#include "kis_hatching_paintop_settings_widget.h"
#include <QScopedPointer>
class KisHatchingPaintOpSettings : public KisBrushBasedPaintOpSettings
{
public:
KisHatchingPaintOpSettings();
- ~KisHatchingPaintOpSettings();
+ ~KisHatchingPaintOpSettings() override;
//Dialogs enabled
bool enabledcurvecrosshatching;
bool enabledcurveopacity;
bool enabledcurveseparation;
bool enabledcurvesize;
bool enabledcurvethickness;
//Hatching Options
double angle;
double separation;
double thickness;
double origin_x;
double origin_y;
bool nocrosshatching;
bool perpendicular;
bool minusthenplus;
bool plusthenminus;
bool moirepattern;
int crosshatchingstyle;
int separationintervals;
//Hatching Preferences
//bool trigonometryalgebra;
//bool scratchoff;
bool antialias;
bool subpixelprecision;
bool opaquebackground;
//Crosshatching, Separation and Thickness curves
double crosshatchingsensorvalue;
double separationsensorvalue;
double thicknesssensorvalue;
void initializeTwin(KisPaintOpSettingsSP convenienttwin) const;
using KisPropertiesConfiguration::fromXML;
- virtual void fromXML(const QDomElement&);
+ void fromXML(const QDomElement&) override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
Q_DISABLE_COPY(KisHatchingPaintOpSettings)
struct Private;
const QScopedPointer<Private> m_d;
};
typedef KisSharedPtr<KisHatchingPaintOpSettings> KisHatchingPaintOpSettingsSP;
#endif
diff --git a/plugins/paintops/hatching/kis_hatching_paintop_settings_widget.h b/plugins/paintops/hatching/kis_hatching_paintop_settings_widget.h
index 4152e8cdde..349c5cc7f9 100644
--- a/plugins/paintops/hatching/kis_hatching_paintop_settings_widget.h
+++ b/plugins/paintops/hatching/kis_hatching_paintop_settings_widget.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
* Copyright (c) 2010 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HATCHING_PAINTOP_SETTINGS_WIDGET_H_
#define KIS_HATCHING_PAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
#include <kis_brush_based_paintop_options_widget.h>
#include "ui_wdghatchingoptions.h"
#include "ui_wdghatchingpreferences.h"
class KisHatchingPaintOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisHatchingPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisHatchingPaintOpSettingsWidget();
+ ~KisHatchingPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
};
#endif
diff --git a/plugins/paintops/hatching/kis_hatching_preferences.h b/plugins/paintops/hatching/kis_hatching_preferences.h
index cf34f50eb4..00195f3a63 100644
--- a/plugins/paintops/hatching/kis_hatching_preferences.h
+++ b/plugins/paintops/hatching/kis_hatching_preferences.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2010 José Luis Vergara <pentalis@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_HATCHING_PREFERENCES_H
#define KIS_HATCHING_PREFERENCES_H
#include <kis_paintop_option.h>
class KisHatchingPreferencesWidget;
class KisHatchingPreferences : public KisPaintOpOption
{
public:
KisHatchingPreferences();
- ~KisHatchingPreferences();
+ ~KisHatchingPreferences() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisHatchingPreferencesWidget * m_options;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_airbrush_option.h b/plugins/paintops/libpaintop/kis_airbrush_option.h
index 9a003f390b..fed1b2c9f8 100644
--- a/plugins/paintops/libpaintop/kis_airbrush_option.h
+++ b/plugins/paintops/libpaintop/kis_airbrush_option.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_AIRBRUSH_OPTION_H
#define KIS_AIRBRUSH_OPTION_H
#include <kis_paintop_option.h>
#include <kritapaintop_export.h>
const QString AIRBRUSH_ENABLED = "AirbrushOption/isAirbrushing";
const QString AIRBRUSH_RATE = "AirbrushOption/rate";
class KisAirbrushWidget;
/**
* Allows the user to activate airbrushing of the brush mask (brush is painted at the same position over and over)
* Rate is set in miliseconds.
*/
class PAINTOP_EXPORT KisAirbrushOption : public KisPaintOpOption
{
public:
KisAirbrushOption(bool enabled = true);
- ~KisAirbrushOption();
+ ~KisAirbrushOption() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisAirbrushWidget * m_optionWidget;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_auto_brush_widget.h b/plugins/paintops/libpaintop/kis_auto_brush_widget.h
index 9e6190dd27..03f74a00e2 100644
--- a/plugins/paintops/libpaintop/kis_auto_brush_widget.h
+++ b/plugins/paintops/libpaintop/kis_auto_brush_widget.h
@@ -1,81 +1,81 @@
/*
* Copyright (c) 2004,2007 Cyrille Berger <cberger@cberger.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_AUTO_BRUSH_WIDGET_H_
#define _KIS_AUTO_BRUSH_WIDGET_H_
#include <QObject>
#include <QResizeEvent>
#include "kritapaintop_export.h"
#include "ui_wdgautobrush.h"
#include <kis_auto_brush.h>
class KisSignalCompressor;
class KisAspectRatioLocker;
class PAINTOP_EXPORT KisWdgAutoBrush : public QWidget, public Ui::KisWdgAutoBrush
{
Q_OBJECT
public:
KisWdgAutoBrush(QWidget *parent, const char *name) : QWidget(parent) {
setObjectName(name); setupUi(this);
}
};
class PAINTOP_EXPORT KisAutoBrushWidget : public KisWdgAutoBrush
{
Q_OBJECT
public:
KisAutoBrushWidget(QWidget *parent, const char* name);
- ~KisAutoBrushWidget();
+ ~KisAutoBrushWidget() override;
void activate();
KisBrushSP brush();
void setBrush(KisBrushSP brush);
void setBrushSize(qreal dxPixels, qreal dyPixels);
QSizeF brushSize() const;
private Q_SLOTS:
void paramChanged();
void setStackedWidget(int);
Q_SIGNALS:
void sigBrushChanged();
protected:
- virtual void resizeEvent(QResizeEvent *);
+ void resizeEvent(QResizeEvent *) override;
private:
QImage m_brush;
KisBrushSP m_autoBrush;
bool m_linkFade;
QScopedPointer<KisSignalCompressor> m_updateCompressor;
QScopedPointer<KisAspectRatioLocker> m_fadeAspectLocker;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_bidirectional_mixing_option_widget.h b/plugins/paintops/libpaintop/kis_bidirectional_mixing_option_widget.h
index de9841b964..c2d3befde7 100644
--- a/plugins/paintops/libpaintop/kis_bidirectional_mixing_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_bidirectional_mixing_option_widget.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2008 Emanuele Tamponi <emanuele@valinor.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BIDIRECTIONAL_MIXING_OPTION_WIDGET_H
#define KIS_BIDIRECTIONAL_MIXING_OPTION_WIDGET_H
#include "kis_paintop_option.h"
#include <kis_types.h>
#include <kritapaintop_export.h>
class KisPropertiesConfiguration;
class QLabel;
const QString BIDIRECTIONAL_MIXING_ENABLED = "BidirectionalMixing/Enabled";
/**
* The bidirectional mixing option uses the painterly framework to
* implement bidirectional paint mixing (that is, paint on the canvas
* dirties the brush, and the brush mixes its color with that on the
* canvas.
*
* Taken from the complex paintop
*/
class PAINTOP_EXPORT KisBidirectionalMixingOptionWidget : public KisPaintOpOption
{
public:
KisBidirectionalMixingOptionWidget();
- ~KisBidirectionalMixingOptionWidget();
+ ~KisBidirectionalMixingOptionWidget() override;
///Reimplemented
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
///Reimplemented
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
QLabel * m_optionWidget;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop.h b/plugins/paintops/libpaintop/kis_brush_based_paintop.h
index 31fb9da493..3c7626a3df 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop.h
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop.h
@@ -1,93 +1,93 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_BASED_PAINTOP_H
#define KIS_BRUSH_BASED_PAINTOP_H
#include "kritapaintop_export.h"
#include <brushengine/kis_paintop.h>
#include "kis_dab_cache.h"
#include "kis_brush.h"
#include "kis_texture_option.h"
#include "kis_precision_option.h"
#include "kis_pressure_mirror_option.h"
#include <kis_threaded_text_rendering_workaround.h>
class KisPropertiesConfiguration;
class KisPressureSpacingOption;
class KisDabCache;
/// Internal
class TextBrushInitializationWorkaround
{
public:
TextBrushInitializationWorkaround();
~TextBrushInitializationWorkaround();
static TextBrushInitializationWorkaround* instance();
void preinitialize(KisPropertiesConfigurationSP settings);
KisBrushSP tryGetBrush(const KisPropertiesConfigurationSP settings);
private:
KisBrushSP m_brush;
KisPropertiesConfigurationSP m_settings;
};
/**
* This is a base class for paintops that use a KisBrush or derived
* brush to paint with. This is mainly important for the spacing
* generation.
*/
class PAINTOP_EXPORT KisBrushBasedPaintOp : public KisPaintOp
{
public:
KisBrushBasedPaintOp(const KisPropertiesConfigurationSP settings, KisPainter* painter);
- ~KisBrushBasedPaintOp();
+ ~KisBrushBasedPaintOp() override;
bool checkSizeTooSmall(qreal scale);
KisSpacingInformation effectiveSpacing(qreal scale) const;
KisSpacingInformation effectiveSpacing(qreal scale, qreal rotation, const KisPaintInformation &pi) const;
KisSpacingInformation effectiveSpacing(qreal scale, qreal rotation, const KisPressureSpacingOption &spacingOption, const KisPaintInformation &pi) const;
///Reimplemented, false if brush is 0
- virtual bool canPaint() const;
+ bool canPaint() const override;
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
typedef int needs_preinitialization;
static void preinitializeOpStatically(KisPaintOpSettingsSP settings);
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
private:
KisSpacingInformation effectiveSpacing(qreal dabWidth, qreal dabHeight, qreal extraScale, bool isotropicSpacing, qreal rotation, bool axesFlipped) const;
protected: // XXX: make private!
KisBrushSP m_brush;
KisTextureProperties m_textureProperties;
KisPressureMirrorOption m_mirrorOption;
KisPrecisionOption m_precisionOption;
KisDabCache *m_dabCache;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
index d2537fad5a..42a161c91c 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
@@ -1,48 +1,48 @@
/*
* Copyright (c) 2010 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_BASED_PAINTOP_OPTIONS_WIDGET_H
#define KIS_BRUSH_BASED_PAINTOP_OPTIONS_WIDGET_H
#include "kis_paintop_settings_widget.h"
#include "kis_types.h"
#include "kis_brush.h"
#include <kritapaintop_export.h>
class KisBrushOptionWidget;
class PAINTOP_EXPORT KisBrushBasedPaintopOptionWidget : public KisPaintOpSettingsWidget
{
public:
KisBrushBasedPaintopOptionWidget(QWidget* parent = 0);
- virtual ~KisBrushBasedPaintopOptionWidget();
+ ~KisBrushBasedPaintopOptionWidget() override;
void setPrecisionEnabled(bool value);
KisBrushSP brush();
- virtual bool presetIsValid();
+ bool presetIsValid() override;
protected:
KisBrushOptionWidget *brushOptionWidget() const;
private:
KisBrushOptionWidget *m_brushOption;
};
#endif // KIS_BRUSH_BASED_PAINTOP_OPTIONS_WIDGET_H
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h b/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
index 28a0db07d4..996c691ebf 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
@@ -1,90 +1,90 @@
/*
* Copyright (c) 2010 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_BASED_PAINTOP_SETTINGS_H
#define KIS_BRUSH_BASED_PAINTOP_SETTINGS_H
#include <brushengine/kis_paintop_settings.h>
#include <kritapaintop_export.h>
#include <kis_outline_generation_policy.h>
#include <kis_brush.h>
#include <kis_shared.h>
#include <kis_shared_ptr.h>
class PAINTOP_EXPORT KisBrushBasedPaintOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSettings>
{
public:
KisBrushBasedPaintOpSettings();
- virtual ~KisBrushBasedPaintOpSettings() {}
+ ~KisBrushBasedPaintOpSettings() override {}
///Reimplemented
- virtual bool paintIncremental();
+ bool paintIncremental() override;
///Reimplemented
- virtual bool isAirbrushing() const;
+ bool isAirbrushing() const override;
///Reimplemented
- virtual int rate() const;
+ int rate() const override;
using KisPaintOpSettings::brushOutline;
- virtual QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode);
+ QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
///Reimplemented
- virtual bool isValid() const;
+ bool isValid() const override;
///Reimplemented
- virtual bool isLoadable();
+ bool isLoadable() override;
KisBrushSP brush() const;
- KisPaintOpSettingsSP clone() const;
+ KisPaintOpSettingsSP clone() const override;
void setAngle(qreal value);
qreal angle();
void setSpacing(qreal spacing);
qreal spacing();
void setAutoSpacing(bool active, qreal coeff);
bool autoSpacingActive();
qreal autoSpacingCoeff();
- void setPaintOpSize(qreal value);
- qreal paintOpSize() const;
+ void setPaintOpSize(qreal value) override;
+ qreal paintOpSize() const override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
protected:
- void onPropertyChanged();
+ void onPropertyChanged() override;
QPainterPath brushOutlineImpl(const KisPaintInformation &info, OutlineMode mode, qreal additionalScale, bool forceOutline = false);
mutable KisBrushSP m_savedBrush;
QList<KisUniformPaintOpPropertyWSP> m_uniformProperties;
private:
Q_DISABLE_COPY(KisBrushBasedPaintOpSettings)
};
class KisBrushBasedPaintOpSettings;
typedef KisPinnedSharedPtr<KisBrushBasedPaintOpSettings> KisBrushBasedPaintOpSettingsSP;
#endif // KIS_BRUSH_BASED_PAINTOP_SETTINGS_H
diff --git a/plugins/paintops/libpaintop/kis_brush_chooser.h b/plugins/paintops/libpaintop/kis_brush_chooser.h
index 74bcd95f74..f87a311e14 100644
--- a/plugins/paintops/libpaintop/kis_brush_chooser.h
+++ b/plugins/paintops/libpaintop/kis_brush_chooser.h
@@ -1,88 +1,88 @@
/*
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PREDEFINED_BRUSH_CHOOSER_H_
#define KIS_PREDEFINED_BRUSH_CHOOSER_H_
#include <QLabel>
#include <kis_brush.h>
#include "kritapaintop_export.h"
#include "ui_wdgpredefinedbrushchooser.h"
class KisDoubleSliderSpinBox;
class QLabel;
class QCheckBox;
class KisDoubleSliderSpinBox;
class KisSpacingSelectionWidget;
class KisCustomBrushWidget;
class KisClipboardBrushWidget;
class KoResourceItemChooser;
class KoResource;
class PAINTOP_EXPORT KisPredefinedBrushChooser : public QWidget, Ui::WdgPredefinedBrushChooser
{
Q_OBJECT
public:
KisPredefinedBrushChooser(QWidget *parent = 0, const char *name = 0);
- virtual ~KisPredefinedBrushChooser();
+ ~KisPredefinedBrushChooser() override;
KisBrushSP brush() {
return m_brush;
};
void setBrush(KisBrushSP _brush);
void setBrushSize(qreal xPixels, qreal yPixels);
void setImage(KisImageWSP image);
private Q_SLOTS:
void slotResetBrush();
void slotSetItemSize(qreal);
void slotSetItemRotation(qreal);
void slotSpacingChanged();
void slotSetItemUseColorAsMask(bool);
void slotActivatedBrush(KoResource *);
void slotOpenStampBrush();
void slotOpenClipboardBrush();
void slotImportNewBrushResource();
void slotDeleteBrushResource();
void slotNewPredefinedBrush(KoResource *);
void update(KoResource *);
Q_SIGNALS:
void sigBrushChanged();
private:
KisBrushSP m_brush;
KoResourceItemChooser* m_itemChooser;
KisImageWSP m_image;
KisCustomBrushWidget* m_stampBrushWidget;
KisClipboardBrushWidget* m_clipboardBrushWidget;
};
#endif // KIS_PREDEFINED_BRUSH_CHOOSER_H_
diff --git a/plugins/paintops/libpaintop/kis_brush_option.h b/plugins/paintops/libpaintop/kis_brush_option.h
index 1dcf822f2f..b36b58ab78 100644
--- a/plugins/paintops/libpaintop/kis_brush_option.h
+++ b/plugins/paintops/libpaintop/kis_brush_option.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
* Copyright (C) Sven Langkamp <sven.langkamp@gmail.com>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_OPTION_H_
#define KIS_BRUSH_OPTION_H_
#include <kis_brush.h>
#include <kis_base_option.h>
#include <kis_properties_configuration.h>
#include <kis_threaded_text_rendering_workaround.h>
#include <kritapaintop_export.h>
class PAINTOP_EXPORT KisBrushOption : public KisBaseOption
{
public:
- void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const;
- void readOptionSettingImpl(const KisPropertiesConfiguration *setting);
+ void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override;
+ void readOptionSettingImpl(const KisPropertiesConfiguration *setting) override;
void readOptionSettingForceCopy(KisPropertiesConfigurationSP setting);
void readOptionSettingForceCopy(const KisPropertiesConfiguration *setting);
KisBrushSP brush() const;
void setBrush(KisBrushSP brush);
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
static bool isTextBrush(const KisPropertiesConfiguration *setting);
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
private:
void readOptionSettingInternal(const KisPropertiesConfiguration *setting, bool forceCopy);
private:
KisBrushSP m_brush;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_brush_option_widget.h b/plugins/paintops/libpaintop/kis_brush_option_widget.h
index fb365df64b..9c88cef1d1 100644
--- a/plugins/paintops/libpaintop/kis_brush_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_option_widget.h
@@ -1,74 +1,74 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_OPTION_H
#define KIS_BRUSH_OPTION_H
#include "kis_paintop_option.h"
#include "kis_brush_option.h"
#include <kritapaintop_export.h>
#include "kis_brush.h"
class KisBrushSelectionWidget;
/**
* The brush option allows the user to select a particular brush
* footprint for suitable paintops
*/
class PAINTOP_EXPORT KisBrushOptionWidget : public KisPaintOpOption
{
Q_OBJECT
public:
KisBrushOptionWidget();
/**
* @return the currently selected brush
*/
KisBrushSP brush() const;
void setAutoBrush(bool on);
void setPredefinedBrushes(bool on);
void setCustomBrush(bool on);
void setTextBrush(bool on);
- void setImage(KisImageWSP image);
+ void setImage(KisImageWSP image) override;
void setPrecisionEnabled(bool value);
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
bool presetIsValid();
void hideOptions(const QStringList &options);
private Q_SLOTS:
void brushChanged();
private:
KisBrushSelectionWidget * m_brushSelectionWidget;
KisBrushOption m_brushOption;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_brush_selection_widget.h b/plugins/paintops/libpaintop/kis_brush_selection_widget.h
index b68114d9e8..ce345ba01b 100644
--- a/plugins/paintops/libpaintop/kis_brush_selection_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_selection_widget.h
@@ -1,117 +1,117 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_BRUSH_SELECTION_WIDGET_H
#define KIS_BRUSH_SELECTION_WIDGET_H
#include <QWidget>
#include <KoGroupButton.h>
#include <kis_properties_configuration.h>
#include <kis_brush.h>
#include "kis_precision_option.h"
#include "ui_wdgbrushchooser.h"
class KisAutoBrushWidget;
class KisPredefinedBrushChooser;
class KisTextBrushChooser;
class KisCustomBrushWidget;
class KisClipboardBrushWidget;
class KisBrush;
/**
* Compound widget that collects all the various brush selection widgets.
*/
class PAINTOP_EXPORT KisBrushSelectionWidget : public QWidget
{
Q_OBJECT
public:
KisBrushSelectionWidget(QWidget * parent = 0);
- ~KisBrushSelectionWidget();
+ ~KisBrushSelectionWidget() override;
KisBrushSP brush() const;
void setAutoBrush(bool on);
void setPredefinedBrushes(bool on);
void setCustomBrush(bool on);
void setClipboardBrush(bool on);
void setTextBrush(bool on);
void setImage(KisImageWSP image);
void setCurrentBrush(KisBrushSP brush);
bool presetIsValid() {
return m_presetIsValid;
}
void writeOptionSetting(KisPropertiesConfigurationSP settings) const;
void readOptionSetting(const KisPropertiesConfigurationSP setting);
void setPrecisionEnabled(bool value);
bool autoPrecisionEnabled();
void hideOptions(const QStringList &options);
Q_SIGNALS:
void sigBrushChanged();
void sigPrecisionChanged();
private Q_SLOTS:
void buttonClicked(int id);
void precisionChanged(int value);
void setAutoPrecisionEnabled(int value);
void setSizeToStartFrom(double value);
void setDeltaValue(double value);
private:
void setCurrentWidget(QWidget * widget);
void addChooser(const QString & text, QWidget * widget, int id, KoGroupButton::GroupPosition pos);
private:
enum Type {
AUTOBRUSH,
PREDEFINEDBRUSH,
CUSTOMBRUSH,
TEXTBRUSH,
CLIPBOARDBRUSH
};
bool m_presetIsValid;
Ui_WdgBrushChooser uiWdgBrushChooser;
QGridLayout * m_layout;
QWidget * m_currentBrushWidget;
QHash<int, QWidget*> m_chooserMap;
QButtonGroup * m_buttonGroup;
QSize m_mininmumSize;
KisAutoBrushWidget * m_autoBrushWidget;
KisPredefinedBrushChooser * m_predefinedBrushWidget;
KisTextBrushChooser * m_textBrushWidget;
KisPrecisionOption m_precisionOption;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_color_option.h b/plugins/paintops/libpaintop/kis_color_option.h
index afc62e4531..4875a2262f 100644
--- a/plugins/paintops/libpaintop/kis_color_option.h
+++ b/plugins/paintops/libpaintop/kis_color_option.h
@@ -1,92 +1,92 @@
/*
* Copyright (c) 2009,2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_OPTION_H
#define KIS_COLOR_OPTION_H
#include <kis_paintop_option.h>
#include <kritapaintop_export.h>
const QString COLOROP_HUE = "ColorOption/hue";
const QString COLOROP_SATURATION = "ColorOption/saturation";
const QString COLOROP_VALUE = "ColorOption/value";
const QString COLOROP_USE_RANDOM_HSV = "ColorOption/useRandomHSV";
const QString COLOROP_USE_RANDOM_OPACITY = "ColorOption/useRandomOpacity";
const QString COLOROP_SAMPLE_COLOR = "ColorOption/sampleInputColor";
const QString COLOROP_FILL_BG = "ColorOption/fillBackground";
const QString COLOROP_COLOR_PER_PARTICLE = "ColorOption/colorPerParticle";
const QString COLOROP_MIX_BG_COLOR = "ColorOption/mixBgColor";
class KisColorOptionsWidget;
class PAINTOP_EXPORT KisColorOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisColorOption();
- ~KisColorOption();
+ ~KisColorOption() override;
bool useRandomHSV() const;
bool useRandomOpacity() const;
bool sampleInputColor() const;
bool fillBackground() const;
bool colorPerParticle() const;
bool mixBgColor() const;
// TODO: these should be intervals like 20..180
int hue() const;
int saturation() const;
int value() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private Q_SLOTS:
void setEnabled(bool);
private:
KisColorOptionsWidget * m_options;
};
class PAINTOP_EXPORT KisColorProperties
{
public:
bool useRandomHSV;
bool useRandomOpacity;
bool sampleInputColor;
bool fillBackground;
bool colorPerParticle;
bool mixBgColor;
int hue;
int saturation;
int value;
public:
/// fill the class members with related properties
void fillProperties(const KisPropertiesConfigurationSP setting);
};
#endif // KIS_COLOR_OPTION_H
diff --git a/plugins/paintops/libpaintop/kis_color_source.h b/plugins/paintops/libpaintop/kis_color_source.h
index 63403e04ae..eb8386f9c5 100644
--- a/plugins/paintops/libpaintop/kis_color_source.h
+++ b/plugins/paintops/libpaintop/kis_color_source.h
@@ -1,151 +1,151 @@
/*
* Copyright (c) 2006-2007, 2009 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DYNAMIC_COLORING_H_
#define _KIS_DYNAMIC_COLORING_H_
#include "kis_paintop_option.h"
#include <QRect>
#include <KoColor.h>
#include <kis_types.h>
#include <kritapaintop_export.h>
class KoAbstractGradient;
class KoColorTransformation;
class KisPaintInformation;
/**
* A color source allow to abstract how a brush is colorized,
* and to apply transformation.
*
* The first function to call is @ref selectColor , then any of the transformation.
*/
class PAINTOP_EXPORT KisColorSource
{
public:
virtual ~KisColorSource();
public:
/**
* This is function is called to initialize the color that will be used for the dab.
* @param mix is a parameter between 0.0 and 1.0
*/
virtual void selectColor(double mix, const KisPaintInformation &pi) = 0;
/**
* Apply a color transformation on the selected color
*/
virtual void applyColorTransformation(const KoColorTransformation* transfo) = 0;
virtual const KoColorSpace* colorSpace() const = 0;
/**
* Apply the color on a paint device
*/
virtual void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& _offset) const = 0;
/**
* @return true if the color is an uniform color
*/
virtual bool isUniformColor() const = 0;
/**
* @return the color if the color is uniformed
*/
virtual const KoColor& uniformColor() const;
};
class PAINTOP_EXPORT KisUniformColorSource : public KisColorSource
{
public:
KisUniformColorSource();
- virtual ~KisUniformColorSource();
+ ~KisUniformColorSource() override;
virtual void rotate(double);
virtual void resize(double , double);
- virtual void applyColorTransformation(const KoColorTransformation* transfo);
- virtual const KoColorSpace* colorSpace() const;
- virtual void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& offset) const;
- virtual bool isUniformColor() const;
- virtual const KoColor& uniformColor() const;
+ void applyColorTransformation(const KoColorTransformation* transfo) override;
+ const KoColorSpace* colorSpace() const override;
+ void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& offset) const override;
+ bool isUniformColor() const override;
+ const KoColor& uniformColor() const override;
protected:
KoColor m_color;
};
class PAINTOP_EXPORT KisPlainColorSource : public KisUniformColorSource
{
public:
KisPlainColorSource(const KoColor& backGroundColor, const KoColor& foreGroundColor);
- virtual ~KisPlainColorSource();
- virtual void selectColor(double mix, const KisPaintInformation &pi);
+ ~KisPlainColorSource() override;
+ void selectColor(double mix, const KisPaintInformation &pi) override;
private:
KoColor m_backGroundColor;
KoColor m_cachedBackGroundColor;
KoColor m_foreGroundColor;
};
class PAINTOP_EXPORT KisGradientColorSource : public KisUniformColorSource
{
public:
KisGradientColorSource(const KoAbstractGradient* gradient, const KoColorSpace* workingCS);
- virtual ~KisGradientColorSource();
- virtual void selectColor(double mix, const KisPaintInformation &pi);
+ ~KisGradientColorSource() override;
+ void selectColor(double mix, const KisPaintInformation &pi) override;
private:
const KoAbstractGradient* m_gradient;
};
class PAINTOP_EXPORT KisUniformRandomColorSource : public KisUniformColorSource
{
public:
KisUniformRandomColorSource();
- virtual ~KisUniformRandomColorSource();
- virtual void selectColor(double mix, const KisPaintInformation &pi);
+ ~KisUniformRandomColorSource() override;
+ void selectColor(double mix, const KisPaintInformation &pi) override;
};
class PAINTOP_EXPORT KisTotalRandomColorSource : public KisColorSource
{
public:
KisTotalRandomColorSource();
- virtual ~KisTotalRandomColorSource();
+ ~KisTotalRandomColorSource() override;
public:
- virtual void selectColor(double mix, const KisPaintInformation &pi);
- virtual void applyColorTransformation(const KoColorTransformation* transfo);
- virtual const KoColorSpace* colorSpace() const;
- virtual void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& offset) const;
+ void selectColor(double mix, const KisPaintInformation &pi) override;
+ void applyColorTransformation(const KoColorTransformation* transfo) override;
+ const KoColorSpace* colorSpace() const override;
+ void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& offset) const override;
virtual void rotate(double r);
virtual void resize(double xs, double ys);
- virtual bool isUniformColor() const;
+ bool isUniformColor() const override;
private:
const KoColorSpace* m_colorSpace;
};
class PAINTOP_EXPORT KoPatternColorSource : public KisColorSource
{
public:
KoPatternColorSource(KisPaintDeviceSP _pattern, int _width, int _height, bool _locked);
- virtual ~KoPatternColorSource();
+ ~KoPatternColorSource() override;
public:
- virtual void selectColor(double mix, const KisPaintInformation &pi);
- virtual void applyColorTransformation(const KoColorTransformation* transfo);
- virtual const KoColorSpace* colorSpace() const;
- virtual void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& _offset) const;
+ void selectColor(double mix, const KisPaintInformation &pi) override;
+ void applyColorTransformation(const KoColorTransformation* transfo) override;
+ const KoColorSpace* colorSpace() const override;
+ void colorize(KisPaintDeviceSP, const QRect& rect, const QPoint& _offset) const override;
virtual void rotate(double r);
virtual void resize(double xs, double ys);
- virtual bool isUniformColor() const;
+ bool isUniformColor() const override;
private:
const KisPaintDeviceSP m_device;
QRect m_bounds;
bool m_locked;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_color_source_option_widget.h b/plugins/paintops/libpaintop/kis_color_source_option_widget.h
index 7995e52b24..f75b803f60 100644
--- a/plugins/paintops/libpaintop/kis_color_source_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_color_source_option_widget.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COLOR_SOURCE_OPTION_WIDGET_H
#define KIS_COLOR_SOURCE_OPTION_WIDGET_H
#include "kis_paintop_option.h"
#include <kritapaintop_export.h>
class KisPaintopLodLimitations;
/**
* The brush option allows the user to select a particular brush
* footprint for suitable paintops
*/
class PAINTOP_EXPORT KisColorSourceOptionWidget : public KisPaintOpOption
{
Q_OBJECT
public:
KisColorSourceOptionWidget();
- ~KisColorSourceOptionWidget();
+ ~KisColorSourceOptionWidget() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private Q_SLOTS:
void sourceChanged();
private:
struct Private;
Private* const d;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_compositeop_option.h b/plugins/paintops/libpaintop/kis_compositeop_option.h
index a9373eea7e..271734ba4b 100644
--- a/plugins/paintops/libpaintop/kis_compositeop_option.h
+++ b/plugins/paintops/libpaintop/kis_compositeop_option.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_COMPOSITEOP_OPTION_H
#define KIS_COMPOSITEOP_OPTION_H
#include <kis_paintop_option.h>
#include <kritapaintop_export.h>
#include <QString>
// const QString AIRBRUSH_ENABLED = "AirbrushOption/isAirbrushing";
// const QString AIRBRUSH_RATE = "AirbrushOption/rate";
class QLabel;
class QModelIndex;
class QPushButton;
class KisCompositeOpListWidget;
class KoID;
class PAINTOP_EXPORT KisCompositeOpOption: public KisPaintOpOption
{
Q_OBJECT
public:
KisCompositeOpOption(bool createConfigWidget = false);
- ~KisCompositeOpOption();
+ ~KisCompositeOpOption() override;
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private Q_SLOTS:
void slotCompositeOpChanged(const QModelIndex& index);
void slotEraserToggled(bool toggled);
private:
void changeCompositeOp(const KoID& compositeOp);
private:
QLabel* m_label;
QPushButton* m_bnEraser;
KisCompositeOpListWidget* m_list;
QString m_currCompositeOpID;
bool m_createConfigWidget;
bool m_eraserMode;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_curve_option_uniform_property.h b/plugins/paintops/libpaintop/kis_curve_option_uniform_property.h
index 6b7c04c39f..42b4913ca8 100644
--- a/plugins/paintops/libpaintop/kis_curve_option_uniform_property.h
+++ b/plugins/paintops/libpaintop/kis_curve_option_uniform_property.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CURVE_OPTION_UNIFORM_PROPERTY_H
#define __KIS_CURVE_OPTION_UNIFORM_PROPERTY_H
#include <QScopedPointer>
#include "kis_slider_based_paintop_property.h"
#include <kritapaintop_export.h>
class KisCurveOption;
class PAINTOP_EXPORT KisCurveOptionUniformProperty : public KisDoubleSliderBasedPaintOpProperty
{
public:
KisCurveOptionUniformProperty(const QString &name,
KisCurveOption *option,
KisPaintOpSettingsRestrictedSP settings,
QObject *parent);
- ~KisCurveOptionUniformProperty();
+ ~KisCurveOptionUniformProperty() override;
- virtual void readValueImpl();
- virtual void writeValueImpl();
+ void readValueImpl() override;
+ void writeValueImpl() override;
- virtual bool isVisible() const;
+ bool isVisible() const override;
private:
QScopedPointer<KisCurveOption> m_option;
};
#endif /* __KIS_CURVE_OPTION_UNIFORM_PROPERTY_H */
diff --git a/plugins/paintops/libpaintop/kis_curve_option_widget.h b/plugins/paintops/libpaintop/kis_curve_option_widget.h
index b7ec993bd0..315fb8af93 100644
--- a/plugins/paintops/libpaintop/kis_curve_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_curve_option_widget.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Boudewijn Rempt <boud@valdyas.org>
* Copyright (C) 2009 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (C) 2011 Silvio Heinrich <plassy@web.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVE_OPTION_WIDGET_H
#define KIS_CURVE_OPTION_WIDGET_H
#include <kis_paintop_option.h>
class Ui_WdgCurveOption;
class KisCurveOption;
#include <kis_dynamic_sensor.h>
class PAINTOP_EXPORT KisCurveOptionWidget : public KisPaintOpOption
{
Q_OBJECT
public:
KisCurveOptionWidget(KisCurveOption* curveOption, const QString &minLabel, const QString &maxLabel, bool hideSlider = false);
- ~KisCurveOptionWidget();
+ ~KisCurveOptionWidget() override;
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
- virtual void lodLimitations(KisPaintopLodLimitations *l) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
- bool isCheckable() const;
- bool isChecked() const;
- void setChecked(bool checked);
+ bool isCheckable() const override;
+ bool isChecked() const override;
+ void setChecked(bool checked) override;
protected:
KisCurveOption* curveOption();
QWidget* curveWidget();
private Q_SLOTS:
void transferCurve();
void updateSensorCurveLabels(KisDynamicSensorSP sensor);
void updateCurve(KisDynamicSensorSP sensor);
void updateValues();
void resetCurve();
void updateLabelsOfCurrentSensor();
void disableWidgets(bool disable);
private:
QWidget* m_widget;
Ui_WdgCurveOption* m_curveOptionWidget;
KisCurveOption* m_curveOption;
};
#endif // KIS_CURVE_OPTION_WIDGET_H
diff --git a/plugins/paintops/libpaintop/kis_dynamic_sensor.h b/plugins/paintops/libpaintop/kis_dynamic_sensor.h
index 4773546040..b852f0a44e 100644
--- a/plugins/paintops/libpaintop/kis_dynamic_sensor.h
+++ b/plugins/paintops/libpaintop/kis_dynamic_sensor.h
@@ -1,217 +1,217 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DYNAMIC_SENSOR_H_
#define _KIS_DYNAMIC_SENSOR_H_
#include <kritapaintop_export.h>
#include <QObject>
#include <KoID.h>
#include <klocalizedstring.h>
#include "kis_serializable_configuration.h"
#include "kis_curve_label.h"
#include <kis_cubic_curve.h>
#include <kis_shared_ptr.h>
#include <kis_shared.h>
class QWidget;
class KisPaintInformation;
const KoID FuzzyPerDabId("fuzzy", ki18n("Fuzzy Dab")); ///< generate a random number
const KoID FuzzyPerStrokeId("fuzzystroke", ki18n("Fuzzy Stroke")); ///< generate a random number
const KoID SpeedId("speed", ki18n("Speed")); ///< generate a number depending on the speed of the cursor
const KoID FadeId("fade", ki18n("Fade")); ///< generate a number that increase every time you call it (e.g. per dab)
const KoID DistanceId("distance", ki18n("Distance")); ///< generate a number that increase with distance
const KoID TimeId("time", ki18n("Time")); ///< generate a number that increase with time
const KoID DrawingAngleId("drawingangle", ki18n("Drawing angle")); ///< number depending on the angle
const KoID RotationId("rotation", ki18n("Rotation")); ///< rotation coming from the device
const KoID PressureId("pressure", ki18n("Pressure")); ///< number depending on the pressure
const KoID PressureInId("pressurein", ki18n("PressureIn")); ///< number depending on the pressure
const KoID XTiltId("xtilt", ki18n("X-Tilt")); ///< number depending on X-tilt
const KoID YTiltId("ytilt", ki18n("Y-Tilt")); ///< number depending on Y-tilt
/**
* "TiltDirection" and "TiltElevation" parameters are written to
* preset files as "ascension" and "declination" to keep backward
* compatibility with older presets from the days when they were called
* differently.
*/
const KoID TiltDirectionId("ascension", ki18n("Tilt direction")); /// < number depending on the X and Y tilt, tilt direction is 0 when stylus nib points to you and changes clockwise from -180 to +180.
const KoID TiltElevationId("declination", ki18n("Tilt elevation")); /// < tilt elevation is 90 when stylus is perpendicular to tablet and 0 when it's parallel to tablet
const KoID PerspectiveId("perspective", ki18n("Perspective")); ///< number depending on the distance on the perspective grid
const KoID TangentialPressureId("tangentialpressure", ki18n("Tangential pressure")); ///< the wheel on an airbrush device
const KoID SensorsListId("sensorslist", "SHOULD NOT APPEAR IN THE UI !"); ///< this a non user-visible sensor that can store a list of other sensors, and multiply their output
class KisDynamicSensor;
typedef KisSharedPtr<KisDynamicSensor> KisDynamicSensorSP;
enum DynamicSensorType {
FUZZY_PER_DAB,
FUZZY_PER_STROKE,
SPEED,
FADE,
DISTANCE,
TIME,
ANGLE,
ROTATION,
PRESSURE,
XTILT,
YTILT,
TILT_DIRECTION,
TILT_ELEVATATION,
PERSPECTIVE,
TANGENTIAL_PRESSURE,
SENSORS_LIST,
PRESSURE_IN,
UNKNOWN = 255
};
/**
* Sensors are used to extract from KisPaintInformation a single
* double value which can be used to control the parameters of
* a brush.
*/
class PAINTOP_EXPORT KisDynamicSensor : public KisSerializableConfiguration
{
public:
enum ParameterSign {
NegativeParameter = -1,
UnSignedParameter = 0,
PositiveParameter = 1
};
protected:
KisDynamicSensor(DynamicSensorType type);
public:
- virtual ~KisDynamicSensor();
+ ~KisDynamicSensor() override;
/**
* @return the value of this sensor for the given KisPaintInformation
*/
qreal parameter(const KisPaintInformation& info);
/**
* This function is call before beginning a stroke to reset the sensor.
* Default implementation does nothing.
*/
virtual void reset();
/**
* @param selector is a \ref QWidget that countains a signal called "parametersChanged()"
*/
virtual QWidget* createConfigurationWidget(QWidget* parent, QWidget* selector);
/**
* Creates a sensor from its identifiant.
*/
static KisDynamicSensorSP id2Sensor(const KoID& id);
static KisDynamicSensorSP id2Sensor(const QString& s) {
return id2Sensor(KoID(s));
}
static DynamicSensorType id2Type(const KoID& id);
static DynamicSensorType id2Type(const QString& s) {
return id2Type(KoID(s));
}
/**
* type2Sensor creates a new sensor for the give type
*/
static KisDynamicSensorSP type2Sensor(DynamicSensorType sensorType);
static QString minimumLabel(DynamicSensorType sensorType);
static QString maximumLabel(DynamicSensorType sensorType, int max = -1);
static KisDynamicSensorSP createFromXML(const QString&);
static KisDynamicSensorSP createFromXML(const QDomElement&);
/**
* @return the list of sensors
*/
static QList<KoID> sensorsIds();
static QList<DynamicSensorType> sensorsTypes();
/**
* @return the identifiant of this sensor
*/
static QString id(DynamicSensorType sensorType);
using KisSerializableConfiguration::fromXML;
using KisSerializableConfiguration::toXML;
- virtual void toXML(QDomDocument&, QDomElement&) const;
- virtual void fromXML(const QDomElement&);
+ void toXML(QDomDocument&, QDomElement&) const override;
+ void fromXML(const QDomElement&) override;
void setCurve(const KisCubicCurve& curve);
const KisCubicCurve& curve() const;
void removeCurve();
bool hasCustomCurve() const;
void setActive(bool active);
bool isActive() const;
virtual bool dependsOnCanvasRotation() const;
virtual bool isAdditive() const;
virtual bool isAbsoluteRotation() const;
inline DynamicSensorType sensorType() const { return m_type; }
/**
* @return the currently set length or -1 if not relevant
*/
int length() { return m_length; }
public:
static inline qreal scalingToAdditive(qreal x) {
return -1.0 + 2.0 * x;
}
static inline qreal additiveToScaling(qreal x) {
return 0.5 * (1.0 + x);
}
protected:
virtual qreal value(const KisPaintInformation& info) = 0;
int m_length;
private:
Q_DISABLE_COPY(KisDynamicSensor)
DynamicSensorType m_type;
bool m_customCurve;
KisCubicCurve m_curve;
bool m_active;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_filter_option.h b/plugins/paintops/libpaintop/kis_filter_option.h
index 281592d015..6a93b8e97f 100644
--- a/plugins/paintops/libpaintop/kis_filter_option.h
+++ b/plugins/paintops/libpaintop/kis_filter_option.h
@@ -1,97 +1,97 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FILTER_OPTION_H
#define KIS_FILTER_OPTION_H
#include "kis_paintop_option.h"
#include <kis_types.h>
#include <kritapaintop_export.h>
class QGridLayout;
class KoID;
class KisConfigWidget;
class KisFilterConfiguration;
class KisFilterOptionWidget;
class KisPaintopLodLimitations;
const QString FILTER_ID = "Filter/id";
const QString FILTER_SMUDGE_MODE = "Filter/smudgeMode";
const QString FILTER_CONFIGURATION = "Filter/configuration";
/**
* The filter option allows the user to select a particular filter
* that can be applied by the paintop to the brush footprint or the
* original paint device data.
*/
class PAINTOP_EXPORT KisFilterOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisFilterOption();
- virtual ~KisFilterOption();
+ ~KisFilterOption() override;
/**
* Return the currently selected filter
*/
const KisFilterSP filter() const;
/**
* Return the currently selected filter configuration
*/
KisFilterConfigurationSP filterConfig() const;
bool smudgeMode() const;
/**
* XXX
*/
- void setNode(KisNodeWSP node);
+ void setNode(KisNodeWSP node) override;
/**
* XXX
*/
- void setImage(KisImageWSP image);
+ void setImage(KisImageWSP image) override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private Q_SLOTS:
void setCurrentFilter(const KoID&);
void updateFilterConfigWidget();
private:
QGridLayout *m_layout {0};
KisFilterOptionWidget *m_filterOptionWidget {0};
KisFilterSP m_currentFilter;
KisConfigWidget *m_currentFilterConfigWidget {0};
KisPaintDeviceSP m_paintDevice;
KisImageSP m_image;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h b/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h
index df79709297..a90f7b23ba 100644
--- a/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h
+++ b/plugins/paintops/libpaintop/kis_multi_sensors_model_p.h
@@ -1,73 +1,73 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISMULTISENSORSMODEL_H_
#define KISMULTISENSORSMODEL_H_
#include <QAbstractListModel>
#include <kis_dynamic_sensor.h>
class KisCubicCurve;
class KisCurveOption;
class KisMultiSensorsModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit KisMultiSensorsModel(QObject* parent = 0);
- virtual ~KisMultiSensorsModel();
+ ~KisMultiSensorsModel() override;
void setCurveOption(KisCurveOption *curveOption);
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- virtual Qt::ItemFlags flags(const QModelIndex & index) const;
+ Qt::ItemFlags flags(const QModelIndex & index) const override;
KisDynamicSensorSP getSensor(const QModelIndex& index);
void setCurrentCurve(const QModelIndex& currentIndex, const KisCubicCurve& curve, bool useSameCurve);
/**
* Create an index that correspond to the sensor given in argument.
*/
QModelIndex sensorIndex(KisDynamicSensorSP arg1);
void resetCurveOption();
Q_SIGNALS:
void sensorChanged(KisDynamicSensorSP sensor);
/**
* This signal is emitted when the parameters of sensor are changed.
*/
void parametersChanged();
private:
KisCurveOption *m_curveOption;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_multi_sensors_selector.h b/plugins/paintops/libpaintop/kis_multi_sensors_selector.h
index 856ee21ca1..6537fd60f2 100644
--- a/plugins/paintops/libpaintop/kis_multi_sensors_selector.h
+++ b/plugins/paintops/libpaintop/kis_multi_sensors_selector.h
@@ -1,60 +1,60 @@
/*
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This library 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 2.1 of the License, or
* (at your option) any later version.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_MULTI_SENSORS_SELECTOR_H
#define KIS_MULTI_SENSORS_SELECTOR_H
#include <QWidget>
class KisCubicCurve;
class QModelIndex;
class KisCurveOption;
#include <kis_dynamic_sensor.h>
class KisMultiSensorsSelector : public QWidget
{
Q_OBJECT
public:
KisMultiSensorsSelector(QWidget* parent);
- ~KisMultiSensorsSelector();
+ ~KisMultiSensorsSelector() override;
void setCurveOption(KisCurveOption *curveOption);
void setCurrent(KisDynamicSensorSP _sensor);
KisDynamicSensorSP currentHighlighted();
void setCurrentCurve(const KisCubicCurve& curve, bool useSameCurve);
void reload();
private Q_SLOTS:
void sensorActivated(const QModelIndex& index);
Q_SIGNALS:
void sensorChanged(KisDynamicSensorSP sensor);
/**
* This signal is emitted when the parameters of sensor are changed.
*/
void parametersChanged();
void highlightedSensorChanged(KisDynamicSensorSP sensor);
private:
struct Private;
Private* const d;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_outline_generation_policy.h b/plugins/paintops/libpaintop/kis_outline_generation_policy.h
index 4f910ef88a..386531ebe5 100644
--- a/plugins/paintops/libpaintop/kis_outline_generation_policy.h
+++ b/plugins/paintops/libpaintop/kis_outline_generation_policy.h
@@ -1,63 +1,63 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_OUTLINE_GENERATION_POLICY_H
#define __KIS_OUTLINE_GENERATION_POLICY_H
#include <kis_current_outline_fetcher.h>
/**
* This is a policy class that adds an ability to have a Outline Generator
* to a KisPaintOpSettings-based class.
*
* \see Andrei Alexandrescu "Modern C++ Design: Generic Programming and Design Patterns Applied"
*/
template <class ParentClass>
class KisOutlineGenerationPolicy : public ParentClass
{
public:
KisOutlineGenerationPolicy(KisCurrentOutlineFetcher::Options options)
: m_outlineFetcher(options)
{
}
- virtual ~KisOutlineGenerationPolicy()
+ ~KisOutlineGenerationPolicy() override
{
}
KisOutlineGenerationPolicy(const KisOutlineGenerationPolicy &rhs)
: ParentClass(rhs)
{
}
const KisCurrentOutlineFetcher *outlineFetcher() const
{
return &m_outlineFetcher;
}
- void onPropertyChanged()
+ void onPropertyChanged() override
{
m_outlineFetcher.setDirty();
ParentClass::onPropertyChanged();
}
private:
KisCurrentOutlineFetcher m_outlineFetcher;
};
#endif /* __KIS_OUTLINE_GENERATION_POLICY_H */
diff --git a/plugins/paintops/libpaintop/kis_paint_action_type_option.h b/plugins/paintops/libpaintop/kis_paint_action_type_option.h
index c32e86409e..21c77e7c9a 100644
--- a/plugins/paintops/libpaintop/kis_paint_action_type_option.h
+++ b/plugins/paintops/libpaintop/kis_paint_action_type_option.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2008 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PAINT_ACTION_TYPE_OPTION_H
#define KIS_PAINT_ACTION_TYPE_OPTION_H
#include <kis_paintop_option.h>
#include <kritapaintop_export.h>
class KisPaintActionWidget;
enum enumPaintActionType {
UNSUPPORTED,
BUILDUP,
WASH,
FRINGED // not used yet
};
/**
* Allows the user to choose between two types of paint action:
* * incremental (going over the same spot in one stroke makes it darker)
* * indirect (like photoshop and gimp)
*/
class PAINTOP_EXPORT KisPaintActionTypeOption : public KisPaintOpOption
{
public:
KisPaintActionTypeOption();
- ~KisPaintActionTypeOption();
+ ~KisPaintActionTypeOption() override;
enumPaintActionType paintActionType() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisPaintActionWidget * m_optionWidget;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option.h b/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option.h
index d7cb7d7486..f822372fe6 100644
--- a/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option.h
@@ -1,54 +1,54 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_FLOW_OPACITY_OPTION_H
#define KIS_PRESSURE_FLOW_OPACITY_OPTION_H
#include "kis_curve_option.h"
#include <kritapaintop_export.h>
#include <kis_types.h>
#include <brushengine/kis_paintop_settings.h>
class KisPaintInformation;
class KisPainter;
class PAINTOP_EXPORT KisFlowOpacityOption: public KisCurveOption
{
public:
KisFlowOpacityOption(KisNodeSP currentNode);
- virtual ~KisFlowOpacityOption() { }
+ ~KisFlowOpacityOption() override { }
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
void setFlow(qreal flow);
void setOpacity(qreal opacity);
void apply(KisPainter* painter, const KisPaintInformation& info);
qreal getFlow() const;
qreal getStaticOpacity() const;
qreal getDynamicOpacity(const KisPaintInformation& info) const;
protected:
qreal m_flow;
int m_paintActionType;
bool m_nodeHasIndirectPaintingSupport;
};
#endif //KIS_PRESSURE_FLOW_OPACITY_OPTION_H
diff --git a/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option_widget.h b/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option_widget.h
index e62106095c..6e72d6e3b6 100644
--- a/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_pressure_flow_opacity_option_widget.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2011 Silvio Heinrich <plassy@web.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_FLOW_OPACITY_OPTION_WIDGET_H
#define KIS_PRESSURE_FLOW_OPACITY_OPTION_WIDGET_H
#include "kis_pressure_flow_opacity_option.h"
#include "kis_curve_option_widget.h"
class KisDoubleSliderSpinBox;
class KisCurveOptionWidget;
class PAINTOP_EXPORT KisFlowOpacityOptionWidget: public KisCurveOptionWidget
{
Q_OBJECT
public:
KisFlowOpacityOptionWidget();
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private Q_SLOTS:
void slotSliderValueChanged();
private:
KisDoubleSliderSpinBox* m_opacitySlider;
};
#endif // KIS_PRESSURE_FLOW_OPACITY_OPTION_WIDGET_H
diff --git a/plugins/paintops/libpaintop/kis_pressure_hsv_option.h b/plugins/paintops/libpaintop/kis_pressure_hsv_option.h
index cee47436f5..93a9254c7a 100644
--- a/plugins/paintops/libpaintop/kis_pressure_hsv_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_hsv_option.h
@@ -1,59 +1,59 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_HSV_OPTION_H
#define KIS_PRESSURE_HSV_OPTION_H
#include "kis_curve_option.h"
#include <kis_types.h>
#include <kritapaintop_export.h>
#include <KoColor.h>
class KoColorTransformation;
/**
* The pressure opacity option defines a curve that is used to
* calculate the effect of pressure on one of the hsv of the dab
*/
class PAINTOP_EXPORT KisPressureHSVOption : public KisCurveOption
{
public:
static KisPressureHSVOption* createHueOption();
static QString hueMinLabel();
static QString huemaxLabel();
static KisPressureHSVOption* createSaturationOption();
static QString saturationMinLabel();
static QString saturationmaxLabel();
static KisPressureHSVOption* createValueOption();
static QString valueMinLabel();
static QString valuemaxLabel();
public:
KisPressureHSVOption(const QString& parameterName);
- ~KisPressureHSVOption();
+ ~KisPressureHSVOption() override;
void apply(KoColorTransformation* hsvTransfo, const KisPaintInformation& info) const;
private:
struct Private;
Private* const d;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_mirror_option.h b/plugins/paintops/libpaintop/kis_pressure_mirror_option.h
index c2f5eea716..5bcf75e837 100644
--- a/plugins/paintops/libpaintop/kis_pressure_mirror_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_mirror_option.h
@@ -1,76 +1,76 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_MIRROR_OPTION_H
#define KIS_PRESSURE_MIRROR_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
#include <kis_types.h>
struct MirrorProperties {
MirrorProperties()
: horizontalMirror(false),
verticalMirror(false),
coordinateSystemFlipped(false) {}
bool horizontalMirror;
bool verticalMirror;
bool coordinateSystemFlipped;
bool isEmpty() const {
return !horizontalMirror && !verticalMirror;
}
};
const QString MIRROR_HORIZONTAL_ENABLED = "HorizontalMirrorEnabled";
const QString MIRROR_VERTICAL_ENABLED = "VerticalMirrorEnabled";
/**
* If the sensor value is higher then 0.5, then the related mirror option is true, false otherwise
*/
class PAINTOP_EXPORT KisPressureMirrorOption : public KisCurveOption
{
public:
KisPressureMirrorOption();
/**
* Set the
*/
MirrorProperties apply(const KisPaintInformation& info) const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
void enableVerticalMirror(bool mirror);
void enableHorizontalMirror(bool mirror);
bool isVerticalMirrorEnabled();
bool isHorizontalMirrorEnabled();
private:
bool m_enableVerticalMirror;
bool m_enableHorizontalMirror;
bool m_canvasAxisXMirrored;
bool m_canvasAxisYMirrored;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_mirror_option_widget.h b/plugins/paintops/libpaintop/kis_pressure_mirror_option_widget.h
index 6a61e88583..a93e7c608c 100644
--- a/plugins/paintops/libpaintop/kis_pressure_mirror_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_pressure_mirror_option_widget.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_MIRROR_OPTION_WIDGET_H
#define KIS_PRESSURE_MIRROR_OPTION_WIDGET_H
#include "kis_curve_option_widget.h"
class QCheckBox;
class PAINTOP_EXPORT KisPressureMirrorOptionWidget : public KisCurveOptionWidget
{
Q_OBJECT
public:
KisPressureMirrorOptionWidget();
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private Q_SLOTS:
void horizontalMirrorChanged(bool mirror);
void verticalMirrorChanged(bool mirror);
private:
QCheckBox* m_horizontalMirror;
QCheckBox* m_verticalMirror;
};
#endif // KIS_PRESSURE_RATE_OPTION_WIDGET_H
diff --git a/plugins/paintops/libpaintop/kis_pressure_opacity_option.h b/plugins/paintops/libpaintop/kis_pressure_opacity_option.h
index f96b4236b1..ae537d9b12 100644
--- a/plugins/paintops/libpaintop/kis_pressure_opacity_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_opacity_option.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_OPACITY_OPTION
#define KIS_PRESSURE_OPACITY_OPTION
#include "kis_curve_option.h"
#include <kritapaintop_export.h>
class KisPainter;
/**
* The pressure opacity option defines a curve that is used to
* calculate the effect of pressure on opacity
*/
class PAINTOP_EXPORT KisPressureOpacityOption : public KisCurveOption
{
public:
KisPressureOpacityOption();
/**
* Set the opacity of the painter based on the pressure
* and the curve (if checked) and return the old opacity
* of the painter.
*/
quint8 apply(KisPainter* painter, const KisPaintInformation& info) const;
qreal getOpacityf(const KisPaintInformation& info);
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_rotation_option.h b/plugins/paintops/libpaintop/kis_pressure_rotation_option.h
index d933345a2f..3abe1b45a7 100644
--- a/plugins/paintops/libpaintop/kis_pressure_rotation_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_rotation_option.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_ROTATION_OPTION_H
#define KIS_PRESSURE_ROTATION_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
/**
* The pressure opacity option defines a curve that is used to
* calculate the effect of pressure on the size of the dab
*/
class PAINTOP_EXPORT KisPressureRotationOption : public KisCurveOption
{
public:
KisPressureRotationOption();
double apply(const KisPaintInformation & info) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
void applyFanCornersInfo(KisPaintOp *op);
private:
qreal m_defaultAngle;
bool m_canvasAxisXMirrored;
bool m_canvasAxisYMirrored;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_scatter_option.h b/plugins/paintops/libpaintop/kis_pressure_scatter_option.h
index 92783b3c9e..f22c8713fb 100644
--- a/plugins/paintops/libpaintop/kis_pressure_scatter_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_scatter_option.h
@@ -1,58 +1,58 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_SCATTER_OPTION_H
#define KIS_PRESSURE_SCATTER_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
#include <kis_types.h>
const QString SCATTER_X = "Scattering/AxisX";
const QString SCATTER_Y = "Scattering/AxisY";
const QString SCATTER_AMOUNT = "Scattering/Amount";
/**
* Scatters the position of the dab
*/
class PAINTOP_EXPORT KisPressureScatterOption : public KisCurveOption
{
public:
KisPressureScatterOption();
QPointF apply(const KisPaintInformation& info, qreal width, qreal height) const;
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
void enableAxisY(bool enable);
void enableAxisX(bool enable);
bool isAxisXEnabled();
bool isAxisYEnabled();
void setScatterAmount(qreal amount);
qreal scatterAmount();
private:
bool m_axisX;
bool m_axisY;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_scatter_option_widget.h b/plugins/paintops/libpaintop/kis_pressure_scatter_option_widget.h
index 59b96a4ad2..c073414102 100644
--- a/plugins/paintops/libpaintop/kis_pressure_scatter_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_pressure_scatter_option_widget.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_SCATTER_OPTION_WIDGET_H
#define KIS_PRESSURE_SCATTER_OPTION_WIDGET_H
#include "kis_curve_option_widget.h"
class QCheckBox;
class PAINTOP_EXPORT KisPressureScatterOptionWidget: public KisCurveOptionWidget
{
Q_OBJECT
public:
KisPressureScatterOptionWidget();
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private Q_SLOTS:
void xAxisEnabled(bool enable);
void yAxisEnabled(bool enable);
private:
QCheckBox* m_axisX;
QCheckBox* m_axisY;
};
#endif // KIS_PRESSURE_RATE_OPTION_WIDGET_H
diff --git a/plugins/paintops/libpaintop/kis_pressure_sharpness_option.h b/plugins/paintops/libpaintop/kis_pressure_sharpness_option.h
index 620e2d0c58..005f7254b4 100644
--- a/plugins/paintops/libpaintop/kis_pressure_sharpness_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_sharpness_option.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_SHARPNESS_OPTION_H
#define KIS_PRESSURE_SHARPNESS_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
#include <kis_types.h>
const QString SHARPNESS_FACTOR = "Sharpness/factor";
const QString SHARPNESS_THRESHOLD = "Sharpness/threshold";
/**
* This option is responsible to mimic pencil effect from former Pixel Pencil brush engine.auto
*/
class PAINTOP_EXPORT KisPressureSharpnessOption : public KisCurveOption
{
public:
KisPressureSharpnessOption();
/**
* First part of the sharpness is the coordinates: in pen mode they are integers without fractions
*/
void apply(const KisPaintInformation &info, const QPointF &pt, qint32 &x, qint32 &y, qreal &xFraction, qreal &yFraction) const;
/**
* Apply threshold specified by user
*/
void applyThreshold(KisFixedPaintDeviceSP dab);
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
/// threshold has 100 levels (like opacity)
void setThreshold(qint32 threshold) {
m_threshold = qBound<qint32>(0, threshold, 100);
}
qint32 threshold() {
return m_threshold;
}
void setSharpnessFactor(qreal factor) {
KisCurveOption::setValue(factor);
}
qreal sharpnessFactor() {
return KisCurveOption::value();
}
private:
qint32 m_threshold;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_size_option.h b/plugins/paintops/libpaintop/kis_pressure_size_option.h
index 849d6e9ae5..91c63d9230 100644
--- a/plugins/paintops/libpaintop/kis_pressure_size_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_size_option.h
@@ -1,44 +1,44 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_SIZE_OPTION_H
#define KIS_PRESSURE_SIZE_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
class KisPaintopLodLimitations;
/**
* The pressure opacity option defines a curve that is used to
* calculate the effect of pressure on the size of the dab
*/
class PAINTOP_EXPORT KisPressureSizeOption : public KisCurveOption
{
public:
KisPressureSizeOption();
double apply(const KisPaintInformation & info) const;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_spacing_option.h b/plugins/paintops/libpaintop/kis_pressure_spacing_option.h
index a191031cbd..b4514e9aa6 100644
--- a/plugins/paintops/libpaintop/kis_pressure_spacing_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_spacing_option.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (c) 2011 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PRESSURE_SPACING_OPTION_H
#define KIS_PRESSURE_SPACING_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
/**
* The pressure spacing option defines a curve that is used to
* calculate the effect of pressure on the spacing of the dab
*/
class PAINTOP_EXPORT KisPressureSpacingOption : public KisCurveOption
{
public:
KisPressureSpacingOption();
double apply(const KisPaintInformation & info) const;
void setIsotropicSpacing(bool isotropic);
bool isotropicSpacing() const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
private:
bool m_isotropicSpacing;
};
#endif
diff --git a/plugins/paintops/libpaintop/kis_pressure_texture_strength_option.h b/plugins/paintops/libpaintop/kis_pressure_texture_strength_option.h
index 8c6c4b6f0f..0f5862bc49 100644
--- a/plugins/paintops/libpaintop/kis_pressure_texture_strength_option.h
+++ b/plugins/paintops/libpaintop/kis_pressure_texture_strength_option.h
@@ -1,41 +1,41 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PRESSURE_TEXTURE_STRENGTH_OPTION_H
#define __KIS_PRESSURE_TEXTURE_STRENGTH_OPTION_H
#include "kis_curve_option.h"
#include <brushengine/kis_paint_information.h>
#include <kritapaintop_export.h>
/**
* This curve defines how deep the ink (or a pointer) of a brush
* penetrates the surface of the canvas, that is how strong we
* press on the paper
*/
class PAINTOP_EXPORT KisPressureTextureStrengthOption : public KisCurveOption
{
public:
KisPressureTextureStrengthOption();
double apply(const KisPaintInformation & info) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
};
#endif /* __KIS_PRESSURE_TEXTURE_STRENGTH_OPTION_H */
diff --git a/plugins/paintops/libpaintop/kis_simple_paintop_factory.h b/plugins/paintops/libpaintop/kis_simple_paintop_factory.h
index 91bf8a1a2a..f09ea88f4c 100644
--- a/plugins/paintops/libpaintop/kis_simple_paintop_factory.h
+++ b/plugins/paintops/libpaintop/kis_simple_paintop_factory.h
@@ -1,132 +1,132 @@
/*
* Copyright (c) 2009 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SIMPLE_PAINTOP_FACTORY_H
#define KIS_SIMPLE_PAINTOP_FACTORY_H
#include <brushengine/kis_paintop_factory.h>
#include <brushengine/kis_paintop_settings.h>
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
template <typename T>
struct __impl_has_typedef_needs_preinitialization {
typedef char yes[1];
typedef char no[2];
template <typename C>
static yes& test(typename C::needs_preinitialization*);
template <typename>
static no& test(...);
static const bool value = sizeof(test<T>(0)) == sizeof(yes);
};
template <typename T>
struct has_typedef_needs_preinitialization
: public boost::integral_constant <bool, __impl_has_typedef_needs_preinitialization<T>::value>
{};
template <typename T>
void preinitializeOpStatically(const KisPaintOpSettingsSP settings, typename boost::enable_if<has_typedef_needs_preinitialization<T> >::type * = 0)
{
T::preinitializeOpStatically(settings);
}
template <typename T>
void preinitializeOpStatically(const KisPaintOpSettingsSP settings, typename boost::disable_if<has_typedef_needs_preinitialization<T> >::type * = 0)
{
Q_UNUSED(settings);
}
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
/**
* Base template class for simple paintop factories
*/
template <class Op, class OpSettings, class OpSettingsWidget> class KisSimplePaintOpFactory : public KisPaintOpFactory
{
public:
KisSimplePaintOpFactory(const QString& id, const QString& name, const QString& category,
const QString& pixmap, const QString& model = QString(),
const QStringList& whiteListedCompositeOps = QStringList(), int priority = 100)
: KisPaintOpFactory(whiteListedCompositeOps)
, m_id(id)
, m_name(name)
, m_category(category)
, m_pixmap(pixmap)
, m_model(model) {
setPriority(priority);
}
- virtual ~KisSimplePaintOpFactory() {
+ ~KisSimplePaintOpFactory() override {
}
#ifdef HAVE_THREADED_TEXT_RENDERING_WORKAROUND
- void preinitializePaintOpIfNeeded(const KisPaintOpSettingsSP settings) {
+ void preinitializePaintOpIfNeeded(const KisPaintOpSettingsSP settings) override {
preinitializeOpStatically<Op>(settings);
}
#endif /* HAVE_THREADED_TEXT_RENDERING_WORKAROUND */
- KisPaintOp *createOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image) {
+ KisPaintOp *createOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image) override {
KisPaintOp * op = new Op(settings, painter, node, image);
Q_CHECK_PTR(op);
return op;
}
- KisPaintOpSettingsSP settings() {
+ KisPaintOpSettingsSP settings() override {
KisPaintOpSettingsSP settings = new OpSettings();
settings->setModelName(m_model);
return settings;
}
- KisPaintOpConfigWidget* createConfigWidget(QWidget* parent) {
+ KisPaintOpConfigWidget* createConfigWidget(QWidget* parent) override {
return new OpSettingsWidget(parent);
}
- QString id() const {
+ QString id() const override {
return m_id;
}
- QString name() const {
+ QString name() const override {
return m_name;
}
- QString pixmap() {
+ QString pixmap() override {
return m_pixmap;
}
- QString category() const {
+ QString category() const override {
return m_category;
}
private:
QString m_id;
QString m_name;
QString m_category;
QString m_pixmap;
QString m_model;
};
#endif // KIS_SIMPLE_PAINTOP_FACTORY_H
diff --git a/plugins/paintops/libpaintop/kis_spacing_selection_widget.h b/plugins/paintops/libpaintop/kis_spacing_selection_widget.h
index 8f6a68f929..44170faee7 100644
--- a/plugins/paintops/libpaintop/kis_spacing_selection_widget.h
+++ b/plugins/paintops/libpaintop/kis_spacing_selection_widget.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SPACING_SELECTION_WIDGET_H
#define __KIS_SPACING_SELECTION_WIDGET_H
#include <QWidget>
#include <QScopedPointer>
#include <kritapaintop_export.h>
class PAINTOP_EXPORT KisSpacingSelectionWidget : public QWidget
{
Q_OBJECT
public:
KisSpacingSelectionWidget(QWidget *parent);
- ~KisSpacingSelectionWidget();
+ ~KisSpacingSelectionWidget() override;
void setSpacing(bool isAuto, qreal spacing);
qreal spacing() const;
bool autoSpacingActive() const;
qreal autoSpacingCoeff() const;
Q_SIGNALS:
void sigSpacingChanged();
private:
Q_PRIVATE_SLOT(m_d, void slotSpacingChanged(qreal value));
Q_PRIVATE_SLOT(m_d, void slotAutoSpacing(bool value));
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_SPACING_SELECTION_WIDGET_H */
diff --git a/plugins/paintops/libpaintop/kis_texture_option.h b/plugins/paintops/libpaintop/kis_texture_option.h
index 52d76daccb..9156c38942 100644
--- a/plugins/paintops/libpaintop/kis_texture_option.h
+++ b/plugins/paintops/libpaintop/kis_texture_option.h
@@ -1,103 +1,103 @@
/* This file is part of the KDE project
* Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2012
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TEXTURE_OPTION_H
#define KIS_TEXTURE_OPTION_H
#include <kritapaintop_export.h>
#include <kis_paint_device.h>
#include <kis_types.h>
#include "kis_paintop_option.h"
#include "kis_pressure_texture_strength_option.h"
#include <QRect>
class KisTextureOptionWidget;
class KoPattern;
class KoResource;
class KisPropertiesConfiguration;
class KisPaintopLodLimitations;
class PAINTOP_EXPORT KisTextureOption : public KisPaintOpOption
{
Q_OBJECT
public:
explicit KisTextureOption();
- virtual ~KisTextureOption();
+ ~KisTextureOption() override;
public Q_SLOTS:
- virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
- virtual void lodLimitations(KisPaintopLodLimitations *l) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private Q_SLOTS:
void resetGUI(KoResource*); /// called when a new pattern is selected
private:
KisTextureOptionWidget *m_optionWidget;
};
class PAINTOP_EXPORT KisTextureProperties
{
public:
KisTextureProperties(int levelOfDetail);
enum TexturingMode {
MULTIPLY,
SUBTRACT
};
bool m_enabled;
/**
* @brief apply combine the texture map with the dab
* @param dab the colored, final representation of the dab, after mirroring and everything.
* @param offset the position of the dab on the image. used to calculate the position of the mask pattern
*/
void apply(KisFixedPaintDeviceSP dab, const QPoint& offset, const KisPaintInformation & info);
void fillProperties(const KisPropertiesConfigurationSP setting);
private:
qreal m_scale;
int m_offsetX;
int m_offsetY;
TexturingMode m_texturingMode;
bool m_invert;
KoPattern *m_pattern;
int m_cutoffLeft;
int m_cutoffRight;
int m_cutoffPolicy;
int m_levelOfDetail;
private:
KisPressureTextureStrengthOption m_strengthOption;
QRect m_maskBounds; // this can be different from the extent if we mask out too many pixels in a big mask!
KisPaintDeviceSP m_mask;
void recalculateMask();
};
#endif // KIS_TEXTURE_OPTION_H
diff --git a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_distance.h b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_distance.h
index e0a43c3dc4..c383776dfc 100644
--- a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_distance.h
+++ b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_distance.h
@@ -1,50 +1,50 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DYNAMIC_SENSOR_DISTANCE_H_
#define _KIS_DYNAMIC_SENSOR_DISTANCE_H_
#include "kis_vec.h"
#include "kis_dynamic_sensor.h"
//
class KisDynamicSensorDistance : public QObject, public KisDynamicSensor
{
Q_OBJECT
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
using KisSerializableConfiguration::fromXML;
using KisSerializableConfiguration::toXML;
KisDynamicSensorDistance();
- virtual ~KisDynamicSensorDistance() { }
- virtual qreal value(const KisPaintInformation&);
- virtual void reset();
- virtual QWidget* createConfigurationWidget(QWidget* parent, QWidget*);
+ ~KisDynamicSensorDistance() override { }
+ qreal value(const KisPaintInformation&) override;
+ void reset() override;
+ QWidget* createConfigurationWidget(QWidget* parent, QWidget*) override;
public Q_SLOTS:
virtual void setPeriodic(bool periodic);
virtual void setLength(int length);
- virtual void toXML(QDomDocument&, QDomElement&) const;
- virtual void fromXML(const QDomElement&);
+ void toXML(QDomDocument&, QDomElement&) const override;
+ void fromXML(const QDomElement&) override;
private:
qreal m_measuredDistance;
bool m_periodic;
};
#endif
diff --git a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_drawing_angle.h b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_drawing_angle.h
index c1767b46d0..a21b71ace2 100644
--- a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_drawing_angle.h
+++ b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_drawing_angle.h
@@ -1,71 +1,71 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_DYNAMIC_SENSOR_DRAWING_ANGLE_H
#define __KIS_DYNAMIC_SENSOR_DRAWING_ANGLE_H
#include "kis_dynamic_sensor.h"
class QCheckBox;
class KisSliderSpinBox;
class KisDynamicSensorDrawingAngle : public QObject, public KisDynamicSensor
{
Q_OBJECT
public:
KisDynamicSensorDrawingAngle();
- qreal value(const KisPaintInformation& info);
- bool dependsOnCanvasRotation() const;
- bool isAbsoluteRotation() const;
+ qreal value(const KisPaintInformation& info) override;
+ bool dependsOnCanvasRotation() const override;
+ bool isAbsoluteRotation() const override;
- QWidget* createConfigurationWidget(QWidget* parent, QWidget*);
+ QWidget* createConfigurationWidget(QWidget* parent, QWidget*) override;
using KisSerializableConfiguration::fromXML;
using KisSerializableConfiguration::toXML;
- void toXML(QDomDocument&, QDomElement&) const;
- void fromXML(const QDomElement&);
+ void toXML(QDomDocument&, QDomElement&) const override;
+ void fromXML(const QDomElement&) override;
bool fanCornersEnabled() const;
int fanCornersStep() const;
int angleOffset() const;
- void reset();
+ void reset() override;
public Q_SLOTS:
void setFanCornersEnabled(int state);
void setFanCornersStep(int angle);
void setAngleOffset(int angle);
void setLockedAngleMode(int value);
void updateGUI();
private:
bool m_fanCornersEnabled;
int m_fanCornersStep;
int m_angleOffset; // in degrees
int m_dabIndex;
qreal m_lockedAngle;
bool m_lockedAngleMode;
QCheckBox *m_chkLockedMode;
QCheckBox *m_chkFanCorners;
KisSliderSpinBox *m_intFanCornersStep;
};
#endif /* __KIS_DYNAMIC_SENSOR_DRAWING_ANGLE_H */
diff --git a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fade.h b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fade.h
index 5ce1118398..d8c5b79084 100644
--- a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fade.h
+++ b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fade.h
@@ -1,51 +1,51 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DYNAMIC_SENSOR_FADE_H_
#define _KIS_DYNAMIC_SENSOR_FADE_H_
#include "kis_vec.h"
#include "kis_dynamic_sensor.h"
class KisDynamicSensorFade : public QObject, public KisDynamicSensor
{
Q_OBJECT
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
using KisSerializableConfiguration::fromXML;
using KisSerializableConfiguration::toXML;
KisDynamicSensorFade();
- virtual ~KisDynamicSensorFade() { }
- virtual qreal value(const KisPaintInformation&);
- virtual void reset();
- virtual QWidget* createConfigurationWidget(QWidget* parent, QWidget*);
+ ~KisDynamicSensorFade() override { }
+ qreal value(const KisPaintInformation&) override;
+ void reset() override;
+ QWidget* createConfigurationWidget(QWidget* parent, QWidget*) override;
public Q_SLOTS:
virtual void setPeriodic(bool periodic);
virtual void setLength(int length);
- virtual void toXML(QDomDocument&, QDomElement&) const;
- virtual void fromXML(const QDomElement&);
+ void toXML(QDomDocument&, QDomElement&) const override;
+ void fromXML(const QDomElement&) override;
private:
int m_counter;
bool m_periodic;
};
#endif
diff --git a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fuzzy.h b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fuzzy.h
index ab749cd44e..90222639f2 100644
--- a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fuzzy.h
+++ b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_fuzzy.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2014 Mohit Goyal <mohit.bits2011@gmail.com>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_DYNAMIC_SENSOR_FUZZY_H
#define KIS_DYNAMIC_SENSOR_FUZZY_H
#include "kis_dynamic_sensor.h"
#include <brushengine/kis_paint_information.h>
#include <brushengine/kis_paintop.h>
#include <KoID.h>
#include <QCheckBox>
#include <QHBoxLayout>
#include <QDomElement>
class KisDynamicSensorFuzzy : public QObject, public KisDynamicSensor
{
Q_OBJECT
public:
- bool dependsOnCanvasRotation() const;
+ bool dependsOnCanvasRotation() const override;
- bool isAdditive() const;
+ bool isAdditive() const override;
KisDynamicSensorFuzzy(bool fuzzyPerStroke = false);
- virtual ~KisDynamicSensorFuzzy() {}
- qreal value(const KisPaintInformation &info);
+ ~KisDynamicSensorFuzzy() override {}
+ qreal value(const KisPaintInformation &info) override;
- void reset();
+ void reset() override;
private:
const bool m_fuzzyPerStroke;
bool m_isInitialized;
qreal m_savedValue;
};
#endif // KIS_DYNAMIC_SENSOR_FUZZY_H
diff --git a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_time.h b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_time.h
index 572bca2cb1..4e293241c6 100644
--- a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_time.h
+++ b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensor_time.h
@@ -1,52 +1,52 @@
/*
* Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DYNAMIC_SENSOR_TIME_H_
#define _KIS_DYNAMIC_SENSOR_TIME_H_
#include "kis_vec.h"
#include "kis_dynamic_sensor.h"
//
class KisDynamicSensorTime : public QObject, public KisDynamicSensor
{
Q_OBJECT
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
using KisSerializableConfiguration::fromXML;
using KisSerializableConfiguration::toXML;
KisDynamicSensorTime();
- virtual ~KisDynamicSensorTime() { }
- virtual qreal value(const KisPaintInformation&);
- virtual void reset();
- virtual QWidget* createConfigurationWidget(QWidget* parent, QWidget*);
+ ~KisDynamicSensorTime() override { }
+ qreal value(const KisPaintInformation&) override;
+ void reset() override;
+ QWidget* createConfigurationWidget(QWidget* parent, QWidget*) override;
public Q_SLOTS:
virtual void setPeriodic(bool periodic);
virtual void setLength(qreal length);
- virtual void toXML(QDomDocument&, QDomElement&) const;
- virtual void fromXML(const QDomElement&);
+ void toXML(QDomDocument&, QDomElement&) const override;
+ void fromXML(const QDomElement&) override;
private:
int m_time;
bool m_periodic;
int m_lastTime;
};
#endif
diff --git a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
index d88672f19d..1d21d68fb0 100644
--- a/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
+++ b/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
@@ -1,140 +1,140 @@
/*
* Copyright (c) 2006-2007,2010 Cyrille Berger <cberger@cberger.net>
* Copyright (c) 2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This library 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; version 2.1 of the License.
*
* This library 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_DYNAMIC_SENSORS_H_
#define _KIS_DYNAMIC_SENSORS_H_
#include "../kis_dynamic_sensor.h"
#include <brushengine/kis_paint_information.h>
class KisDynamicSensorSpeed : public KisDynamicSensor
{
public:
KisDynamicSensorSpeed();
- virtual ~KisDynamicSensorSpeed() { }
- virtual qreal value(const KisPaintInformation& info);
- void reset() {
+ ~KisDynamicSensorSpeed() override { }
+ qreal value(const KisPaintInformation& info) override;
+ void reset() override {
m_speed = -1.0;
}
private:
double m_speed;
};
class KisDynamicSensorRotation : public KisDynamicSensor
{
public:
KisDynamicSensorRotation();
- virtual ~KisDynamicSensorRotation() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorRotation() override { }
+ qreal value(const KisPaintInformation& info) override {
return info.rotation() / 360.0;
}
};
class KisDynamicSensorPressure : public KisDynamicSensor
{
public:
KisDynamicSensorPressure();
- virtual ~KisDynamicSensorPressure() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorPressure() override { }
+ qreal value(const KisPaintInformation& info) override {
return info.pressure();
}
};
class KisDynamicSensorPressureIn : public KisDynamicSensor
{
public:
KisDynamicSensorPressureIn();
- virtual ~KisDynamicSensorPressureIn() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorPressureIn() override { }
+ qreal value(const KisPaintInformation& info) override {
if(!info.isHoveringMode()) {
if(info.pressure() > lastPressure) {
lastPressure = info.pressure();
}
return lastPressure;
}
lastPressure = 0.0;
return 0.0;
}
private:
qreal lastPressure;
};
class KisDynamicSensorXTilt : public KisDynamicSensor
{
public:
KisDynamicSensorXTilt();
- virtual ~KisDynamicSensorXTilt() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorXTilt() override { }
+ qreal value(const KisPaintInformation& info) override {
return 1.0 - fabs(info.xTilt()) / 60.0;
}
};
class KisDynamicSensorYTilt : public KisDynamicSensor
{
public:
KisDynamicSensorYTilt();
- virtual ~KisDynamicSensorYTilt() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorYTilt() override { }
+ qreal value(const KisPaintInformation& info) override {
return 1.0 - fabs(info.yTilt()) / 60.0;
}
};
class KisDynamicSensorTiltDirection : public KisDynamicSensor
{
public:
KisDynamicSensorTiltDirection();
- virtual ~KisDynamicSensorTiltDirection() {}
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorTiltDirection() override {}
+ qreal value(const KisPaintInformation& info) override {
return KisPaintInformation::tiltDirection(info, true);
}
};
class KisDynamicSensorTiltElevation : public KisDynamicSensor
{
public:
KisDynamicSensorTiltElevation();
- virtual ~KisDynamicSensorTiltElevation() {}
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorTiltElevation() override {}
+ qreal value(const KisPaintInformation& info) override {
return KisPaintInformation::tiltElevation(info, 60.0, 60.0, true);
}
};
class KisDynamicSensorPerspective : public KisDynamicSensor
{
public:
KisDynamicSensorPerspective();
- virtual ~KisDynamicSensorPerspective() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorPerspective() override { }
+ qreal value(const KisPaintInformation& info) override {
return info.perspective();
}
};
class KisDynamicSensorTangentialPressure : public KisDynamicSensor
{
public:
KisDynamicSensorTangentialPressure();
- virtual ~KisDynamicSensorTangentialPressure() { }
- virtual qreal value(const KisPaintInformation& info) {
+ ~KisDynamicSensorTangentialPressure() override { }
+ qreal value(const KisPaintInformation& info) override {
return info.tangentialPressure();
}
};
#endif
diff --git a/plugins/paintops/particle/kis_particle_paintop.h b/plugins/paintops/particle/kis_particle_paintop.h
index 64bea4dc65..0bd16e0386 100644
--- a/plugins/paintops/particle/kis_particle_paintop.h
+++ b/plugins/paintops/particle/kis_particle_paintop.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PARTICLE_PAINTOP_H_
#define KIS_PARTICLE_PAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "kis_particle_paintop_settings.h"
#include "particle_brush.h"
class KisPainter;
class KisPaintInformation;
class KisParticlePaintOp : public KisPaintOp
{
public:
KisParticlePaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- ~KisParticlePaintOp();
+ ~KisParticlePaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
private:
KisParticleBrushProperties m_properties;
KisPaintDeviceSP m_dab;
ParticleBrush m_particleBrush;
bool m_first;
};
#endif // KIS_PARTICLE_PAINTOP_H_
diff --git a/plugins/paintops/particle/kis_particle_paintop_settings.h b/plugins/paintops/particle/kis_particle_paintop_settings.h
index 329343f07f..84acccb212 100644
--- a/plugins/paintops/particle/kis_particle_paintop_settings.h
+++ b/plugins/paintops/particle/kis_particle_paintop_settings.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PARTICLE_PAINTOP_SETTINGS_H_
#define KIS_PARTICLE_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
#include <brushengine/kis_no_size_paintop_settings.h>
#include <kis_types.h>
class KisParticlePaintOpSettings : public KisNoSizePaintOpSettings
{
public:
KisParticlePaintOpSettings();
- ~KisParticlePaintOpSettings();
+ ~KisParticlePaintOpSettings() override;
- bool paintIncremental();
- bool isAirbrushing() const;
- int rate() const;
+ bool paintIncremental() override;
+ bool isAirbrushing() const override;
+ int rate() const override;
- QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings);
+ QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/paintops/particle/kis_particle_paintop_settings_widget.h b/plugins/paintops/particle/kis_particle_paintop_settings_widget.h
index 2bcbf2c170..3ee677c1dc 100644
--- a/plugins/paintops/particle/kis_particle_paintop_settings_widget.h
+++ b/plugins/paintops/particle/kis_particle_paintop_settings_widget.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2008 Lukas Tvrdy <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PARTICLEPAINTOP_SETTINGS_WIDGET_H_
#define KIS_PARTICLEPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
#include "ui_wdgparticleoptions.h"
#include "widgets/kis_popup_button.h"
class KisPaintActionTypeOption;
class KisParticleOpOption;
class KisParticlePaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisParticlePaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisParticlePaintOpSettingsWidget();
+ ~KisParticlePaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
KisPaintActionTypeOption* m_paintActionTypeOption;
KisParticleOpOption* m_particleOption;
};
#endif
diff --git a/plugins/paintops/particle/kis_particleop_option.h b/plugins/paintops/particle/kis_particleop_option.h
index 2fdabcc33f..79e3abde9c 100644
--- a/plugins/paintops/particle/kis_particleop_option.h
+++ b/plugins/paintops/particle/kis_particleop_option.h
@@ -1,81 +1,81 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_PARTICLEOP_OPTION_H
#define KIS_PARTICLEOP_OPTION_H
#include <kis_paintop_option.h>
const QString PARTICLE_COUNT = "Particle/count";
const QString PARTICLE_GRAVITY = "Particle/gravity";
const QString PARTICLE_WEIGHT = "Particle/weight";
const QString PARTICLE_ITERATIONS = "Particle/iterations";
const QString PARTICLE_SCALE_X = "Particle/scaleX";
const QString PARTICLE_SCALE_Y = "Particle/scaleY";
class KisParticleOpOptionsWidget;
class KisPaintopLodLimitations;
class KisParticleOpOption : public KisPaintOpOption
{
public:
KisParticleOpOption();
- ~KisParticleOpOption();
+ ~KisParticleOpOption() override;
int particleCount() const;
qreal weight() const;
qreal gravity() const;
int iterations() const;
QPointF scale() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
KisParticleOpOptionsWidget * m_options;
};
struct ParticleOption {
int particle_count;
int particle_iterations;
qreal particle_gravity;
qreal particle_weight;
qreal particle_scale_x;
qreal particle_scale_y;
void readOptionSetting(const KisPropertiesConfigurationSP setting) {
particle_count = setting->getInt(PARTICLE_COUNT);
particle_iterations = setting->getInt(PARTICLE_ITERATIONS);
particle_gravity = setting->getDouble(PARTICLE_GRAVITY);
particle_weight = setting->getDouble(PARTICLE_WEIGHT);
particle_scale_x = setting->getDouble(PARTICLE_SCALE_X);
particle_scale_y = setting->getDouble(PARTICLE_SCALE_Y);
}
void writeOptionSetting(KisPropertiesConfigurationSP setting) const {
setting->setProperty(PARTICLE_COUNT, particle_count);
setting->setProperty(PARTICLE_ITERATIONS, particle_iterations);
setting->setProperty(PARTICLE_GRAVITY, particle_gravity);
setting->setProperty(PARTICLE_WEIGHT, particle_weight);
setting->setProperty(PARTICLE_SCALE_X, particle_scale_x);
setting->setProperty(PARTICLE_SCALE_Y, particle_scale_y);
}
};
#endif
diff --git a/plugins/paintops/particle/particle_paintop_plugin.h b/plugins/paintops/particle/particle_paintop_plugin.h
index 1dde0ac4a2..849e867422 100644
--- a/plugins/paintops/particle/particle_paintop_plugin.h
+++ b/plugins/paintops/particle/particle_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PARTICLE_PAINTOP_PLUGIN_H_
#define PARTICLE_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariantList>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class ParticlePaintOpPlugin : public QObject
{
Q_OBJECT
public:
ParticlePaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~ParticlePaintOpPlugin();
+ ~ParticlePaintOpPlugin() override;
};
#endif // PARTICLE_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/roundmarker/kis_roundmarker_option.h b/plugins/paintops/roundmarker/kis_roundmarker_option.h
index 45c70945a7..4cd1a24efd 100644
--- a/plugins/paintops/roundmarker/kis_roundmarker_option.h
+++ b/plugins/paintops/roundmarker/kis_roundmarker_option.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ROUND_MARKER_OPTION_H
#define KIS_ROUND_MARKER_OPTION_H
#include <kis_paintop_option.h>
class KisRoundMarkerOptionWidget;
class KisRoundMarkerOption : public KisPaintOpOption
{
public:
KisRoundMarkerOption();
- ~KisRoundMarkerOption();
+ ~KisRoundMarkerOption() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(KisPropertiesConfigurationSP setting) override;
private:
KisRoundMarkerOptionWidget * m_options;
};
class RoundMarkerOption
{
public:
qreal diameter;
qreal spacing;
bool use_auto_spacing;
qreal auto_spacing_coeff;
void readOptionSetting(const KisPropertiesConfiguration &config) {
diameter = config.getDouble("diameter", 30.0);
spacing = config.getDouble("spacing", 0.02);
use_auto_spacing = config.getBool("useAutoSpacing", false);
auto_spacing_coeff = config.getDouble("autoSpacingCoeff", 1.0);
}
void writeOptionSetting(KisPropertiesConfigurationSP config) const {
config->setProperty("diameter", diameter);
config->setProperty("spacing", spacing);
config->setProperty("useAutoSpacing", use_auto_spacing);
config->setProperty("autoSpacingCoeff", auto_spacing_coeff);
}
};
#endif
diff --git a/plugins/paintops/roundmarker/kis_roundmarkerop.h b/plugins/paintops/roundmarker/kis_roundmarkerop.h
index c7ad951038..ded5e6eb38 100644
--- a/plugins/paintops/roundmarker/kis_roundmarkerop.h
+++ b/plugins/paintops/roundmarker/kis_roundmarkerop.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_ROUNDMARKEROP_H_
#define _KIS_ROUNDMARKEROP_H_
#include <QRect>
#include <kis_paintop.h>
#include <kis_types.h>
#include <kis_pressure_size_option.h>
#include <kis_pressure_spacing_option.h>
#include "kis_roundmarker_option.h"
class QPointF;
class KisPaintOpSettings;
class KisPainter;
class KisRoundMarkerOp: public KisPaintOp
{
public:
KisRoundMarkerOp(KisPaintOpSettingsSP settings, KisPainter* painter, KisNodeSP node, KisImageSP image);
- virtual ~KisRoundMarkerOp();
+ ~KisRoundMarkerOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
bool m_firstRun;
KisImageSP m_image;
KisPaintDeviceSP m_tempDev;
KisPressureSizeOption m_sizeOption;
KisPressureSpacingOption m_spacingOption;
QPointF m_lastPaintPos;
qreal m_lastRadius;
RoundMarkerOption m_markerOption;
};
#endif // _KIS_ROUNDMARKEROP_H_
diff --git a/plugins/paintops/roundmarker/kis_roundmarkerop_settings.h b/plugins/paintops/roundmarker/kis_roundmarkerop_settings.h
index 82f0a8da01..5a29f2b006 100644
--- a/plugins/paintops/roundmarker/kis_roundmarkerop_settings.h
+++ b/plugins/paintops/roundmarker/kis_roundmarkerop_settings.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ROUNDMARKEROP_SETTINGS_H
#define __KIS_ROUNDMARKEROP_SETTINGS_H
#include <QScopedPointer>
#include <kis_paintop_settings.h>
#include <kis_outline_generation_policy.h>
class KisRoundMarkerOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSettings>
{
public:
KisRoundMarkerOpSettings();
- ~KisRoundMarkerOpSettings();
+ ~KisRoundMarkerOpSettings() override;
bool paintIncremental() override;
qreal paintOpSize() const override;
void setPaintOpSize(qreal value) override;
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_ROUNDMARKEROP_SETTINGS_H */
diff --git a/plugins/paintops/roundmarker/kis_roundmarkerop_settings_widget.h b/plugins/paintops/roundmarker/kis_roundmarkerop_settings_widget.h
index 7794a190fa..fd3b56e689 100644
--- a/plugins/paintops/roundmarker/kis_roundmarkerop_settings_widget.h
+++ b/plugins/paintops/roundmarker/kis_roundmarkerop_settings_widget.h
@@ -1,42 +1,42 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_ROUNDMARKEROP_SETTINGS_WIDGET_H_
#define KIS_ROUNDMARKEROP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisSmudgeOptionWidget;
class KisRoundMarkerOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisRoundMarkerOpSettingsWidget(QWidget* parent = 0);
- ~KisRoundMarkerOpSettingsWidget();
+ ~KisRoundMarkerOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
private:
KisSmudgeOptionWidget *m_smudgeOptionWidget;
};
#endif // KIS_ROUNDMARKEROP_SETTINGS_WIDGET_H_
diff --git a/plugins/paintops/roundmarker/roundmarker_paintop_plugin.h b/plugins/paintops/roundmarker/roundmarker_paintop_plugin.h
index 4a2800aa2d..abd9bad568 100644
--- a/plugins/paintops/roundmarker/roundmarker_paintop_plugin.h
+++ b/plugins/paintops/roundmarker/roundmarker_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ROUNDMARKER_PAINTOP_PLUGIN_H_
#define _ROUNDMARKER_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class RoundMarkerPaintOpPlugin: public QObject
{
Q_OBJECT
public:
RoundMarkerPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~RoundMarkerPaintOpPlugin();
+ ~RoundMarkerPaintOpPlugin() override;
};
#endif // _ROUNDMARKER_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/sketch/kis_sketch_paintop.h b/plugins/paintops/sketch/kis_sketch_paintop.h
index 0f4995149f..e6b233e305 100644
--- a/plugins/paintops/sketch/kis_sketch_paintop.h
+++ b/plugins/paintops/sketch/kis_sketch_paintop.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SKETCH_PAINTOP_H_
#define KIS_SKETCH_PAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "kis_density_option.h"
#include "kis_sketchop_option.h"
#include "kis_sketch_paintop_settings.h"
#include "kis_painter.h"
#include <kis_pressure_size_option.h>
#include <kis_brush_option.h>
#include <kis_pressure_rotation_option.h>
#include "kis_linewidth_option.h"
#include "kis_offset_scale_option.h"
class KisDabCache;
class KisSketchPaintOp : public KisPaintOp
{
public:
KisSketchPaintOp(const KisPaintOpSettingsSP settings, KisPainter *painter, KisNodeSP node, KisImageSP image);
- ~KisSketchPaintOp();
+ ~KisSketchPaintOp() override;
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
// pixel buffer
KisPaintDeviceSP m_dab;
// mask detection area
KisFixedPaintDeviceSP m_maskDab;
QRectF m_brushBoundingBox;
QPointF m_hotSpot;
// simple mode
qreal m_radius;
KisPressureOpacityOption m_opacityOption;
KisPressureSizeOption m_sizeOption;
KisPressureRotationOption m_rotationOption;
KisDensityOption m_densityOption;
KisLineWidthOption m_lineWidthOption;
KisOffsetScaleOption m_offsetScaleOption;
KisBrushOption m_brushOption;
SketchProperties m_sketchProperties;
QVector<QPointF> m_points;
int m_count;
KisPainter * m_painter;
KisBrushSP m_brush;
KisDabCache *m_dabCache;
private:
void drawConnection(const QPointF &start, const QPointF &end, double lineWidth);
void updateBrushMask(const KisPaintInformation& info, qreal scale, qreal rotation);
};
#endif // KIS_SKETCH_PAINTOP_H_
diff --git a/plugins/paintops/sketch/kis_sketch_paintop_settings.h b/plugins/paintops/sketch/kis_sketch_paintop_settings.h
index e2c8f3cc1e..ad5a7e6557 100644
--- a/plugins/paintops/sketch/kis_sketch_paintop_settings.h
+++ b/plugins/paintops/sketch/kis_sketch_paintop_settings.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SKETCH_PAINTOP_SETTINGS_H_
#define KIS_SKETCH_PAINTOP_SETTINGS_H_
#include <kis_brush_based_paintop_settings.h>
#include <kis_types.h>
#include "kis_sketch_paintop_settings_widget.h"
#include <kis_pressure_opacity_option.h>
class KisSketchPaintOpSettings : public KisBrushBasedPaintOpSettings
{
public:
KisSketchPaintOpSettings();
- virtual ~KisSketchPaintOpSettings() {}
+ ~KisSketchPaintOpSettings() override {}
- QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode);
+ QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
- bool paintIncremental();
- bool isAirbrushing() const;
- int rate() const;
+ bool paintIncremental() override;
+ bool isAirbrushing() const override;
+ int rate() const override;
};
typedef KisSharedPtr<KisSketchPaintOpSettings> KisSketchPaintOpSettingsSP;
#endif
diff --git a/plugins/paintops/sketch/kis_sketch_paintop_settings_widget.h b/plugins/paintops/sketch/kis_sketch_paintop_settings_widget.h
index c484ce4131..d652f27056 100644
--- a/plugins/paintops/sketch/kis_sketch_paintop_settings_widget.h
+++ b/plugins/paintops/sketch/kis_sketch_paintop_settings_widget.h
@@ -1,45 +1,45 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SKETCHPAINTOP_SETTINGS_WIDGET_H_
#define KIS_SKETCHPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
#include <kis_brush_based_paintop_options_widget.h>
#include "ui_wdgsketchoptions.h"
class KisPaintActionTypeOption;
class KisSketchOpOption;
class KisSketchPaintOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisSketchPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisSketchPaintOpSettingsWidget();
+ ~KisSketchPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
KisSketchOpOption* m_sketchOption;
KisPaintActionTypeOption* m_paintActionType;
};
#endif
diff --git a/plugins/paintops/sketch/kis_sketchop_option.h b/plugins/paintops/sketch/kis_sketchop_option.h
index 3b986a7189..c23b9ec7ab 100644
--- a/plugins/paintops/sketch/kis_sketchop_option.h
+++ b/plugins/paintops/sketch/kis_sketchop_option.h
@@ -1,84 +1,84 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SKETCHOP_OPTION_H
#define KIS_SKETCHOP_OPTION_H
#include <kis_paintop_option.h>
const QString SKETCH_PROBABILITY = "Sketch/probability";
const QString SKETCH_DISTANCE_DENSITY = "Sketch/distanceDensity";
const QString SKETCH_OFFSET = "Sketch/offset";
const QString SKETCH_USE_SIMPLE_MODE = "Sketch/simpleMode";
const QString SKETCH_MAKE_CONNECTION = "Sketch/makeConnection";
const QString SKETCH_MAGNETIFY = "Sketch/magnetify";
const QString SKETCH_LINE_WIDTH = "Sketch/lineWidth";
const QString SKETCH_RANDOM_RGB = "Sketch/randomRGB";
const QString SKETCH_RANDOM_OPACITY = "Sketch/randomOpacity";
const QString SKETCH_DISTANCE_OPACITY = "Sketch/distanceOpacity";
class KisSketchOpOptionsWidget;
class KisSketchOpOption : public KisPaintOpOption
{
public:
KisSketchOpOption();
- ~KisSketchOpOption();
+ ~KisSketchOpOption() override;
void setThreshold(int radius) const;
int threshold() const;
- void writeOptionSetting(KisPropertiesConfigurationSP settings) const;
- void readOptionSetting(const KisPropertiesConfigurationSP settings);
+ void writeOptionSetting(KisPropertiesConfigurationSP settings) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP settings) override;
- void lodLimitations(KisPaintopLodLimitations *l) const;
+ void lodLimitations(KisPaintopLodLimitations *l) const override;
private:
KisSketchOpOptionsWidget * m_options;
};
class SketchProperties
{
public:
qreal offset; // perc
qreal probability; // perc
bool simpleMode;
bool makeConnection;
bool magnetify;
bool randomRGB;
bool randomOpacity;
bool distanceOpacity;
bool distanceDensity;
int lineWidth; // px
void readOptionSetting(const KisPropertiesConfigurationSP settings) {
probability = settings->getDouble(SKETCH_PROBABILITY);
offset = settings->getDouble(SKETCH_OFFSET) * 0.01;
lineWidth = settings->getInt(SKETCH_LINE_WIDTH);
simpleMode = settings->getBool(SKETCH_USE_SIMPLE_MODE);
makeConnection = settings->getBool(SKETCH_MAKE_CONNECTION);
magnetify = settings->getBool(SKETCH_MAGNETIFY);
randomRGB = settings->getBool(SKETCH_RANDOM_RGB);
randomOpacity = settings->getBool(SKETCH_RANDOM_OPACITY);
distanceDensity = settings->getBool(SKETCH_DISTANCE_DENSITY);
distanceOpacity = settings->getBool(SKETCH_DISTANCE_OPACITY);
}
};
#endif
diff --git a/plugins/paintops/sketch/sketch_paintop_plugin.h b/plugins/paintops/sketch/sketch_paintop_plugin.h
index 6feb7f89ec..313912cdde 100644
--- a/plugins/paintops/sketch/sketch_paintop_plugin.h
+++ b/plugins/paintops/sketch/sketch_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SKETCH_PAINTOP_PLUGIN_H_
#define SKETCH_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class SketchPaintOpPlugin : public QObject
{
Q_OBJECT
public:
SketchPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~SketchPaintOpPlugin();
+ ~SketchPaintOpPlugin() override;
};
#endif // SKETCH_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/spray/kis_spray_paintop.h b/plugins/paintops/spray/kis_spray_paintop.h
index f19320057f..82241f616d 100644
--- a/plugins/paintops/spray/kis_spray_paintop.h
+++ b/plugins/paintops/spray/kis_spray_paintop.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2008-2012 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPRAY_PAINTOP_H_
#define KIS_SPRAY_PAINTOP_H_
#include <brushengine/kis_paintop.h>
#include <kis_types.h>
#include "spray_brush.h"
#include "kis_spray_paintop_settings.h"
#include "kis_brush_option.h"
#include <kis_pressure_rotation_option.h>
#include <kis_pressure_opacity_option.h>
#include <kis_pressure_size_option.h>
class KisPainter;
class KisSprayPaintOp : public KisPaintOp
{
public:
KisSprayPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
- ~KisSprayPaintOp();
+ ~KisSprayPaintOp() override;
- KisSpacingInformation paintAt(const KisPaintInformation& info);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
private:
KisShapeProperties m_shapeProperties;
KisSprayProperties m_properties;
KisShapeDynamicsProperties m_shapeDynamicsProperties;
KisColorProperties m_colorProperties;
KisBrushOption m_brushOption;
KisSprayPaintOpSettingsSP m_settings;
KisPaintDeviceSP m_dab;
SprayBrush m_sprayBrush;
qreal m_xSpacing, m_ySpacing, m_spacing;
bool m_isPresetValid;
KisPressureRotationOption m_rotationOption;
KisPressureSizeOption m_sizeOption;
KisPressureOpacityOption m_opacityOption;
KisNodeSP m_node;
};
#endif // KIS_SPRAY_PAINTOP_H_
diff --git a/plugins/paintops/spray/kis_spray_paintop_settings.h b/plugins/paintops/spray/kis_spray_paintop_settings.h
index d63ef21013..40516f50ed 100644
--- a/plugins/paintops/spray/kis_spray_paintop_settings.h
+++ b/plugins/paintops/spray/kis_spray_paintop_settings.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2008,2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPRAY_PAINTOP_SETTINGS_H_
#define KIS_SPRAY_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
#include <brushengine/kis_no_size_paintop_settings.h>
#include <kis_types.h>
#include <kis_outline_generation_policy.h>
#include "kis_spray_paintop_settings_widget.h"
class KisSprayPaintOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSettings>
{
public:
KisSprayPaintOpSettings();
- virtual ~KisSprayPaintOpSettings();
+ ~KisSprayPaintOpSettings() override;
void setPaintOpSize(qreal value) override;
qreal paintOpSize() const override;
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) override;
QString modelName() const override {
return "airbrush";
}
bool paintIncremental() override;
bool isAirbrushing() const override;
int rate() const override;
protected:
QList<KisUniformPaintOpPropertySP> uniformProperties(KisPaintOpSettingsSP settings) override;
private:
Q_DISABLE_COPY(KisSprayPaintOpSettings)
struct Private;
const QScopedPointer<Private> m_d;
};
typedef KisSharedPtr<KisSprayPaintOpSettings> KisSprayPaintOpSettingsSP;
#endif
diff --git a/plugins/paintops/spray/kis_spray_paintop_settings_widget.h b/plugins/paintops/spray/kis_spray_paintop_settings_widget.h
index 4dcff92dec..b990033e04 100644
--- a/plugins/paintops/spray/kis_spray_paintop_settings_widget.h
+++ b/plugins/paintops/spray/kis_spray_paintop_settings_widget.h
@@ -1,40 +1,40 @@
/*
* Copyright (c) 2008,2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPRAYPAINTOP_SETTINGS_WIDGET_H_
#define KIS_SPRAYPAINTOP_SETTINGS_WIDGET_H_
#include <kis_paintop_settings_widget.h>
class KisSprayOpOption;
class KisSprayPaintOpSettingsWidget : public KisPaintOpSettingsWidget
{
Q_OBJECT
public:
KisSprayPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisSprayPaintOpSettingsWidget();
+ ~KisSprayPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
public:
KisSprayOpOption* m_sprayArea;
};
#endif
diff --git a/plugins/paintops/spray/kis_spray_shape_dynamics.h b/plugins/paintops/spray/kis_spray_shape_dynamics.h
index 6b594d3a63..fe2c962ebe 100644
--- a/plugins/paintops/spray/kis_spray_shape_dynamics.h
+++ b/plugins/paintops/spray/kis_spray_shape_dynamics.h
@@ -1,122 +1,122 @@
/*
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
#define KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
#include <kis_paintop_option.h>
const QString SHAPE_DYNAMICS_VERSION = "ShapeDynamicsVersion";
// Old Krita 2.2.x strings for backward compatibility
const QString SPRAYSHAPE_RANDOM_SIZE = "SprayShape/randomSize";
const QString SPRAYSHAPE_FIXED_ROTATION = "SprayShape/fixedRotation";
const QString SPRAYSHAPE_FIXED_ANGEL = "SprayShape/fixedAngle";
const QString SPRAYSHAPE_RANDOM_ROTATION = "SprayShape/randomRotation";
const QString SPRAYSHAPE_RANDOM_ROTATION_WEIGHT = "SprayShape/randomRotationWeight";
const QString SPRAYSHAPE_FOLLOW_CURSOR = "SprayShape/followCursor";
const QString SPRAYSHAPE_FOLLOW_CURSOR_WEIGHT = "SprayShape/followCursorWeigth";
const QString SPRAYSHAPE_DRAWING_ANGLE = "SprayShape/followDrawingAngle";
const QString SPRAYSHAPE_DRAWING_ANGLE_WEIGHT = "SprayShape/followDrawingAngleWeigth";
// My intention is to have the option dialog more general so that it can be share
// hence the suffix ShapeDynamics
const QString SHAPE_DYNAMICS_ENABLED = "ShapeDynamics/enabled";
const QString SHAPE_DYNAMICS_RANDOM_SIZE = "ShapeDynamics/randomSize";
const QString SHAPE_DYNAMICS_FIXED_ROTATION = "ShapeDynamics/fixedRotation";
const QString SHAPE_DYNAMICS_FIXED_ANGEL = "ShapeDynamics/fixedAngle";
const QString SHAPE_DYNAMICS_RANDOM_ROTATION = "ShapeDynamics/randomRotation";
const QString SHAPE_DYNAMICS_RANDOM_ROTATION_WEIGHT = "ShapeDynamics/randomRotationWeight";
const QString SHAPE_DYNAMICS_FOLLOW_CURSOR = "ShapeDynamics/followCursor";
const QString SHAPE_DYNAMICS_FOLLOW_CURSOR_WEIGHT = "ShapeDynamics/followCursorWeigth";
const QString SHAPE_DYNAMICS_DRAWING_ANGLE = "ShapeDynamics/followDrawingAngle";
const QString SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT = "ShapeDynamics/followDrawingAngleWeigth";
class KisShapeDynamicsOptionsWidget;
class KisSprayShapeDynamicsOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisSprayShapeDynamicsOption();
- ~KisSprayShapeDynamicsOption();
+ ~KisSprayShapeDynamicsOption() override;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
void setupBrushPreviewSignals();
private:
KisShapeDynamicsOptionsWidget * m_options;
};
class KisShapeDynamicsProperties
{
public:
bool enabled;
// particle size dynamics
bool randomSize;
// rotation dynamics
bool fixedRotation;
bool randomRotation;
bool followCursor;
bool followDrawingAngle;
quint16 fixedAngle;
qreal randomRotationWeight;
qreal followCursorWeigth;
qreal followDrawingAngleWeight;
public:
void loadSettings(const KisPropertiesConfigurationSP settings) {
// Krita 2.2
if (settings->getString(SHAPE_DYNAMICS_VERSION, "2.2") == "2.2") {
randomSize = settings->getBool(SPRAYSHAPE_RANDOM_SIZE);
// rotation
fixedRotation = settings->getBool(SPRAYSHAPE_FIXED_ROTATION);
randomRotation = settings->getBool(SPRAYSHAPE_RANDOM_ROTATION);
followCursor = settings->getBool(SPRAYSHAPE_FOLLOW_CURSOR);
followDrawingAngle = settings->getBool(SPRAYSHAPE_DRAWING_ANGLE);
fixedAngle = settings->getInt(SPRAYSHAPE_FIXED_ANGEL);
randomRotationWeight = settings->getDouble(SPRAYSHAPE_RANDOM_ROTATION_WEIGHT);
followCursorWeigth = settings->getDouble(SPRAYSHAPE_FOLLOW_CURSOR_WEIGHT);
followDrawingAngleWeight = settings->getDouble(SPRAYSHAPE_DRAWING_ANGLE_WEIGHT);
enabled = true;
}
// Krita latest
else {
enabled = settings->getBool(SHAPE_DYNAMICS_ENABLED);
// particle type size
randomSize = settings->getBool(SHAPE_DYNAMICS_RANDOM_SIZE);
// rotation dynamics
fixedRotation = settings->getBool(SHAPE_DYNAMICS_FIXED_ROTATION);
randomRotation = settings->getBool(SHAPE_DYNAMICS_RANDOM_ROTATION);
followCursor = settings->getBool(SHAPE_DYNAMICS_FOLLOW_CURSOR);
followDrawingAngle = settings->getBool(SHAPE_DYNAMICS_DRAWING_ANGLE);
fixedAngle = settings->getInt(SHAPE_DYNAMICS_FIXED_ANGEL);
randomRotationWeight = settings->getDouble(SHAPE_DYNAMICS_RANDOM_ROTATION_WEIGHT);
followCursorWeigth = settings->getDouble(SHAPE_DYNAMICS_FOLLOW_CURSOR_WEIGHT);
followDrawingAngleWeight = settings->getDouble(SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT);
}
}
};
#endif // KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
diff --git a/plugins/paintops/spray/kis_spray_shape_option.h b/plugins/paintops/spray/kis_spray_shape_option.h
index 99539434c8..43f555d433 100644
--- a/plugins/paintops/spray/kis_spray_shape_option.h
+++ b/plugins/paintops/spray/kis_spray_shape_option.h
@@ -1,95 +1,95 @@
/*
* Copyright (c) 2008,2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPRAY_SHAPE_OPTION_H
#define KIS_SPRAY_SHAPE_OPTION_H
#include <kis_paintop_option.h>
const QString SPRAYSHAPE_ENABLED = "SprayShape/enabled";
const QString SPRAYSHAPE_SHAPE = "SprayShape/shape";
const QString SPRAYSHAPE_PROPORTIONAL = "SprayShape/proportional";
const QString SPRAYSHAPE_WIDTH = "SprayShape/width";
const QString SPRAYSHAPE_HEIGHT = "SprayShape/height";
const QString SPRAYSHAPE_IMAGE_URL = "SprayShape/imageUrl";
const QString SPRAYSHAPE_USE_ASPECT = "SprayShape/useAspect";
class KisShapeOptionsWidget;
class KisAspectRatioLocker;
class KisSprayShapeOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisSprayShapeOption();
- ~KisSprayShapeOption();
+ ~KisSprayShapeOption() override;
/// 0 - ellipse, 1 - rectangle, 2 - anti-aliased pixel, 2 - pixel
int shape() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisShapeOptionsWidget * m_options;
int m_maxSize;
KisAspectRatioLocker *m_sizeRatioLocker;
private Q_SLOTS:
void prepareImage();
void changeSizeUI(bool proportionalSize);
};
#include <QImage>
class KisShapeProperties
{
public:
// particle type size
quint8 shape;
quint16 width;
quint16 height;
bool enabled;
bool proportional;
// rotation
QImage image;
public:
void loadSettings(const KisPropertiesConfigurationSP settings, qreal proportionalWidth, qreal proportionalHeight) {
enabled = settings->getBool(SPRAYSHAPE_ENABLED, true);
width = settings->getInt(SPRAYSHAPE_WIDTH);
height = settings->getInt(SPRAYSHAPE_HEIGHT);
proportional = settings->getBool(SPRAYSHAPE_PROPORTIONAL);
if (proportional) {
width = (width / 100.0) * proportionalWidth;
height = (height / 100.0) * proportionalHeight;
}
// particle type size
shape = settings->getInt(SPRAYSHAPE_SHAPE);
// you have to check if the image is null in client
image = QImage(settings->getString(SPRAYSHAPE_IMAGE_URL));
}
};
#endif // KIS_SPRAY_SHAPE_OPTION_H
diff --git a/plugins/paintops/spray/kis_sprayop_option.h b/plugins/paintops/spray/kis_sprayop_option.h
index 4777d04033..ead7483434 100644
--- a/plugins/paintops/spray/kis_sprayop_option.h
+++ b/plugins/paintops/spray/kis_sprayop_option.h
@@ -1,106 +1,106 @@
/*
* Copyright (c) 2008,2009,2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SPRAYOP_OPTION_H
#define KIS_SPRAYOP_OPTION_H
#include <kis_paintop_option.h>
const QString SPRAY_DIAMETER = "Spray/diameter";
const QString SPRAY_ASPECT = "Spray/aspect";
const QString SPRAY_COVERAGE = "Spray/coverage";
const QString SPRAY_SCALE = "Spray/scale";
const QString SPRAY_ROTATION = "Spray/rotation";
const QString SPRAY_PARTICLE_COUNT = "Spray/particleCount";
const QString SPRAY_JITTER_MOVE_AMOUNT = "Spray/jitterMoveAmount";
const QString SPRAY_JITTER_MOVEMENT = "Spray/jitterMovement";
const QString SPRAY_SPACING = "Spray/spacing";
const QString SPRAY_GAUSS_DISTRIBUTION = "Spray/gaussianDistribution";
const QString SPRAY_USE_DENSITY = "Spray/useDensity";
class KisSprayOpOptionsWidget;
class KisSprayOpOption : public KisPaintOpOption
{
public:
KisSprayOpOption();
- ~KisSprayOpOption();
+ ~KisSprayOpOption() override;
void setDiameter(int diameter) const;
int diameter() const;
qreal brushAspect() const;
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisSprayOpOptionsWidget *m_options;
};
class KisSprayProperties : public KisBaseOption
{
public:
quint16 diameter;
quint16 particleCount;
qreal aspect;
qreal coverage;
qreal amount;
qreal spacing;
qreal scale;
qreal brushRotation;
bool jitterMovement;
bool useDensity;
bool gaussian;
int radius() const {
return diameter / 2;
}
public:
- void readOptionSettingImpl(const KisPropertiesConfiguration *settings) {
+ void readOptionSettingImpl(const KisPropertiesConfiguration *settings) override {
diameter = settings->getInt(SPRAY_DIAMETER);
aspect = settings->getDouble(SPRAY_ASPECT);
particleCount = settings->getDouble(SPRAY_PARTICLE_COUNT);
coverage = (settings->getDouble(SPRAY_COVERAGE) / 100.0);
amount = settings->getDouble(SPRAY_JITTER_MOVE_AMOUNT);
spacing = settings->getDouble(SPRAY_SPACING);
scale = settings->getDouble(SPRAY_SCALE);
brushRotation = settings->getDouble(SPRAY_ROTATION);
jitterMovement = settings->getBool(SPRAY_JITTER_MOVEMENT);
useDensity = settings->getBool(SPRAY_USE_DENSITY);
gaussian = settings->getBool(SPRAY_GAUSS_DISTRIBUTION);
}
- void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const {
+ void writeOptionSettingImpl(KisPropertiesConfiguration *setting) const override {
setting->setProperty(SPRAY_DIAMETER, diameter);
setting->setProperty(SPRAY_ASPECT, aspect);
setting->setProperty(SPRAY_COVERAGE, coverage * 100.0);
setting->setProperty(SPRAY_SCALE, scale);
setting->setProperty(SPRAY_ROTATION, brushRotation);
setting->setProperty(SPRAY_PARTICLE_COUNT, particleCount);
setting->setProperty(SPRAY_JITTER_MOVE_AMOUNT, amount);
setting->setProperty(SPRAY_JITTER_MOVEMENT, jitterMovement);
setting->setProperty(SPRAY_SPACING, spacing);
setting->setProperty(SPRAY_GAUSS_DISTRIBUTION, gaussian);
setting->setProperty(SPRAY_USE_DENSITY, useDensity);
}
};
#endif
diff --git a/plugins/paintops/spray/spray_paintop_plugin.h b/plugins/paintops/spray/spray_paintop_plugin.h
index 3c4c866b34..9aa2b9efc1 100644
--- a/plugins/paintops/spray/spray_paintop_plugin.h
+++ b/plugins/paintops/spray/spray_paintop_plugin.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2008 Lukáš Tvrdý (lukast.dev@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SPRAY_PAINTOP_PLUGIN_H_
#define SPRAY_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
/**
* A plugin wrapper that adds the paintop factories to the paintop registry.
*/
class SprayPaintOpPlugin : public QObject
{
Q_OBJECT
public:
SprayPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~SprayPaintOpPlugin();
+ ~SprayPaintOpPlugin() override;
};
#endif // SPRAY_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/tangentnormal/kis_normal_preview_widget.h b/plugins/paintops/tangentnormal/kis_normal_preview_widget.h
index a25ccd0143..b2e715b8cf 100644
--- a/plugins/paintops/tangentnormal/kis_normal_preview_widget.h
+++ b/plugins/paintops/tangentnormal/kis_normal_preview_widget.h
@@ -1,57 +1,57 @@
/* This file is part of the KDE project
*
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KISNORMALPREVIEWWIDGET_H
#define KISNORMALPREVIEWWIDGET_H
#include <QLabel>
/* This is a widget that takes an image of a normal semi-sphere, and inverts the channels based on the values
* of m_redChannel, m_greenChannel and m_blueChannel, this is used to give feedback on a set of normal-swizzles.
* setRedChannel, setGreenChannel and setBlueChannel automatically updates the image with the new channel configuration.
*/
class KisNormalPreviewWidget : public QLabel
{
Q_OBJECT
public:
KisNormalPreviewWidget(QWidget* parent = 0);
- ~KisNormalPreviewWidget();
+ ~KisNormalPreviewWidget() override;
public Q_SLOTS:
/* for the following functions 0=X+, 1=X-, 2=Y+, 3=Y-, 4=Z+ and 5=Z-*/
void setRedChannel(int index);
void setGreenChannel(int index);
void setBlueChannel(int index);
private:
void updateImage();
QImage swizzleTransformPreview (QImage preview);
int previewTransform(int const horizontal, int const vertical, int const depth, int index, int maxvalue);
int m_redChannel;
int m_greenChannel;
int m_blueChannel;
QString m_fileName;
};
#endif // KISNORMALPREVIEWWIDGET_H
diff --git a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop.h b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop.h
index eb76845b0c..15b74dc91b 100644
--- a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop.h
+++ b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop.h
@@ -1,70 +1,70 @@
/*
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TANGENTNORMALPAINTOP_H_
#define _KIS_TANGENTNORMALPAINTOP_H_
#include <QRect>
#include <kis_brush_based_paintop.h>
#include <kis_types.h>
#include <kis_pressure_size_option.h>
#include <kis_tangent_tilt_option.h>
#include <kis_pressure_flow_opacity_option.h>
#include <kis_pressure_spacing_option.h>
#include <kis_pressure_rotation_option.h>
#include <kis_pressure_scatter_option.h>
#include <kis_pressure_flow_option.h>
#include <kis_pressure_softness_option.h>
#include <kis_pressure_sharpness_option.h>
class KisBrushBasedPaintOpSettings;
class KisPainter;
class KisTangentNormalPaintOp: public KisBrushBasedPaintOp
{
public:
//public functions//
/* Create a Tangent Normal Brush Operator*/
KisTangentNormalPaintOp(const KisPaintOpSettingsSP settings, KisPainter* painter, KisNodeSP node, KisImageSP image);
- virtual ~KisTangentNormalPaintOp();
+ ~KisTangentNormalPaintOp() override;
/*paint the dabs*/
- KisSpacingInformation paintAt(const KisPaintInformation& info);
- void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance);
+ KisSpacingInformation paintAt(const KisPaintInformation& info) override;
+ void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;
private:
//private functions//
KisPressureSizeOption m_sizeOption;
KisFlowOpacityOption m_opacityOption;
KisPressureSpacingOption m_spacingOption;
KisPressureRotationOption m_rotationOption;
KisPressureScatterOption m_scatterOption;
KisTangentTiltOption m_tangentTiltOption;
KisPressureSoftnessOption m_softnessOption;
KisPressureSharpnessOption m_sharpnessOption;
KisPressureFlowOption m_flowOption;
KisFixedPaintDeviceSP m_maskDab;
KisPaintDeviceSP m_tempDev;
QRect m_dstDabRect;
KisPaintDeviceSP m_lineCacheDevice;
};
#endif // _KIS_TANGENTNORMALPAINTOP_H_
diff --git a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_plugin.h b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_plugin.h
index f41156d3de..c34a223606 100644
--- a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_plugin.h
+++ b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_plugin.h
@@ -1,34 +1,34 @@
/*
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _TANGENTNORMAL_PAINTOP_PLUGIN_H_
#define _TANGENTNORMAL_PAINTOP_PLUGIN_H_
#include <QObject>
#include <QVariant>
class TangentNormalPaintOpPlugin: public QObject
{
Q_OBJECT
public:
TangentNormalPaintOpPlugin(QObject *parent, const QVariantList &);
- virtual ~TangentNormalPaintOpPlugin();
+ ~TangentNormalPaintOpPlugin() override;
};
#endif // _TANGENTNORMAL_PAINTOP_PLUGIN_H_
diff --git a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.h b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.h
index c8c4d9832f..ff14370867 100644
--- a/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.h
+++ b/plugins/paintops/tangentnormal/kis_tangent_normal_paintop_settings_widget.h
@@ -1,38 +1,38 @@
/*
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TANGENTNORMAL_PAINTOP_SETTINGS_WIDGET_H_
#define KIS_TANGENTNORMAL_PAINTOP_SETTINGS_WIDGET_H_
#include <kis_brush_based_paintop_options_widget.h>
class KisTangentNormalPaintOpSettingsWidget : public KisBrushBasedPaintopOptionWidget
{
Q_OBJECT
public:
KisTangentNormalPaintOpSettingsWidget(QWidget* parent = 0);
- ~KisTangentNormalPaintOpSettingsWidget();
+ ~KisTangentNormalPaintOpSettingsWidget() override;
- KisPropertiesConfigurationSP configuration() const;
+ KisPropertiesConfigurationSP configuration() const override;
};
#endif // KIS_TANGENTNORMAL_PAINTOP_SETTINGS_WIDGET_H_
diff --git a/plugins/paintops/tangentnormal/kis_tangent_tilt_option.h b/plugins/paintops/tangentnormal/kis_tangent_tilt_option.h
index 8598e7e82b..67a7ee2437 100644
--- a/plugins/paintops/tangentnormal/kis_tangent_tilt_option.h
+++ b/plugins/paintops/tangentnormal/kis_tangent_tilt_option.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
*
* Copyright (C) 2015 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TANGENT_TILT_OPTION_H
#define KIS_TANGENT_TILT_OPTION_H
#include <brushengine/kis_paint_information.h>
#include <kis_types.h>
#include <kis_paintop_option.h>
const QString TANGENT_RED = "Tangent/swizzleRed";
const QString TANGENT_GREEN = "Tangent/swizzleGreen";
const QString TANGENT_BLUE = "Tangent/swizzleBlue";
const QString TANGENT_TYPE = "Tangent/directionType";
const QString TANGENT_EV_SEN = "Tangent/elevationSensitivity";
const QString TANGENT_MIX_VAL = "Tangent/mixValue";
//const QString TANGENT_DIR_MIN = "Tangent/directionMinimum";
//const QString TANGENT_DIR_MAX = "Tangent/directionMaximum";
class KisPropertiesConfiguration;
class KisTangentTiltOptionWidget;
class KisTangentTiltOption: public KisPaintOpOption//not really//
{
public:
KisTangentTiltOption();
- ~KisTangentTiltOption();
+ ~KisTangentTiltOption() override;
/*These three give away which the index of the combobox for a given channel*/
int redChannel() const;
int greenChannel() const;
int blueChannel() const;
int directionType() const;
double elevationSensitivity() const;
double mixValue() const;
qreal m_canvasAngle;
bool m_canvasAxisXMirrored;
bool m_canvasAxisYMirrored;
/*This assigns the right axis to the component, based on index and maximum value*/
void swizzleAssign(qreal const horizontal, qreal const vertical, qreal const depth, qreal *component, int index, qreal maxvalue);
//takes the RGB values and will deform them depending on tilt.
void apply(const KisPaintInformation& info, qreal *r, qreal *g, qreal *b);
- void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
- void readOptionSetting(const KisPropertiesConfigurationSP setting);
+ void writeOptionSetting(KisPropertiesConfigurationSP setting) const override;
+ void readOptionSetting(const KisPropertiesConfigurationSP setting) override;
private:
KisTangentTiltOptionWidget * m_options;
};
#endif // KIS_TANGENT_TILT_OPTION_H
diff --git a/plugins/tools/basictools/default_tools.h b/plugins/tools/basictools/default_tools.h
index 073a37144f..de11e3cd65 100644
--- a/plugins/tools/basictools/default_tools.h
+++ b/plugins/tools/basictools/default_tools.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DEFAULT_TOOLS_H_
#define DEFAULT_TOOLS_H_
#include <QObject>
#include <QVariant>
/**
* A module wrapper around Krita's default tools.
* Despite the fact that new tools are created for every new view,
* it is not possible to make tools standard parts of the type of the
* imagesize plugin, because we need to create a new set of tools for every
* pointer device (mouse, stylus, eraser, puck, etc.). So this plugin is
* a module which is loaded once into Krita. For every tool there is a factory
* class that is registered with the tool registry, and that is used to create
* new instances of the tools.
*/
class DefaultTools : public QObject
{
Q_OBJECT
public:
DefaultTools(QObject *parent, const QVariantList &);
- virtual ~DefaultTools();
+ ~DefaultTools() override;
};
#endif // DEFAULT_TOOLS_H_
diff --git a/plugins/tools/basictools/kis_tool_brush.h b/plugins/tools/basictools/kis_tool_brush.h
index e627ada171..577f4b05a2 100644
--- a/plugins/tools/basictools/kis_tool_brush.h
+++ b/plugins/tools/basictools/kis_tool_brush.h
@@ -1,165 +1,165 @@
/*
* Copyright (c) 2003-2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_BRUSH_H_
#define KIS_TOOL_BRUSH_H_
#include "kis_tool_freehand.h"
#include <QSignalMapper>
#include "KoToolFactoryBase.h"
#include <flake/kis_node_shape.h>
#include <kis_icon.h>
#include <QKeySequence>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <KoIcon.h>
class QCheckBox;
class QComboBox;
class KActionCollection;
class KoCanvasBase;
class KisSliderSpinBox;
class KisDoubleSliderSpinBox;
class KisToolBrush : public KisToolFreehand
{
Q_OBJECT
Q_PROPERTY(int smoothnessQuality READ smoothnessQuality WRITE slotSetSmoothnessDistance NOTIFY smoothnessQualityChanged)
Q_PROPERTY(qreal smoothnessFactor READ smoothnessFactor WRITE slotSetTailAgressiveness NOTIFY smoothnessFactorChanged)
Q_PROPERTY(bool smoothPressure READ smoothPressure WRITE setSmoothPressure NOTIFY smoothPressureChanged)
Q_PROPERTY(int smoothingType READ smoothingType WRITE slotSetSmoothingType NOTIFY smoothingTypeChanged)
Q_PROPERTY(bool useScalableDistance READ useScalableDistance WRITE setUseScalableDistance NOTIFY useScalableDistanceChanged)
Q_PROPERTY(bool useDelayDistance READ useDelayDistance WRITE setUseDelayDistance NOTIFY useDelayDistanceChanged)
Q_PROPERTY(qreal delayDistance READ delayDistance WRITE setDelayDistance NOTIFY delayDistanceChanged)
Q_PROPERTY(bool finishStabilizedCurve READ finishStabilizedCurve WRITE setFinishStabilizedCurve NOTIFY finishStabilizedCurveChanged)
Q_PROPERTY(bool stabilizeSensors READ stabilizeSensors WRITE setStabilizeSensors NOTIFY stabilizeSensorsChanged)
public:
KisToolBrush(KoCanvasBase * canvas);
- virtual ~KisToolBrush();
+ ~KisToolBrush() override;
- QWidget * createOptionWidget();
+ QWidget * createOptionWidget() override;
int smoothnessQuality() const;
qreal smoothnessFactor() const;
bool smoothPressure() const;
int smoothingType() const;
bool useScalableDistance() const;
bool useDelayDistance() const;
qreal delayDistance() const;
bool finishStabilizedCurve() const;
bool stabilizeSensors() const;
protected:
KConfigGroup m_configGroup; // only used in the multihand tool for now
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
void slotSetSmoothnessDistance(qreal distance);
void slotSetMagnetism(int magnetism);
void slotSetSmoothingType(int index);
void slotSetTailAgressiveness(qreal argh_rhhrr);
void setSmoothPressure(bool value);
void setUseScalableDistance(bool value);
void setUseDelayDistance(bool value);
void setDelayDistance(qreal value);
void setStabilizeSensors(bool value);
void setFinishStabilizedCurve(bool value);
- virtual void updateSettingsViews();
+ void updateSettingsViews() override;
Q_SIGNALS:
void smoothnessQualityChanged();
void smoothnessFactorChanged();
void smoothPressureChanged();
void smoothingTypeChanged();
void useScalableDistanceChanged();
void useDelayDistanceChanged();
void delayDistanceChanged();
void finishStabilizedCurveChanged();
void stabilizeSensorsChanged();
private:
void addSmoothingAction(int enumId, const QString &id, const QString &name, const QIcon &icon, KActionCollection *globalCollection);
private:
QComboBox *m_cmbSmoothingType;
QCheckBox *m_chkAssistant;
KisSliderSpinBox *m_sliderMagnetism;
QCheckBox *m_chkOnlyOneAssistant;
KisDoubleSliderSpinBox *m_sliderSmoothnessDistance;
KisDoubleSliderSpinBox *m_sliderTailAggressiveness;
QCheckBox *m_chkSmoothPressure;
QCheckBox *m_chkUseScalableDistance;
QCheckBox *m_chkStabilizeSensors;
QCheckBox *m_chkDelayDistance;
KisDoubleSliderSpinBox *m_sliderDelayDistance;
QCheckBox *m_chkFinishStabilizedCurve;
QSignalMapper m_signalMapper;
};
class KisToolBrushFactory : public KoToolFactoryBase
{
public:
KisToolBrushFactory()
: KoToolFactoryBase("KritaShape/KisToolBrush") {
setToolTip(i18n("Freehand Brush Tool"));
// Temporarily
setSection(TOOL_TYPE_SHAPE);
setIconName(koIconNameCStr("krita_tool_freehand"));
setShortcut(QKeySequence(Qt::Key_B));
setPriority(0);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolBrushFactory() {}
+ ~KisToolBrushFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolBrush(canvas);
}
};
#endif // KIS_TOOL_BRUSH_H_
diff --git a/plugins/tools/basictools/kis_tool_colorpicker.h b/plugins/tools/basictools/kis_tool_colorpicker.h
index e95c16376c..0f00df9e96 100644
--- a/plugins/tools/basictools/kis_tool_colorpicker.h
+++ b/plugins/tools/basictools/kis_tool_colorpicker.h
@@ -1,147 +1,147 @@
/*
* Copyright (c) 1999 Matthias Elter <elter@kde.org>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_COLOR_PICKER_H_
#define KIS_TOOL_COLOR_PICKER_H_
#include <QList>
#include <QTimer>
#include "KoToolFactoryBase.h"
#include "ui_wdgcolorpicker.h"
#include "kis_tool.h"
#include <flake/kis_node_shape.h>
#include <KoIcon.h>
#include <kis_icon.h>
#include <QKeySequence>
class KoResource;
class KoColorSet;
namespace KisToolUtils {
struct ColorPickerConfig;
}
class ColorPickerOptionsWidget : public QWidget, public Ui::ColorPickerOptionsWidget
{
Q_OBJECT
public:
ColorPickerOptionsWidget(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class KisToolColorPicker : public KisTool
{
Q_OBJECT
Q_PROPERTY(bool toForeground READ toForeground WRITE setToForeground NOTIFY toForegroundChanged)
public:
KisToolColorPicker(KoCanvasBase* canvas);
- virtual ~KisToolColorPicker();
+ ~KisToolColorPicker() override;
public:
struct Configuration {
Configuration();
bool toForegroundColor;
bool updateColor;
bool addPalette;
bool normaliseValues;
bool sampleMerged;
int radius;
void save(ToolActivation activation) const;
void load(ToolActivation activation);
};
public:
- virtual QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
bool toForeground() const;
Q_SIGNALS:
void toForegroundChanged();
protected:
- void activate(ToolActivation activation, const QSet<KoShape*> &);
- void deactivate();
+ void activate(ToolActivation activation, const QSet<KoShape*> &) override;
+ void deactivate() override;
public Q_SLOTS:
void setToForeground(bool newValue);
void slotSetUpdateColor(bool);
void slotSetNormaliseValues(bool);
void slotSetAddPalette(bool);
void slotChangeRadius(int);
void slotAddPalette(KoResource* resource);
void slotSetColorSource(int value);
private:
void displayPickedColor();
void pickColor(const QPointF& pos);
void updateOptionWidget();
//Configuration m_config;
QScopedPointer<KisToolUtils::ColorPickerConfig> m_config;
ToolActivation m_toolActivationSource;
bool m_isActivated;
KoColor m_pickedColor;
// used to skip some of the tablet events and don't update the colour that often
QTimer m_colorPickerDelayTimer;
ColorPickerOptionsWidget *m_optionsWidget;
QList<KoColorSet*> m_palettes;
};
class KisToolColorPickerFactory : public KoToolFactoryBase
{
public:
KisToolColorPickerFactory()
: KoToolFactoryBase("KritaSelected/KisToolColorPicker") {
setToolTip(i18n("Color Selector Tool"));
setSection(TOOL_TYPE_FILL);
setPriority(2);
setIconName(koIconNameCStr("krita_tool_color_picker"));
setShortcut(QKeySequence(Qt::Key_P));
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolColorPickerFactory() {}
+ ~KisToolColorPickerFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolColorPicker(canvas);
}
};
#endif // KIS_TOOL_COLOR_PICKER_H_
diff --git a/plugins/tools/basictools/kis_tool_ellipse.h b/plugins/tools/basictools/kis_tool_ellipse.h
index faee4ed609..70c83f34cb 100644
--- a/plugins/tools/basictools/kis_tool_ellipse.h
+++ b/plugins/tools/basictools/kis_tool_ellipse.h
@@ -1,75 +1,75 @@
/*
* kis_tool_ellipse.h - part of Krayon
*
* Copyright (c) 2000 John Califf <jcaliff@compuzone.net>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_ELLIPSE_H__
#define __KIS_TOOL_ELLIPSE_H__
#include "kis_tool_shape.h"
#include "kis_types.h"
#include "KoToolFactoryBase.h"
#include "flake/kis_node_shape.h"
#include <kis_tool_ellipse_base.h>
#include <kis_icon.h>
class KoCanvasBase;
class KisToolEllipse : public KisToolEllipseBase
{
Q_OBJECT
public:
KisToolEllipse(KoCanvasBase * canvas);
- virtual ~KisToolEllipse();
+ ~KisToolEllipse() override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
protected:
- virtual void finishRect(const QRectF& rect);
+ void finishRect(const QRectF& rect) override;
};
class KisToolEllipseFactory : public KoToolFactoryBase
{
public:
KisToolEllipseFactory()
: KoToolFactoryBase("KritaShape/KisToolEllipse") {
setToolTip(i18n("Ellipse Tool"));
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("krita_tool_ellipse"));
setPriority(3);
}
- virtual ~KisToolEllipseFactory() {}
+ ~KisToolEllipseFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolEllipse(canvas);
}
};
#endif //__KIS_TOOL_ELLIPSE_H__
diff --git a/plugins/tools/basictools/kis_tool_fill.h b/plugins/tools/basictools/kis_tool_fill.h
index 62c96802d8..4c8b699d48 100644
--- a/plugins/tools/basictools/kis_tool_fill.h
+++ b/plugins/tools/basictools/kis_tool_fill.h
@@ -1,118 +1,118 @@
/*
* kis_tool_fill.h - part of Krayon^Krita
*
* Copyright (c) 2004 Bart Coppens <kde@bartcoppens.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_FILL_H_
#define KIS_TOOL_FILL_H_
#include "kis_tool_paint.h"
#include <flake/kis_node_shape.h>
#include <KoIcon.h>
#include <kis_icon.h>
#include <QPoint>
#include <kconfig.h>
#include <kconfiggroup.h>
class QWidget;
class QCheckBox;
class KisSliderSpinBox;
class KoCanvasBase;
class KisToolFill : public KisToolPaint
{
Q_OBJECT
public:
KisToolFill(KoCanvasBase * canvas);
- virtual ~KisToolFill();
+ ~KisToolFill() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- virtual QWidget * createOptionWidget();
+ QWidget * createOptionWidget() override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
void slotSetUseFastMode(bool);
void slotSetThreshold(int);
void slotSetUsePattern(bool);
void slotSetSampleMerged(bool);
void slotSetFillSelection(bool);
void slotSetSizemod(int);
void slotSetFeather(int);
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
protected:
- virtual bool wantsAutoScroll() const { return false; }
+ bool wantsAutoScroll() const override { return false; }
private:
void updateGUI();
private:
int m_feather;
int m_sizemod;
QPoint m_startPos;
int m_threshold;
bool m_unmerged;
bool m_usePattern;
bool m_fillOnlySelection;
QCheckBox *m_useFastMode;
KisSliderSpinBox *m_slThreshold;
KisSliderSpinBox *m_sizemodWidget;
KisSliderSpinBox *m_featherWidget;
QCheckBox *m_checkUsePattern;
QCheckBox *m_checkSampleMerged;
QCheckBox *m_checkFillSelection;
KConfigGroup m_configGroup;
};
#include "KoToolFactoryBase.h"
class KisToolFillFactory : public KoToolFactoryBase
{
public:
KisToolFillFactory()
: KoToolFactoryBase("KritaFill/KisToolFill") {
setToolTip(i18n("Fill Tool"));
setSection(TOOL_TYPE_FILL);
setPriority(0);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("krita_tool_color_fill"));
//setShortcut( QKeySequence( Qt::Key_F ) );
setPriority(14);
}
- virtual ~KisToolFillFactory() {}
+ ~KisToolFillFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolFill(canvas);
}
};
#endif //__filltool_h__
diff --git a/plugins/tools/basictools/kis_tool_gradient.h b/plugins/tools/basictools/kis_tool_gradient.h
index bbf0cbe726..ab68fd864d 100644
--- a/plugins/tools/basictools/kis_tool_gradient.h
+++ b/plugins/tools/basictools/kis_tool_gradient.h
@@ -1,131 +1,131 @@
/*
* kis_tool_line.h - part of Krayon
*
* Copyright (c) 2000 John Califf <jcaliff@comuzone.net>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Adrian Page <adrian@pagenet.plus.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_GRADIENT_H_
#define KIS_TOOL_GRADIENT_H_
#include <QKeySequence>
#include <KoToolFactoryBase.h>
#include <kis_tool_paint.h>
#include <kis_global.h>
#include <kis_types.h>
#include <kis_gradient_painter.h>
#include <flake/kis_node_shape.h>
#include <kis_icon.h>
#include <kconfig.h>
#include <kconfiggroup.h>
class QLabel;
class QPoint;
class QWidget;
class QCheckBox;
class KComboBox;
class KisDoubleSliderSpinBox;
class KisToolGradient : public KisToolPaint
{
Q_OBJECT
public:
KisToolGradient(KoCanvasBase * canvas);
- virtual ~KisToolGradient();
+ ~KisToolGradient() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
- QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
void slotSetShape(int);
void slotSetRepeat(int);
void slotSetReverse(bool);
void slotSetAntiAliasThreshold(qreal);
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
private Q_SLOTS:
void areaDone(const QRect & rc) {
currentNode()->setDirty(rc); // Starts computing the projection for the area we've done.
}
private:
void paintLine(QPainter& gc);
QPointF straightLine(QPointF point);
QPointF m_startPos;
QPointF m_endPos;
KisGradientPainter::enumGradientShape m_shape;
KisGradientPainter::enumGradientRepeat m_repeat;
bool m_reverse;
double m_antiAliasThreshold;
QLabel *m_lbShape;
QLabel *m_lbRepeat;
QCheckBox *m_ckReverse;
KComboBox *m_cmbShape;
KComboBox *m_cmbRepeat;
QLabel *m_lbAntiAliasThreshold;
KisDoubleSliderSpinBox *m_slAntiAliasThreshold;
KConfigGroup m_configGroup;
};
class KisToolGradientFactory : public KoToolFactoryBase
{
public:
KisToolGradientFactory()
: KoToolFactoryBase("KritaFill/KisToolGradient") {
setToolTip(i18n("Gradient Tool"));
setSection(TOOL_TYPE_FILL);
setIconName(koIconNameCStr("krita_tool_gradient"));
setShortcut(QKeySequence(Qt::Key_G));
setPriority(1);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolGradientFactory() {}
+ ~KisToolGradientFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolGradient(canvas);
}
};
#endif //KIS_TOOL_GRADIENT_H_
diff --git a/plugins/tools/basictools/kis_tool_line.h b/plugins/tools/basictools/kis_tool_line.h
index a4c8f4ae06..e9db2097f2 100644
--- a/plugins/tools/basictools/kis_tool_line.h
+++ b/plugins/tools/basictools/kis_tool_line.h
@@ -1,137 +1,137 @@
/*
* kis_tool_line.h - part of Krayon
*
* Copyright (c) 2000 John Califf <jcaliff@comuzone.net>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_LINE_H_
#define KIS_TOOL_LINE_H_
#include "kis_tool_shape.h"
#include <kconfig.h>
#include <kconfiggroup.h>
#include <QScopedPointer>
#include "kis_global.h"
#include "kis_types.h"
#include "KoToolFactoryBase.h"
#include "flake/kis_node_shape.h"
#include "kis_signal_compressor.h"
#include <kis_icon.h>
#include <KoIcon.h>
class QPoint;
class KoCanvasBase;
class QCheckBox;
class KisPaintingInformationBuilder;
class KisToolLineHelper;
class KisToolLine : public KisToolShape
{
Q_OBJECT
public:
KisToolLine(KoCanvasBase * canvas);
- virtual ~KisToolLine();
+ ~KisToolLine() override;
- void requestStrokeCancellation();
- void requestStrokeEnd();
+ void requestStrokeCancellation() override;
+ void requestStrokeEnd() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
- void activate(ToolActivation activation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
+ void activate(ToolActivation activation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
- virtual int flags() const;
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ int flags() const override;
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- virtual QString quickHelp() const;
+ QString quickHelp() const override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
private Q_SLOTS:
void updateStroke();
void setUseSensors(bool value);
void setShowPreview(bool value);
void setShowGuideline(bool value);
private:
void paintLine(QPainter& gc, const QRect& rc);
QPointF straightLine(QPointF point);
void updateGuideline();
void updatePreviewTimer(bool showGuide);
- virtual QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
void endStroke();
void cancelStroke();
private:
bool m_showGuideline;
QPointF m_startPoint;
QPointF m_endPoint;
QPointF m_lastUpdatedPoint;
bool m_strokeIsRunning;
QCheckBox *m_chkUseSensors;
QCheckBox *m_chkShowPreview;
QCheckBox *m_chkShowGuideline;
QScopedPointer<KisPaintingInformationBuilder> m_infoBuilder;
QScopedPointer<KisToolLineHelper> m_helper;
KisSignalCompressor m_strokeUpdateCompressor;
KisSignalCompressor m_longStrokeUpdateCompressor;
KConfigGroup configGroup;
};
class KisToolLineFactory : public KoToolFactoryBase
{
public:
KisToolLineFactory()
: KoToolFactoryBase("KritaShape/KisToolLine") {
setToolTip(i18n("Line Tool"));
// Temporarily
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setPriority(1);
setIconName(koIconNameCStr("krita_tool_line"));
}
- virtual ~KisToolLineFactory() {}
+ ~KisToolLineFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolLine(canvas);
}
};
#endif //KIS_TOOL_LINE_H_
diff --git a/plugins/tools/basictools/kis_tool_line_helper.h b/plugins/tools/basictools/kis_tool_line_helper.h
index 581bffbf02..4fbb62913d 100644
--- a/plugins/tools/basictools/kis_tool_line_helper.h
+++ b/plugins/tools/basictools/kis_tool_line_helper.h
@@ -1,56 +1,56 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_LINE_HELPER_H
#define __KIS_TOOL_LINE_HELPER_H
#include "kis_tool_freehand_helper.h"
class KisToolLineHelper : private KisToolFreehandHelper
{
public:
KisToolLineHelper(KisPaintingInformationBuilder *infoBuilder,
const KUndo2MagicString &transactionText,
KisRecordingAdapter *recordingAdapter = 0);
- ~KisToolLineHelper();
+ ~KisToolLineHelper() override;
void setEnabled(bool value);
void setUseSensors(bool value);
void repaintLine(KoCanvasResourceManager *resourceManager,
KisImageWSP image,
KisNodeSP node,
KisStrokesFacade *strokesFacade);
void start(KoPointerEvent *event, KoCanvasResourceManager *resourceManager);
void addPoint(KoPointerEvent *event, const QPointF &overridePos = QPointF());
void translatePoints(const QPointF &offset);
void end();
void cancel();
void clearPaint();
using KisToolFreehandHelper::isRunning;
private:
struct Private;
Private * const m_d;
};
#endif /* __KIS_TOOL_LINE_HELPER_H */
diff --git a/plugins/tools/basictools/kis_tool_measure.h b/plugins/tools/basictools/kis_tool_measure.h
index cee6009e74..0f3b695460 100644
--- a/plugins/tools/basictools/kis_tool_measure.h
+++ b/plugins/tools/basictools/kis_tool_measure.h
@@ -1,129 +1,129 @@
/*
*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_MEASURE_H_
#define KIS_TOOL_MEASURE_H_
#include <QLabel>
#include <KoUnit.h>
#include "kis_tool.h"
#include "kis_global.h"
#include "kis_types.h"
#include "KoToolFactoryBase.h"
#include "flake/kis_node_shape.h"
#include <kis_icon.h>
class QPointF;
class QWidget;
class KoCanvasBase;
class KisToolMeasureOptionsWidget : public QWidget
{
Q_OBJECT
public:
KisToolMeasureOptionsWidget(QWidget* parent, double resolution);
public Q_SLOTS:
void slotSetDistance(double distance);
void slotSetAngle(double angle);
void slotUnitChanged(int index);
private:
void updateDistance();
double m_resolution;
QLabel* m_distanceLabel;
QLabel* m_angleLabel;
double m_distance;
KoUnit m_unit;
};
class KisToolMeasure : public KisTool
{
Q_OBJECT
public:
KisToolMeasure(KoCanvasBase * canvas);
- virtual ~KisToolMeasure();
+ ~KisToolMeasure() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- QWidget * createOptionWidget();
+ QWidget * createOptionWidget() override;
Q_SIGNALS:
void sigDistanceChanged(double distance);
void sigAngleChanged(double angle);
private:
QRectF boundingRect();
double angle();
double distance();
double deltaX() {
return m_endPos.x() - m_startPos.x();
}
double deltaY() {
return m_startPos.y() - m_endPos.y();
}
private:
KisToolMeasureOptionsWidget *m_optionsWidget;
QPointF m_startPos;
QPointF m_endPos;
};
class KisToolMeasureFactory : public KoToolFactoryBase
{
public:
KisToolMeasureFactory()
: KoToolFactoryBase("KritaShape/KisToolMeasure") {
setSection(TOOL_TYPE_VIEW);
setToolTip(i18n("Measure Tool"));
setIconName(koIconNameCStr("krita_tool_measure"));
setPriority(1);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolMeasureFactory() {}
+ ~KisToolMeasureFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolMeasure(canvas);
}
};
#endif //KIS_TOOL_MEASURE_H_
diff --git a/plugins/tools/basictools/kis_tool_move.h b/plugins/tools/basictools/kis_tool_move.h
index 2b54c7f143..36e4652e64 100644
--- a/plugins/tools/basictools/kis_tool_move.h
+++ b/plugins/tools/basictools/kis_tool_move.h
@@ -1,160 +1,160 @@
/*
* Copyright (c) 1999 Matthias Elter <me@kde.org>
* 1999 Michael Koch <koch@kde.org>
* 2003 Patrick Julien <freak@codepimps.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_MOVE_H_
#define KIS_TOOL_MOVE_H_
#include <KoToolFactoryBase.h>
#include <kis_types.h>
#include <kis_tool.h>
#include <flake/kis_node_shape.h>
#include <kis_icon.h>
#include <QKeySequence>
#include <QWidget>
#include <QGroupBox>
#include <QRadioButton>
class KoCanvasBase;
class MoveToolOptionsWidget;
class KisDocument;
class KisToolMove : public KisTool
{
Q_OBJECT
Q_ENUMS(MoveToolMode);
Q_PROPERTY(bool moveInProgress READ moveInProgress NOTIFY moveInProgressChanged);
public:
KisToolMove(KoCanvasBase * canvas);
- virtual ~KisToolMove();
+ ~KisToolMove() override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
public Q_SLOTS:
- void requestStrokeEnd();
- void requestStrokeCancellation();
+ void requestStrokeEnd() override;
+ void requestStrokeCancellation() override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
public:
enum MoveToolMode {
MoveSelectedLayer,
MoveFirstLayer,
MoveGroup
};
enum MoveDirection {
Up,
Down,
Left,
Right
};
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
- void continueAlternateAction(KoPointerEvent *event, AlternateAction action);
- void endAlternateAction(KoPointerEvent *event, AlternateAction action);
+ void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void endAlternateAction(KoPointerEvent *event, AlternateAction action) override;
void startAction(KoPointerEvent *event, MoveToolMode mode);
void continueAction(KoPointerEvent *event);
void endAction(KoPointerEvent *event);
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- virtual QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
void updateUIUnit(int newUnit);
MoveToolMode moveToolMode() const;
bool moveInProgress() const;
void setShowCoordinates(bool value);
public Q_SLOTS:
void moveDiscrete(MoveDirection direction, bool big);
void moveBySpinX(int newX);
void moveBySpinY(int newY);
void slotNodeChanged(KisNodeList nodes);
Q_SIGNALS:
void moveToolModeChanged();
void moveInProgressChanged();
void moveInNewPosition(QPoint);
private:
void drag(const QPoint& newPos);
void cancelStroke();
QPoint applyModifiers(Qt::KeyboardModifiers modifiers, QPoint pos);
bool startStrokeImpl(MoveToolMode mode, const QPoint *pos);
private Q_SLOTS:
void endStroke();
private:
MoveToolOptionsWidget* m_optionsWidget;
QPoint m_dragStart; ///< Point where current cursor dragging began
QPoint m_accumulatedOffset; ///< Total offset including multiple clicks, up/down/left/right keys, etc. added together
QPoint m_startPosition;
KisStrokeId m_strokeId;
bool m_moveInProgress;
KisNodeList m_currentlyProcessingNodes;
int m_resolution;
QAction *m_showCoordinatesAction;
};
class KisToolMoveFactory : public KoToolFactoryBase
{
public:
KisToolMoveFactory()
: KoToolFactoryBase("KritaTransform/KisToolMove") {
setToolTip(i18n("Move Tool"));
setSection(TOOL_TYPE_TRANSFORM);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setPriority(3);
setIconName(koIconNameCStr("krita_tool_move"));
setShortcut(QKeySequence( Qt::Key_T));
}
- virtual ~KisToolMoveFactory() {}
+ ~KisToolMoveFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolMove(canvas);
}
};
#endif // KIS_TOOL_MOVE_H_
diff --git a/plugins/tools/basictools/kis_tool_multihand.h b/plugins/tools/basictools/kis_tool_multihand.h
index 01e76abd40..ed096bc726 100644
--- a/plugins/tools/basictools/kis_tool_multihand.h
+++ b/plugins/tools/basictools/kis_tool_multihand.h
@@ -1,120 +1,120 @@
/*
* Copyright (c) 2011 Lukáš Tvrdý <lukast.dev@gmail.com>
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_MULTIHAND_H
#define __KIS_TOOL_MULTIHAND_H
#include "kis_tool_brush.h"
#include <kis_icon.h>
#include "kis_tool_multihand_config.h"
class QPushButton;
class QCheckBox;
class QComboBox;
class QStackedWidget;
class KisSliderSpinBox;
class KisToolMultihandHelper;
class KisToolMultihand : public KisToolBrush
{
Q_OBJECT
public:
KisToolMultihand(KoCanvasBase *canvas);
- ~KisToolMultihand();
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ ~KisToolMultihand() override;
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
protected:
- void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
private:
void initTransformations();
void finishAxesSetup();
void updateCanvas();
private Q_SLOTS:
void activateAxesPointModeSetup();
void slotSetHandsCount(int count);
void slotSetAxesAngle(int angle);
void slotSetTransformMode(int qcomboboxIndex);
void slotSetAxesVisible(bool vis);
void slotSetMirrorVertically(bool mirror);
void slotSetMirrorHorizontally(bool mirror);
void slotSetTranslateRadius(int radius);
private:
KisToolMultihandHelper *m_helper;
enum enumTransforModes { SYMMETRY, MIRROR, TRANSLATE, SNOWFLAKE };
enumTransforModes m_transformMode;
QPointF m_axesPoint;
qreal m_angle;
int m_handsCount;
bool m_mirrorVertically;
bool m_mirrorHorizontally;
bool m_showAxes;
int m_translateRadius;
bool m_setupAxesFlag;
QComboBox * m_transformModesComboBox;
KisSliderSpinBox *m_handsCountSlider;
KisDoubleSliderSpinBox *m_axesAngleSlider;
QCheckBox *m_axesChCkBox;
QStackedWidget *m_modeCustomOption;
QCheckBox *m_mirrorVerticallyChCkBox;
QCheckBox *m_mirrorHorizontallyChCkBox;
KisSliderSpinBox *m_translateRadiusSlider;
QPushButton *m_axesPointBtn;
KisToolMultiHandConfigWidget* customUI;
};
class KisToolMultiBrushFactory : public KoToolFactoryBase
{
public:
KisToolMultiBrushFactory()
: KoToolFactoryBase("KritaShape/KisToolMultiBrush") {
setToolTip(i18n("Multibrush Tool"));
// Temporarily
setSection(TOOL_TYPE_SHAPE);
setIconName(koIconNameCStr("krita_tool_multihand"));
setShortcut(QKeySequence(Qt::Key_Q));
setPriority(11);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolMultiBrushFactory() {}
+ ~KisToolMultiBrushFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolMultihand(canvas);
}
};
#endif /* __KIS_TOOL_MULTIHAND_H */
diff --git a/plugins/tools/basictools/kis_tool_multihand_config.h b/plugins/tools/basictools/kis_tool_multihand_config.h
index a917c47100..e67e4cc293 100644
--- a/plugins/tools/basictools/kis_tool_multihand_config.h
+++ b/plugins/tools/basictools/kis_tool_multihand_config.h
@@ -1,44 +1,44 @@
/*
Copyright (C) 2016 Scott Petrovic <scottpetrovic@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef KISTOOLMULTIHANDCONFIG_H
#define KISTOOLMULTIHANDCONFIG_H
#include "ui_wdgmultihandtool.h"
class KisToolMultiHandConfigWidget : public QWidget, public Ui::WdgMultiHandTool
{
Q_OBJECT
public:
KisToolMultiHandConfigWidget(QWidget *parent=0);
- ~KisToolMultiHandConfigWidget();
+ ~KisToolMultiHandConfigWidget() override;
//Q_SIGNALS:
//public Q_SLOTS:
//void cropTypeSelectableChanged();
//private:
//KisToolCrop* m_cropTool;
};
#endif // KISTOOLMULTIHANDCONFIG_H
diff --git a/plugins/tools/basictools/kis_tool_path.h b/plugins/tools/basictools/kis_tool_path.h
index b337ac3977..a83d4e2d20 100644
--- a/plugins/tools/basictools/kis_tool_path.h
+++ b/plugins/tools/basictools/kis_tool_path.h
@@ -1,103 +1,103 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_PATH_H_
#define KIS_TOOL_PATH_H_
#include <KoCreatePathTool.h>
#include <KoToolFactoryBase.h>
#include "flake/kis_node_shape.h"
#include "kis_tool_shape.h"
#include "kis_delegated_tool.h"
#include <kis_icon.h>
class KoCanvasBase;
class KisToolPath;
class __KisToolPathLocalTool : public KoCreatePathTool {
public:
__KisToolPathLocalTool(KoCanvasBase * canvas, KisToolPath* parentTool);
- virtual void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter);
- virtual void addPathShape(KoPathShape* pathShape);
+ void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter) override;
+ void addPathShape(KoPathShape* pathShape) override;
using KoCreatePathTool::createOptionWidgets;
using KoCreatePathTool::endPathWithoutLastPoint;
using KoCreatePathTool::endPath;
using KoCreatePathTool::cancelPath;
using KoCreatePathTool::removeLastPoint;
private:
KisToolPath* const m_parentTool;
};
typedef KisDelegatedTool<KisToolShape,
__KisToolPathLocalTool,
DeselectShapesActivationPolicy> DelegatedPathTool;
class KisToolPath : public DelegatedPathTool
{
Q_OBJECT
public:
KisToolPath(KoCanvasBase * canvas);
- void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
- virtual QList< QPointer<QWidget> > createOptionWidgets();
+ QList< QPointer<QWidget> > createOptionWidgets() override;
- bool eventFilter(QObject *obj, QEvent *event);
- void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
- void continueAlternateAction(KoPointerEvent *event, AlternateAction action);
- void endAlternateAction(KoPointerEvent *event, AlternateAction action);
+ bool eventFilter(QObject *obj, QEvent *event) override;
+ void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void endAlternateAction(KoPointerEvent *event, AlternateAction action) override;
protected:
- void requestStrokeCancellation();
- void requestStrokeEnd();
+ void requestStrokeCancellation() override;
+ void requestStrokeEnd() override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
private:
friend class __KisToolPathLocalTool;
};
class KisToolPathFactory : public KoToolFactoryBase
{
public:
KisToolPathFactory()
: KoToolFactoryBase("KisToolPath") {
setToolTip(i18n("Bezier Curve Tool: Shift-mouseclick ends the curve."));
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("krita_draw_path"));
setPriority(7);
}
- virtual ~KisToolPathFactory() {}
+ ~KisToolPathFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolPath(canvas);
}
};
#endif // KIS_TOOL_PATH_H_
diff --git a/plugins/tools/basictools/kis_tool_pencil.h b/plugins/tools/basictools/kis_tool_pencil.h
index 9dffcfe30f..409671be96 100644
--- a/plugins/tools/basictools/kis_tool_pencil.h
+++ b/plugins/tools/basictools/kis_tool_pencil.h
@@ -1,96 +1,96 @@
/*
* Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_PENCIL_H_
#define KIS_TOOL_PENCIL_H_
#include <KoPencilTool.h>
#include <KoToolFactoryBase.h>
#include "flake/kis_node_shape.h"
#include "kis_tool_shape.h"
#include "kis_delegated_tool.h"
#include <kis_icon.h>
class KoCanvasBase;
class KisToolPencil;
class __KisToolPencilLocalTool : public KoPencilTool {
public:
__KisToolPencilLocalTool(KoCanvasBase * canvas, KisToolPencil* parentTool);
virtual void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter);
- virtual void addPathShape(KoPathShape* pathShape, bool closePath);
+ void addPathShape(KoPathShape* pathShape, bool closePath) override;
using KoPencilTool::createOptionWidgets;
protected:
void slotUpdatePencilCursor() override;
private:
KisToolPencil* const m_parentTool;
};
typedef KisDelegatedTool<KisToolShape,
__KisToolPencilLocalTool,
DeselectShapesActivationPolicy> DelegatedPencilTool;
class KisToolPencil : public DelegatedPencilTool
{
Q_OBJECT
public:
KisToolPencil(KoCanvasBase * canvas);
- void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
protected Q_SLOTS:
void resetCursorStyle() override;
private:
void updatePencilCursor(bool value);
private:
friend class __KisToolPencilLocalTool;
};
class KisToolPencilFactory : public KoToolFactoryBase
{
public:
KisToolPencilFactory()
: KoToolFactoryBase("KisToolPencil") {
setToolTip(i18n("Freehand Path Tool"));
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("krita_tool_freehandvector"));
setPriority(9);
}
- virtual ~KisToolPencilFactory() {}
+ ~KisToolPencilFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolPencil(canvas);
}
};
#endif // KIS_TOOL_PENCIL_H_
diff --git a/plugins/tools/basictools/kis_tool_rectangle.h b/plugins/tools/basictools/kis_tool_rectangle.h
index 3e5933b8b0..754483cd63 100644
--- a/plugins/tools/basictools/kis_tool_rectangle.h
+++ b/plugins/tools/basictools/kis_tool_rectangle.h
@@ -1,79 +1,79 @@
/*
* kis_tool_rectangle.h - part of KImageShop^WKrayon^WKrita
*
* Copyright (c) 1999 Michael Koch <koch@kde.org>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2004 Clarence Dang <dang@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_RECTANGLE_H__
#define __KIS_TOOL_RECTANGLE_H__
#include "kis_tool_shape.h"
#include "kis_types.h"
#include "KoToolFactoryBase.h"
#include "flake/kis_node_shape.h"
#include <kis_tool_rectangle_base.h>
#include <kis_icon.h>
class QRect;
class KoCanvasBase;
class KisToolRectangle : public KisToolRectangleBase
{
Q_OBJECT
public:
KisToolRectangle(KoCanvasBase * canvas);
- virtual ~KisToolRectangle();
+ ~KisToolRectangle() override;
protected:
- virtual void finishRect(const QRectF& rect);
+ void finishRect(const QRectF& rect) override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
};
class KisToolRectangleFactory : public KoToolFactoryBase
{
public:
KisToolRectangleFactory()
: KoToolFactoryBase("KritaShape/KisToolRectangle") {
setToolTip(i18n("Rectangle Tool"));
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("krita_tool_rectangle"));
//setShortcut( Qt::Key_F6 );
setPriority(2);
}
- virtual ~KisToolRectangleFactory() {}
+ ~KisToolRectangleFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolRectangle(canvas);
}
};
#endif // __KIS_TOOL_RECTANGLE_H__
diff --git a/plugins/tools/basictools/strokes/move_selection_stroke_strategy.h b/plugins/tools/basictools/strokes/move_selection_stroke_strategy.h
index 6d44fe0e56..782757169b 100644
--- a/plugins/tools/basictools/strokes/move_selection_stroke_strategy.h
+++ b/plugins/tools/basictools/strokes/move_selection_stroke_strategy.h
@@ -1,55 +1,55 @@
/*
* Copyright (c) 2012 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __MOVE_SELECTION_STROKE_STRATEGY_H
#define __MOVE_SELECTION_STROKE_STRATEGY_H
#include "kis_stroke_strategy_undo_command_based.h"
#include "kis_types.h"
class KisPostExecutionUndoAdapter;
class KisUpdatesFacade;
class MoveSelectionStrokeStrategy : public KisStrokeStrategyUndoCommandBased
{
public:
MoveSelectionStrokeStrategy(KisPaintLayerSP paintLayer,
KisSelectionSP selection,
KisUpdatesFacade *updatesFacade,
KisStrokeUndoFacade *undoFacade);
- void initStrokeCallback();
- void finishStrokeCallback();
- void cancelStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
+ void initStrokeCallback() override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
private:
MoveSelectionStrokeStrategy(const MoveSelectionStrokeStrategy &rhs);
- KisStrokeStrategy* createLodClone(int levelOfDetail);
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
private:
KisPaintLayerSP m_paintLayer;
KisSelectionSP m_selection;
KisUpdatesFacade *m_updatesFacade;
QPoint m_finalOffset;
QPoint m_initialDeviceOffset;
};
#endif /* __MOVE_SELECTION_STROKE_STRATEGY_H */
diff --git a/plugins/tools/basictools/strokes/move_stroke_strategy.h b/plugins/tools/basictools/strokes/move_stroke_strategy.h
index d91035c052..e7f31d3fe1 100644
--- a/plugins/tools/basictools/strokes/move_stroke_strategy.h
+++ b/plugins/tools/basictools/strokes/move_stroke_strategy.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2011 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __MOVE_STROKE_STRATEGY_H
#define __MOVE_STROKE_STRATEGY_H
#include <QHash>
#include "kis_stroke_strategy_undo_command_based.h"
#include "kis_types.h"
#include "kis_lod_transform.h"
class KisUpdatesFacade;
class KisPostExecutionUndoAdapter;
class MoveStrokeStrategy : public KisStrokeStrategyUndoCommandBased
{
public:
class Data : public KisStrokeJobData {
public:
Data(QPoint _offset)
: KisStrokeJobData(SEQUENTIAL, EXCLUSIVE),
offset(_offset)
{
}
- KisStrokeJobData* createLodClone(int levelOfDetail) {
+ KisStrokeJobData* createLodClone(int levelOfDetail) override {
return new Data(*this, levelOfDetail);
}
QPoint offset;
private:
Data(const Data &rhs, int levelOfDetail)
: KisStrokeJobData(rhs)
{
KisLodTransform t(levelOfDetail);
offset = t.map(rhs.offset);
}
};
public:
MoveStrokeStrategy(KisNodeList nodes, KisUpdatesFacade *updatesFacade,
KisStrokeUndoFacade *undoFacade);
- void initStrokeCallback();
- void finishStrokeCallback();
- void cancelStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
+ void initStrokeCallback() override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
- KisStrokeStrategy* createLodClone(int levelOfDetail);
+ KisStrokeStrategy* createLodClone(int levelOfDetail) override;
private:
MoveStrokeStrategy(const MoveStrokeStrategy &rhs);
void setUndoEnabled(bool value);
void setUpdatesEnabled(bool value);
private:
void moveAndUpdate(QPoint offset);
QRect moveNode(KisNodeSP node, QPoint offset);
void addMoveCommands(KisNodeSP node, KUndo2Command *parent);
void saveInitialNodeOffsets(KisNodeSP node);
private:
KisNodeList m_nodes;
QSet<KisNodeSP> m_blacklistedNodes;
KisUpdatesFacade *m_updatesFacade;
QPoint m_finalOffset;
QRect m_dirtyRect;
QHash<KisNodeSP, QRect> m_dirtyRects;
bool m_updatesEnabled;
QHash<KisNodeSP, QPoint> m_initialNodeOffsets;
};
#endif /* __MOVE_STROKE_STRATEGY_H */
diff --git a/plugins/tools/defaulttool/Plugin.h b/plugins/tools/defaulttool/Plugin.h
index 285b5b1239..9a6caf8410 100644
--- a/plugins/tools/defaulttool/Plugin.h
+++ b/plugins/tools/defaulttool/Plugin.h
@@ -1,33 +1,33 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef PLUGIN_H
#define PLUGIN_H
#include <QObject>
#include <QVariantList>
class Plugin : public QObject
{
Q_OBJECT
public:
Plugin(QObject *parent, const QVariantList &);
- ~Plugin() {}
+ ~Plugin() override {}
};
#endif
diff --git a/plugins/tools/defaulttool/connectionTool/AddConnectionPointCommand.h b/plugins/tools/defaulttool/connectionTool/AddConnectionPointCommand.h
index 6dff437a23..5d518d3053 100644
--- a/plugins/tools/defaulttool/connectionTool/AddConnectionPointCommand.h
+++ b/plugins/tools/defaulttool/connectionTool/AddConnectionPointCommand.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef ADDCONNECTIONPOINTCOMMAND_H
#define ADDCONNECTIONPOINTCOMMAND_H
#include <kundo2command.h>
#include <QPointF>
class KoShape;
class AddConnectionPointCommand : public KUndo2Command
{
public:
/// Creates new comand to add connection point to shape
AddConnectionPointCommand(KoShape *shape, const QPointF &connectionPoint, KUndo2Command *parent = 0);
- virtual ~AddConnectionPointCommand();
+ ~AddConnectionPointCommand() override;
/// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
/// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
private:
void updateRoi();
KoShape *m_shape;
QPointF m_connectionPoint;
int m_connectionPointId;
};
#endif // ADDCONNECTIONPOINTCOMMAND_H
diff --git a/plugins/tools/defaulttool/connectionTool/ChangeConnectionPointCommand.h b/plugins/tools/defaulttool/connectionTool/ChangeConnectionPointCommand.h
index 661ca1d412..fe344107d2 100644
--- a/plugins/tools/defaulttool/connectionTool/ChangeConnectionPointCommand.h
+++ b/plugins/tools/defaulttool/connectionTool/ChangeConnectionPointCommand.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CHANGECONNECTIONPOINTCOMMAND_H
#define CHANGECONNECTIONPOINTCOMMAND_H
#include <KoConnectionPoint.h>
#include <kundo2command.h>
#include <QPointF>
class KoShape;
class ChangeConnectionPointCommand : public KUndo2Command
{
public:
/// Creates new comand to change connection point of shape
ChangeConnectionPointCommand(KoShape *shape, int connectionPointId, const KoConnectionPoint &oldPoint, const KoConnectionPoint &newPoint, KUndo2Command *parent = 0);
- virtual ~ChangeConnectionPointCommand();
+ ~ChangeConnectionPointCommand() override;
/// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
/// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
private:
void updateRoi(const QPointF &position);
KoShape *m_shape;
int m_connectionPointId;
KoConnectionPoint m_oldPoint;
KoConnectionPoint m_newPoint;
};
#endif // CHANGECONNECTIONPOINTCOMMAND_H
diff --git a/plugins/tools/defaulttool/connectionTool/ConnectionTool.h b/plugins/tools/defaulttool/connectionTool/ConnectionTool.h
index 2638700131..13c12ef320 100644
--- a/plugins/tools/defaulttool/connectionTool/ConnectionTool.h
+++ b/plugins/tools/defaulttool/connectionTool/ConnectionTool.h
@@ -1,171 +1,171 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KO_CONNECTION_TOOL_H
#define KO_CONNECTION_TOOL_H
#define ConnectionTool_ID "ConnectionTool"
#include <KoToolBase.h>
#include <KoCanvasBase.h>
#include <KoSnapGuide.h>
#include <KoConnectionShape.h>
#include <QCursor>
class QAction;
class QActionGroup;
class KoShapeConfigWidgetBase;
class KoInteractionStrategy;
class ConnectionTool : public KoToolBase
{
Q_OBJECT
public:
/**
* @brief Constructor
*/
explicit ConnectionTool(KoCanvasBase *canvas);
/**
* @brief Destructor
*/
- ~ConnectionTool();
+ ~ConnectionTool() override;
/// reimplemented from superclass
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/// reimplemented from superclass
- virtual void repaintDecorations();
+ void repaintDecorations() override;
/// reimplemented from superclass
- virtual void mousePressEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseReleaseEvent(KoPointerEvent *event);
+ void mouseReleaseEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void mouseDoubleClickEvent(KoPointerEvent *event);
+ void mouseDoubleClickEvent(KoPointerEvent *event) override;
/// reimplemented from superclass
- virtual void keyPressEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
/// reimplemented from superclass
- virtual void activate(ToolActivation activation, const QSet<KoShape *> &shapes);
+ void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
/// reimplemented from superclass
- virtual void deactivate();
+ void deactivate() override;
/// reimplemented from superclass
- virtual void deleteSelection();
+ void deleteSelection() override;
Q_SIGNALS:
void connectionPointEnabled(bool enabled);
void sendConnectionType(int type);
void sendConnectionPointEditState(bool enabled);
public Q_SLOTS:
void toggleConnectionPointEditMode(int state);
private Q_SLOTS:
void horizontalAlignChanged();
void verticalAlignChanged();
void relativeAlignChanged();
void escapeDirectionChanged();
void connectionChanged();
void getConnectionType(int type);
private:
/// reimplemented from superclass
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
/**
* @brief Return the square of the absolute distance between p1 and p2
*
* @param p1 The first point
* @param p2 The second point
* @return The float which is the square of the distance
*/
qreal squareDistance(const QPointF &p1, const QPointF &p2) const;
/// Returns nearest connection handle or nearest connection point id of shape
int handleAtPoint(KoShape *shape, const QPointF &mousePoint) const;
enum EditMode {
Idle, ///< in idle mode we can only start a connector creation, manipulation to existing connectors and connection points not allowed
CreateConnection, ///< we are creating a new connection
EditConnection, ///< we are editing a connection
EditConnectionPoint ///< we are editing connection points
};
/// Sets the edit mode, current shape and active handle
void setEditMode(EditMode mode, KoShape *currentShape, int handle);
/// Resets the current edit mode to Idle, standard connector type
void resetEditMode();
/// Returns the nearest connection shape within handle grab sensitiviy distance
KoConnectionShape *nearestConnectionShape(const QList<KoShape *> &shapes, const QPointF &mousePos) const;
/// Updates status text depending on edit mode
void updateStatusText();
/// Updates current shape and edit mode dependent on position
KoShape *findShapeAtPosition(const QPointF &position) const;
/// Updates current shape and edit mode dependent on position excluding connection shapes
KoShape *findNonConnectionShapeAtPosition(const QPointF &position) const;
/// Updates actions
void updateActions();
/// Updates currently selected connection point
void updateConnectionPoint();
EditMode m_editMode; ///< the current edit mode
KoConnectionShape::Type m_connectionType;
KoShape *m_currentShape; ///< the current shape we are working on
int m_activeHandle; ///< the currently active connection point/connection handle
KoInteractionStrategy *m_currentStrategy; ///< the current editing strategy
KoSnapGuide::Strategies m_oldSnapStrategies; ///< the previously enables snap strategies
bool m_resetPaint; ///< whether in initial paint mode
QCursor m_connectCursor;
QActionGroup *m_alignVertical;
QActionGroup *m_alignHorizontal;
QActionGroup *m_alignRelative;
QActionGroup *m_escapeDirections;
QAction *m_editConnectionPoint;
QAction *m_alignPercent;
QAction *m_alignLeft;
QAction *m_alignCenterH;
QAction *m_alignRight;
QAction *m_alignTop;
QAction *m_alignCenterV;
QAction *m_alignBottom;
QAction *m_escapeAll;
QAction *m_escapeHorizontal;
QAction *m_escapeVertical;
QAction *m_escapeUp;
QAction *m_escapeLeft;
QAction *m_escapeDown;
QAction *m_escapeRight;
QList<KoShapeConfigWidgetBase *> m_connectionShapeWidgets;
};
#endif // KO_CONNECTION_TOOL_H
diff --git a/plugins/tools/defaulttool/connectionTool/ConnectionToolFactory.h b/plugins/tools/defaulttool/connectionTool/ConnectionToolFactory.h
index fbf055ba3b..213d8b7832 100644
--- a/plugins/tools/defaulttool/connectionTool/ConnectionToolFactory.h
+++ b/plugins/tools/defaulttool/connectionTool/ConnectionToolFactory.h
@@ -1,38 +1,38 @@
/* This file is part of the KDE project
*
* Copyright (C) 2009 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CONNECTIONTOOLFACTORY_H
#define CONNECTIONTOOLFACTORY_H
#include "KoToolFactoryBase.h"
/// The factory for the ConnectionTool
class ConnectionToolFactory : public KoToolFactoryBase
{
public:
/// Constructor
ConnectionToolFactory();
/// Destructor
- ~ConnectionToolFactory();
+ ~ConnectionToolFactory() override;
/// reimplemented
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/plugins/tools/defaulttool/connectionTool/MoveConnectionPointStrategy.h b/plugins/tools/defaulttool/connectionTool/MoveConnectionPointStrategy.h
index e98c903e47..d77859c705 100644
--- a/plugins/tools/defaulttool/connectionTool/MoveConnectionPointStrategy.h
+++ b/plugins/tools/defaulttool/connectionTool/MoveConnectionPointStrategy.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MOVECONNECTIONPOINTSTRATEGY_H
#define MOVECONNECTIONPOINTSTRATEGY_H
#include <KoInteractionStrategy.h>
#include <KoConnectionPoint.h>
#include <QPointF>
class KoShape;
class MoveConnectionPointStrategy : public KoInteractionStrategy
{
public:
/// Constructor
MoveConnectionPointStrategy(KoShape *shape, int connectionPointId, KoToolBase *parent);
/// Destructor
- virtual ~MoveConnectionPointStrategy();
+ ~MoveConnectionPointStrategy() override;
/// reimplemented from KoInteractionStrategy
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/// reimplemented from KoInteractionStrategy
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
/// reimplemented from KoInteractionStrategy
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
/// reimplemented from KoInteractionStrategy
- virtual void cancelInteraction();
+ void cancelInteraction() override;
/// reimplemented from KoInteractionStrategy
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
private:
KoShape *m_shape;
int m_connectionPointId;
KoConnectionPoint m_oldPoint;
KoConnectionPoint m_newPoint;
};
#endif // MOVECONNECTIONPOINTSTRATEGY_H
diff --git a/plugins/tools/defaulttool/connectionTool/RemoveConnectionPointCommand.h b/plugins/tools/defaulttool/connectionTool/RemoveConnectionPointCommand.h
index ea26140002..e87e5c9386 100644
--- a/plugins/tools/defaulttool/connectionTool/RemoveConnectionPointCommand.h
+++ b/plugins/tools/defaulttool/connectionTool/RemoveConnectionPointCommand.h
@@ -1,49 +1,49 @@
/* This file is part of the KDE project
*
* Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef REMOVECONNECTIONPOINTCOMMAND_H
#define REMOVECONNECTIONPOINTCOMMAND_H
#include <KoConnectionPoint.h>
#include <kundo2command.h>
#include <QPointF>
class KoShape;
class RemoveConnectionPointCommand : public KUndo2Command
{
public:
/// Creates new comand to remove connection point from shape
RemoveConnectionPointCommand(KoShape *shape, int connectionPointId, KUndo2Command *parent = 0);
- virtual ~RemoveConnectionPointCommand();
+ ~RemoveConnectionPointCommand() override;
/// reimplemented from KUndo2Command
- virtual void redo();
+ void redo() override;
/// reimplemented from KUndo2Command
- virtual void undo();
+ void undo() override;
private:
void updateRoi();
KoShape *m_shape;
KoConnectionPoint m_connectionPoint;
int m_connectionPointId;
};
#endif // REMOVECONNECTIONPOINTCOMMAND_H
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp b/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp
index 8ab9b97f32..b7cdcbef48 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp
+++ b/plugins/tools/defaulttool/defaulttool/DefaultTool.cpp
@@ -1,1349 +1,1349 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
Copyright (C) 2008-2009 Jan Hambrecht <jaham@gmx.net>
Copyright (C) 2008 C. Boemann <cbo@boemann.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "DefaultTool.h"
#include "DefaultToolGeometryWidget.h"
#include "DefaultToolTabbedWidget.h"
#include "SelectionDecorator.h"
#include "ShapeMoveStrategy.h"
#include "ShapeRotateStrategy.h"
#include "ShapeShearStrategy.h"
#include "ShapeResizeStrategy.h"
#include <KoPointerEvent.h>
#include <KoToolSelection.h>
#include <KoToolManager.h>
#include <KoSelection.h>
#include <KoShapeController.h>
#include <KoShapeManager.h>
#include <KoSelectedShapesProxy.h>
#include <KoShapeGroup.h>
#include <KoShapeLayer.h>
#include <KoShapeOdfSaveHelper.h>
#include <KoDrag.h>
#include <KoCanvasBase.h>
#include <KoCanvasResourceManager.h>
#include <KoShapeRubberSelectStrategy.h>
#include <commands/KoShapeMoveCommand.h>
#include <commands/KoShapeDeleteCommand.h>
#include <commands/KoShapeCreateCommand.h>
#include <commands/KoShapeGroupCommand.h>
#include <commands/KoShapeUngroupCommand.h>
#include <commands/KoShapeDistributeCommand.h>
#include <KoSnapGuide.h>
#include <KoStrokeConfigWidget.h>
#include "kis_action_registry.h"
#include <KoInteractionStrategyFactory.h>
#include "kis_document_aware_spin_box_unit_manager.h"
#include <KoIcon.h>
#include <QPointer>
#include <QAction>
#include <QKeyEvent>
#include <QSignalMapper>
#include <KoResourcePaths.h>
#include <KoCanvasController.h>
#include <kactioncollection.h>
#include <QMenu>
#include <math.h>
#include "kis_assert.h"
#include "kis_global.h"
#include "kis_debug.h"
#include <QVector2D>
#define HANDLE_DISTANCE 10
#define HANDLE_DISTANCE_SQ (HANDLE_DISTANCE * HANDLE_DISTANCE)
#define INNER_HANDLE_DISTANCE_SQ 16
namespace {
static const QString EditFillGradientFactoryId = "edit_fill_gradient";
static const QString EditStrokeGradientFactoryId = "edit_stroke_gradient";
}
QPolygonF selectionPolygon(KoSelection *selection)
{
QPolygonF result;
QList<KoShape*> selectedShapes = selection->selectedShapes();
if (!selectedShapes.size()) {
return result;
}
if (selectedShapes.size() > 1) {
QTransform matrix = selection->absoluteTransformation(0);
result = matrix.map(QPolygonF(QRectF(QPointF(0, 0), selection->size())));
} else {
KoShape *selectedShape = selectedShapes.first();
QTransform matrix = selectedShape->absoluteTransformation(0);
result = matrix.map(QPolygonF(QRectF(QPointF(0, 0), selectedShape->size())));
}
return result;
}
class NopInteractionStrategy : public KoInteractionStrategy
{
public:
explicit NopInteractionStrategy(KoToolBase *parent)
: KoInteractionStrategy(parent)
{
}
KUndo2Command *createCommand() override
{
return 0;
}
void handleMouseMove(const QPointF & /*mouseLocation*/, Qt::KeyboardModifiers /*modifiers*/) override {}
void finishInteraction(Qt::KeyboardModifiers /*modifiers*/) override {}
- void paint(QPainter &painter, const KoViewConverter &converter) {
+ void paint(QPainter &painter, const KoViewConverter &converter) override {
Q_UNUSED(painter);
Q_UNUSED(converter);
}
};
class SelectionInteractionStrategy : public KoShapeRubberSelectStrategy
{
public:
explicit SelectionInteractionStrategy(KoToolBase *parent, const QPointF &clicked, bool useSnapToGrid)
: KoShapeRubberSelectStrategy(parent, clicked, useSnapToGrid)
{
}
- void paint(QPainter &painter, const KoViewConverter &converter) {
+ void paint(QPainter &painter, const KoViewConverter &converter) override {
KoShapeRubberSelectStrategy::paint(painter, converter);
}
};
#include <KoGradientBackground.h>
#include "KoShapeGradientHandles.h"
#include "ShapeGradientEditStrategy.h"
class DefaultTool::MoveGradientHandleInteractionFactory : public KoInteractionStrategyFactory
{
public:
MoveGradientHandleInteractionFactory(KoFlake::FillVariant fillVariant,
int priority, const QString &id, DefaultTool *_q)
: KoInteractionStrategyFactory(priority, id),
q(_q),
m_fillVariant(fillVariant)
{
}
KoInteractionStrategy* createStrategy(KoPointerEvent *ev) override
{
m_currentHandle = handleAt(ev->point);
if (m_currentHandle.type != KoShapeGradientHandles::Handle::None) {
KoShape *shape = onlyEditableShape();
KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(shape, 0);
return new ShapeGradientEditStrategy(q, m_fillVariant, shape, m_currentHandle.type, ev->point);
}
return 0;
}
bool hoverEvent(KoPointerEvent *ev) override
{
m_currentHandle = handleAt(ev->point);
return false;
}
bool paintOnHover(QPainter &painter, const KoViewConverter &converter) override
{
Q_UNUSED(painter);
Q_UNUSED(converter);
return false;
}
- bool tryUseCustomCursor() {
+ bool tryUseCustomCursor() override {
if (m_currentHandle.type != KoShapeGradientHandles::Handle::None) {
q->useCursor(Qt::OpenHandCursor);
}
return m_currentHandle.type != KoShapeGradientHandles::Handle::None;
}
private:
KoShape* onlyEditableShape() const {
KoSelection *selection = q->koSelection();
QList<KoShape*> shapes = selection->selectedEditableShapes();
KoShape *shape = 0;
if (shapes.size() == 1) {
shape = shapes.first();
}
return shape;
}
KoShapeGradientHandles::Handle handleAt(const QPointF &pos) {
KoShapeGradientHandles::Handle result;
KoShape *shape = onlyEditableShape();
if (shape) {
KoFlake::SelectionHandle globalHandle = q->handleAt(pos);
const qreal distanceThresholdSq =
globalHandle == KoFlake::NoHandle ?
HANDLE_DISTANCE_SQ : 0.25 * HANDLE_DISTANCE_SQ;
const KoViewConverter *converter = q->canvas()->viewConverter();
const QPointF viewPoint = converter->documentToView(pos);
qreal minDistanceSq = std::numeric_limits<qreal>::max();
KoShapeGradientHandles sh(m_fillVariant, shape);
Q_FOREACH (const KoShapeGradientHandles::Handle &handle, sh.handles()) {
const QPointF handlePoint = converter->documentToView(handle.pos);
const qreal distanceSq = kisSquareDistance(viewPoint, handlePoint);
if (distanceSq < distanceThresholdSq && distanceSq < minDistanceSq) {
result = handle;
minDistanceSq = distanceSq;
}
}
}
return result;
}
private:
DefaultTool *q;
KoFlake::FillVariant m_fillVariant;
KoShapeGradientHandles::Handle m_currentHandle;
};
class SelectionHandler : public KoToolSelection
{
public:
SelectionHandler(DefaultTool *parent)
: KoToolSelection(parent)
, m_selection(parent->koSelection())
{
}
bool hasSelection() override
{
if (m_selection) {
return m_selection->count();
}
return false;
}
private:
QPointer<KoSelection> m_selection;
};
DefaultTool::DefaultTool(KoCanvasBase *canvas)
: KoInteractionTool(canvas)
, m_lastHandle(KoFlake::NoHandle)
, m_hotPosition(KoFlake::TopLeft)
, m_mouseWasInsideHandles(false)
, m_selectionHandler(new SelectionHandler(this))
, m_customEventStrategy(0)
, m_tabbedOptionWidget(0)
{
setupActions();
QPixmap rotatePixmap, shearPixmap;
rotatePixmap.load(":/cursor_rotate.png");
Q_ASSERT(!rotatePixmap.isNull());
shearPixmap.load(":/cursor_shear.png");
Q_ASSERT(!shearPixmap.isNull());
m_rotateCursors[0] = QCursor(rotatePixmap.transformed(QTransform().rotate(45)));
m_rotateCursors[1] = QCursor(rotatePixmap.transformed(QTransform().rotate(90)));
m_rotateCursors[2] = QCursor(rotatePixmap.transformed(QTransform().rotate(135)));
m_rotateCursors[3] = QCursor(rotatePixmap.transformed(QTransform().rotate(180)));
m_rotateCursors[4] = QCursor(rotatePixmap.transformed(QTransform().rotate(225)));
m_rotateCursors[5] = QCursor(rotatePixmap.transformed(QTransform().rotate(270)));
m_rotateCursors[6] = QCursor(rotatePixmap.transformed(QTransform().rotate(315)));
m_rotateCursors[7] = QCursor(rotatePixmap);
/*
m_rotateCursors[0] = QCursor(Qt::RotateNCursor);
m_rotateCursors[1] = QCursor(Qt::RotateNECursor);
m_rotateCursors[2] = QCursor(Qt::RotateECursor);
m_rotateCursors[3] = QCursor(Qt::RotateSECursor);
m_rotateCursors[4] = QCursor(Qt::RotateSCursor);
m_rotateCursors[5] = QCursor(Qt::RotateSWCursor);
m_rotateCursors[6] = QCursor(Qt::RotateWCursor);
m_rotateCursors[7] = QCursor(Qt::RotateNWCursor);
*/
m_shearCursors[0] = QCursor(shearPixmap);
m_shearCursors[1] = QCursor(shearPixmap.transformed(QTransform().rotate(45)));
m_shearCursors[2] = QCursor(shearPixmap.transformed(QTransform().rotate(90)));
m_shearCursors[3] = QCursor(shearPixmap.transformed(QTransform().rotate(135)));
m_shearCursors[4] = QCursor(shearPixmap.transformed(QTransform().rotate(180)));
m_shearCursors[5] = QCursor(shearPixmap.transformed(QTransform().rotate(225)));
m_shearCursors[6] = QCursor(shearPixmap.transformed(QTransform().rotate(270)));
m_shearCursors[7] = QCursor(shearPixmap.transformed(QTransform().rotate(315)));
m_sizeCursors[0] = Qt::SizeVerCursor;
m_sizeCursors[1] = Qt::SizeBDiagCursor;
m_sizeCursors[2] = Qt::SizeHorCursor;
m_sizeCursors[3] = Qt::SizeFDiagCursor;
m_sizeCursors[4] = Qt::SizeVerCursor;
m_sizeCursors[5] = Qt::SizeBDiagCursor;
m_sizeCursors[6] = Qt::SizeHorCursor;
m_sizeCursors[7] = Qt::SizeFDiagCursor;
connect(canvas->selectedShapesProxy(), SIGNAL(selectionChanged()), this, SLOT(updateActions()));
}
DefaultTool::~DefaultTool()
{
}
void DefaultTool::slotActivateEditFillGradient(bool value)
{
if (value) {
addInteractionFactory(
new MoveGradientHandleInteractionFactory(KoFlake::Fill,
1, EditFillGradientFactoryId, this));
} else {
removeInteractionFactory(EditFillGradientFactoryId);
}
repaintDecorations();
}
void DefaultTool::slotActivateEditStrokeGradient(bool value)
{
if (value) {
addInteractionFactory(
new MoveGradientHandleInteractionFactory(KoFlake::StrokeFill,
0, EditStrokeGradientFactoryId, this));
} else {
removeInteractionFactory(EditStrokeGradientFactoryId);
}
repaintDecorations();
}
bool DefaultTool::wantsAutoScroll() const
{
return true;
}
void DefaultTool::addMappedAction(QSignalMapper *mapper, const QString &actionId, int commandType)
{
KisActionRegistry *actionRegistry = KisActionRegistry::instance();
QAction *action = actionRegistry->makeQAction(actionId, this);
addAction(actionId, action);
connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
mapper->setMapping(action, commandType);
}
void DefaultTool::setupActions()
{
KisActionRegistry *actionRegistry = KisActionRegistry::instance();
QAction *actionBringToFront = actionRegistry->makeQAction("object_order_front", this);
addAction("object_order_front", actionBringToFront);
connect(actionBringToFront, SIGNAL(triggered()), this, SLOT(selectionBringToFront()));
QAction *actionRaise = actionRegistry->makeQAction("object_order_raise", this);
addAction("object_order_raise", actionRaise);
connect(actionRaise, SIGNAL(triggered()), this, SLOT(selectionMoveUp()));
QAction *actionLower = actionRegistry->makeQAction("object_order_lower", this);
addAction("object_order_lower", actionLower);
connect(actionLower, SIGNAL(triggered()), this, SLOT(selectionMoveDown()));
QAction *actionSendToBack = actionRegistry->makeQAction("object_order_back", this);
addAction("object_order_back", actionSendToBack);
connect(actionSendToBack, SIGNAL(triggered()), this, SLOT(selectionSendToBack()));
QSignalMapper *alignSignalsMapper = new QSignalMapper(this);
connect(alignSignalsMapper, SIGNAL(mapped(int)), SLOT(selectionAlign(int)));
addMappedAction(alignSignalsMapper, "object_align_horizontal_left", KoShapeAlignCommand::HorizontalLeftAlignment);
addMappedAction(alignSignalsMapper, "object_align_horizontal_center", KoShapeAlignCommand::HorizontalCenterAlignment);
addMappedAction(alignSignalsMapper, "object_align_horizontal_right", KoShapeAlignCommand::HorizontalRightAlignment);
addMappedAction(alignSignalsMapper, "object_align_vertical_top", KoShapeAlignCommand::VerticalTopAlignment);
addMappedAction(alignSignalsMapper, "object_align_vertical_center", KoShapeAlignCommand::VerticalCenterAlignment);
addMappedAction(alignSignalsMapper, "object_align_vertical_bottom", KoShapeAlignCommand::VerticalBottomAlignment);
QSignalMapper *distributeSignalsMapper = new QSignalMapper(this);
connect(distributeSignalsMapper, SIGNAL(mapped(int)), SLOT(selectionDistribute(int)));
addMappedAction(distributeSignalsMapper, "object_distribute_horizontal_left", KoShapeDistributeCommand::HorizontalLeftDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_horizontal_center", KoShapeDistributeCommand::HorizontalCenterDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_horizontal_right", KoShapeDistributeCommand::HorizontalRightDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_horizontal_gaps", KoShapeDistributeCommand::HorizontalGapsDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_vertical_top", KoShapeDistributeCommand::VerticalTopDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_vertical_center", KoShapeDistributeCommand::VerticalCenterDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_vertical_bottom", KoShapeDistributeCommand::VerticalBottomDistribution);
addMappedAction(distributeSignalsMapper, "object_distribute_vertical_gaps", KoShapeDistributeCommand::VerticalGapsDistribution);
QAction *actionGroupBottom = actionRegistry->makeQAction("object_group", this);
addAction("object_group", actionGroupBottom);
connect(actionGroupBottom, SIGNAL(triggered()), this, SLOT(selectionGroup()));
QAction *actionUngroupBottom = actionRegistry->makeQAction("object_ungroup", this);
addAction("object_ungroup", actionUngroupBottom);
connect(actionUngroupBottom, SIGNAL(triggered()), this, SLOT(selectionUngroup()));
m_contextMenu.reset(new QMenu());
}
qreal DefaultTool::rotationOfHandle(KoFlake::SelectionHandle handle, bool useEdgeRotation)
{
QPointF selectionCenter = koSelection()->absolutePosition();
QPointF direction;
switch (handle) {
case KoFlake::TopMiddleHandle:
if (useEdgeRotation) {
direction = koSelection()->absolutePosition(KoFlake::TopRight)
- koSelection()->absolutePosition(KoFlake::TopLeft);
} else {
QPointF handlePosition = koSelection()->absolutePosition(KoFlake::TopLeft);
handlePosition += 0.5 * (koSelection()->absolutePosition(KoFlake::TopRight) - handlePosition);
direction = handlePosition - selectionCenter;
}
break;
case KoFlake::TopRightHandle:
direction = (QVector2D(koSelection()->absolutePosition(KoFlake::TopRight) - koSelection()->absolutePosition(KoFlake::TopLeft)).normalized() + QVector2D(koSelection()->absolutePosition(KoFlake::TopRight) - koSelection()->absolutePosition(KoFlake::BottomRight)).normalized()).toPointF();
break;
case KoFlake::RightMiddleHandle:
if (useEdgeRotation) {
direction = koSelection()->absolutePosition(KoFlake::BottomRight)
- koSelection()->absolutePosition(KoFlake::TopRight);
} else {
QPointF handlePosition = koSelection()->absolutePosition(KoFlake::TopRight);
handlePosition += 0.5 * (koSelection()->absolutePosition(KoFlake::BottomRight) - handlePosition);
direction = handlePosition - selectionCenter;
}
break;
case KoFlake::BottomRightHandle:
direction = (QVector2D(koSelection()->absolutePosition(KoFlake::BottomRight) - koSelection()->absolutePosition(KoFlake::BottomLeft)).normalized() + QVector2D(koSelection()->absolutePosition(KoFlake::BottomRight) - koSelection()->absolutePosition(KoFlake::TopRight)).normalized()).toPointF();
break;
case KoFlake::BottomMiddleHandle:
if (useEdgeRotation) {
direction = koSelection()->absolutePosition(KoFlake::BottomLeft)
- koSelection()->absolutePosition(KoFlake::BottomRight);
} else {
QPointF handlePosition = koSelection()->absolutePosition(KoFlake::BottomLeft);
handlePosition += 0.5 * (koSelection()->absolutePosition(KoFlake::BottomRight) - handlePosition);
direction = handlePosition - selectionCenter;
}
break;
case KoFlake::BottomLeftHandle:
direction = koSelection()->absolutePosition(KoFlake::BottomLeft) - selectionCenter;
direction = (QVector2D(koSelection()->absolutePosition(KoFlake::BottomLeft) - koSelection()->absolutePosition(KoFlake::BottomRight)).normalized() + QVector2D(koSelection()->absolutePosition(KoFlake::BottomLeft) - koSelection()->absolutePosition(KoFlake::TopLeft)).normalized()).toPointF();
break;
case KoFlake::LeftMiddleHandle:
if (useEdgeRotation) {
direction = koSelection()->absolutePosition(KoFlake::TopLeft)
- koSelection()->absolutePosition(KoFlake::BottomLeft);
} else {
QPointF handlePosition = koSelection()->absolutePosition(KoFlake::TopLeft);
handlePosition += 0.5 * (koSelection()->absolutePosition(KoFlake::BottomLeft) - handlePosition);
direction = handlePosition - selectionCenter;
}
break;
case KoFlake::TopLeftHandle:
direction = koSelection()->absolutePosition(KoFlake::TopLeft) - selectionCenter;
direction = (QVector2D(koSelection()->absolutePosition(KoFlake::TopLeft) - koSelection()->absolutePosition(KoFlake::TopRight)).normalized() + QVector2D(koSelection()->absolutePosition(KoFlake::TopLeft) - koSelection()->absolutePosition(KoFlake::BottomLeft)).normalized()).toPointF();
break;
case KoFlake::NoHandle:
return 0.0;
break;
}
qreal rotation = atan2(direction.y(), direction.x()) * 180.0 / M_PI;
switch (handle) {
case KoFlake::TopMiddleHandle:
if (useEdgeRotation) {
rotation -= 0.0;
} else {
rotation -= 270.0;
}
break;
case KoFlake::TopRightHandle:
rotation -= 315.0;
break;
case KoFlake::RightMiddleHandle:
if (useEdgeRotation) {
rotation -= 90.0;
} else {
rotation -= 0.0;
}
break;
case KoFlake::BottomRightHandle:
rotation -= 45.0;
break;
case KoFlake::BottomMiddleHandle:
if (useEdgeRotation) {
rotation -= 180.0;
} else {
rotation -= 90.0;
}
break;
case KoFlake::BottomLeftHandle:
rotation -= 135.0;
break;
case KoFlake::LeftMiddleHandle:
if (useEdgeRotation) {
rotation -= 270.0;
} else {
rotation -= 180.0;
}
break;
case KoFlake::TopLeftHandle:
rotation -= 225.0;
break;
case KoFlake::NoHandle:
break;
}
if (rotation < 0.0) {
rotation += 360.0;
}
return rotation;
}
void DefaultTool::updateCursor()
{
if (tryUseCustomCursor()) return;
QCursor cursor = Qt::ArrowCursor;
QString statusText;
if (koSelection()->count() > 0) { // has a selection
bool editable = !koSelection()->selectedEditableShapes().isEmpty();
if (!m_mouseWasInsideHandles) {
m_angle = rotationOfHandle(m_lastHandle, true);
int rotOctant = 8 + int(8.5 + m_angle / 45);
bool rotateHandle = false;
bool shearHandle = false;
switch (m_lastHandle) {
case KoFlake::TopMiddleHandle:
cursor = m_shearCursors[(0 + rotOctant) % 8];
shearHandle = true;
break;
case KoFlake::TopRightHandle:
cursor = m_rotateCursors[(1 + rotOctant) % 8];
rotateHandle = true;
break;
case KoFlake::RightMiddleHandle:
cursor = m_shearCursors[(2 + rotOctant) % 8];
shearHandle = true;
break;
case KoFlake::BottomRightHandle:
cursor = m_rotateCursors[(3 + rotOctant) % 8];
rotateHandle = true;
break;
case KoFlake::BottomMiddleHandle:
cursor = m_shearCursors[(4 + rotOctant) % 8];
shearHandle = true;
break;
case KoFlake::BottomLeftHandle:
cursor = m_rotateCursors[(5 + rotOctant) % 8];
rotateHandle = true;
break;
case KoFlake::LeftMiddleHandle:
cursor = m_shearCursors[(6 + rotOctant) % 8];
shearHandle = true;
break;
case KoFlake::TopLeftHandle:
cursor = m_rotateCursors[(7 + rotOctant) % 8];
rotateHandle = true;
break;
case KoFlake::NoHandle:
cursor = Qt::ArrowCursor;
break;
}
if (rotateHandle) {
statusText = i18n("Left click rotates around center, right click around highlighted position.");
}
if (shearHandle) {
statusText = i18n("Click and drag to shear selection.");
}
} else {
statusText = i18n("Click and drag to resize selection.");
m_angle = rotationOfHandle(m_lastHandle, false);
int rotOctant = 8 + int(8.5 + m_angle / 45);
bool cornerHandle = false;
switch (m_lastHandle) {
case KoFlake::TopMiddleHandle:
cursor = m_sizeCursors[(0 + rotOctant) % 8];
break;
case KoFlake::TopRightHandle:
cursor = m_sizeCursors[(1 + rotOctant) % 8];
cornerHandle = true;
break;
case KoFlake::RightMiddleHandle:
cursor = m_sizeCursors[(2 + rotOctant) % 8];
break;
case KoFlake::BottomRightHandle:
cursor = m_sizeCursors[(3 + rotOctant) % 8];
cornerHandle = true;
break;
case KoFlake::BottomMiddleHandle:
cursor = m_sizeCursors[(4 + rotOctant) % 8];
break;
case KoFlake::BottomLeftHandle:
cursor = m_sizeCursors[(5 + rotOctant) % 8];
cornerHandle = true;
break;
case KoFlake::LeftMiddleHandle:
cursor = m_sizeCursors[(6 + rotOctant) % 8];
break;
case KoFlake::TopLeftHandle:
cursor = m_sizeCursors[(7 + rotOctant) % 8];
cornerHandle = true;
break;
case KoFlake::NoHandle:
cursor = Qt::SizeAllCursor;
statusText = i18n("Click and drag to move selection.");
break;
}
if (cornerHandle) {
statusText = i18n("Click and drag to resize selection. Middle click to set highlighted position.");
}
}
if (!editable) {
cursor = Qt::ArrowCursor;
}
} else {
// there used to be guides... :'''(
}
useCursor(cursor);
if (currentStrategy() == 0) {
emit statusTextChanged(statusText);
}
}
void DefaultTool::paint(QPainter &painter, const KoViewConverter &converter)
{
SelectionDecorator decorator(canvas()->resourceManager());
decorator.setSelection(koSelection());
decorator.setHandleRadius(handleRadius());
decorator.setShowFillGradientHandles(hasInteractioFactory(EditFillGradientFactoryId));
decorator.setShowStrokeFillGradientHandles(hasInteractioFactory(EditStrokeGradientFactoryId));
decorator.paint(painter, converter);
KoInteractionTool::paint(painter, converter);
painter.save();
KoShape::applyConversion(painter, converter);
canvas()->snapGuide()->paint(painter, converter);
painter.restore();
}
void DefaultTool::mousePressEvent(KoPointerEvent *event)
{
KoInteractionTool::mousePressEvent(event);
updateCursor();
}
void DefaultTool::mouseMoveEvent(KoPointerEvent *event)
{
KoInteractionTool::mouseMoveEvent(event);
if (currentStrategy() == 0 && koSelection() && koSelection()->count() > 0) {
QRectF bound = handlesSize();
if (bound.contains(event->point)) {
bool inside;
KoFlake::SelectionHandle newDirection = handleAt(event->point, &inside);
if (inside != m_mouseWasInsideHandles || m_lastHandle != newDirection) {
m_lastHandle = newDirection;
m_mouseWasInsideHandles = inside;
//repaintDecorations();
}
} else {
/*if (m_lastHandle != KoFlake::NoHandle)
repaintDecorations(); */
m_lastHandle = KoFlake::NoHandle;
m_mouseWasInsideHandles = false;
// there used to be guides... :'''(
}
} else {
// there used to be guides... :'''(
}
updateCursor();
}
QRectF DefaultTool::handlesSize()
{
KoSelection *selection = koSelection();
if (!selection->count()) return QRectF();
recalcSelectionBox(selection);
QRectF bound = m_selectionOutline.boundingRect();
// expansion Border
if (!canvas() || !canvas()->viewConverter()) {
return bound;
}
QPointF border = canvas()->viewConverter()->viewToDocument(QPointF(HANDLE_DISTANCE, HANDLE_DISTANCE));
bound.adjust(-border.x(), -border.y(), border.x(), border.y());
return bound;
}
void DefaultTool::mouseReleaseEvent(KoPointerEvent *event)
{
KoInteractionTool::mouseReleaseEvent(event);
updateCursor();
}
void DefaultTool::mouseDoubleClickEvent(KoPointerEvent *event)
{
KoSelection *selection = canvas()->selectedShapesProxy()->selection();
KoShape *shape = canvas()->shapeManager()->shapeAt(event->point, KoFlake::ShapeOnTop);
if (shape && !selection->isSelected(shape)) {
if (!(event->modifiers() & Qt::ShiftModifier)) {
selection->deselectAll();
}
selection->select(shape);
}
explicitUserStrokeEndRequest();
}
bool DefaultTool::moveSelection(int direction, Qt::KeyboardModifiers modifiers)
{
bool result = false;
qreal x = 0.0, y = 0.0;
if (direction == Qt::Key_Left) {
x = -5;
} else if (direction == Qt::Key_Right) {
x = 5;
} else if (direction == Qt::Key_Up) {
y = -5;
} else if (direction == Qt::Key_Down) {
y = 5;
}
if (x != 0.0 || y != 0.0) { // actually move
if ((modifiers & Qt::ShiftModifier) != 0) {
x *= 10;
y *= 10;
} else if ((modifiers & Qt::AltModifier) != 0) { // more precise
x /= 5;
y /= 5;
}
QList<KoShape *> shapes = koSelection()->selectedEditableShapes();
if (!shapes.isEmpty()) {
canvas()->addCommand(new KoShapeMoveCommand(shapes, QPointF(x, y)));
result = true;
}
}
return result;
}
void DefaultTool::keyPressEvent(QKeyEvent *event)
{
KoInteractionTool::keyPressEvent(event);
if (currentStrategy() == 0) {
switch (event->key()) {
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Up:
case Qt::Key_Down:
if (moveSelection(event->key(), event->modifiers())) {
event->accept();
}
break;
case Qt::Key_1:
case Qt::Key_2:
case Qt::Key_3:
case Qt::Key_4:
case Qt::Key_5:
canvas()->resourceManager()->setResource(HotPosition, event->key() - Qt::Key_1);
event->accept();
break;
default:
return;
}
}
}
void DefaultTool::repaintDecorations()
{
if (koSelection() && koSelection()->count() > 0) {
canvas()->updateCanvas(handlesSize());
}
}
void DefaultTool::copy() const
{
// all the selected shapes, not only editable!
QList<KoShape *> shapes = canvas()->selectedShapesProxy()->selection()->selectedShapes();
if (!shapes.isEmpty()) {
KoDrag drag;
drag.setSvg(shapes);
drag.addToClipboard();
}
}
void DefaultTool::deleteSelection()
{
QList<KoShape *> shapes;
foreach (KoShape *s, canvas()->selectedShapesProxy()->selection()->selectedShapes()) {
if (s->isGeometryProtected()) {
continue;
}
shapes << s;
}
if (!shapes.empty()) {
canvas()->addCommand(canvas()->shapeController()->removeShapes(shapes));
}
}
bool DefaultTool::paste()
{
// we no longer have to do anything as tool Proxy will do it for us
return false;
}
KoSelection *DefaultTool::koSelection()
{
Q_ASSERT(canvas());
Q_ASSERT(canvas()->selectedShapesProxy());
return canvas()->selectedShapesProxy()->selection();
}
KoFlake::SelectionHandle DefaultTool::handleAt(const QPointF &point, bool *innerHandleMeaning)
{
// check for handles in this order; meaning that when handles overlap the one on top is chosen
static const KoFlake::SelectionHandle handleOrder[] = {
KoFlake::BottomRightHandle,
KoFlake::TopLeftHandle,
KoFlake::BottomLeftHandle,
KoFlake::TopRightHandle,
KoFlake::BottomMiddleHandle,
KoFlake::RightMiddleHandle,
KoFlake::LeftMiddleHandle,
KoFlake::TopMiddleHandle,
KoFlake::NoHandle
};
const KoViewConverter *converter = canvas()->viewConverter();
KoSelection *selection = koSelection();
if (!selection->count() || !converter) {
return KoFlake::NoHandle;
}
recalcSelectionBox(selection);
if (innerHandleMeaning) {
QPainterPath path;
path.addPolygon(m_selectionOutline);
*innerHandleMeaning = path.contains(point) || path.intersects(handlePaintRect(point));
}
const QPointF viewPoint = converter->documentToView(point);
for (int i = 0; i < KoFlake::NoHandle; ++i) {
KoFlake::SelectionHandle handle = handleOrder[i];
const QPointF handlePoint = converter->documentToView(m_selectionBox[handle]);
const qreal distanceSq = kisSquareDistance(viewPoint, handlePoint);
// if just inside the outline
if (distanceSq < HANDLE_DISTANCE_SQ) {
if (innerHandleMeaning) {
if (distanceSq < INNER_HANDLE_DISTANCE_SQ) {
*innerHandleMeaning = true;
}
}
return handle;
}
}
return KoFlake::NoHandle;
}
void DefaultTool::recalcSelectionBox(KoSelection *selection)
{
KIS_ASSERT_RECOVER_RETURN(selection->count());
QTransform matrix = selection->absoluteTransformation(0);
m_selectionOutline = matrix.map(QPolygonF(selection->outlineRect()));
m_angle = 0.0;
QPolygonF outline = m_selectionOutline; //shorter name in the following :)
m_selectionBox[KoFlake::TopMiddleHandle] = (outline.value(0) + outline.value(1)) / 2;
m_selectionBox[KoFlake::TopRightHandle] = outline.value(1);
m_selectionBox[KoFlake::RightMiddleHandle] = (outline.value(1) + outline.value(2)) / 2;
m_selectionBox[KoFlake::BottomRightHandle] = outline.value(2);
m_selectionBox[KoFlake::BottomMiddleHandle] = (outline.value(2) + outline.value(3)) / 2;
m_selectionBox[KoFlake::BottomLeftHandle] = outline.value(3);
m_selectionBox[KoFlake::LeftMiddleHandle] = (outline.value(3) + outline.value(0)) / 2;
m_selectionBox[KoFlake::TopLeftHandle] = outline.value(0);
if (selection->count() == 1) {
#if 0 // TODO detect mirroring
KoShape *s = koSelection()->firstSelectedShape();
if (s->scaleX() < 0) { // vertically mirrored: swap left / right
qSwap(m_selectionBox[KoFlake::TopLeftHandle], m_selectionBox[KoFlake::TopRightHandle]);
qSwap(m_selectionBox[KoFlake::LeftMiddleHandle], m_selectionBox[KoFlake::RightMiddleHandle]);
qSwap(m_selectionBox[KoFlake::BottomLeftHandle], m_selectionBox[KoFlake::BottomRightHandle]);
}
if (s->scaleY() < 0) { // vertically mirrored: swap top / bottom
qSwap(m_selectionBox[KoFlake::TopLeftHandle], m_selectionBox[KoFlake::BottomLeftHandle]);
qSwap(m_selectionBox[KoFlake::TopMiddleHandle], m_selectionBox[KoFlake::BottomMiddleHandle]);
qSwap(m_selectionBox[KoFlake::TopRightHandle], m_selectionBox[KoFlake::BottomRightHandle]);
}
#endif
}
}
void DefaultTool::activate(ToolActivation activation, const QSet<KoShape *> &shapes)
{
KoToolBase::activate(activation, shapes);
m_mouseWasInsideHandles = false;
m_lastHandle = KoFlake::NoHandle;
useCursor(Qt::ArrowCursor);
repaintDecorations();
updateActions();
if (m_tabbedOptionWidget) {
m_tabbedOptionWidget->activate();
}
}
void DefaultTool::deactivate()
{
KoToolBase::deactivate();
if (m_tabbedOptionWidget) {
m_tabbedOptionWidget->deactivate();
}
}
void DefaultTool::selectionGroup()
{
KoSelection *selection = koSelection();
if (!selection) return;
QList<KoShape *> selectedShapes = selection->selectedEditableShapes();
qSort(selectedShapes.begin(), selectedShapes.end(), KoShape::compareShapeZIndex);
KoShapeGroup *group = new KoShapeGroup();
// TODO what if only one shape is left?
KUndo2Command *cmd = new KUndo2Command(kundo2_i18n("Group shapes"));
canvas()->shapeController()->addShapeDirect(group, cmd);
new KoShapeGroupCommand(group, selectedShapes, false, true, true, cmd);
canvas()->addCommand(cmd);
// update selection so we can ungroup immediately again
selection->deselectAll();
selection->select(group);
}
void DefaultTool::selectionUngroup()
{
KoSelection *selection = koSelection();
if (!selection) return;
QList<KoShape *> selectedShapes = selection->selectedEditableShapes();
qSort(selectedShapes.begin(), selectedShapes.end(), KoShape::compareShapeZIndex);
KUndo2Command *cmd = 0;
// add a ungroup command for each found shape container to the macro command
Q_FOREACH (KoShape *shape, selectedShapes) {
KoShapeGroup *group = dynamic_cast<KoShapeGroup *>(shape);
if (group) {
cmd = cmd ? cmd : new KUndo2Command(kundo2_i18n("Ungroup shapes"));
new KoShapeUngroupCommand(group, group->shapes(),
group->parent() ? QList<KoShape *>() : canvas()->shapeManager()->topLevelShapes(),
cmd);
canvas()->shapeController()->removeShape(group, cmd);
}
}
if (cmd) {
canvas()->addCommand(cmd);
}
}
void DefaultTool::selectionAlign(int _align)
{
KoShapeAlignCommand::Align align =
static_cast<KoShapeAlignCommand::Align>(_align);
KoSelection *selection = koSelection();
if (!selection) return;
QList<KoShape *> editableShapes = selection->selectedEditableShapes();
if (editableShapes.isEmpty()) {
return;
}
// TODO add an option to the widget so that one can align to the page
// with multiple selected shapes too
QRectF bb;
// single selected shape is automatically aligned to document rect
if (editableShapes.count() == 1) {
if (!canvas()->resourceManager()->hasResource(KoCanvasResourceManager::PageSize)) {
return;
}
bb = QRectF(QPointF(0, 0), canvas()->resourceManager()->sizeResource(KoCanvasResourceManager::PageSize));
} else {
bb = KoShape::absoluteOutlineRect(editableShapes);
}
KoShapeAlignCommand *cmd = new KoShapeAlignCommand(editableShapes, align, bb);
canvas()->addCommand(cmd);
}
void DefaultTool::selectionDistribute(int _distribute)
{
KoShapeDistributeCommand::Distribute distribute =
static_cast<KoShapeDistributeCommand::Distribute>(_distribute);
KoSelection *selection = koSelection();
if (!selection) return;
QList<KoShape *> editableShapes = selection->selectedEditableShapes();
if (editableShapes.size() < 3) {
return;
}
QRectF bb = KoShape::absoluteOutlineRect(editableShapes);
KoShapeDistributeCommand *cmd = new KoShapeDistributeCommand(editableShapes, distribute, bb);
canvas()->addCommand(cmd);
}
void DefaultTool::selectionBringToFront()
{
selectionReorder(KoShapeReorderCommand::BringToFront);
}
void DefaultTool::selectionMoveUp()
{
selectionReorder(KoShapeReorderCommand::RaiseShape);
}
void DefaultTool::selectionMoveDown()
{
selectionReorder(KoShapeReorderCommand::LowerShape);
}
void DefaultTool::selectionSendToBack()
{
selectionReorder(KoShapeReorderCommand::SendToBack);
}
void DefaultTool::selectionReorder(KoShapeReorderCommand::MoveShapeType order)
{
KoSelection *selection = canvas()->selectedShapesProxy()->selection();
if (!selection) {
return;
}
QList<KoShape *> selectedShapes = selection->selectedEditableShapes();
if (selectedShapes.isEmpty()) {
return;
}
KUndo2Command *cmd = KoShapeReorderCommand::createCommand(selectedShapes, canvas()->shapeManager(), order);
if (cmd) {
canvas()->addCommand(cmd);
}
}
QList<QPointer<QWidget> > DefaultTool::createOptionWidgets()
{
QList<QPointer<QWidget> > widgets;
m_tabbedOptionWidget = new DefaultToolTabbedWidget(this);
if (isActivated()) {
m_tabbedOptionWidget->activate();
}
widgets.append(m_tabbedOptionWidget);
connect(m_tabbedOptionWidget,
SIGNAL(sigSwitchModeEditFillGradient(bool)),
SLOT(slotActivateEditFillGradient(bool)));
connect(m_tabbedOptionWidget,
SIGNAL(sigSwitchModeEditStrokeGradient(bool)),
SLOT(slotActivateEditStrokeGradient(bool)));
return widgets;
}
void DefaultTool::canvasResourceChanged(int key, const QVariant &res)
{
if (key == HotPosition) {
m_hotPosition = KoFlake::AnchorPosition(res.toInt());
repaintDecorations();
}
}
KoInteractionStrategy *DefaultTool::createStrategy(KoPointerEvent *event)
{
KoShapeManager *shapeManager = canvas()->shapeManager();
KoSelection *selection = koSelection();
bool insideSelection = false;
KoFlake::SelectionHandle handle = handleAt(event->point, &insideSelection);
bool editableShape = !selection->selectedEditableShapes().isEmpty();
const bool selectMultiple = event->modifiers() & Qt::ShiftModifier;
const bool selectNextInStack = event->modifiers() & Qt::ControlModifier;
const bool avoidSelection = event->modifiers() & Qt::AltModifier;
if (selectNextInStack) {
// change the hot selection position when middle clicking on a handle
KoFlake::AnchorPosition newHotPosition = m_hotPosition;
switch (handle) {
case KoFlake::TopMiddleHandle:
newHotPosition = KoFlake::Top;
break;
case KoFlake::TopRightHandle:
newHotPosition = KoFlake::TopRight;
break;
case KoFlake::RightMiddleHandle:
newHotPosition = KoFlake::Right;
break;
case KoFlake::BottomRightHandle:
newHotPosition = KoFlake::BottomRight;
break;
case KoFlake::BottomMiddleHandle:
newHotPosition = KoFlake::Bottom;
break;
case KoFlake::BottomLeftHandle:
newHotPosition = KoFlake::BottomLeft;
break;
case KoFlake::LeftMiddleHandle:
newHotPosition = KoFlake::Left;
break;
case KoFlake::TopLeftHandle:
newHotPosition = KoFlake::TopLeft;
break;
case KoFlake::NoHandle:
default:
// check if we had hit the center point
const KoViewConverter *converter = canvas()->viewConverter();
QPointF pt = converter->documentToView(event->point);
// TODO: use calculated values instead!
QPointF centerPt = converter->documentToView(selection->absolutePosition());
if (kisSquareDistance(pt, centerPt) < HANDLE_DISTANCE_SQ) {
newHotPosition = KoFlake::Center;
}
break;
}
if (m_hotPosition != newHotPosition) {
canvas()->resourceManager()->setResource(HotPosition, newHotPosition);
return new NopInteractionStrategy(this);
}
}
if (!avoidSelection && editableShape) {
// manipulation of selected shapes goes first
if (handle != KoFlake::NoHandle) {
// resizing or shearing only with left mouse button
if (insideSelection) {
return new ShapeResizeStrategy(this, event->point, handle);
}
if (handle == KoFlake::TopMiddleHandle || handle == KoFlake::RightMiddleHandle ||
handle == KoFlake::BottomMiddleHandle || handle == KoFlake::LeftMiddleHandle) {
return new ShapeShearStrategy(this, event->point, handle);
}
// rotating is allowed for rigth mouse button too
if (handle == KoFlake::TopLeftHandle || handle == KoFlake::TopRightHandle ||
handle == KoFlake::BottomLeftHandle || handle == KoFlake::BottomRightHandle) {
return new ShapeRotateStrategy(this, event->point, event->buttons());
}
}
if (!selectMultiple && !selectNextInStack) {
if (insideSelection) {
return new ShapeMoveStrategy(this, event->point);
}
}
}
KoShape *shape = shapeManager->shapeAt(event->point, selectNextInStack ? KoFlake::NextUnselected : KoFlake::ShapeOnTop);
if (avoidSelection || (!shape && handle == KoFlake::NoHandle)) {
if (!selectMultiple) {
repaintDecorations();
selection->deselectAll();
}
return new SelectionInteractionStrategy(this, event->point, false);
}
if (selection->isSelected(shape)) {
if (selectMultiple) {
repaintDecorations();
selection->deselect(shape);
}
} else if (handle == KoFlake::NoHandle) { // clicked on shape which is not selected
repaintDecorations();
if (!selectMultiple) {
shapeManager->selection()->deselectAll();
}
selection->select(shape);
repaintDecorations();
// tablet selection isn't precise and may lead to a move, preventing that
if (event->isTabletEvent()) {
return new NopInteractionStrategy(this);
}
return new ShapeMoveStrategy(this, event->point);
}
return 0;
}
void DefaultTool::updateActions()
{
QList<KoShape*> editableShapes;
if (koSelection()) {
editableShapes = koSelection()->selectedEditableShapes();
}
const bool orderingEnabled = !editableShapes.isEmpty();
action("object_order_front")->setEnabled(orderingEnabled);
action("object_order_raise")->setEnabled(orderingEnabled);
action("object_order_lower")->setEnabled(orderingEnabled);
action("object_order_back")->setEnabled(orderingEnabled);
const bool alignmentEnabled =
editableShapes.size() > 1 ||
(!editableShapes.isEmpty() &&
canvas()->resourceManager()->hasResource(KoCanvasResourceManager::PageSize));
action("object_align_horizontal_left")->setEnabled(alignmentEnabled);
action("object_align_horizontal_center")->setEnabled(alignmentEnabled);
action("object_align_horizontal_right")->setEnabled(alignmentEnabled);
action("object_align_vertical_top")->setEnabled(alignmentEnabled);
action("object_align_vertical_center")->setEnabled(alignmentEnabled);
action("object_align_vertical_bottom")->setEnabled(alignmentEnabled);
action("object_group")->setEnabled(editableShapes.size() > 1);
const bool distributionEnabled = editableShapes.size() > 2;
action("object_distribute_horizontal_left")->setEnabled(distributionEnabled);
action("object_distribute_horizontal_center")->setEnabled(distributionEnabled);
action("object_distribute_horizontal_right")->setEnabled(distributionEnabled);
action("object_distribute_horizontal_gaps")->setEnabled(distributionEnabled);
action("object_distribute_vertical_top")->setEnabled(distributionEnabled);
action("object_distribute_vertical_center")->setEnabled(distributionEnabled);
action("object_distribute_vertical_bottom")->setEnabled(distributionEnabled);
action("object_distribute_vertical_gaps")->setEnabled(distributionEnabled);
bool hasGroupShape = false;
foreach (KoShape *shape, editableShapes) {
if (dynamic_cast<KoShapeGroup *>(shape)) {
hasGroupShape = true;
break;
}
}
action("object_ungroup")->setEnabled(hasGroupShape);
emit selectionChanged(editableShapes.size());
}
KoToolSelection *DefaultTool::selection()
{
return m_selectionHandler;
}
QMenu* DefaultTool::popupActionsMenu()
{
if (m_contextMenu) {
m_contextMenu->clear();
KActionCollection *collection = this->canvas()->canvasController()->actionCollection();
m_contextMenu->addAction(collection->action("edit_cut"));
m_contextMenu->addAction(collection->action("edit_copy"));
m_contextMenu->addAction(collection->action("edit_paste"));
m_contextMenu->addSeparator();
m_contextMenu->addAction(action("object_order_front"));
m_contextMenu->addAction(action("object_order_raise"));
m_contextMenu->addAction(action("object_order_lower"));
m_contextMenu->addAction(action("object_order_back"));
if (action("object_group")->isEnabled() || action("object_ungroup")->isEnabled()) {
m_contextMenu->addSeparator();
m_contextMenu->addAction(action("object_group"));
m_contextMenu->addAction(action("object_ungroup"));
}
}
return m_contextMenu.data();
}
void DefaultTool::explicitUserStrokeEndRequest()
{
QList<KoShape *> shapes = koSelection()->selectedEditableShapesAndDelegates();
emit activateTemporary(KoToolManager::instance()->preferredToolForSelection(shapes));
}
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultTool.h b/plugins/tools/defaulttool/defaulttool/DefaultTool.h
index 8311cb28c6..85d336cf3f 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultTool.h
+++ b/plugins/tools/defaulttool/defaulttool/DefaultTool.h
@@ -1,173 +1,173 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006-2008 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DEFAULTTOOL_H
#define DEFAULTTOOL_H
#include <KoInteractionTool.h>
#include <KoFlake.h>
#include <commands/KoShapeAlignCommand.h>
#include <commands/KoShapeReorderCommand.h>
#include <QPolygonF>
#include <QTime>
class QSignalMapper;
class KoInteractionStrategy;
class KoShapeMoveCommand;
class KoSelection;
class DefaultToolTabbedWidget;
/**
* The default tool (associated with the arrow icon) implements the default
* interactions you have with flake objects.<br>
* The tool provides scaling, moving, selecting, rotation and soon skewing of
* any number of shapes.
* <p>Note that the implementation of those different strategies are delegated
* to the InteractionStrategy class and its subclasses.
*/
class DefaultTool : public KoInteractionTool
{
Q_OBJECT
public:
/**
* Constructor for basic interaction tool where user actions are translated
* and handled by interaction strategies of type KoInteractionStrategy.
* @param canvas the canvas this tool will be working for.
*/
explicit DefaultTool(KoCanvasBase *canvas);
- virtual ~DefaultTool();
+ ~DefaultTool() override;
enum CanvasResource {
HotPosition = 1410100299
};
public:
- virtual bool wantsAutoScroll() const;
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ bool wantsAutoScroll() const override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
- virtual void repaintDecorations();
+ void repaintDecorations() override;
///reimplemented
- virtual void copy() const;
+ void copy() const override;
///reimplemented
- virtual void deleteSelection();
+ void deleteSelection() override;
///reimplemented
- virtual bool paste();
+ bool paste() override;
///reimplemented
- virtual KoToolSelection *selection();
+ KoToolSelection *selection() override;
QMenu* popupActionsMenu() override;
/**
* Returns which selection handle is at params point (or NoHandle if none).
* @return which selection handle is at params point (or NoHandle if none).
* @param point the location (in pt) where we should look for a handle
* @param innerHandleMeaning this boolean is altered to true if the point
* is inside the selection rectangle and false if it is just outside.
* The value of innerHandleMeaning is undefined if the handle location is NoHandle
*/
KoFlake::SelectionHandle handleAt(const QPointF &point, bool *innerHandleMeaning = 0);
public Q_SLOTS:
void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
void deactivate() override;
private Q_SLOTS:
void selectionAlign(int _align);
void selectionDistribute(int _distribute);
void selectionBringToFront();
void selectionSendToBack();
void selectionMoveUp();
void selectionMoveDown();
void selectionGroup();
void selectionUngroup();
void slotActivateEditFillGradient(bool value);
void slotActivateEditStrokeGradient(bool value);
/// Update actions on selection change
void updateActions();
public: // Events
void mousePressEvent(KoPointerEvent *event) override;
void mouseMoveEvent(KoPointerEvent *event) override;
void mouseReleaseEvent(KoPointerEvent *event) override;
void mouseDoubleClickEvent(KoPointerEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void explicitUserStrokeEndRequest() override;
protected:
- QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
KoInteractionStrategy *createStrategy(KoPointerEvent *event) override;
private:
class MoveGradientHandleInteractionFactory;
private:
void setupActions();
void recalcSelectionBox(KoSelection *selection);
void updateCursor();
/// Returns rotation angle of given handle of the current selection
qreal rotationOfHandle(KoFlake::SelectionHandle handle, bool useEdgeRotation);
void addMappedAction(QSignalMapper *mapper, const QString &actionId, int type);
void selectionReorder(KoShapeReorderCommand::MoveShapeType order);
bool moveSelection(int direction, Qt::KeyboardModifiers modifiers);
/// Returns selection rectangle adjusted by handle proximity threshold
QRectF handlesSize();
// convenience method;
KoSelection *koSelection();
- void canvasResourceChanged(int key, const QVariant &res);
+ void canvasResourceChanged(int key, const QVariant &res) override;
KoFlake::SelectionHandle m_lastHandle;
KoFlake::AnchorPosition m_hotPosition;
bool m_mouseWasInsideHandles;
QPointF m_selectionBox[8];
QPolygonF m_selectionOutline;
QPointF m_lastPoint;
// TODO alter these 3 arrays to be static const instead
QCursor m_sizeCursors[8];
QCursor m_rotateCursors[8];
QCursor m_shearCursors[8];
qreal m_angle;
KoToolSelection *m_selectionHandler;
friend class SelectionHandler;
KoInteractionStrategy *m_customEventStrategy;
QScopedPointer<QMenu> m_contextMenu;
DefaultToolTabbedWidget *m_tabbedOptionWidget;
};
#endif
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolFactory.h b/plugins/tools/defaulttool/defaulttool/DefaultToolFactory.h
index 82d1f3512f..869b218d86 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolFactory.h
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolFactory.h
@@ -1,36 +1,36 @@
/* This file is part of the KDE project
*
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DEFAULTTOOLFACTORY_H
#define DEFAULTTOOLFACTORY_H
#include <KoToolFactoryBase.h>
/// Factory for the KoInteractionTool
class DefaultToolFactory : public KoToolFactoryBase
{
public:
/// constructor
DefaultToolFactory();
- ~DefaultToolFactory();
+ ~DefaultToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.h b/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.h
index bf5c393d5c..6b00476486 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.h
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.h
@@ -1,70 +1,70 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Martin Pfeiffer <hubipete@gmx.net>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
* Copyright (C) 2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DEFAULTTOOLGEOMETRYWIDGET_H
#define DEFAULTTOOLGEOMETRYWIDGET_H
#include <ui_DefaultToolGeometryWidget.h>
#include <KoFlake.h>
#include <QWidget>
class KoInteractionTool;
class KisAspectRatioLocker;
class DefaultToolGeometryWidget : public QWidget, Ui::DefaultToolGeometryWidget
{
Q_OBJECT
public:
explicit DefaultToolGeometryWidget(KoInteractionTool *tool, QWidget *parent = 0);
- ~DefaultToolGeometryWidget();
+ ~DefaultToolGeometryWidget() override;
/// Sets the unit used by the unit aware child widgets
void setUnit(const KoUnit &unit);
protected:
- void showEvent(QShowEvent *event);
+ void showEvent(QShowEvent *event) override;
private Q_SLOTS:
void slotAnchorPointChanged();
void resourceChanged(int key, const QVariant &res);
void slotUpdatePositionBoxes();
void slotRepositionShapes();
void slotUpdateSizeBoxes();
void slotResizeShapes();
void slotUpdateCheckboxes();
void slotAspectButtonToggled();
void slotUpdateAspectButton();
void slotOpacitySliderChanged();
void slotUpdateOpacitySlider();
private:
KoInteractionTool *m_tool;
QScopedPointer<KisAspectRatioLocker> m_sizeAspectLocker;
bool m_savedUniformScaling;
};
#endif
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.ui b/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.ui
index e359fb7f5e..43603bf5c0 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.ui
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolGeometryWidget.ui
@@ -1,253 +1,283 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DefaultToolGeometryWidget</class>
<widget class="QWidget" name="DefaultToolGeometryWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>305</width>
+ <width>182</width>
<height>303</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>1</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KisDoubleParseUnitSpinBox" name="positionXSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="KisDoubleParseUnitSpinBox" name="widthSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="2">
<widget class="KoAspectButton" name="aspectButton" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" stdset="0">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KisDoubleParseUnitSpinBox" name="positionYSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="KisDoubleParseUnitSpinBox" name="heightSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="minimum">
<double>-10000.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="KoAnchorSelectionWidget" name="positionSelector" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QCheckBox" name="chkAnchorLock">
<property name="text">
<string>Anchor Lock</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkUniformScaling">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When &amp;quot;Uniform Scaling&amp;quot; is &lt;span style=&quot; font-weight:600;&quot;&gt;enabled&lt;/span&gt;, the shape's stroke is scaled with the shape itself. &lt;/p&gt;&lt;p&gt;In &lt;span style=&quot; font-weight:600;&quot;&gt;disabled&lt;/span&gt; state, the shape is only resized, keeping the stroke width and style intact.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Uniform Scaling</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkGlobalCoordinates">
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;In &amp;quot;Global Coordinates&amp;quot; mode Width and Height fields show the size of the shape's bounding box in image-aligned coordinates, even when the shape is rotated or has any other transform. &lt;/p&gt;&lt;p&gt;If &amp;quot;Global Coordinates&amp;quot; mode is disabled, Width and Height fields show the shape's &amp;quot;local&amp;quot; size, before application of any transformations.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Global Coordinates</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="KisDoubleSliderSpinBox" name="dblOpacity" native="true"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KoAspectButton</class>
<extends>QWidget</extends>
<header>KoAspectButton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisDoubleParseUnitSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header>kis_double_parse_unit_spin_box.h</header>
</customwidget>
<customwidget>
<class>KoAnchorSelectionWidget</class>
<extends>QWidget</extends>
<header>KoAnchorSelectionWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KisDoubleSliderSpinBox</class>
<extends>QWidget</extends>
<header location="global">kis_slider_spin_box.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>positionXSpinBox</tabstop>
<tabstop>positionYSpinBox</tabstop>
<tabstop>widthSpinBox</tabstop>
<tabstop>heightSpinBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.cpp b/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.cpp
index 3851b5b840..8127c711a0 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.cpp
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.cpp
@@ -1,90 +1,91 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "DefaultToolTabbedWidget.h"
#include <QLabel>
#include "kis_icon_utils.h"
#include "DefaultToolGeometryWidget.h"
#include "KoStrokeConfigWidget.h"
#include "KoFillConfigWidget.h"
#include <KoInteractionTool.h>
#include <kis_document_aware_spin_box_unit_manager.h>
DefaultToolTabbedWidget::DefaultToolTabbedWidget(KoInteractionTool *tool, QWidget *parent)
: KoTitledTabWidget(parent)
-{
+{
setObjectName("default-tool-tabbed-widget");
DefaultToolGeometryWidget *geometryWidget = new DefaultToolGeometryWidget(tool, this);
geometryWidget->setWindowTitle(i18n("Geometry"));
addTab(geometryWidget, KisIconUtils::loadIcon("geometry"), QString());
m_strokeWidget = new KoStrokeConfigWidget(tool->canvas(), this);
m_strokeWidget->setWindowTitle(i18n("Stroke"));
KisDocumentAwareSpinBoxUnitManager* managerLineWidth = new KisDocumentAwareSpinBoxUnitManager(m_strokeWidget);
KisDocumentAwareSpinBoxUnitManager* managerMitterLimit = new KisDocumentAwareSpinBoxUnitManager(m_strokeWidget);
managerLineWidth->setApparentUnitFromSymbol("px");
managerMitterLimit->setApparentUnitFromSymbol("px"); //set unit to px by default
m_strokeWidget->setUnitManagers(managerLineWidth, managerMitterLimit);
addTab(m_strokeWidget, KisIconUtils::loadIcon("krita_tool_line"), QString());
+
m_fillWidget = new KoFillConfigWidget(tool->canvas(), KoFlake::Fill, this);
m_fillWidget->setWindowTitle(i18n("Fill"));
addTab(m_fillWidget, KisIconUtils::loadIcon("krita_tool_color_fill"), QString());
connect(this, SIGNAL(currentChanged(int)), SLOT(slotCurrentIndexChanged(int)));
m_oldTabIndex = currentIndex();
}
DefaultToolTabbedWidget::~DefaultToolTabbedWidget()
{
}
void DefaultToolTabbedWidget::activate()
{
m_fillWidget->activate();
m_strokeWidget->activate();
}
void DefaultToolTabbedWidget::deactivate()
{
m_fillWidget->deactivate();
m_strokeWidget->deactivate();
}
void DefaultToolTabbedWidget::slotCurrentIndexChanged(int current)
{
if (m_oldTabIndex == FillTab) {
emit sigSwitchModeEditFillGradient(false);
} else if (m_oldTabIndex == StrokeTab) {
emit sigSwitchModeEditStrokeGradient(false);
}
m_oldTabIndex = current;
if (current == FillTab) {
emit sigSwitchModeEditFillGradient(true);
} else if (m_oldTabIndex == StrokeTab) {
emit sigSwitchModeEditStrokeGradient(true);
}
}
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.h b/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.h
index 31eb961756..f8b40bad4a 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.h
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolTabbedWidget.h
@@ -1,59 +1,59 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DEFAULTTOOLTABBEDWIDGET_H
#define DEFAULTTOOLTABBEDWIDGET_H
#include <KoTitledTabWidget.h>
class KoInteractionTool;
class KoFillConfigWidget;
class KoStrokeConfigWidget;
class DefaultToolTabbedWidget : public KoTitledTabWidget
{
Q_OBJECT
public:
explicit DefaultToolTabbedWidget(KoInteractionTool *tool, QWidget *parent = 0);
- ~DefaultToolTabbedWidget();
+ ~DefaultToolTabbedWidget() override;
enum TabType {
GeometryTab,
StrokeTab,
FillTab
};
void activate();
void deactivate();
Q_SIGNALS:
void sigSwitchModeEditFillGradient(bool value);
void sigSwitchModeEditStrokeGradient(bool value);
private Q_SLOTS:
void slotCurrentIndexChanged(int current);
private:
int m_oldTabIndex;
KoFillConfigWidget *m_fillWidget;
KoStrokeConfigWidget *m_strokeWidget;
};
#endif // DEFAULTTOOLTABBEDWIDGET_H
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.h
index 329e3f6ed9..0aefb8b5c7 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.h
+++ b/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.h
@@ -1,46 +1,46 @@
/*
* Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SHAPEGRADIENTEDITSTRATEGY_H
#define SHAPEGRADIENTEDITSTRATEGY_H
#include <QScopedPointer>
#include <KoInteractionStrategy.h>
#include "KoShapeGradientHandles.h"
class ShapeGradientEditStrategy : public KoInteractionStrategy
{
public:
ShapeGradientEditStrategy(KoToolBase *tool,
KoFlake::FillVariant fillVariant,
KoShape *shape,
KoShapeGradientHandles::Handle::Type startHandleType,
const QPointF &clicked);
- ~ShapeGradientEditStrategy();
+ ~ShapeGradientEditStrategy() override;
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
KUndo2Command *createCommand() override;
void finishInteraction(Qt::KeyboardModifiers modifiers) override;
void paint(QPainter &painter, const KoViewConverter &converter) override;
private:
struct Private;
QScopedPointer<Private> m_d;
};
#endif // SHAPEGRADIENTEDITSTRATEGY_H
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h
index bddd0a05eb..a43dcf70ff 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h
+++ b/plugins/tools/defaulttool/defaulttool/ShapeMoveStrategy.h
@@ -1,64 +1,64 @@
/* This file is part of the KDE project
Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SHAPEMOVESTRATEGY_H
#define SHAPEMOVESTRATEGY_H
#include <KoInteractionStrategy.h>
#include <QPointer>
#include <QPointF>
#include <QList>
#include <KoCanvasBase.h>
class KoToolBase;
class KoShape;
/**
* Implements the Move action on an object or selected objects.
*/
class ShapeMoveStrategy : public KoInteractionStrategy
{
public:
/**
* Constructor that starts to move the objects.
* @param tool the parent tool which controls this strategy
* @param canvas the canvas interface which will supply things like a selection object
* @param clicked the initial point that the user depressed (in pt).
*/
ShapeMoveStrategy(KoToolBase *tool, const QPointF &clicked);
- virtual ~ShapeMoveStrategy() {}
+ ~ShapeMoveStrategy() override {}
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
KUndo2Command *createCommand() override;
void finishInteraction(Qt::KeyboardModifiers modifiers) override;
- virtual void paint(QPainter &painter, const KoViewConverter &converter) override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
private:
void moveSelection(const QPointF &diff);
QList<QPointF> m_previousPositions;
QList<QPointF> m_newPositions;
QPointF m_start, m_finalMove, m_initialOffset;
QList<KoShape *> m_selectedShapes;
QPointer<KoCanvasBase> m_canvas;
};
#endif
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h
index 645eee9e2d..8e0a2b7e07 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h
+++ b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h
@@ -1,70 +1,70 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SHAPERESIZESTRATEGY_H
#define SHAPERESIZESTRATEGY_H
#include <KoInteractionStrategy.h>
#include <KoFlake.h>
#include <QScopedPointer>
#include <QPointF>
#include <QList>
#include <QTransform>
class KoToolBase;
class KoShape;
class KoShapeResizeCommand;
/**
* A strategy for the KoInteractionTool.
* This strategy is invoked when the user starts a resize of a selection of objects,
* the stategy will then resize the objects interactively and provide a command afterwards.
*/
class ShapeResizeStrategy : public KoInteractionStrategy
{
public:
/**
* Constructor
*/
ShapeResizeStrategy(KoToolBase *tool, const QPointF &clicked, KoFlake::SelectionHandle direction);
- ~ShapeResizeStrategy();
+ ~ShapeResizeStrategy() override;
- void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- KUndo2Command *createCommand();
- void finishInteraction(Qt::KeyboardModifiers modifiers);
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command *createCommand() override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
private:
void resizeBy(const QPointF &stillPoint, qreal zoomX, qreal zoomY);
QPointF m_start;
QList<KoShape *> m_selectedShapes;
QTransform m_postScalingCoveringTransform;
QSizeF m_initialSelectionSize;
QTransform m_unwindMatrix;
bool m_top, m_left, m_bottom, m_right;
QPointF m_globalStillPoint;
QPointF m_globalCenterPoint;
QScopedPointer<KoShapeResizeCommand> m_executedCommand;
};
#endif
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeRotateStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeRotateStrategy.h
index 47bf458008..6f20d3eef4 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeRotateStrategy.h
+++ b/plugins/tools/defaulttool/defaulttool/ShapeRotateStrategy.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SHAPEROTATESTRATEGY_H
#define SHAPEROTATESTRATEGY_H
#include <KoInteractionStrategy.h>
#include <QPointF>
#include <QRectF>
#include <QTransform>
#include <QList>
class KoToolBase;
class KoShape;
/**
* A strategy for the KoInteractionTool.
* This strategy is invoked when the user starts a rotate of a selection of objects,
* the stategy will then rotate the objects interactively and provide a command afterwards.
*/
class ShapeRotateStrategy : public KoInteractionStrategy
{
public:
/**
* Constructor that starts to rotate the objects.
* @param tool the parent tool which controls this strategy
* @param clicked the initial point that the user depressed (in pt).
*/
ShapeRotateStrategy(KoToolBase *tool, const QPointF &clicked, Qt::MouseButtons buttons);
- virtual ~ShapeRotateStrategy() {}
+ ~ShapeRotateStrategy() override {}
- void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- KUndo2Command *createCommand();
- void finishInteraction(Qt::KeyboardModifiers modifiers)
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command *createCommand() override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override
{
Q_UNUSED(modifiers);
}
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
private:
void rotateBy(qreal angle);
QPointF m_start;
QTransform m_rotationMatrix;
QList<QTransform> m_oldTransforms;
QPointF m_rotationCenter;
QList<KoShape *> m_selectedShapes;
};
#endif
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeShearStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeShearStrategy.h
index 5e655e2c53..53667a1304 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeShearStrategy.h
+++ b/plugins/tools/defaulttool/defaulttool/ShapeShearStrategy.h
@@ -1,71 +1,71 @@
/* This file is part of the KDE project
* Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SHAPESHEARSTRATEGY_H
#define SHAPESHEARSTRATEGY_H
#include <KoInteractionStrategy.h>
#include <KoFlake.h>
#include <QPointF>
#include <QSizeF>
#include <QTransform>
class KoToolBase;
class KoShape;
/**
* A strategy for the KoInteractionTool.
* This strategy is invoked when the user starts a shear of a selection of objects,
* the stategy will then shear the objects interactively and provide a command afterwards.
*/
class ShapeShearStrategy : public KoInteractionStrategy
{
public:
/**
* Constructor that starts to rotate the objects.
* @param tool the parent tool which controls this strategy
* @param clicked the initial point that the user depressed (in pt).
* @param direction the handle that was grabbed
*/
ShapeShearStrategy(KoToolBase *tool, const QPointF &clicked, KoFlake::SelectionHandle direction);
- virtual ~ShapeShearStrategy() {}
+ ~ShapeShearStrategy() override {}
- void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- KUndo2Command *createCommand();
- void finishInteraction(Qt::KeyboardModifiers modifiers)
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ KUndo2Command *createCommand() override;
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override
{
Q_UNUSED(modifiers);
}
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
private:
QPointF m_start;
QPointF m_solidPoint;
QSizeF m_initialSize;
bool m_top, m_left, m_bottom, m_right;
qreal m_initialSelectionAngle;
QTransform m_shearMatrix;
bool m_isMirrored;
QList<QTransform> m_oldTransforms;
QList<KoShape *> m_selectedShapes;
};
#endif
diff --git a/plugins/tools/karbonplugins/filtereffects/BlendEffect.h b/plugins/tools/karbonplugins/filtereffects/BlendEffect.h
index 9ed8c36966..272133e200 100644
--- a/plugins/tools/karbonplugins/filtereffects/BlendEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/BlendEffect.h
@@ -1,61 +1,61 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLENDEFFECT_H
#define BLENDEFFECT_H
#include "KoFilterEffect.h"
#define BlendEffectId "feBlend"
/// A color matrix effect
class BlendEffect : public KoFilterEffect
{
public:
enum BlendMode {
Normal,
Multiply,
Screen,
Darken,
Lighten
};
BlendEffect();
/// Returns the type of the color matrix
BlendMode blendMode() const;
/// Sets the blend mode
void setBlendMode(BlendMode blendMode);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const;
+ QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
BlendMode m_blendMode; ///< the blend mode
};
#endif // BLENDEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/BlendEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/BlendEffectConfigWidget.h
index bee2c5baa3..d92753cba0 100644
--- a/plugins/tools/karbonplugins/filtereffects/BlendEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/BlendEffectConfigWidget.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLENDEFFECTCONFIGWIDGET_H
#define BLENDEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class BlendEffect;
class KoFilterEffect;
class KComboBox;
class BlendEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit BlendEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void modeChanged(int index);
private:
KComboBox *m_mode;
BlendEffect *m_effect;
};
#endif // BLENDEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/BlendEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/BlendEffectFactory.h
index 5732010254..9d300a9d1f 100644
--- a/plugins/tools/karbonplugins/filtereffects/BlendEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/BlendEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLENDEFFECTFACTORY_H
#define BLENDEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class BlendEffectFactory : public KoFilterEffectFactoryBase
{
public:
BlendEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // BLENDEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/BlurEffect.h b/plugins/tools/karbonplugins/filtereffects/BlurEffect.h
index 526c4012e9..076ea74dbc 100644
--- a/plugins/tools/karbonplugins/filtereffects/BlurEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/BlurEffect.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLUREFFECT_H
#define BLUREFFECT_H
#include "KoFilterEffect.h"
#include <QPointF>
#define BlurEffectId "feGaussianBlur"
/// A gaussian blur effect
class BlurEffect : public KoFilterEffect
{
public:
BlurEffect();
QPointF deviation() const;
void setDeviation(const QPointF &deviation);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
QPointF m_deviation;
};
#endif // BLUREFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/BlurEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/BlurEffectConfigWidget.h
index c0e1712ed0..9543fbac0c 100644
--- a/plugins/tools/karbonplugins/filtereffects/BlurEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/BlurEffectConfigWidget.h
@@ -1,46 +1,46 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLUREFFECTCONFIGWIDGET_H
#define BLUREFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class BlurEffect;
class QDoubleSpinBox;
class BlurEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit BlurEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void stdDeviationChanged(double stdDeviation);
private:
BlurEffect *m_effect;
QDoubleSpinBox *m_stdDeviation;
};
#endif // BLUREFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/BlurEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/BlurEffectFactory.h
index 23894a85d0..a932495b7c 100644
--- a/plugins/tools/karbonplugins/filtereffects/BlurEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/BlurEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef BLUREFFECTFACTORY_H
#define BLUREFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class BlurEffectFactory : public KoFilterEffectFactoryBase
{
public:
BlurEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // BLUREFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffect.h b/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffect.h
index f9264e11d2..e2e2124411 100644
--- a/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffect.h
@@ -1,89 +1,89 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COLORMATRIXEFFECT_H
#define COLORMATRIXEFFECT_H
#include "KoFilterEffect.h"
#include <QVector>
#define ColorMatrixEffectId "feColorMatrix"
/// A color matrix effect
class ColorMatrixEffect : public KoFilterEffect
{
public:
enum Type {
Matrix,
Saturate,
HueRotate,
LuminanceAlpha
};
ColorMatrixEffect();
/// Returns the type of the color matrix
Type type() const;
/// Returns the size of the color matrix
static int colorMatrixSize();
/// Returns the row count of the color matrix
static int colorMatrixRowCount();
/// Returns the column count of the color matrix
static int colorMatrixColumnCount();
QVector<qreal> colorMatrix() const;
/// Sets a color matrix and changes type to Matrix
void setColorMatrix(const QVector<qreal> &matrix);
/// Sets a saturate value and changes type to Saturate
void setSaturate(qreal value);
/// Returns the saturate value if type == Saturate
qreal saturate() const;
/// Sets a hue rotate value and changes type to HueRotate
void setHueRotate(qreal value);
/// Returns the saturate value if type == HueRotate
qreal hueRotate() const;
/// Sets luminance alpha an changes type to LuminanceAlpha
void setLuminanceAlpha();
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
/// sets color matrix to identity matrix
void setIdentity();
Type m_type; ///< the color matrix type
QVector<qreal> m_matrix; ///< the color matrix to apply
qreal m_value; ///< the value (saturate or hueRotate)
};
#endif // COLORMATRIXEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectConfigWidget.h
index aee2674db4..2c2f0dd7cd 100644
--- a/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectConfigWidget.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COLORMATRIXEFFECTCONFIGWIDGET_H
#define COLORMATRIXEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class ColorMatrixEffect;
class KoFilterEffect;
class KComboBox;
class QStackedWidget;
class QDoubleSpinBox;
class MatrixDataModel;
class ColorMatrixEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit ColorMatrixEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void matrixChanged();
void saturateChanged(double saturate);
void hueRotateChanged(double angle);
void typeChanged(int index);
private:
KComboBox *m_type;
ColorMatrixEffect *m_effect;
MatrixDataModel *m_matrixModel;
QStackedWidget *m_stack;
QDoubleSpinBox *m_saturate;
QDoubleSpinBox *m_hueRotate;
};
#endif // COLORMATRIXEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectFactory.h
index 2f63506fb5..85288e9bfb 100644
--- a/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/ColorMatrixEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COLORMATRIXEFFECTFACTORY_H
#define COLORMATRIXEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class ColorMatrixEffectFactory : public KoFilterEffectFactoryBase
{
public:
ColorMatrixEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // COLORMATRIXEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffect.h b/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffect.h
index fff238ce7d..d5706cd692 100644
--- a/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffect.h
@@ -1,128 +1,128 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COMPONENTTRANSFEREFFECT_H
#define COMPONENTTRANSFEREFFECT_H
#include "KoFilterEffect.h"
#define ComponentTransferEffectId "feComponentTransfer"
/// A component transfer effect
class ComponentTransferEffect : public KoFilterEffect
{
public:
/// the different transfer functions
enum Function {
Identity,
Table,
Discrete,
Linear,
Gamma
};
/// the different color channels
enum Channel {
ChannelR,
ChannelG,
ChannelB,
ChannelA
};
ComponentTransferEffect();
/// Returns the component transfer function of the specified channel
Function function(Channel channel) const;
/// Sets the component transfer function to use for the specified channel
void setFunction(Channel channel, Function function);
/// Returns the lookup table for the specified channel
QList<qreal> tableValues(Channel channel) const;
/// Sets the lookup table for the specified channel
void setTableValues(Channel channel, QList<qreal> tableValues);
/// Sets the slope for the specified channel
void setSlope(Channel channel, qreal slope);
/// Returns the slope for the specified channel
qreal slope(Channel channel) const;
/// Sets the intercept for the specified channel
void setIntercept(Channel channel, qreal intercept);
/// Returns the intercept for the specified channel
qreal intercept(Channel channel) const;
/// Sets the amplitude for the specified channel
void setAmplitude(Channel channel, qreal amplitude);
/// Returns the amplitude for the specified channel
qreal amplitude(Channel channel) const;
/// Sets the exponent for the specified channel
void setExponent(Channel channel, qreal exponent);
/// Returns the exponent for the specified channel
qreal exponent(Channel channel) const;
/// Sets the offset for the specified channel
void setOffset(Channel channel, qreal offset);
/// Returns the offset for the specified channel
qreal offset(Channel channel) const;
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
/// loads channel transfer function from given xml element
void loadChannel(Channel channel, const KoXmlElement &element);
/// saves channel transfer function to given xml writer
void saveChannel(Channel channel, KoXmlWriter &writer);
/// transfers color channel
qreal transferChannel(Channel channel, qreal value) const;
struct Data {
Data()
: function(Identity), slope(1.0), intercept(0.0)
, amplitude(1.0), exponent(1.0), offset(0.0)
{
}
Function function; ///< the component transfer function
QList<qreal> tableValues; ///< lookup table for table or discrete function
qreal slope; ///< slope for linear function
qreal intercept; ///< intercept for linear function
qreal amplitude; ///< amplitude for gamma function
qreal exponent; ///< exponent for gamma function
qreal offset; ///< offset for gamma function
};
Data m_data[4];
};
#endif // COMPONENTTRANSFEREFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectConfigWidget.h
index a38082252b..6d438e6d18 100644
--- a/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectConfigWidget.h
@@ -1,67 +1,67 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COMPONENTTRANSFEREFFECTCONFIGWIDGET_H
#define COMPONENTTRANSFEREFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
#include "ComponentTransferEffect.h"
class KoFilterEffect;
class QDoubleSpinBox;
class KComboBox;
class KLineEdit;
class QStackedWidget;
class ComponentTransferEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit ComponentTransferEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void slopeChanged(double slope);
void interceptChanged(double intercept);
void amplitudeChanged(double amplitude);
void exponentChanged(double exponent);
void offsetChanged(double offset);
void functionChanged(int index);
void channelSelected(int channel);
void tableValuesChanged();
void discreteValuesChanged();
private:
void updateControls();
ComponentTransferEffect *m_effect;
KComboBox *m_function;
QStackedWidget *m_stack;
KLineEdit *m_tableValues;
KLineEdit *m_discreteValues;
QDoubleSpinBox *m_slope;
QDoubleSpinBox *m_intercept;
QDoubleSpinBox *m_amplitude;
QDoubleSpinBox *m_exponent;
QDoubleSpinBox *m_offset;
ComponentTransferEffect::Channel m_currentChannel;
};
#endif // COMPONENTTRANSFEREFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectFactory.h
index dee5a16742..51f10d4d1d 100644
--- a/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/ComponentTransferEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COMPONENTTRANSFEREFFECTFACTORY_H
#define COMPONENTTRANSFEREFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class ComponentTransferEffectFactory : public KoFilterEffectFactoryBase
{
public:
ComponentTransferEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // COMPONENTTRANSFEREFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/CompositeEffect.h b/plugins/tools/karbonplugins/filtereffects/CompositeEffect.h
index 48628361a5..143506e943 100644
--- a/plugins/tools/karbonplugins/filtereffects/CompositeEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/CompositeEffect.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COMPOSITEEFFECT_H
#define COMPOSITEEFFECT_H
#include "KoFilterEffect.h"
#define CompositeEffectId "feComposite"
/// A flood fill effect
class CompositeEffect : public KoFilterEffect
{
public:
enum Operation {
CompositeOver,
CompositeIn,
CompositeOut,
CompositeAtop,
CompositeXor,
Arithmetic
};
CompositeEffect();
/// Returns the composite operation
Operation operation() const;
/// Sets the composite operation
void setOperation(Operation op);
/// Returns the arithmetic values
const qreal *arithmeticValues() const;
/// Sets the arithmetic values
void setArithmeticValues(qreal *values);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const;
+ QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
Operation m_operation;
qreal m_k[4];
};
#endif // COMPOSITEEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/CompositeEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/CompositeEffectConfigWidget.h
index 32c7536d9a..475d7970ff 100644
--- a/plugins/tools/karbonplugins/filtereffects/CompositeEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/CompositeEffectConfigWidget.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COMPOSITEEFFECTCONFIGWIDGET_H
#define COMPOSITEEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class CompositeEffect;
class QDoubleSpinBox;
class KComboBox;
class CompositeEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit CompositeEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void valueChanged();
void operationChanged(int index);
private:
CompositeEffect *m_effect;
KComboBox *m_operation;
QDoubleSpinBox *m_k[4];
QWidget *m_arithmeticWidget;
};
#endif // COMPOSITEEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/CompositeEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/CompositeEffectFactory.h
index 40b93ce122..1495393903 100644
--- a/plugins/tools/karbonplugins/filtereffects/CompositeEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/CompositeEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef COMPOSITEEFFECTFACTORY_H
#define COMPOSITEEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class CompositeEffectFactory : public KoFilterEffectFactoryBase
{
public:
CompositeEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // COMPOSITEEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffect.h b/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffect.h
index 44b418a04f..ea673e35cc 100644
--- a/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffect.h
@@ -1,106 +1,106 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CONVOLVEMATRIXEFFECT_H
#define CONVOLVEMATRIXEFFECT_H
#include "KoFilterEffect.h"
#include <QPointF>
#include <QVector>
#define ConvolveMatrixEffectId "feConvolveMatrix"
class KoFilterEffectLoadingContext;
/// A convolve matrix effect
class ConvolveMatrixEffect : public KoFilterEffect
{
public:
/// Edge mode, i.e. how the kernel behaves at image edges
enum EdgeMode {
Duplicate, ///< duplicates colors at the edges
Wrap, ///< takes the colors at the opposite edge
None ///< uses values of zero for each color channel
};
ConvolveMatrixEffect();
/// Returns the order of the kernel matrix
QPoint order() const;
/// Sets the order of the kernel matrix
void setOrder(const QPoint &order);
/// Returns the kernel matrix
QVector<qreal> kernel() const;
/// Sets the kernel matrix
void setKernel(const QVector<qreal> &kernel);
/// Returns the divisor
qreal divisor() const;
/// Sets the divisor
void setDivisor(qreal divisor);
/// Returns the bias
qreal bias() const;
/// Sets the bias
void setBias(qreal bias);
/// Returns the target cell within the kernel
QPoint target() const;
/// Sets the target cell within the kernel
void setTarget(const QPoint &target);
/// Returns edge mode
EdgeMode edgeMode() const;
/// Sets the edge mode
void setEdgeMode(EdgeMode edgeMode);
/// Returns if alpha values are preserved
bool isPreserveAlphaEnabled() const;
/// Enables/disables preserving alpha values
void enablePreserveAlpha(bool on);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
void setDefaults();
QPoint m_order; ///< the dimension of the kernel
QVector<qreal> m_kernel; ///< the kernel
qreal m_divisor; ///< the divisor
qreal m_bias; ///< the bias
QPoint m_target; ///< target cell within the kernel
EdgeMode m_edgeMode; ///< the edge mode
QPointF m_kernelUnitLength; ///< the kernel unit length
bool m_preserveAlpha; ///< indicates if original alpha values are left intact
};
#endif // CONVOLVEMATRIXEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectConfigWidget.h
index 15883526f1..e32bbf9fac 100644
--- a/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectConfigWidget.h
@@ -1,64 +1,64 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CONVOLVEMATRIXEFFECTCONFIGWIDGET_H
#define CONVOLVEMATRIXEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class QDoubleSpinBox;
class KoFilterEffect;
class ConvolveMatrixEffect;
class KComboBox;
class QSpinBox;
class QCheckBox;
class MatrixDataModel;
class ConvolveMatrixEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit ConvolveMatrixEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void orderChanged(int value);
void targetChanged(int value);
void divisorChanged(double divisor);
void biasChanged(double bias);
void edgeModeChanged(int mode);
void preserveAlphaChanged(bool checked);
void editKernel();
void kernelChanged();
private:
ConvolveMatrixEffect *m_effect;
KComboBox *m_edgeMode;
QSpinBox *m_orderX;
QSpinBox *m_orderY;
QSpinBox *m_targetX;
QSpinBox *m_targetY;
QDoubleSpinBox *m_divisor;
QDoubleSpinBox *m_bias;
QCheckBox *m_preserveAlpha;
MatrixDataModel *m_matrixModel;
};
#endif // CONVOLVEMATRIXEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectFactory.h
index 4111cdbdb5..437a065c6a 100644
--- a/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/ConvolveMatrixEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef CONVOLVEMATRIXEFFECTFACTORY_H
#define CONVOLVEMATRIXEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class ConvolveMatrixEffectFactory : public KoFilterEffectFactoryBase
{
public:
ConvolveMatrixEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // CONVOLVEMATRIXEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/FilterEffectsPlugin.h b/plugins/tools/karbonplugins/filtereffects/FilterEffectsPlugin.h
index 120aa64a53..c29db0df23 100644
--- a/plugins/tools/karbonplugins/filtereffects/FilterEffectsPlugin.h
+++ b/plugins/tools/karbonplugins/filtereffects/FilterEffectsPlugin.h
@@ -1,33 +1,33 @@
/* This file is part of the KDE project
* Copyright (C) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KARBONFILTEREFFECTSPLUGIN_H
#define KARBONFILTEREFFECTSPLUGIN_H
#include <QObject>
class FilterEffectsPlugin : public QObject
{
Q_OBJECT
public:
FilterEffectsPlugin(QObject *parent, const QList<QVariant> &);
- ~FilterEffectsPlugin() {}
+ ~FilterEffectsPlugin() override {}
};
#endif // KARBONFILTEREFFECTSPLUGIN_H
diff --git a/plugins/tools/karbonplugins/filtereffects/FloodEffect.h b/plugins/tools/karbonplugins/filtereffects/FloodEffect.h
index 061cd9e363..724fea492d 100644
--- a/plugins/tools/karbonplugins/filtereffects/FloodEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/FloodEffect.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FLOODEFFECT_H
#define FLOODEFFECT_H
#include "KoFilterEffect.h"
#include <QColor>
#define FloodEffectId "feFlood"
class KoFilterEffectLoadingContext;
/// A flood fill effect
class FloodEffect : public KoFilterEffect
{
public:
FloodEffect();
QColor floodColor() const;
void setFloodColor(const QColor &color);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
QColor m_color;
};
#endif // FLOODEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/FloodEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/FloodEffectConfigWidget.h
index 631dbdcf6f..40aa5a988c 100644
--- a/plugins/tools/karbonplugins/filtereffects/FloodEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/FloodEffectConfigWidget.h
@@ -1,46 +1,46 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FLOODEFFECTCONFIGWIDGET_H
#define FLOODEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class FloodEffect;
class KoColorPopupAction;
class FloodEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit FloodEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void colorChanged();
private:
FloodEffect *m_effect;
KoColorPopupAction *m_actionStopColor;
};
#endif // FLOODEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/FloodEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/FloodEffectFactory.h
index d59f78e406..432a7c6362 100644
--- a/plugins/tools/karbonplugins/filtereffects/FloodEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/FloodEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FLOODEFFECTFACTORY_H
#define FLOODEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class FloodEffectFactory : public KoFilterEffectFactoryBase
{
public:
FloodEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // FLOODEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ImageEffect.h b/plugins/tools/karbonplugins/filtereffects/ImageEffect.h
index d5f91a1ec3..b81ede9a72 100644
--- a/plugins/tools/karbonplugins/filtereffects/ImageEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/ImageEffect.h
@@ -1,52 +1,52 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef IMAGEEFFECT_H
#define IMAGEEFFECT_H
#include "KoFilterEffect.h"
#include <QImage>
#define ImageEffectId "feImage"
/// An image offset effect
class ImageEffect : public KoFilterEffect
{
public:
ImageEffect();
/// Returns the image
QImage image() const;
/// Sets the image
void setImage(const QImage &image);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
QImage m_image;
QRectF m_bound;
};
#endif // IMAGEEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ImageEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/ImageEffectConfigWidget.h
index 7b45d6c831..dfe635723d 100644
--- a/plugins/tools/karbonplugins/filtereffects/ImageEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/ImageEffectConfigWidget.h
@@ -1,46 +1,46 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef IMAGEEFFECTCONFIGWIDGET_H
#define IMAGEEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class ImageEffect;
class QLabel;
class ImageEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit ImageEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void selectImage();
private:
ImageEffect *m_effect;
QLabel *m_image;
};
#endif // IMAGEEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/ImageEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/ImageEffectFactory.h
index 8e5ec58d54..22e0192ee4 100644
--- a/plugins/tools/karbonplugins/filtereffects/ImageEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/ImageEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef IMAGEEFFECTFACTORY_H
#define IMAGEEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class ImageEffectFactory : public KoFilterEffectFactoryBase
{
public:
ImageEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // IMAGEEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MatrixDataModel.h b/plugins/tools/karbonplugins/filtereffects/MatrixDataModel.h
index 795d6c0d8e..65cbc5953b 100644
--- a/plugins/tools/karbonplugins/filtereffects/MatrixDataModel.h
+++ b/plugins/tools/karbonplugins/filtereffects/MatrixDataModel.h
@@ -1,55 +1,55 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MATRIXDATAMODEL_H
#define MATRIXDATAMODEL_H
#include <QAbstractTableModel>
#include <QVector>
class MatrixDataModel : public QAbstractTableModel
{
public:
/// Creates a new matrix data model
explicit MatrixDataModel(QObject *parent = 0);
/// Sets the matrix data and rows/columns to use
void setMatrix(const QVector<qreal> &matrix, int rows, int cols);
/// Returns the matrix data
QVector<qreal> matrix() const;
// reimplemented
- int rowCount(const QModelIndex &/*parent*/) const;
+ int rowCount(const QModelIndex &/*parent*/) const override;
// reimplemented
- int columnCount(const QModelIndex &/*parent*/) const;
+ int columnCount(const QModelIndex &/*parent*/) const override;
// reimplemented
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
// reimplemented
- bool setData(const QModelIndex &index, const QVariant &value, int /*role*/);
+ bool setData(const QModelIndex &index, const QVariant &value, int /*role*/) override;
// reimplemented
- Qt::ItemFlags flags(const QModelIndex &/*index*/) const;
+ Qt::ItemFlags flags(const QModelIndex &/*index*/) const override;
private:
QVector<qreal> m_matrix; ///< the matrix data to handle
int m_rows; ///< the number or rows in the matrix
int m_cols; ///< the number of columns in the matrix
};
#endif // MATRIXDATAMODEL_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MergeEffect.h b/plugins/tools/karbonplugins/filtereffects/MergeEffect.h
index 521db7c0b5..93ea481eb5 100644
--- a/plugins/tools/karbonplugins/filtereffects/MergeEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/MergeEffect.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MERGEEFFECT_H
#define MERGEEFFECT_H
#include "KoFilterEffect.h"
#define MergeEffectId "feMerge"
/// A gaussian blur effect
class MergeEffect : public KoFilterEffect
{
public:
MergeEffect();
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const;
+ QImage processImages(const QList<QImage> &images, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
};
#endif // MERGEEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MergeEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/MergeEffectConfigWidget.h
index b896528da4..2c22881cd5 100644
--- a/plugins/tools/karbonplugins/filtereffects/MergeEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/MergeEffectConfigWidget.h
@@ -1,43 +1,43 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MERGEEFFECTCONFIGWIDGET_H
#define MERGEEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class MergeEffect;
class MergeEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit MergeEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
private:
MergeEffect *m_effect;
};
#endif // MERGEEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MergeEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/MergeEffectFactory.h
index 7263ab32f0..b18026e7e4 100644
--- a/plugins/tools/karbonplugins/filtereffects/MergeEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/MergeEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MERGEEFFECTFACTORY_H
#define MERGEEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class MergeEffectFactory : public KoFilterEffectFactoryBase
{
public:
MergeEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // MERGEEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MorphologyEffect.h b/plugins/tools/karbonplugins/filtereffects/MorphologyEffect.h
index 88d5a0d006..9d91520275 100644
--- a/plugins/tools/karbonplugins/filtereffects/MorphologyEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/MorphologyEffect.h
@@ -1,66 +1,66 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MORPHOLOGYEFFECT_H
#define MORPHOLOGYEFFECT_H
#include "KoFilterEffect.h"
#include <QPointF>
#define MorphologyEffectId "feMorphology"
class KoFilterEffectLoadingContext;
/// A morphology filter effect
class MorphologyEffect : public KoFilterEffect
{
public:
/// Morphology operator type
enum Operator {
Erode,
Dilate
};
MorphologyEffect();
/// Returns the morphology radius
QPointF morphologyRadius() const;
/// Sets the morphology radius
void setMorphologyRadius(const QPointF &radius);
/// Returns the morphology operator
Operator morphologyOperator() const;
/// Sets the morphology operator
void setMorphologyOperator(Operator op);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
QPointF m_radius;
Operator m_operator;
};
#endif // MORPHOLOGYEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MorphologyEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/MorphologyEffectConfigWidget.h
index beabba030d..f0b68afcf7 100644
--- a/plugins/tools/karbonplugins/filtereffects/MorphologyEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/MorphologyEffectConfigWidget.h
@@ -1,50 +1,50 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MORPHOLOGYEFFECTCONFIGWIDGET_H
#define MORPHOLOGYEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class MorphologyEffect;
class QDoubleSpinBox;
class QButtonGroup;
class MorphologyEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit MorphologyEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void radiusXChanged(double x);
void radiusYChanged(double y);
void operatorChanged(int op);
private:
MorphologyEffect *m_effect;
QButtonGroup *m_operator;
QDoubleSpinBox *m_radiusX;
QDoubleSpinBox *m_radiusY;
};
#endif // MORPHOLOGYEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/MorphologyEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/MorphologyEffectFactory.h
index eabfcc7ea9..1706120062 100644
--- a/plugins/tools/karbonplugins/filtereffects/MorphologyEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/MorphologyEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MORPHOLOGYEFFECTFACTORY_H
#define MORPHOLOGYEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class MorphologyEffectFactory : public KoFilterEffectFactoryBase
{
public:
MorphologyEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // MORPHOLOGYEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/filtereffects/OffsetEffect.h b/plugins/tools/karbonplugins/filtereffects/OffsetEffect.h
index bad9a55d24..9543ade734 100644
--- a/plugins/tools/karbonplugins/filtereffects/OffsetEffect.h
+++ b/plugins/tools/karbonplugins/filtereffects/OffsetEffect.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef OFFSETEFFECT_H
#define OFFSETEFFECT_H
#include "KoFilterEffect.h"
#include <QPointF>
#define OffsetEffectId "feOffset"
/// An image offset effect
class OffsetEffect : public KoFilterEffect
{
public:
OffsetEffect();
QPointF offset() const;
void setOffset(const QPointF &offset);
/// reimplemented from KoFilterEffect
- virtual QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const;
+ QImage processImage(const QImage &image, const KoFilterEffectRenderContext &context) const override;
/// reimplemented from KoFilterEffect
- virtual bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context);
+ bool load(const KoXmlElement &element, const KoFilterEffectLoadingContext &context) override;
/// reimplemented from KoFilterEffect
- virtual void save(KoXmlWriter &writer);
+ void save(KoXmlWriter &writer) override;
private:
QPointF m_offset;
};
#endif // OFFSETEFFECT_H
diff --git a/plugins/tools/karbonplugins/filtereffects/OffsetEffectConfigWidget.h b/plugins/tools/karbonplugins/filtereffects/OffsetEffectConfigWidget.h
index 995713d7a1..9bd17de7a3 100644
--- a/plugins/tools/karbonplugins/filtereffects/OffsetEffectConfigWidget.h
+++ b/plugins/tools/karbonplugins/filtereffects/OffsetEffectConfigWidget.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef OFFSETEFFECTCONFIGWIDGET_H
#define OFFSETEFFECTCONFIGWIDGET_H
#include "KoFilterEffectConfigWidgetBase.h"
class KoFilterEffect;
class OffsetEffect;
class QDoubleSpinBox;
class OffsetEffectConfigWidget : public KoFilterEffectConfigWidgetBase
{
Q_OBJECT
public:
explicit OffsetEffectConfigWidget(QWidget *parent = 0);
/// reimplemented from KoFilterEffectConfigWidgetBase
- virtual bool editFilterEffect(KoFilterEffect *filterEffect);
+ bool editFilterEffect(KoFilterEffect *filterEffect) override;
private Q_SLOTS:
void offsetChanged(double offset);
private:
OffsetEffect *m_effect;
QDoubleSpinBox *m_offsetX;
QDoubleSpinBox *m_offsetY;
};
#endif // OFFSETEFFECTCONFIGWIDGET_H
diff --git a/plugins/tools/karbonplugins/filtereffects/OffsetEffectFactory.h b/plugins/tools/karbonplugins/filtereffects/OffsetEffectFactory.h
index 9432b5c7a1..679c9a56c2 100644
--- a/plugins/tools/karbonplugins/filtereffects/OffsetEffectFactory.h
+++ b/plugins/tools/karbonplugins/filtereffects/OffsetEffectFactory.h
@@ -1,35 +1,35 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef OFFSETEFFECTFACTORY_H
#define OFFSETEFFECTFACTORY_H
#include "KoFilterEffectFactoryBase.h"
class KoFilterEffect;
class OffsetEffectFactory : public KoFilterEffectFactoryBase
{
public:
OffsetEffectFactory();
- virtual KoFilterEffect *createFilterEffect() const;
- virtual KoFilterEffectConfigWidgetBase *createConfigWidget() const;
+ KoFilterEffect *createFilterEffect() const override;
+ KoFilterEffectConfigWidgetBase *createConfigWidget() const override;
};
#endif // OFFSETEFFECTFACTORY_H
diff --git a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShape.h b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShape.h
index 356dbcda67..45bdebc722 100644
--- a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShape.h
+++ b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShape.h
@@ -1,151 +1,151 @@
/* This file is part of the KDE project
Copyright (C) 2008 Fela Winkelmolen <fela.kde@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KARBONCALLIGRAPHICSHAPE_H
#define KARBONCALLIGRAPHICSHAPE_H
#include <KoParameterShape.h>
#define KarbonCalligraphicShapeId "KarbonCalligraphicShape"
class KarbonCalligraphicPoint
{
public:
KarbonCalligraphicPoint(const QPointF &point, qreal angle, qreal width)
: m_point(point), m_angle(angle), m_width(width) {}
QPointF point() const
{
return m_point;
}
qreal angle() const
{
return m_angle;
}
qreal width() const
{
return m_width;
}
void setPoint(const QPointF &point)
{
m_point = point;
}
void setAngle(qreal angle)
{
m_angle = angle;
}
private:
QPointF m_point; // in shape coordinates
qreal m_angle;
qreal m_width;
};
/*class KarbonCalligraphicShape::Point
{
public:
KoPainterPath(KoPathPoint *point) : m_prev(point), m_next(0) {}
// calculates the effective point
QPointF point() {
if (m_next = 0)
return m_prev.point();
// m_next != 0
qDebug() << "not implemented yet!!!!";
return QPointF();
}
private:
KoPainterPath m_prev;
KoPainterPath m_next;
qreal m_percentage;
};*/
// the indexes of the path will be similar to:
// 7--6--5--4 <- pointCount() / 2
// start | | end ==> (direction of the stroke)
// 0--1--2--3
class KarbonCalligraphicShape : public KoParameterShape
{
public:
explicit KarbonCalligraphicShape(qreal caps = 0.0);
- ~KarbonCalligraphicShape();
+ ~KarbonCalligraphicShape() override;
KoShape* cloneShape() const override;
void appendPoint(const QPointF &p1, qreal angle, qreal width);
void appendPointToPath(const KarbonCalligraphicPoint &p);
// returns the bounding rect of whan needs to be repainted
// after new points are added
const QRectF lastPieceBoundingRect();
- void setSize(const QSizeF &newSize);
+ void setSize(const QSizeF &newSize) override;
//virtual QPointF normalize();
- QPointF normalize();
+ QPointF normalize() override;
void simplifyPath();
void simplifyGuidePath();
// reimplemented
- virtual QString pathShapeId() const;
+ QString pathShapeId() const override;
protected:
// reimplemented
void moveHandleAction(int handleId,
const QPointF &point,
- Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier) override;
// reimplemented
- void updatePath(const QSizeF &size);
+ void updatePath(const QSizeF &size) override;
private:
KarbonCalligraphicShape(const KarbonCalligraphicShape &rhs);
// auxiliary function that actually insererts the points
// without doing any additional checks
// the points should be given in canvas coordinates
void appendPointsToPathAux(const QPointF &p1, const QPointF &p2);
// function to detect a flip, given the points being inserted
bool flipDetected(const QPointF &p1, const QPointF &p2);
void smoothLastPoints();
void smoothPoint(const int index);
// determine whether the points given are in counterclockwise order or not
// returns +1 if they are, -1 if they are given in clockwise order
// and 0 if they form a degenerate triangle
static int ccw(const QPointF &p1, const QPointF &p2, const QPointF &p3);
//
void addCap(int index1, int index2, int pointIndex, bool inverted = false);
// the actual data then determines it's shape (guide path + data for points)
QList<KarbonCalligraphicPoint *> m_points;
bool m_lastWasFlip;
qreal m_caps;
};
#endif // KARBONCALLIGRAPHICSHAPE_H
diff --git a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShapeFactory.h b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShapeFactory.h
index 374aeaa1cc..a84090d516 100644
--- a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShapeFactory.h
+++ b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphicShapeFactory.h
@@ -1,39 +1,39 @@
/* This file is part of the KDE project
Copyright (C) 2008 Fela Winkelmolen <fela.kde@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KARBONCALLIGRAPHICSHAPEFACTORY_H
#define KARBONCALLIGRAPHICSHAPEFACTORY_H
#include "KoShapeFactoryBase.h"
class KoShape;
/// Factory for ellipse shapes
class KarbonCalligraphicShapeFactory : public KoShapeFactoryBase
{
public:
/// constructor
KarbonCalligraphicShapeFactory();
- virtual ~KarbonCalligraphicShapeFactory();
- virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
- virtual bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const;
+ ~KarbonCalligraphicShapeFactory() override;
+ KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const override;
+ bool supports(const KoXmlElement &e, KoShapeLoadingContext &context) const override;
//virtual QList<KoShapeConfigWidgetBase*> createShapeOptionPanels();
};
#endif // KARBONCALLIGRAPHICSHAPEFACTORY_H
diff --git a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyOptionWidget.h b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyOptionWidget.h
index db4d39aa0f..ae49d5dcb3 100644
--- a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyOptionWidget.h
+++ b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyOptionWidget.h
@@ -1,143 +1,143 @@
/* This file is part of the KDE project
Copyright (C) 2008 Fela Winkelmolen <fela.kde@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KARBONCALLIGRAPHYOPTIONWIDGET_H
#define KARBONCALLIGRAPHYOPTIONWIDGET_H
#include <QWidget>
#include <QMap>
class KComboBox;
class QCheckBox;
class QSpinBox;
class QDoubleSpinBox;
class QToolButton;
class KarbonCalligraphyOptionWidget : public QWidget
{
Q_OBJECT
public:
explicit KarbonCalligraphyOptionWidget();
- ~KarbonCalligraphyOptionWidget();
+ ~KarbonCalligraphyOptionWidget() override;
// emits all signals with the appropriate values
// called once the signals are connected inside KarbonCalligraphyTool
// to make sure all parameters are uptodate
void emitAll();
Q_SIGNALS:
// all the following signals emit user friendly values, not the internal
// values which are instead computed directly by KarbonCalligraphyTool
void usePathChanged(bool);
void usePressureChanged(bool);
void useAngleChanged(bool);
void widthChanged(double);
void thinningChanged(double);
void angleChanged(int);
void fixationChanged(double);
void capsChanged(double);
void massChanged(double);
void dragChanged(double);
public Q_SLOTS:
// needed for the shortcuts
void increaseWidth();
void decreaseWidth();
void increaseAngle();
void decreaseAngle();
private Q_SLOTS:
void loadProfile(const QString &name);
void toggleUseAngle(bool checked);
void updateCurrentProfile();
void saveProfileAs();
void removeProfile();
void setUsePathEnabled(bool enabled);
private:
// TODO: maybe make it a hash?? <QString, QVariant>
// is it needed al all??
struct Profile {
QString name;
int index; // index in the config file
bool usePath;
bool usePressure;
bool useAngle;
qreal width;
qreal thinning;
int angle;
qreal fixation;
qreal caps;
qreal mass;
qreal drag;
};
// convenience functions:
// connects signals and slots
void createConnections();
// if they aren't already added adds the default profiles
// called by the ctor
void addDefaultProfiles();
// laod the profiles from the configuration file
void loadProfiles();
// loads the profile set as current profile in the configuration file
void loadCurrentProfile();
// save a new profile using the values of the input boxes
// if a profile with the same name already exists it will be overwritten
void saveProfile(const QString &name);
// removes the profile from the configuration file, from profiles
// and from the combobox.
// if the profile doesn't exist the function does nothing
void removeProfile(const QString &name);
// returns the position inside profiles of a certain profile
// returns -1 if the profile is not found
int profilePosition(const QString &profileName);
private:
typedef QMap<QString, Profile *> ProfileMap;
ProfileMap m_profiles;
KComboBox *m_comboBox;
QCheckBox *m_usePath;
QCheckBox *m_usePressure;
QCheckBox *m_useAngle;
QDoubleSpinBox *m_widthBox;
QDoubleSpinBox *m_thinningBox;
QSpinBox *m_angleBox;
QDoubleSpinBox *m_capsBox;
QDoubleSpinBox *m_fixationBox;
QDoubleSpinBox *m_massBox;
QDoubleSpinBox *m_dragBox;
QToolButton *m_saveButton;
QToolButton *m_removeButton;
// when true updateCurrentProfile() doesn't do anything
bool m_changingProfile;
};
#endif // KARBONCALLIGRAPHYOPTIONWIDGET_H
diff --git a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.h b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.h
index 2b810a2862..76c3669925 100644
--- a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.h
+++ b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyTool.h
@@ -1,110 +1,110 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Fela Winkelmolen <fela.kde@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KARBONCALLIGRAPHYTOOL_H
#define KARBONCALLIGRAPHYTOOL_H
#include <KoToolBase.h>
#include <KoPathShape.h>
#include <QPointer>
class KoPathShape;
class KarbonCalligraphicShape;
class KarbonCalligraphyTool : public KoToolBase
{
Q_OBJECT
public:
explicit KarbonCalligraphyTool(KoCanvasBase *canvas);
- ~KarbonCalligraphyTool();
+ ~KarbonCalligraphyTool() override;
- void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
- void mousePressEvent(KoPointerEvent *event);
- void mouseMoveEvent(KoPointerEvent *event);
- void mouseReleaseEvent(KoPointerEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
- QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
- virtual void activate(ToolActivation activation, const QSet<KoShape *> &shapes);
- void deactivate();
+ void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
+ void deactivate() override;
Q_SIGNALS:
void pathSelectedChanged(bool selection);
private Q_SLOTS:
void setUsePath(bool usePath);
void setUsePressure(bool usePressure);
void setUseAngle(bool useAngle);
void setStrokeWidth(double width);
void setThinning(double thinning);
void setAngle(int angle); // set theangle in degrees
void setFixation(double fixation);
void setCaps(double caps);
void setMass(double mass); // set the mass in user friendly format
void setDrag(double drag);
void updateSelectedPath();
private:
void addPoint(KoPointerEvent *event);
// auxiliary function that sets m_angle
void setAngle(KoPointerEvent *event);
// auxiliary functions to calculate the dynamic parameters
// returns the new point and sets speed to the speed
QPointF calculateNewPoint(const QPointF &mousePos, QPointF *speed);
qreal calculateWidth(qreal pressure);
qreal calculateAngle(const QPointF &oldSpeed, const QPointF &newSpeed);
QPointF m_lastPoint;
KarbonCalligraphicShape *m_shape;
// used to determine if the device supports tilt
bool m_deviceSupportsTilt;
bool m_usePath; // follow selected path
bool m_usePressure; // use tablet pressure
bool m_useAngle; // use tablet angle
qreal m_strokeWidth;
qreal m_lastWidth;
qreal m_customAngle; // angle set by the user
qreal m_angle; // angle to use, may use the device angle, in radians!!!
qreal m_fixation;
qreal m_thinning;
qreal m_caps;
qreal m_mass; // in raw format (not user friendly)
qreal m_drag; // from 0.0 to 1.0
KoPathShape *m_selectedPath;
QPainterPath m_selectedPathOutline;
qreal m_followPathPosition;
bool m_endOfPath;
QPointF m_lastMousePos;
bool m_isDrawing;
int m_pointCount;
// dynamic parameters
QPointF m_speed; // used as a vector
// last calligraphic shape drawn, if any
KarbonCalligraphicShape *m_lastShape;
};
#endif // KARBONCALLIGRAPHYTOOL_H
diff --git a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyToolFactory.h b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyToolFactory.h
index 6f5450d4eb..8290f26aa6 100644
--- a/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyToolFactory.h
+++ b/plugins/tools/karbonplugins/tools/CalligraphyTool/KarbonCalligraphyToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KARBONCALLIGRAPHYTOOLFACTORY_H_
#define _KARBONCALLIGRAPHYTOOLFACTORY_H_
#include <KoToolFactoryBase.h>
class KarbonCalligraphyToolFactory : public KoToolFactoryBase
{
public:
KarbonCalligraphyToolFactory();
- ~KarbonCalligraphyToolFactory();
+ ~KarbonCalligraphyToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif // _KARBONCALLIGRAPHYTOOLFACTORY_H_
diff --git a/plugins/tools/karbonplugins/tools/KarbonPatternEditStrategy.h b/plugins/tools/karbonplugins/tools/KarbonPatternEditStrategy.h
index ab3d8a406e..5b79d3e336 100644
--- a/plugins/tools/karbonplugins/tools/KarbonPatternEditStrategy.h
+++ b/plugins/tools/karbonplugins/tools/KarbonPatternEditStrategy.h
@@ -1,174 +1,174 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KARBONPATTERNEDITSTRATEGY_H_
#define _KARBONPATTERNEDITSTRATEGY_H_
#include <KoPatternBackground.h>
#include <QBrush>
#include <QSharedPointer>
class KoShape;
class KoViewConverter;
class KoImageCollection;
class QPainter;
class KUndo2Command;
/// The class used for editing a shapes pattern
class KarbonPatternEditStrategyBase
{
public:
/// constructs an edit strategy working on the given shape
explicit KarbonPatternEditStrategyBase(KoShape *shape, KoImageCollection *imageCollection);
/// destroy the edit strategy
virtual ~KarbonPatternEditStrategyBase();
/// painting of the pattern editing handles
virtual void paint(QPainter &painter, const KoViewConverter &converter) const = 0;
/// selects handle at the given position
virtual bool selectHandle(const QPointF &mousePos, const KoViewConverter &converter) = 0;
/// mouse position handling for moving handles
virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) = 0;
/// sets the strategy into editing mode
void setEditing(bool on);
/// checks if strategy is in editing mode
bool isEditing() const
{
return m_editing;
}
/// create the command for changing the shapes background
KUndo2Command *createCommand();
/// schedules a repaint of the shape and gradient handles
void repaint() const;
/// returns the pattern handles bounding rect
virtual QRectF boundingRect() const = 0;
/// returns the actual background brush
virtual QSharedPointer<KoPatternBackground> updatedBackground() = 0;
/// Returns the shape we are working on
KoShape *shape() const;
/// sets the handle radius in pixel used for painting the handles
static void setHandleRadius(uint radius)
{
m_handleRadius = radius;
}
/// returns the actual handle radius in pixel
static uint handleRadius()
{
return m_handleRadius;
}
/// sets the grab sensitivity in pixel used for grabbing the handles
static void setGrabSensitivity(uint grabSensitivity)
{
m_grabSensitivity = grabSensitivity;
}
/// returns the actual grab sensitivity in pixel
static uint grabSensitivity()
{
return m_grabSensitivity;
}
virtual void updateHandles() {}
protected:
/// Returns the image collectio used to create new pattern background
KoImageCollection *imageCollection();
/// Flags the background as modified
void setModified();
/// Returns if background is modified
bool isModified() const;
/// paints a single handle
void paintHandle(QPainter &painter, const KoViewConverter &converter, const QPointF &position) const;
/// checks if mouse position is inside handle rect
bool mouseInsideHandle(const QPointF &mousePos, const QPointF &handlePos, const KoViewConverter &converter) const;
QList<QPointF> m_handles; ///< the list of handles
int m_selectedHandle; ///< index of currently deleted handle or -1 if none selected
QSharedPointer<KoPatternBackground> m_oldFill;
QSharedPointer<KoPatternBackground> m_newFill;
QTransform m_matrix; ///< matrix to map handle into document coordinate system
private:
static uint m_handleRadius; ///< the handle radius for all gradient strategies
static uint m_grabSensitivity; ///< the grab sensitivity
KoShape *m_shape; ///< the shape we are working on
KoImageCollection *m_imageCollection;
bool m_editing; ///< the edit mode flag
bool m_modified; ///< indicated if background was modified
};
/// The class used for editing a shapes pattern
class KarbonPatternEditStrategy : public KarbonPatternEditStrategyBase
{
public:
explicit KarbonPatternEditStrategy(KoShape *shape, KoImageCollection *imageCollection);
- virtual ~KarbonPatternEditStrategy();
- virtual void paint(QPainter &painter, const KoViewConverter &converter) const;
- virtual bool selectHandle(const QPointF &mousePos, const KoViewConverter &converter);
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual QRectF boundingRect() const;
- virtual QSharedPointer<KoPatternBackground> updatedBackground();
+ ~KarbonPatternEditStrategy() override;
+ void paint(QPainter &painter, const KoViewConverter &converter) const override;
+ bool selectHandle(const QPointF &mousePos, const KoViewConverter &converter) override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ QRectF boundingRect() const override;
+ QSharedPointer<KoPatternBackground> updatedBackground() override;
private:
enum Handles { center, direction };
qreal m_normalizedLength; ///< the normalized direction vector length
QPointF m_origin; ///< the pattern handle origin
};
/// The class used for editing a shapes pattern
class KarbonOdfPatternEditStrategy : public KarbonPatternEditStrategyBase
{
public:
explicit KarbonOdfPatternEditStrategy(KoShape *shape, KoImageCollection *imageCollection);
- virtual ~KarbonOdfPatternEditStrategy();
- virtual void paint(QPainter &painter, const KoViewConverter &converter) const;
- virtual bool selectHandle(const QPointF &mousePos, const KoViewConverter &converter);
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
- virtual QRectF boundingRect() const;
- virtual QSharedPointer<KoPatternBackground> updatedBackground();
- virtual void updateHandles();
+ ~KarbonOdfPatternEditStrategy() override;
+ void paint(QPainter &painter, const KoViewConverter &converter) const override;
+ bool selectHandle(const QPointF &mousePos, const KoViewConverter &converter) override;
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
+ QRectF boundingRect() const override;
+ QSharedPointer<KoPatternBackground> updatedBackground() override;
+ void updateHandles() override;
private:
enum Handles { origin, size };
void updateHandles(QSharedPointer<KoPatternBackground> fill);
};
#endif // _KARBONPATTERNEDITSTRATEGY_H_
diff --git a/plugins/tools/karbonplugins/tools/KarbonPatternOptionsWidget.h b/plugins/tools/karbonplugins/tools/KarbonPatternOptionsWidget.h
index 9f37808c09..62e9b63d9e 100644
--- a/plugins/tools/karbonplugins/tools/KarbonPatternOptionsWidget.h
+++ b/plugins/tools/karbonplugins/tools/KarbonPatternOptionsWidget.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KARBONPATTERNOPTIONSWIDGET_H
#define KARBONPATTERNOPTIONSWIDGET_H
#include <KoPatternBackground.h>
#include <QWidget>
class KarbonPatternOptionsWidget : public QWidget
{
Q_OBJECT
public:
explicit KarbonPatternOptionsWidget(QWidget *parent = 0);
- virtual ~KarbonPatternOptionsWidget();
+ ~KarbonPatternOptionsWidget() override;
/// Sets the pattern repeat
void setRepeat(KoPatternBackground::PatternRepeat repeat);
/// Return the pattern repeat
KoPatternBackground::PatternRepeat repeat() const;
/// Returns the pattern reference point identifier
KoPatternBackground::ReferencePoint referencePoint() const;
/// Sets the pattern reference point
void setReferencePoint(KoPatternBackground::ReferencePoint referencePoint);
/// Returns reference point offset in percent of the size to fill
QPointF referencePointOffset() const;
/// Sets the reference point offset in percent of the size to fill
void setReferencePointOffset(const QPointF &offset);
/// Returns tile repeat offset in percent of the size to fill
QPointF tileRepeatOffset() const;
/// Sets the tile repeat offset in percent of the size to fill
void setTileRepeatOffset(const QPointF &offset);
/// Returns the pattern size
QSize patternSize() const;
/// Sets the pattern size
void setPatternSize(const QSize &size);
Q_SIGNALS:
/// is emitted whenever an option has changed
void patternChanged();
private Q_SLOTS:
void updateControls();
private:
class Private;
Private *const d;
};
#endif // KARBONPATTERNOPTIONSWIDGET_H
diff --git a/plugins/tools/karbonplugins/tools/KarbonPatternTool.h b/plugins/tools/karbonplugins/tools/KarbonPatternTool.h
index 7c83f6f1c8..0ccddd7b02 100644
--- a/plugins/tools/karbonplugins/tools/KarbonPatternTool.h
+++ b/plugins/tools/karbonplugins/tools/KarbonPatternTool.h
@@ -1,68 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2007,2009 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KARBONPATTERNTOOL_H_
#define _KARBONPATTERNTOOL_H_
#include <KoToolBase.h>
#include <QMap>
class QPainter;
class KoResource;
class KarbonPatternEditStrategyBase;
class KarbonPatternOptionsWidget;
class KoShape;
class KarbonPatternTool : public KoToolBase
{
Q_OBJECT
public:
explicit KarbonPatternTool(KoCanvasBase *canvas);
- ~KarbonPatternTool();
+ ~KarbonPatternTool() override;
- void paint(QPainter &painter, const KoViewConverter &converter);
- void repaintDecorations();
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
+ void repaintDecorations() override;
- void mousePressEvent(KoPointerEvent *event);
- void mouseMoveEvent(KoPointerEvent *event);
- void mouseReleaseEvent(KoPointerEvent *event);
- void keyPressEvent(QKeyEvent *event);
+ void mousePressEvent(KoPointerEvent *event) override;
+ void mouseMoveEvent(KoPointerEvent *event) override;
+ void mouseReleaseEvent(KoPointerEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
- virtual void activate(ToolActivation activation, const QSet<KoShape *> &shapes);
- void deactivate();
+ void activate(ToolActivation activation, const QSet<KoShape *> &shapes) override;
+ void deactivate() override;
public Q_SLOTS:
- virtual void documentResourceChanged(int key, const QVariant &res);
+ void documentResourceChanged(int key, const QVariant &res) override;
protected:
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
private Q_SLOTS:
void patternSelected(KoResource *resource);
void initialize();
/// updates options widget from selected pattern
void updateOptionsWidget();
void patternChanged();
private:
QMap<KoShape *, KarbonPatternEditStrategyBase *> m_strategies; ///< the list of editing strategies, one for each shape
KarbonPatternEditStrategyBase *m_currentStrategy; ///< the current editing strategy
KarbonPatternOptionsWidget *m_optionsWidget;
};
#endif // _KARBONPATTERNTOOL_H_
diff --git a/plugins/tools/karbonplugins/tools/KarbonPatternToolFactory.h b/plugins/tools/karbonplugins/tools/KarbonPatternToolFactory.h
index fdef9ac9c0..976dffb9c1 100644
--- a/plugins/tools/karbonplugins/tools/KarbonPatternToolFactory.h
+++ b/plugins/tools/karbonplugins/tools/KarbonPatternToolFactory.h
@@ -1,34 +1,34 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KARBONPATTERNTOOLFACTORY_H_
#define _KARBONPATTERNTOOLFACTORY_H_
#include <KoToolFactoryBase.h>
class KarbonPatternToolFactory : public KoToolFactoryBase
{
public:
KarbonPatternToolFactory();
- ~KarbonPatternToolFactory();
+ ~KarbonPatternToolFactory() override;
- KoToolBase *createTool(KoCanvasBase *canvas);
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif // _KARBONPATTERNTOOLFACTORY_H_
diff --git a/plugins/tools/karbonplugins/tools/KarbonToolsPlugin.h b/plugins/tools/karbonplugins/tools/KarbonToolsPlugin.h
index fe75789713..0a88716d94 100644
--- a/plugins/tools/karbonplugins/tools/KarbonToolsPlugin.h
+++ b/plugins/tools/karbonplugins/tools/KarbonToolsPlugin.h
@@ -1,36 +1,36 @@
/* This file is part of the KDE project
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KARBONTOOLSPLUGIN_H_
#define _KARBONTOOLSPLUGIN_H_
#include <QObject>
#include <QVariant>
class KarbonToolsPlugin : public QObject
{
Q_OBJECT
public:
KarbonToolsPlugin(QObject *parent, const QVariantList &);
- ~KarbonToolsPlugin() {}
+ ~KarbonToolsPlugin() override {}
};
#endif // _KARBONTOOLSPLUGIN_H_
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterAddCommand.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterAddCommand.h
index 5fea1eb253..e13bc801e0 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterAddCommand.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterAddCommand.h
@@ -1,45 +1,45 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTERADDCOMMAND_H
#define FILTERADDCOMMAND_H
#include <kundo2command.h>
class KoShape;
class KoFilterEffect;
/// A command do add a new filter effect to a filter effect stack
class FilterAddCommand : public KUndo2Command
{
public:
FilterAddCommand(KoFilterEffect *filterEffect, KoShape *shape, KUndo2Command *parent = 0);
- ~FilterAddCommand();
+ ~FilterAddCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
KoFilterEffect *m_filterEffect;
KoShape *m_shape;
bool m_isAdded;
};
#endif // FILTERADDCOMMAND_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h
index 6293b6082a..d2a76bb65f 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectEditWidget.h
@@ -1,71 +1,71 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTEREFFECTEDITWIDGET_H
#define FILTEREFFECTEDITWIDGET_H
#include "ui_FilterEffectEditWidget.h"
#include "FilterEffectScene.h"
#include <QWidget>
#include <QPointer>
#include <KoCanvasBase.h>
class KoShape;
class KoFilterEffect;
class KoFilterEffectStack;
class FilterEffectEditWidget : public QWidget, Ui::FilterEffectEditWidget
{
Q_OBJECT
public:
explicit FilterEffectEditWidget(QWidget *parent = 0);
- ~FilterEffectEditWidget();
+ ~FilterEffectEditWidget() override;
/// Edits effects of given shape
void editShape(KoShape *shape, KoCanvasBase *canvas);
protected:
/// reimplemented from QWidget
- virtual void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
/// reimplemented from QWidget
- virtual void showEvent(QShowEvent *event);
+ void showEvent(QShowEvent *event) override;
private Q_SLOTS:
void addSelectedEffect();
void removeSelectedItem();
void connectionCreated(ConnectionSource source, ConnectionTarget target);
void addToPresets();
void removeFromPresets();
void presetSelected(KoResource *resource);
void filterChanged();
void sceneSelectionChanged();
void defaultSourceChanged(int);
private:
void fitScene();
void addWidgetForItem(ConnectionSource item);
FilterEffectScene *m_scene;
KoShape *m_shape;
QPointer<KoCanvasBase> m_canvas;
KoFilterEffectStack *m_effects;
ConnectionSource m_currentItem;
KComboBox *m_defaultSourceSelector;
};
#endif // FILTEREFFECTEDITWIDGET_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectResource.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectResource.h
index 79766c641a..5cb4d1dfc2 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectResource.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectResource.h
@@ -1,60 +1,60 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTEREFFECTRESOURCE_H
#define FILTEREFFECTRESOURCE_H
#include <resources/KoResource.h>
#include <KoXmlReader.h>
#include <QDomDocument>
class KoFilterEffectStack;
class FilterEffectResource : public KoResource
{
public:
explicit FilterEffectResource(const QString &filename);
/// reimplemented from KoResource
- virtual bool load();
+ bool load() override;
/// reimplemented from KoResource
- virtual bool loadFromDevice(QIODevice *dev);
+ bool loadFromDevice(QIODevice *dev) override;
/// reimplemented from KoResource
- virtual bool save();
+ bool save() override;
/// reimplemented from KoResource
- virtual bool saveToDevice(QIODevice *dev) const;
+ bool saveToDevice(QIODevice *dev) const override;
/// reimplemented from KoResource
- virtual QString defaultFileExtension() const;
+ QString defaultFileExtension() const override;
/// Creates resource from given filter effect stack
static FilterEffectResource *fromFilterEffectStack(KoFilterEffectStack *filterStack);
/// Creates a new filter stack from this filter resource
KoFilterEffectStack *toFilterStack() const;
protected:
- virtual QByteArray generateMD5() const;
+ QByteArray generateMD5() const override;
private:
QDomDocument m_data;
};
#endif // FILTEREFFECTRESOURCE_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectScene.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectScene.h
index 40d594662c..e7092e5be5 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectScene.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectScene.h
@@ -1,113 +1,113 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTEREFFECTSCENE_H
#define FILTEREFFECTSCENE_H
#include <QGraphicsScene>
#include <QString>
#include <QMap>
class KoFilterEffect;
class KoFilterEffectStack;
class QGraphicsItem;
class EffectItemBase;
class EffectItem;
class ConnectionItem;
class ConnectionSource
{
public:
enum SourceType {
Effect, ///< a complete effect item
SourceGraphic, ///< SourceGraphic predefined input image
SourceAlpha, ///< SourceAlpha predefined input image
BackgroundImage, ///< BackgroundImage predefined input image
BackgroundAlpha, ///< BackgroundAlpha predefined input image
FillPaint, ///< FillPaint predefined input image
StrokePaint ///< StrokePaint predefined input image
};
ConnectionSource();
ConnectionSource(KoFilterEffect *effect, SourceType type);
/// Returns the source type
SourceType type() const;
/// Returns the corresponding filter effect, or 0 if type == Effect
KoFilterEffect *effect() const;
static SourceType typeFromString(const QString &str);
static QString typeToString(SourceType type);
private:
SourceType m_type; ///< the source type
KoFilterEffect *m_effect; ///< the corresponding effect if type == Effect, 0 otherwise
};
class ConnectionTarget
{
public:
ConnectionTarget();
ConnectionTarget(KoFilterEffect *effect, int inputIndex);
/// Returns the target input index
int inputIndex() const;
/// Returns the corresponding filter effect
KoFilterEffect *effect() const;
private:
int m_inputIndex; ///< the index of the input of the target effect
KoFilterEffect *m_effect; ///< the target effect
};
class FilterEffectScene : public QGraphicsScene
{
Q_OBJECT
public:
explicit FilterEffectScene(QObject *parent = 0);
- virtual ~FilterEffectScene();
+ ~FilterEffectScene() override;
/// initializes the scene from the filter effect stack
void initialize(KoFilterEffectStack *effectStack);
/// Returns list of selected effect items
QList<ConnectionSource> selectedEffectItems() const;
Q_SIGNALS:
void connectionCreated(ConnectionSource source, ConnectionTarget target);
protected:
/// reimplemented from QGraphicsScene
- virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
+ void dropEvent(QGraphicsSceneDragDropEvent *event) override;
private Q_SLOTS:
void selectionChanged();
private:
void createEffectItems(KoFilterEffect *effect);
void addSceneItem(QGraphicsItem *item);
void layoutConnections();
void layoutEffects();
QList<QString> m_defaultInputs;
KoFilterEffectStack *m_effectStack;
QList<EffectItemBase *> m_items;
QList<ConnectionItem *> m_connectionItems;
QMap<QString, EffectItemBase *> m_outputs;
QGraphicsProxyWidget *m_defaultInputProxy;
};
#endif // FILTEREFFECTSCENE_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectSceneItems.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectSceneItems.h
index afb0d32fc4..ace528cc94 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectSceneItems.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterEffectSceneItems.h
@@ -1,137 +1,137 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTEREFFECTSCENEITEMS_H
#define FILTEREFFECTSCENEITEMS_H
#include <QGraphicsRectItem>
#include <QGraphicsSceneMouseEvent>
#include <QMimeData>
class KoFilterEffect;
/// Graphics item representing a connector (input/output)
class ConnectorItem : public QGraphicsEllipseItem
{
public:
enum ConnectorType { Input, Output };
ConnectorItem(ConnectorType type, int index, QGraphicsItem *parent);
void setCenter(const QPointF &position);
ConnectorType connectorType();
int connectorIndex() const;
KoFilterEffect *effect() const;
private:
ConnectorType m_type;
int m_index;
};
/// Custom mime data for connector drag and drop
class ConnectorMimeData : public QMimeData
{
public:
explicit ConnectorMimeData(ConnectorItem *connector);
ConnectorItem *connector() const;
private:
ConnectorItem *m_connector;
};
/// Base class for effect items
class EffectItemBase : public QGraphicsRectItem
{
public:
explicit EffectItemBase(KoFilterEffect *effect);
/// Returns the position of the output connector
QPointF outputPosition() const;
/// Returns the position of the specified input connector
QPointF inputPosition(int index) const;
/// Returns the name of the output
QString outputName() const;
/// Returns the size of the connectors
QSizeF connectorSize() const;
/// Returns the corresponding filter effect
KoFilterEffect *effect() const;
protected:
void createText(const QString &text);
void createOutput(const QPointF &position, const QString &name);
void createInput(const QPointF &position);
- virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
- virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
- virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) override;
ConnectorItem *connectorAtPosition(const QPointF &scenePosition);
private:
QPointF m_outputPosition;
QString m_outputName;
QList<QPointF> m_inputPositions;
KoFilterEffect *m_effect;
};
/// Graphics item representing a predefined input image
class DefaultInputItem : public EffectItemBase
{
public:
DefaultInputItem(const QString &name, KoFilterEffect *effect);
private:
QString m_name;
};
/// Graphics item representing a effect primitive
class EffectItem : public EffectItemBase
{
public:
explicit EffectItem(KoFilterEffect *effect);
private:
KoFilterEffect *m_effect;
};
/// Graphics item representing an connection between an output and input
class ConnectionItem : public QGraphicsPathItem
{
public:
ConnectionItem(EffectItemBase *source, EffectItemBase *target, int targetInput);
/// Returns the source item of the connection
EffectItemBase *sourceItem() const;
/// Returns the target item of the connection
EffectItemBase *targetItem() const;
/// Returns the input index of the target item
int targetInput() const;
/// Sets the source item
void setSourceItem(EffectItemBase *source);
/// Set the target item and the corresponding input index
void setTargetItem(EffectItemBase *target, int targetInput);
private:
EffectItemBase *m_source;
EffectItemBase *m_target;
int m_targetInput;
};
#endif // FILTEREFFECTSCENEITEMS_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterInputChangeCommand.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterInputChangeCommand.h
index 29a6f88206..c31e975204 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterInputChangeCommand.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterInputChangeCommand.h
@@ -1,62 +1,62 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTERINPUTCHANGECOMMAND_H
#define FILTERINPUTCHANGECOMMAND_H
#include <kundo2command.h>
class KoShape;
class KoFilterEffect;
struct InputChangeData {
InputChangeData()
: filterEffect(0), inputIndex(-1)
{
}
InputChangeData(KoFilterEffect *effect, int index, const QString &oldIn, const QString &newIn)
: filterEffect(effect), inputIndex(index), oldInput(oldIn), newInput(newIn)
{
}
KoFilterEffect *filterEffect;
int inputIndex;
QString oldInput;
QString newInput;
};
/// A command to change the input of a filter effect
class FilterInputChangeCommand : public KUndo2Command
{
public:
explicit FilterInputChangeCommand(const InputChangeData &data, KoShape *shape = 0, KUndo2Command *parent = 0);
explicit FilterInputChangeCommand(const QList<InputChangeData> &data, KoShape *shape = 0, KUndo2Command *parent = 0);
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
QList<InputChangeData> m_data;
KoShape *m_shape;
};
#endif // FILTERINPUTCHANGECOMMAND_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionChangeCommand.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionChangeCommand.h
index fb20605843..5080e597a5 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionChangeCommand.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionChangeCommand.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTERREGIONCHANGECOMMAND_H
#define FILTERREGIONCHANGECOMMAND_H
#include <kundo2command.h>
#include <QRectF>
class KoShape;
class KoFilterEffect;
/// A command to change the region of a filter effect
class FilterRegionChangeCommand : public KUndo2Command
{
public:
/**
* Creates new command to change filter region of a filter effect
* @param effect the effect to change the filter region of
* @param filterRegion the new filter region to set
* @param shape the shape the filter effect is applied to
* @param parent the parent undo command
*/
explicit FilterRegionChangeCommand(KoFilterEffect *effect, const QRectF &filterRegion, KoShape *shape = 0, KUndo2Command *parent = 0);
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
KoFilterEffect *m_effect; ///< the filter effect we are working on
QRectF m_oldRegion; ///< the old filter region
QRectF m_newRegion; ///< the new filter region
KoShape *m_shape; ///< the shape the effect is applied to, might be zero
};
#endif // FILTERREGIONCHANGECOMMAND_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionEditStrategy.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionEditStrategy.h
index 40201adb28..1f60cc5f02 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionEditStrategy.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRegionEditStrategy.h
@@ -1,54 +1,54 @@
/* This file is part of the KDE project
* Copyright (c) 2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTERREGIONEDITSTRATEGY_H
#define FILTERREGIONEDITSTRATEGY_H
#include <KoInteractionStrategy.h>
#include "KarbonFilterEffectsTool.h"
#include <QRectF>
class KoShape;
class KoFilterEffect;
class FilterRegionEditStrategy : public KoInteractionStrategy
{
public:
FilterRegionEditStrategy(KoToolBase *parent, KoShape *shape, KoFilterEffect *effect, KarbonFilterEffectsTool::EditMode mode);
// reimplemented from KoInteractionStrategy
- virtual void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers);
+ void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override;
// reimplemented from KoInteractionStrategy
- virtual KUndo2Command *createCommand();
+ KUndo2Command *createCommand() override;
// reimplemented from KoInteractionStrategy
- virtual void finishInteraction(Qt::KeyboardModifiers modifiers);
+ void finishInteraction(Qt::KeyboardModifiers modifiers) override;
// reimplemented from KoInteractionStrategy
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
private:
KoFilterEffect *m_effect;
KoShape *m_shape;
QRectF m_sizeRect;
QRectF m_filterRect;
KarbonFilterEffectsTool::EditMode m_editMode;
QPointF m_lastPosition;
};
#endif // FILTERREGIONEDITSTRATEGY_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRemoveCommand.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRemoveCommand.h
index 0fb54efe27..3733b59917 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRemoveCommand.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterRemoveCommand.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTERREMOVECOMMAND_H
#define FILTERREMOVECOMMAND_H
#include <kundo2command.h>
class KoShape;
class KoFilterEffect;
class KoFilterEffectStack;
/// A command do remove a filter effect from a filter effect stack
class FilterRemoveCommand : public KUndo2Command
{
public:
FilterRemoveCommand(int filterEffectIndex, KoFilterEffectStack *filterStack, KoShape *shape, KUndo2Command *parent = 0);
- ~FilterRemoveCommand();
+ ~FilterRemoveCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
KoFilterEffect *m_filterEffect;
KoFilterEffectStack *m_filterStack;
KoShape *m_shape;
bool m_isRemoved;
int m_filterEffectIndex;
};
#endif // FILTERREMOVECOMMAND_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterResourceServerProvider.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterResourceServerProvider.h
index 563492e383..a063dfdf05 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterResourceServerProvider.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterResourceServerProvider.h
@@ -1,53 +1,53 @@
/* This file is part of the KDE project
Copyright (c) 1999 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
Copyright (c) 2005 Sven Langkamp <sven.langkamp@gmail.com>
This library 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 2.1 of the License, or (at your option) any later version.
This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FILTERRESOURCESERVERPROVIDER_H
#define FILTERRESOURCESERVERPROVIDER_H
#include "KoResourceServer.h"
class KoResourceLoaderThread;
class FilterEffectResource;
/// Provides resource server for filter effect resources
class FilterResourceServerProvider : public QObject
{
Q_OBJECT
public:
- virtual ~FilterResourceServerProvider();
+ ~FilterResourceServerProvider() override;
static FilterResourceServerProvider *instance();
KoResourceServer<FilterEffectResource> *filterEffectServer();
private:
FilterResourceServerProvider();
FilterResourceServerProvider(const FilterResourceServerProvider &);
FilterResourceServerProvider operator=(const FilterResourceServerProvider &);
static FilterResourceServerProvider *m_singleton;
KoResourceServer<FilterEffectResource> *m_filterEffectServer;
KoResourceLoaderThread *m_filterEffectThread;
};
#endif // FILTERRESOURCESERVERPROVIDER_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterStackSetCommand.h b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterStackSetCommand.h
index d1929a631b..11c7bd8ad5 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/FilterStackSetCommand.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/FilterStackSetCommand.h
@@ -1,47 +1,47 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef FILTERSTACKSETCOMMAND_H
#define FILTERSTACKSETCOMMAND_H
#include <kundo2command.h>
class KoFilterEffectStack;
class KoShape;
/// Command to set a filter stack on a shape
class FilterStackSetCommand : public KUndo2Command
{
public:
FilterStackSetCommand(KoFilterEffectStack *newStack, KoShape *shape, KUndo2Command *parent = 0);
- ~FilterStackSetCommand();
+ ~FilterStackSetCommand() override;
/// redo the command
- virtual void redo();
+ void redo() override;
/// revert the actions done in redo
- virtual void undo();
+ void undo() override;
private:
KoFilterEffectStack *m_newFilterStack;
KoFilterEffectStack *m_oldFilterStack;
KoShape *m_shape;
bool m_isSet;
};
#endif // FILTERSTACKSETCOMMAND_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsTool.h b/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsTool.h
index 5a67e7a33f..965e3b17cd 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsTool.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsTool.h
@@ -1,75 +1,75 @@
/* This file is part of the KDE project
* Copyright (c) 2009-2010 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KARBONFILTEREFFECTSTOOL_H
#define KARBONFILTEREFFECTSTOOL_H
#include "KoInteractionTool.h"
class KoResource;
class KoInteractionStrategy;
class KarbonFilterEffectsTool : public KoInteractionTool
{
Q_OBJECT
public:
enum EditMode {
None,
MoveAll,
MoveLeft,
MoveRight,
MoveTop,
MoveBottom
};
explicit KarbonFilterEffectsTool(KoCanvasBase *canvas);
- virtual ~KarbonFilterEffectsTool();
+ ~KarbonFilterEffectsTool() override;
/// reimplemented from KoToolBase
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
/// reimplemented from KoToolBase
- virtual void repaintDecorations();
+ void repaintDecorations() override;
/// reimplemented from KoToolBase
- virtual void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
/// reimplemented from KoToolBase
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape *> &shapes) override;
protected:
/// reimplemented from KoToolBase
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
/// reimplemented from KoToolBase
- virtual KoInteractionStrategy *createStrategy(KoPointerEvent *event);
+ KoInteractionStrategy *createStrategy(KoPointerEvent *event) override;
private Q_SLOTS:
void editFilter();
void clearFilter();
void filterChanged();
void filterSelected(int index);
void selectionChanged();
void presetSelected(KoResource *resource);
void regionXChanged(double x);
void regionYChanged(double y);
void regionWidthChanged(double width);
void regionHeightChanged(double height);
private:
class Private;
Private *const d;
};
#endif // KARBONFILTEREFFECTSTOOL_H
diff --git a/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsToolFactory.h b/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsToolFactory.h
index 4cdf04c021..821e2c6ca9 100644
--- a/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsToolFactory.h
+++ b/plugins/tools/karbonplugins/tools/filterEffectTool/KarbonFilterEffectsToolFactory.h
@@ -1,33 +1,33 @@
/* This file is part of the KDE project
* Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net>
*
* This library 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 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KARBONFILTEREFFECTSTOOLFACTORY_H
#define KARBONFILTEREFFECTSTOOLFACTORY_H
#include <KoToolFactoryBase.h>
class KarbonFilterEffectsToolFactory : public KoToolFactoryBase
{
public:
KarbonFilterEffectsToolFactory();
- virtual ~KarbonFilterEffectsToolFactory();
- virtual KoToolBase *createTool(KoCanvasBase *canvas);
+ ~KarbonFilterEffectsToolFactory() override;
+ KoToolBase *createTool(KoCanvasBase *canvas) override;
};
#endif // KARBONFILTEREFFECTSTOOLFACTORY_H
diff --git a/plugins/tools/selectiontools/kis_selection_modifier_mapper.h b/plugins/tools/selectiontools/kis_selection_modifier_mapper.h
index 2e644a0c2f..5e696a016f 100644
--- a/plugins/tools/selectiontools/kis_selection_modifier_mapper.h
+++ b/plugins/tools/selectiontools/kis_selection_modifier_mapper.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE project
* Copyright (C) 2016 Michael Abrahams <miabraha@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_SELECTION_MODIFIER_MAPPER_H_
#define KIS_SELECTION_MODIFIER_MAPPER_H_
/**
* See KisToolSelectBase for usage.
*/
#include "kis_selection.h"
#include <QScopedPointer>
class KisSelectionModifierMapper : public QObject
{
Q_OBJECT
public:
KisSelectionModifierMapper();
- ~KisSelectionModifierMapper();
+ ~KisSelectionModifierMapper() override;
static KisSelectionModifierMapper *instance();
static SelectionAction map(Qt::KeyboardModifiers m);
public Q_SLOTS:
void slotConfigChanged();
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/tools/selectiontools/kis_tool_select_contiguous.cc b/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
index c0cc3127bd..de663a9234 100644
--- a/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
+++ b/plugins/tools/selectiontools/kis_tool_select_contiguous.cc
@@ -1,252 +1,253 @@
/*
* kis_tool_select_contiguous - part of Krayon^WKrita
*
* Copyright (c) 1999 Michael Koch <koch@kde.org>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2012 José Luis Vergara <pentalis@gmail.com>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_tool_select_contiguous.h"
#include <QPainter>
#include <QLayout>
#include <QLabel>
#include <QApplication>
#include <QCheckBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <kis_debug.h>
#include <klocalizedstring.h>
#include <ksharedconfig.h>
#include "KoPointerEvent.h"
#include "KoViewConverter.h"
#include "kis_cursor.h"
#include "kis_selection_manager.h"
#include "kis_image.h"
#include "canvas/kis_canvas2.h"
#include "kis_layer.h"
#include "kis_selection_options.h"
#include "kis_paint_device.h"
#include "kis_fill_painter.h"
#include "kis_pixel_selection.h"
#include "kis_selection_tool_helper.h"
#include "kis_slider_spin_box.h"
#include "kis_paint_device.h"
#include "kis_pixel_selection.h"
#include "tiles3/kis_hline_iterator.h"
KisToolSelectContiguous::KisToolSelectContiguous(KoCanvasBase *canvas)
: KisToolSelectBase<KisTool>(canvas,
KisCursor::load("tool_contiguous_selection_cursor.png", 6, 6),
i18n("Contiguous Area Selection")),
m_fuzziness(20),
m_sizemod(0),
m_feather(0),
m_limitToCurrentLayer(false)
{
setObjectName("tool_select_contiguous");
connect(&m_widgetHelper, &KisSelectionToolConfigWidgetHelper::selectionActionChanged,
this, &KisToolSelectContiguous::setSelectionAction);
}
KisToolSelectContiguous::~KisToolSelectContiguous()
{
}
void KisToolSelectContiguous::activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes)
{
KisTool::activate(toolActivation, shapes);
m_configGroup = KSharedConfig::openConfig()->group(toolId());
}
void KisToolSelectContiguous::beginPrimaryAction(KoPointerEvent *event)
{
KisToolSelectBase::beginPrimaryAction(event);
KisPaintDeviceSP dev;
if (!currentNode() ||
!(dev = currentNode()->projection()) ||
!currentNode()->visible() ||
!selectionEditable()) {
event->ignore();
return;
}
QApplication::setOverrideCursor(KisCursor::waitCursor());
QPoint pos = convertToIntPixelCoord(event);
QRect rc = currentImage()->bounds();
KisFillPainter fillpainter(dev);
fillpainter.setHeight(rc.height());
fillpainter.setWidth(rc.width());
fillpainter.setFillThreshold(m_fuzziness);
fillpainter.setFeather(m_feather);
fillpainter.setSizemod(m_sizemod);
KisImageWSP image = currentImage();
KisPaintDeviceSP sourceDevice = m_limitToCurrentLayer ? dev : image->projection();
image->lock();
KisSelectionSP selection = fillpainter.createFloodSelection(pos.x(), pos.y(), sourceDevice);
image->unlock();
// If we're not antialiasing, threshold the entire selection
if (!antiAliasSelection()) {
QRect r = selection->selectedExactRect();
if (r.isValid()) {
KisHLineIteratorSP selectionIt = selection->pixelSelection()->createHLineIteratorNG(r.x(), r.y(), r.width());
for (qint32 y = 0; y < r.height(); y++) {
do {
if (selectionIt->rawData()[0] > 0) {
selection->pixelSelection()->colorSpace()->setOpacity(selectionIt->rawData(), OPACITY_OPAQUE_U8, 1);
}
} while (selectionIt->nextPixel());
selectionIt->nextRow();
}
}
}
KisCanvas2 * kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
if (!kisCanvas || !selection->pixelSelection()) {
QApplication::restoreOverrideCursor();
return;
}
selection->pixelSelection()->invalidateOutlineCache();
KisSelectionToolHelper helper(kisCanvas, kundo2_i18n("Select Contiguous Area"));
helper.selectPixelSelection(selection->pixelSelection(), selectionAction());
QApplication::restoreOverrideCursor();
}
void KisToolSelectContiguous::paint(QPainter &painter, const KoViewConverter &converter)
{
Q_UNUSED(painter);
Q_UNUSED(converter);
}
void KisToolSelectContiguous::slotSetFuzziness(int fuzziness)
{
m_fuzziness = fuzziness;
m_configGroup.writeEntry("fuzziness", fuzziness);
}
void KisToolSelectContiguous::slotSetSizemod(int sizemod)
{
m_sizemod = sizemod;
m_configGroup.writeEntry("sizemod", sizemod);
}
void KisToolSelectContiguous::slotSetFeather(int feather)
{
m_feather = feather;
m_configGroup.writeEntry("feather", feather);
}
QWidget* KisToolSelectContiguous::createOptionWidget()
{
KisToolSelectBase::createOptionWidget();
KisSelectionOptions *selectionWidget = selectionOptionWidget();
selectionWidget->disableSelectionModeOption();
QVBoxLayout * l = dynamic_cast<QVBoxLayout*>(selectionWidget->layout());
Q_ASSERT(l);
if (l) {
QHBoxLayout * hbox = new QHBoxLayout();
Q_CHECK_PTR(hbox);
l->insertLayout(1, hbox);
QLabel * lbl = new QLabel(i18n("Fuzziness: "), selectionWidget);
hbox->addWidget(lbl);
KisSliderSpinBox *input = new KisSliderSpinBox(selectionWidget);
Q_CHECK_PTR(input);
input->setObjectName("fuzziness");
- input->setRange(0, 200);
- input->setSingleStep(10);
+ input->setRange(1, 100);
+ input->setSingleStep(1);
+ input->setExponentRatio(2);
hbox->addWidget(input);
hbox = new QHBoxLayout();
Q_CHECK_PTR(hbox);
l->insertLayout(2, hbox);
lbl = new QLabel(i18n("Grow/shrink selection: "), selectionWidget);
hbox->addWidget(lbl);
KisSliderSpinBox *sizemod = new KisSliderSpinBox(selectionWidget);
Q_CHECK_PTR(sizemod);
sizemod->setObjectName("sizemod"); //grow/shrink selection
sizemod->setRange(-40, 40);
sizemod->setSingleStep(1);
hbox->addWidget(sizemod);
hbox = new QHBoxLayout();
Q_CHECK_PTR(hbox);
l->insertLayout(3, hbox);
hbox->addWidget(new QLabel(i18n("Feathering radius: "), selectionWidget));
KisSliderSpinBox *feather = new KisSliderSpinBox(selectionWidget);
Q_CHECK_PTR(feather);
feather->setObjectName("feathering");
feather->setRange(0, 40);
feather->setSingleStep(1);
hbox->addWidget(feather);
connect (input , SIGNAL(valueChanged(int)), this, SLOT(slotSetFuzziness(int) ));
connect (sizemod, SIGNAL(valueChanged(int)), this, SLOT(slotSetSizemod(int) ));
connect (feather, SIGNAL(valueChanged(int)), this, SLOT(slotSetFeather(int) ));
QCheckBox* limitToCurrentLayer = new QCheckBox(i18n("Limit to current layer"), selectionWidget);
l->insertWidget(4, limitToCurrentLayer);
connect (limitToCurrentLayer, SIGNAL(stateChanged(int)), this, SLOT(slotLimitToCurrentLayer(int)));
// load configuration settings into tool options
input->setValue(m_configGroup.readEntry("fuzziness", 20)); // fuzziness
sizemod->setValue( m_configGroup.readEntry("sizemod", 0)); //grow/shrink
sizemod->setSuffix(i18n(" px"));
feather->setValue(m_configGroup.readEntry("feather", 0));
feather->setSuffix(i18n(" px"));
limitToCurrentLayer->setChecked(m_configGroup.readEntry("limitToCurrentLayer", false));
}
return selectionWidget;
}
void KisToolSelectContiguous::slotLimitToCurrentLayer(int state)
{
if (state == Qt::PartiallyChecked)
return;
m_limitToCurrentLayer = (state == Qt::Checked);
m_configGroup.writeEntry("limitToCurrentLayer", state);
}
void KisToolSelectContiguous::setSelectionAction(int action)
{
changeSelectionAction(action);
}
diff --git a/plugins/tools/selectiontools/kis_tool_select_contiguous.h b/plugins/tools/selectiontools/kis_tool_select_contiguous.h
index 6bbbf29324..72f4b863d0 100644
--- a/plugins/tools/selectiontools/kis_tool_select_contiguous.h
+++ b/plugins/tools/selectiontools/kis_tool_select_contiguous.h
@@ -1,95 +1,95 @@
/*
* kis_tool_select_contiguous.h - part of KImageShop^WKrayon^Krita
*
* Copyright (c) 1999 Michael Koch <koch@kde.org>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_SELECT_CONTIGUOUS_H__
#define __KIS_TOOL_SELECT_CONTIGUOUS_H__
#include "KoToolFactoryBase.h"
#include "kis_tool_select_base.h"
#include <kis_icon.h>
#include <kconfig.h>
#include <kconfiggroup.h>
/**
* The 'magic wand' selection tool -- in fact just
* a floodfill that only creates a selection.
*/
class KisToolSelectContiguous : public KisToolSelectBase<KisTool>
{
Q_OBJECT
public:
KisToolSelectContiguous(KoCanvasBase *canvas);
- virtual ~KisToolSelectContiguous();
+ ~KisToolSelectContiguous() override;
- virtual QWidget* createOptionWidget();
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ QWidget* createOptionWidget() override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
- void beginPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
protected:
- virtual bool wantsAutoScroll() const { return false; }
+ bool wantsAutoScroll() const override { return false; }
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
virtual void slotSetFuzziness(int);
virtual void slotSetSizemod(int);
virtual void slotSetFeather(int);
virtual void slotLimitToCurrentLayer(int);
void setSelectionAction(int);
//virtual bool antiAliasSelection();
protected:
using KisToolSelectBase::m_widgetHelper;
private:
int m_fuzziness;
int m_sizemod;
int m_feather;
bool m_limitToCurrentLayer;
KConfigGroup m_configGroup;
};
class KisToolSelectContiguousFactory : public KoToolFactoryBase
{
public:
KisToolSelectContiguousFactory()
: KoToolFactoryBase("KisToolSelectContiguous")
{
setToolTip(i18n("Contiguous Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setIconName(koIconNameCStr("tool_contiguous_selection"));
setPriority(4);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolSelectContiguousFactory() {}
+ ~KisToolSelectContiguousFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectContiguous(canvas);
}
};
#endif //__KIS_TOOL_SELECT_CONTIGUOUS_H__
diff --git a/plugins/tools/selectiontools/kis_tool_select_elliptical.h b/plugins/tools/selectiontools/kis_tool_select_elliptical.h
index cfec0ee6fb..3abbddfe3e 100644
--- a/plugins/tools/selectiontools/kis_tool_select_elliptical.h
+++ b/plugins/tools/selectiontools/kis_tool_select_elliptical.h
@@ -1,86 +1,86 @@
/*
* kis_tool_select_elliptical.h - part of Krayon^WKrita
*
* Copyright (c) 2000 John Califf <jcaliff@compuzone.net>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org> *
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_SELECT_ELLIPTICAL_H__
#define __KIS_TOOL_SELECT_ELLIPTICAL_H__
#include "KoToolFactoryBase.h"
#include "kis_tool_ellipse_base.h"
#include <kis_tool_select_base.h>
#include "kis_selection_tool_config_widget_helper.h"
#include <KoIcon.h>
#include <QKeySequence>
#include <kis_icon.h>
class __KisToolSelectEllipticalLocal : public KisToolEllipseBase
{
Q_OBJECT
public:
__KisToolSelectEllipticalLocal(KoCanvasBase *canvas);
protected:
virtual SelectionMode selectionMode() const = 0;
virtual SelectionAction selectionAction() const = 0;
virtual bool antiAliasSelection() const = 0;
private:
- void finishRect(const QRectF &rect);
+ void finishRect(const QRectF &rect) override;
};
typedef KisToolSelectBase<__KisToolSelectEllipticalLocal> KisToolSelectEllipticalTemplate;
class KisToolSelectElliptical : public KisToolSelectEllipticalTemplate
{
Q_OBJECT
public:
KisToolSelectElliptical(KoCanvasBase* canvas);
public Q_SLOTS:
void setSelectionAction(int);
};
class KisToolSelectEllipticalFactory : public KoToolFactoryBase
{
public:
KisToolSelectEllipticalFactory()
: KoToolFactoryBase("KisToolSelectElliptical")
{
setToolTip(i18n("Elliptical Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("tool_elliptical_selection"));
setShortcut(QKeySequence(Qt::Key_J));
setPriority(1);
}
- virtual ~KisToolSelectEllipticalFactory() {}
+ ~KisToolSelectEllipticalFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectElliptical(canvas);
}
};
#endif //__KIS_TOOL_SELECT_ELLIPTICAL_H__
diff --git a/plugins/tools/selectiontools/kis_tool_select_outline.h b/plugins/tools/selectiontools/kis_tool_select_outline.h
index c0f492acd6..7965b649a9 100644
--- a/plugins/tools/selectiontools/kis_tool_select_outline.h
+++ b/plugins/tools/selectiontools/kis_tool_select_outline.h
@@ -1,92 +1,92 @@
/*
* kis_tool_select_freehand.h - part of Krayon^WKrita
*
* Copyright (c) 2000 John Califf <jcaliff@compuzone.net>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SELECT_OUTLINE_H_
#define KIS_TOOL_SELECT_OUTLINE_H_
#include <QPoint>
#include <KoToolFactoryBase.h>
#include <kis_tool_select_base.h>
#include <kis_icon.h>
class QPainterPath;
class KisToolSelectOutline : public KisToolSelect
{
Q_OBJECT
public:
KisToolSelectOutline(KoCanvasBase *canvas);
- virtual ~KisToolSelectOutline();
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
- virtual void paint(QPainter& gc, const KoViewConverter &converter);
+ ~KisToolSelectOutline() override;
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
- void mouseMoveEvent(KoPointerEvent *event);
+ void mouseMoveEvent(KoPointerEvent *event) override;
public Q_SLOTS:
- virtual void deactivate();
+ void deactivate() override;
void setSelectionAction(int);
protected:
using KisToolSelectBase::m_widgetHelper;
private:
void finishSelectionAction();
void updateFeedback();
void updateContinuedMode();
void updateCanvas();
QPainterPath m_paintPath;
vQPointF m_points;
bool m_continuedMode;
QPointF m_lastCursorPos;
};
class KisToolSelectOutlineFactory : public KoToolFactoryBase
{
public:
KisToolSelectOutlineFactory()
: KoToolFactoryBase("KisToolSelectOutline")
{
setToolTip(i18n("Outline Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setIconName(koIconNameCStr("tool_outline_selection"));
setPriority(3);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolSelectOutlineFactory() {}
+ ~KisToolSelectOutlineFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectOutline(canvas);
}
};
#endif //__selecttoolfreehand_h__
diff --git a/plugins/tools/selectiontools/kis_tool_select_path.h b/plugins/tools/selectiontools/kis_tool_select_path.h
index 261fbed4ba..57eb9eaf99 100644
--- a/plugins/tools/selectiontools/kis_tool_select_path.h
+++ b/plugins/tools/selectiontools/kis_tool_select_path.h
@@ -1,107 +1,107 @@
/*
* Copyright (c) 2007 Sven Langkamp <sven.langkamp@gmail.com>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SELECT_PATH_H_
#define KIS_TOOL_SELECT_PATH_H_
#include <KoCreatePathTool.h>
#include <KoToolFactoryBase.h>
#include "kis_tool_select_base.h"
#include "kis_delegated_tool.h"
#include <kis_icon.h>
class KoCanvasBase;
class KisToolSelectPath;
class __KisToolSelectPathLocalTool : public KoCreatePathTool {
public:
__KisToolSelectPathLocalTool(KoCanvasBase * canvas, KisToolSelectPath* parentTool);
- virtual void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter);
- virtual void addPathShape(KoPathShape* pathShape);
+ void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter) override;
+ void addPathShape(KoPathShape* pathShape) override;
using KoCreatePathTool::createOptionWidgets;
using KoCreatePathTool::endPathWithoutLastPoint;
using KoCreatePathTool::endPath;
using KoCreatePathTool::cancelPath;
using KoCreatePathTool::removeLastPoint;
private:
KisToolSelectPath* const m_selectionTool;
};
typedef KisDelegatedTool<KisTool, __KisToolSelectPathLocalTool,
DeselectShapesActivationPolicy> DelegatedSelectPathTool;
struct KisDelegatedSelectPathWrapper : public DelegatedSelectPathTool {
KisDelegatedSelectPathWrapper(KoCanvasBase *canvas,
const QCursor &cursor,
KisTool* delegateTool)
: DelegatedSelectPathTool(canvas, cursor, (__KisToolSelectPathLocalTool*) delegateTool)
{
}
- bool listeningToModifiers();
+ bool listeningToModifiers() override;
// If an event is explicitly forwarded only as an action (e.g. shift-click is captured by "change size")
// we will receive a primary action but no mousePressEvent. Thus these events must be explicitly forwarded.
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
};
class KisToolSelectPath : public KisToolSelectBase<KisDelegatedSelectPathWrapper>
{
Q_OBJECT
public:
KisToolSelectPath(KoCanvasBase * canvas);
- void mousePressEvent(KoPointerEvent* event);
- bool eventFilter(QObject *obj, QEvent *event);
+ void mousePressEvent(KoPointerEvent* event) override;
+ bool eventFilter(QObject *obj, QEvent *event) override;
protected:
- void requestStrokeCancellation();
- void requestStrokeEnd();
- void setAlternateSelectionAction(SelectionAction action);
+ void requestStrokeCancellation() override;
+ void requestStrokeEnd() override;
+ void setAlternateSelectionAction(SelectionAction action) override;
friend class __KisToolSelectPathLocalTool;
- QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
};
class KisToolSelectPathFactory : public KoToolFactoryBase
{
public:
KisToolSelectPathFactory()
: KoToolFactoryBase("KisToolSelectPath") {
setToolTip(i18n("Bezier Curve Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("tool_path_selection"));
setPriority(6);
}
- virtual ~KisToolSelectPathFactory() {}
+ ~KisToolSelectPathFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectPath(canvas);
}
};
#endif // KIS_TOOL_SELECT_PATH_H_
diff --git a/plugins/tools/selectiontools/kis_tool_select_polygonal.h b/plugins/tools/selectiontools/kis_tool_select_polygonal.h
index c746158ee7..d59904bc9c 100644
--- a/plugins/tools/selectiontools/kis_tool_select_polygonal.h
+++ b/plugins/tools/selectiontools/kis_tool_select_polygonal.h
@@ -1,80 +1,80 @@
/*
* kis_tool_select_polygonal.h - part of Krayon^WKrita
*
* Copyright (c) 2000 John Califf <jcaliff@compuzone.net>
* Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SELECT_POLYGONAL_H_
#define KIS_TOOL_SELECT_POLYGONAL_H_
#include "KoToolFactoryBase.h"
#include "kis_tool_polyline_base.h"
#include <kis_tool_select_base.h>
#include "kis_selection_tool_config_widget_helper.h"
#include <kis_icon.h>
class __KisToolSelectPolygonalLocal : public KisToolPolylineBase
{
Q_OBJECT
public:
__KisToolSelectPolygonalLocal(KoCanvasBase *canvas);
protected:
virtual SelectionMode selectionMode() const = 0;
virtual SelectionAction selectionAction() const = 0;
virtual bool antiAliasSelection() const = 0;
private:
- void finishPolyline(const QVector<QPointF> &points);
+ void finishPolyline(const QVector<QPointF> &points) override;
private:
};
class KisToolSelectPolygonal : public KisToolSelectBase<__KisToolSelectPolygonalLocal>
{
Q_OBJECT
public:
KisToolSelectPolygonal(KoCanvasBase* canvas);
public Q_SLOTS:
void setSelectionAction(int);
};
class KisToolSelectPolygonalFactory : public KoToolFactoryBase
{
public:
KisToolSelectPolygonalFactory()
: KoToolFactoryBase("KisToolSelectPolygonal")
{
setToolTip(i18n("Polygonal Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setIconName(koIconNameCStr("tool_polygonal_selection"));
setPriority(2);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolSelectPolygonalFactory() {}
+ ~KisToolSelectPolygonalFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectPolygonal(canvas);
}
};
#endif //__selecttoolpolygonal_h__
diff --git a/plugins/tools/selectiontools/kis_tool_select_rectangular.h b/plugins/tools/selectiontools/kis_tool_select_rectangular.h
index 1d1e3e3173..6ffe624f8e 100644
--- a/plugins/tools/selectiontools/kis_tool_select_rectangular.h
+++ b/plugins/tools/selectiontools/kis_tool_select_rectangular.h
@@ -1,84 +1,84 @@
/*
* kis_tool_select_rectangular.h - part of Krita
*
* Copyright (c) 1999 Michael Koch <koch@kde.org>
* 2002 Patrick Julien <freak@codepimps.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SELECT_RECTANGULAR_H_
#define KIS_TOOL_SELECT_RECTANGULAR_H_
#include "KoToolFactoryBase.h"
#include "kis_tool_rectangle_base.h"
#include <kis_tool_select_base.h>
#include "kis_selection_tool_config_widget_helper.h"
#include <kis_icon.h>
#include <QKeySequence>
class __KisToolSelectRectangularLocal : public KisToolRectangleBase
{
Q_OBJECT
public:
__KisToolSelectRectangularLocal(KoCanvasBase * canvas);
protected:
virtual SelectionMode selectionMode() const = 0;
virtual SelectionAction selectionAction() const = 0;
private:
- void finishRect(const QRectF& rect);
+ void finishRect(const QRectF& rect) override;
};
class KisToolSelectRectangular : public KisToolSelectBase<__KisToolSelectRectangularLocal>
{
Q_OBJECT
public:
KisToolSelectRectangular(KoCanvasBase* canvas);
public Q_SLOTS:
void setSelectionAction(int);
};
class KisToolSelectRectangularFactory : public KoToolFactoryBase
{
public:
KisToolSelectRectangularFactory()
: KoToolFactoryBase("KisToolSelectRectangular")
{
setToolTip(i18n("Rectangular Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("tool_rect_selection"));
setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
setPriority(0);
}
- virtual ~KisToolSelectRectangularFactory() {}
+ ~KisToolSelectRectangularFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectRectangular(canvas);
}
};
#endif // KIS_TOOL_SELECT_RECTANGULAR_H_
diff --git a/plugins/tools/selectiontools/kis_tool_select_similar.h b/plugins/tools/selectiontools/kis_tool_select_similar.h
index 2f3b7562ac..8331c5fe41 100644
--- a/plugins/tools/selectiontools/kis_tool_select_similar.h
+++ b/plugins/tools/selectiontools/kis_tool_select_similar.h
@@ -1,78 +1,78 @@
/*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
* Copyright (c) 2015 Michael Abrahams <miabraha@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SELECT_SIMILAR_H_
#define KIS_TOOL_SELECT_SIMILAR_H_
#include <KoToolFactoryBase.h>
#include <kis_icon.h>
#include <kconfig.h>
#include "kis_tool_select_base.h"
#include <kconfiggroup.h>
/*
* Tool to select colors by pointing at a color on the image.
*/
class KisToolSelectSimilar: public KisToolSelect
{
Q_OBJECT
public:
KisToolSelectSimilar(KoCanvasBase * canvas);
- void beginPrimaryAction(KoPointerEvent *event);
- void paint(QPainter&, const KoViewConverter &) {}
- QWidget* createOptionWidget();
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void paint(QPainter&, const KoViewConverter &) override {}
+ QWidget* createOptionWidget() override;
public Q_SLOTS:
- void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
void slotSetFuzziness(int);
void setSelectionAction(int);
protected:
using KisToolSelectBase::m_widgetHelper;
private:
int m_fuzziness;
KConfigGroup m_configGroup;
};
class KisToolSelectSimilarFactory : public KoToolFactoryBase
{
public:
KisToolSelectSimilarFactory()
: KoToolFactoryBase("KisToolSelectSimilar")
{
setToolTip(i18n("Similar Color Selection Tool"));
setSection(TOOL_TYPE_SELECTION);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("tool_similar_selection"));
setPriority(5);
}
- virtual ~KisToolSelectSimilarFactory() {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ ~KisToolSelectSimilarFactory() override {}
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolSelectSimilar(canvas);
}
};
#endif // KIS_TOOL_SELECT_SIMILAR_H_
diff --git a/plugins/tools/selectiontools/selection_tools.h b/plugins/tools/selectiontools/selection_tools.h
index 5fb0f62061..f297567287 100644
--- a/plugins/tools/selectiontools/selection_tools.h
+++ b/plugins/tools/selectiontools/selection_tools.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2003 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SELECTION_TOOLS_H_
#define SELECTION_TOOLS_H_
#include <QObject>
#include <QVariant>
/**
* A module wrapper around Krita's selection tools.
* Despite the fact that new tools are created for every new view,
* it is not possible to make tools standard parts of the type of the
* imagesize plugin, because we need to create a new set of tools for every
* pointer device (mouse, stylus, eraser, puck, etc.). So this plugin is
* a module which is loaded once into Krita. For every tool there is a factory
* class that is registered with the tool registry, and that is used to create
* new instances of the tools.
*/
class SelectionTools : public QObject
{
Q_OBJECT
public:
SelectionTools(QObject *parent, const QVariantList &);
- virtual ~SelectionTools();
+ ~SelectionTools() override;
};
#endif // SELECTION_TOOLS_H_
diff --git a/plugins/tools/tool_crop/kis_constrained_rect.h b/plugins/tools/tool_crop/kis_constrained_rect.h
index 7917aec024..7ef087ced5 100644
--- a/plugins/tools/tool_crop/kis_constrained_rect.h
+++ b/plugins/tools/tool_crop/kis_constrained_rect.h
@@ -1,108 +1,108 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CONSTRAINED_RECT_H
#define __KIS_CONSTRAINED_RECT_H
#include <QObject>
#include <QRect>
class KisConstrainedRect : public QObject
{
Q_OBJECT
public:
enum HandleType {
None = 0,
UpperLeft,
UpperRight,
LowerLeft,
LowerRight,
Upper,
Lower,
Left,
Right,
Inside,
Creation
};
public:
KisConstrainedRect();
- ~KisConstrainedRect();
+ ~KisConstrainedRect() override;
void setRectInitial(const QRect &rect);
void setCropRect(const QRect &cropRect);
bool centered() const;
void setCentered(bool value);
bool canGrow() const;
void setCanGrow(bool value);
QRect rect() const;
qreal ratio() const;
void moveHandle(HandleType handle, const QPoint &offset, const QRect &oldRect);
QPointF handleSnapPoint(HandleType handle, const QPointF &cursorPos);
void setRatio(qreal value);
void setOffset(const QPoint &offset);
void setWidth(int value);
void setHeight(int value);
bool widthLocked() const;
void setWidthLocked(bool value);
bool heightLocked() const;
void setHeightLocked(bool value);
bool ratioLocked() const;
void setRatioLocked(bool value);
void normalize();
Q_SIGNALS:
void sigValuesChanged();
void sigLockValuesChanged();
private:
int widthFromHeightUnsignedRatio(int height, qreal ratio, int oldWidth) const;
int heightFromWidthUnsignedRatio(int width, qreal ratio, int oldHeight) const;
void assignNewSize(const QSize &newSize);
void storeRatioSafe(const QSize &newSize);
private:
bool m_centered;
bool m_canGrow;
QRect m_rect;
qreal m_ratio;
bool m_lockingEnabled;
bool m_widthLocked;
bool m_heightLocked;
bool m_ratioLocked;
QRect m_cropRect;
};
#endif /* __KIS_CONSTRAINED_RECT_H */
diff --git a/plugins/tools/tool_crop/kis_tool_crop.h b/plugins/tools/tool_crop/kis_tool_crop.h
index e797bfa488..c4653137f1 100644
--- a/plugins/tools/tool_crop/kis_tool_crop.h
+++ b/plugins/tools/tool_crop/kis_tool_crop.h
@@ -1,232 +1,232 @@
/*
* kis_tool_crop.h - part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_CROP_H_
#define KIS_TOOL_CROP_H_
#include <QPoint>
#include <QPainterPath>
#include <kis_icon.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <QKeySequence>
#include <KoToolFactoryBase.h>
#include "kis_tool.h"
#include "flake/kis_node_shape.h"
#include "ui_wdg_tool_crop.h"
#include "kis_constrained_rect.h"
class QRect;
struct DecorationLine;
/**
* Crop tool
*
* TODO: - crop from selection -- i.e, set crop outline to the exact bounds of the selection.
* - (when moving to Qt 4: replace rectangle with darker, dimmer overlay layer
* like we have for selections right now)
*/
class KisToolCrop : public KisTool
{
Q_OBJECT
Q_ENUMS(CropToolType);
Q_PROPERTY(CropToolType cropType READ cropType WRITE setCropType NOTIFY cropTypeChanged);
Q_PROPERTY(bool cropTypeSelectable READ cropTypeSelectable WRITE setCropTypeSelectable NOTIFY cropTypeSelectableChanged);
Q_PROPERTY(int cropX READ cropX WRITE setCropX NOTIFY cropXChanged);
Q_PROPERTY(int cropY READ cropY WRITE setCropY NOTIFY cropYChanged);
Q_PROPERTY(int cropWidth READ cropWidth WRITE setCropWidth NOTIFY cropWidthChanged);
Q_PROPERTY(bool forceWidth READ forceWidth WRITE setForceWidth NOTIFY forceWidthChanged);
Q_PROPERTY(int cropHeight READ cropHeight WRITE setCropHeight NOTIFY cropHeightChanged);
Q_PROPERTY(bool forceHeight READ forceHeight WRITE setForceHeight NOTIFY forceHeightChanged);
Q_PROPERTY(double ratio READ ratio WRITE setRatio NOTIFY ratioChanged);
Q_PROPERTY(bool forceRatio READ forceRatio WRITE setForceRatio NOTIFY forceRatioChanged);
Q_PROPERTY(int decoration READ decoration WRITE setDecoration NOTIFY decorationChanged);
public:
enum CropToolType {
LayerCropType,
ImageCropType
};
KisToolCrop(KoCanvasBase * canvas);
- virtual ~KisToolCrop();
+ ~KisToolCrop() override;
- virtual QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
- void beginPrimaryDoubleClickAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
+ void beginPrimaryDoubleClickAction(KoPointerEvent *event) override;
- virtual void mouseMoveEvent(KoPointerEvent *e);
- virtual void canvasResourceChanged(int key, const QVariant &res);
+ void mouseMoveEvent(KoPointerEvent *e) override;
+ void canvasResourceChanged(int key, const QVariant &res) override;
- virtual void paint(QPainter &painter, const KoViewConverter &converter);
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
CropToolType cropType() const;
bool cropTypeSelectable() const;
int cropX() const;
int cropY() const;
int cropWidth() const;
bool forceWidth() const;
int cropHeight() const;
bool forceHeight() const;
double ratio() const;
bool forceRatio() const;
int decoration() const;
bool growCenter() const;
bool allowGrow() const;
Q_SIGNALS:
void cropTypeSelectableChanged();
void cropTypeChanged(int value);
void decorationChanged(int value);
void cropXChanged(int value);
void cropYChanged(int value);
void cropWidthChanged(int value);
void cropHeightChanged(int value);
void ratioChanged(double value);
void forceWidthChanged(bool value);
void forceHeightChanged(bool value);
void forceRatioChanged(bool value);
void canGrowChanged(bool value);
void isCenteredChanged(bool value);
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- virtual void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
- void requestStrokeEnd();
- void requestStrokeCancellation();
+ void requestStrokeEnd() override;
+ void requestStrokeCancellation() override;
void crop();
void setCropTypeLegacy(int cropType);
void setCropType(CropToolType cropType);
void setCropTypeSelectable(bool selectable);
void setCropX(int x);
void setCropY(int y);
void setCropWidth(int x);
void setForceWidth(bool force);
void setCropHeight(int y);
void setForceHeight(bool force);
void setRatio(double ratio);
void setForceRatio(bool force);
void setDecoration(int i);
void setAllowGrow(bool g);
void setGrowCenter(bool g);
void slotRectChanged();
private:
void doCanvasUpdate(const QRect &updateRect);
private:
void cancelStroke();
QRectF boundingRect();
QRectF borderLineRect();
QPainterPath handlesPath();
void paintOutlineWithHandles(QPainter& gc);
qint32 mouseOnHandle(const QPointF currentViewPoint);
void setMoveResizeCursor(qint32 handle);
QRectF lowerRightHandleRect(QRectF cropBorderRect);
QRectF upperRightHandleRect(QRectF cropBorderRect);
QRectF lowerLeftHandleRect(QRectF cropBorderRect);
QRectF upperLeftHandleRect(QRectF cropBorderRect);
QRectF lowerHandleRect(QRectF cropBorderRect);
QRectF rightHandleRect(QRectF cropBorderRect);
QRectF upperHandleRect(QRectF cropBorderRect);
QRectF leftHandleRect(QRectF cropBorderRect);
void drawDecorationLine(QPainter *p, DecorationLine *decorLine, QRectF rect);
bool tryContinueLastCropAction();
private:
QPoint m_dragStart;
qint32 m_handleSize;
bool m_haveCropSelection;
qint32 m_mouseOnHandleType;
CropToolType m_cropType;
bool m_cropTypeSelectable;
int m_decoration;
bool m_resettingStroke;
QRect m_lastCanvasUpdateRect;
KConfigGroup configGroup;
enum handleType {
None = 0,
UpperLeft = 1,
UpperRight = 2,
LowerLeft = 3,
LowerRight = 4,
Upper = 5,
Lower = 6,
Left = 7,
Right = 8,
Inside = 9
};
QList<DecorationLine *> m_decorations;
KisConstrainedRect m_finalRect;
QRect m_initialDragRect;
QPointF m_dragOffsetDoc;
};
class KisToolCropFactory : public KoToolFactoryBase
{
public:
KisToolCropFactory()
: KoToolFactoryBase("KisToolCrop") {
setToolTip(i18n("Crop Tool"));
setSection(TOOL_TYPE_TRANSFORM);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setPriority(11);
setIconName(koIconNameCStr("tool_crop"));
setShortcut(QKeySequence("C"));
}
- virtual ~KisToolCropFactory() {}
+ ~KisToolCropFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolCrop(canvas);
}
};
#endif // KIS_TOOL_CROP_H_
diff --git a/plugins/tools/tool_crop/tool_crop.h b/plugins/tools/tool_crop/tool_crop.h
index ea790269e8..93a279f63a 100644
--- a/plugins/tools/tool_crop/tool_crop.h
+++ b/plugins/tools/tool_crop/tool_crop.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_CROP_H_
#define TOOL_CROP_H_
#include <QObject>
#include <QVariant>
/**
* A module that provides a crop tool.
*/
class ToolCrop : public QObject
{
Q_OBJECT
public:
ToolCrop(QObject *parent, const QVariantList &);
- virtual ~ToolCrop();
+ ~ToolCrop() override;
};
#endif // TOOL_CROP_H_
diff --git a/plugins/tools/tool_dyna/kis_tool_dyna.h b/plugins/tools/tool_dyna/kis_tool_dyna.h
index 789778e7ef..dbdea5870c 100644
--- a/plugins/tools/tool_dyna/kis_tool_dyna.h
+++ b/plugins/tools/tool_dyna/kis_tool_dyna.h
@@ -1,180 +1,180 @@
/*
* Copyright (c) 2009-2011 Lukáš Tvrdý <lukast.dev@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_DYNA_H_
#define KIS_TOOL_DYNA_H_
#include "kis_tool_freehand.h"
#include "KoToolFactoryBase.h"
#include "KoPointerEvent.h"
#include <flake/kis_node_shape.h>
#include <kis_icon.h>
#include <kconfig.h>
#include <kconfiggroup.h>
class KisDoubleSliderSpinBox;
class QCheckBox;
class QGridLayout;
class KoCanvasBase;
class DynaFilter
{
public:
DynaFilter() {
curx = 0;
cury = 0;
lastx = 0;
lasty = 0;
velx = 0.0;
vely = 0.0;
accx = 0.0;
accy = 0.0;
}
void init(qreal x, qreal y) {
curx = x;
cury = y;
lastx = x;
lasty = y;
velx = 0.0;
vely = 0.0;
accx = 0.0;
accy = 0.0;
}
~DynaFilter() {}
public:
qreal curx, cury;
qreal velx, vely, vel;
qreal accx, accy, acc;
qreal angx, angy;
qreal mass, drag;
qreal lastx, lasty;
bool fixedangle;
};
class KisToolDyna : public KisToolFreehand
{
Q_OBJECT
public:
KisToolDyna(KoCanvasBase * canvas);
- virtual ~KisToolDyna();
+ ~KisToolDyna() override;
- QWidget * createOptionWidget();
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
+ QWidget * createOptionWidget() override;
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
protected:
- virtual void initStroke(KoPointerEvent *event);
+ void initStroke(KoPointerEvent *event) override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
private Q_SLOTS:
void slotSetDynaWidth(double width);
void slotSetMass(qreal mass);
void slotSetDrag(qreal drag);
void slotSetAngle(qreal angle);
void slotSetWidthRange(double widthRange);
void slotSetFixedAngle(bool fixedAngle);
private:
QGridLayout* m_optionLayout;
// dyna gui
QCheckBox * m_chkFixedAngle;
KisDoubleSliderSpinBox * m_massSPBox;
KisDoubleSliderSpinBox * m_dragSPBox;
KisDoubleSliderSpinBox * m_angleDSSBox;
// dyna algorithm
QVector<QPointF> m_prevPosition;
qreal m_odelx, m_odely;
// mouse info
QPointF m_mousePos;
qreal m_surfaceWidth;
qreal m_surfaceHeight;
// settings variables
KConfigGroup m_configGroup;
qreal m_width;
qreal m_curmass;
qreal m_curdrag;
DynaFilter m_mouse;
qreal m_xangle;
qreal m_yangle;
qreal m_widthRange;
// methods
qreal flerp(qreal f0, qreal f1, qreal p) {
return ((f0 *(1.0 - p)) + (f1 * p));
}
void setMousePosition(const QPointF &point) {
m_mousePos.setX(point.x() / m_surfaceWidth );
m_mousePos.setY(point.y() / m_surfaceHeight);
}
void initDyna();
int applyFilter(qreal mx, qreal my);
KoPointerEvent filterEvent(KoPointerEvent * event);
};
class KisToolDynaFactory : public KoToolFactoryBase
{
public:
KisToolDynaFactory()
: KoToolFactoryBase("KritaShape/KisToolDyna") {
setToolTip(i18n("Dynamic Brush Tool"));
// Temporarily
setSection(TOOL_TYPE_SHAPE);
setIconName(koIconNameCStr("krita_tool_dyna"));
// TODO
//setShortcut(QKeySequence(Qt::Key_F));
setPriority(10);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolDynaFactory() {}
+ ~KisToolDynaFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolDyna(canvas);
}
};
#endif // KIS_TOOL_DYNA_H_
diff --git a/plugins/tools/tool_dyna/tool_dyna.h b/plugins/tools/tool_dyna/tool_dyna.h
index 85150f5139..9beaacdc4f 100644
--- a/plugins/tools/tool_dyna/tool_dyna.h
+++ b/plugins/tools/tool_dyna/tool_dyna.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_DYNA_H_
#define TOOL_DYNA_H_
#include <QObject>
#include <QVariant>
/**
* A module that provides a polygon tool.
*/
class ToolDyna : public QObject
{
Q_OBJECT
public:
ToolDyna(QObject *parent, const QVariantList &);
- virtual ~ToolDyna();
+ ~ToolDyna() override;
};
#endif // TOOL_DYNA_H_
diff --git a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h
index 0aaf46eb95..dcc93828b1 100644
--- a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h
+++ b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush.h
@@ -1,99 +1,99 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_LAZY_BRUSH_H_
#define KIS_TOOL_LAZY_BRUSH_H_
#include <QScopedPointer>
#include "kis_tool_freehand.h"
#include "KoToolFactoryBase.h"
#include <flake/kis_node_shape.h>
#include <kis_icon.h>
#include <QKeySequence>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <KoIcon.h>
class KActionCollection;
class KoCanvasBase;
class KisToolLazyBrush : public KisToolFreehand
{
Q_OBJECT
public:
KisToolLazyBrush(KoCanvasBase * canvas);
- virtual ~KisToolLazyBrush();
+ ~KisToolLazyBrush() override;
- QWidget * createOptionWidget();
+ QWidget * createOptionWidget() override;
- void activatePrimaryAction();
- void deactivatePrimaryAction();
+ void activatePrimaryAction() override;
+ void deactivatePrimaryAction() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
protected Q_SLOTS:
- void resetCursorStyle();
+ void resetCursorStyle() override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
Q_SIGNALS:
private:
bool colorizeMaskActive() const;
bool canCreateColorizeMask() const;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
class KisToolLazyBrushFactory : public KoToolFactoryBase
{
public:
KisToolLazyBrushFactory()
: KoToolFactoryBase("KritaShape/KisToolLazyBrush") {
setToolTip(i18n("Colorize Mask Editing Tool"));
// Temporarily
setSection(TOOL_TYPE_FILL);
setIconName(koIconNameCStr("krita_tool_lazybrush"));
//setShortcut(QKeySequence(Qt::Key_Shift + Qt::Key_B));
setPriority(3);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolLazyBrushFactory() {}
+ ~KisToolLazyBrushFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolLazyBrush(canvas);
}
};
#endif // KIS_TOOL_LAZY_BRUSH_H_
diff --git a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.h b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.h
index 4ef1f96c35..15afeb54c5 100644
--- a/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.h
+++ b/plugins/tools/tool_lazybrush/kis_tool_lazy_brush_options_widget.h
@@ -1,64 +1,64 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_LAZY_BRUSH_OPTIONS_WIDGET_H
#define __KIS_TOOL_LAZY_BRUSH_OPTIONS_WIDGET_H
#include <QScopedPointer>
#include <QWidget>
#include <QModelIndex>
#include "kis_types.h"
class KisCanvasResourceProvider;
class KoColor;
class KisToolLazyBrushOptionsWidget : public QWidget
{
Q_OBJECT
public:
KisToolLazyBrushOptionsWidget(KisCanvasResourceProvider *provider, QWidget *parent);
- ~KisToolLazyBrushOptionsWidget();
+ ~KisToolLazyBrushOptionsWidget() override;
private Q_SLOTS:
void entrySelected(QModelIndex index);
void slotCurrentFgColorChanged(const KoColor &color);
void slotCurrentNodeChanged(KisNodeSP node);
void slotColorLabelsChanged();
void slotMakeTransparent(bool value);
void slotRemove();
void slotUpdate();
void slotSetAutoUpdates(bool value);
void slotSetShowKeyStrokes(bool value);
void slotSetShowOutput(bool value);
void slotUpdateNodeProperties();
protected:
- void showEvent(QShowEvent *event);
- void hideEvent(QHideEvent *event);
+ void showEvent(QShowEvent *event) override;
+ void hideEvent(QHideEvent *event) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_TOOL_LAZY_BRUSH_OPTIONS_WIDGET_H */
diff --git a/plugins/tools/tool_lazybrush/tool_lazybrush.h b/plugins/tools/tool_lazybrush/tool_lazybrush.h
index fbadd0178a..58f7157161 100644
--- a/plugins/tools/tool_lazybrush/tool_lazybrush.h
+++ b/plugins/tools/tool_lazybrush/tool_lazybrush.h
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_LAZYBRUSH_H_
#define TOOL_LAZYBRUSH_H_
#include <QObject>
#include <QVariant>
class ToolLazyBrush : public QObject
{
Q_OBJECT
public:
ToolLazyBrush(QObject *parent, const QVariantList &);
- virtual ~ToolLazyBrush();
+ ~ToolLazyBrush() override;
};
#endif // TOOL_LAZYBRUSH_H_
diff --git a/plugins/tools/tool_polygon/kis_tool_polygon.h b/plugins/tools/tool_polygon/kis_tool_polygon.h
index 7e622c1528..fb7a5db095 100644
--- a/plugins/tools/tool_polygon/kis_tool_polygon.h
+++ b/plugins/tools/tool_polygon/kis_tool_polygon.h
@@ -1,68 +1,68 @@
/*
* kis_tool_polygon.h - part of Krita
*
* Copyright (c) 2004 Michael Thaler <michael Thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_POLYGON_H_
#define KIS_TOOL_POLYGON_H_
#include "kis_tool_shape.h"
#include "flake/kis_node_shape.h"
#include <kis_tool_polyline_base.h>
#include <kis_icon.h>
class KoCanvasBase;
class KisToolPolygon : public KisToolPolylineBase
{
Q_OBJECT
public:
KisToolPolygon(KoCanvasBase *canvas);
- virtual ~KisToolPolygon();
+ ~KisToolPolygon() override;
protected:
- virtual void finishPolyline(const QVector<QPointF>& points);
+ void finishPolyline(const QVector<QPointF>& points) override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
};
#include "KoToolFactoryBase.h"
class KisToolPolygonFactory : public KoToolFactoryBase
{
public:
KisToolPolygonFactory()
: KoToolFactoryBase("KisToolPolygon") {
setToolTip(i18n("Polygon Tool: Shift-mouseclick ends the polygon."));
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("krita_tool_polygon"));
setPriority(4);
}
- virtual ~KisToolPolygonFactory() {}
+ ~KisToolPolygonFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolPolygon(canvas);
}
};
#endif //__KIS_TOOL_POLYGON_H__
diff --git a/plugins/tools/tool_polygon/tool_polygon.h b/plugins/tools/tool_polygon/tool_polygon.h
index bcfed0b3ac..356e9f8cc1 100644
--- a/plugins/tools/tool_polygon/tool_polygon.h
+++ b/plugins/tools/tool_polygon/tool_polygon.h
@@ -1,39 +1,39 @@
/*
* Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_POLYGON_H_
#define TOOL_POLYGON_H_
#include <QObject>
#include <QVariant>
/**
* A module that provides a polygon tool.
*/
class ToolPolygon : public QObject
{
Q_OBJECT
public:
ToolPolygon(QObject *parent, const QVariantList &);
- virtual ~ToolPolygon();
+ ~ToolPolygon() override;
};
#endif // TOOL_POLYGON_H_
diff --git a/plugins/tools/tool_polyline/kis_tool_polyline.h b/plugins/tools/tool_polyline/kis_tool_polyline.h
index d28f48c842..731e3e416a 100644
--- a/plugins/tools/tool_polyline/kis_tool_polyline.h
+++ b/plugins/tools/tool_polyline/kis_tool_polyline.h
@@ -1,70 +1,70 @@
/*
* kis_tool_polyline.h - part of Krita
*
* Copyright (c) 2004 Michael Thaler <michael Thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_POLYLINE_H_
#define KIS_TOOL_POLYLINE_H_
#include "kis_tool_polyline_base.h"
//#include "flake/kis_node_shape.h"
#include <kis_icon.h>
class KisToolPolyline : public KisToolPolylineBase
{
Q_OBJECT
public:
KisToolPolyline(KoCanvasBase * canvas);
- virtual ~KisToolPolyline();
+ ~KisToolPolyline() override;
protected:
- QWidget* createOptionWidget();
- void finishPolyline(const QVector<QPointF>& points);
+ QWidget* createOptionWidget() override;
+ void finishPolyline(const QVector<QPointF>& points) override;
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
};
#include "KoToolFactoryBase.h"
class KisToolPolylineFactory : public KoToolFactoryBase
{
public:
KisToolPolylineFactory()
: KoToolFactoryBase("KisToolPolyline") {
setToolTip(i18n("Polyline Tool: Shift-mouseclick ends the polyline."));
setSection(TOOL_TYPE_SHAPE);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("polyline"));
setPriority(5);
}
- virtual ~KisToolPolylineFactory() {}
+ ~KisToolPolylineFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolPolyline(canvas);
}
};
#endif //__KIS_TOOL_POLYLINE_H__
diff --git a/plugins/tools/tool_polyline/tool_polyline.h b/plugins/tools/tool_polyline/tool_polyline.h
index 8fc38ede13..43fef14481 100644
--- a/plugins/tools/tool_polyline/tool_polyline.h
+++ b/plugins/tools/tool_polyline/tool_polyline.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2004 Michael Thaler <michael.thaler@physik.tu-muenchen.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_POLYLINE_H_
#define TOOL_POLYLINE_H_
#include <QObject>
#include <QVariant>
/**
* A module that provides a polyline tool.
*/
class ToolPolyline : public QObject
{
Q_OBJECT
public:
ToolPolyline(QObject *parent, const QVariantList &);
- virtual ~ToolPolyline();
+ ~ToolPolyline() override;
};
#endif // TOOL_POLYLINE_H_
diff --git a/plugins/tools/tool_smart_patch/kis_inpaint.cpp b/plugins/tools/tool_smart_patch/kis_inpaint.cpp
index 606984826b..ddc6df97ad 100644
--- a/plugins/tools/tool_smart_patch/kis_inpaint.cpp
+++ b/plugins/tools/tool_smart_patch/kis_inpaint.cpp
@@ -1,1014 +1,994 @@
/*
* Copyright (c) 2017 Eugene Ingerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Inpaint using the PatchMatch Algorithm
*
* | PatchMatch : A Randomized Correspondence Algorithm for Structural Image Editing
* | by Connelly Barnes and Eli Shechtman and Adam Finkelstein and Dan B Goldman
* | ACM Transactions on Graphics (Proc. SIGGRAPH), vol.28, aug-2009
*
* Original author Xavier Philippeau
* Code adopted from: David Chatting https://github.com/davidchatting/PatchMatch
*/
#include <boost/multi_array.hpp>
#include <random>
#include <iostream>
#include <functional>
#include "kis_paint_device.h"
#include "kis_painter.h"
#include "kis_selection.h"
#include "kis_debug.h"
#include "kis_paint_device_debug_utils.h"
//#include "kis_random_accessor_ng.h"
#include <QList>
#include <kis_transform_worker.h>
#include <kis_filter_strategy.h>
#include "KoColor.h"
#include "KoColorSpace.h"
#include "KoChannelInfo.h"
#include "KoMixColorsOp.h"
#include "KoColorModelStandardIds.h"
#include "KoColorSpaceRegistry.h"
#include "KoColorSpaceTraits.h"
const int MAX_DIST = 65535;
-const quint8 MASK_SET = 0;
-const quint8 MASK_CLEAR = 255;
-
-void patchImage(KisPaintDeviceSP, KisPaintDeviceSP, int radius);
+const quint8 MASK_SET = 255;
+const quint8 MASK_CLEAR = 0;
class MaskedImage; //forward decl for the forward decl below
template <typename T> float distance_impl(const MaskedImage& my, int x, int y, const MaskedImage& other, int xo, int yo);
class ImageView
{
protected:
quint8* m_data;
int m_imageWidth;
int m_imageHeight;
int m_pixelSize;
public:
void Init(quint8* _data, int _imageWidth, int _imageHeight, int _pixelSize)
{
m_data = _data;
m_imageWidth = _imageWidth;
m_imageHeight = _imageHeight;
m_pixelSize = _pixelSize;
}
ImageView() : m_data(nullptr)
{
m_imageHeight = m_imageWidth = m_pixelSize = 0;
}
ImageView(quint8* _data, int _imageWidth, int _imageHeight, int _pixelSize)
{
Init(_data, _imageWidth, _imageHeight, _pixelSize);
}
quint8* operator()(int x, int y) const
{
Q_ASSERT(m_data);
Q_ASSERT((x >= 0) && (x < m_imageWidth) && (y >= 0) && (y < m_imageHeight));
return (m_data + x * m_pixelSize + y * m_imageWidth * m_pixelSize);
}
ImageView& operator=(const ImageView& other)
{
if (this != &other) {
if (other.num_bytes() != num_bytes()) {
delete[] m_data;
m_data = nullptr; //to preserve invariance if next line throws exception
m_data = new quint8[other.num_bytes()];
}
std::copy(other.data(), other.data() + other.num_bytes(), m_data);
m_imageHeight = other.m_imageHeight;
m_imageWidth = other.m_imageWidth;
m_pixelSize = other.m_pixelSize;
}
return *this;
}
//move assignement operator
ImageView& operator=(ImageView&& other) noexcept
{
if (this != &other) {
delete[] m_data;
m_data = nullptr;
Init(other.data(), other.m_imageWidth, other.m_imageHeight, other.m_pixelSize);
other.m_data = nullptr;
}
return *this;
}
virtual ~ImageView() {} //this class doesn't own m_data, so it ain't going to delete it either.
quint8* data(void) const
{
return m_data;
}
inline int num_elements(void) const
{
return m_imageHeight * m_imageWidth;
}
inline int num_bytes(void) const
{
return m_imageHeight * m_imageWidth * m_pixelSize;
}
inline int pixel_size(void) const
{
return m_pixelSize;
}
void saveToDevice(KisPaintDeviceSP outDev, QRect rect)
{
-
Q_ASSERT(outDev->colorSpace()->pixelSize() == (quint32) m_pixelSize);
outDev->writeBytes(m_data, rect);
}
void DebugDump(const QString& fnamePrefix)
{
QRect imSize(QPoint(0, 0), QSize(m_imageWidth, m_imageHeight));
const KoColorSpace* cs = (m_pixelSize == 1) ?
KoColorSpaceRegistry::instance()->alpha8() : (m_pixelSize == 3) ? KoColorSpaceRegistry::instance()->colorSpace("RGB", "U8", "") :
KoColorSpaceRegistry::instance()->colorSpace("RGBA", "U8", "");
KisPaintDeviceSP dbout = new KisPaintDevice(cs);
saveToDevice(dbout, imSize);
KIS_DUMP_DEVICE_2(dbout, imSize, fnamePrefix, "./");
}
};
class ImageData : public ImageView
{
public:
ImageData() : ImageView() {}
void Init(int _imageWidth, int _imageHeight, int _pixelSize)
{
m_data = new quint8[ _imageWidth * _imageHeight * _pixelSize ];
ImageView::Init(m_data, _imageWidth, _imageHeight, _pixelSize);
}
ImageData(int _imageWidth, int _imageHeight, int _pixelSize) : ImageView()
{
Init(_imageWidth, _imageHeight, _pixelSize);
}
void Init(KisPaintDeviceSP imageDev, const QRect& imageSize)
{
const KoColorSpace* cs = imageDev->colorSpace();
m_pixelSize = cs->pixelSize();
m_data = new quint8[ imageSize.width()*imageSize.height()*cs->pixelSize() ];
imageDev->readBytes(m_data, imageSize.x(), imageSize.y(), imageSize.width(), imageSize.height());
ImageView::Init(m_data, imageSize.width(), imageSize.height(), m_pixelSize);
}
ImageData(KisPaintDeviceSP imageDev, const QRect& imageSize) : ImageView()
{
Init(imageDev, imageSize);
}
- virtual ~ImageData()
+ ~ImageData() override
{
delete[] m_data; //ImageData owns m_data, so it has to delete it
}
};
class MaskedImage : public KisShared
{
private:
template <typename T> friend float distance_impl(const MaskedImage& my, int x, int y, const MaskedImage& other, int xo, int yo);
QRect imageSize;
int nChannels;
const KoColorSpace* cs;
const KoColorSpace* csMask;
ImageData maskData;
ImageData imageData;
- void cacheImageSize(KisPaintDeviceSP imageDev)
+ void cacheImage(KisPaintDeviceSP imageDev, QRect rect)
{
- imageSize = imageDev->exactBounds();
- }
-
- void cacheImage(KisPaintDeviceSP imageDev)
- {
- Q_ASSERT(!imageSize.isEmpty() && imageSize.isValid());
cs = imageDev->colorSpace();
nChannels = cs->channelCount();
- imageData.Init(imageDev, imageSize);
+ imageData.Init(imageDev, rect);
+ imageSize = rect;
}
- void cacheMask(KisPaintDeviceSP maskDev)
+ void cacheMask(KisPaintDeviceSP maskDev, QRect rect)
{
- Q_ASSERT(!imageSize.isEmpty() && imageSize.isValid());
Q_ASSERT(maskDev->colorSpace()->pixelSize() == 1);
csMask = maskDev->colorSpace();
- maskData.Init(maskDev, imageSize);
+ maskData.Init(maskDev, rect);
//hard threshold for the initial mask
//may be optional. needs testing
std::for_each(maskData.data(), maskData.data() + maskData.num_bytes(), [](quint8 & v) {
- v = (v < MASK_CLEAR) ? MASK_SET : MASK_CLEAR;
+ v = (v > MASK_CLEAR) ? MASK_SET : MASK_CLEAR;
});
}
MaskedImage() {}
public:
std::function< float(const MaskedImage&, int, int, const MaskedImage& , int , int ) > distance;
void toPaintDevice(KisPaintDeviceSP imageDev, QRect rect)
{
imageData.saveToDevice(imageDev, rect);
}
void DebugDump(const QString& name)
{
imageData.DebugDump(name + "_img");
maskData.DebugDump(name + "_mask");
}
void clearMask(void)
{
std::fill(maskData.data(), maskData.data() + maskData.num_bytes(), MASK_CLEAR);
}
- void initialize(KisPaintDeviceSP _imageDev, KisPaintDeviceSP _maskDev)
+ void initialize(KisPaintDeviceSP _imageDev, KisPaintDeviceSP _maskDev, QRect _maskRect)
{
- cacheImageSize(_imageDev);
- cacheImage(_imageDev);
- cacheMask(_maskDev);
+ cacheImage(_imageDev, _maskRect);
+ cacheMask(_maskDev, _maskRect);
//distance function is the only that needs to know the type
//For performance reasons we can't use functions provided by color space
KoID colorDepthId = _imageDev->colorSpace()->colorDepthId();
//Use RGB traits to assign actual pixel data types.
distance = &distance_impl<KoRgbU8Traits::channels_type>;
if( colorDepthId == Integer16BitsColorDepthID )
distance = &distance_impl<KoRgbU16Traits::channels_type>;
#ifdef HAVE_OPENEXR
if( colorDepthId == Float16BitsColorDepthID )
distance = &distance_impl<KoRgbF16Traits::channels_type>;
#endif
if( colorDepthId == Float32BitsColorDepthID )
distance = &distance_impl<KoRgbF32Traits::channels_type>;
if( colorDepthId == Float64BitsColorDepthID )
distance = &distance_impl<KoRgbF64Traits::channels_type>;
}
- MaskedImage(KisPaintDeviceSP _imageDev, KisPaintDeviceSP _maskDev)
+ MaskedImage(KisPaintDeviceSP _imageDev, KisPaintDeviceSP _maskDev, QRect _maskRect)
{
- initialize(_imageDev, _maskDev);
-// DebugDump("Initialize");
+ initialize(_imageDev, _maskDev, _maskRect);
}
void downsample2x(void)
{
int H = imageSize.height();
int W = imageSize.width();
int newW = W / 2, newH = H / 2;
KisPaintDeviceSP imageDev = new KisPaintDevice(cs);
KisPaintDeviceSP maskDev = new KisPaintDevice(csMask);
imageDev->writeBytes(imageData.data(), 0, 0, W, H);
maskDev->writeBytes(maskData.data(), 0, 0, W, H);
ImageData newImage(newW, newH, cs->pixelSize());
ImageData newMask(newW, newH, 1);
KoDummyUpdater updater;
KisTransformWorker worker(imageDev, 1. / 2., 1. / 2., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
&updater, KisFilterStrategyRegistry::instance()->value("Bicubic"));
worker.run();
KisTransformWorker workerMask(maskDev, 1. / 2., 1. / 2., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
&updater, KisFilterStrategyRegistry::instance()->value("Bicubic"));
workerMask.run();
imageDev->readBytes(newImage.data(), 0, 0, newW, newH);
maskDev->readBytes(newMask.data(), 0, 0, newW, newH);
imageData = std::move(newImage);
maskData = std::move(newMask);
for (int i = 0; i < imageData.num_elements(); ++i) {
quint8* maskPix = maskData.data() + i * maskData.pixel_size();
if (*maskPix == MASK_SET) {
for (int k = 0; k < imageData.pixel_size(); k++)
*(imageData.data() + i * imageData.pixel_size() + k) = 0;
} else {
*maskPix = MASK_CLEAR;
}
}
imageSize = QRect(0, 0, newW, newH);
}
void upscale(int newW, int newH)
{
int H = imageSize.height();
int W = imageSize.width();
ImageData newImage(newW, newH, cs->pixelSize());
ImageData newMask(newW, newH, 1);
QVector<float> colors(nChannels, 0.f);
QVector<float> v(nChannels, 0.f);
for (int y = 0; y < newH; ++y) {
for (int x = 0; x < newW; ++x) {
// original pixel
int xs = (x * W) / newW;
int ys = (y * H) / newH;
// copy to new image
if (!isMasked(xs, ys)) {
std::copy(imageData(xs, ys), imageData(xs, ys) + imageData.pixel_size(), newImage(x, y));
*newMask(x, y) = MASK_CLEAR;
} else {
std::fill(newImage(x, y), newImage(x, y) + newImage.pixel_size(), 0);
*newMask(x, y) = MASK_SET;
}
}
}
imageData = std::move(newImage);
maskData = std::move(newMask);
imageSize = QRect(0, 0, newW, newH);
}
QRect size()
{
return imageSize;
}
KisSharedPtr<MaskedImage> copy(void)
{
KisSharedPtr<MaskedImage> clone = new MaskedImage();
clone->imageSize = this->imageSize;
clone->nChannels = this->nChannels;
clone->maskData = this->maskData;
clone->imageData = this->imageData;
clone->cs = this->cs;
clone->csMask = this->csMask;
clone->distance = this->distance;
return clone;
}
int countMasked(void)
{
int count = std::count_if(maskData.data(), maskData.data() + maskData.num_elements(), [](quint8 v) {
- return v < MASK_CLEAR;
+ return v > MASK_CLEAR;
});
return count;
}
inline bool isMasked(int x, int y)
{
- return (*maskData(x, y) < MASK_CLEAR);
+ return (*maskData(x, y) > MASK_CLEAR);
}
//returns true if the patch contains a masked pixel
bool containsMasked(int x, int y, int S)
{
for (int dy = -S; dy <= S; ++dy) {
int ys = y + dy;
if (ys < 0 || ys >= imageSize.height())
continue;
for (int dx = -S; dx <= S; ++dx) {
int xs = x + dx;
if (xs < 0 || xs >= imageSize.width())
continue;
if (isMasked(xs, ys))
return true;
}
}
return false;
}
inline quint8 getImagePixelU8(int x, int y, int chan) const
{
return cs->scaleToU8(imageData(x, y), chan);
}
inline QVector<float> getImagePixels(int x, int y) const
{
QVector<float> v(cs->channelCount());
cs->normalisedChannelsValue(imageData(x, y), v);
return v;
}
inline quint8* getImagePixel(int x, int y)
{
return imageData(x, y);
}
inline void setImagePixels(int x, int y, QVector<float>& value)
{
cs->fromNormalisedChannelsValue(imageData(x, y), value);
}
inline void mixColors(std::vector< quint8* > pixels, std::vector< float > w, float wsum, quint8* dst)
{
const KoMixColorsOp* mixOp = cs->mixColorsOp();
size_t n = w.size();
assert(pixels.size() == n);
std::vector< qint16 > weights;
weights.clear();
float dif = 0;
float scale = 255 / (wsum + 0.001);
for (auto& v : w) {
//compensated summation to increase accuracy
float v1 = v * scale + dif;
float v2 = std::round(v1);
dif = v1 - v2;
weights.push_back(v2);
}
mixOp->mixColors(pixels.data(), weights.data(), n, dst);
}
inline void setMask(int x, int y, quint8 v)
{
*(maskData(x, y)) = v;
}
inline int channelCount(void) const
{
return cs->channelCount();
}
};
//Generic version of the distance function. produces distance between colors in the range [0, MAX_DIST]. This
//is a fast distance computation. More accurate, but very slow implementation is to use color space operations.
template <typename T> float distance_impl(const MaskedImage& my, int x, int y, const MaskedImage& other, int xo, int yo)
{
float dsq = 0;
quint32 nchannels = my.channelCount();
quint8* v1 = my.imageData(x, y);
quint8* v2 = other.imageData(xo, yo);
for (quint32 chan = 0; chan < nchannels; chan++) {
//It's very important not to lose precision in the next line
float v = ((float)(*((T*)v1 + chan)) - (float)(*((T*)v2 + chan)));
dsq += v * v;
}
return dsq / ( (float)KoColorSpaceMathsTraits<T>::unitValue * (float)KoColorSpaceMathsTraits<T>::unitValue / MAX_DIST );
}
typedef KisSharedPtr<MaskedImage> MaskedImageSP;
struct NNPixel {
int x;
int y;
int distance;
};
typedef boost::multi_array<NNPixel, 2> NNArray_type;
struct Vote_elem {
QVector<float> channel_values;
float w;
};
typedef boost::multi_array<Vote_elem, 2> Vote_type;
class NearestNeighborField : public KisShared
{
private:
template< typename T> T randomInt(T range)
{
return rand() % range;
}
//compute intial value of the distance term
void initialize(void)
{
for (int y = 0; y < imSize.height(); y++) {
for (int x = 0; x < imSize.width(); x++) {
field[x][y].distance = distance(x, y, field[x][y].x, field[x][y].y);
//if the distance is "infinity", try to find a better link
int iter = 0;
const int maxretry = 20;
while (field[x][y].distance == MAX_DIST && iter < maxretry) {
field[x][y].x = randomInt(imSize.width() + 1);
field[x][y].y = randomInt(imSize.height() + 1);
field[x][y].distance = distance(x, y, field[x][y].x, field[x][y].y);
iter++;
}
}
}
}
void init_similarity_curve(void)
{
float s_zero = 0.999;
float t_halfmax = 0.10;
float x = (s_zero - 0.5) * 2;
float invtanh = 0.5 * std::log((1. + x) / (1. - x));
float coef = invtanh / t_halfmax;
similarity.resize(MAX_DIST + 1);
for (int i = 0; i < (int)similarity.size(); i++) {
float t = (float)i / similarity.size();
similarity[i] = 0.5 - 0.5 * std::tanh(coef * (t - t_halfmax));
}
}
private:
int patchSize; //patch size
public:
MaskedImageSP input;
MaskedImageSP output;
QRect imSize;
NNArray_type field;
std::vector<float> similarity;
quint32 nColors;
QList<KoChannelInfo *> channels;
public:
NearestNeighborField(const MaskedImageSP _input, MaskedImageSP _output, int _patchsize) : patchSize(_patchsize), input(_input), output(_output)
{
imSize = input->size();
field.resize(boost::extents[imSize.width()][imSize.height()]);
init_similarity_curve();
nColors = input->channelCount(); //only color count, doesn't include alpha channels
}
void randomize(void)
{
for (int y = 0; y < imSize.height(); y++) {
for (int x = 0; x < imSize.width(); x++) {
field[x][y].x = randomInt(imSize.width() + 1);
field[x][y].y = randomInt(imSize.height() + 1);
field[x][y].distance = MAX_DIST;
}
}
initialize();
}
//initialize field from an existing (possibly smaller) nearest neighbor field
void initialize(const NearestNeighborField& nnf)
{
float xscale = imSize.width() / nnf.imSize.width();
float yscale = imSize.height() / nnf.imSize.height();
for (int y = 0; y < imSize.height(); y++) {
for (int x = 0; x < imSize.width(); x++) {
int xlow = std::min((int)(x / xscale), nnf.imSize.width() - 1);
int ylow = std::min((int)(y / yscale), nnf.imSize.height() - 1);
field[x][y].x = nnf.field[xlow][ylow].x * xscale;
field[x][y].y = nnf.field[xlow][ylow].y * yscale;
field[x][y].distance = MAX_DIST;
}
}
initialize();
}
//multi-pass NN-field minimization (see "PatchMatch" paper referenced above - page 4)
void minimize(int pass)
{
int min_x = 0;
int min_y = 0;
int max_x = imSize.width() - 1;
int max_y = imSize.height() - 1;
for (int i = 0; i < pass; i++) {
//scanline order
for (int y = min_y; y < max_y; y++)
for (int x = min_x; x <= max_x; x++)
if (field[x][y].distance > 0)
minimizeLink(x, y, 1);
//reverse scanline order
for (int y = max_y; y >= min_y; y--)
for (int x = max_x; x >= min_x; x--)
if (field[x][y].distance > 0)
minimizeLink(x, y, -1);
}
}
void minimizeLink(int x, int y, int dir)
{
int xp, yp, dp;
//Propagation Left/Right
if (x - dir > 0 && x - dir < imSize.width()) {
xp = field[x - dir][y].x + dir;
yp = field[x - dir][y].y;
dp = distance(x, y, xp, yp);
if (dp < field[x][y].distance) {
field[x][y].x = xp;
field[x][y].y = yp;
field[x][y].distance = dp;
}
}
//Propagation Up/Down
if (y - dir > 0 && y - dir < imSize.height()) {
xp = field[x][y - dir].x;
yp = field[x][y - dir].y + dir;
dp = distance(x, y, xp, yp);
if (dp < field[x][y].distance) {
field[x][y].x = xp;
field[x][y].y = yp;
field[x][y].distance = dp;
}
}
//Random search
int wi = std::max(output->size().width(), output->size().height());
int xpi = field[x][y].x;
int ypi = field[x][y].y;
while (wi > 0) {
xp = xpi + randomInt(2 * wi) - wi;
yp = ypi + randomInt(2 * wi) - wi;
xp = std::max(0, std::min(output->size().width() - 1, xp));
yp = std::max(0, std::min(output->size().height() - 1, yp));
dp = distance(x, y, xp, yp);
if (dp < field[x][y].distance) {
field[x][y].x = xp;
field[x][y].y = yp;
field[x][y].distance = dp;
}
wi /= 2;
}
}
//compute distance between two patches
int distance(int x, int y, int xp, int yp)
{
float distance = 0;
float wsum = 0;
float ssdmax = nColors * 255 * 255;
//for each pixel in the source patch
for (int dy = -patchSize; dy <= patchSize; dy++) {
for (int dx = -patchSize; dx <= patchSize; dx++) {
wsum += ssdmax;
int xks = x + dx;
int yks = y + dy;
if (xks < 0 || xks >= input->size().width()) {
distance += ssdmax;
continue;
}
if (yks < 0 || yks >= input->size().height()) {
distance += ssdmax;
continue;
}
//cannot use masked pixels as a valid source of information
if (input->isMasked(xks, yks)) {
distance += ssdmax;
continue;
}
//corresponding pixel in target patch
int xkt = xp + dx;
int ykt = yp + dy;
if (xkt < 0 || xkt >= output->size().width()) {
distance += ssdmax;
continue;
}
if (ykt < 0 || ykt >= output->size().height()) {
distance += ssdmax;
continue;
}
//cannot use masked pixels as a valid source of information
if (output->isMasked(xkt, ykt)) {
distance += ssdmax;
continue;
}
//SSD distance between pixels
float ssd = input->distance(*input, xks, yks, *output, xkt, ykt);
distance += ssd;
}
}
return (int)(MAX_DIST * (distance / wsum));
}
static MaskedImageSP ExpectationMaximization(KisSharedPtr<NearestNeighborField> TargetToSource, int level, int radius, QList<MaskedImageSP>& pyramid);
static void ExpectationStep(KisSharedPtr<NearestNeighborField> nnf, MaskedImageSP source, MaskedImageSP target, bool upscale);
void EM_Step(MaskedImageSP source, MaskedImageSP target, int R, bool upscaled);
};
typedef KisSharedPtr<NearestNeighborField> NearestNeighborFieldSP;
class Inpaint
{
private:
KisPaintDeviceSP devCache;
MaskedImageSP initial;
NearestNeighborFieldSP nnf_TargetToSource;
NearestNeighborFieldSP nnf_SourceToTarget;
int radius;
QList<MaskedImageSP> pyramid;
public:
- Inpaint(KisPaintDeviceSP dev, KisPaintDeviceSP devMask, int _radius)
+ Inpaint(KisPaintDeviceSP dev, KisPaintDeviceSP devMask, int _radius, QRect maskRect)
{
- initial = new MaskedImage(dev, devMask);
+ initial = new MaskedImage(dev, devMask, maskRect);
radius = _radius;
devCache = dev;
}
MaskedImageSP patch(void);
MaskedImageSP patch_simple(void);
};
MaskedImageSP Inpaint::patch()
{
MaskedImageSP source = initial->copy();
pyramid.append(initial);
QRect size = source->size();
//qDebug() << "countMasked: " << source->countMasked() << "\n";
while ((size.width() > radius) && (size.height() > radius) && source->countMasked() > 0) {
source->downsample2x();
//source->DebugDump("Pyramid");
//qDebug() << "countMasked1: " << source->countMasked() << "\n";
pyramid.append(source->copy());
size = source->size();
}
int maxlevel = pyramid.size();
//qDebug() << "MaxLevel: " << maxlevel << "\n";
// The initial target is the same as the smallest source.
// We consider that this target contains no masked pixels
MaskedImageSP target = source->copy();
target->clearMask();
//recursively building nearest neighbor field
for (int level = maxlevel - 1; level > 0; level--) {
source = pyramid.at(level);
if (level == maxlevel - 1) {
//random initial guess
nnf_TargetToSource = new NearestNeighborField(target, source, radius);
nnf_TargetToSource->randomize();
} else {
// then, we use the rebuilt (upscaled) target
// and reuse the previous NNF as initial guess
NearestNeighborFieldSP new_nnf_rev = new NearestNeighborField(target, source, radius);
new_nnf_rev->initialize(*nnf_TargetToSource);
nnf_TargetToSource = new_nnf_rev;
}
//Build an upscaled target by EM-like algorithm (see "PatchMatch" paper referenced above - page 6)
target = NearestNeighborField::ExpectationMaximization(nnf_TargetToSource, level, radius, pyramid);
//target->DebugDump( "target" );
}
return target;
}
//EM-Like algorithm (see "PatchMatch" - page 6)
//Returns a float sized target image
MaskedImageSP NearestNeighborField::ExpectationMaximization(NearestNeighborFieldSP nnf_TargetToSource, int level, int radius, QList<MaskedImageSP>& pyramid)
{
int iterEM = std::min(2 * level, 4);
int iterNNF = std::min(5, 1 + level);
MaskedImageSP source = nnf_TargetToSource->output;
MaskedImageSP target = nnf_TargetToSource->input;
MaskedImageSP newtarget = nullptr;
//EM loop
for (int emloop = 1; emloop <= iterEM; emloop++) {
//set the new target as current target
if (!newtarget.isNull()) {
nnf_TargetToSource->input = newtarget;
target = newtarget;
newtarget = nullptr;
}
for (int x = 0; x < target->size().width(); ++x) {
for (int y = 0; y < target->size().height(); ++y) {
if (!source->containsMasked(x, y, radius)) {
nnf_TargetToSource->field[x][y].x = x;
nnf_TargetToSource->field[x][y].y = y;
nnf_TargetToSource->field[x][y].distance = 0;
}
}
}
//minimize the NNF
nnf_TargetToSource->minimize(iterNNF);
//Now we rebuild the target using best patches from source
MaskedImageSP newsource = nullptr;
bool upscaled = false;
// Instead of upsizing the final target, we build the last target from the next level source image
// So the final target is less blurry (see "Space-Time Video Completion" - page 5)
if (level >= 1 && (emloop == iterEM)) {
newsource = pyramid.at(level - 1);
QRect sz = newsource->size();
newtarget = target->copy();
newtarget->upscale(sz.width(), sz.height());
upscaled = true;
} else {
newsource = pyramid.at(level);
newtarget = target->copy();
upscaled = false;
}
//EM Step
//EM_Step(newsource, newtarget, radius, upscaled);
ExpectationStep(nnf_TargetToSource, newsource, newtarget, upscaled);
}
return newtarget;
}
void NearestNeighborField::ExpectationStep(NearestNeighborFieldSP nnf, MaskedImageSP source, MaskedImageSP target, bool upscale)
{
//int*** field = nnf->field;
int R = nnf->patchSize;
if (upscale)
R *= 2;
int H_nnf = nnf->input->size().height();
int W_nnf = nnf->input->size().width();
int H_target = target->size().height();
int W_target = target->size().width();
int H_source = source->size().height();
int W_source = source->size().width();
std::vector< quint8* > pixels;
std::vector< float > weights;
pixels.reserve(R * R);
weights.reserve(R * R);
for (int x = 0 ; x < W_target ; ++x) {
for (int y = 0 ; y < H_target; ++y) {
float wsum = 0;
pixels.clear();
weights.clear();
if (!source->containsMasked(x, y, R + 4) /*&& upscale*/) {
//speedup computation by copying parts that are not masked.
pixels.push_back(source->getImagePixel(x, y));
weights.push_back(1.f);
target->mixColors(pixels, weights, 1.f, target->getImagePixel(x, y));
} else {
for (int dx = -R ; dx <= R; ++dx) {
for (int dy = -R ; dy <= R ; ++dy) {
// xpt,ypt = center pixel of the target patch
int xpt = x + dx;
int ypt = y + dy;
int xst, yst;
float w;
if (!upscale) {
if (xpt < 0 || xpt >= W_nnf || ypt < 0 || ypt >= H_nnf)
continue;
xst = nnf->field[xpt][ypt].x;
yst = nnf->field[xpt][ypt].y;
float dp = nnf->field[xpt][ypt].distance;
// similarity measure between the two patches
w = nnf->similarity[dp];
} else {
if (xpt < 0 || (xpt / 2) >= W_nnf || ypt < 0 || (ypt / 2) >= H_nnf)
continue;
xst = 2 * nnf->field[xpt / 2][ypt / 2].x + (xpt % 2);
yst = 2 * nnf->field[xpt / 2][ypt / 2].y + (ypt % 2);
float dp = nnf->field[xpt / 2][ypt / 2].distance;
// similarity measure between the two patches
w = nnf->similarity[dp];
}
int xs = xst - dx;
int ys = yst - dy;
if (xs < 0 || xs >= W_source || ys < 0 || ys >= H_source)
continue;
if (source->isMasked(xs, ys))
continue;
pixels.push_back(source->getImagePixel(xs, ys));
weights.push_back(w);
wsum += w;
}
}
if (wsum < 1)
continue;
target->mixColors(pixels, weights, wsum, target->getImagePixel(x, y));
}
}
}
}
QRect getMaskBoundingBox(KisPaintDeviceSP maskDev)
{
- KoColor defaultMaskPixel = maskDev->defaultPixel();
- maskDev->setDefaultPixel(KoColor(Qt::white, maskDev->colorSpace()));
QRect maskRect = maskDev->nonDefaultPixelArea();
- maskDev->setDefaultPixel(defaultMaskPixel);
-
return maskRect;
}
-QRect patchImage(KisPaintDeviceSP imageDev, KisPaintDeviceSP maskDev, int patchRadius, int accuracy)
+QRect patchImage(const KisPaintDeviceSP imageDev, const KisPaintDeviceSP maskDev, int patchRadius, int accuracy)
{
QRect maskRect = getMaskBoundingBox(maskDev);
QRect imageRect = imageDev->exactBounds();
float scale = 1 + (accuracy / 25); //higher accuracy means we include more surrouding area around the patch. Minimum 2x padding.
int dx = maskRect.width() * scale;
int dy = maskRect.height() * scale;
maskRect.adjust(-dx, -dy, dx, dy);
maskRect = maskRect.intersected(imageRect);
- KisPaintDeviceSP tempImageDev = new KisPaintDevice(imageDev->colorSpace());
- KisPaintDeviceSP tempMaskDev = new KisPaintDevice(maskDev->colorSpace());
- tempImageDev->makeCloneFrom(imageDev, maskRect);
- tempMaskDev->makeCloneFrom(maskDev, maskRect);
-
if (!maskRect.isEmpty()) {
- Inpaint inpaint(tempImageDev, tempMaskDev, patchRadius);
+ Inpaint inpaint(imageDev, maskDev, patchRadius, maskRect);
MaskedImageSP output = inpaint.patch();
output->toPaintDevice(imageDev, maskRect);
}
return maskRect;
}
diff --git a/plugins/tools/tool_smart_patch/kis_tool_smart_patch.cpp b/plugins/tools/tool_smart_patch/kis_tool_smart_patch.cpp
index d65329bd73..8aae695636 100644
--- a/plugins/tools/tool_smart_patch/kis_tool_smart_patch.cpp
+++ b/plugins/tools/tool_smart_patch/kis_tool_smart_patch.cpp
@@ -1,236 +1,271 @@
/*
* Copyright (c) 2017 Eugene Ingerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_tool_smart_patch.h"
#include "QApplication"
+#include "QPainterPath"
#include <klocalizedstring.h>
-#include <KoCanvasBase.h>
-
+#include <KoColor.h>
#include <KisViewManager.h>
#include "kis_canvas2.h"
#include "kis_cursor.h"
-#include "kis_config.h"
+#include "kis_painter.h"
+#include "kis_paintop_preset.h"
+
#include "kundo2magicstring.h"
+#include "kundo2stack.h"
+#include "kis_transaction_based_command.h"
+#include "kis_transaction.h"
+
+#include "kis_processing_applicator.h"
+#include "kis_datamanager.h"
-#include "KoProperties.h"
#include "KoColorSpaceRegistry.h"
-#include "KoShapeController.h"
-#include "KoDocumentResourceManager.h"
-#include "kis_node_manager.h"
-#include "kis_cursor.h"
#include "kis_tool_smart_patch_options_widget.h"
#include "libs/image/kis_paint_device_debug_utils.h"
-#include "kis_resources_snapshot.h"
-#include "kis_layer.h"
-#include "kis_transaction.h"
#include "kis_paint_layer.h"
-#include "kis_inpaint_mask.h"
-
QRect patchImage(KisPaintDeviceSP imageDev, KisPaintDeviceSP maskDev, int radius, int accuracy);
+class KisToolSmartPatch::InpaintCommand : public KisTransactionBasedCommand {
+public:
+ InpaintCommand( KisPaintDeviceSP maskDev, KisPaintDeviceSP imageDev, int accuracy, int patchRadius ) :
+ m_maskDev(maskDev), m_imageDev(imageDev), m_accuracy(accuracy), m_patchRadius(patchRadius) {}
+
+ KUndo2Command* paint() override {
+ KisTransaction transaction(m_imageDev);
+ patchImage(m_imageDev, m_maskDev, m_patchRadius, m_accuracy);
+ return transaction.endAndTake();
+ }
+
+private:
+ KisPaintDeviceSP m_maskDev, m_imageDev;
+ int m_accuracy, m_patchRadius;
+};
+
struct KisToolSmartPatch::Private {
- KisMaskSP mask = nullptr;
- KisNodeSP maskNode = nullptr;
- KisNodeSP paintNode = nullptr;
- KisPaintDeviceSP imageDev = nullptr;
KisPaintDeviceSP maskDev = nullptr;
- KisResourcesSnapshotSP resources = nullptr;
- KoColor currentFgColor;
+ KisPainter maskDevPainter;
+ float brushRadius = 50.; //initial default. actually read from ui.
KisToolSmartPatchOptionsWidget *optionsWidget = nullptr;
+ QRectF oldOutlineRect;
+ QPainterPath brushOutline;
};
KisToolSmartPatch::KisToolSmartPatch(KoCanvasBase * canvas)
- : KisToolFreehand(canvas,
- KisCursor::load("tool_freehand_cursor.png", 5, 5),
- kundo2_i18n("Smart Patch Stroke")),
+ : KisToolPaint(canvas, KisCursor::blankCursor()),
m_d(new Private)
{
+ setSupportOutline(true);
setObjectName("tool_SmartPatch");
+ m_d->maskDev = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
+ m_d->maskDevPainter.begin( m_d->maskDev );
+
+ m_d->maskDevPainter.setPaintColor(KoColor(Qt::magenta, m_d->maskDev->colorSpace()));
+ m_d->maskDevPainter.setBackgroundColor(KoColor(Qt::white, m_d->maskDev->colorSpace()));
+ m_d->maskDevPainter.setFillStyle( KisPainter::FillStyleForegroundColor );
}
KisToolSmartPatch::~KisToolSmartPatch()
{
m_d->optionsWidget = nullptr;
+ m_d->maskDevPainter.end();
}
void KisToolSmartPatch::activate(ToolActivation activation, const QSet<KoShape*> &shapes)
{
- KisToolFreehand::activate(activation, shapes);
+ KisToolPaint::activate(activation, shapes);
}
void KisToolSmartPatch::deactivate()
{
- KisToolFreehand::deactivate();
+ KisToolPaint::deactivate();
}
void KisToolSmartPatch::resetCursorStyle()
{
- KisToolFreehand::resetCursorStyle();
-}
-
-
-bool KisToolSmartPatch::canCreateInpaintMask() const
-{
- KisNodeSP node = currentNode();
- return node && node->inherits("KisPaintLayer");
-}
-
-QRect KisToolSmartPatch::inpaintImage(KisPaintDeviceSP maskDev, KisPaintDeviceSP imageDev)
-{
- int accuracy = 50; //default accuracy - middle value
- int patchRadius = 4; //default radius, which works well for most cases tested
-
- if (!m_d.isNull() && m_d->optionsWidget) {
- accuracy = m_d->optionsWidget->getAccuracy();
- patchRadius = m_d->optionsWidget->getPatchRadius();
- }
- return patchImage(imageDev, maskDev, patchRadius, accuracy);
+ KisToolPaint::resetCursorStyle();
}
void KisToolSmartPatch::activatePrimaryAction()
{
- KisToolFreehand::activatePrimaryAction();
+ setOutlineEnabled(true);
+ KisToolPaint::activatePrimaryAction();
}
void KisToolSmartPatch::deactivatePrimaryAction()
{
- KisToolFreehand::deactivatePrimaryAction();
+ setOutlineEnabled(false);
+ KisToolPaint::deactivatePrimaryAction();
}
-void KisToolSmartPatch::createInpaintMask(void)
+void KisToolSmartPatch::addMaskPath( KoPointerEvent *event )
{
- m_d->mask = new KisInpaintMask();
+ QPointF imagePos = currentImage()->documentToPixel(event->point);
+ QPainterPath currentBrushOutline = brushOutline().translated(imagePos);
+ m_d->maskDevPainter.fillPainterPath(currentBrushOutline);
- KisLayerSP parentLayer = qobject_cast<KisLayer*>(m_d->paintNode.data());
- m_d->mask->initSelection(parentLayer);
- image()->addNode(m_d->mask, m_d->paintNode);
-}
-
-void KisToolSmartPatch::deleteInpaintMask(void)
-{
- KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
- KisViewManager* viewManager = kiscanvas->viewManager();
- if (! m_d->paintNode.isNull())
- viewManager->nodeManager()->slotNonUiActivatedNode(m_d->paintNode);
-
- image()->removeNode(m_d->mask);
- m_d->mask = nullptr;
+ canvas()->updateCanvas(currentImage()->pixelToDocument(m_d->maskDev->exactBounds()));
}
void KisToolSmartPatch::beginPrimaryAction(KoPointerEvent *event)
{
- m_d->paintNode = currentNode();
-
- KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
- KisViewManager* viewManager = kiscanvas->viewManager();
-
//we can only apply inpaint operation to paint layer
- if (!m_d->paintNode.isNull() && m_d->paintNode->inherits("KisPaintLayer")) {
-
-
- if (!m_d->mask.isNull()) {
- viewManager->nodeManager()->slotNonUiActivatedNode(m_d->mask);
- } else {
-
- createInpaintMask();
- viewManager->nodeManager()->slotNonUiActivatedNode(m_d->mask);
-
- //Collapse freehand drawing of the mask followed by inpaint operation into a single undo node
- canvas()->shapeController()->resourceManager()->undoStack()->beginMacro(kundo2_i18n("Smart Patch"));
-
-
- //User will be drawing on an alpha mask. Show color matching inpaint mask color.
- m_d->currentFgColor = canvas()->resourceManager()->foregroundColor();
- canvas()->resourceManager()->setForegroundColor(KoColor(Qt::magenta, image()->colorSpace()));
- }
- KisToolFreehand::beginPrimaryAction(event);
- } else {
- viewManager->
- showFloatingMessage(
- i18n("Select a paint layer to use this tool"),
- QIcon(), 2000, KisFloatingMessage::Medium, Qt::AlignCenter);
+ if ( currentNode().isNull() || !currentNode()->inherits("KisPaintLayer") || nodePaintAbility()!=NodePaintAbility::PAINT ) {
+ KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
+ kiscanvas->viewManager()->
+ showFloatingMessage(
+ i18n("Select a paint layer to use this tool"),
+ QIcon(), 2000, KisFloatingMessage::Medium, Qt::AlignCenter);
+ event->ignore();
+ return;
}
+
+ addMaskPath(event);
+ setMode(KisTool::PAINT_MODE);
+ KisToolPaint::beginPrimaryAction(event);
}
void KisToolSmartPatch::continuePrimaryAction(KoPointerEvent *event)
{
- if (!m_d->mask.isNull())
- KisToolFreehand::continuePrimaryAction(event);
+ CHECK_MODE_SANITY_OR_RETURN(KisTool::PAINT_MODE);
+ addMaskPath(event);
+ KisToolPaint::continuePrimaryAction(event);
}
void KisToolSmartPatch::endPrimaryAction(KoPointerEvent *event)
{
- if (mode() != KisTool::PAINT_MODE)
- return;
+ CHECK_MODE_SANITY_OR_RETURN(KisTool::PAINT_MODE);
+ addMaskPath(event);
+ KisToolPaint::endPrimaryAction(event);
+ setMode(KisTool::HOVER_MODE);
- if (m_d->mask.isNull())
- return;
+ QApplication::setOverrideCursor(KisCursor::waitCursor());
+
+ int accuracy = 50; //default accuracy - middle value
+ int patchRadius = 4; //default radius, which works well for most cases tested
+
+ if (m_d->optionsWidget) {
+ accuracy = m_d->optionsWidget->getAccuracy();
+ patchRadius = m_d->optionsWidget->getPatchRadius();
+ }
+
+ KisProcessingApplicator applicator( image(), currentNode(), KisProcessingApplicator::NONE, KisImageSignalVector() << ModifiedSignal,
+ kundo2_i18n("Smart Patch"));
- KisToolFreehand::endPrimaryAction(event);
+ //actual inpaint operation. filling in areas masked by user
+ applicator.applyCommand( new InpaintCommand( KisPainter::convertToAlphaAsAlpha(m_d->maskDev), currentNode()->paintDevice(), accuracy, patchRadius ),
+ KisStrokeJobData::BARRIER, KisStrokeJobData::EXCLUSIVE );
- //Next line is important. We need to wait for the paint operation to finish otherwise
- //mask will be incomplete.
+ applicator.end();
image()->waitForDone();
- //User drew a mask on the temporary inpaint mask layer. Get this mask to pass to the inpaint algorithm
- m_d->maskDev = new KisPaintDevice(KoColorSpaceRegistry::instance()->alpha8());
+ QApplication::restoreOverrideCursor();
+ m_d->maskDev->clear();
+}
- if (!m_d->mask.isNull()) {
- m_d->maskDev->makeCloneFrom(m_d->mask->paintDevice(), m_d->mask->paintDevice()->extent());
+QPainterPath KisToolSmartPatch::brushOutline( void )
+{
+ const qreal diameter = m_d->brushRadius;
+ QPainterPath outline;
+ outline.addEllipse(QPointF(0,0), -0.5 * diameter, -0.5 * diameter );
+ return outline;
+}
- //Once we get the mask we delete the temporary layer on which user painted it
- deleteInpaintMask();
+QPainterPath KisToolSmartPatch::getBrushOutlinePath(const QPointF &documentPos,
+ const KoPointerEvent *event)
+{
+ Q_UNUSED(event);
- image()->waitForDone();
- m_d->imageDev = currentNode()->paintDevice();
+ QPointF imagePos = currentImage()->documentToPixel(documentPos);
+ QPainterPath path = brushOutline();
- KisTransaction inpaintTransaction(kundo2_i18n("Inpaint Operation"), m_d->imageDev);
+ return path.translated( imagePos.rx(), imagePos.ry() );
+}
- QApplication::setOverrideCursor(KisCursor::waitCursor());
+void KisToolSmartPatch::requestUpdateOutline(const QPointF &outlineDocPoint, const KoPointerEvent *event)
+{
+ static QPointF lastDocPoint = QPointF(0,0);
+ if( event )
+ lastDocPoint=outlineDocPoint;
+
+ m_d->brushRadius = currentPaintOpPreset()->settings()->paintOpSize();
+ m_d->brushOutline = getBrushOutlinePath(lastDocPoint, event);
+
+ QRectF outlinePixelRect = m_d->brushOutline.boundingRect();
+ QRectF outlineDocRect = currentImage()->pixelToDocument(outlinePixelRect);
+
+ // This adjusted call is needed as we paint with a 3 pixel wide brush and the pen is outside the bounds of the path
+ // Pen uses view coordinates so we have to zoom the document value to match 2 pixel in view coordiates
+ // See BUG 275829
+ qreal zoomX;
+ qreal zoomY;
+ canvas()->viewConverter()->zoom(&zoomX, &zoomY);
+ qreal xoffset = 2.0/zoomX;
+ qreal yoffset = 2.0/zoomY;
+
+ if (!outlineDocRect.isEmpty()) {
+ outlineDocRect.adjust(-xoffset,-yoffset,xoffset,yoffset);
+ }
- //actual inpaint operation. filling in areas masked by user
- QRect changedRect = inpaintImage(m_d->maskDev, m_d->imageDev);
- currentNode()->setDirty(changedRect);
- inpaintTransaction.commit(image()->undoAdapter());
+ if (!m_d->oldOutlineRect.isEmpty()) {
+ canvas()->updateCanvas(m_d->oldOutlineRect);
+ }
- //Matching endmacro for inpaint operation
- canvas()->shapeController()->resourceManager()->undoStack()->endMacro();
+ if (!outlineDocRect.isEmpty()) {
+ canvas()->updateCanvas(outlineDocRect);
+ }
- QApplication::restoreOverrideCursor();
+ m_d->oldOutlineRect = outlineDocRect;
+}
- canvas()->resourceManager()->setForegroundColor(m_d->currentFgColor);
+void KisToolSmartPatch::paint(QPainter &painter, const KoViewConverter &converter)
+{
+ Q_UNUSED(converter);
+
+ painter.save();
+ painter.setCompositionMode(QPainter::RasterOp_SourceXorDestination);
+ painter.setPen(QColor(128, 255, 128));
+ painter.drawPath(pixelToView(m_d->brushOutline));
+ painter.restore();
+
+ painter.save();
+ painter.setBrush(Qt::magenta);
+ QImage img = m_d->maskDev->convertToQImage(0);
+ if( !img.size().isEmpty() ){
+ painter.drawImage(pixelToView(m_d->maskDev->exactBounds()), img);
}
+ painter.restore();
}
QWidget * KisToolSmartPatch::createOptionWidget()
{
KisCanvas2 * kiscanvas = dynamic_cast<KisCanvas2*>(canvas());
m_d->optionsWidget = new KisToolSmartPatchOptionsWidget(kiscanvas->viewManager()->resourceProvider(), 0);
m_d->optionsWidget->setObjectName(toolId() + "option widget");
return m_d->optionsWidget;
}
diff --git a/plugins/tools/tool_smart_patch/kis_tool_smart_patch.h b/plugins/tools/tool_smart_patch/kis_tool_smart_patch.h
index 8797bb38b9..69ebf3e205 100644
--- a/plugins/tools/tool_smart_patch/kis_tool_smart_patch.h
+++ b/plugins/tools/tool_smart_patch/kis_tool_smart_patch.h
@@ -1,103 +1,110 @@
/*
* Copyright (c) 2017 Eugene Ingerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_SMART_PATCH_H_
#define KIS_TOOL_SMART_PATCH_H_
#include <QScopedPointer>
-#include "kis_tool_freehand.h"
+#include <QPainterPath>
+
+#include "kis_tool_paint.h"
#include "KoToolFactoryBase.h"
#include <flake/kis_node_shape.h>
#include <kis_icon.h>
#include <QKeySequence>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <KoIcon.h>
class KActionCollection;
class KoCanvasBase;
+class KisPaintInformation;
+class KisSpacingInfomation;
+
-class KisToolSmartPatch : public KisToolFreehand
+class KisToolSmartPatch : public KisToolPaint
{
Q_OBJECT
public:
KisToolSmartPatch(KoCanvasBase * canvas);
- virtual ~KisToolSmartPatch();
+ ~KisToolSmartPatch() override;
- QWidget * createOptionWidget();
+ QWidget * createOptionWidget() override;
- void activatePrimaryAction();
- void deactivatePrimaryAction();
+ void activatePrimaryAction() override;
+ void deactivatePrimaryAction() override;
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
+ void paint(QPainter &painter, const KoViewConverter &converter) override;
+ int flags() const override { return KisTool::FLAG_USES_CUSTOM_SIZE; }
protected Q_SLOTS:
- void resetCursorStyle();
+ void resetCursorStyle() override;
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- void deactivate();
-
-Q_SIGNALS:
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
private:
- bool canCreateInpaintMask() const;
- QRect inpaintImage(KisPaintDeviceSP maskDev, KisPaintDeviceSP imageDev);
+ //QRect inpaintImage(KisPaintDeviceSP maskDev, KisPaintDeviceSP imageDev);
+ QPainterPath getBrushOutlinePath(const QPointF &documentPos, const KoPointerEvent *event);
+ QPainterPath brushOutline();
+ void requestUpdateOutline(const QPointF &outlineDocPoint, const KoPointerEvent *event) override;
private:
struct Private;
+ class InpaintCommand;
const QScopedPointer<Private> m_d;
- void createInpaintMask();
- void deleteInpaintMask();
+ void addMaskPath(KoPointerEvent *event);
};
class KisToolSmartPatchFactory : public KoToolFactoryBase
{
public:
KisToolSmartPatchFactory()
: KoToolFactoryBase("KritaShape/KisToolSmartPatch")
{
setToolTip(i18n("Smart Patch Tool"));
setSection(TOOL_TYPE_FILL);
setIconName(koIconNameCStr("krita_tool_smart_patch"));
setShortcut(QKeySequence(Qt::Key_Shift + Qt::Key_I));
setPriority(4);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolSmartPatchFactory() {}
+ ~KisToolSmartPatchFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas)
+ KoToolBase * createTool(KoCanvasBase *canvas) override
{
return new KisToolSmartPatch(canvas);
}
};
#endif // KIS_TOOL_SMART_PATCH_H_
diff --git a/plugins/tools/tool_smart_patch/kis_tool_smart_patch_options_widget.h b/plugins/tools/tool_smart_patch/kis_tool_smart_patch_options_widget.h
index 87289a0fc5..4a3b5abead 100644
--- a/plugins/tools/tool_smart_patch/kis_tool_smart_patch_options_widget.h
+++ b/plugins/tools/tool_smart_patch/kis_tool_smart_patch_options_widget.h
@@ -1,47 +1,47 @@
/*
* Copyright (c) 2017 Eugene Ingerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_SMART_PATCH_OPTIONS_WIDGET_H
#define __KIS_TOOL_SMART_PATCH_OPTIONS_WIDGET_H
#include <QScopedPointer>
#include <QWidget>
#include <QModelIndex>
#include "kis_types.h"
class KisCanvasResourceProvider;
class KoColor;
class KisToolSmartPatchOptionsWidget : public QWidget
{
Q_OBJECT
public:
KisToolSmartPatchOptionsWidget(KisCanvasResourceProvider *provider, QWidget *parent);
- ~KisToolSmartPatchOptionsWidget();
+ ~KisToolSmartPatchOptionsWidget() override;
int getPatchRadius(void);
int getAccuracy(void);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_TOOL_SMART_PATCH_OPTIONS_WIDGET_H */
diff --git a/plugins/tools/tool_smart_patch/tool_smartpatch.h b/plugins/tools/tool_smart_patch/tool_smartpatch.h
index 1f3b7c4db6..02a2f499b1 100644
--- a/plugins/tools/tool_smart_patch/tool_smartpatch.h
+++ b/plugins/tools/tool_smart_patch/tool_smartpatch.h
@@ -1,34 +1,34 @@
/*
* Copyright (c) 2017 Eugene Ingerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_SMARTPATCH_H_
#define TOOL_SMARTPATCH_H_
#include <QObject>
#include <QVariant>
class ToolSmartPatch : public QObject
{
Q_OBJECT
public:
ToolSmartPatch(QObject *parent, const QVariantList &);
- virtual ~ToolSmartPatch();
+ ~ToolSmartPatch() override;
};
#endif // TOOL_SMARTPATCH_H_
diff --git a/plugins/tools/tool_text/kis_tool_text.h b/plugins/tools/tool_text/kis_tool_text.h
index b28496dcd8..80a2524b77 100644
--- a/plugins/tools/tool_text/kis_tool_text.h
+++ b/plugins/tools/tool_text/kis_tool_text.h
@@ -1,111 +1,111 @@
/*
*
* Copyright (c) 2011 Sven Langkamp <sven.langkamp@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TOOL_TEXT_H__
#define __KIS_TOOL_TEXT_H__
#include <QRect>
#include "KoToolFactoryBase.h"
#include <kis_tool_rectangle_base.h>
#include "kis_text_tool_option_widget.h"
#include <kis_icon.h>
#include <kconfig.h>
#include <kconfiggroup.h>
/**
* You are now reading a beautiful solution to a hideous abstraction. The old
* Calligra suite developed text interaction methods that were intended to be
* appropriate for an entire suite of office apps at once. This tool hooks up
* Krita to the two old text interaction methods, one designed to be like a word
* processor for a paragraph of text ("texttool"), the other designed to make a
* very pretty single line of text ("artistictexttool"), and squishes them
* together into a single digital-painting wrapper. Surprisingly, the base class
* is KisToolRectangle. This is because the first interaction the user makes
* will be drawing an outline for the text area. After the shape is drawn, the
* rectangle tool will deactivate, switching to one of the two text tools
* which will be used to interact with the new shape on canvas.
*
* I call "not dibs" on cleaning this up.
*
* TODO: Disallow the appearance of the Artistic Text Shape tool in the toolbox.
*/
class KisToolText : public KisToolRectangleBase
{
Q_OBJECT
public:
KisToolText(KoCanvasBase * canvas);
- virtual ~KisToolText();
+ ~KisToolText() override;
/// These functions are inherited from KisToolRectangleBase. They simply
/// draw a rectangle. endPrimaryAction calls finishRect.
- virtual void beginPrimaryAction(KoPointerEvent *event);
- virtual void continuePrimaryAction(KoPointerEvent *event);
- virtual void endPrimaryAction(KoPointerEvent *event);
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- virtual QList<QPointer<QWidget> > createOptionWidgets();
+ QList<QPointer<QWidget> > createOptionWidgets() override;
- virtual KisPainter::FillStyle fillStyle();
+ KisPainter::FillStyle fillStyle() override;
private:
KConfigGroup m_configGroup;
private Q_SLOTS:
/// slotActivateTextTool signals to the ToolManager that the Rectangle Tool
/// work is done, and it should switch to a new tool for text editing.
void slotActivateTextTool();
void styleIndexChanged(int index);
void textTypeIndexChanged(int index);
protected:
/// finishRect places the text box on canvas and calls slotActivateTextTool.
- virtual void finishRect(const QRectF& rect);
+ void finishRect(const QRectF& rect) override;
KisTextToolOptionWidget* m_optionsWidget;
};
class KisToolTextFactory : public KoToolFactoryBase
{
public:
KisToolTextFactory()
: KoToolFactoryBase("KritaShape/KisToolText") {
setToolTip(i18n("Text Tool"));
setSection(mainToolType());
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
setIconName(koIconNameCStr("draw-text"));
setPriority(1);
}
- virtual ~KisToolTextFactory() {}
+ ~KisToolTextFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolText(canvas);
}
};
#endif // __KIS_TOOL_TEXT_H__
diff --git a/plugins/tools/tool_text/tool_text.h b/plugins/tools/tool_text/tool_text.h
index 282cae8f8a..6d587ccaf5 100644
--- a/plugins/tools/tool_text/tool_text.h
+++ b/plugins/tools/tool_text/tool_text.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_TEXT_H_
#define TOOL_TEXT_H_
#include <QObject>
#include <QVariant>
/**
* A module that provides a text tool.
*/
class ToolText : public QObject
{
Q_OBJECT
public:
ToolText(QObject *parent, const QVariantList &);
- virtual ~ToolText();
+ ~ToolText() override;
};
#endif // TOOL_TEXT_H_
diff --git a/plugins/tools/tool_transform2/kis_animated_transform_parameters.h b/plugins/tools/tool_transform2/kis_animated_transform_parameters.h
index 17eb7083a6..513392f1e6 100644
--- a/plugins/tools/tool_transform2/kis_animated_transform_parameters.h
+++ b/plugins/tools/tool_transform2/kis_animated_transform_parameters.h
@@ -1,61 +1,61 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_ANIMATED_TRANSFORM_MASK_PARAMETERS_H
#define __KIS_ANIMATED_TRANSFORM_MASK_PARAMETERS_H
#include "kis_transform_mask_adapter.h"
#include "kritatooltransform_export.h"
class KisKeyframeChannel;
class KRITATOOLTRANSFORM_EXPORT KisAnimatedTransformMaskParameters : public KisTransformMaskAdapter, public KisAnimatedTransformParamsInterface
{
public:
KisAnimatedTransformMaskParameters();
KisAnimatedTransformMaskParameters(const KisTransformMaskAdapter *staticTransform);
- ~KisAnimatedTransformMaskParameters();
+ ~KisAnimatedTransformMaskParameters() override;
- const ToolTransformArgs& transformArgs() const;
+ const ToolTransformArgs& transformArgs() const override;
- QString id() const;
- void toXML(QDomElement *e) const;
+ QString id() const override;
+ void toXML(QDomElement *e) const override;
static KisTransformMaskParamsInterfaceSP fromXML(const QDomElement &e);
static KisTransformMaskParamsInterfaceSP animate(KisTransformMaskParamsInterfaceSP params);
- void translate(const QPointF &offset);
+ void translate(const QPointF &offset) override;
- KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds);
+ KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds) override;
- bool isHidden() const;
+ bool isHidden() const override;
void setHidden(bool hidden);
- void clearChangedFlag();
- bool hasChanged() const;
+ void clearChangedFlag() override;
+ bool hasChanged() const override;
bool isAnimated() const;
static void addKeyframes(KisTransformMaskSP mask, int time, KisTransformMaskParamsInterfaceSP params, KUndo2Command *parentCommand);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif
diff --git a/plugins/tools/tool_transform2/kis_cage_transform_strategy.h b/plugins/tools/tool_transform2/kis_cage_transform_strategy.h
index a5ee032cb4..c6d386b09e 100644
--- a/plugins/tools/tool_transform2/kis_cage_transform_strategy.h
+++ b/plugins/tools/tool_transform2/kis_cage_transform_strategy.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_CAGE_TRANSFORM_STRATEGY_H
#define __KIS_CAGE_TRANSFORM_STRATEGY_H
#include <QObject>
#include <QScopedPointer>
#include "kis_warp_transform_strategy.h"
class QPointF;
class QPainter;
class KisCoordinatesConverter;
class ToolTransformArgs;
class TransformTransactionProperties;
class QImage;
class KisCageTransformStrategy : public KisWarpTransformStrategy
{
Q_OBJECT
public:
KisCageTransformStrategy(const KisCoordinatesConverter *converter,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction);
- ~KisCageTransformStrategy();
+ ~KisCageTransformStrategy() override;
protected:
void drawConnectionLines(QPainter &gc,
const QVector<QPointF> &origPoints,
const QVector<QPointF> &transfPoints,
- bool isEditingPoints);
+ bool isEditingPoints) override;
QImage calculateTransformedImage(ToolTransformArgs &currentArgs,
const QImage &srcImage,
const QVector<QPointF> &origPoints,
const QVector<QPointF> &transfPoints,
const QPointF &srcOffset,
- QPointF *dstOffset);
+ QPointF *dstOffset) override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_CAGE_TRANSFORM_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/kis_free_transform_strategy.h b/plugins/tools/tool_transform2/kis_free_transform_strategy.h
index 8fad40ea84..a5e8051a66 100644
--- a/plugins/tools/tool_transform2/kis_free_transform_strategy.h
+++ b/plugins/tools/tool_transform2/kis_free_transform_strategy.h
@@ -1,68 +1,68 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_FREE_TRANSFORM_STRATEGY_H
#define __KIS_FREE_TRANSFORM_STRATEGY_H
#include <QObject>
#include <QScopedPointer>
#include "kis_simplified_action_policy_strategy.h"
class QPointF;
class QPainter;
class KisCoordinatesConverter;
class ToolTransformArgs;
class TransformTransactionProperties;
class QCursor;
class KisFreeTransformStrategy : public KisSimplifiedActionPolicyStrategy
{
Q_OBJECT
public:
KisFreeTransformStrategy(const KisCoordinatesConverter *converter,
KoSnapGuide *snapGuide,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction);
- ~KisFreeTransformStrategy();
+ ~KisFreeTransformStrategy() override;
- void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive);
- void paint(QPainter &gc);
- QCursor getCurrentCursor() const;
+ void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive) override;
+ void paint(QPainter &gc) override;
+ QCursor getCurrentCursor() const override;
- void externalConfigChanged();
+ void externalConfigChanged() override;
using KisTransformStrategyBase::beginPrimaryAction;
using KisTransformStrategyBase::continuePrimaryAction;
using KisTransformStrategyBase::endPrimaryAction;
- bool beginPrimaryAction(const QPointF &pt);
- void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive);
- bool endPrimaryAction();
+ bool beginPrimaryAction(const QPointF &pt) override;
+ void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive) override;
+ bool endPrimaryAction() override;
Q_SIGNALS:
void requestCanvasUpdate();
void requestResetRotationCenterButtons();
void requestShowImageTooBig(bool value);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_FREE_TRANSFORM_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/kis_liquify_transform_strategy.cpp b/plugins/tools/tool_transform2/kis_liquify_transform_strategy.cpp
index ab548fd54c..16b9b29d62 100644
--- a/plugins/tools/tool_transform2/kis_liquify_transform_strategy.cpp
+++ b/plugins/tools/tool_transform2/kis_liquify_transform_strategy.cpp
@@ -1,309 +1,310 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_liquify_transform_strategy.h"
#include <algorithm>
#include <QPointF>
#include <QPainter>
#include "KoPointerEvent.h"
#include "kis_coordinates_converter.h"
#include "tool_transform_args.h"
#include "transform_transaction_properties.h"
#include "krita_utils.h"
#include "kis_cursor.h"
#include "kis_transform_utils.h"
#include "kis_algebra_2d.h"
#include "kis_transform_utils.h"
#include "kis_liquify_paint_helper.h"
#include "kis_liquify_transform_worker.h"
#include "KoCanvasResourceManager.h"
struct KisLiquifyTransformStrategy::Private
{
Private(KisLiquifyTransformStrategy *_q,
const KisCoordinatesConverter *_converter,
ToolTransformArgs &_currentArgs,
TransformTransactionProperties &_transaction,
const KoCanvasResourceManager *_manager)
: manager(_manager),
q(_q),
converter(_converter),
currentArgs(_currentArgs),
transaction(_transaction),
helper(_converter),
recalculateOnNextRedraw(false)
{
}
const KoCanvasResourceManager *manager;
KisLiquifyTransformStrategy * const q;
/// standard members ///
const KisCoordinatesConverter *converter;
//////
ToolTransformArgs &currentArgs;
//////
TransformTransactionProperties &transaction;
QTransform paintingTransform;
QPointF paintingOffset;
QTransform handlesTransform;
/// custom members ///
QImage transformedImage;
// size-gesture-related
QPointF lastMouseWidgetPos;
QPointF startResizeImagePos;
QPoint startResizeGlobalCursorPos;
KisLiquifyPaintHelper helper;
bool recalculateOnNextRedraw;
void recalculateTransformations();
inline QPointF imageToThumb(const QPointF &pt, bool useFlakeOptimization);
};
KisLiquifyTransformStrategy::KisLiquifyTransformStrategy(const KisCoordinatesConverter *converter,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction,
const KoCanvasResourceManager *manager)
: m_d(new Private(this, converter, currentArgs, transaction, manager))
{
}
KisLiquifyTransformStrategy::~KisLiquifyTransformStrategy()
{
}
QPainterPath KisLiquifyTransformStrategy::getCursorOutline() const
{
return m_d->helper.brushOutline(*m_d->currentArgs.liquifyProperties());
}
void KisLiquifyTransformStrategy::setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive)
{
Q_UNUSED(mousePos);
Q_UNUSED(perspectiveModifierActive);
}
QCursor KisLiquifyTransformStrategy::getCurrentCursor() const
{
return Qt::BlankCursor;
}
void KisLiquifyTransformStrategy::paint(QPainter &gc)
{
// Draw preview image
if (m_d->recalculateOnNextRedraw) {
m_d->recalculateTransformations();
m_d->recalculateOnNextRedraw = false;
}
gc.save();
gc.setOpacity(m_d->transaction.basePreviewOpacity());
gc.setTransform(m_d->paintingTransform, true);
gc.drawImage(m_d->paintingOffset, m_d->transformedImage);
gc.restore();
}
void KisLiquifyTransformStrategy::externalConfigChanged()
{
if (!m_d->currentArgs.liquifyWorker()) return;
m_d->recalculateTransformations();
}
bool KisLiquifyTransformStrategy::acceptsClicks() const
{
return true;
}
bool KisLiquifyTransformStrategy::beginPrimaryAction(KoPointerEvent *event)
{
m_d->helper.configurePaintOp(*m_d->currentArgs.liquifyProperties(), m_d->currentArgs.liquifyWorker());
m_d->helper.startPaint(event, m_d->manager);
m_d->recalculateTransformations();
return true;
}
void KisLiquifyTransformStrategy::continuePrimaryAction(KoPointerEvent *event)
{
m_d->helper.continuePaint(event);
// the updates should be compressed
m_d->recalculateOnNextRedraw = true;
emit requestCanvasUpdate();
}
bool KisLiquifyTransformStrategy::endPrimaryAction(KoPointerEvent *event)
{
if (m_d->helper.endPaint(event)) {
m_d->recalculateTransformations();
emit requestCanvasUpdate();
}
return true;
}
void KisLiquifyTransformStrategy::hoverActionCommon(KoPointerEvent *event)
{
m_d->helper.hoverPaint(event);
}
void KisLiquifyTransformStrategy::activateAlternateAction(KisTool::AlternateAction action)
{
if (action == KisTool::PickFgNode || action == KisTool::PickBgNode ||
action == KisTool::PickFgImage || action == KisTool::PickBgImage) {
KisLiquifyProperties *props = m_d->currentArgs.liquifyProperties();
props->setReverseDirection(!props->reverseDirection());
emit requestUpdateOptionWidget();
}
}
void KisLiquifyTransformStrategy::deactivateAlternateAction(KisTool::AlternateAction action)
{
if (action == KisTool::PickFgNode || action == KisTool::PickBgNode ||
action == KisTool::PickFgImage || action == KisTool::PickBgImage) {
KisLiquifyProperties *props = m_d->currentArgs.liquifyProperties();
props->setReverseDirection(!props->reverseDirection());
emit requestUpdateOptionWidget();
}
}
bool KisLiquifyTransformStrategy::beginAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action)
{
if (action == KisTool::ChangeSize) {
QPointF widgetPoint = m_d->converter->documentToWidget(event->point);
m_d->lastMouseWidgetPos = widgetPoint;
m_d->startResizeImagePos = m_d->converter->documentToImage(event->point);
m_d->startResizeGlobalCursorPos = QCursor::pos();
return true;
} else if (action == KisTool::PickFgNode || action == KisTool::PickBgNode ||
action == KisTool::PickFgImage || action == KisTool::PickBgImage) {
return beginPrimaryAction(event);
}
return false;
}
void KisLiquifyTransformStrategy::continueAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action)
{
if (action == KisTool::ChangeSize) {
QPointF widgetPoint = m_d->converter->documentToWidget(event->point);
QPointF diff = widgetPoint - m_d->lastMouseWidgetPos;
KisLiquifyProperties *props = m_d->currentArgs.liquifyProperties();
const qreal linearizedOffset = diff.x() / KisTransformUtils::scaleFromAffineMatrix(m_d->converter->imageToWidgetTransform());
const qreal newSize = qBound(props->minSize(), props->size() + linearizedOffset, props->maxSize());
props->setSize(newSize);
m_d->currentArgs.saveLiquifyTransformMode();
m_d->lastMouseWidgetPos = widgetPoint;
emit requestCursorOutlineUpdate(m_d->startResizeImagePos);
} else if (action == KisTool::PickFgNode || action == KisTool::PickBgNode ||
action == KisTool::PickFgImage || action == KisTool::PickBgImage) {
return continuePrimaryAction(event);
}
}
bool KisLiquifyTransformStrategy::endAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action)
{
Q_UNUSED(event);
if (action == KisTool::ChangeSize) {
QCursor::setPos(m_d->startResizeGlobalCursorPos);
return true;
} else if (action == KisTool::PickFgNode || action == KisTool::PickBgNode ||
action == KisTool::PickFgImage || action == KisTool::PickBgImage) {
return endPrimaryAction(event);
}
return false;
}
inline QPointF KisLiquifyTransformStrategy::Private::imageToThumb(const QPointF &pt, bool useFlakeOptimization)
{
return useFlakeOptimization ? converter->imageToDocument(converter->documentToFlake((pt))) : q->thumbToImageTransform().inverted().map(pt);
}
void KisLiquifyTransformStrategy::Private::recalculateTransformations()
{
KIS_ASSERT_RECOVER_RETURN(currentArgs.liquifyWorker());
QTransform scaleTransform = KisTransformUtils::imageToFlakeTransform(converter);
- QTransform resultTransform = q->thumbToImageTransform() * scaleTransform;
- qreal scale = KisTransformUtils::scaleFromAffineMatrix(resultTransform);
- bool useFlakeOptimization = scale < 1.0;
+ QTransform resultThumbTransform = q->thumbToImageTransform() * scaleTransform;
+ qreal scale = KisTransformUtils::scaleFromAffineMatrix(resultThumbTransform);
+ bool useFlakeOptimization = scale < 1.0 &&
+ !KisTransformUtils::thumbnailTooSmall(resultThumbTransform, q->originalImage().rect());
paintingOffset = transaction.originalTopLeft();
if (!q->originalImage().isNull()) {
if (useFlakeOptimization) {
- transformedImage = q->originalImage().transformed(q->thumbToImageTransform() * scaleTransform);
+ transformedImage = q->originalImage().transformed(resultThumbTransform);
paintingTransform = QTransform();
} else {
transformedImage = q->originalImage();
- paintingTransform = q->thumbToImageTransform() * scaleTransform;
+ paintingTransform = resultThumbTransform;
}
QTransform imageToRealThumbTransform =
useFlakeOptimization ?
scaleTransform :
q->thumbToImageTransform().inverted();
QPointF origTLInFlake =
imageToRealThumbTransform.map(transaction.originalTopLeft());
transformedImage =
currentArgs.liquifyWorker()->runOnQImage(transformedImage,
origTLInFlake,
imageToRealThumbTransform,
&paintingOffset);
} else {
transformedImage = q->originalImage();
paintingOffset = imageToThumb(transaction.originalTopLeft(), false);
- paintingTransform = q->thumbToImageTransform() * scaleTransform;
+ paintingTransform = resultThumbTransform;
}
handlesTransform = scaleTransform;
}
diff --git a/plugins/tools/tool_transform2/kis_liquify_transform_strategy.h b/plugins/tools/tool_transform2/kis_liquify_transform_strategy.h
index 9c17450f23..5a6b69d2b0 100644
--- a/plugins/tools/tool_transform2/kis_liquify_transform_strategy.h
+++ b/plugins/tools/tool_transform2/kis_liquify_transform_strategy.h
@@ -1,75 +1,75 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_LIQUIFY_TRANSFORM_STRATEGY_H
#define __KIS_LIQUIFY_TRANSFORM_STRATEGY_H
#include <QObject>
#include <QScopedPointer>
#include "kis_transform_strategy_base.h"
class QPointF;
class QPainter;
class KisCoordinatesConverter;
class ToolTransformArgs;
class TransformTransactionProperties;
class QCursor;
class KisLiquifyTransformStrategy : public KisTransformStrategyBase
{
Q_OBJECT
public:
KisLiquifyTransformStrategy(const KisCoordinatesConverter *converter,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction, const KoCanvasResourceManager *manager);
- ~KisLiquifyTransformStrategy();
+ ~KisLiquifyTransformStrategy() override;
void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive);
- void paint(QPainter &gc);
- QCursor getCurrentCursor() const;
- QPainterPath getCursorOutline() const;
+ void paint(QPainter &gc) override;
+ QCursor getCurrentCursor() const override;
+ QPainterPath getCursorOutline() const override;
- bool acceptsClicks() const;
+ bool acceptsClicks() const override;
- void externalConfigChanged();
+ void externalConfigChanged() override;
- bool beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- bool endPrimaryAction(KoPointerEvent *event);
- void hoverActionCommon(KoPointerEvent *event);
+ bool beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ bool endPrimaryAction(KoPointerEvent *event) override;
+ void hoverActionCommon(KoPointerEvent *event) override;
- void activateAlternateAction(KisTool::AlternateAction action);
- void deactivateAlternateAction(KisTool::AlternateAction action);
+ void activateAlternateAction(KisTool::AlternateAction action) override;
+ void deactivateAlternateAction(KisTool::AlternateAction action) override;
- bool beginAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
- void continueAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
- bool endAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
+ bool beginAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action) override;
+ bool endAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action) override;
Q_SIGNALS:
void requestCanvasUpdate();
void requestUpdateOptionWidget();
void requestCursorOutlineUpdate(const QPointF &imagePoint);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_LIQUIFY_TRANSFORM_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/kis_modify_transform_mask_command.h b/plugins/tools/tool_transform2/kis_modify_transform_mask_command.h
index ee76e5caf5..16a5031ab6 100644
--- a/plugins/tools/tool_transform2/kis_modify_transform_mask_command.h
+++ b/plugins/tools/tool_transform2/kis_modify_transform_mask_command.h
@@ -1,44 +1,44 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __MODIFY_TRANFORM_MASK_COMMAND_H
#define __MODIFY_TRANFORM_MASK_COMMAND_H
#include "kundo2command.h"
#include "kis_types.h"
#include "kritatooltransform_export.h"
#include "KoID.h"
class KisAnimatedTransformMaskParameters;
class KRITATOOLTRANSFORM_EXPORT KisModifyTransformMaskCommand : public KUndo2Command {
public:
KisModifyTransformMaskCommand(KisTransformMaskSP mask, KisTransformMaskParamsInterfaceSP params);
- void redo();
- void undo();
+ void redo() override;
+ void undo() override;
private:
void updateMask(bool isHidden);
private:
KisTransformMaskSP m_mask;
KisTransformMaskParamsInterfaceSP m_params;
KisTransformMaskParamsInterfaceSP m_oldParams;
bool m_wasHidden;
};
#endif
diff --git a/plugins/tools/tool_transform2/kis_perspective_transform_strategy.h b/plugins/tools/tool_transform2/kis_perspective_transform_strategy.h
index 2f8f10d50e..c0602e2b90 100644
--- a/plugins/tools/tool_transform2/kis_perspective_transform_strategy.h
+++ b/plugins/tools/tool_transform2/kis_perspective_transform_strategy.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_PERSPECTIVE_TRANSFORM_STRATEGY_H
#define __KIS_PERSPECTIVE_TRANSFORM_STRATEGY_H
#include <QObject>
#include <QScopedPointer>
#include "kis_simplified_action_policy_strategy.h"
class QPointF;
class QPainter;
class KisCoordinatesConverter;
class ToolTransformArgs;
class TransformTransactionProperties;
class QCursor;
class KisPerspectiveTransformStrategy : public KisSimplifiedActionPolicyStrategy
{
Q_OBJECT
public:
KisPerspectiveTransformStrategy(const KisCoordinatesConverter *converter,
KoSnapGuide *snapGuide,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction);
- ~KisPerspectiveTransformStrategy();
+ ~KisPerspectiveTransformStrategy() override;
- void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive);
- void paint(QPainter &gc);
- QCursor getCurrentCursor() const;
+ void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive) override;
+ void paint(QPainter &gc) override;
+ QCursor getCurrentCursor() const override;
- void externalConfigChanged();
+ void externalConfigChanged() override;
using KisTransformStrategyBase::beginPrimaryAction;
using KisTransformStrategyBase::continuePrimaryAction;
using KisTransformStrategyBase::endPrimaryAction;
- bool beginPrimaryAction(const QPointF &pt);
- void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive);
- bool endPrimaryAction();
+ bool beginPrimaryAction(const QPointF &pt) override;
+ void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive) override;
+ bool endPrimaryAction() override;
Q_SIGNALS:
void requestCanvasUpdate();
void requestShowImageTooBig(bool value);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_PERSPECTIVE_TRANSFORM_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/kis_simplified_action_policy_strategy.h b/plugins/tools/tool_transform2/kis_simplified_action_policy_strategy.h
index 3edc20398d..54cf7394d4 100644
--- a/plugins/tools/tool_transform2/kis_simplified_action_policy_strategy.h
+++ b/plugins/tools/tool_transform2/kis_simplified_action_policy_strategy.h
@@ -1,67 +1,67 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_SIMPLIFIED_ACTION_POLICY_STRATEGY_H
#define __KIS_SIMPLIFIED_ACTION_POLICY_STRATEGY_H
#include <QScopedPointer>
#include "kis_transform_strategy_base.h"
class KoPointerEvent;
class KisCoordinatesConverter;
class KoSnapGuide;
class KisSimplifiedActionPolicyStrategy : public KisTransformStrategyBase
{
public:
KisSimplifiedActionPolicyStrategy(const KisCoordinatesConverter *_converter, KoSnapGuide *snapGuide = 0);
- ~KisSimplifiedActionPolicyStrategy();
+ ~KisSimplifiedActionPolicyStrategy() override;
- void activatePrimaryAction();
+ void activatePrimaryAction() override;
- virtual bool beginPrimaryAction(KoPointerEvent *event);
- virtual void continuePrimaryAction(KoPointerEvent *event);
- virtual bool endPrimaryAction(KoPointerEvent *event);
- virtual void hoverActionCommon(KoPointerEvent *event);
+ bool beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ bool endPrimaryAction(KoPointerEvent *event) override;
+ void hoverActionCommon(KoPointerEvent *event) override;
virtual QPointF handleSnapPoint(const QPointF &imagePos);
- virtual void activateAlternateAction(KisTool::AlternateAction action);
- virtual void deactivateAlternateAction(KisTool::AlternateAction action);
+ void activateAlternateAction(KisTool::AlternateAction action) override;
+ void deactivateAlternateAction(KisTool::AlternateAction action) override;
- virtual bool beginAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
- virtual void continueAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
- virtual bool endAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
+ bool beginAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action) override;
+ bool endAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action) override;
protected:
virtual void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive) = 0;
virtual bool beginPrimaryAction(const QPointF &pt) = 0;
virtual void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive) = 0;
virtual bool endPrimaryAction() = 0;
virtual void hoverActionCommon(const QPointF &pt);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_SIMPLIFIED_ACTION_POLICY_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/kis_tool_transform.h b/plugins/tools/tool_transform2/kis_tool_transform.h
index 5c7d8b5299..5426bfa3b8 100644
--- a/plugins/tools/tool_transform2/kis_tool_transform.h
+++ b/plugins/tools/tool_transform2/kis_tool_transform.h
@@ -1,337 +1,337 @@
/*
* kis_tool_transform.h - part of Krita
*
* Copyright (c) 2004 Boudewijn Rempt <boud@valdyas.org>
* Copyright (c) 2005 C. Boemann <cbo@boemann.dk>
* Copyright (c) 2010 Marc Pegon <pe.marc@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_TOOL_TRANSFORM_H_
#define KIS_TOOL_TRANSFORM_H_
#include <kis_icon.h>
#include <QPoint>
#include <QPointF>
#include <QVector2D>
#include <QVector3D>
#include <QButtonGroup>
#include <QPointer>
#include <QKeySequence>
#include <KoToolFactoryBase.h>
#include <kis_shape_selection.h>
#include <kis_undo_adapter.h>
#include <kis_types.h>
#include <flake/kis_node_shape.h>
#include <kis_tool.h>
#include <kis_canvas2.h>
#include "tool_transform_args.h"
#include "tool_transform_changes_tracker.h"
#include "kis_tool_transform_config_widget.h"
#include "transform_transaction_properties.h"
class QTouchEvent;
class KisTransformStrategyBase;
class KisWarpTransformStrategy;
class KisCageTransformStrategy;
class KisLiquifyTransformStrategy;
class KisFreeTransformStrategy;
class KisPerspectiveTransformStrategy;
/**
* Transform tool
* This tool offers several modes.
* - Free Transform mode allows the user to translate, scale, shear, rotate and
* apply a perspective transformation to a selection or the whole canvas.
* - Warp mode allows the user to warp the selection of the canvas by grabbing
* and moving control points placed on the image. The user can either work
* with default control points, like a grid whose density can be modified, or
* place the control points manually. The modifications made on the selected
* pixels are applied only when the user clicks the Apply button : the
* semi-transparent image displayed until the user click that button is only a
* preview.
* - Cage transform is similar to warp transform with control points exactly
* placed on the outer boundary. The user draws a boundary polygon, the
* vertices of which become control points.
* - Perspective transform applies a two-point perspective transformation. The
* user can manipulate the corners of the selection. If the vanishing points
* of the resulting quadrilateral are on screen, the user can manipulate those
* as well.
* - Liquify transform transforms the selection by painting motions, as if the
* user were fingerpainting.
*/
class KisToolTransform : public KisTool
{
Q_OBJECT
Q_PROPERTY(TransformToolMode transformMode READ transformMode WRITE setTransformMode NOTIFY transformModeChanged)
Q_PROPERTY(double translateX READ translateX WRITE setTranslateX NOTIFY freeTransformChanged)
Q_PROPERTY(double translateY READ translateY WRITE setTranslateY NOTIFY freeTransformChanged)
Q_PROPERTY(double rotateX READ rotateX WRITE setRotateX NOTIFY freeTransformChanged)
Q_PROPERTY(double rotateY READ rotateY WRITE setRotateY NOTIFY freeTransformChanged)
Q_PROPERTY(double rotateZ READ rotateZ WRITE setRotateZ NOTIFY freeTransformChanged)
Q_PROPERTY(double scaleX READ scaleX WRITE setScaleX NOTIFY freeTransformChanged)
Q_PROPERTY(double scaleY READ scaleY WRITE setScaleY NOTIFY freeTransformChanged)
Q_PROPERTY(double shearX READ shearX WRITE setShearX NOTIFY freeTransformChanged)
Q_PROPERTY(double shearY READ shearY WRITE setShearY NOTIFY freeTransformChanged)
Q_PROPERTY(WarpType warpType READ warpType WRITE setWarpType NOTIFY warpTransformChanged)
Q_PROPERTY(double warpFlexibility READ warpFlexibility WRITE setWarpFlexibility NOTIFY warpTransformChanged)
Q_PROPERTY(int warpPointDensity READ warpPointDensity WRITE setWarpPointDensity NOTIFY warpTransformChanged)
public:
enum TransformToolMode {
FreeTransformMode,
WarpTransformMode,
CageTransformMode,
LiquifyTransformMode,
PerspectiveTransformMode
};
Q_ENUMS(TransformToolMode)
enum WarpType {
RigidWarpType,
AffineWarpType,
SimilitudeWarpType
};
Q_ENUMS(WarpType)
KisToolTransform(KoCanvasBase * canvas);
- virtual ~KisToolTransform();
+ ~KisToolTransform() override;
- virtual QWidget* createOptionWidget();
+ QWidget* createOptionWidget() override;
- virtual void mousePressEvent(KoPointerEvent *e);
- virtual void mouseMoveEvent(KoPointerEvent *e);
- virtual void mouseReleaseEvent(KoPointerEvent *e);
- virtual void touchEvent(QTouchEvent *event);
+ void mousePressEvent(KoPointerEvent *e) override;
+ void mouseMoveEvent(KoPointerEvent *e) override;
+ void mouseReleaseEvent(KoPointerEvent *e) override;
+ void touchEvent(QTouchEvent *event) override;
void beginActionImpl(KoPointerEvent *event, bool usePrimaryAction, KisTool::AlternateAction action);
void continueActionImpl(KoPointerEvent *event, bool usePrimaryAction, KisTool::AlternateAction action);
void endActionImpl(KoPointerEvent *event, bool usePrimaryAction, KisTool::AlternateAction action);
- void activatePrimaryAction();
- void deactivatePrimaryAction();
- void beginPrimaryAction(KoPointerEvent *event);
- void continuePrimaryAction(KoPointerEvent *event);
- void endPrimaryAction(KoPointerEvent *event);
+ void activatePrimaryAction() override;
+ void deactivatePrimaryAction() override;
+ void beginPrimaryAction(KoPointerEvent *event) override;
+ void continuePrimaryAction(KoPointerEvent *event) override;
+ void endPrimaryAction(KoPointerEvent *event) override;
- void activateAlternateAction(AlternateAction action);
- void deactivateAlternateAction(AlternateAction action);
- void beginAlternateAction(KoPointerEvent *event, AlternateAction action);
- void continueAlternateAction(KoPointerEvent *event, AlternateAction action);
- void endAlternateAction(KoPointerEvent *event, AlternateAction action);
+ void activateAlternateAction(AlternateAction action) override;
+ void deactivateAlternateAction(AlternateAction action) override;
+ void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void continueAlternateAction(KoPointerEvent *event, AlternateAction action) override;
+ void endAlternateAction(KoPointerEvent *event, AlternateAction action) override;
- void paint(QPainter& gc, const KoViewConverter &converter);
+ void paint(QPainter& gc, const KoViewConverter &converter) override;
TransformToolMode transformMode() const;
double translateX() const;
double translateY() const;
double rotateX() const;
double rotateY() const;
double rotateZ() const;
double scaleX() const;
double scaleY() const;
double shearX() const;
double shearY() const;
WarpType warpType() const;
double warpFlexibility() const;
int warpPointDensity() const;
- bool wantsTouch() const { return true; }
+ bool wantsTouch() const override { return true; }
public Q_SLOTS:
- virtual void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes);
- virtual void deactivate();
+ void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
+ void deactivate() override;
// Applies the current transformation to the original paint device and commits it to the undo stack
void applyTransform();
void setTransformMode( KisToolTransform::TransformToolMode newMode );
void setTranslateX(double translateX);
void setTranslateY(double translateY);
void setRotateX(double rotation);
void setRotateY(double rotation);
void setRotateZ(double rotation);
void setScaleX(double scaleX);
void setScaleY(double scaleY);
void setShearX(double shearX);
void setShearY(double shearY);
void setWarpType(WarpType type);
void setWarpFlexibility(double flexibility);
void setWarpPointDensity(int density);
protected Q_SLOTS:
- virtual void resetCursorStyle();
+ void resetCursorStyle() override;
Q_SIGNALS:
void transformModeChanged();
void freeTransformChanged();
void warpTransformChanged();
public Q_SLOTS:
- void requestUndoDuringStroke();
- void requestStrokeEnd();
- void requestStrokeCancellation();
+ void requestUndoDuringStroke() override;
+ void requestStrokeEnd() override;
+ void requestStrokeCancellation() override;
void canvasUpdateRequested();
void cursorOutlineUpdateRequested(const QPointF &imagePos);
// Update the widget according to m_currentArgs
void updateOptionWidget();
void resetRotationCenterButtonsRequested();
void imageTooBigRequested(bool value);
private:
QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive);
bool clearDevices(const QList<KisNodeSP> &nodes);
void transformClearedDevices();
void startStroke(ToolTransformArgs::TransformMode mode, bool forceReset);
void endStroke();
void cancelStroke();
private:
void outlineChanged();
// Sets the cursor according to mouse position (doesn't take shearing into account well yet)
void setFunctionalCursor();
// Sets m_function according to mouse position and modifier
void setTransformFunction(QPointF mousePos, Qt::KeyboardModifiers modifiers);
void commitChanges();
bool tryInitTransformModeFromNode(KisNodeSP node);
bool tryFetchArgsFromCommandAndUndo(ToolTransformArgs *args, ToolTransformArgs::TransformMode mode, KisNodeSP currentNode);
void initTransformMode(ToolTransformArgs::TransformMode mode);
void initGuiAfterTransformMode();
void initThumbnailImage(KisPaintDeviceSP previewDevice);
void updateSelectionPath();
void updateApplyResetAvailability();
void forceRepaintDelayedLayers(KisNodeSP root);
private:
ToolTransformArgs m_currentArgs;
bool m_actuallyMoveWhileSelected; // true <=> selection has been moved while clicked
KisPaintDeviceSP m_selectedPortionCache;
struct StrokeData {
StrokeData() {}
StrokeData(KisStrokeId strokeId) : m_strokeId(strokeId) {}
void clear() {
m_strokeId.clear();
m_clearedNodes.clear();
}
const KisStrokeId strokeId() const { return m_strokeId; }
void addClearedNode(KisNodeSP node) { m_clearedNodes.append(node); }
const QVector<KisNodeWSP>& clearedNodes() const { return m_clearedNodes; }
private:
KisStrokeId m_strokeId;
QVector<KisNodeWSP> m_clearedNodes;
};
StrokeData m_strokeData;
bool m_workRecursively;
QPainterPath m_selectionPath; // original (unscaled) selection outline, used for painting decorations
KisToolTransformConfigWidget *m_optionsWidget;
QPointer<KisCanvas2> m_canvas;
TransformTransactionProperties m_transaction;
TransformChangesTracker m_changesTracker;
/**
* This artificial rect is used to store the image to flake
* transformation. We check against this rect to get to know
* whether zoom has changed.
*/
QRectF m_refRect;
QScopedPointer<KisWarpTransformStrategy> m_warpStrategy;
QScopedPointer<KisCageTransformStrategy> m_cageStrategy;
QScopedPointer<KisLiquifyTransformStrategy> m_liquifyStrategy;
QScopedPointer<KisFreeTransformStrategy> m_freeStrategy;
QScopedPointer<KisPerspectiveTransformStrategy> m_perspectiveStrategy;
KisTransformStrategyBase* currentStrategy() const;
QPainterPath m_cursorOutline;
private Q_SLOTS:
void slotTrackerChangedConfig();
void slotUiChangedConfig();
void slotApplyTransform();
void slotResetTransform();
void slotRestartTransform();
void slotEditingFinished();
};
class KisToolTransformFactory : public KoToolFactoryBase
{
public:
KisToolTransformFactory()
: KoToolFactoryBase("KisToolTransform") {
setToolTip(i18n("Transform a layer or a selection"));
setSection(TOOL_TYPE_TRANSFORM);
setIconName(koIconNameCStr("krita_tool_transform"));
setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));
setPriority(2);
setActivationShapeId(KRITA_TOOL_ACTIVATION_ID);
}
- virtual ~KisToolTransformFactory() {}
+ ~KisToolTransformFactory() override {}
- virtual KoToolBase * createTool(KoCanvasBase *canvas) {
+ KoToolBase * createTool(KoCanvasBase *canvas) override {
return new KisToolTransform(canvas);
}
};
#endif // KIS_TOOL_TRANSFORM_H_
diff --git a/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.cpp b/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.cpp
index 3a198c99a7..35e7dd3921 100644
--- a/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.cpp
+++ b/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.cpp
@@ -1,122 +1,122 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_transform_args_keyframe_channel.h"
struct KisTransformArgsKeyframe : public KisKeyframe
{
KisTransformArgsKeyframe(KisTransformArgsKeyframeChannel *channel, int time)
: KisKeyframe(channel, time)
{}
KisTransformArgsKeyframe(KisTransformArgsKeyframeChannel *channel, int time, const ToolTransformArgs &args)
: KisKeyframe(channel, time)
, args(args)
{}
KisTransformArgsKeyframe(const KisTransformArgsKeyframe *rhs, KisKeyframeChannel *channel)
: KisKeyframe(rhs, channel)
, args(rhs->args)
{}
ToolTransformArgs args;
- KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const
+ KisKeyframeSP cloneFor(KisKeyframeChannel *channel) const override
{
KisTransformArgsKeyframeChannel *argsChannel = dynamic_cast<KisTransformArgsKeyframeChannel*>(channel);
Q_ASSERT(argsChannel);
return toQShared(new KisTransformArgsKeyframe(this, channel));
}
};
KisTransformArgsKeyframeChannel::AddKeyframeCommand::AddKeyframeCommand(KisTransformArgsKeyframeChannel *channel, int time, const ToolTransformArgs &args, KUndo2Command *parentCommand)
: KisReplaceKeyframeCommand(channel, time, toQShared(new KisTransformArgsKeyframe(channel, time, args)), parentCommand)
{
}
KisTransformArgsKeyframeChannel::KisTransformArgsKeyframeChannel(const KoID &id, KisDefaultBoundsBaseSP defaultBounds, const ToolTransformArgs &initialValue)
: KisKeyframeChannel(id, defaultBounds)
{
KisKeyframeSP keyframe = addKeyframe(0);
KisTransformArgsKeyframe *argsKeyframe = dynamic_cast<KisTransformArgsKeyframe*>(keyframe.data());
argsKeyframe->args = initialValue;
}
ToolTransformArgs &KisTransformArgsKeyframeChannel::transformArgs(KisKeyframeSP keyframe) const
{
KisTransformArgsKeyframe *key = dynamic_cast<KisTransformArgsKeyframe*>(keyframe.data());
Q_ASSERT(key != 0);
return key->args;
}
bool KisTransformArgsKeyframeChannel::hasScalarValue() const
{
return false;
}
KisKeyframeSP KisTransformArgsKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand)
{
Q_UNUSED(parentCommand);
KisTransformArgsKeyframe *srcKey = dynamic_cast<KisTransformArgsKeyframe*>(copySrc.data());
KisTransformArgsKeyframe *newKey;
if (srcKey) {
newKey = new KisTransformArgsKeyframe(this, time, srcKey->args);
} else {
newKey = new KisTransformArgsKeyframe(this, time);
}
return toQShared(newKey);
}
void KisTransformArgsKeyframeChannel::destroyKeyframe(KisKeyframeSP, KUndo2Command*)
{}
void KisTransformArgsKeyframeChannel::uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame)
{
Q_UNUSED(srcChannel);
Q_UNUSED(srcTime);
Q_UNUSED(dstFrame);
}
QRect KisTransformArgsKeyframeChannel::affectedRect(KisKeyframeSP key)
{
Q_UNUSED(key);
// TODO
return QRect();
}
KisKeyframeSP KisTransformArgsKeyframeChannel::loadKeyframe(const QDomElement &keyframeNode)
{
ToolTransformArgs args;
args.fromXML(keyframeNode);
int time = keyframeNode.attribute("time").toUInt();
KisTransformArgsKeyframe *keyframe = new KisTransformArgsKeyframe(this, time, args);
return toQShared(keyframe);
}
void KisTransformArgsKeyframeChannel::saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename)
{
Q_UNUSED(layerFilename);
KisTransformArgsKeyframe *key = dynamic_cast<KisTransformArgsKeyframe*>(keyframe.data());
KIS_ASSERT_RECOVER_RETURN(key);
key->args.toXML(&keyframeElement);
}
diff --git a/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.h b/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.h
index d8665e448c..05c7a169cd 100644
--- a/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.h
+++ b/plugins/tools/tool_transform2/kis_transform_args_keyframe_channel.h
@@ -1,49 +1,49 @@
/*
* Copyright (c) 2016 Jouni Pentikäinen <joupent@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _KIS_TRANSFORM_ARGS_KEYFRAME_CHANNEL_H
#define _KIS_TRANSFORM_ARGS_KEYFRAME_CHANNEL_H
#include "kis_keyframe_channel.h"
#include "kis_keyframe_commands.h"
#include "tool_transform_args.h"
#include "kundo2command.h"
class KisTransformArgsKeyframeChannel : public KisKeyframeChannel
{
public:
struct AddKeyframeCommand : public KisReplaceKeyframeCommand
{
AddKeyframeCommand(KisTransformArgsKeyframeChannel *channel, int time, const ToolTransformArgs &args, KUndo2Command *parentCommand);
};
KisTransformArgsKeyframeChannel(const KoID &id, KisDefaultBoundsBaseSP defaultBounds, const ToolTransformArgs &initialValue);
ToolTransformArgs &transformArgs(KisKeyframeSP keyframe) const;
- bool hasScalarValue() const;
+ bool hasScalarValue() const override;
protected:
- KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
- void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand);
- void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame);
- QRect affectedRect(KisKeyframeSP key);
- KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode);
- void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename);
+ KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) override;
+ void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand) override;
+ void uploadExternalKeyframe(KisKeyframeChannel *srcChannel, int srcTime, KisKeyframeSP dstFrame) override;
+ QRect affectedRect(KisKeyframeSP key) override;
+ KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode) override;
+ void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) override;
};
#endif
diff --git a/plugins/tools/tool_transform2/kis_transform_mask_adapter.h b/plugins/tools/tool_transform2/kis_transform_mask_adapter.h
index 83b27d117a..1c2b4c48e7 100644
--- a/plugins/tools/tool_transform2/kis_transform_mask_adapter.h
+++ b/plugins/tools/tool_transform2/kis_transform_mask_adapter.h
@@ -1,62 +1,62 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TRANSFORM_MASK_ADAPTER_H
#define __KIS_TRANSFORM_MASK_ADAPTER_H
#include <QScopedPointer>
#include "kis_transform_mask_params_interface.h"
#include "kritatooltransform_export.h"
class ToolTransformArgs;
class KRITATOOLTRANSFORM_EXPORT KisTransformMaskAdapter : public KisTransformMaskParamsInterface
{
public:
KisTransformMaskAdapter(const ToolTransformArgs &args);
- ~KisTransformMaskAdapter();
+ ~KisTransformMaskAdapter() override;
- QTransform finalAffineTransform() const;
- bool isAffine() const;
- bool isHidden() const;
+ QTransform finalAffineTransform() const override;
+ bool isAffine() const override;
+ bool isHidden() const override;
- void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const;
+ void transformDevice(KisNodeSP node, KisPaintDeviceSP src, KisPaintDeviceSP dst) const override;
virtual const ToolTransformArgs& transformArgs() const;
- QString id() const;
- void toXML(QDomElement *e) const;
+ QString id() const override;
+ void toXML(QDomElement *e) const override;
static KisTransformMaskParamsInterfaceSP fromXML(const QDomElement &e);
- virtual void translate(const QPointF &offset);
+ void translate(const QPointF &offset) override;
- QRect nonAffineChangeRect(const QRect &rc);
- QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds);
+ QRect nonAffineChangeRect(const QRect &rc) override;
+ QRect nonAffineNeedRect(const QRect &rc, const QRect &srcBounds) override;
bool isAnimated() const;
KisKeyframeChannel *getKeyframeChannel(const QString &id, KisDefaultBoundsBaseSP defaultBounds);
- void clearChangedFlag();
- bool hasChanged() const;
+ void clearChangedFlag() override;
+ bool hasChanged() const override;
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_TRANSFORM_MASK_ADAPTER_H */
diff --git a/plugins/tools/tool_transform2/kis_transform_strategy_base.h b/plugins/tools/tool_transform2/kis_transform_strategy_base.h
index cb1aa1326c..ef0955186d 100644
--- a/plugins/tools/tool_transform2/kis_transform_strategy_base.h
+++ b/plugins/tools/tool_transform2/kis_transform_strategy_base.h
@@ -1,77 +1,77 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TRANSFORM_STRATEGY_BASE_H
#define __KIS_TRANSFORM_STRATEGY_BASE_H
#include <QObject>
#include <QScopedPointer>
#include "kis_tool.h"
class QImage;
class QTransform;
class QPainter;
class QCursor;
class KoPointerEvent;
class QPainterPath;
class KisTransformStrategyBase : public QObject
{
public:
KisTransformStrategyBase();
- ~KisTransformStrategyBase();
+ ~KisTransformStrategyBase() override;
QImage originalImage() const;
QTransform thumbToImageTransform() const;
void setThumbnailImage(const QImage &image, QTransform thumbToImageTransform);
public:
virtual bool acceptsClicks() const;
virtual void paint(QPainter &gc) = 0;
virtual QCursor getCurrentCursor() const = 0;
virtual QPainterPath getCursorOutline() const;
virtual void externalConfigChanged() = 0;
virtual void activatePrimaryAction();
virtual void deactivatePrimaryAction();
virtual bool beginPrimaryAction(KoPointerEvent *event) = 0;
virtual void continuePrimaryAction(KoPointerEvent *event) = 0;
virtual bool endPrimaryAction(KoPointerEvent *event) = 0;
virtual void hoverActionCommon(KoPointerEvent *event) = 0;
virtual void activateAlternateAction(KisTool::AlternateAction action);
virtual void deactivateAlternateAction(KisTool::AlternateAction action);
virtual bool beginAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
virtual void continueAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
virtual bool endAlternateAction(KoPointerEvent *event, KisTool::AlternateAction action);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_TRANSFORM_STRATEGY_BASE_H */
diff --git a/plugins/tools/tool_transform2/kis_transform_utils.cpp b/plugins/tools/tool_transform2/kis_transform_utils.cpp
index 3537d75f53..a3b2ab9c84 100644
--- a/plugins/tools/tool_transform2/kis_transform_utils.cpp
+++ b/plugins/tools/tool_transform2/kis_transform_utils.cpp
@@ -1,391 +1,397 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_transform_utils.h"
#include <cmath>
#include <QTransform>
#include <KoUnit.h>
#include "tool_transform_args.h"
#include "kis_paint_device.h"
+#include "kis_algebra_2d.h"
const int KisTransformUtils::rotationHandleVisualRadius = 12;
const int KisTransformUtils::rotationHandleRadius = 8;
const int KisTransformUtils::handleVisualRadius = 12;
const int KisTransformUtils::handleRadius = 8;
QTransform KisTransformUtils::imageToFlakeTransform(const KisCoordinatesConverter *converter)
{
return converter->imageToDocumentTransform() * converter->documentToFlakeTransform();
}
qreal KisTransformUtils::effectiveHandleGrabRadius(const KisCoordinatesConverter *converter)
{
QPointF handleRadiusPt = flakeToImage(converter, QPointF(handleRadius, handleRadius));
return (handleRadiusPt.x() > handleRadiusPt.y()) ? handleRadiusPt.x() : handleRadiusPt.y();
}
qreal KisTransformUtils::effectiveRotationHandleGrabRadius(const KisCoordinatesConverter *converter)
{
QPointF handleRadiusPt = flakeToImage(converter, QPointF(rotationHandleRadius, rotationHandleRadius));
return (handleRadiusPt.x() > handleRadiusPt.y()) ? handleRadiusPt.x() : handleRadiusPt.y();
}
qreal KisTransformUtils::scaleFromAffineMatrix(const QTransform &t) {
return KoUnit::approxTransformScale(t);
}
qreal KisTransformUtils::scaleFromPerspectiveMatrixX(const QTransform &t, const QPointF &basePt) {
const QPointF pt = basePt + QPointF(1.0, 0);
return kisDistance(t.map(pt), t.map(basePt));
}
qreal KisTransformUtils::scaleFromPerspectiveMatrixY(const QTransform &t, const QPointF &basePt) {
const QPointF pt = basePt + QPointF(0, 1.0);
return kisDistance(t.map(pt), t.map(basePt));
}
qreal KisTransformUtils::effectiveSize(const QRectF &rc) {
return 0.5 * (rc.width() + rc.height());
}
+bool KisTransformUtils::thumbnailTooSmall(const QTransform &resultThumbTransform, const QRect &originalImageRect)
+{
+ return KisAlgebra2D::minDimension(resultThumbTransform.mapRect(originalImageRect)) < 32;
+}
+
QRectF handleRectImpl(qreal radius, const QTransform &t, const QRectF &limitingRect, const QPointF &basePoint, qreal *dOutX, qreal *dOutY) {
const qreal handlesExtraScaleX =
KisTransformUtils::scaleFromPerspectiveMatrixX(t, basePoint);
const qreal handlesExtraScaleY =
KisTransformUtils::scaleFromPerspectiveMatrixY(t, basePoint);
const qreal maxD = 0.2 * KisTransformUtils::effectiveSize(limitingRect);
const qreal dX = qMin(maxD, radius / handlesExtraScaleX);
const qreal dY = qMin(maxD, radius / handlesExtraScaleY);
QRectF handleRect(-0.5 * dX, -0.5 * dY, dX, dY);
if (dOutX) {
*dOutX = dX;
}
if (dOutY) {
*dOutY = dY;
}
return handleRect;
}
QRectF KisTransformUtils::handleRect(qreal radius, const QTransform &t, const QRectF &limitingRect, qreal *dOutX, qreal *dOutY) {
return handleRectImpl(radius, t, limitingRect, limitingRect.center(), dOutX, dOutY);
}
QRectF KisTransformUtils::handleRect(qreal radius, const QTransform &t, const QRectF &limitingRect, const QPointF &basePoint) {
return handleRectImpl(radius, t, limitingRect, basePoint, 0, 0);
}
QPointF KisTransformUtils::clipInRect(QPointF p, QRectF r)
{
QPointF center = r.center();
QPointF t = p - center;
r.translate(- center);
if (t.y() != 0) {
if (t.x() != 0) {
double slope = t.y() / t.x();
if (t.x() < r.left()) {
t.setY(r.left() * slope);
t.setX(r.left());
}
else if (t.x() > r.right()) {
t.setY(r.right() * slope);
t.setX(r.right());
}
if (t.y() < r.top()) {
t.setX(r.top() / slope);
t.setY(r.top());
}
else if (t.y() > r.bottom()) {
t.setX(r.bottom() / slope);
t.setY(r.bottom());
}
}
else {
if (t.y() < r.top())
t.setY(r.top());
else if (t.y() > r.bottom())
t.setY(r.bottom());
}
}
else {
if (t.x() < r.left())
t.setX(r.left());
else if (t.x() > r.right())
t.setX(r.right());
}
t += center;
return t;
}
KisTransformUtils::MatricesPack::MatricesPack(const ToolTransformArgs &args)
{
TS = QTransform::fromTranslate(-args.originalCenter().x(), -args.originalCenter().y());
SC = QTransform::fromScale(args.scaleX(), args.scaleY());
S.shear(0, args.shearY()); S.shear(args.shearX(), 0);
if (args.mode() == ToolTransformArgs::FREE_TRANSFORM) {
P.rotate(180. * args.aX() / M_PI, QVector3D(1, 0, 0));
P.rotate(180. * args.aY() / M_PI, QVector3D(0, 1, 0));
P.rotate(180. * args.aZ() / M_PI, QVector3D(0, 0, 1));
projectedP = P.toTransform(args.cameraPos().z());
} else if (args.mode() == ToolTransformArgs::PERSPECTIVE_4POINT) {
projectedP = args.flattenedPerspectiveTransform();
P = QMatrix4x4(projectedP);
}
QPointF translation = args.transformedCenter();
T = QTransform::fromTranslate(translation.x(), translation.y());
}
QTransform KisTransformUtils::MatricesPack::finalTransform() const
{
return TS * SC * S * projectedP * T;
}
bool KisTransformUtils::checkImageTooBig(const QRectF &bounds, const MatricesPack &m)
{
bool imageTooBig = false;
QMatrix4x4 unprojectedMatrix = QMatrix4x4(m.T) * m.P * QMatrix4x4(m.TS * m.SC * m.S);
QVector<QPointF> points;
points << bounds.topLeft();
points << bounds.topRight();
points << bounds.bottomRight();
points << bounds.bottomLeft();
Q_FOREACH (const QPointF &pt, points) {
QVector4D v(pt.x(), pt.y(), 0, 1);
v = unprojectedMatrix * v;
qreal z = v.z() / v.w();
imageTooBig = z > 1024.0;
if (imageTooBig) {
break;
}
}
return imageTooBig;
}
#include <kis_transform_worker.h>
#include <kis_perspectivetransform_worker.h>
#include <kis_warptransform_worker.h>
#include <kis_cage_transform_worker.h>
#include <kis_liquify_transform_worker.h>
KisTransformWorker KisTransformUtils::createTransformWorker(const ToolTransformArgs &config,
KisPaintDeviceSP device,
KoUpdaterPtr updater,
QVector3D *transformedCenter /* OUT */)
{
{
KisTransformWorker t(0,
config.scaleX(), config.scaleY(),
config.shearX(), config.shearY(),
config.originalCenter().x(),
config.originalCenter().y(),
config.aZ(),
0, // set X and Y translation
0, // to null for calculation
0,
config.filter());
*transformedCenter = QVector3D(t.transform().map(config.originalCenter()));
}
QPointF translation = config.transformedCenter() - (*transformedCenter).toPointF();
KisTransformWorker transformWorker(device,
config.scaleX(), config.scaleY(),
config.shearX(), config.shearY(),
config.originalCenter().x(),
config.originalCenter().y(),
config.aZ(),
(int)(translation.x()),
(int)(translation.y()),
updater,
config.filter());
return transformWorker;
}
void KisTransformUtils::transformDevice(const ToolTransformArgs &config,
KisPaintDeviceSP device,
KisProcessingVisitor::ProgressHelper *helper)
{
if (config.mode() == ToolTransformArgs::WARP) {
KoUpdaterPtr updater = helper->updater();
KisWarpTransformWorker worker(config.warpType(),
device,
config.origPoints(),
config.transfPoints(),
config.alpha(),
updater);
worker.run();
} else if (config.mode() == ToolTransformArgs::CAGE) {
KoUpdaterPtr updater = helper->updater();
KisCageTransformWorker worker(device,
config.origPoints(),
updater,
8);
worker.prepareTransform();
worker.setTransformedCage(config.transfPoints());
worker.run();
} else if (config.mode() == ToolTransformArgs::LIQUIFY) {
KoUpdaterPtr updater = helper->updater();
//FIXME:
Q_UNUSED(updater);
config.liquifyWorker()->run(device);
} else {
QVector3D transformedCenter;
KoUpdaterPtr updater1 = helper->updater();
KoUpdaterPtr updater2 = helper->updater();
KisTransformWorker transformWorker =
createTransformWorker(config, device, updater1, &transformedCenter);
transformWorker.run();
if (config.mode() == ToolTransformArgs::FREE_TRANSFORM) {
KisPerspectiveTransformWorker perspectiveWorker(device,
config.transformedCenter(),
config.aX(),
config.aY(),
config.cameraPos().z(),
updater2);
perspectiveWorker.run();
} else if (config.mode() == ToolTransformArgs::PERSPECTIVE_4POINT) {
QTransform T =
QTransform::fromTranslate(config.transformedCenter().x(),
config.transformedCenter().y());
KisPerspectiveTransformWorker perspectiveWorker(device,
T.inverted() * config.flattenedPerspectiveTransform() * T,
updater2);
perspectiveWorker.run();
}
}
}
QRect KisTransformUtils::needRect(const ToolTransformArgs &config,
const QRect &rc,
const QRect &srcBounds)
{
QRect result = rc;
if (config.mode() == ToolTransformArgs::WARP) {
KisWarpTransformWorker worker(config.warpType(),
0,
config.origPoints(),
config.transfPoints(),
config.alpha(),
0);
result = worker.approxNeedRect(rc, srcBounds);
} else if (config.mode() == ToolTransformArgs::CAGE) {
KisCageTransformWorker worker(0,
config.origPoints(),
0,
8);
worker.setTransformedCage(config.transfPoints());
result = worker.approxNeedRect(rc, srcBounds);
} else if (config.mode() == ToolTransformArgs::LIQUIFY) {
result = config.liquifyWorker() ?
config.liquifyWorker()->approxNeedRect(rc, srcBounds) : rc;
} else {
KIS_ASSERT_RECOVER_NOOP(0 && "this works for non-affine transformations only!");
}
return result;
}
QRect KisTransformUtils::changeRect(const ToolTransformArgs &config,
const QRect &rc)
{
QRect result = rc;
if (config.mode() == ToolTransformArgs::WARP) {
KisWarpTransformWorker worker(config.warpType(),
0,
config.origPoints(),
config.transfPoints(),
config.alpha(),
0);
result = worker.approxChangeRect(rc);
} else if (config.mode() == ToolTransformArgs::CAGE) {
KisCageTransformWorker worker(0,
config.origPoints(),
0,
8);
worker.setTransformedCage(config.transfPoints());
result = worker.approxChangeRect(rc);
} else if (config.mode() == ToolTransformArgs::LIQUIFY) {
result = config.liquifyWorker() ?
config.liquifyWorker()->approxChangeRect(rc) : rc;
} else {
KIS_ASSERT_RECOVER_NOOP(0 && "this works for non-affine transformations only!");
}
return result;
}
KisTransformUtils::AnchorHolder::AnchorHolder(bool enabled, ToolTransformArgs *config)
: m_enabled(enabled),
m_config(config)
{
if (!m_enabled) return;
m_staticPoint = m_config->originalCenter() + m_config->rotationCenterOffset();
const KisTransformUtils::MatricesPack m(*m_config);
m_oldStaticPointInView = m.finalTransform().map(m_staticPoint);
}
KisTransformUtils::AnchorHolder::~AnchorHolder() {
if (!m_enabled) return;
const KisTransformUtils::MatricesPack m(*m_config);
const QPointF newStaticPointInView = m.finalTransform().map(m_staticPoint);
const QPointF diff = m_oldStaticPointInView - newStaticPointInView;
m_config->setTransformedCenter(m_config->transformedCenter() + diff);
}
diff --git a/plugins/tools/tool_transform2/kis_transform_utils.h b/plugins/tools/tool_transform2/kis_transform_utils.h
index 9e84f29269..1299e1cf66 100644
--- a/plugins/tools/tool_transform2/kis_transform_utils.h
+++ b/plugins/tools/tool_transform2/kis_transform_utils.h
@@ -1,156 +1,157 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_TRANSFORM_UTILS_H
#define __KIS_TRANSFORM_UTILS_H
#include <QtGlobal>
#include "kis_coordinates_converter.h"
#include <QTransform>
#include <QMatrix4x4>
#include <kis_processing_visitor.h>
#include <limits>
// for kisSquareDistance only
#include "kis_global.h"
class ToolTransformArgs;
class KisTransformWorker;
class KisTransformUtils
{
public:
static const int rotationHandleVisualRadius;
static const int handleVisualRadius;
static const int handleRadius;
static const int rotationHandleRadius;
template <class T>
static T flakeToImage(const KisCoordinatesConverter *converter, T object) {
return converter->documentToImage(converter->flakeToDocument(object));
}
template <class T>
static T imageToFlake(const KisCoordinatesConverter *converter, T object) {
return converter->documentToFlake(converter->imageToDocument(object));
}
static QTransform imageToFlakeTransform(const KisCoordinatesConverter *converter);
static qreal effectiveHandleGrabRadius(const KisCoordinatesConverter *converter);
static qreal effectiveRotationHandleGrabRadius(const KisCoordinatesConverter *converter);
static qreal scaleFromAffineMatrix(const QTransform &t);
static qreal scaleFromPerspectiveMatrixX(const QTransform &t, const QPointF &basePt);
static qreal scaleFromPerspectiveMatrixY(const QTransform &t, const QPointF &basePt);
static qreal effectiveSize(const QRectF &rc);
+ static bool thumbnailTooSmall(const QTransform &resultThumbTransform, const QRect &originalImageRect);
static QRectF handleRect(qreal radius, const QTransform &t, const QRectF &limitingRect, qreal *dOutX, qreal *dOutY);
static QRectF handleRect(qreal radius, const QTransform &t, const QRectF &limitingRect, const QPointF &basePoint);
static QPointF clipInRect(QPointF p, QRectF r);
struct MatricesPack
{
MatricesPack(const ToolTransformArgs &args);
QTransform TS;
QTransform SC;
QTransform S;
QMatrix4x4 P;
QTransform projectedP;
QTransform T;
// the final transformation looks like
// transform = TS * SC * S * projectedP * T
QTransform finalTransform() const;
};
static bool checkImageTooBig(const QRectF &bounds, const MatricesPack &m);
static KisTransformWorker createTransformWorker(const ToolTransformArgs &config,
KisPaintDeviceSP device,
KoUpdaterPtr updater,
QVector3D *transformedCenter /* OUT */);
static void transformDevice(const ToolTransformArgs &config,
KisPaintDeviceSP device,
KisProcessingVisitor::ProgressHelper *helper);
static QRect needRect(const ToolTransformArgs &config,
const QRect &rc,
const QRect &srcBounds);
static QRect changeRect(const ToolTransformArgs &config,
const QRect &rc);
template<typename Function>
class HandleChooser {
public:
HandleChooser(const QPointF &cursorPos, Function defaultFunction)
: m_cursorPos(cursorPos),
m_minDistance(std::numeric_limits<qreal>::max()),
m_function(defaultFunction)
{
}
bool addFunction(const QPointF &pt, qreal radius, Function function) {
bool result = false;
qreal distance = kisSquareDistance(pt, m_cursorPos);
if (distance < pow2(radius) && distance < m_minDistance) {
m_minDistance = distance;
m_function = function;
result = true;
}
return result;
}
Function function() const {
return m_function;
}
private:
QPointF m_cursorPos;
qreal m_minDistance;
Function m_function;
};
/**
* A special class that ensures that the view position of the anchor point of the
* transformation is unchanged during the lifetime of the object. On destruction
* of the keeper the position of the anchor point will be restored.
*/
struct AnchorHolder {
AnchorHolder(bool enabled, ToolTransformArgs *config);
~AnchorHolder();
private:
bool m_enabled;
ToolTransformArgs *m_config;
QPointF m_staticPoint;
QPointF m_oldStaticPointInView;
};
};
#endif /* __KIS_TRANSFORM_UTILS_H */
diff --git a/plugins/tools/tool_transform2/kis_warp_transform_strategy.cpp b/plugins/tools/tool_transform2/kis_warp_transform_strategy.cpp
index ba5b4668d7..c1fdd050ee 100644
--- a/plugins/tools/tool_transform2/kis_warp_transform_strategy.cpp
+++ b/plugins/tools/tool_transform2/kis_warp_transform_strategy.cpp
@@ -1,591 +1,592 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_warp_transform_strategy.h"
#include <algorithm>
#include <QPointF>
#include <QPainter>
#include "kis_coordinates_converter.h"
#include "tool_transform_args.h"
#include "transform_transaction_properties.h"
#include "kis_painting_tweaks.h"
#include "kis_cursor.h"
#include "kis_transform_utils.h"
#include "kis_algebra_2d.h"
struct KisWarpTransformStrategy::Private
{
Private(KisWarpTransformStrategy *_q,
const KisCoordinatesConverter *_converter,
ToolTransformArgs &_currentArgs,
TransformTransactionProperties &_transaction)
: q(_q),
converter(_converter),
currentArgs(_currentArgs),
transaction(_transaction),
lastNumPoints(0),
drawConnectionLines(true),
drawOrigPoints(true),
drawTransfPoints(true),
closeOnStartPointClick(false),
clipOriginalPointsPosition(true),
pointWasDragged(false)
{
}
KisWarpTransformStrategy * const q;
/// standard members ///
const KisCoordinatesConverter *converter;
//////
ToolTransformArgs &currentArgs;
//////
TransformTransactionProperties &transaction;
QTransform paintingTransform;
QPointF paintingOffset;
QTransform handlesTransform;
/// custom members ///
QImage transformedImage;
int pointIndexUnderCursor;
enum Mode {
OVER_POINT = 0,
MULTIPLE_POINT_SELECTION,
MOVE_MODE,
ROTATE_MODE,
SCALE_MODE,
NOTHING
};
Mode mode;
QVector<int> pointsInAction;
int lastNumPoints;
bool drawConnectionLines;
bool drawOrigPoints;
bool drawTransfPoints;
bool closeOnStartPointClick;
bool clipOriginalPointsPosition;
QPointF pointPosOnClick;
bool pointWasDragged;
QPointF lastMousePos;
void recalculateTransformations();
inline QPointF imageToThumb(const QPointF &pt, bool useFlakeOptimization);
bool shouldCloseTheCage() const;
QVector<QPointF*> getSelectedPoints(QPointF *center, bool limitToSelectedOnly = false) const;
};
KisWarpTransformStrategy::KisWarpTransformStrategy(const KisCoordinatesConverter *converter,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction)
: KisSimplifiedActionPolicyStrategy(converter),
m_d(new Private(this, converter, currentArgs, transaction))
{
}
KisWarpTransformStrategy::~KisWarpTransformStrategy()
{
}
void KisWarpTransformStrategy::setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive)
{
double handleRadius = KisTransformUtils::effectiveHandleGrabRadius(m_d->converter);
bool cursorOverPoint = false;
m_d->pointIndexUnderCursor = -1;
KisTransformUtils::HandleChooser<Private::Mode>
handleChooser(mousePos, Private::NOTHING);
const QVector<QPointF> &points = m_d->currentArgs.transfPoints();
for (int i = 0; i < points.size(); ++i) {
if (handleChooser.addFunction(points[i],
handleRadius, Private::NOTHING)) {
cursorOverPoint = true;
m_d->pointIndexUnderCursor = i;
}
}
if (cursorOverPoint) {
m_d->mode = perspectiveModifierActive &&
!m_d->currentArgs.isEditingTransformPoints() ?
Private::MULTIPLE_POINT_SELECTION : Private::OVER_POINT;
} else if (!m_d->currentArgs.isEditingTransformPoints()) {
QPolygonF polygon(m_d->currentArgs.transfPoints());
bool insidePolygon = polygon.boundingRect().contains(mousePos);
m_d->mode = insidePolygon ? Private::MOVE_MODE :
!perspectiveModifierActive ? Private::ROTATE_MODE :
Private::SCALE_MODE;
} else {
m_d->mode = Private::NOTHING;
}
}
QCursor KisWarpTransformStrategy::getCurrentCursor() const
{
QCursor cursor;
switch (m_d->mode) {
case Private::OVER_POINT:
cursor = KisCursor::pointingHandCursor();
break;
case Private::MULTIPLE_POINT_SELECTION:
cursor = KisCursor::crossCursor();
break;
case Private::MOVE_MODE:
cursor = KisCursor::moveCursor();
break;
case Private::ROTATE_MODE:
cursor = KisCursor::rotateCursor();
break;
case Private::SCALE_MODE:
cursor = KisCursor::sizeVerCursor();
break;
case Private::NOTHING:
cursor = KisCursor::arrowCursor();
break;
}
return cursor;
}
void KisWarpTransformStrategy::overrideDrawingItems(bool drawConnectionLines,
bool drawOrigPoints,
bool drawTransfPoints)
{
m_d->drawConnectionLines = drawConnectionLines;
m_d->drawOrigPoints = drawOrigPoints;
m_d->drawTransfPoints = drawTransfPoints;
}
void KisWarpTransformStrategy::setCloseOnStartPointClick(bool value)
{
m_d->closeOnStartPointClick = value;
}
void KisWarpTransformStrategy::setClipOriginalPointsPosition(bool value)
{
m_d->clipOriginalPointsPosition = value;
}
void KisWarpTransformStrategy::drawConnectionLines(QPainter &gc,
const QVector<QPointF> &origPoints,
const QVector<QPointF> &transfPoints,
bool isEditingPoints)
{
Q_UNUSED(isEditingPoints);
QPen antsPen;
QPen outlinePen;
KisPaintingTweaks::initAntsPen(&antsPen, &outlinePen);
const int numPoints = origPoints.size();
for (int i = 0; i < numPoints; ++i) {
gc.setPen(outlinePen);
gc.drawLine(transfPoints[i], origPoints[i]);
gc.setPen(antsPen);
gc.drawLine(transfPoints[i], origPoints[i]);
}
}
void KisWarpTransformStrategy::paint(QPainter &gc)
{
// Draw preview image
gc.save();
gc.setOpacity(m_d->transaction.basePreviewOpacity());
gc.setTransform(m_d->paintingTransform, true);
gc.drawImage(m_d->paintingOffset, m_d->transformedImage);
gc.restore();
gc.save();
gc.setTransform(m_d->handlesTransform, true);
// draw connecting lines
if (m_d->drawConnectionLines) {
gc.setOpacity(0.5);
drawConnectionLines(gc,
m_d->currentArgs.origPoints(),
m_d->currentArgs.transfPoints(),
m_d->currentArgs.isEditingTransformPoints());
}
// draw handles
{
const int numPoints = m_d->currentArgs.origPoints().size();
QPen mainPen(Qt::black);
QPen outlinePen(Qt::white);
qreal handlesExtraScale = KisTransformUtils::scaleFromAffineMatrix(m_d->handlesTransform);
qreal dstIn = 8 / handlesExtraScale;
qreal dstOut = 10 / handlesExtraScale;
qreal srcIn = 6 / handlesExtraScale;
qreal srcOut = 6 / handlesExtraScale;
QRectF handleRect1(-0.5 * dstIn, -0.5 * dstIn, dstIn, dstIn);
QRectF handleRect2(-0.5 * dstOut, -0.5 * dstOut, dstOut, dstOut);
if (m_d->drawTransfPoints) {
gc.setOpacity(1.0);
for (int i = 0; i < numPoints; ++i) {
gc.setPen(outlinePen);
gc.drawEllipse(handleRect2.translated(m_d->currentArgs.transfPoints()[i]));
gc.setPen(mainPen);
gc.drawEllipse(handleRect1.translated(m_d->currentArgs.transfPoints()[i]));
}
QPointF center;
QVector<QPointF*> selectedPoints = m_d->getSelectedPoints(&center, true);
QBrush selectionBrush = selectedPoints.size() > 1 ? Qt::red : Qt::black;
QBrush oldBrush = gc.brush();
gc.setBrush(selectionBrush);
Q_FOREACH (const QPointF *pt, selectedPoints) {
gc.drawEllipse(handleRect1.translated(*pt));
}
gc.setBrush(oldBrush);
}
if (m_d->drawOrigPoints) {
QPainterPath inLine;
inLine.moveTo(-0.5 * srcIn, 0);
inLine.lineTo( 0.5 * srcIn, 0);
inLine.moveTo( 0, -0.5 * srcIn);
inLine.lineTo( 0, 0.5 * srcIn);
QPainterPath outLine;
outLine.moveTo(-0.5 * srcOut, -0.5 * srcOut);
outLine.lineTo( 0.5 * srcOut, -0.5 * srcOut);
outLine.lineTo( 0.5 * srcOut, 0.5 * srcOut);
outLine.lineTo(-0.5 * srcOut, 0.5 * srcOut);
outLine.lineTo(-0.5 * srcOut, -0.5 * srcOut);
gc.setOpacity(0.5);
for (int i = 0; i < numPoints; ++i) {
gc.setPen(outlinePen);
gc.drawPath(outLine.translated(m_d->currentArgs.origPoints()[i]));
gc.setPen(mainPen);
gc.drawPath(inLine.translated(m_d->currentArgs.origPoints()[i]));
}
}
}
gc.restore();
}
void KisWarpTransformStrategy::externalConfigChanged()
{
if (m_d->lastNumPoints != m_d->currentArgs.transfPoints().size()) {
m_d->pointsInAction.clear();
}
m_d->recalculateTransformations();
}
bool KisWarpTransformStrategy::beginPrimaryAction(const QPointF &pt)
{
const bool isEditingPoints = m_d->currentArgs.isEditingTransformPoints();
bool retval = false;
if (m_d->mode == Private::OVER_POINT ||
m_d->mode == Private::MULTIPLE_POINT_SELECTION ||
m_d->mode == Private::MOVE_MODE ||
m_d->mode == Private::ROTATE_MODE ||
m_d->mode == Private::SCALE_MODE) {
retval = true;
} else if (isEditingPoints) {
QPointF newPos = m_d->clipOriginalPointsPosition ?
KisTransformUtils::clipInRect(pt, m_d->transaction.originalRect()) :
pt;
m_d->currentArgs.refOriginalPoints().append(newPos);
m_d->currentArgs.refTransformedPoints().append(newPos);
m_d->mode = Private::OVER_POINT;
m_d->pointIndexUnderCursor = m_d->currentArgs.origPoints().size() - 1;
m_d->recalculateTransformations();
emit requestCanvasUpdate();
retval = true;
}
if (m_d->mode == Private::OVER_POINT) {
m_d->pointPosOnClick =
m_d->currentArgs.transfPoints()[m_d->pointIndexUnderCursor];
m_d->pointWasDragged = false;
m_d->pointsInAction.clear();
m_d->pointsInAction << m_d->pointIndexUnderCursor;
m_d->lastNumPoints = m_d->currentArgs.transfPoints().size();
} else if (m_d->mode == Private::MULTIPLE_POINT_SELECTION) {
QVector<int>::iterator it =
std::find(m_d->pointsInAction.begin(),
m_d->pointsInAction.end(),
m_d->pointIndexUnderCursor);
if (it != m_d->pointsInAction.end()) {
m_d->pointsInAction.erase(it);
} else {
m_d->pointsInAction << m_d->pointIndexUnderCursor;
}
m_d->lastNumPoints = m_d->currentArgs.transfPoints().size();
}
m_d->lastMousePos = pt;
return retval;
}
QVector<QPointF*> KisWarpTransformStrategy::Private::getSelectedPoints(QPointF *center, bool limitToSelectedOnly) const
{
QVector<QPointF> &points = currentArgs.refTransformedPoints();
QRectF boundingRect;
QVector<QPointF*> selectedPoints;
if (limitToSelectedOnly || pointsInAction.size() > 1) {
Q_FOREACH (int index, pointsInAction) {
selectedPoints << &points[index];
KisAlgebra2D::accumulateBounds(points[index], &boundingRect);
}
} else {
QVector<QPointF>::iterator it = points.begin();
QVector<QPointF>::iterator end = points.end();
for (; it != end; ++it) {
selectedPoints << &(*it);
KisAlgebra2D::accumulateBounds(*it, &boundingRect);
}
}
*center = boundingRect.center();
return selectedPoints;
}
void KisWarpTransformStrategy::continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive)
{
Q_UNUSED(shiftModifierActve);
Q_UNUSED(altModifierActive);
// toplevel code switches to HOVER mode if nothing is selected
KIS_ASSERT_RECOVER_RETURN(m_d->mode == Private::MOVE_MODE ||
m_d->mode == Private::ROTATE_MODE ||
m_d->mode == Private::SCALE_MODE ||
(m_d->mode == Private::OVER_POINT &&
m_d->pointIndexUnderCursor >= 0 &&
m_d->pointsInAction.size() == 1) ||
(m_d->mode == Private::MULTIPLE_POINT_SELECTION &&
m_d->pointIndexUnderCursor >= 0));
if (m_d->mode == Private::OVER_POINT) {
if (m_d->currentArgs.isEditingTransformPoints()) {
QPointF newPos = m_d->clipOriginalPointsPosition ?
KisTransformUtils::clipInRect(pt, m_d->transaction.originalRect()) :
pt;
m_d->currentArgs.origPoint(m_d->pointIndexUnderCursor) = newPos;
m_d->currentArgs.transfPoint(m_d->pointIndexUnderCursor) = newPos;
} else {
m_d->currentArgs.transfPoint(m_d->pointIndexUnderCursor) = pt;
}
const qreal handleRadiusSq = pow2(KisTransformUtils::effectiveHandleGrabRadius(m_d->converter));
qreal dist =
kisSquareDistance(
m_d->currentArgs.transfPoint(m_d->pointIndexUnderCursor),
m_d->pointPosOnClick);
if (dist > handleRadiusSq) {
m_d->pointWasDragged = true;
}
} else if (m_d->mode == Private::MOVE_MODE) {
QPointF center;
QVector<QPointF*> selectedPoints = m_d->getSelectedPoints(&center);
QPointF diff = pt - m_d->lastMousePos;
QVector<QPointF*>::iterator it = selectedPoints.begin();
QVector<QPointF*>::iterator end = selectedPoints.end();
for (; it != end; ++it) {
**it += diff;
}
} else if (m_d->mode == Private::ROTATE_MODE) {
QPointF center;
QVector<QPointF*> selectedPoints = m_d->getSelectedPoints(&center);
QPointF oldDirection = m_d->lastMousePos - center;
QPointF newDirection = pt - center;
qreal rotateAngle = KisAlgebra2D::angleBetweenVectors(oldDirection, newDirection);
QTransform R;
R.rotateRadians(rotateAngle);
QTransform t =
QTransform::fromTranslate(-center.x(), -center.y()) *
R *
QTransform::fromTranslate(center.x(), center.y());
QVector<QPointF*>::iterator it = selectedPoints.begin();
QVector<QPointF*>::iterator end = selectedPoints.end();
for (; it != end; ++it) {
**it = t.map(**it);
}
} else if (m_d->mode == Private::SCALE_MODE) {
QPointF center;
QVector<QPointF*> selectedPoints = m_d->getSelectedPoints(&center);
QPolygonF polygon(m_d->currentArgs.origPoints());
QSizeF maxSize = polygon.boundingRect().size();
qreal maxDimension = qMax(maxSize.width(), maxSize.height());
qreal scale = 1.0 - (pt - m_d->lastMousePos).y() / maxDimension;
QTransform t =
QTransform::fromTranslate(-center.x(), -center.y()) *
QTransform::fromScale(scale, scale) *
QTransform::fromTranslate(center.x(), center.y());
QVector<QPointF*>::iterator it = selectedPoints.begin();
QVector<QPointF*>::iterator end = selectedPoints.end();
for (; it != end; ++it) {
**it = t.map(**it);
}
}
m_d->lastMousePos = pt;
m_d->recalculateTransformations();
emit requestCanvasUpdate();
}
bool KisWarpTransformStrategy::Private::shouldCloseTheCage() const
{
return currentArgs.isEditingTransformPoints() &&
closeOnStartPointClick &&
pointIndexUnderCursor == 0 &&
currentArgs.origPoints().size() > 2 &&
!pointWasDragged;
}
bool KisWarpTransformStrategy::acceptsClicks() const
{
return m_d->shouldCloseTheCage() ||
m_d->currentArgs.isEditingTransformPoints();
}
bool KisWarpTransformStrategy::endPrimaryAction()
{
if (m_d->shouldCloseTheCage()) {
m_d->currentArgs.setEditingTransformPoints(false);
}
return true;
}
inline QPointF KisWarpTransformStrategy::Private::imageToThumb(const QPointF &pt, bool useFlakeOptimization)
{
return useFlakeOptimization ? converter->imageToDocument(converter->documentToFlake((pt))) : q->thumbToImageTransform().inverted().map(pt);
}
void KisWarpTransformStrategy::Private::recalculateTransformations()
{
QTransform scaleTransform = KisTransformUtils::imageToFlakeTransform(converter);
- QTransform resultTransform = q->thumbToImageTransform() * scaleTransform;
- qreal scale = KisTransformUtils::scaleFromAffineMatrix(resultTransform);
- bool useFlakeOptimization = scale < 1.0;
+ QTransform resultThumbTransform = q->thumbToImageTransform() * scaleTransform;
+ qreal scale = KisTransformUtils::scaleFromAffineMatrix(resultThumbTransform);
+ bool useFlakeOptimization = scale < 1.0 &&
+ !KisTransformUtils::thumbnailTooSmall(resultThumbTransform, q->originalImage().rect());
QVector<QPointF> thumbOrigPoints(currentArgs.numPoints());
QVector<QPointF> thumbTransfPoints(currentArgs.numPoints());
for (int i = 0; i < currentArgs.numPoints(); ++i) {
thumbOrigPoints[i] = imageToThumb(currentArgs.origPoints()[i], useFlakeOptimization);
thumbTransfPoints[i] = imageToThumb(currentArgs.transfPoints()[i], useFlakeOptimization);
}
paintingOffset = transaction.originalTopLeft();
if (!q->originalImage().isNull() && !currentArgs.isEditingTransformPoints()) {
QPointF origTLInFlake = imageToThumb(transaction.originalTopLeft(), useFlakeOptimization);
if (useFlakeOptimization) {
- transformedImage = q->originalImage().transformed(q->thumbToImageTransform() * scaleTransform);
+ transformedImage = q->originalImage().transformed(resultThumbTransform);
paintingTransform = QTransform();
} else {
transformedImage = q->originalImage();
- paintingTransform = q->thumbToImageTransform() * scaleTransform;
+ paintingTransform = resultThumbTransform;
}
transformedImage = q->calculateTransformedImage(currentArgs,
transformedImage,
thumbOrigPoints,
thumbTransfPoints,
origTLInFlake,
&paintingOffset);
} else {
transformedImage = q->originalImage();
paintingOffset = imageToThumb(transaction.originalTopLeft(), false);
- paintingTransform = q->thumbToImageTransform() * scaleTransform;
+ paintingTransform = resultThumbTransform;
}
handlesTransform = scaleTransform;
}
QImage KisWarpTransformStrategy::calculateTransformedImage(ToolTransformArgs &currentArgs,
const QImage &srcImage,
const QVector<QPointF> &origPoints,
const QVector<QPointF> &transfPoints,
const QPointF &srcOffset,
QPointF *dstOffset)
{
return KisWarpTransformWorker::transformQImage(
currentArgs.warpType(),
origPoints, transfPoints,
currentArgs.alpha(),
srcImage,
srcOffset, dstOffset);
}
diff --git a/plugins/tools/tool_transform2/kis_warp_transform_strategy.h b/plugins/tools/tool_transform2/kis_warp_transform_strategy.h
index 39d195ca81..9d7493feec 100644
--- a/plugins/tools/tool_transform2/kis_warp_transform_strategy.h
+++ b/plugins/tools/tool_transform2/kis_warp_transform_strategy.h
@@ -1,91 +1,91 @@
/*
* Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __KIS_WARP_TRANSFORM_STRATEGY_H
#define __KIS_WARP_TRANSFORM_STRATEGY_H
#include <QObject>
#include <QScopedPointer>
#include "kis_simplified_action_policy_strategy.h"
class QPointF;
class QPainter;
class KisCoordinatesConverter;
class ToolTransformArgs;
class TransformTransactionProperties;
class QCursor;
class QImage;
class KisWarpTransformStrategy : public KisSimplifiedActionPolicyStrategy
{
Q_OBJECT
public:
KisWarpTransformStrategy(const KisCoordinatesConverter *converter,
ToolTransformArgs &currentArgs,
TransformTransactionProperties &transaction);
- ~KisWarpTransformStrategy();
+ ~KisWarpTransformStrategy() override;
- void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive);
- void paint(QPainter &gc);
- QCursor getCurrentCursor() const;
+ void setTransformFunction(const QPointF &mousePos, bool perspectiveModifierActive) override;
+ void paint(QPainter &gc) override;
+ QCursor getCurrentCursor() const override;
- void externalConfigChanged();
+ void externalConfigChanged() override;
using KisTransformStrategyBase::beginPrimaryAction;
using KisTransformStrategyBase::continuePrimaryAction;
using KisTransformStrategyBase::endPrimaryAction;
- bool beginPrimaryAction(const QPointF &pt);
- void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive);
- bool endPrimaryAction();
+ bool beginPrimaryAction(const QPointF &pt) override;
+ void continuePrimaryAction(const QPointF &pt, bool shiftModifierActve, bool altModifierActive) override;
+ bool endPrimaryAction() override;
- bool acceptsClicks() const;
+ bool acceptsClicks() const override;
Q_SIGNALS:
void requestCanvasUpdate();
protected:
// default is true
void setClipOriginalPointsPosition(bool value);
// default is false
void setCloseOnStartPointClick(bool value);
void overrideDrawingItems(bool drawConnectionLines,
bool drawOrigPoints,
bool drawTransfPoints);
virtual void drawConnectionLines(QPainter &gc,
const QVector<QPointF> &origPoints,
const QVector<QPointF> &transfPoints,
bool isEditingPoints);
virtual QImage calculateTransformedImage(ToolTransformArgs &currentArgs,
const QImage &srcImage,
const QVector<QPointF> &origPoints,
const QVector<QPointF> &transfPoints,
const QPointF &srcOffset,
QPointF *dstOffset);
private:
struct Private;
const QScopedPointer<Private> m_d;
};
#endif /* __KIS_WARP_TRANSFORM_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
index 27771924a9..689fdc87d3 100644
--- a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
+++ b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.h
@@ -1,126 +1,126 @@
/*
* Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TRANSFORM_STROKE_STRATEGY_H
#define __TRANSFORM_STROKE_STRATEGY_H
#include <QMutex>
#include <KoUpdater.h>
#include <kis_stroke_strategy_undo_command_based.h>
#include <kis_types.h>
#include "tool_transform_args.h"
#include <kis_processing_visitor.h>
#include <kritatooltransform_export.h>
class KisPostExecutionUndoAdapter;
class TransformStrokeStrategy : public KisStrokeStrategyUndoCommandBased
{
public:
class TransformData : public KisStrokeJobData {
public:
enum Destination {
PAINT_DEVICE,
SELECTION,
};
public:
TransformData(Destination _destination, const ToolTransformArgs &_config, KisNodeSP _node)
: KisStrokeJobData(CONCURRENT, NORMAL),
destination(_destination),
config(_config),
node(_node)
{
}
Destination destination;
ToolTransformArgs config;
KisNodeSP node;
};
class ClearSelectionData : public KisStrokeJobData {
public:
ClearSelectionData(KisNodeSP _node)
: KisStrokeJobData(SEQUENTIAL, NORMAL),
node(_node)
{
}
KisNodeSP node;
};
public:
TransformStrokeStrategy(KisNodeSP rootNode,
KisSelectionSP selection,
KisStrokeUndoFacade *undoFacade);
- ~TransformStrokeStrategy();
+ ~TransformStrokeStrategy() override;
KisPaintDeviceSP previewDevice() const;
KisSelectionSP realSelection() const;
- void initStrokeCallback();
- void finishStrokeCallback();
- void cancelStrokeCallback();
- void doStrokeCallback(KisStrokeJobData *data);
+ void initStrokeCallback() override;
+ void finishStrokeCallback() override;
+ void cancelStrokeCallback() override;
+ void doStrokeCallback(KisStrokeJobData *data) override;
static bool fetchArgsFromCommand(const KUndo2Command *command, ToolTransformArgs *args, KisNodeSP *rootNode);
protected:
- void postProcessToplevelCommand(KUndo2Command *command);
+ void postProcessToplevelCommand(KUndo2Command *command) override;
private:
KoUpdaterPtr fetchUpdater(KisNodeSP node);
void transformAndMergeDevice(const ToolTransformArgs &config,
KisPaintDeviceSP src,
KisPaintDeviceSP dst,
KisProcessingVisitor::ProgressHelper *helper);
void transformDevice(const ToolTransformArgs &config,
KisPaintDeviceSP device,
KisProcessingVisitor::ProgressHelper *helper);
void clearSelection(KisPaintDeviceSP device);
//void transformDevice(KisPaintDeviceSP src, KisPaintDeviceSP dst, KisProcessingVisitor::ProgressHelper *helper);
bool checkBelongsToSelection(KisPaintDeviceSP device) const;
KisPaintDeviceSP createDeviceCache(KisPaintDeviceSP src);
bool haveDeviceInCache(KisPaintDeviceSP src);
void putDeviceCache(KisPaintDeviceSP src, KisPaintDeviceSP cache);
KisPaintDeviceSP getDeviceCache(KisPaintDeviceSP src);
private:
KisSelectionSP m_selection;
QMutex m_devicesCacheMutex;
QHash<KisPaintDevice*, KisPaintDeviceSP> m_devicesCacheHash;
KisPaintDeviceSP m_previewDevice;
KisTransformMaskSP writeToTransformMask;
ToolTransformArgs m_savedTransformArgs;
KisNodeSP m_savedRootNode;
};
#endif /* __TRANSFORM_STROKE_STRATEGY_H */
diff --git a/plugins/tools/tool_transform2/tool_transform.h b/plugins/tools/tool_transform2/tool_transform.h
index 9420bf2dac..f107390773 100644
--- a/plugins/tools/tool_transform2/tool_transform.h
+++ b/plugins/tools/tool_transform2/tool_transform.h
@@ -1,36 +1,36 @@
/*
* Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TOOL_TRANSFORM_H_
#define TOOL_TRANSFORM_H_
#include <QObject>
#include <QVariant>
/**
* A module that provides a transform tool.
*/
class ToolTransform : public QObject
{
Q_OBJECT
public:
ToolTransform(QObject *parent, const QVariantList &);
- virtual ~ToolTransform();
+ ~ToolTransform() override;
};
#endif // TOOL_TRANSFORM_H_
diff --git a/sdk/tests/lod_override.h b/sdk/tests/lod_override.h
index 26356e7b3e..e07b3e1f8f 100644
--- a/sdk/tests/lod_override.h
+++ b/sdk/tests/lod_override.h
@@ -1,134 +1,134 @@
/*
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __LOD_OVERRIDE_H
#define __LOD_OVERRIDE_H
#include "kis_default_bounds_base.h"
namespace TestUtil {
class LodOverride
{
private:
class LodDefaultBounds : public KisDefaultBoundsBase
{
public:
LodDefaultBounds(int lod, KisDefaultBoundsBaseSP parent)
: m_lod(lod), m_parent(parent)
{
}
- QRect bounds() const {
+ QRect bounds() const override {
return m_parent->bounds();
}
- bool wrapAroundMode() const {
+ bool wrapAroundMode() const override {
return m_parent->wrapAroundMode();
}
- int currentLevelOfDetail() const {
+ int currentLevelOfDetail() const override {
return m_lod;
}
- int currentTime() const {
+ int currentTime() const override {
return m_parent->currentTime();
}
- bool externalFrameActive() const {
+ bool externalFrameActive() const override {
return m_parent->externalFrameActive();
}
KisDefaultBoundsBaseSP parent() const {
return m_parent;
}
private:
int m_lod;
KisDefaultBoundsBaseSP m_parent;
};
public:
explicit LodOverride(int lod, KisImageSP image)
: m_lod(lod), m_image(image)
{
overrideBounds(m_image->root(), OverrideDevice(m_lod));
}
~LodOverride()
{
overrideBounds(m_image->root(), RestoreDevice());
}
private:
template <class OverrideOp>
void overrideBounds(KisNodeSP root, OverrideOp op) {
op(root->paintDevice());
if (root->original() != root->paintDevice()) {
op(root->original());
}
if (root->projection() != root->original()) {
op(root->projection());
}
KisNodeSP node = root->firstChild();
while (node) {
overrideBounds(node, op);
node = node->nextSibling();
}
}
struct OverrideDevice {
OverrideDevice(int lod) : m_lod(lod) {}
void operator() (KisPaintDeviceSP device) {
if (!device) return;
LodDefaultBounds *bounds = dynamic_cast<LodDefaultBounds*>(device->defaultBounds().data());
if (bounds) return;
device->setDefaultBounds(new LodDefaultBounds(m_lod, device->defaultBounds()));
}
int m_lod;
};
struct RestoreDevice {
void operator() (KisPaintDeviceSP device) {
if (!device) return;
LodDefaultBounds *bounds = dynamic_cast<LodDefaultBounds*>(device->defaultBounds().data());
if (!bounds) return;
device->setDefaultBounds(bounds->parent());
}
};
private:
int m_lod;
KisImageSP m_image;
};
}
#endif /* __LOD_OVERRIDE_H */
diff --git a/sdk/tests/testing_nodes.h b/sdk/tests/testing_nodes.h
index 6855a0e84b..5e972cf086 100644
--- a/sdk/tests/testing_nodes.h
+++ b/sdk/tests/testing_nodes.h
@@ -1,53 +1,53 @@
/*
* Copyright (c) 2016 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TESTING_NODES_H
#define TESTING_NODES_H
#include "kis_node.h"
namespace TestUtil {
struct DefaultNode : public KisNode {
- KisPaintDeviceSP paintDevice() const {
+ KisPaintDeviceSP paintDevice() const override {
return KisPaintDeviceSP();
}
- KisPaintDeviceSP original() const {
+ KisPaintDeviceSP original() const override {
return KisPaintDeviceSP();
}
- KisPaintDeviceSP projection() const {
+ KisPaintDeviceSP projection() const override {
return KisPaintDeviceSP();
}
- bool allowAsChild(KisNodeSP) const {
+ bool allowAsChild(KisNodeSP) const override {
return true;
}
- const KoColorSpace * colorSpace() const {
+ const KoColorSpace * colorSpace() const override {
return 0;
}
- virtual const KoCompositeOp * compositeOp() const {
+ const KoCompositeOp * compositeOp() const override {
return 0;
}
};
}
#endif // TESTING_NODES_H
diff --git a/sdk/tests/testing_timed_default_bounds.h b/sdk/tests/testing_timed_default_bounds.h
index 1b4c22f853..f48324acfd 100644
--- a/sdk/tests/testing_timed_default_bounds.h
+++ b/sdk/tests/testing_timed_default_bounds.h
@@ -1,72 +1,72 @@
/*
* Copyright (c) 2015 Jouni Pentikäinen <joupent@gmail.com>
* Copyright (c) 2015 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __TESTING_TIMED_DEFAULT_BOUNDS_H
#define __TESTING_TIMED_DEFAULT_BOUNDS_H
#include "kis_default_bounds_base.h"
namespace TestUtil {
struct TestingTimedDefaultBounds : public KisDefaultBoundsBase {
TestingTimedDefaultBounds(const QRect &bounds = QRect(0,0,100,100))
: m_time(0),
m_lod(0),
m_bounds(bounds)
{
}
- QRect bounds() const {
+ QRect bounds() const override {
return m_bounds;
}
- bool wrapAroundMode() const {
+ bool wrapAroundMode() const override {
return false;
}
- int currentLevelOfDetail() const {
+ int currentLevelOfDetail() const override {
return m_lod;
}
- int currentTime() const {
+ int currentTime() const override {
return m_time;
}
- bool externalFrameActive() const {
+ bool externalFrameActive() const override {
return false;
}
void testingSetTime(int time) {
m_time = time;
}
void testingSetLod(int lod) {
m_lod = lod;
}
private:
int m_time;
int m_lod;
QRect m_bounds;
};
}
#endif /* __TESTING_TIMED_DEFAULT_BOUNDS_H */
diff --git a/sdk/tests/testutil.h b/sdk/tests/testutil.h
index f5bf219401..75c981fc7c 100644
--- a/sdk/tests/testutil.h
+++ b/sdk/tests/testutil.h
@@ -1,419 +1,419 @@
/*
* Copyright (c) 2007 Boudewijn Rempt <boud@valdyas.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef TEST_UTIL
#define TEST_UTIL
#include <QProcessEnvironment>
#include <QList>
#include <QTime>
#include <QDir>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <KoColorProfile.h>
#include <KoProgressProxy.h>
#include <kis_paint_device.h>
#include <kis_node.h>
#include <kis_undo_adapter.h>
#include "kis_node_graph_listener.h"
#include "kis_iterator_ng.h"
#include "kis_image.h"
#include "testing_nodes.h"
#ifndef FILES_DATA_DIR
#define FILES_DATA_DIR "."
#endif
#ifndef FILES_DEFAULT_DATA_DIR
#define FILES_DEFAULT_DATA_DIR "."
#endif
#include "qimage_test_util.h"
/**
* Routines that are useful for writing efficient tests
*/
namespace TestUtil
{
inline KisNodeSP findNode(KisNodeSP root, const QString &name) {
if(root->name() == name) return root;
KisNodeSP child = root->firstChild();
while (child) {
if((root = findNode(child, name))) return root;
child = child->nextSibling();
}
return KisNodeSP();
}
inline void dumpNodeStack(KisNodeSP node, QString prefix = QString("\t"))
{
- dbgKrita << node->name();
+ qDebug() << node->name();
KisNodeSP child = node->firstChild();
while (child) {
if (child->childCount() > 0) {
dumpNodeStack(child, prefix + "\t");
} else {
- dbgKrita << prefix << child->name();
+ qDebug() << prefix << child->name();
}
child = child->nextSibling();
}
}
class TestProgressBar : public KoProgressProxy {
public:
TestProgressBar()
: m_min(0), m_max(0), m_value(0)
{}
- int maximum() const {
+ int maximum() const override {
return m_max;
}
- void setValue(int value) {
+ void setValue(int value) override {
m_value = value;
}
- void setRange(int min, int max) {
+ void setRange(int min, int max) override {
m_min = min;
m_max = max;
}
- void setFormat(const QString &format) {
+ void setFormat(const QString &format) override {
m_format = format;
}
int min() { return m_min; }
int max() { return m_max; }
int value() { return m_value; }
QString format() { return m_format; }
private:
int m_min;
int m_max;
int m_value;
QString m_format;
};
inline bool comparePaintDevices(QPoint & pt, const KisPaintDeviceSP dev1, const KisPaintDeviceSP dev2)
{
// QTime t;
// t.start();
QRect rc1 = dev1->exactBounds();
QRect rc2 = dev2->exactBounds();
if (rc1 != rc2) {
pt.setX(-1);
pt.setY(-1);
}
KisHLineConstIteratorSP iter1 = dev1->createHLineConstIteratorNG(0, 0, rc1.width());
KisHLineConstIteratorSP iter2 = dev2->createHLineConstIteratorNG(0, 0, rc1.width());
int pixelSize = dev1->pixelSize();
for (int y = 0; y < rc1.height(); ++y) {
do {
if (memcmp(iter1->oldRawData(), iter2->oldRawData(), pixelSize) != 0)
return false;
} while (iter1->nextPixel() && iter2->nextPixel());
iter1->nextRow();
iter2->nextRow();
}
- // dbgKrita << "comparePaintDevices time elapsed:" << t.elapsed();
+ // qDebug() << "comparePaintDevices time elapsed:" << t.elapsed();
return true;
}
template <typename channel_type>
inline bool comparePaintDevicesClever(const KisPaintDeviceSP dev1, const KisPaintDeviceSP dev2, channel_type alphaThreshold = 0)
{
QRect rc1 = dev1->exactBounds();
QRect rc2 = dev2->exactBounds();
if (rc1 != rc2) {
- dbgKrita << "Devices have different size" << ppVar(rc1) << ppVar(rc2);
+ qDebug() << "Devices have different size" << ppVar(rc1) << ppVar(rc2);
return false;
}
KisHLineConstIteratorSP iter1 = dev1->createHLineConstIteratorNG(0, 0, rc1.width());
KisHLineConstIteratorSP iter2 = dev2->createHLineConstIteratorNG(0, 0, rc1.width());
int pixelSize = dev1->pixelSize();
for (int y = 0; y < rc1.height(); ++y) {
do {
if (memcmp(iter1->oldRawData(), iter2->oldRawData(), pixelSize) != 0) {
const channel_type* p1 = reinterpret_cast<const channel_type*>(iter1->oldRawData());
const channel_type* p2 = reinterpret_cast<const channel_type*>(iter2->oldRawData());
if (p1[3] < alphaThreshold && p2[3] < alphaThreshold) continue;
- dbgKrita << "Failed compare paint devices:" << iter1->x() << iter1->y();
- dbgKrita << "src:" << p1[0] << p1[1] << p1[2] << p1[3];
- dbgKrita << "dst:" << p2[0] << p2[1] << p2[2] << p2[3];
+ qDebug() << "Failed compare paint devices:" << iter1->x() << iter1->y();
+ qDebug() << "src:" << p1[0] << p1[1] << p1[2] << p1[3];
+ qDebug() << "dst:" << p2[0] << p2[1] << p2[2] << p2[3];
return false;
}
} while (iter1->nextPixel() && iter2->nextPixel());
iter1->nextRow();
iter2->nextRow();
}
return true;
}
#ifdef FILES_OUTPUT_DIR
struct ExternalImageChecker
{
ExternalImageChecker(const QString &prefix, const QString &testName)
: m_prefix(prefix),
m_testName(testName),
m_success(true),
m_maxFailingPixels(100),
m_fuzzy(1)
{
}
void setMaxFailingPixels(int value) {
m_maxFailingPixels = value;
}
void setFuzzy(int fuzzy){
m_fuzzy = fuzzy;
}
bool testPassed() const {
return m_success;
}
inline bool checkDevice(KisPaintDeviceSP device, KisImageSP image, const QString &caseName) {
bool result =
checkQImageExternal(device->convertToQImage(0, image->bounds()),
m_testName,
m_prefix,
caseName, m_fuzzy, m_fuzzy, m_maxFailingPixels);
m_success &= result;
return result;
}
inline bool checkImage(KisImageSP image, const QString &testName) {
bool result = checkDevice(image->projection(), image, testName);
m_success &= result;
return result;
}
private:
QString m_prefix;
QString m_testName;
bool m_success;
int m_maxFailingPixels;
int m_fuzzy;
};
#endif
inline quint8 alphaDevicePixel(KisPaintDeviceSP dev, qint32 x, qint32 y)
{
KisHLineConstIteratorSP iter = dev->createHLineConstIteratorNG(x, y, 1);
const quint8 *pix = iter->oldRawData();
return *pix;
}
inline void alphaDeviceSetPixel(KisPaintDeviceSP dev, qint32 x, qint32 y, quint8 s)
{
KisHLineIteratorSP iter = dev->createHLineIteratorNG(x, y, 1);
quint8 *pix = iter->rawData();
*pix = s;
}
inline bool checkAlphaDeviceFilledWithPixel(KisPaintDeviceSP dev, const QRect &rc, quint8 expected)
{
KisHLineIteratorSP it = dev->createHLineIteratorNG(rc.x(), rc.y(), rc.width());
for (int y = rc.y(); y < rc.y() + rc.height(); y++) {
for (int x = rc.x(); x < rc.x() + rc.width(); x++) {
if(*((quint8*)it->rawData()) != expected) {
errKrita << "At point:" << x << y;
errKrita << "Expected pixel:" << expected;
errKrita << "Actual pixel: " << *((quint8*)it->rawData());
return false;
}
it->nextPixel();
}
it->nextRow();
}
return true;
}
class TestNode : public DefaultNode
{
Q_OBJECT
public:
- KisNodeSP clone() const {
+ KisNodeSP clone() const override {
return KisNodeSP(new TestNode(*this));
}
};
class TestGraphListener : public KisNodeGraphListener
{
public:
- virtual void aboutToAddANode(KisNode *parent, int index) {
+ void aboutToAddANode(KisNode *parent, int index) override {
KisNodeGraphListener::aboutToAddANode(parent, index);
beforeInsertRow = true;
}
- virtual void nodeHasBeenAdded(KisNode *parent, int index) {
+ void nodeHasBeenAdded(KisNode *parent, int index) override {
KisNodeGraphListener::nodeHasBeenAdded(parent, index);
afterInsertRow = true;
}
- virtual void aboutToRemoveANode(KisNode *parent, int index) {
+ void aboutToRemoveANode(KisNode *parent, int index) override {
KisNodeGraphListener::aboutToRemoveANode(parent, index);
beforeRemoveRow = true;
}
- virtual void nodeHasBeenRemoved(KisNode *parent, int index) {
+ void nodeHasBeenRemoved(KisNode *parent, int index) override {
KisNodeGraphListener::nodeHasBeenRemoved(parent, index);
afterRemoveRow = true;
}
- virtual void aboutToMoveNode(KisNode *parent, int oldIndex, int newIndex) {
+ void aboutToMoveNode(KisNode *parent, int oldIndex, int newIndex) override {
KisNodeGraphListener::aboutToMoveNode(parent, oldIndex, newIndex);
beforeMove = true;
}
- virtual void nodeHasBeenMoved(KisNode *parent, int oldIndex, int newIndex) {
+ void nodeHasBeenMoved(KisNode *parent, int oldIndex, int newIndex) override {
KisNodeGraphListener::nodeHasBeenMoved(parent, oldIndex, newIndex);
afterMove = true;
}
bool beforeInsertRow;
bool afterInsertRow;
bool beforeRemoveRow;
bool afterRemoveRow;
bool beforeMove;
bool afterMove;
void resetBools() {
beforeRemoveRow = false;
afterRemoveRow = false;
beforeInsertRow = false;
afterInsertRow = false;
beforeMove = false;
afterMove = false;
}
};
}
#include <kis_paint_layer.h>
#include <kis_image.h>
#include "kis_undo_stores.h"
namespace TestUtil {
struct MaskParent
{
MaskParent(const QRect &_imageRect = QRect(0,0,512,512))
: imageRect(_imageRect) {
const KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
undoStore = new KisSurrogateUndoStore();
image = new KisImage(undoStore, imageRect.width(), imageRect.height(), cs, "test image");
layer = KisPaintLayerSP(new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8));
image->addNode(KisNodeSP(layer.data()));
}
KisSurrogateUndoStore *undoStore;
const QRect imageRect;
KisImageSP image;
KisPaintLayerSP layer;
};
}
namespace TestUtil {
class MeasureAvgPortion
{
public:
MeasureAvgPortion(int period)
: m_period(period),
m_val(0),
m_total(0),
m_cycles(0)
{
}
~MeasureAvgPortion() {
printValues(true);
}
void addVal(int x) {
m_val += x;
}
void addTotal(int x) {
m_total += x;
m_cycles++;
printValues();
}
private:
void printValues(bool force = false) {
if (m_cycles > m_period || force) {
- dbgKrita << "Val / Total:" << qreal(m_val) / qreal(m_total);
- dbgKrita << "Avg. Val: " << qreal(m_val) / m_cycles;
- dbgKrita << "Avg. Total: " << qreal(m_total) / m_cycles;
- dbgKrita << ppVar(m_val) << ppVar(m_total) << ppVar(m_cycles);
+ qDebug() << "Val / Total:" << qreal(m_val) / qreal(m_total);
+ qDebug() << "Avg. Val: " << qreal(m_val) / m_cycles;
+ qDebug() << "Avg. Total: " << qreal(m_total) / m_cycles;
+ qDebug() << ppVar(m_val) << ppVar(m_total) << ppVar(m_cycles);
m_val = 0;
m_total = 0;
m_cycles = 0;
}
}
private:
int m_period;
qint64 m_val;
qint64 m_total;
qint64 m_cycles;
};
QStringList getHierarchy(KisNodeSP root, const QString &prefix = "");
bool checkHierarchy(KisNodeSP root, const QStringList &expected);
}
#endif