Merge branch 'master' of https://github.com/fluxer/kdelibs into devinfo

This commit is contained in:
Ivailo Monev 2021-08-01 00:16:41 +03:00
commit dbd91e5c1e
53 changed files with 18 additions and 6960 deletions

View file

@ -77,17 +77,6 @@ set_package_properties(Exiv2 PROPERTIES
PURPOSE "Required to build libkexiv2"
)
# NOTE: Libraw 0.16.x is prefered version to use because it's ported to Cmake
# with full features supported. Until libraw 0.16.0 is release (ends of 2013),
# we will support previous version (with limited support)
find_package(LibRaw 0.15)
set_package_properties(LibRaw PROPERTIES
DESCRIPTION "library that provides image Raw file demosaicing"
URL "http://www.libraw.org"
TYPE REQUIRED
PURPOSE "Required to build libkdcraw"
)
# optional features
if(X11_FOUND)
macro_bool_to_01(X11_XTest_FOUND HAVE_XTEST)
@ -357,7 +346,6 @@ add_subdirectory( cmake )
add_subdirectory( dnssd )
add_subdirectory( includes )
add_subdirectory( interfaces )
add_subdirectory( kdcraw )
add_subdirectory( kdeclarative )
add_subdirectory( kdecore )
add_subdirectory( kded )

View file

@ -19,7 +19,7 @@ build_script:
sudo apt-get update -qq
sudo apt-get install -qq cmake katie-dev libenchant-dev \
libmagick++-dev libmpv-dev libraw-dev xorg-dev mesa-common-dev \
libmagick++-dev libmpv-dev xorg-dev mesa-common-dev \
libavahi-common-dev krb5-multidev libwebp-dev \
libudev-dev liblzma-dev libexiv2-dev libilmbase-dev libjpeg-dev \
libbz2-dev libattr1-dev libacl1-dev libxcb-render-util0-dev \

View file

