Commit 99e1a2e0 authored by Scott Petrovic's avatar Scott Petrovic
Browse files

Merge remote-tracking branch 'origin/master' into petrovic-ui-assistants

parents b3576e06 101e96f6
......@@ -31,7 +31,7 @@ Note: on all operating systems the entire procedure is done in a terminal window
== Setup your environment ==
Windows Only:
When launching the commands from the console, run first "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" in it, this way all the environment variables for the compiler will be ready.
When launching the commands from the console, run first "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" in it (include the quotes). This way all the environment variables for the compiler will be ready.
== Prepare your directory layout ==
......@@ -49,7 +49,13 @@ Windows Only:
== Qt ==
Install Qt. Either build from source or with the qt.io installer. Make sure qmake is in your path. You need qtbase, qtsvg, qttools, qtscript, qtdeclarative, qtgraphicaleffects, qttranslations. On Windows, you also need qtwinextras, on Linux qtx11extras.
Install Qt. Either build from source or with the qt.io installer.
Either way, make sure qmake is in your environment path. If you are using Qt 5.6 for example, this is the default location for Windows:
C:\Qt\Qt5.6.0\5.6\msvc2015_64\bin
You need qtbase, qtsvg, qttools, qtscript, qtdeclarative, qtgraphicaleffects, qttranslations. On Windows, you also need qtwinextras, on Linux qtx11extras.
When installing from source, you can use these example configure commands:
......@@ -264,6 +270,10 @@ 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, next to the install folder and run it.
That will copy the Krita 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"
......@@ -271,3 +281,4 @@ On OSX
- 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.
......@@ -169,6 +169,8 @@ option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binar
# get the special macros
include(CalligraProductSetMacros)
include(MacroJPEG)
include(GenerateTestExportHeader)
# get the definitions of products, features and product sets
include(KritaProducts.cmake)
......
......@@ -13,7 +13,7 @@ Krita. Stable Krita 2.9 is here:
The user manual is here:
https://userbase.kde.org/Krita/Manual
https://docs.krita.org/Category:User_Manual
Development notes and build instructions:
......
......@@ -355,7 +355,7 @@ bool compareTwoOps(bool haveMask, const KoCompositeOp *op1, const KoCompositeOp
compareResult = compareTwoOpsPixels<quint8>(tiles, 10);
}
else if (pixelSize == 16) {
compareResult = compareTwoOpsPixels<float>(tiles, 0);
compareResult = compareTwoOpsPixels<float>(tiles, 2e-7);
}
else {
qFatal("Pixel size %i is not implemented", pixelSize);
......@@ -589,6 +589,41 @@ void KisCompositionBenchmark::checkRoundingAlphaDarken_05_10_08()
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_03()
{
#ifdef HAVE_VC
checkRounding<OverCompositor128<float, float, false, true> >(0.5, 0.3, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_05()
{
#ifdef HAVE_VC
checkRounding<OverCompositor128<float, float, false, true> >(0.5, 0.5, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_07()
{
#ifdef HAVE_VC
checkRounding<OverCompositor128<float, float, false, true> >(0.5, 0.7, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_10()
{
#ifdef HAVE_VC
checkRounding<OverCompositor128<float, float, false, true> >(0.5, 1.0, -1, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingAlphaDarkenF32_05_10_08()
{
#ifdef HAVE_VC
checkRounding<OverCompositor128<float, float, false, true> >(0.5, 1.0, 0.8, 16);
#endif
}
void KisCompositionBenchmark::checkRoundingOver()
{
#ifdef HAVE_VC
......@@ -615,6 +650,18 @@ void KisCompositionBenchmark::compareAlphaDarkenOps()
delete opAct;
}
void KisCompositionBenchmark::compareRgbF32AlphaDarkenOps()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->colorSpace("RGBA", "F32", "");
KoCompositeOp *opAct = KoOptimizedCompositeOpFactory::createAlphaDarkenOp128(cs);
KoCompositeOp *opExp = new KoCompositeOpAlphaDarken<KoRgbF32Traits>(cs);
QVERIFY(compareTwoOps(true, opAct, opExp));
delete opExp;
delete opAct;
}
void KisCompositionBenchmark::compareAlphaDarkenOpsNoMask()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
......@@ -695,6 +742,22 @@ void KisCompositionBenchmark::testRgb8CompositeOverOptimized()
delete op;
}
void KisCompositionBenchmark::testRgbF32CompositeAlphaDarkenLegacy()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->colorSpace("RGBA", "F32", "");
KoCompositeOp *op = new KoCompositeOpAlphaDarken<KoRgbF32Traits>(cs);
benchmarkCompositeOp(op, "Legacy");
delete op;
}
void KisCompositionBenchmark::testRgbF32CompositeAlphaDarkenOptimized()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->colorSpace("RGBA", "F32", "");
KoCompositeOp *op = KoOptimizedCompositeOpFactory::createAlphaDarkenOp128(cs);
benchmarkCompositeOp(op, "Optimized");
delete op;
}
void KisCompositionBenchmark::testRgbF32CompositeOverLegacy()
{
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->colorSpace("RGBA", "F32", "");
......
......@@ -30,12 +30,18 @@ private Q_SLOTS:
void checkRoundingAlphaDarken_05_07();
void checkRoundingAlphaDarken_05_10();
void checkRoundingAlphaDarken_05_10_08();
void checkRoundingAlphaDarkenF32_05_03();
void checkRoundingAlphaDarkenF32_05_05();
void checkRoundingAlphaDarkenF32_05_07();
void checkRoundingAlphaDarkenF32_05_10();
void checkRoundingAlphaDarkenF32_05_10_08();
void checkRoundingOver();
void checkRoundingOverRgbaF32();
void compareAlphaDarkenOps();
void compareAlphaDarkenOpsNoMask();
void compareRgbF32AlphaDarkenOps();
void compareOverOps();
void compareOverOpsNoMask();
void compareRgbF32OverOps();
......@@ -46,6 +52,9 @@ private Q_SLOTS:
void testRgb8CompositeOverLegacy();
void testRgb8CompositeOverOptimized();
void testRgbF32CompositeAlphaDarkenLegacy();
void testRgbF32CompositeAlphaDarkenOptimized();
void testRgbF32CompositeOverLegacy();
void testRgbF32CompositeOverOptimized();
......
#.rst:
# GenerateTestExportHeader
# --------------------
#
# This module provides the function GENERATE_TEST_EXPORT_HEADER().
# It is almost identical to generate_export_header() but produces
# additional test export symbols using exporttestheader.cmake.in
#
# The standard format is ${BASE_NAME}_TEST_EXPORT
# If you use a custom export symbol like EXPORTMYLIB
# the test symbol will be of the format EXPORTMYLIB_TEST
#
#=============================================================================
# Copyright 2011 Stephen Kelly <steveire@gmail.com>
# Copyright 2015 Michael Abrahams <miabraha@gmail.com>
#
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
include(CMakeParseArguments)
include(CheckCXXCompilerFlag)
# TODO: Install this macro separately?
macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT)
check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; }
int main() { return somefunc();}" ${_RESULT}
)
endmacro()
macro(_test_compiler_hidden_visibility)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
set(GCC_TOO_OLD TRUE)
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
set(_INTEL_TOO_OLD TRUE)
endif()
# Exclude XL here because it misinterprets -fvisibility=hidden even though
# the check_cxx_compiler_flag passes
if(NOT GCC_TOO_OLD
AND NOT _INTEL_TOO_OLD
AND NOT WIN32
AND NOT CYGWIN
AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL
AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI
AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
check_cxx_compiler_flag(-fvisibility-inlines-hidden
COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
option(USE_COMPILER_HIDDEN_VISIBILITY
"Use HIDDEN visibility support if available." ON)
mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY)
endif()
endmacro()
macro(_test_compiler_has_deprecated)
if(CMAKE_CXX_COMPILER_ID MATCHES Borland
OR CMAKE_CXX_COMPILER_ID MATCHES HP
OR GCC_TOO_OLD
OR CMAKE_CXX_COMPILER_ID MATCHES PGI
OR CMAKE_CXX_COMPILER_ID MATCHES Watcom)
set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL
"Compiler support for a deprecated attribute")
else()
_check_cxx_compiler_attribute("__attribute__((__deprecated__))"
COMPILER_HAS_DEPRECATED_ATTR)
if(COMPILER_HAS_DEPRECATED_ATTR)
set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}"
CACHE INTERNAL "Compiler support for a deprecated attribute")
else()
_check_cxx_compiler_attribute("__declspec(deprecated)"
COMPILER_HAS_DEPRECATED)
endif()
endif()
endmacro()
get_filename_component(_GENERATE_TEST_EXPORT_HEADER_MODULE_DIR
"${CMAKE_CURRENT_LIST_FILE}" PATH)
macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
set(DEFINE_DEPRECATED)
set(DEFINE_EXPORT)
set(DEFINE_IMPORT)
set(DEFINE_NO_EXPORT)
if (COMPILER_HAS_DEPRECATED_ATTR)
set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))")
elseif(COMPILER_HAS_DEPRECATED)
set(DEFINE_DEPRECATED "__declspec(deprecated)")
endif()
get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
if(NOT ${type} STREQUAL "STATIC_LIBRARY")
if(WIN32)
set(DEFINE_EXPORT "__declspec(dllexport)")
set(DEFINE_IMPORT "__declspec(dllimport)")
elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
set(DEFINE_EXPORT "__attribute__((visibility(\"default\")))")
set(DEFINE_IMPORT "__attribute__((visibility(\"default\")))")
set(DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))")
endif()
endif()
endmacro()
macro(_DO_GENERATE_TEST_EXPORT_HEADER TARGET_LIBRARY)
# Option overrides
set(options DEFINE_NO_DEPRECATED)
set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME
DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE
NO_DEPRECATED_MACRO_NAME)
set(multiValueArgs)
cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN})
set(BASE_NAME "${TARGET_LIBRARY}")
if(_GEH_BASE_NAME)
set(BASE_NAME ${_GEH_BASE_NAME})
endif()
string(TOUPPER ${BASE_NAME} BASE_NAME_UPPER)
string(TOLOWER ${BASE_NAME} BASE_NAME_LOWER)
# Default options
set(EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_EXPORT")
set(EXPORT_TEST_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_TEST_EXPORT")
set(NO_EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_EXPORT")
set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME_LOWER}_export.h")
set(DEPRECATED_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_DEPRECATED")
set(STATIC_DEFINE "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_STATIC_DEFINE")
set(NO_DEPRECATED_MACRO_NAME
"${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_DEPRECATED")
if(_GEH_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "Unknown keywords given to GENERATE_TEST_EXPORT_HEADER(): \"${_GEH_UNPARSED_ARGUMENTS}\"")
endif()
if(_GEH_EXPORT_MACRO_NAME)
set(EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME})
set(EXPORT_TEST_MACRO_NAME "${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME}_TEST")
endif()
string(MAKE_C_IDENTIFIER ${EXPORT_MACRO_NAME} EXPORT_MACRO_NAME)
string(MAKE_C_IDENTIFIER ${EXPORT_MACRO_NAME} EXPORT_TEST_MACRO_NAME)
if(_GEH_EXPORT_FILE_NAME)
if(IS_ABSOLUTE ${_GEH_EXPORT_FILE_NAME})
set(EXPORT_FILE_NAME ${_GEH_EXPORT_FILE_NAME})
else()
set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${_GEH_EXPORT_FILE_NAME}")
endif()
endif()
if(_GEH_DEPRECATED_MACRO_NAME)
set(DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_DEPRECATED_MACRO_NAME})
endif()
string(MAKE_C_IDENTIFIER ${DEPRECATED_MACRO_NAME} DEPRECATED_MACRO_NAME)
if(_GEH_NO_EXPORT_MACRO_NAME)
set(NO_EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_EXPORT_MACRO_NAME})
endif()
string(MAKE_C_IDENTIFIER ${NO_EXPORT_MACRO_NAME} NO_EXPORT_MACRO_NAME)
if(_GEH_STATIC_DEFINE)
set(STATIC_DEFINE ${_GEH_PREFIX_NAME}${_GEH_STATIC_DEFINE})
endif()
string(MAKE_C_IDENTIFIER ${STATIC_DEFINE} STATIC_DEFINE)
if(_GEH_DEFINE_NO_DEPRECATED)
set(DEFINE_NO_DEPRECATED TRUE)
endif()
if(_GEH_NO_DEPRECATED_MACRO_NAME)
set(NO_DEPRECATED_MACRO_NAME
${_GEH_PREFIX_NAME}${_GEH_NO_DEPRECATED_MACRO_NAME})
endif()
string(MAKE_C_IDENTIFIER ${NO_DEPRECATED_MACRO_NAME} NO_DEPRECATED_MACRO_NAME)
set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H")
get_target_property(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY} DEFINE_SYMBOL)
if(NOT EXPORT_IMPORT_CONDITION)
set(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY}_EXPORTS)
endif()
string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION)
configure_file("${_GENERATE_TEST_EXPORT_HEADER_MODULE_DIR}/exporttestheader.cmake.in"
"${EXPORT_FILE_NAME}" @ONLY)
endmacro()
function(GENERATE_TEST_EXPORT_HEADER TARGET_LIBRARY)
get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
if(NOT ${type} STREQUAL "STATIC_LIBRARY"
AND NOT ${type} STREQUAL "SHARED_LIBRARY"
AND NOT ${type} STREQUAL "OBJECT_LIBRARY"
AND NOT ${type} STREQUAL "MODULE_LIBRARY")
message(WARNING "This macro can only be used with libraries")
return()
endif()
_test_compiler_hidden_visibility()
_test_compiler_has_deprecated()
_do_set_macro_values(${TARGET_LIBRARY})
_do_generate_test_export_header(${TARGET_LIBRARY} ${ARGN})
endfunction()
function(add_compiler_export_flags)
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
message(DEPRECATION "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.")
endif()
_test_compiler_hidden_visibility()
_test_compiler_has_deprecated()
if(NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY))
# Just return if there are no flags to add.
return()
endif()
set (EXTRA_FLAGS "-fvisibility=hidden")
if(COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
set (EXTRA_FLAGS "${EXTRA_FLAGS} -fvisibility-inlines-hidden")
endif()
# Either return the extra flags needed in the supplied argument, or to the
# CMAKE_CXX_FLAGS if no argument is supplied.
if(ARGC GREATER 0)
set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
endif()
endfunction()
......@@ -40,9 +40,6 @@ Collapsed=false
[krita][DockWidget KisToolCrop option widget]
Collapsed=false
[krita][DockWidget KisToolGrid Option Widget]
Collapsed=false
[krita][DockWidget KisToolPerspectiveGrid Option Widget]
Collapsed=false
......
......@@ -9,7 +9,6 @@ KarbonGradientTool=none
KarbonPatternTool=none
KisRulerAssistantTool=none
KisToolCrop=C
KisToolGrid=none
KisToolPath=P
KisToolPencil=none
KisToolPerspectiveGrid=none
......
......@@ -9,7 +9,6 @@ KarbonGradientTool=none
KarbonPatternTool=none
KisRulerAssistantTool=none
KisToolCrop=C
KisToolGrid=none
KisToolPath=none
KisToolPencil=none
KisToolPerspectiveGrid=none
......
......@@ -343,7 +343,7 @@ void MainWindow::switchToSketch()
QTimer::singleShot(50, this, SLOT(sketchChange()));
if (view && view->document()) {
view->document()->setSaveInBatchMode(true);
view->document()->setFileBatchMode(true);
}
}
......@@ -423,7 +423,7 @@ void MainWindow::switchToDesktop(bool justLoaded)
}
if (view && view->document()) {
view->document()->setSaveInBatchMode(false);
view->document()->setFileBatchMode(false);
}
}
......
......@@ -26,12 +26,12 @@
#include <resources/KoAbstractGradient.h>
#include <kis_node.h>
#include <resources/KoPattern.h>
#include <KoGridData.h>
#include <brushengine/kis_paintop_preset.h>
#include <kis_smoothing_options.h>
#include "kis_grid_config.h"
struct ViewModeSynchronisationObject {
ViewModeSynchronisationObject() : initialized(false), gridData(0) { }
ViewModeSynchronisationObject() : initialized(false) { }
bool initialized;
......@@ -52,7 +52,7 @@ struct ViewModeSynchronisationObject {
bool globalAlphaLock;
QString activeToolId;
KoGridData* gridData;
KisGridConfig gridConfig;
// Mirror-axes
QPointF mirrorAxesCenter;
......
......@@ -65,10 +65,6 @@
<Action name="view_fast_grid_20x20"/>
<Action name="view_fast_grid_40x40"/>
</Menu>
<Separator/>
<Action name="view_toggle_perspective_grid"/>
<Action name="view_clear_perspective_grid"/>
<Separator/>
<Action name="view_toggle_painting_assistants"/>
<Separator/>
<Action name="view_palette_action_menu"/>
......
......@@ -43,9 +43,6 @@ Collapsed=false
[krita][DockWidget KisToolCrop option widget]
Collapsed=false
[krita][DockWidget KisToolGrid Option Widget]
Collapsed=false
[krita][DockWidget KisToolPerspectiveGrid Option Widget]
Collapsed=false
......
add_subdirectory( kimgio )
if (APPLE)
add_subdirectory(quicklook)
endif()
add_library(kimg_kra MODULE kra.cpp)
target_link_libraries(kimg_kra Qt5::Gui KF5::Archive)
add_library(kimg_ora MODULE ora.cpp)
target_link_libraries(kimg_ora Qt5::Gui KF5::Archive)
install(TARGETS kimg_ora DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
install(FILES ora.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
install(TARGETS kimg_kra DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats/)
install(FILES kra.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/)
/* This file is part of the KDE project
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 Lesser GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This code is based on Thacher Ulrich PSD loading code released
on public domain. See: http://tulrich.com/geekstuff/
*/
#include "kra.h"
#include <kzip.h>
#include <QImage>
#include <QIODevice>
#include <QFile>
KraHandler::KraHandler()
{
}
bool KraHandler::canRead() const
{
if (canRead(device())) {
setFormat("kra");
return true;
}
return false;
}
bool KraHandler::read(QImage *image)
{
KZip zip(device());
if (!zip.open(QIODevice::ReadOnly)) return false;
const KArchiveEntry *entry = zip.directory()->entry("mergedimage.png");
if (!entry || !entry->isFile()) return false;
const KZipFileEntry* fileZipEntry = static_cast<const KZipFileEntry*>(entry);
image->loadFromData(fileZipEntry->data(), "PNG");
return true;
}
bool KraHandler::canRead(QIODevice *device)
{
if (!device) {
qWarning("KraHandler::canRead() called with no device");
return false;
}
char buff[57];
if (device->peek(buff, sizeof(buff)) == sizeof(buff))
return qstrcmp(buff + 0x26, "application/x-krita") == 0;
return false;
}
QImageIOPlugin::Capabilities KraPlugin::capabilities(QIODevice *device, const QByteArray &format) const
{
if (format == "kra" || format == "KRA") {