@ -7,7 +7,6 @@ set(module_install_dir ${KDE4_DATA_INSTALL_DIR}/cmake/modules)
# to have it around, so there is a place where the modules which are not installed
# are listed explicitly:
set(cmakeFilesDontInstall
FindLibRaw.cmake
FindMPV.cmake
FindUDev.cmake
FindAvahi.cmake

View file

@ -60,7 +60,6 @@
# KDE4_KNOTIFYCONFIG_LIBS - the knotify config library and all depending libraries
# KDE4_KTEXTEDITOR_LIBS - the ktexteditor library and all depending libraries
# KDE4_PLASMA_LIBS - the plasma library and all depending librairies
# KDE4_KDCRAW_LIBS - the kdcraw library and all depending libraries
# KDE4_KEXIV2_LIBS - the kexiv2 library and all depending libraries
# KDE4_KMEDIAPLAYER_LIBS - the kmediaplayer library and all depending libraries
#
@ -284,7 +283,6 @@ endif(_kdeBootStrapping)
set(_kde_libraries
kmediaplayer
kcmutils
kdcraw
kdeclarative
kdecore
kdeui

View file

@ -1,42 +0,0 @@
# Try to find LibRaw library, once done this will define:
#
# LIBRAW_FOUND - system has LibRaw
# LIBRAW_INCLUDE_DIR - the LibRaw include directory
# LIBRAW_LIBRARIES - the libraries needed to use LibRaw
# LIBRAW_DEFINITIONS - compiler switches required for using LibRaw
#
# Copyright (c) 2021 Ivailo Monev <xakepa10@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(PC_LIBRAW QUIET libraw_r)
set(LIBRAW_INCLUDE_DIR ${PC_LIBRAW_INCLUDE_DIRS})
set(LIBRAW_LIBRARIES ${PC_LIBRAW_LIBRARIES})
endif()
set(LIBRAW_VERSION ${PC_LIBRAW_VERSION})
set(LIBRAW_DEFINITIONS ${PC_LIBRAW_CFLAGS_OTHER})
if(NOT LIBRAW_INCLUDE_DIR OR NOT LIBRAW_LIBRARIES)
find_path(LIBRAW_INCLUDE_DIR
NAMES libraw.h
HINTS $ENV{LIBRAWDIR}/include
)
find_library(LIBRAW_LIBRARIES
NAMES raw_r
HINTS $ENV{LIBRAWDIR}/lib
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibRaw
VERSION_VAR LIBRAW_VERSION
REQUIRED_VARS LIBRAW_LIBRARIES LIBRAW_INCLUDE_DIR
)
mark_as_advanced(LIBRAW_INCLUDE_DIR LIBRAW_LIBRARIES)

2
kdcraw/.gitignore vendored
View file

@ -1,2 +0,0 @@
*.kate-swp
tests/databases/*/*.db

View file

@ -1,2 +0,0 @@
SKIP /libraw/

View file

@ -1,15 +0,0 @@
AUTHORS AND MAINTAINERS :
Caulier Gilles <caulier dot gilles at gmail dot com>
Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
CONTRIBUTORS:
Angelo Naselli <anaselli at linux dot it>
Gerhard Kulzer <gerhard at kulzer dot net>
Achim Bohnet <ach at mpe dot mpg dot de>
Guillaume Castagnino <casta at xwing dot info>
THANKS:
Alex Tutubalin <lexa at lexa dot ru> from LibRaw project (http://www.libraw.org)

View file

@ -1,64 +0,0 @@
# ===========================================================
#
# 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 for KDE
#
# @author Copyright (C) 2006-2014 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.
#
# ============================================================
PROJECT(libkdcraw)
IF(EXISTS "${LIBRAW_INCLUDE_DIR}/libraw_config.h")
ADD_DEFINITIONS(-DLIBRAW_HAS_CONFIG)
MESSAGE(STATUS "LibRaw config file exists: yes")
ELSE()
MESSAGE(STATUS "LibRaw config file exists: no")
ENDIF()
ADD_DEFINITIONS(
${QT_QTDBUS_DEFINITIONS}
${LIBRAW_DEFINITIONS}
-DKDE_DEFAULT_DEBUG_AREA=51002
)
INCLUDE_DIRECTORIES(
# for the export header
${CMAKE_CURRENT_BINARY_DIR}/libkdcraw
${QDBUS_INCLUDE_DIRS}
${KDE4_KDECORE_INCLUDES}
${KDE4_KIO_INCLUDES}
${LIBRAW_INCLUDE_DIR}
)
# ==================================================================================================
# Set env. variables accordinly.
SET(DCRAW_LIB_VERSION_STRING "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KDE_VERSION_RELEASE}")
SET(DCRAW_LIB_VERSION_ID "0x0${KDE_VERSION_MAJOR}0${KDE_VERSION_MINOR}0${KDE_VERSION_RELEASE}")
SET(DCRAW_LIB_SO_VERSION_STRING "${DCRAW_LIB_VERSION_STRING}")
# ==================================================================================================
ADD_SUBDIRECTORY(libkdcraw)
ADD_SUBDIRECTORY(icons)
ADD_SUBDIRECTORY(profiles)
IF(ENABLE_TESTING)
ADD_SUBDIRECTORY(tests)
ENDIF()

View file

@ -1,2 +0,0 @@
#! /bin/sh
$XGETTEXT libkdcraw/*.cpp -o $podir/libkdcraw.pot

View file

@ -1,14 +0,0 @@
- Add DNG writting mode support using Adobe DNG sdk
- Libraw 0.13.0 features to support :
1) Green channel local averaging. All interpolation methods, but may conflict with green_matching option, so it is safer to use only one green averaging.
int cfa_green; Boolean, default is 0 (off)
float green_threshold; - Sensitivity of method (green is averaged if difference less than this value in percent). Usable range between 0.01 and 0.1, commonly 0.03
This filtering is applied *before* demosaic.
The problem is simple: on some cameras (for example, Olympus E-xxx) two green channels are different (in sensitivity and, may be, in spectral response).
As a result, it produces 'maze artifacts' on flat surfaces (like sky).
The solution is simple: if two channels are *slightly* different in some local area, it is better to equalize it.

View file

@ -1,25 +0,0 @@
# ===========================================================
#
# 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 for KDE
#
# @author Copyright (C) 2006-2012 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.
#
# ============================================================
kde4_install_icons(${KDE4_ICON_INSTALL_DIR})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -1,83 +0,0 @@
# ===========================================================
#
# This file is was 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 for KDE
#
# @author Copyright (C) 2006-2013 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.
#
# ============================================================
add_definitions(${KDE4_ENABLE_EXCEPTIONS})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/version.h
)
set(kdcraw_LIB_SRCS
kdcraw.cpp
kdcraw_p.cpp
dcrawsettingswidget.cpp
dcrawinfocontainer.cpp
rawdecodingsettings.cpp
rcombobox.cpp
rnuminput.cpp
rexpanderbox.cpp
squeezedcombobox.cpp
)
add_library(kdcraw ${LIBRARY_TYPE} ${kdcraw_LIB_SRCS})
target_link_libraries(kdcraw PRIVATE
${LIBRAW_LIBRARIES}
)
target_link_libraries(kdcraw PUBLIC
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
)
set_target_properties(kdcraw PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
)
install(
TARGETS kdcraw
EXPORT kdelibsLibraryTargets
${INSTALL_TARGETS_DEFAULT_ARGS}
)
generate_export_header(kdcraw)
install(
FILES
rawdecodingsettings.h
kdcraw.h
dcrawsettingswidget.h
rnuminput.h
rcombobox.h
rexpanderbox.h
squeezedcombobox.h
dcrawinfocontainer.h
rawfiles.h
${CMAKE_CURRENT_BINARY_DIR}/kdcraw_export.h
${CMAKE_CURRENT_BINARY_DIR}/version.h
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}/libkdcraw
COMPONENT Devel
)

View file

@ -1,7 +0,0 @@
/** @mainpage libKDcraw
libKDcraw is a thread-safe wrapper around <a href="http://www.libraw.org">libraw</a>. Have a look at KDcrawIface::KDcraw to get started.
@see KDcrawIface::KDcraw
*/

View file

@ -1,173 +0,0 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2007-05-02
* @brief RAW file identification information container
*
* @author Copyright (C) 2007-2013 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.
*
* ============================================================ */
// Local includes
#include "dcrawinfocontainer.h"
namespace KDcrawIface
{
DcrawInfoContainer::DcrawInfoContainer()
{
sensitivity = -1.0;
exposureTime = -1.0;
aperture = -1.0;
focalLength = -1.0;
pixelAspectRatio = 1.0; // Default value. This can be unavailable (depending of camera model).
rawColors = -1;
rawImages = -1;
hasIccProfile = false;
isDecodable = false;
daylightMult[0] = 0.0;
daylightMult[1] = 0.0;
daylightMult[2] = 0.0;
cameraMult[0] = 0.0;
cameraMult[1] = 0.0;
cameraMult[2] = 0.0;
cameraMult[3] = 0.0;
blackPoint = 0;
for (int ch=0; ch<4; ch++)
{
blackPointCh[ch] = 0;
}
whitePoint = 0;
topMargin = 0;
leftMargin = 0;
orientation = ORIENTATION_NONE;
for (int x=0 ; x<3 ; x++)
{
for (int y=0 ; y<4 ; y++)
{
cameraColorMatrix1[x][y] = 0.0;
cameraColorMatrix2[x][y] = 0.0;
cameraXYZMatrix[y][x] = 0.0; // NOTE: see B.K.O # 253911 : [y][x] not [x][y]
}
}
}
DcrawInfoContainer::~DcrawInfoContainer()
{
}
bool DcrawInfoContainer::isEmpty()
{
if (make.isEmpty() &&
model.isEmpty() &&
filterPattern.isEmpty() &&
colorKeys.isEmpty() &&
DNGVersion.isEmpty() &&
exposureTime == -1.0 &&
aperture == -1.0 &&
focalLength == -1.0 &&
pixelAspectRatio == 1.0 &&
sensitivity == -1.0 &&
rawColors == -1 &&
rawImages == -1 &&
blackPoint == 0 &&
blackPointCh[0] == 0 &&
blackPointCh[1] == 0 &&
blackPointCh[2] == 0 &&
blackPointCh[3] == 0 &&
whitePoint == 0 &&
topMargin == 0 &&
leftMargin == 0 &&
!dateTime.isValid() &&
!imageSize.isValid() &&
!fullSize.isValid() &&
!outputSize.isValid() &&
!thumbSize.isValid() &&
cameraColorMatrix1[0][0] == 0.0 &&
cameraColorMatrix1[0][1] == 0.0 &&
cameraColorMatrix1[0][2] == 0.0 &&
cameraColorMatrix1[0][3] == 0.0 &&
cameraColorMatrix1[1][0] == 0.0 &&
cameraColorMatrix1[1][1] == 0.0 &&
cameraColorMatrix1[1][2] == 0.0 &&
cameraColorMatrix1[1][3] == 0.0 &&
cameraColorMatrix1[2][0] == 0.0 &&
cameraColorMatrix1[2][1] == 0.0 &&
cameraColorMatrix1[2][2] == 0.0 &&
cameraColorMatrix1[2][3] == 0.0 &&
cameraColorMatrix2[0][0] == 0.0 &&
cameraColorMatrix2[0][1] == 0.0 &&
cameraColorMatrix2[0][2] == 0.0 &&
cameraColorMatrix2[0][3] == 0.0 &&
cameraColorMatrix2[1][0] == 0.0 &&
cameraColorMatrix2[1][1] == 0.0 &&
cameraColorMatrix2[1][2] == 0.0 &&
cameraColorMatrix2[1][3] == 0.0 &&
cameraColorMatrix2[2][0] == 0.0 &&
cameraColorMatrix2[2][1] == 0.0 &&
cameraColorMatrix2[2][2] == 0.0 &&
cameraColorMatrix2[2][3] == 0.0 &&
cameraXYZMatrix[0][0] == 0.0 &&
cameraXYZMatrix[0][1] == 0.0 &&
cameraXYZMatrix[0][2] == 0.0 &&
cameraXYZMatrix[1][0] == 0.0 &&
cameraXYZMatrix[1][1] == 0.0 &&
cameraXYZMatrix[1][2] == 0.0 &&
cameraXYZMatrix[2][0] == 0.0 &&
cameraXYZMatrix[2][1] == 0.0 &&
cameraXYZMatrix[2][2] == 0.0 &&
cameraXYZMatrix[3][0] == 0.0 &&
cameraXYZMatrix[3][1] == 0.0 &&
cameraXYZMatrix[3][2] == 0.0 &&
orientation == ORIENTATION_NONE
)
{
return true;
}
else
{
return false;
}
}
QDebug operator<<(QDebug dbg, const DcrawInfoContainer& c)
{
dbg.nospace() << "DcrawInfoContainer::sensitivity: " << c.sensitivity << ", ";
dbg.nospace() << "DcrawInfoContainer::exposureTime: " << c.exposureTime << ", ";
dbg.nospace() << "DcrawInfoContainer::aperture: " << c.aperture << ", ";
dbg.nospace() << "DcrawInfoContainer::focalLength: " << c.focalLength << ", ";
dbg.nospace() << "DcrawInfoContainer::pixelAspectRatio: " << c.pixelAspectRatio << ", ";
dbg.nospace() << "DcrawInfoContainer::rawColors: " << c.rawColors << ", ";
dbg.nospace() << "DcrawInfoContainer::rawImages: " << c.rawImages << ", ";
dbg.nospace() << "DcrawInfoContainer::hasIccProfile: " << c.hasIccProfile << ", ";
dbg.nospace() << "DcrawInfoContainer::isDecodable: " << c.isDecodable << ", ";
dbg.nospace() << "DcrawInfoContainer::daylightMult: " << c.daylightMult << ", ";
dbg.nospace() << "DcrawInfoContainer::cameraMult: " << c.cameraMult << ", ";
dbg.nospace() << "DcrawInfoContainer::blackPoint: " << c.blackPoint << ", ";
dbg.nospace() << "DcrawInfoContainer::whitePoint: " << c.whitePoint << ", ";
dbg.nospace() << "DcrawInfoContainer::topMargin: " << c.topMargin << ", ";
dbg.nospace() << "DcrawInfoContainer::leftMargin: " << c.leftMargin << ", ";
dbg.nospace() << "DcrawInfoContainer::orientation: " << c.orientation;
return dbg.space();
}
} // namespace KDcrawIface

View file

@ -1,158 +0,0 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2007-05-02
* @brief RAW file identification information container
*
* @author Copyright (C) 2007-2013 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 DCRAW_INFO_CONTAINER_H
#define DCRAW_INFO_CONTAINER_H
// Qt includes
#include <QtCore/QString>
#include <QtCore/QDateTime>
#include <QtCore/QSize>
#include <QtCore/QDebug>
// Local includes
#include "kdcraw_export.h"
namespace KDcrawIface
{
class KDCRAW_EXPORT DcrawInfoContainer
{
public:
/** The RAW image orientation values
*/
enum ImageOrientation
{
ORIENTATION_NONE = 0,
ORIENTATION_180 = 3,
ORIENTATION_Mirror90CCW = 4,
ORIENTATION_90CCW = 5,
ORIENTATION_90CW = 6
};
public:
/** Standard constructor */
DcrawInfoContainer();
/** Standard destructor */
virtual ~DcrawInfoContainer();
/** Return 'true' if container is empty, else 'false' */
bool isEmpty();
public:
/** True if RAW file include an ICC color profile. */
bool hasIccProfile;
/** True is RAW file is decodable by dcraw. */
bool isDecodable;
/** The number of RAW colors. */
int rawColors;
/** The number of RAW images. */
int rawImages;
/** Black level from Raw histogram. */
unsigned int blackPoint;
/** Channel black levels from Raw histogram. */
unsigned int blackPointCh[4];
/** White level from Raw histogram. */
unsigned int whitePoint;
/** Top margin of raw image. */
unsigned int topMargin;
/** Left margin of raw image. */
unsigned int leftMargin;
/** The raw image orientation */
ImageOrientation orientation;
/** The sensitivity in ISO used by camera to take the picture. */
float sensitivity;
/** ==> 1/exposureTime = exposure time in seconds. */
float exposureTime;
/** ==> Aperture value in APEX. */
float aperture;
/** ==> Focal Length value in mm. */
float focalLength;
/** The pixel Aspect Ratio if != 1.0. NOTE: if == 1.0, dcraw do not show this value. */
float pixelAspectRatio;
/** White color balance settings. */
double daylightMult[3];
/** Camera multipliers used for White Balance adjustments */
double cameraMult[4];
/** Camera Color Matrix */
float cameraColorMatrix1[3][4];
float cameraColorMatrix2[3][4];
float cameraXYZMatrix[4][3];
/** The used Color Keys */
QString colorKeys;
/** The camera maker. */
QString make;
/** The camera model. */
QString model;
/** The artist name who have picture owner. */
QString owner;
/** The demosaising filter pattern. */
QString filterPattern;
/** The DNG version. NOTE: it is only shown with DNG RAW files. */
QString DNGVersion;
/** Date & time when the picture has been taken. */
QDateTime dateTime;
/** The image dimensions in pixels. */
QSize imageSize;
/** The thumb dimensions in pixels. */
QSize thumbSize;
/** The full RAW image dimensions in pixels. */
QSize fullSize;
/** The output dimensions in pixels. */
QSize outputSize;
};
//! kDebug() stream operator. Writes container @a c to the debug output in a nicely formatted way.
KDCRAW_EXPORT QDebug operator<<(QDebug dbg, const DcrawInfoContainer& c);
} // namespace KDcrawIface
#endif /* DCRAW_INFO_CONTAINER_H */

File diff suppressed because it is too large Load diff

View file

@ -1,127 +0,0 @@
/** ===========================================================
* @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-2013 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 <kurlrequester.h>
#include <kconfig.h>
// Local includes
#include "kdcraw_export.h"
#include "rawdecodingsettings.h"
#include "rexpanderbox.h"
namespace KDcrawIface
{
class KDCRAW_EXPORT 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();
KUrlRequester* inputProfileUrlEdit() const;
KUrlRequester* 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);
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 processDcrawUrl(const QString&);
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 */

View file

@ -1,593 +0,0 @@
/** ===========================================================
* @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-2013 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.
*
* ============================================================ */
#include "moc_kdcraw.cpp"
#include "kdcraw_p.h"
// Qt includes
#include <QFile>
#include <QFileInfo>
#include <QStringList>
// KDE includes
#include <kglobal.h>
// LibRaw includes
#include <libraw_version.h>
#ifdef LIBRAW_HAS_CONFIG
#include <libraw_config.h>
#endif
// Local includes
#include "version.h"
#include "rawfiles.h"
static const KCatalogLoader loader("libkdcraw");
namespace KDcrawIface
{
KDcraw::KDcraw()
: d(new Private(this))
{
m_cancel = false;
}
KDcraw::~KDcraw()
{
cancel();
delete d;
}
QString KDcraw::version()
{
return QString(kdcraw_version);
}
void KDcraw::cancel()
{
m_cancel = true;
}
bool KDcraw::loadRawPreview(QImage& image, const QString& path)
{
// In first, try to extract the embedded JPEG preview. Very fast.
bool ret = loadEmbeddedPreview(image, path);
if (ret)
return true;
// In second, decode and half size of RAW picture. More slow.
return (loadHalfPreview(image, path));
}
bool KDcraw::loadEmbeddedPreview(QImage& image, const QString& path)
{
QByteArray imgData;
if ( loadEmbeddedPreview(imgData, path) )
{
kDebug() << "Preview data size:" << imgData.size();
if (image.loadFromData( imgData ))
{
kDebug() << "Using embedded RAW preview extraction";
return true;
}
}
kDebug() << "Failed to load embedded RAW preview";
return false;
}
bool KDcraw::loadEmbeddedPreview(QByteArray& imgData, const QString& path)
{
QFileInfo fileInfo(path);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
LibRaw raw;
int ret = raw.open_file(QFile::encodeName(path));
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
raw.recycle();
return false;
}
return (Private::loadEmbeddedPreview(imgData, raw));
}
bool KDcraw::loadEmbeddedPreview(QByteArray& imgData, const QBuffer& buffer)
{
QString rawFilesExt(KDcrawIface::KDcraw::rawFiles());
LibRaw raw;
QByteArray inData = buffer.data();
int ret = raw.open_buffer((void*) inData.data(), (size_t) inData.size());
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run open_buffer: " << libraw_strerror(ret);
raw.recycle();
return false;
}
return (Private::loadEmbeddedPreview(imgData, raw));
}
bool KDcraw::loadHalfPreview(QImage& image, const QString& path)
{
QFileInfo fileInfo(path);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
kDebug() << "Try to use reduced RAW picture extraction";
LibRaw raw;
raw.imgdata.params.use_auto_wb = 1; // Use automatic white balance.
raw.imgdata.params.use_camera_wb = 1; // Use camera white balance, if possible.
raw.imgdata.params.half_size = 1; // Half-size color image (3x faster than -q).
int ret = raw.open_file(QFile::encodeName(path));
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if(!Private::loadHalfPreview(image, raw))
{
kDebug() << "Failed to get half preview from LibRaw!";
return false;
}
kDebug() << "Using reduced RAW picture extraction";
return true;
}
bool KDcraw::loadHalfPreview(QByteArray& imgData, const QString& path)
{
QFileInfo fileInfo(path);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
kDebug() << "Try to use reduced RAW picture extraction";
LibRaw raw;
int ret = raw.open_file(QFile::encodeName(path));
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run dcraw_process: " << libraw_strerror(ret);
raw.recycle();
return false;
}
QImage image;
if (!Private::loadHalfPreview(image, raw))
{
kDebug() << "KDcraw: failed to get half preview: " << libraw_strerror(ret);
return false;
}
QBuffer buffer(&imgData);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "JPEG");
return true;
}
bool KDcraw::loadHalfPreview(QByteArray& imgData, const QBuffer& inBuffer)
{
QString rawFilesExt(KDcrawIface::KDcraw::rawFiles());
LibRaw raw;
QByteArray inData = inBuffer.data();
int ret = raw.open_buffer((void*) inData.data(), (size_t) inData.size());
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run dcraw_make_mem_image: " << libraw_strerror(ret);
raw.recycle();
return false;
}
QImage image;
if (!Private::loadHalfPreview(image, raw))
{
kDebug() << "KDcraw: failed to get half preview: " << libraw_strerror(ret);
return false;
}
QBuffer buffer(&imgData);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "JPG");
return true;
}
bool KDcraw::loadFullImage(QImage& image, const QString& path, const RawDecodingSettings& settings)
{
QFileInfo fileInfo(path);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
kDebug() << "Try to load full RAW picture...";
RawDecodingSettings prm = settings;
prm.sixteenBitsImage = false;
QByteArray imgData;
int width, height, rgbmax;
KDcraw decoder;
bool ret = decoder.decodeRAWImage(path, prm, imgData, width, height, rgbmax);
if (!ret)
{
kDebug() << "Failled to load full RAW picture";
return false;
}
uchar* sptr = (uchar*)imgData.data();
uchar tmp8[2];
// Set RGB color components.
for (int i = 0 ; i < width * height ; ++i)
{
// Swap Red and Blue
tmp8[0] = sptr[2];
tmp8[1] = sptr[0];
sptr[0] = tmp8[0];
sptr[2] = tmp8[1];
sptr += 3;
}
image = QImage(width, height, QImage::Format_ARGB32);
uint* dptr = reinterpret_cast<uint*>(image.bits());
sptr = (uchar*)imgData.data();
for (int i = 0 ; i < width * height ; ++i)
{
*dptr++ = qRgba(sptr[2], sptr[1], sptr[0], 0xFF);
sptr += 3;
}
kDebug() << "Load full RAW picture done";
return true;
}
bool KDcraw::rawFileIdentify(DcrawInfoContainer& identify, const QString& path)
{
QFileInfo fileInfo(path);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
identify.isDecodable = false;
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
LibRaw raw;
int ret = raw.open_file(QFile::encodeName(path));
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
raw.recycle();
return false;
}
ret = raw.adjust_sizes_info_only();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run adjust_sizes_info_only: " << libraw_strerror(ret);
raw.recycle();
return false;
}
Private::fillIndentifyInfo(&raw, identify);
raw.recycle();
return true;
}
// ----------------------------------------------------------------------------------
bool KDcraw::extractRAWData(const QString& filePath, QByteArray& rawData, DcrawInfoContainer& identify, unsigned int shotSelect)
{
QFileInfo fileInfo(filePath);
QString rawFilesExt(rawFiles());
QString ext = fileInfo.suffix().toUpper();
identify.isDecodable = false;
if (!fileInfo.exists() || ext.isEmpty() || !rawFilesExt.toUpper().contains(ext))
return false;
if (m_cancel)
return false;
d->setProgress(0.1);
LibRaw raw;
// Set progress call back function.
raw.set_progress_handler(callbackForLibRaw, d);
int ret = raw.open_file(QFile::encodeName(filePath));
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_cancel)
{
raw.recycle();
return false;
}
d->setProgress(0.3);
raw.imgdata.params.output_bps = 16;
raw.imgdata.params.shot_select = shotSelect;
ret = raw.unpack();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run unpack: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_cancel)
{
raw.recycle();
return false;
}
d->setProgress(0.4);
ret = raw.raw2image();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run raw2image: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_cancel)
{
raw.recycle();
return false;
}
d->setProgress(0.6);
Private::fillIndentifyInfo(&raw, identify);
if (m_cancel)
{
raw.recycle();
return false;
}
d->setProgress(0.8);
rawData = QByteArray();
if (raw.imgdata.idata.filters == 0)
{
qulonglong overflowcheck = qulonglong(raw.imgdata.sizes.iwidth) * raw.imgdata.sizes.iheight * raw.imgdata.idata.colors * sizeof(unsigned short);
if (overflowcheck > INT_MAX) {
kDebug() << "Raw data size overflow";
raw.recycle();
return false;
}
rawData.resize(int(overflowcheck));
unsigned short* output = reinterpret_cast<unsigned short*>(rawData.data());
for (unsigned int row = 0; row < raw.imgdata.sizes.iheight; row++)
{
for (unsigned int col = 0; col < raw.imgdata.sizes.iwidth; col++)
{
for (int color = 0; color < raw.imgdata.idata.colors; color++)
{
*output = raw.imgdata.image[raw.imgdata.sizes.iwidth*row + col][color];
output++;
}
}
}
}
else
{
qulonglong overflowcheck = qulonglong(raw.imgdata.sizes.iwidth) * raw.imgdata.sizes.iheight * sizeof(unsigned short);
if (overflowcheck > INT_MAX) {
kDebug() << "Raw data size overflow";
raw.recycle();
return false;
}
rawData.resize(int(overflowcheck));
unsigned short* output = reinterpret_cast<unsigned short*>(rawData.data());
for (uint row = 0; row < raw.imgdata.sizes.iheight; row++)
{
for (uint col = 0; col < raw.imgdata.sizes.iwidth; col++)
{
*output = raw.imgdata.image[raw.imgdata.sizes.iwidth*row + col][raw.COLOR(row, col)];
output++;
}
}
}
raw.recycle();
d->setProgress(1.0);
return true;
}
bool KDcraw::decodeHalfRAWImage(const QString& filePath, const RawDecodingSettings& rawDecodingSettings,
QByteArray& imageData, int& width, int& height, int& rgbmax)
{
m_rawDecodingSettings = rawDecodingSettings;
m_rawDecodingSettings.halfSizeColorImage = true;
return (d->loadFromLibraw(filePath, imageData, width, height, rgbmax));
}
bool KDcraw::decodeRAWImage(const QString& filePath, const RawDecodingSettings& rawDecodingSettings,
QByteArray& imageData, int& width, int& height, int& rgbmax)
{
m_rawDecodingSettings = rawDecodingSettings;
return (d->loadFromLibraw(filePath, imageData, width, height, rgbmax));
}
bool KDcraw::checkToCancelWaitingData()
{
return m_cancel;
}
void KDcraw::setWaitingDataProgress(double)
{
}
const char* KDcraw::rawFiles()
{
return raw_file_extentions;
}
QStringList KDcraw::rawFilesList()
{
QString string = QString::fromLatin1(rawFiles());
return string.remove("*.").split(' ');
}
int KDcraw::rawFilesVersion()
{
return raw_file_extensions_version;
}
QStringList KDcraw::supportedCamera()
{
QStringList camera;
const char** const list = LibRaw::cameraList();
for (int i = 0; i < LibRaw::cameraCount(); i++)
camera.append(list[i]);
return camera;
}
QString KDcraw::librawVersion()
{
return QString(LIBRAW_VERSION_STR).remove("-Release");
}
int KDcraw::librawUseGomp()
{
#ifdef LIBRAW_HAS_CONFIG
# ifdef LIBRAW_USE_OPENMP
return true;
# else
return false;
# endif
#else
return -1;
#endif
}
int KDcraw::librawUseRawSpeed()
{
#ifdef LIBRAW_HAS_CONFIG
# ifdef LIBRAW_USE_RAWSPEED
return true;
# else
return false;
# endif
#else
return -1;
#endif
}
int KDcraw::librawUseGPL2DemosaicPack()
{
#ifdef LIBRAW_HAS_CONFIG
# ifdef LIBRAW_USE_DEMOSAIC_PACK_GPL2
return true;
# else
return false;
# endif
#else
return -1;
#endif
}
int KDcraw::librawUseGPL3DemosaicPack()
{
#ifdef LIBRAW_HAS_CONFIG
# ifdef LIBRAW_USE_DEMOSAIC_PACK_GPL3
return true;
# else
return false;
# endif
#else
return -1;
#endif
}
} // namespace KDcrawIface

View file

@ -1,267 +0,0 @@
/** ===========================================================
* @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-2013 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 "kdcraw_export.h"
#include "rawdecodingsettings.h"
#include "dcrawinfocontainer.h"
/** @brief Main namespace of libKDcraw
*/
namespace KDcrawIface
{
class KDCRAW_EXPORT KDcraw : public QObject
{
Q_OBJECT
public:
/** Standard constructor.
*/
KDcraw();
/** Standard destructor.
*/
virtual ~KDcraw();
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 */

View file

@ -1,692 +0,0 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-10-09
* @brief internal private container for KDcraw
*
* @author Copyright (C) 2008-2013 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.
*
* ============================================================ */
#include "kdcraw.h"
#include "kdcraw_p.h"
// Qt includes
#include <QString>
#include <QFile>
namespace KDcrawIface
{
int callbackForLibRaw(void* data, enum LibRaw_progress p, int iteration, int expected)
{
if (data)
{
KDcraw::Private* const d = static_cast<KDcraw::Private*>(data);
if (d)
{
return d->progressCallback(p, iteration, expected);
}
}
return 0;
}
// --------------------------------------------------------------------------------------------------
KDcraw::Private::Private(KDcraw* const p)
{
m_progress = 0.0;
m_parent = p;
}
KDcraw::Private::~Private()
{
}
void KDcraw::Private::createPPMHeader(QByteArray& imgData, libraw_processed_image_t* const img)
{
QString header = QString("P%1\n%2 %3\n%4\n").arg(img->colors == 3 ? "6" : "5")
.arg(img->width)
.arg(img->height)
.arg((1 << img->bits)-1);
imgData.append(header.toAscii());
imgData.append(QByteArray((const char*)img->data, (int)img->data_size));
}
int KDcraw::Private::progressCallback(enum LibRaw_progress p, int iteration, int expected)
{
kDebug() << "LibRaw progress: " << libraw_strprogress(p) << " pass "
<< iteration << " of " << expected;
// post a little change in progress indicator to show raw processor activity.
setProgress(progressValue()+0.01);
// Clean processing termination by user...
if (m_parent->checkToCancelWaitingData())
{
kDebug() << "LibRaw process terminaison invoked...";
m_parent->m_cancel = true;
m_progress = 0.0;
return 1;
}
// Return 0 to continue processing...
return 0;
}
void KDcraw::Private::setProgress(double value)
{
m_progress = value;
m_parent->setWaitingDataProgress(m_progress);
}
double KDcraw::Private::progressValue() const
{
return m_progress;
}
void KDcraw::Private::fillIndentifyInfo(LibRaw* const raw, DcrawInfoContainer& identify)
{
identify.dateTime.setTime_t(raw->imgdata.other.timestamp);
identify.make = QString(raw->imgdata.idata.make);
identify.model = QString(raw->imgdata.idata.model);
identify.owner = QString(raw->imgdata.other.artist);
identify.DNGVersion = QString::number(raw->imgdata.idata.dng_version);
identify.sensitivity = raw->imgdata.other.iso_speed;
identify.exposureTime = raw->imgdata.other.shutter;
identify.aperture = raw->imgdata.other.aperture;
identify.focalLength = raw->imgdata.other.focal_len;
identify.imageSize = QSize(raw->imgdata.sizes.width, raw->imgdata.sizes.height);
identify.fullSize = QSize(raw->imgdata.sizes.raw_width, raw->imgdata.sizes.raw_height);
identify.outputSize = QSize(raw->imgdata.sizes.iwidth, raw->imgdata.sizes.iheight);
identify.thumbSize = QSize(raw->imgdata.thumbnail.twidth, raw->imgdata.thumbnail.theight);
identify.topMargin = raw->imgdata.sizes.top_margin;
identify.leftMargin = raw->imgdata.sizes.left_margin;
identify.hasIccProfile = raw->imgdata.color.profile ? true : false;
identify.isDecodable = true;
identify.pixelAspectRatio = raw->imgdata.sizes.pixel_aspect;
identify.rawColors = raw->imgdata.idata.colors;
identify.rawImages = raw->imgdata.idata.raw_count;
identify.blackPoint = raw->imgdata.color.black;
for (int ch = 0; ch < 4; ch++)
{
identify.blackPointCh[ch] = raw->imgdata.color.cblack[ch];
}
identify.whitePoint = raw->imgdata.color.maximum;
identify.orientation = (DcrawInfoContainer::ImageOrientation)raw->imgdata.sizes.flip;
memcpy(&identify.cameraColorMatrix1, &raw->imgdata.color.cmatrix, sizeof(raw->imgdata.color.cmatrix));
memcpy(&identify.cameraColorMatrix2, &raw->imgdata.color.rgb_cam, sizeof(raw->imgdata.color.rgb_cam));
memcpy(&identify.cameraXYZMatrix, &raw->imgdata.color.cam_xyz, sizeof(raw->imgdata.color.cam_xyz));
if (raw->imgdata.idata.filters)
{
if (!raw->imgdata.idata.cdesc[3])
{
raw->imgdata.idata.cdesc[3] = 'G';
}
for (int i=0; i < 16; i++)
{
identify.filterPattern.append(raw->imgdata.idata.cdesc[raw->COLOR(i >> 1,i & 1)]);
}
identify.colorKeys = raw->imgdata.idata.cdesc;
}
for(int c = 0 ; c < raw->imgdata.idata.colors ; c++)
{
identify.daylightMult[c] = raw->imgdata.color.pre_mul[c];
}
if (raw->imgdata.color.cam_mul[0] > 0)
{
for(int c = 0 ; c < 4 ; c++)
{
identify.cameraMult[c] = raw->imgdata.color.cam_mul[c];
}
}
}
bool KDcraw::Private::loadFromLibraw(const QString& filePath, QByteArray& imageData,
int& width, int& height, int& rgbmax)
{
m_parent->m_cancel = false;
LibRaw raw;
// Set progress call back function.
raw.set_progress_handler(callbackForLibRaw, this);
QByteArray deadpixelPath = QFile::encodeName(m_parent->m_rawDecodingSettings.deadPixelMap);
QByteArray cameraProfile = QFile::encodeName(m_parent->m_rawDecodingSettings.inputProfile);
QByteArray outputProfile = QFile::encodeName(m_parent->m_rawDecodingSettings.outputProfile);
if (!m_parent->m_rawDecodingSettings.autoBrightness)
{
// Use a fixed white level, ignoring the image histogram.
raw.imgdata.params.no_auto_bright = 1;
}
if (m_parent->m_rawDecodingSettings.sixteenBitsImage)
{
// (-4) 16bit ppm output
raw.imgdata.params.output_bps = 16;
}
if (m_parent->m_rawDecodingSettings.halfSizeColorImage)
{
// (-h) Half-size color image (3x faster than -q).
raw.imgdata.params.half_size = 1;
}
if (m_parent->m_rawDecodingSettings.RGBInterpolate4Colors)
{
// (-f) Interpolate RGB as four colors.
raw.imgdata.params.four_color_rgb = 1;
}
if (m_parent->m_rawDecodingSettings.DontStretchPixels)
{
// (-j) Do not stretch the image to its correct aspect ratio.
raw.imgdata.params.use_fuji_rotate = 1;
}
// (-H) Unclip highlight color.
raw.imgdata.params.highlight = m_parent->m_rawDecodingSettings.unclipColors;
if (m_parent->m_rawDecodingSettings.brightness != 1.0)
{
// (-b) Set Brightness value.
raw.imgdata.params.bright = m_parent->m_rawDecodingSettings.brightness;
}
if (m_parent->m_rawDecodingSettings.enableBlackPoint)
{
// (-k) Set Black Point value.
raw.imgdata.params.user_black = m_parent->m_rawDecodingSettings.blackPoint;
}
if (m_parent->m_rawDecodingSettings.enableWhitePoint)
{
// (-S) Set White Point value (saturation).
raw.imgdata.params.user_sat = m_parent->m_rawDecodingSettings.whitePoint;
}
if (m_parent->m_rawDecodingSettings.medianFilterPasses > 0)
{
// (-m) After interpolation, clean up color artifacts by repeatedly applying a 3x3 median filter to the R-G and B-G channels.
raw.imgdata.params.med_passes = m_parent->m_rawDecodingSettings.medianFilterPasses;
}
if (!m_parent->m_rawDecodingSettings.deadPixelMap.isEmpty())
{
// (-P) Read the dead pixel list from this file.
raw.imgdata.params.bad_pixels = deadpixelPath.data();
}
switch (m_parent->m_rawDecodingSettings.whiteBalance)
{
case RawDecodingSettings::NONE:
{
break;
}
case RawDecodingSettings::CAMERA:
{
// (-w) Use camera white balance, if possible.
raw.imgdata.params.use_camera_wb = 1;
break;
}
case RawDecodingSettings::AUTO:
{
// (-a) Use automatic white balance.
raw.imgdata.params.use_auto_wb = 1;
break;
}
case RawDecodingSettings::CUSTOM:
{
/* Convert between Temperature and RGB.
*/
double T;
double RGB[3];
double xD, yD, X, Y, Z;
DcrawInfoContainer identify;
T = m_parent->m_rawDecodingSettings.customWhiteBalance;
/* Here starts the code picked and adapted from ufraw (0.12.1)
to convert Temperature + green multiplier to RGB multipliers
*/
/* Convert between Temperature and RGB.
* Base on information from http://www.brucelindbloom.com/
* The fit for D-illuminant between 4000K and 12000K are from CIE
* The generalization to 2000K < T < 4000K and the blackbody fits
* are my own and should be taken with a grain of salt.
*/
const double XYZ_to_RGB[3][3] = {
{ 3.24071, -0.969258, 0.0556352 },
{-1.53726, 1.87599, -0.203996 },
{-0.498571, 0.0415557, 1.05707 }
};
// Fit for CIE Daylight illuminant
if (T <= 4000)
{
xD = 0.27475e9/(T*T*T) - 0.98598e6/(T*T) + 1.17444e3/T + 0.145986;
}
else if (T <= 7000)
{
xD = -4.6070e9/(T*T*T) + 2.9678e6/(T*T) + 0.09911e3/T + 0.244063;
}
else
{
xD = -2.0064e9/(T*T*T) + 1.9018e6/(T*T) + 0.24748e3/T + 0.237040;
}
yD = -3*xD*xD + 2.87*xD - 0.275;
X = xD/yD;
Y = 1;
Z = (1-xD-yD)/yD;
RGB[0] = X*XYZ_to_RGB[0][0] + Y*XYZ_to_RGB[1][0] + Z*XYZ_to_RGB[2][0];
RGB[1] = X*XYZ_to_RGB[0][1] + Y*XYZ_to_RGB[1][1] + Z*XYZ_to_RGB[2][1];
RGB[2] = X*XYZ_to_RGB[0][2] + Y*XYZ_to_RGB[1][2] + Z*XYZ_to_RGB[2][2];
/* End of the code picked to ufraw
*/
RGB[1] = RGB[1] / m_parent->m_rawDecodingSettings.customWhiteBalanceGreen;
/* By default, decraw override his default D65 WB
We need to keep it as a basis : if not, colors with some
DSLR will have a high dominant of color that will lead to
a completely wrong WB
*/
if (rawFileIdentify(identify, filePath))
{
RGB[0] = identify.daylightMult[0] / RGB[0];
RGB[1] = identify.daylightMult[1] / RGB[1];
RGB[2] = identify.daylightMult[2] / RGB[2];
}
else
{
RGB[0] = 1.0 / RGB[0];
RGB[1] = 1.0 / RGB[1];
RGB[2] = 1.0 / RGB[2];
kDebug() << "Warning: cannot get daylight multipliers";
}
// (-r) set Raw Color Balance Multipliers.
raw.imgdata.params.user_mul[0] = RGB[0];
raw.imgdata.params.user_mul[1] = RGB[1];
raw.imgdata.params.user_mul[2] = RGB[2];
raw.imgdata.params.user_mul[3] = RGB[1];
break;
}
case RawDecodingSettings::AERA:
{
// (-A) Calculate the white balance by averaging a rectangular area from image.
raw.imgdata.params.greybox[0] = m_parent->m_rawDecodingSettings.whiteBalanceArea.left();
raw.imgdata.params.greybox[1] = m_parent->m_rawDecodingSettings.whiteBalanceArea.top();
raw.imgdata.params.greybox[2] = m_parent->m_rawDecodingSettings.whiteBalanceArea.width();
raw.imgdata.params.greybox[3] = m_parent->m_rawDecodingSettings.whiteBalanceArea.height();
break;
}
}
// (-q) Use an interpolation method.
raw.imgdata.params.user_qual = m_parent->m_rawDecodingSettings.RAWQuality;
switch (m_parent->m_rawDecodingSettings.NRType)
{
case RawDecodingSettings::WAVELETSNR:
{
// (-n) Use wavelets to erase noise while preserving real detail.
raw.imgdata.params.threshold = m_parent->m_rawDecodingSettings.NRThreshold;
break;
}
case RawDecodingSettings::FBDDNR:
{
// (100 - 1000) => (1 - 10) conversion
raw.imgdata.params.fbdd_noiserd = lround(m_parent->m_rawDecodingSettings.NRThreshold / 100.0);
break;
}
#if !LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 19)
case RawDecodingSettings::LINENR:
{
// (100 - 1000) => (0.001 - 0.02) conversion.
raw.imgdata.params.linenoise = m_parent->m_rawDecodingSettings.NRThreshold * 2.11E-5 + 0.00111111;
raw.imgdata.params.cfaline = true;
break;
}
case RawDecodingSettings::IMPULSENR:
{
// (100 - 1000) => (0.005 - 0.05) conversion.
raw.imgdata.params.lclean = m_parent->m_rawDecodingSettings.NRThreshold * 5E-5;
raw.imgdata.params.cclean = m_parent->m_rawDecodingSettings.NRChroThreshold * 5E-5;
raw.imgdata.params.cfa_clean = true;
break;
}
#endif
default: // No Noise Reduction
{
raw.imgdata.params.threshold = 0;
raw.imgdata.params.fbdd_noiserd = 0;
#if !LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 19)
raw.imgdata.params.linenoise = 0;
raw.imgdata.params.cfaline = false;
raw.imgdata.params.lclean = 0;
raw.imgdata.params.cclean = 0;
raw.imgdata.params.cfa_clean = false;
#endif
break;
}
}
#if !LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 19)
// Chromatic aberration correction.
raw.imgdata.params.ca_correc = m_parent->m_rawDecodingSettings.enableCACorrection;
raw.imgdata.params.cared = m_parent->m_rawDecodingSettings.caMultiplier[0];
raw.imgdata.params.cablue = m_parent->m_rawDecodingSettings.caMultiplier[1];
#endif
// Exposure Correction before interpolation.
raw.imgdata.params.exp_correc = m_parent->m_rawDecodingSettings.expoCorrection;
raw.imgdata.params.exp_shift = m_parent->m_rawDecodingSettings.expoCorrectionShift;
raw.imgdata.params.exp_preser = m_parent->m_rawDecodingSettings.expoCorrectionHighlight;
switch (m_parent->m_rawDecodingSettings.inputColorSpace)
{
case RawDecodingSettings::EMBEDDED:
{
// (-p embed) Use input profile from RAW file to define the camera's raw colorspace.
raw.imgdata.params.camera_profile = (char*)"embed";
break;
}
case RawDecodingSettings::CUSTOMINPUTCS:
{
if (!m_parent->m_rawDecodingSettings.inputProfile.isEmpty())
{
// (-p) Use input profile file to define the camera's raw colorspace.
raw.imgdata.params.camera_profile = cameraProfile.data();
}
break;
}
default:
{
// No input profile
break;
}
}
switch (m_parent->m_rawDecodingSettings.outputColorSpace)
{
case RawDecodingSettings::CUSTOMOUTPUTCS:
{
if (!m_parent->m_rawDecodingSettings.outputProfile.isEmpty())
{
// (-o) Use ICC profile file to define the output colorspace.
raw.imgdata.params.output_profile = outputProfile.data();
}
break;
}
default:
{
// (-o) Define the output colorspace.
raw.imgdata.params.output_color = m_parent->m_rawDecodingSettings.outputColorSpace;
break;
}
}
//-- Extended demosaicing settings ----------------------------------------------------------
raw.imgdata.params.dcb_iterations = m_parent->m_rawDecodingSettings.dcbIterations;
raw.imgdata.params.dcb_enhance_fl = m_parent->m_rawDecodingSettings.dcbEnhanceFl;
#if !LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 19)
raw.imgdata.params.eeci_refine = m_parent->m_rawDecodingSettings.eeciRefine;
raw.imgdata.params.es_med_passes = m_parent->m_rawDecodingSettings.esMedPasses;
#endif
//-------------------------------------------------------------------------------------------
setProgress(0.1);
kDebug() << filePath;
kDebug() << m_parent->m_rawDecodingSettings;
int ret = raw.open_file(QFile::encodeName(filePath));
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run open_file: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_parent->m_cancel)
{
raw.recycle();
return false;
}
setProgress(0.2);
ret = raw.unpack();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run unpack: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_parent->m_cancel)
{
raw.recycle();
return false;
}
setProgress(0.25);
if (m_parent->m_rawDecodingSettings.fixColorsHighlights)
{
kDebug() << "Applying LibRaw highlights adjustments";
// 1.0 is fallback to default value
raw.imgdata.params.adjust_maximum_thr = 1.0;
}
else
{
kDebug() << "Disabling LibRaw highlights adjustments";
// 0.0 disables this feature
raw.imgdata.params.adjust_maximum_thr = 0.0;
}
ret = raw.dcraw_process();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run dcraw_process: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_parent->m_cancel)
{
raw.recycle();
return false;
}
setProgress(0.3);
libraw_processed_image_t* img = raw.dcraw_make_mem_image(&ret);
if(!img)
{
kDebug() << "LibRaw: failed to run dcraw_make_mem_image: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if (m_parent->m_cancel)
{
// Clear memory allocation. Introduced with LibRaw 0.11.0
raw.dcraw_clear_mem(img);
raw.recycle();
return false;
}
setProgress(0.35);
width = img->width;
height = img->height;
rgbmax = (1 << img->bits)-1;
if (img->colors == 3)
{
imageData = QByteArray((const char*)img->data, (int)img->data_size);
}
else
{
// img->colors == 1 (Grayscale) : convert to RGB
imageData = QByteArray();
for (int i = 0 ; i < (int)img->data_size ; ++i)
{
for (int j = 0 ; j < 3 ; ++j)
{
imageData.append(img->data[i]);
}
}
}
// Clear memory allocation. Introduced with LibRaw 0.11.0
raw.dcraw_clear_mem(img);
raw.recycle();
if (m_parent->m_cancel)
{
return false;
}
setProgress(0.4);
kDebug() << "LibRaw: data info: width=" << width
<< " height=" << height
<< " rgbmax=" << rgbmax;
return true;
}
bool KDcraw::Private::loadEmbeddedPreview(QByteArray& imgData, LibRaw& raw)
{
int ret = raw.unpack_thumb();
if (ret != LIBRAW_SUCCESS)
{
raw.recycle();
kDebug() << "LibRaw: failed to run unpack_thumb: " << libraw_strerror(ret);
raw.recycle();
return false;
}
libraw_processed_image_t* const thumb = raw.dcraw_make_mem_thumb(&ret);
if(!thumb)
{
kDebug() << "LibRaw: failed to run dcraw_make_mem_thumb: " << libraw_strerror(ret);
raw.recycle();
return false;
}
if(thumb->type == LIBRAW_IMAGE_BITMAP)
{
createPPMHeader(imgData, thumb);
}
else
{
imgData = QByteArray((const char*)thumb->data, (int)thumb->data_size);
}
// Clear memory allocation. Introduced with LibRaw 0.11.0
raw.dcraw_clear_mem(thumb);
raw.recycle();
if ( imgData.isEmpty() )
{
kDebug() << "Failed to load JPEG thumb from LibRaw!";
return false;
}
return true;
}
bool KDcraw::Private::loadHalfPreview(QImage& image, LibRaw& raw)
{
raw.imgdata.params.use_auto_wb = 1; // Use automatic white balance.
raw.imgdata.params.use_camera_wb = 1; // Use camera white balance, if possible.
raw.imgdata.params.half_size = 1; // Half-size color image (3x faster than -q).
QByteArray imgData;
int ret = raw.unpack();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run unpack: " << libraw_strerror(ret);
raw.recycle();
return false;
}
ret = raw.dcraw_process();
if (ret != LIBRAW_SUCCESS)
{
kDebug() << "LibRaw: failed to run dcraw_process: " << libraw_strerror(ret);
raw.recycle();
return false;
}
libraw_processed_image_t* halfImg = raw.dcraw_make_mem_image(&ret);
if(!halfImg)
{
kDebug() << "LibRaw: failed to run dcraw_make_mem_image: " << libraw_strerror(ret);
raw.recycle();
return false;
}
Private::createPPMHeader(imgData, halfImg);
// Clear memory allocation. Introduced with LibRaw 0.11.0
raw.dcraw_clear_mem(halfImg);
raw.recycle();
if ( imgData.isEmpty() )
{
kDebug() << "Failed to load half preview from LibRaw!";
return false;
}
if (!image.loadFromData(imgData))
{
kDebug() << "Failed to load PPM data from LibRaw!";
return false;
}
return true;
}
} // namespace KDcrawIface

View file

@ -1,94 +0,0 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-10-09
* @brief internal private container for KDcraw
*
* @author Copyright (C) 2008-2013 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 KDCRAWPRIVATE_H
#define KDCRAWPRIVATE_H
// Qt includes
#include <QByteArray>
// KDE includes
#include <kdebug.h>
// LibRaw includes
#include <libraw.h>
// Local includes
#include "dcrawinfocontainer.h"
namespace KDcrawIface
{
class KDcraw;
extern "C"
{
int callbackForLibRaw(void* data, enum LibRaw_progress p, int iteration, int expected);
}
class KDcraw::Private
{
public:
Private(KDcraw* const p);
~Private();
public:
int progressCallback(enum LibRaw_progress p, int iteration, int expected);
void setProgress(double value);
double progressValue() const;
bool loadFromLibraw(const QString& filePath, QByteArray& imageData,
int& width, int& height, int& rgbmax);
public:
static void createPPMHeader(QByteArray& imgData, libraw_processed_image_t* const img);
static void fillIndentifyInfo(LibRaw* const raw, DcrawInfoContainer& identify);
static bool loadEmbeddedPreview(QByteArray&, LibRaw&);
static bool loadHalfPreview(QImage&, LibRaw&);
private:
double m_progress;
KDcraw* m_parent;
friend class KDcraw;
};
} // namespace KDcrawIface
#endif /* KDCRAWPRIVATE_H */

View file

@ -1,396 +0,0 @@
/** ===========================================================
* @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 Raw decoding settings
*
* @author Copyright (C) 2006-2013 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.
*
* ============================================================ */
#define OPTIONFIXCOLORSHIGHLIGHTSENTRY "FixColorsHighlights"
#define OPTIONDECODESIXTEENBITENTRY "SixteenBitsImage"
#define OPTIONWHITEBALANCEENTRY "White Balance"
#define OPTIONCUSTOMWHITEBALANCEENTRY "Custom White Balance"
#define OPTIONCUSTOMWBGREENENTRY "Custom White Balance Green"
#define OPTIONFOURCOLORRGBENTRY "Four Color RGB"
#define OPTIONUNCLIPCOLORSENTRY "Unclip Color"
// Wrong spelling, but do not fix it since it is a configuration key
// krazy:cond=spelling
#define OPTIONDONTSTRETCHPIXELSENTRY "Dont Stretch Pixels"
// krazy:endcond=spelling
#define OPTIONMEDIANFILTERPASSESENTRY "Median Filter Passes"
#define OPTIONNOISEREDUCTIONTYPEENTRY "Noise Reduction Type"
#define OPTIONNOISEREDUCTIONTHRESHOLDENTRY "Noise Reduction Threshold"
#define OPTIONUSECACORRECTIONENTRY "EnableCACorrection"
#define OPTIONCAREDMULTIPLIERENTRY "caRedMultiplier"
#define OPTIONCABLUEMULTIPLIERENTRY "caBlueMultiplier"
#define OPTIONAUTOBRIGHTNESSENTRY "AutoBrightness"
#define OPTIONDECODINGQUALITYENTRY "Decoding Quality"
#define OPTIONINPUTCOLORSPACEENTRY "Input Color Space"
#define OPTIONOUTPUTCOLORSPACEENTRY "Output Color Space"
#define OPTIONINPUTCOLORPROFILEENTRY "Input Color Profile"
#define OPTIONOUTPUTCOLORPROFILEENTRY "Output Color Profile"
#define OPTIONBRIGHTNESSMULTIPLIERENTRY "Brightness Multiplier"
#define OPTIONUSEBLACKPOINTENTRY "Use Black Point"
#define OPTIONBLACKPOINTENTRY "Black Point"
#define OPTIONUSEWHITEPOINTENTRY "Use White Point"
#define OPTIONWHITEPOINTENTRY "White Point"
//-- Extended demosaicing settings ----------------------------------------------------------
#define OPTIONDCBITERATIONSENTRY "Dcb Iterations"
#define OPTIONDCBENHANCEFLENTRY "Dcb Enhance Filter"
#define OPTIONEECIREFINEENTRY "Eeci Refine"
#define OPTIONESMEDPASSESENTRY "Es Median Filter Passes"
#define OPTIONNRCHROMINANCETHRESHOLDENTRY "Noise Reduction Chrominance Threshold"
#define OPTIONEXPOCORRECTIONENTRY "Expo Correction"
#define OPTIONEXPOCORRECTIONSHIFTENTRY "Expo Correction Shift"
#define OPTIONEXPOCORRECTIONHIGHLIGHTENTRY "Expo Correction Highlight"
#include "rawdecodingsettings.h"
namespace KDcrawIface
{
RawDecodingSettings::RawDecodingSettings()
{
fixColorsHighlights = false;
autoBrightness = true;
sixteenBitsImage = false;
brightness = 1.0;
RAWQuality = BILINEAR;
inputColorSpace = NOINPUTCS;
outputColorSpace = SRGB;
RGBInterpolate4Colors = false;
DontStretchPixels = false;
unclipColors = 0;
whiteBalance = CAMERA;
customWhiteBalance = 6500;
customWhiteBalanceGreen = 1.0;
medianFilterPasses = 0;
halfSizeColorImage = false;
enableBlackPoint = false;
blackPoint = 0;
enableWhitePoint = false;
whitePoint = 0;
NRType = NONR;
NRThreshold = 0;
enableCACorrection = false;
caMultiplier[0] = 0.0;
caMultiplier[1] = 0.0;
inputProfile = QString();
outputProfile = QString();
deadPixelMap = QString();
whiteBalanceArea = QRect();
//-- Extended demosaicing settings ----------------------------------------------------------
dcbIterations = -1;
dcbEnhanceFl = false;
eeciRefine = false;
esMedPasses = 0;
NRChroThreshold = 0;
expoCorrection = false;
expoCorrectionShift = 1.0;
expoCorrectionHighlight = 0.0;
}
RawDecodingSettings::~RawDecodingSettings()
{
}
RawDecodingSettings& RawDecodingSettings::operator=(const RawDecodingSettings& o)
{
fixColorsHighlights = o.fixColorsHighlights;
autoBrightness = o.autoBrightness;
sixteenBitsImage = o.sixteenBitsImage;
brightness = o.brightness;
RAWQuality = o.RAWQuality;
inputColorSpace = o.inputColorSpace;
outputColorSpace = o.outputColorSpace;
RGBInterpolate4Colors = o.RGBInterpolate4Colors;
DontStretchPixels = o.DontStretchPixels;
unclipColors = o.unclipColors;
whiteBalance = o.whiteBalance;
customWhiteBalance = o.customWhiteBalance;
customWhiteBalanceGreen = o.customWhiteBalanceGreen;
halfSizeColorImage = o.halfSizeColorImage;
enableBlackPoint = o.enableBlackPoint;
blackPoint = o.blackPoint;
enableWhitePoint = o.enableWhitePoint;
whitePoint = o.whitePoint;
NRType = o.NRType;
NRThreshold = o.NRThreshold;
enableCACorrection = o.enableCACorrection;
caMultiplier[0] = o.caMultiplier[0];
caMultiplier[1] = o.caMultiplier[1];
medianFilterPasses = o.medianFilterPasses;
inputProfile = o.inputProfile;
outputProfile = o.outputProfile;
deadPixelMap = o.deadPixelMap;
whiteBalanceArea = o.whiteBalanceArea;
//-- Extended demosaicing settings ----------------------------------------------------------
dcbIterations = o.dcbIterations;
dcbEnhanceFl = o.dcbEnhanceFl;
eeciRefine = o.eeciRefine;
esMedPasses = o.esMedPasses;
NRChroThreshold = o.NRChroThreshold;
expoCorrection = o.expoCorrection;
expoCorrectionShift = o.expoCorrectionShift;
expoCorrectionHighlight = o.expoCorrectionHighlight;
return *this;
}
bool RawDecodingSettings::operator==(const RawDecodingSettings& o) const
{
return fixColorsHighlights == o.fixColorsHighlights
&& autoBrightness == o.autoBrightness
&& sixteenBitsImage == o.sixteenBitsImage
&& brightness == o.brightness
&& RAWQuality == o.RAWQuality
&& inputColorSpace == o.inputColorSpace
&& outputColorSpace == o.outputColorSpace
&& RGBInterpolate4Colors == o.RGBInterpolate4Colors
&& DontStretchPixels == o.DontStretchPixels
&& unclipColors == o.unclipColors
&& whiteBalance == o.whiteBalance
&& customWhiteBalance == o.customWhiteBalance
&& customWhiteBalanceGreen == o.customWhiteBalanceGreen
&& halfSizeColorImage == o.halfSizeColorImage
&& enableBlackPoint == o.enableBlackPoint
&& blackPoint == o.blackPoint
&& enableWhitePoint == o.enableWhitePoint
&& whitePoint == o.whitePoint
&& NRType == o.NRType
&& NRThreshold == o.NRThreshold
&& enableCACorrection == o.enableCACorrection
&& caMultiplier[0] == o.caMultiplier[0]
&& caMultiplier[1] == o.caMultiplier[1]
&& medianFilterPasses == o.medianFilterPasses
&& inputProfile == o.inputProfile
&& outputProfile == o.outputProfile
&& deadPixelMap == o.deadPixelMap
&& whiteBalanceArea == o.whiteBalanceArea
//-- Extended demosaicing settings ----------------------------------------------------------
&& dcbIterations == o.dcbIterations
&& dcbEnhanceFl == o.dcbEnhanceFl
&& eeciRefine == o.eeciRefine
&& esMedPasses == o.esMedPasses
&& NRChroThreshold == o.NRChroThreshold
&& expoCorrection == o.expoCorrection
&& expoCorrectionShift == o.expoCorrectionShift
&& expoCorrectionHighlight == o.expoCorrectionHighlight
;
}
void RawDecodingSettings::optimizeTimeLoading()
{
fixColorsHighlights = false;
autoBrightness = true;
sixteenBitsImage = true;
brightness = 1.0;
RAWQuality = BILINEAR;
inputColorSpace = NOINPUTCS;
outputColorSpace = SRGB;
RGBInterpolate4Colors = false;
DontStretchPixels = false;
unclipColors = 0;
whiteBalance = CAMERA;
customWhiteBalance = 6500;
customWhiteBalanceGreen = 1.0;
halfSizeColorImage = true;
medianFilterPasses = 0;
enableBlackPoint = false;
blackPoint = 0;
enableWhitePoint = false;
whitePoint = 0;
NRType = NONR;
NRThreshold = 0;
enableCACorrection = false;
caMultiplier[0] = 0.0;
caMultiplier[1] = 0.0;
inputProfile = QString();
outputProfile = QString();
deadPixelMap = QString();
whiteBalanceArea = QRect();
//-- Extended demosaicing settings ----------------------------------------------------------
dcbIterations = -1;
dcbEnhanceFl = false;
eeciRefine = false;
esMedPasses = 0;
NRChroThreshold = 0;
expoCorrection = false;
expoCorrectionShift = 1.0;
expoCorrectionHighlight = 0.0;
}
void RawDecodingSettings::readSettings(KConfigGroup& group)
{
RawDecodingSettings defaultPrm;
fixColorsHighlights = group.readEntry(OPTIONFIXCOLORSHIGHLIGHTSENTRY, defaultPrm.fixColorsHighlights);
sixteenBitsImage = group.readEntry(OPTIONDECODESIXTEENBITENTRY, defaultPrm.sixteenBitsImage);
whiteBalance = (WhiteBalance)
group.readEntry(OPTIONWHITEBALANCEENTRY, (int)defaultPrm.whiteBalance);
customWhiteBalance = group.readEntry(OPTIONCUSTOMWHITEBALANCEENTRY, defaultPrm.customWhiteBalance);
customWhiteBalanceGreen = group.readEntry(OPTIONCUSTOMWBGREENENTRY, defaultPrm.customWhiteBalanceGreen);
RGBInterpolate4Colors = group.readEntry(OPTIONFOURCOLORRGBENTRY, defaultPrm.RGBInterpolate4Colors);
unclipColors = group.readEntry(OPTIONUNCLIPCOLORSENTRY, defaultPrm.unclipColors);
DontStretchPixels = group.readEntry(OPTIONDONTSTRETCHPIXELSENTRY, defaultPrm.DontStretchPixels);
NRType = (NoiseReduction)
group.readEntry(OPTIONNOISEREDUCTIONTYPEENTRY, (int)defaultPrm.NRType);
brightness = group.readEntry(OPTIONBRIGHTNESSMULTIPLIERENTRY, defaultPrm.brightness);
enableBlackPoint = group.readEntry(OPTIONUSEBLACKPOINTENTRY, defaultPrm.enableBlackPoint);
blackPoint = group.readEntry(OPTIONBLACKPOINTENTRY, defaultPrm.blackPoint);
enableWhitePoint = group.readEntry(OPTIONUSEWHITEPOINTENTRY, defaultPrm.enableWhitePoint);
whitePoint = group.readEntry(OPTIONWHITEPOINTENTRY, defaultPrm.whitePoint);
medianFilterPasses = group.readEntry(OPTIONMEDIANFILTERPASSESENTRY, defaultPrm.medianFilterPasses);
NRThreshold = group.readEntry(OPTIONNOISEREDUCTIONTHRESHOLDENTRY, defaultPrm.NRThreshold);
enableCACorrection = group.readEntry(OPTIONUSECACORRECTIONENTRY, defaultPrm.enableCACorrection);
caMultiplier[0] = group.readEntry(OPTIONCAREDMULTIPLIERENTRY, defaultPrm.caMultiplier[0]);
caMultiplier[1] = group.readEntry(OPTIONCABLUEMULTIPLIERENTRY, defaultPrm.caMultiplier[1]);
RAWQuality = (DecodingQuality)
group.readEntry(OPTIONDECODINGQUALITYENTRY, (int)defaultPrm.RAWQuality);
outputColorSpace = (OutputColorSpace)
group.readEntry(OPTIONOUTPUTCOLORSPACEENTRY, (int)defaultPrm.outputColorSpace);
autoBrightness = group.readEntry(OPTIONAUTOBRIGHTNESSENTRY, defaultPrm.autoBrightness);
//-- Extended demosaicing settings ----------------------------------------------------------
dcbIterations = group.readEntry(OPTIONDCBITERATIONSENTRY, defaultPrm.dcbIterations);
dcbEnhanceFl = group.readEntry(OPTIONDCBENHANCEFLENTRY, defaultPrm.dcbEnhanceFl);
eeciRefine = group.readEntry(OPTIONEECIREFINEENTRY, defaultPrm.eeciRefine);
esMedPasses = group.readEntry(OPTIONESMEDPASSESENTRY, defaultPrm.esMedPasses);
NRChroThreshold = group.readEntry(OPTIONNRCHROMINANCETHRESHOLDENTRY, defaultPrm.NRChroThreshold);
expoCorrection = group.readEntry(OPTIONEXPOCORRECTIONENTRY, defaultPrm.expoCorrection);
expoCorrectionShift = group.readEntry(OPTIONEXPOCORRECTIONSHIFTENTRY, defaultPrm.expoCorrectionShift);
expoCorrectionHighlight = group.readEntry(OPTIONEXPOCORRECTIONHIGHLIGHTENTRY, defaultPrm.expoCorrectionHighlight);
}
void RawDecodingSettings::writeSettings(KConfigGroup& group)
{
group.writeEntry(OPTIONFIXCOLORSHIGHLIGHTSENTRY, fixColorsHighlights);
group.writeEntry(OPTIONDECODESIXTEENBITENTRY, sixteenBitsImage);
group.writeEntry(OPTIONWHITEBALANCEENTRY, (int)whiteBalance);
group.writeEntry(OPTIONCUSTOMWHITEBALANCEENTRY, customWhiteBalance);
group.writeEntry(OPTIONCUSTOMWBGREENENTRY, customWhiteBalanceGreen);
group.writeEntry(OPTIONFOURCOLORRGBENTRY, RGBInterpolate4Colors);
group.writeEntry(OPTIONUNCLIPCOLORSENTRY, unclipColors);
group.writeEntry(OPTIONDONTSTRETCHPIXELSENTRY, DontStretchPixels);
group.writeEntry(OPTIONNOISEREDUCTIONTYPEENTRY, (int)NRType);
group.writeEntry(OPTIONBRIGHTNESSMULTIPLIERENTRY, brightness);
group.writeEntry(OPTIONUSEBLACKPOINTENTRY, enableBlackPoint);
group.writeEntry(OPTIONBLACKPOINTENTRY, blackPoint);
group.writeEntry(OPTIONUSEWHITEPOINTENTRY, enableWhitePoint);
group.writeEntry(OPTIONWHITEPOINTENTRY, whitePoint);
group.writeEntry(OPTIONMEDIANFILTERPASSESENTRY, medianFilterPasses);
group.writeEntry(OPTIONNOISEREDUCTIONTHRESHOLDENTRY, NRThreshold);
group.writeEntry(OPTIONUSECACORRECTIONENTRY, enableCACorrection);
group.writeEntry(OPTIONCAREDMULTIPLIERENTRY, caMultiplier[0]);
group.writeEntry(OPTIONCABLUEMULTIPLIERENTRY, caMultiplier[1]);
group.writeEntry(OPTIONDECODINGQUALITYENTRY, (int)RAWQuality);
group.writeEntry(OPTIONOUTPUTCOLORSPACEENTRY, (int)outputColorSpace);
group.writeEntry(OPTIONAUTOBRIGHTNESSENTRY, autoBrightness);
//-- Extended demosaicing settings ----------------------------------------------------------
group.writeEntry(OPTIONDCBITERATIONSENTRY, dcbIterations);
group.writeEntry(OPTIONDCBENHANCEFLENTRY, dcbEnhanceFl);
group.writeEntry(OPTIONEECIREFINEENTRY, eeciRefine);
group.writeEntry(OPTIONESMEDPASSESENTRY, esMedPasses);
group.writeEntry(OPTIONNRCHROMINANCETHRESHOLDENTRY, NRChroThreshold);
group.writeEntry(OPTIONEXPOCORRECTIONENTRY, expoCorrection);
group.writeEntry(OPTIONEXPOCORRECTIONSHIFTENTRY, expoCorrectionShift);
group.writeEntry(OPTIONEXPOCORRECTIONHIGHLIGHTENTRY, expoCorrectionHighlight);
}
QDebug operator<<(QDebug dbg, const RawDecodingSettings& s)
{
dbg.nospace() << endl;
dbg.nospace() << "-- RAW DECODING SETTINGS --------------------------------" << endl;
dbg.nospace() << "-- autoBrightness: " << s.autoBrightness << endl;
dbg.nospace() << "-- sixteenBitsImage: " << s.sixteenBitsImage << endl;
dbg.nospace() << "-- brightness: " << s.brightness << endl;
dbg.nospace() << "-- RAWQuality: " << s.RAWQuality << endl;
dbg.nospace() << "-- inputColorSpace: " << s.inputColorSpace << endl;
dbg.nospace() << "-- outputColorSpace: " << s.outputColorSpace << endl;
dbg.nospace() << "-- RGBInterpolate4Colors: " << s.RGBInterpolate4Colors << endl;
dbg.nospace() << "-- DontStretchPixels: " << s.DontStretchPixels << endl;
dbg.nospace() << "-- unclipColors: " << s.unclipColors << endl;
dbg.nospace() << "-- whiteBalance: " << s.whiteBalance << endl;
dbg.nospace() << "-- customWhiteBalance: " << s.customWhiteBalance << endl;
dbg.nospace() << "-- customWhiteBalanceGreen: " << s.customWhiteBalanceGreen << endl;
dbg.nospace() << "-- halfSizeColorImage: " << s.halfSizeColorImage << endl;
dbg.nospace() << "-- enableBlackPoint: " << s.enableBlackPoint << endl;
dbg.nospace() << "-- blackPoint: " << s.blackPoint << endl;
dbg.nospace() << "-- enableWhitePoint: " << s.enableWhitePoint << endl;
dbg.nospace() << "-- whitePoint: " << s.whitePoint << endl;
dbg.nospace() << "-- NoiseReductionType: " << s.NRType << endl;
dbg.nospace() << "-- NoiseReductionThreshold: " << s.NRThreshold << endl;
dbg.nospace() << "-- enableCACorrection: " << s.enableCACorrection << endl;
dbg.nospace() << "-- caMultiplier: " << s.caMultiplier[0]
<< ", " << s.caMultiplier[1] << endl;
dbg.nospace() << "-- medianFilterPasses: " << s.medianFilterPasses << endl;
dbg.nospace() << "-- inputProfile: " << s.inputProfile << endl;
dbg.nospace() << "-- outputProfile: " << s.outputProfile << endl;
dbg.nospace() << "-- deadPixelMap: " << s.deadPixelMap << endl;
dbg.nospace() << "-- whiteBalanceArea: " << s.whiteBalanceArea << endl;
//-- Extended demosaicing settings ----------------------------------------------------------
dbg.nospace() << "-- dcbIterations: " << s.dcbIterations << endl;
dbg.nospace() << "-- dcbEnhanceFl: " << s.dcbEnhanceFl << endl;
dbg.nospace() << "-- eeciRefine: " << s.eeciRefine << endl;
dbg.nospace() << "-- esMedPasses: " << s.esMedPasses << endl;
dbg.nospace() << "-- NRChrominanceThreshold: " << s.NRChroThreshold << endl;
dbg.nospace() << "-- expoCorrection: " << s.expoCorrection << endl;
dbg.nospace() << "-- expoCorrectionShift: " << s.expoCorrectionShift << endl;
dbg.nospace() << "-- expoCorrectionHighlight: " << s.expoCorrectionHighlight << endl;
dbg.nospace() << "---------------------------------------------------------" << endl;
return dbg.space();
}
} // namespace KDcrawIface

View file

@ -1,375 +0,0 @@
/** ===========================================================
* @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 Raw decoding settings
*
* @author Copyright (C) 2006-2013 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 RAW_DECODING_SETTINGS_H
#define RAW_DECODING_SETTINGS_H
// Qt includes
#include <QtCore/QRect>
#include <QtCore/QString>
#include <QtCore/QDebug>
// KDE includes
#include <kconfiggroup.h>
// Local includes
#include "kdcraw_export.h"
namespace KDcrawIface
{
class KDCRAW_EXPORT RawDecodingSettings
{
public:
/** RAW decoding Interpolation methods
*
* NOTE: from original dcraw demosaic
*
* Bilinear: use high-speed but low-quality bilinear
* interpolation (default - for slow computer). In this method,
* the red value of a non-red pixel is computed as the average of
* the adjacent red pixels, and similar for blue and green.
* VNG: use Variable Number of Gradients interpolation.
* This method computes gradients near the pixel of interest and uses
* the lower gradients (representing smoother and more similar parts
* of the image) to make an estimate.
* PPG: use Patterned Pixel Grouping interpolation.
* Pixel Grouping uses assumptions about natural scenery in making estimates.
* It has fewer color artifacts on natural images than the Variable Number of
* Gradients method.
* AHD: use Adaptive Homogeneity-Directed interpolation.
* This method selects the direction of interpolation so as to
* maximize a homogeneity metric, thus typically minimizing color artifacts.
*
* NOTE: from GPL2 demosaic pack.
*
* DCB: DCB interpolation (see http://www.linuxphoto.org/html/dcb.html for details)
* PL_AHD: modified AHD interpolation (see http://sites.google.com/site/demosaicalgorithms/modified-dcraw
* for details).
* AFD: demosaicing through 5 pass median filter from PerfectRaw project.
* VCD: VCD interpolation.
* VCD_AHD: mixed demosaicing between VCD and AHD.
* LMMSE: LMMSE interpolation from PerfectRaw.
*
* NOTE: from GPL3 demosaic pack.
*
* AMAZE: AMaZE interpolation and color aberration removal from RawTherapee project.
*/
enum DecodingQuality
{
// from original dcraw demosaic
BILINEAR = 0,
VNG = 1,
PPG = 2,
AHD = 3,
// Extended demosaicing method from GPL2 demosaic pack
DCB = 4,
PL_AHD = 5,
AFD = 6,
VCD = 7,
VCD_AHD = 8,
LMMSE = 9,
// Extended demosaicing methods from GPL3 demosaic pack
AMAZE = 10
};
/** White balances alternatives
* NONE: no white balance used : reverts to standard daylight D65 WB.
* CAMERA: Use the camera embedded WB if available. Reverts to NONE if not.
* AUTO: Averages an auto WB on the entire image.
* CUSTOM: Let use set it's own temperature and green factor (later converted to RGBG factors).
* AERA: Let use an aera from image to average white balance (see whiteBalanceArea for details).
*/
enum WhiteBalance
{
NONE = 0,
CAMERA = 1,
AUTO = 2,
CUSTOM = 3,
AERA = 4
};
/** Noise Reduction method to apply before demosaicing
* NONR: No noise reduction.
* WAVELETSNR: wavelets correction to erase noise while preserving real detail. It's applied after interpolation.
* FBDDNR: Fake Before Demosaicing Denoising noise reduction. It's applied before interpolation.
* LINENR: CFA Line Denoise. It's applied after interpolation.
* IMPULSENR: Impulse Denoise. It's applied after interpolation.
*/
enum NoiseReduction
{
NONR = 0,
WAVELETSNR,
FBDDNR,
LINENR,
IMPULSENR
};
/** Input color profile used to decoded image
* NOINPUTCS: No input color profile.
* EMBEDDED: Use the camera profile embedded in RAW file if exist.
* CUSTOMINPUTCS: Use a custom input color space profile.
*/
enum InputColorSpace
{
NOINPUTCS = 0,
EMBEDDED,
CUSTOMINPUTCS
};
/** Output RGB color space used to decoded image
* RAWCOLOR: No output color profile (Linear RAW).
* SRGB: Use standard sRGB color space.
* ADOBERGB: Use standard Adobe RGB color space.
* WIDEGAMMUT: Use standard RGB Wide Gamut color space.
* PROPHOTO: Use standard RGB Pro Photo color space.
* CUSTOMOUTPUTCS: Use a custom workspace color profile.
*/
enum OutputColorSpace
{
RAWCOLOR = 0,
SRGB,
ADOBERGB,
WIDEGAMMUT,
PROPHOTO,
CUSTOMOUTPUTCS
};
/** Standard constructor with default settings
*/
RawDecodingSettings();
/** Equivalent to the copy constructor
*/
RawDecodingSettings& operator=(const RawDecodingSettings& prm);
/** Compare for equality
*/
bool operator==(const RawDecodingSettings& o) const;
/** Standard destructor
*/
virtual ~RawDecodingSettings();
/** Method to use a settings to optimize time loading, for exemple to compute image histogram
*/
void optimizeTimeLoading();
/** Methods to read/write settings from/to a config file
*/
void readSettings(KConfigGroup& group);
void writeSettings(KConfigGroup& group);
public:
/** If true, images with overblown channels are processed much more accurate,
* without 'pink clouds' (and blue highlights under tungsteen lamps).
*/
bool fixColorsHighlights;
/** If false, use a fixed white level, ignoring the image histogram.
*/
bool autoBrightness;
/** Turn on RAW file decoding in 16 bits per color per pixel instead 8 bits.
*/
bool sixteenBitsImage;
/** Half-size color image decoding (twice as fast as "enableRAWQuality").
* Turn on this option to reduce time loading to render histogram for example,
* no to render an image to screen.
*/
bool halfSizeColorImage;
/** White balance type to use. See WhiteBalance values for detail
*/
WhiteBalance whiteBalance;
/** The temperature and the green multiplier of the custom white balance
*/
int customWhiteBalance;
double customWhiteBalanceGreen;
/** Turn on RAW file decoding using RGB interpolation as four colors.
*/
bool RGBInterpolate4Colors;
/** For cameras with non-square pixels, do not stretch the image to its
* correct aspect ratio. In any case, this option guarantees that each
* output pixel corresponds to one RAW pixel.
*/
bool DontStretchPixels;
/** Unclip Highlight color level:
* 0 = Clip all highlights to solid white.
* 1 = Leave highlights unclipped in various shades of pink.
* 2 = Blend clipped and unclipped values together for a gradual
* fade to white.
* 3-9 = Reconstruct highlights. Low numbers favor whites; high numbers
* favor colors.
*/
int unclipColors;
/** RAW quality decoding factor value. See DecodingQuality values
* for details.
*/
DecodingQuality RAWQuality;
/** After interpolation, clean up color artifacts by repeatedly applying
* a 3x3 median filter to the R-G and B-G channels.
*/
int medianFilterPasses;
/** Noise reduction method to apply before demosaicing.
*/
NoiseReduction NRType;
/** Noise reduction threshold value. Null value disable NR. Range is between 100 and 1000.
* For IMPULSENR : set the amount of Luminance impulse denoise.
*/
int NRThreshold;
/** Turn on chromatic aberrations correction
* @deprecated does not work with libraw>=0.19
*/
bool enableCACorrection;
/** Magnification factor for Red and Blue layers
* - caMultiplier[0] = amount of correction on red-green axis.
* - caMultiplier[1] = amount of correction on blue-yellow axis.
* - Both values set to 0.0 = automatic CA correction.
* @deprecated does not work with libraw>=0.19
*/
double caMultiplier[2];
/** Brightness of output image.
*/
double brightness;
/** Turn on the black point setting to decode RAW image.
*/
bool enableBlackPoint;
/** Black Point value of output image.
*/
int blackPoint;
/** Turn on the white point setting to decode RAW image.
*/
bool enableWhitePoint;
/** White Point value of output image.
*/
int whitePoint;
/** The input color profile used to decoded RAW data. See OutputColorProfile
* values for details.
*/
InputColorSpace inputColorSpace;
/** Path to custom input ICC profile to define the camera's raw colorspace.
*/
QString inputProfile;
/** The output color profile used to decoded RAW data. See OutputColorProfile
* values for details.
*/
OutputColorSpace outputColorSpace;
/** Path to custom output ICC profile to define the color workspace.
*/
QString outputProfile;
/** Path to text file including dead pixel list.
*/
QString deadPixelMap;
/** Rectangle used to calculate the white balance by averaging the region of image.
*/
QRect whiteBalanceArea;
//-- Extended demosaicing settings ----------------------------------------------------------
/// For DCB interpolation.
/** Number of DCB median filtering correction passes.
* -1 : disable (default)
* 1-10 : DCB correction passes
*/
int dcbIterations;
/** Turn on the DCB interpolation with enhance interpolated colors.
*/
bool dcbEnhanceFl;
/// For VCD_AHD interpolation.
/** Turn on the EECI refine for VCD Demosaicing.
*/
bool eeciRefine;
/** Use edge-sensitive median filtering for artifact supression after VCD demosaicing.
* 0 : disable (default)
* 1-10 : median filter passes.
*/
int esMedPasses;
/** For IMPULSENR Noise reduction. Set the amount of Chrominance impulse denoise.
* Null value disable NR. Range is between 100 and 1000.
* @deprecated does not work with libraw>=0.19
*/
int NRChroThreshold;
/** Turn on the Exposure Correction before interpolation.
*/
bool expoCorrection;
/** Shift of Exposure Correction before interpolation in linear scale.
* Usable range is from 0.25 (darken image 1 stop : -2EV) to 8.0 (lighten ~1.5 photographic stops : +3EV).
*/
double expoCorrectionShift;
/** Amount of highlight preservation for exposure correction before interpolation in E.V.
* Usable range is from 0.0 (linear exposure shift, highlights may blow) to 1.0 (maximum highlights preservation)
* This settings can only take effect if expoCorrectionShift > 1.0.
*/
double expoCorrectionHighlight;
};
//! kDebug() stream operator. Writes settings @a s to the debug output in a nicely formatted way.
KDCRAW_EXPORT QDebug operator<<(QDebug dbg, const RawDecodingSettings& s);
} // namespace KDcrawIface
#endif /* RAW_DECODING_SETTINGS_H */

View file

@ -1,99 +0,0 @@
/** ===========================================================
* @file
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2005-11-06
* @brief list of RAW file extensions supported by libraw
*
* @author Copyright (C) 2005-2013 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 RAW_FILES_H
#define RAW_FILES_H
// NOTE: extension list Version 1 and 2 are taken from http://www.cybercom.net/~dcoffin/dcraw/rawphoto.c
// Ext Descriptions From
// www.file-extensions.org
// en.wikipedia.org/wiki/RAW_file_format
// filext.com
static const char raw_file_extentions[] =
// NOTE: VERSION 1
"*.bay " // Casio Digital Camera Raw File Format.
"*.bmq " // NuCore Raw Image File.
"*.cr2 " // Canon Digital Camera RAW Image Format version 2.0. These images are based on the TIFF image standard.
"*.crw " // Canon Digital Camera RAW Image Format version 1.0.
"*.cs1 " // Capture Shop Raw Image File.
"*.dc2 " // Kodak DC25 Digital Camera File.
"*.dcr " // Kodak Digital Camera Raw Image Format for these models: Kodak DSC Pro SLR/c, Kodak DSC Pro SLR/n, Kodak DSC Pro 14N, Kodak DSC PRO 14nx.
"*.dng " // Adobe Digital Negative: DNG is publicly available archival format for the raw files generated by digital cameras. By addressing the lack of an open standard for the raw files created by individual camera models, DNG helps ensure that photographers will be able to access their files in the future.
"*.erf " // Epson Digital Camera Raw Image Format.
"*.fff " // Imacon Digital Camera Raw Image Format.
"*.hdr " // Leaf Raw Image File.
"*.k25 " // Kodak DC25 Digital Camera Raw Image Format.
"*.kdc " // Kodak Digital Camera Raw Image Format.
"*.mdc " // Minolta RD175 Digital Camera Raw Image Format.
"*.mos " // Mamiya Digital Camera Raw Image Format.
"*.mrw " // Minolta Dimage Digital Camera Raw Image Format.
"*.nef " // Nikon Digital Camera Raw Image Format.
"*.orf " // Olympus Digital Camera Raw Image Format.
"*.pef " // Pentax Digital Camera Raw Image Format.
"*.pxn " // Logitech Digital Camera Raw Image Format.
"*.raf " // Fuji Digital Camera Raw Image Format.
"*.raw " // Panasonic Digital Camera Image Format.
"*.rdc " // Digital Foto Maker Raw Image File.
"*.sr2 " // Sony Digital Camera Raw Image Format.
"*.srf " // Sony Digital Camera Raw Image Format for DSC-F828 8 megapixel digital camera or Sony DSC-R1
"*.x3f " // Sigma Digital Camera Raw Image Format for devices based on Foveon X3 direct image sensor.
"*.arw " // Sony Digital Camera Raw Image Format for Alpha devices.
// NOTE: VERSION 2
"*.3fr " // Hasselblad Digital Camera Raw Image Format.
"*.cine " // Phantom Software Raw Image File.
"*.ia " // Sinar Raw Image File.
"*.kc2 " // Kodak DCS200 Digital Camera Raw Image Format.
"*.mef " // Mamiya Digital Camera Raw Image Format.
"*.nrw " // Nikon Digital Camera Raw Image Format.
"*.qtk " // Apple Quicktake 100/150 Digital Camera Raw Image Format.
"*.rw2 " // Panasonic LX3 Digital Camera Raw Image Format.
"*.sti " // Sinar Capture Shop Raw Image File.
// NOTE: VERSION 3
"*.rwl " // Leica Digital Camera Raw Image Format.
// NOTE: VERSION 4
"*.srw "; // Samnsung Raw Image Format.
/* TODO: check if these format are supported
"*.drf " // Kodak Digital Camera Raw Image Format.
"*.dsc " // Kodak Digital Camera Raw Image Format.
"*.ptx " // Pentax Digital Camera Raw Image Format.
"*.cap " // Phase One Digital Camera Raw Image Format.
"*.iiq " // Phase One Digital Camera Raw Image Format.
"*.rwz " // Rawzor Digital Camera Raw Image Format.
*/
// increment this number whenever you change the above string
static const int raw_file_extensions_version = 4;
#endif // RAW_FILES_H

View file

@ -1,149 +0,0 @@
/** ===========================================================
* @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-2013 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.
*
* ============================================================ */
#include "moc_rcombobox.cpp"
// Qt includes
#include <QToolButton>
// KDE includes
#include <kdialog.h>
#include <klocale.h>
#include <kiconloader.h>
namespace KDcrawIface
{
class RComboBox::Private
{
public:
Private()
{
defaultIndex = 0;
resetButton = 0;
combo = 0;
}
int defaultIndex;
QToolButton* resetButton;
KComboBox* combo;
};
RComboBox::RComboBox(QWidget* const parent)
: KHBox(parent), d(new Private)
{
d->combo = new KComboBox(this);
d->resetButton = new QToolButton(this);
d->resetButton->setAutoRaise(true);
d->resetButton->setFocusPolicy(Qt::NoFocus);
d->resetButton->setIcon(SmallIcon("document-revert"));
d->resetButton->setToolTip(i18nc("@info:tooltip", "Reset to default value"));
setStretchFactor(d->combo, 10);
setMargin(0);
setSpacing(KDialog::spacingHint());
// -------------------------------------------------------------
connect(d->resetButton, SIGNAL(clicked()),
this, SLOT(slotReset()));
connect(d->combo, SIGNAL(activated(int)),
this, SLOT(slotItemActivated(int)));
connect(d->combo, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotCurrentIndexChanged(int)));
}
RComboBox::~RComboBox()
{
delete d;
}
KComboBox* RComboBox::combo() const
{
return d->combo;
}
void RComboBox::addItem(const QString& t, int index)
{
d->combo->addItem(t, index);
}
void RComboBox::insertItem(int index, const QString& t)
{
d->combo->insertItem(index, t);
}
int RComboBox::currentIndex() const
{
return d->combo->currentIndex();
}
void RComboBox::setCurrentIndex(int v)
{
d->combo->setCurrentIndex(v);
}
int RComboBox::defaultIndex() const
{
return d->defaultIndex;
}
void RComboBox::setDefaultIndex(int v)
{
d->defaultIndex = v;
d->combo->setCurrentIndex(d->defaultIndex);
slotItemActivated(v);
}
void RComboBox::slotReset()
{
d->combo->setCurrentIndex(d->defaultIndex);
d->resetButton->setEnabled(false);
slotItemActivated(d->defaultIndex);
emit reset();
}
void RComboBox::slotItemActivated(int v)
{
d->resetButton->setEnabled(v != d->defaultIndex);
emit activated(v);
}
void RComboBox::slotCurrentIndexChanged(int v)
{
d->resetButton->setEnabled(v != d->defaultIndex);
emit currentIndexChanged(v);
}
} // namespace KDcrawIface

View file

@ -1,86 +0,0 @@
/** ===========================================================
* @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-2013 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
// KDE includes
#include <khbox.h>
#include <kcombobox.h>
// Local includes
#include "kdcraw_export.h"
namespace KDcrawIface
{
class KDCRAW_EXPORT RComboBox : public KHBox
{
Q_OBJECT
public:
RComboBox(QWidget* const parent=0);
~RComboBox();
void setCurrentIndex(int d);
int currentIndex() const;
void setDefaultIndex(int d);
int defaultIndex() const;
KComboBox* 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 */

View file

@ -1,827 +0,0 @@
/** ===========================================================
* @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-2013 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.
*
* ============================================================ */
#include "moc_rexpanderbox.cpp"
// Qt includes
#include <QtGui/qevent.h>
#include <QPainter>
#include <QPen>
#include <QCursor>
#include <QStyle>
#include <QStyleOption>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QCheckBox>
// KDE includes
#include <kseparator.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kdialog.h>
#include <klocale.h>
namespace KDcrawIface
{
RClickLabel::RClickLabel(QWidget* const parent)
: QLabel(parent)
{
setCursor(Qt::PointingHandCursor);
}
RClickLabel::RClickLabel(const QString& text, QWidget* const parent)
: QLabel(text, parent)
{
setCursor(Qt::PointingHandCursor);
}
RClickLabel::~RClickLabel()
{
}
void RClickLabel::mousePressEvent(QMouseEvent* event)
{
QLabel::mousePressEvent(event);
/*
* In some contexts, like QGraphicsView, there will be no
* release event if the press event was not accepted.
*/
if (event->button() == Qt::LeftButton)
{
event->accept();
}
}
void RClickLabel::mouseReleaseEvent(QMouseEvent* event)
{
QLabel::mouseReleaseEvent(event);
if (event->button() == Qt::LeftButton)
{
emit leftClicked();
emit activated();
event->accept();
}
}
void RClickLabel::keyPressEvent(QKeyEvent* e)
{
switch (e->key())
{
case Qt::Key_Down:
case Qt::Key_Right:
case Qt::Key_Space:
emit activated();
return;
default:
break;
}
QLabel::keyPressEvent(e);
}
// ------------------------------------------------------------------------
RSqueezedClickLabel::RSqueezedClickLabel(QWidget* const parent)
: KSqueezedTextLabel(parent)
{
setCursor(Qt::PointingHandCursor);
}
RSqueezedClickLabel::RSqueezedClickLabel(const QString& text, QWidget* const parent)
: KSqueezedTextLabel(text, parent)
{
setCursor(Qt::PointingHandCursor);
}
RSqueezedClickLabel::~RSqueezedClickLabel()
{
}
void RSqueezedClickLabel::mouseReleaseEvent(QMouseEvent* event)
{
KSqueezedTextLabel::mouseReleaseEvent(event);
if (event->button() == Qt::LeftButton)
{
emit leftClicked();
emit activated();
event->accept();
}
}
void RSqueezedClickLabel::mousePressEvent(QMouseEvent* event)
{
QLabel::mousePressEvent(event);
/*
* In some contexts, like QGraphicsView, there will be no
* release event if the press event was not accepted.
*/
if (event->button() == Qt::LeftButton)
{
event->accept();
}
}
void RSqueezedClickLabel::keyPressEvent(QKeyEvent* e)
{
switch (e->key())
{
case Qt::Key_Down:
case Qt::Key_Right:
case Qt::Key_Space:
emit activated();
return;
default:
break;
}
QLabel::keyPressEvent(e);
}
// ------------------------------------------------------------------------
RArrowClickLabel::RArrowClickLabel(QWidget* const parent)
: QWidget(parent), m_arrowType(Qt::DownArrow)
{
setCursor(Qt::PointingHandCursor);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_size = 8;
m_margin = 2;
}
void RArrowClickLabel::setArrowType(Qt::ArrowType type)
{
m_arrowType = type;
update();
}
RArrowClickLabel::~RArrowClickLabel()
{
}
Qt::ArrowType RArrowClickLabel::arrowType() const
{
return m_arrowType;
}
void RArrowClickLabel::mousePressEvent(QMouseEvent* event)
{
/*
* In some contexts, like QGraphicsView, there will be no
* release event if the press event was not accepted.
*/
if (event->button() == Qt::LeftButton)
{
event->accept();
}
}
void RArrowClickLabel::mouseReleaseEvent(QMouseEvent* event)
{
if (event->button() == Qt::LeftButton)
{
emit leftClicked();
}
}
void RArrowClickLabel::paintEvent(QPaintEvent*)
{
// Inspired by karrowbutton.cpp,
// Copyright (C) 2001 Frerich Raabe <raabe@kde.org>
QPainter p(this);
QStyleOptionFrame opt;
opt.init(this);
opt.lineWidth = 2;
opt.midLineWidth = 0;
/*
p.fillRect( rect(), palette().brush( QPalette::Background ) );
style()->drawPrimitive( QStyle::PE_Frame, &opt, &p, this);
*/
if (m_arrowType == Qt::NoArrow)
return;
if (width() < m_size + m_margin || height() < m_size + m_margin)
return; // don't draw arrows if we are too small
unsigned int x = 0, y = 0;
if (m_arrowType == Qt::DownArrow)
{
x = (width() - m_size) / 2;
y = height() - (m_size + m_margin);
}
else if (m_arrowType == Qt::UpArrow)
{
x = (width() - m_size) / 2;
y = m_margin;
}
else if (m_arrowType == Qt::RightArrow)
{
x = width() - (m_size + m_margin);
y = (height() - m_size) / 2;
}
else // arrowType == LeftArrow
{
x = m_margin;
y = (height() - m_size) / 2;
}
/*
if (isDown())
{
++x;
++y;
}
*/
QStyle::PrimitiveElement e = QStyle::PE_IndicatorArrowLeft;
switch (m_arrowType)
{
case Qt::LeftArrow:
e = QStyle::PE_IndicatorArrowLeft;
break;
case Qt::RightArrow:
e = QStyle::PE_IndicatorArrowRight;
break;
case Qt::UpArrow:
e = QStyle::PE_IndicatorArrowUp;
break;
case Qt::DownArrow:
e = QStyle::PE_IndicatorArrowDown;
break;
case Qt::NoArrow:
break;
}
opt.state |= QStyle::State_Enabled;
opt.rect = QRect( x, y, m_size, m_size);
style()->drawPrimitive( e, &opt, &p, this );
}
QSize RArrowClickLabel::sizeHint() const
{
return QSize(m_size + 2*m_margin, m_size + 2*m_margin);
}
// ------------------------------------------------------------------------
class RLabelExpander::Private
{
public:
Private()
{
clickLabel = 0;
containerWidget = 0;
pixmapLabel = 0;
grid = 0;
arrow = 0;
line = 0;
hbox = 0;
checkBox = 0;
expandByDefault = true;
}
bool expandByDefault;
QCheckBox* checkBox;
QLabel* pixmapLabel;
QWidget* containerWidget;
QGridLayout* grid;
KSeparator* line;
QWidget* hbox;
RArrowClickLabel* arrow;
RClickLabel* clickLabel;
};
RLabelExpander::RLabelExpander(QWidget* const parent)
: QWidget(parent), d(new Private)
{
d->grid = new QGridLayout(this);
d->line = new KSeparator(Qt::Horizontal, this);
d->hbox = new QWidget(this);
d->arrow = new RArrowClickLabel(d->hbox);
d->checkBox = new QCheckBox(d->hbox);
d->pixmapLabel = new QLabel(d->hbox);
d->clickLabel = new RClickLabel(d->hbox);
QHBoxLayout* const hlay = new QHBoxLayout(d->hbox);
hlay->addWidget(d->arrow);
hlay->addWidget(d->checkBox);
hlay->addWidget(d->pixmapLabel);
hlay->addWidget(d->clickLabel, 10);
hlay->setMargin(0);
hlay->setSpacing(KDialog::spacingHint());
d->pixmapLabel->installEventFilter(this);
d->pixmapLabel->setCursor(Qt::PointingHandCursor);
d->hbox->setCursor(Qt::PointingHandCursor);
setCheckBoxVisible(false);
d->grid->addWidget(d->line, 0, 0, 1, 3);
d->grid->addWidget(d->hbox, 1, 0, 1, 3);
d->grid->setColumnStretch(2, 10);
d->grid->setMargin(KDialog::spacingHint());
d->grid->setSpacing(KDialog::spacingHint());
connect(d->arrow, SIGNAL(leftClicked()),
this, SLOT(slotToggleContainer()));
connect(d->clickLabel, SIGNAL(activated()),
this, SLOT(slotToggleContainer()));
connect(d->checkBox, SIGNAL(toggled(bool)),
this, SIGNAL(signalToggled(bool)));
}
RLabelExpander::~RLabelExpander()
{
delete d;
}
void RLabelExpander::setCheckBoxVisible(bool b)
{
d->checkBox->setVisible(b);
}
bool RLabelExpander::checkBoxIsVisible() const
{
return d->checkBox->isVisible();
}
void RLabelExpander::setChecked(bool b)
{
d->checkBox->setChecked(b);
}
bool RLabelExpander::isChecked() const
{
return d->checkBox->isChecked();
}
void RLabelExpander::setLineVisible(bool b)
{
d->line->setVisible(b);
}
bool RLabelExpander::lineIsVisible() const
{
return d->line->isVisible();
}
void RLabelExpander::setText(const QString& txt)
{
d->clickLabel->setText(QString("<qt><b>%1</b></qt>").arg(txt));
}
QString RLabelExpander::text() const
{
return d->clickLabel->text();
}
void RLabelExpander::setIcon(const QPixmap& pix)
{
d->pixmapLabel->setPixmap(pix);
}
const QPixmap* RLabelExpander::icon() const
{
return d->pixmapLabel->pixmap();
}
void RLabelExpander::setWidget(QWidget* const widget)
{
if (widget)
{
d->containerWidget = widget;
d->containerWidget->setParent(this);
d->grid->addWidget(d->containerWidget, 2, 0, 1, 3);
}
}
QWidget* RLabelExpander::widget() const
{
return d->containerWidget;
}
void RLabelExpander::setExpandByDefault(bool b)
{
d->expandByDefault = b;
}
bool RLabelExpander::isExpandByDefault() const
{
return d->expandByDefault;
}
void RLabelExpander::setExpanded(bool b)
{
if (d->containerWidget)
{
d->containerWidget->setVisible(b);
if (b)
d->arrow->setArrowType(Qt::DownArrow);
else
d->arrow->setArrowType(Qt::RightArrow);
}
emit signalExpanded(b);
}
bool RLabelExpander::isExpanded() const
{
return (d->arrow->arrowType() == Qt::DownArrow);
}
void RLabelExpander::slotToggleContainer()
{
if (d->containerWidget)
setExpanded(!d->containerWidget->isVisible());
}
bool RLabelExpander::eventFilter(QObject* obj, QEvent* ev)
{
if ( obj == d->pixmapLabel)
{
if ( ev->type() == QEvent::MouseButtonRelease)
{
slotToggleContainer();
return false;
}
else
{
return false;
}
}
else
{
// pass the event on to the parent class
return QWidget::eventFilter(obj, ev);
}
}
// ------------------------------------------------------------------------
class RExpanderBox::Private
{
public:
Private(RExpanderBox* const box)
{
parent = box;
vbox = 0;
}
void createItem(int index, QWidget* const w, const QPixmap& pix, const QString& txt,
const QString& objName, bool expandBydefault)
{
RLabelExpander* const exp = new RLabelExpander(parent->viewport());
exp->setText(txt);
exp->setIcon(pix);
exp->setWidget(w);
exp->setLineVisible(!wList.isEmpty());
exp->setObjectName(objName);
exp->setExpandByDefault(expandBydefault);
if (index >= 0)
{
vbox->insertWidget(index, exp);
wList.insert(index, exp);
}
else
{
vbox->addWidget(exp);
wList.append(exp);
}
parent->connect(exp, SIGNAL(signalExpanded(bool)),
parent, SLOT(slotItemExpanded(bool)));
parent->connect(exp, SIGNAL(signalToggled(bool)),
parent, SLOT(slotItemToggled(bool)));
}
public:
QList<RLabelExpander*> wList;
QVBoxLayout* vbox;
RExpanderBox* parent;
};
RExpanderBox::RExpanderBox(QWidget* const parent)
: QScrollArea(parent), d(new Private(this))
{
setFrameStyle(QFrame::NoFrame);
setWidgetResizable(true);
QWidget* const main = new QWidget(viewport());
d->vbox = new QVBoxLayout(main);
d->vbox->setMargin(0);
d->vbox->setSpacing(KDialog::spacingHint());
setWidget(main);
setAutoFillBackground(false);
viewport()->setAutoFillBackground(false);
main->setAutoFillBackground(false);
}
RExpanderBox::~RExpanderBox()
{
d->wList.clear();
delete d;
}
void RExpanderBox::setCheckBoxVisible(int index, bool b)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->setCheckBoxVisible(b);
}
bool RExpanderBox::checkBoxIsVisible(int index) const
{
if (index > d->wList.count() || index < 0) return false;
return d->wList[index]->checkBoxIsVisible();
}
void RExpanderBox::setChecked(int index, bool b)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->setChecked(b);
}
bool RExpanderBox::isChecked(int index) const
{
if (index > d->wList.count() || index < 0) return false;
return d->wList[index]->isChecked();
}
void RExpanderBox::addItem(QWidget* const w, const QPixmap& pix, const QString& txt,
const QString& objName, bool expandBydefault)
{
d->createItem(-1, w, pix, txt, objName, expandBydefault);
}
void RExpanderBox::addItem(QWidget* const w, const QString& txt,
const QString& objName, bool expandBydefault)
{
addItem(w, QPixmap(), txt, objName, expandBydefault);
}
void RExpanderBox::addStretch()
{
d->vbox->addStretch(10);
}
void RExpanderBox::insertItem(int index, QWidget* const w, const QPixmap& pix, const QString& txt,
const QString& objName, bool expandBydefault)
{
d->createItem(index, w, pix, txt, objName, expandBydefault);
}
void RExpanderBox::slotItemExpanded(bool b)
{
RLabelExpander* const exp = dynamic_cast<RLabelExpander*>(sender());
if (exp)
{
int index = indexOf(exp);
emit signalItemExpanded(index, b);
}
}
void RExpanderBox::slotItemToggled(bool b)
{
RLabelExpander* const exp = dynamic_cast<RLabelExpander*>(sender());
if (exp)
{
int index = indexOf(exp);
emit signalItemToggled(index, b);
}
}
void RExpanderBox::insertItem(int index, QWidget* const w, const QString& txt,
const QString& objName, bool expandBydefault)
{
insertItem(index, w, QPixmap(), txt, objName, expandBydefault);
}
void RExpanderBox::insertStretch(int index)
{
d->vbox->insertStretch(index, 10);
}
void RExpanderBox::removeItem(int index)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->hide();
d->wList.removeAt(index);
}
void RExpanderBox::setItemText(int index, const QString& txt)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->setText(txt);
}
QString RExpanderBox::itemText(int index) const
{
if (index > d->wList.count() || index < 0) return QString();
return d->wList[index]->text();
}
void RExpanderBox::setItemIcon(int index, const QPixmap& pix)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->setIcon(pix);
}
const QPixmap* RExpanderBox::itemIcon(int index) const
{
if (index > d->wList.count() || index < 0) return 0;
return d->wList[index]->icon();
}
int RExpanderBox::count() const
{
return d->wList.count();
}
void RExpanderBox::setItemToolTip(int index, const QString& tip)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->setToolTip(tip);
}
QString RExpanderBox::itemToolTip(int index) const
{
if (index > d->wList.count() || index < 0) return QString();
return d->wList[index]->toolTip();
}
void RExpanderBox::setItemEnabled(int index, bool enabled)
{
if (index > d->wList.count() || index < 0) return;
d->wList[index]->setEnabled(enabled);
}
bool RExpanderBox::isItemEnabled(int index) const
{
if (index > d->wList.count() || index < 0) return false;
return d->wList[index]->isEnabled();
}
RLabelExpander* RExpanderBox::widget(int index) const
{
if (index > d->wList.count() || index < 0) return 0;
return d->wList[index];
}
int RExpanderBox::indexOf(RLabelExpander* const widget) const
{
for (int i = 0 ; i < count(); ++i)
{
RLabelExpander* const exp = d->wList[i];
if (widget == exp)
return i;
}
return -1;
}
void RExpanderBox::setItemExpanded(int index, bool b)
{
if (index > d->wList.count() || index < 0) return;
RLabelExpander* const exp = d->wList[index];
if (!exp) return;
exp->setExpanded(b);
}
bool RExpanderBox::isItemExpanded(int index) const
{
if (index > d->wList.count() || index < 0) return false;
RLabelExpander* const exp = d->wList[index];
if (!exp) return false;
return (exp->isExpanded());
}
void RExpanderBox::readSettings(KConfigGroup& group)
{
for (int i = 0 ; i < count(); ++i)
{
RLabelExpander* const exp = d->wList[i];
if (exp)
{
exp->setExpanded(group.readEntry(QString("%1 Expanded").arg(exp->objectName()),
exp->isExpandByDefault()));
}
}
}
void RExpanderBox::writeSettings(KConfigGroup& group)
{
for (int i = 0 ; i < count(); ++i)
{
RLabelExpander* const exp = d->wList[i];
if (exp)
{
group.writeEntry(QString("%1 Expanded").arg(exp->objectName()),
exp->isExpanded());
}
}
}
// ------------------------------------------------------------------------
RExpanderBoxExclusive::RExpanderBoxExclusive(QWidget* const parent)
: RExpanderBox(parent)
{
setIsToolBox(true);
}
RExpanderBoxExclusive::~RExpanderBoxExclusive()
{
}
void RExpanderBoxExclusive::slotItemExpanded(bool b)
{
RLabelExpander* const exp = dynamic_cast<RLabelExpander*>(sender());
if (!exp) return;
if (isToolBox() && b)
{
int item = 0;
while (item < count())
{
if (isItemExpanded(item) && item != indexOf(exp))
{
setItemExpanded(item, false);
}
item++;
}
}
emit signalItemExpanded(indexOf(exp), b);
}
void RExpanderBoxExclusive::setIsToolBox(bool b)
{
m_toolbox = b;
}
bool RExpanderBoxExclusive::isToolBox() const
{
return (m_toolbox);
}
} // namespace KDcrawIface

View file

@ -1,299 +0,0 @@
/** ===========================================================
* @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-2013 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 <QtCore/QObject>
#include <QtGui/QPixmap>
#include <QtGui/QLabel>
#include <QtGui/QWidget>
#include <QtGui/QScrollArea>
// KDE includes
#include <ksqueezedtextlabel.h>
#include <kconfig.h>
// Local includes
#include "kdcraw_export.h"
namespace KDcrawIface
{
class KDCRAW_EXPORT RClickLabel : public QLabel
{
Q_OBJECT
public:
RClickLabel(QWidget* const parent = 0);
explicit RClickLabel(const QString& text, QWidget* const parent = 0);
~RClickLabel();
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);
};
// -------------------------------------------------------------------------
class KDCRAW_EXPORT RSqueezedClickLabel : public KSqueezedTextLabel
{
Q_OBJECT
public:
RSqueezedClickLabel(QWidget* const parent = 0);
explicit RSqueezedClickLabel(const QString& text, QWidget* const parent = 0);
~RSqueezedClickLabel();
Q_SIGNALS:
void leftClicked();
void activated();
protected:
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void keyPressEvent(QKeyEvent* event);
};
// -------------------------------------------------------------------------
class KDCRAW_EXPORT RArrowClickLabel : public QWidget
{
Q_OBJECT
public:
RArrowClickLabel(QWidget* const parent = 0);
~RArrowClickLabel();
void setArrowType(Qt::ArrowType arrowType);
Qt::ArrowType arrowType() const;
virtual QSize sizeHint () const;
Q_SIGNALS:
void leftClicked();
protected:
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
virtual void paintEvent(QPaintEvent* event);
protected:
Qt::ArrowType m_arrowType;
int m_size;
int m_margin;
};
// -------------------------------------------------------------------------
class KDCRAW_EXPORT RLabelExpander : public QWidget
{
Q_OBJECT
public:
RLabelExpander(QWidget* const parent = 0);
~RLabelExpander();
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 QPixmap& pix);
const QPixmap* 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);
private:
class Private;
Private* const d;
};
// -------------------------------------------------------------------------
class KDCRAW_EXPORT RExpanderBox : public QScrollArea
{
Q_OBJECT
public:
RExpanderBox(QWidget* const parent = 0);
~RExpanderBox();
/** 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 QPixmap& pix, 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 QPixmap& pix, 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 QPixmap& pix);
const QPixmap* 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 KDCRAW_EXPORT RExpanderBoxExclusive : public RExpanderBox
{
Q_OBJECT
public:
RExpanderBoxExclusive(QWidget* const parent = 0);
~RExpanderBoxExclusive();
/** 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

View file

@ -1,239 +0,0 @@
/** ===========================================================
* @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-2013 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.
*
* ============================================================ */
#include "moc_rnuminput.cpp"
// Qt includes
#include <QToolButton>
// KDE includes
#include <klocale.h>
#include <kiconloader.h>
#include <kdialog.h>
namespace KDcrawIface
{
class RIntNumInput::Private
{
public:
Private()
{
defaultValue = 0;
resetButton = 0;
input = 0;
}
int defaultValue;
QToolButton* resetButton;
KIntNumInput* input;
};
RIntNumInput::RIntNumInput(QWidget* const parent)
: KHBox(parent), d(new Private)
{
d->input = new KIntNumInput(this);
d->resetButton = new QToolButton(this);
d->resetButton->setAutoRaise(true);
d->resetButton->setFocusPolicy(Qt::NoFocus);
d->resetButton->setIcon(SmallIcon("document-revert"));
d->resetButton->setToolTip(i18nc("@info:tooltip", "Reset to default value"));
setStretchFactor(d->input, 10);
setMargin(0);
setSpacing(KDialog::spacingHint());
// -------------------------------------------------------------
connect(d->resetButton, SIGNAL(clicked()),
this, SLOT(slotReset()));
connect(d->input, SIGNAL(valueChanged(int)),
this, SLOT(slotValueChanged(int)));
}
RIntNumInput::~RIntNumInput()
{
delete d;
}
KIntNumInput* RIntNumInput::input() const
{
return d->input;
}
void RIntNumInput::setSliderEnabled(bool b)
{
d->input->setSliderEnabled(b);
}
void RIntNumInput::setRange(int min, int max, int step)
{
d->input->setRange(min, max, step);
}
int RIntNumInput::value() const
{
return d->input->value();
}
void RIntNumInput::setValue(int v)
{
d->input->setValue(v);
}
int RIntNumInput::defaultValue() const
{
return d->defaultValue;
}
void RIntNumInput::setDefaultValue(int v)
{
d->defaultValue = v;
d->input->setValue(d->defaultValue);
slotValueChanged(v);
}
void RIntNumInput::slotReset()
{
d->input->setValue(d->defaultValue);
d->resetButton->setEnabled(false);
emit reset();
}
void RIntNumInput::slotValueChanged(int v)
{
d->resetButton->setEnabled(v != d->defaultValue);
emit valueChanged(v);
}
// ----------------------------------------------------
class RDoubleNumInput::Private
{
public:
Private()
{
defaultValue = 0.0;
resetButton = 0;
input = 0;
}
double defaultValue;
QToolButton* resetButton;
KDoubleNumInput* input;
};
RDoubleNumInput::RDoubleNumInput(QWidget* const parent)
: KHBox(parent), d(new Private)
{
d->input = new KDoubleNumInput(this);
d->resetButton = new QToolButton(this);
d->resetButton->setAutoRaise(true);
d->resetButton->setFocusPolicy(Qt::NoFocus);
d->resetButton->setIcon(SmallIcon("document-revert"));
d->resetButton->setToolTip(i18nc("@info:tooltip", "Reset to default value"));
setStretchFactor(d->input, 10);
setMargin(0);
setSpacing(KDialog::spacingHint());
// -------------------------------------------------------------
connect(d->resetButton, SIGNAL(clicked()),
this, SLOT(slotReset()));
connect(d->input, SIGNAL(valueChanged(double)),
this, SLOT(slotValueChanged(double)));
}
RDoubleNumInput::~RDoubleNumInput()
{
delete d;
}
KDoubleNumInput* RDoubleNumInput::input() const
{
return d->input;
}
void RDoubleNumInput::setDecimals(int p)
{
d->input->setDecimals(p);
}
void RDoubleNumInput::setRange(double min, double max, double step, bool slider)
{
d->input->setRange(min, max, step, slider);
}
double RDoubleNumInput::value() const
{
return d->input->value();
}
void RDoubleNumInput::setValue(double v)
{
d->input->setValue(v);
}
double RDoubleNumInput::defaultValue() const
{
return d->defaultValue;
}
void RDoubleNumInput::setDefaultValue(double v)
{
d->defaultValue = v;
d->input->setValue(d->defaultValue);
slotValueChanged(v);
}
void RDoubleNumInput::slotReset()
{
d->input->setValue(d->defaultValue);
d->resetButton->setEnabled(false);
emit reset();
}
void RDoubleNumInput::slotValueChanged(double v)
{
d->resetButton->setEnabled(v != d->defaultValue);
emit valueChanged(v);
}
} // namespace KDcrawIface

View file

@ -1,125 +0,0 @@
/** ===========================================================
* @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-2013 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
// KDE includes
#include <khbox.h>
#include <knuminput.h>
// Local includes
#include "kdcraw_export.h"
namespace KDcrawIface
{
class KDCRAW_EXPORT RIntNumInput : public KHBox
{
Q_OBJECT
public:
RIntNumInput(QWidget* const parent=0);
~RIntNumInput();
int value() const;
void setSliderEnabled(bool b);
void setRange(int min, int max, int step);
void setDefaultValue(int d);
int defaultValue() const;
KIntNumInput* input() const;
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 KDCRAW_EXPORT RDoubleNumInput : public KHBox
{
Q_OBJECT
public:
RDoubleNumInput(QWidget* const parent=0);
~RDoubleNumInput();
double value() const;
void setDecimals(int p);
void setRange(double min, double max, double step, bool slider=true);
void setDefaultValue(double d);
double defaultValue() const;
KDoubleNumInput* input() const;
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 */

View file

@ -1,200 +0,0 @@
/** ===========================================================
* @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-2013 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.
*
* ============================================================ */
#include "moc_squeezedcombobox.cpp"
// Qt includes
#include <QComboBox>
#include <QPair>
#include <QTimer>
#include <QStyle>
#include <QApplication>
#include <QToolTip>
#include <QtGui/qevent.h>
namespace KDcrawIface
{
class SqueezedComboBox::Private
{
public:
Private()
{
timer = 0;
}
QMap<int, QString> originalItems;
QTimer* timer;
};
SqueezedComboBox::SqueezedComboBox(QWidget* const parent, const char* name)
: QComboBox(parent), d(new Private)
{
setObjectName(name);
setMinimumWidth(100);
d->timer = new QTimer(this);
d->timer->setSingleShot(true);
connect(d->timer, SIGNAL(timeout()),
this, SLOT(slotTimeOut()));
connect(this, SIGNAL(activated(int)),
SLOT(slotUpdateToolTip(int)));
}
SqueezedComboBox::~SqueezedComboBox()
{
d->originalItems.clear();
delete d->timer;
delete d;
}
bool SqueezedComboBox::contains(const QString& text) const
{
if (text.isEmpty())
return false;
for (QMap<int, QString>::const_iterator it = d->originalItems.constBegin() ; it != d->originalItems.constEnd(); ++it)
{
if (it.value() == text)
return true;
}
return false;
}
QSize SqueezedComboBox::sizeHint() const
{
ensurePolished();
QFontMetrics fm = fontMetrics();
int maxW = count() ? 18 : 7 * fm.width(QChar('x')) + 18;
int maxH = qMax( fm.lineSpacing(), 14 ) + 2;
QStyleOptionComboBox options;
options.initFrom(this);
return style()->sizeFromContents(QStyle::CT_ComboBox, &options,
QSize(maxW, maxH), this).expandedTo(QApplication::globalStrut());
}
void SqueezedComboBox::insertSqueezedItem(const QString& newItem, int index,
const QVariant& userData)
{
d->originalItems[index] = newItem;
QComboBox::insertItem(index, squeezeText(newItem), userData);
// if this is the first item, set the tooltip.
if (index == 0)
slotUpdateToolTip(0);
}
void SqueezedComboBox::insertSqueezedList(const QStringList& newItems, int index)
{
for(QStringList::const_iterator it = newItems.constBegin() ; it != newItems.constEnd() ; ++it)
{
insertSqueezedItem(*it, index);
index++;
}
}
void SqueezedComboBox::addSqueezedItem(const QString& newItem,
const QVariant& userData)
{
insertSqueezedItem(newItem, count(), userData);
}
void SqueezedComboBox::setCurrent(const QString& itemText)
{
QString squeezedText = squeezeText(itemText);
qint32 itemIndex = findText(squeezedText);
if (itemIndex >= 0)
setCurrentIndex(itemIndex);
}
void SqueezedComboBox::resizeEvent(QResizeEvent *)
{
d->timer->start(200);
}
void SqueezedComboBox::slotTimeOut()
{
for (QMap<int, QString>::iterator it = d->originalItems.begin() ; it != d->originalItems.end(); ++it)
{
setItemText( it.key(), squeezeText( it.value() ) );
}
}
QString SqueezedComboBox::squeezeText(const QString& original) const
{
// not the complete widgetSize is usable. Need to compensate for that.
int widgetSize = width()-30;
QFontMetrics fm( fontMetrics() );
// If we can fit the full text, return that.
if (fm.width(original) < widgetSize)
return(original);
// We need to squeeze.
QString sqItem = original; // prevent empty return value;
widgetSize = widgetSize-fm.width("...");
for (int i = 0 ; i != original.length(); ++i)
{
if ((int)fm.width(original.right(i)) > widgetSize)
{
sqItem = QString(original.left(i) + "...");
break;
}
}
return sqItem;
}
void SqueezedComboBox::slotUpdateToolTip(int index)
{
setToolTip(d->originalItems[index]);
}
QString SqueezedComboBox::itemHighlighted() const
{
int curItem = currentIndex();
return d->originalItems[curItem];
}
QString SqueezedComboBox::item(int index) const
{
return d->originalItems[index];
}
} // namespace KDcrawIface

View file

@ -1,165 +0,0 @@
/** ===========================================================
* @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-2013 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 <QtGui/QComboBox>
// Local includes
#include "kdcraw_export.h"
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 KDCRAW_EXPORT 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();
/**
*
* 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;
private Q_SLOTS:
void slotTimeOut();
void slotUpdateToolTip(int index);
private:
void resizeEvent(QResizeEvent*);
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

View file

@ -1,33 +0,0 @@
/** ===========================================================
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2007-02-12
* @brief libraw program interface for KDE
*
* @author Copyright (C) 2007-2013 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 KDCRAW_VERSION_H
#define KDCRAW_VERSION_H
// Before changing the line below, make sure that FindKdcraw.cmake can still parse it
static const char kdcraw_version[] = "${DCRAW_LIB_VERSION_STRING}";
#define KDCRAW_VERSION ${DCRAW_LIB_VERSION_ID}
#endif // KDCRAW_VERSION_H

View file

@ -1,31 +0,0 @@
# ===========================================================
#
# 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 for KDE
#
# @author Copyright (C) 2006-2012 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.
#
# ============================================================
FILE(GLOB icmfiles *.icm *.icc)
INSTALL(
FILES
${icmfiles}
DESTINATION ${KDE4_DATA_INSTALL_DIR}/libkdcraw/profiles
)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,31 +0,0 @@
# ===========================================================
#
# 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 for KDE
#
# @author Copyright (C) 2006-2013 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.
#
# ============================================================
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libkdcraw)
KDE4_ADD_MANUAL_TEST(kdcraw-raw2png raw2png.cpp)
TARGET_LINK_LIBRARIES(kdcraw-raw2png kdcraw ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
KDE4_ADD_MANUAL_TEST(kdcraw-libinfo libinfo.cpp)
TARGET_LINK_LIBRARIES(kdcraw-libinfo kdcraw ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})

View file

@ -1,49 +0,0 @@
/** ===========================================================
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2013-09-07
* @brief a command line tool to show libkdcraw info
*
* @author Copyright (C) 2013 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.
*
* ============================================================ */
// Qt includes
#include <QString>
#include <QDebug>
// Local includes
#include "kdcraw.h"
using namespace KDcrawIface;
int main(int /*argc*/, char** /*argv*/)
{
qDebug() << "Libkdcraw version : " << KDcraw::version(),
qDebug() << "Libraw version : " << KDcraw::librawVersion();
qDebug() << "Use OpenMP : " << KDcraw::librawUseGomp();
qDebug() << "Use RawSpeed : " << KDcraw::librawUseRawSpeed();
qDebug() << "Use GPL2 Pack : " << KDcraw::librawUseGPL2DemosaicPack();
qDebug() << "Use GPL3 Pack : " << KDcraw::librawUseGPL3DemosaicPack();
qDebug() << "Raw files list : " << KDcraw::rawFilesList();
qDebug() << "Raw files version : " << KDcraw::rawFilesVersion();
qDebug() << "Supported camera : " << KDcraw::supportedCamera();
return 0;
}

View file

@ -1,138 +0,0 @@
/** ===========================================================
*
* This file is a part of digiKam project
* <a href="http://www.digikam.org">http://www.digikam.org</a>
*
* @date 2008-15-09
* @brief a command line tool to convert RAW file to PNG
*
* @author Copyright (C) 2008-2012 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.
*
* ============================================================ */
// Qt includes
#include <QString>
#include <QFile>
#include <QFileInfo>
#include <QDebug>
// Local includes
#include "kdcraw.h"
#include "rawdecodingsettings.h"
using namespace KDcrawIface;
int main(int argc, char** argv)
{
if(argc != 2)
{
qDebug() << "raw2png - RAW Camera Image to PNG Converter";
qDebug() << "Usage: <rawfile>";
return -1;
}
QString filePath(argv[1]);
QFileInfo input(filePath);
QString previewFilePath(input.baseName() + QString(".preview.png"));
QFileInfo previewOutput(previewFilePath);
QString halfFilePath(input.baseName() + QString(".half.png"));
QFileInfo halfOutput(halfFilePath);
QString fullFilePath(input.baseName() + QString(".full.png"));
QFileInfo fullOutput(fullFilePath);
QImage image;
DcrawInfoContainer identify;
// -----------------------------------------------------------
qDebug() << "raw2png: Identify RAW image from " << input.fileName();
KDcraw rawProcessor;
if (!rawProcessor.rawFileIdentify(identify, filePath))
{
qDebug() << "raw2png: Idendify RAW image failed. Aborted...";
return -1;
}
int width = identify.imageSize.width();
int height = identify.imageSize.height();
qDebug() << "raw2png: Raw image info:";
qDebug() << "--- Date: " << identify.dateTime.toString(Qt::ISODate);
qDebug() << "--- Make: " << identify.make;
qDebug() << "--- Model: " << identify.model;
qDebug() << "--- Size: " << width << "x" << height;
qDebug() << "--- Filter: " << identify.filterPattern;
qDebug() << "--- Colors: " << identify.rawColors;
// -----------------------------------------------------------
qDebug() << "raw2png: Loading RAW image preview";
if (!rawProcessor.loadRawPreview(image, filePath))
{
qDebug() << "raw2png: Loading RAW image preview failed. Aborted...";
return -1;
}
qDebug() << "raw2png: Saving preview image to "
<< previewOutput.fileName() << " size ("
<< image.width() << "x" << image.height()
<< ")";
image.save(previewFilePath, "PNG");
// -----------------------------------------------------------
qDebug() << "raw2png: Loading half RAW image";
image = QImage();
if (!rawProcessor.loadHalfPreview(image, filePath))
{
qDebug() << "raw2png: Loading half RAW image failed. Aborted...";
return -1;
}
qDebug() << "raw2png: Saving half image to "
<< halfOutput.fileName() << " size ("
<< image.width() << "x" << image.height()
<< ")";
image.save(halfFilePath, "PNG");
// -----------------------------------------------------------
qDebug() << "raw2png: Loading full RAW image";
image = QImage();
RawDecodingSettings settings;
settings.halfSizeColorImage = false;
settings.sixteenBitsImage = false;
settings.RGBInterpolate4Colors = false;
settings.RAWQuality = RawDecodingSettings::BILINEAR;
if (!rawProcessor.loadFullImage(image, filePath, settings))
{
qDebug() << "raw2png: Loading full RAW image failed. Aborted...";
return -1;
}
qDebug() << "raw2png: Saving full RAW image to "
<< fullOutput.fileName() << " size ("
<< image.width() << "x" << image.height()
<< ")";
image.save(fullFilePath, "PNG");
return 0;
}

View file

@ -239,9 +239,6 @@
51000 KIPI (general)
51001 KIPI (loading)
# KDCRAW - KDE C++ wrapper for LibRaw
51002 KDCRAW
# KEXIV2 - KDE C++ wrapper for LibExiv2
51003 KEXIV2

View file

@ -305,15 +305,15 @@ void KStandarddirsTest::testAddResourceType()
QString ret = KStandardDirs::locate( "dtd", "customization/catalog.xml" );
QCOMPARE(ret, QString()); // normal, there's no "dtd" resource in kstandarddirs by default
KGlobal::dirs()->addResourceType("dtd", "data", "libkdcraw/");
ret = KStandardDirs::locate( "dtd", "profiles/prophoto.icm" );
KGlobal::dirs()->addResourceType("dtd", "data", "libkexiv2/");
ret = KStandardDirs::locate( "dtd", "data/topicset.iptc-subjectcode.xml" );
QVERIFY(!ret.isEmpty());
ret = KStandardDirs::locate("dtd", "profiles/srgb-d65.icm");
ret = KStandardDirs::locate("dtd", "data/topicset.iptc-subjectcode.xml");
QVERIFY(!ret.isEmpty());
const QStringList files = KGlobal::dirs()->findAllResources("dtd", "profiles/*", KStandardDirs::NoDuplicates);
QVERIFY(files.count() > 3);
const QStringList files = KGlobal::dirs()->findAllResources("dtd", "data/*", KStandardDirs::NoDuplicates);
QVERIFY(files.count() >= 1);
KGlobal::dirs()->addResourceType("xdgdata-ontology", 0, "ontology");
const QStringList ontologyDirs = KGlobal::dirs()->resourceDirs("xdgdata-ontology");

View file

@ -29,6 +29,7 @@ if(IMAGEMAGICK_FOUND)
pcx.desktop
psd.desktop
xcf.desktop
x-dcraw.desktop
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/qimageioplugins
)
endif(IMAGEMAGICK_FOUND)

View file

@ -16,3 +16,4 @@ JP2 <read>
PCX <read>
PSD <read>
XCF <read>
RAW <read>

View file

@ -121,12 +121,12 @@ bool WebPHandler::write(const QImage &image)
delete [] imageData;
if ( size == 0 ) {
free(output);
WebPFree(output);
return false;
}
device()->write(reinterpret_cast<const char*>(output), size);
free(output);
WebPFree(output);
return true;
}

7
kimgio/x-dcraw.desktop Normal file
View file

@ -0,0 +1,7 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=QImageIOPlugins
X-KDE-ImageFormat=magick
X-KDE-MimeType=image/x-dcraw
X-KDE-Read=true
X-KDE-Write=false

View file

@ -31,6 +31,7 @@
* @li PSD \<read\>
* @li WEBP \<read\> \<write\>
* @li XCF \<read\>
* @li RAW \<read\>
*
*/
namespace KImageIO