Bug Summary

File:libs/dimg/filters/bw/mixersettings.cpp
Warning:line 545, column 9
Read function called when stream is in EOF state. Function has no effect

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mixersettings.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/gilles/devel/8.x/build.scan/core/libs/dimg -fcoverage-compilation-dir=/home/gilles/devel/8.x/build.scan/core/libs/dimg -resource-dir /usr/lib/llvm-19/lib/clang/19 -D BUILDING_XMPCOMPAREANDMERGE_AS_STATIC=1 -D BUILDING_XMPCOMPAREANDMERGE_LIB=1 -D BanAllEntityUsage=1 -D CMS_NO_REGISTER_KEYWORD=1 -D EnablePluginManager=0 -D HAVE_FFMPEG_VERSION5 -D LIBPGF_DISABLE_OPENMP -D LINKING_XMPCORE_LIB=1 -D MAGICKCORE_HDRI_ENABLE=0 -D MAGICKCORE_QUANTUM_DEPTH=16 -D QT_DEPRECATED_WARNINGS -D QT_DEPRECATED_WARNINGS_SINCE=0x060000 -D QT_DISABLE_DEPRECATED_BEFORE=0x050E00 -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_FROM_BYTEARRAY -D QT_NO_CAST_TO_ASCII -D QT_NO_FOREACH -D QT_NO_KEYWORDS -D QT_NO_NARROWING_CONVERSIONS_IN_CONNECT -D QT_NO_URL_CAST_FROM_STRING -D QT_STRICT_ITERATORS -D QT_USE_QSTRINGBUILDER -D TRANSLATION_DOMAIN="digikam" -D UNIX_ENV=1 -D USE_JASPER -D USE_JPEG -D USE_JPEG8 -D XMP_COMPONENT_INT_NAMESPACE=AdobeXMPCompareAndMerge_Int -D XMP_StaticBuild=1 -D _GNU_SOURCE -D _LARGEFILE64_SOURCE -D digikamcore_EXPORTS -D qDNGDebug=0 -D qDNGLittleEndian=1 -D qDNGThreadSafe=1 -D qDNGUseLibJPEG=1 -D qDNGUseStdInt=1 -D qDNGUseXMP=1 -D qDNGValidateTarget=1 -D qDNGXMPDocOps=0 -D qDNGXMPFiles=0 -D qLinux=1 -D qMacOS=0 -D qWinOS=0 -I /home/gilles/devel/8.x/build.scan/core/libs/dimg -I /home/gilles/devel/8.x/core/libs/dimg -I /home/gilles/devel/8.x/build.scan/core/libs/dimg/core_dimg_obj_autogen/include -I /home/gilles/devel/8.x/core/libs/video/player/qtmm -I /home/gilles/devel/8.x/core/libs/album/engine -I /home/gilles/devel/8.x/core/libs/album/manager -I /home/gilles/devel/8.x/core/libs/album/treeview -I /home/gilles/devel/8.x/core/libs/album/widgets -I /home/gilles/devel/8.x/core/libs/database/collection -I /home/gilles/devel/8.x/core/libs/database/coredb -I /home/gilles/devel/8.x/core/libs/database/dbjobs -I /home/gilles/devel/8.x/core/libs/database/engine -I /home/gilles/devel/8.x/core/libs/database/haar -I /home/gilles/devel/8.x/core/libs/database/history -I /home/gilles/devel/8.x/core/libs/database/item/containers -I /home/gilles/devel/8.x/core/libs/database/item/lister -I /home/gilles/devel/8.x/core/libs/database/item/query -I /home/gilles/devel/8.x/core/libs/database/item/scanner -I /home/gilles/devel/8.x/core/libs/database/models -I /home/gilles/devel/8.x/core/libs/database/server -I /home/gilles/devel/8.x/core/libs/database/similaritydb -I /home/gilles/devel/8.x/core/libs/database/tags -I /home/gilles/devel/8.x/core/libs/database/thumbsdb -I /home/gilles/devel/8.x/core/libs/database/utils/ifaces -I /home/gilles/devel/8.x/core/libs/database/utils/scan -I /home/gilles/devel/8.x/core/libs/database/utils/widgets -I /home/gilles/devel/8.x/core/libs/dialogs -I /home/gilles/devel/8.x/core/libs/dimg/color -I /home/gilles/devel/8.x/core/libs/dimg/filters/auto -I /home/gilles/devel/8.x/core/libs/dimg/filters/bcg -I /home/gilles/devel/8.x/core/libs/dimg/filters/bw -I /home/gilles/devel/8.x/core/libs/dimg/filters/cb -I /home/gilles/devel/8.x/core/libs/dimg/filters/curves -I /home/gilles/devel/8.x/core/libs/dimg/filters/decorate -I /home/gilles/devel/8.x/core/libs/dimg/filters -I /home/gilles/devel/8.x/core/libs/dimg/filters/film -I /home/gilles/devel/8.x/core/libs/dimg/filters/fx -I /home/gilles/devel/8.x/core/libs/dimg/filters/greycstoration/cimg -I /home/gilles/devel/8.x/core/libs/dimg/filters/greycstoration -I /home/gilles/devel/8.x/core/libs/dimg/filters/hotpixels -I /home/gilles/devel/8.x/core/libs/dimg/filters/hsl -I /home/gilles/devel/8.x/core/libs/dimg/filters/icc -I /home/gilles/devel/8.x/core/libs/dimg/filters/lc -I /home/gilles/devel/8.x/core/libs/dimg/filters/lens -I /home/gilles/devel/8.x/core/libs/dimg/filters/levels -I /home/gilles/devel/8.x/core/libs/dimg/filters/nr -I /home/gilles/devel/8.x/core/libs/dimg/filters/raw -I /home/gilles/devel/8.x/core/libs/dimg/filters/redeye -I /home/gilles/devel/8.x/core/libs/dimg/filters/sharp -I /home/gilles/devel/8.x/core/libs/dimg/filters/transform -I /home/gilles/devel/8.x/core/libs/dimg/filters/wb -I /home/gilles/devel/8.x/core/libs/dimg/history -I /home/gilles/devel/8.x/core/libs/dimg/loaders -I /home/gilles/devel/8.x/core/libs/dngwriter -I /home/gilles/devel/8.x/core/libs/dnnmodelmanager -I /home/gilles/devel/8.x/core/libs/dplugins/core -I /home/gilles/devel/8.x/core/libs/dplugins/iface -I /home/gilles/devel/8.x/core/libs/dplugins/setup -I /home/gilles/devel/8.x/core/libs/dplugins/webservices -I /home/gilles/devel/8.x/core/libs/dplugins/widgets -I /home/gilles/devel/8.x/core/libs/dragdrop -I /home/gilles/devel/8.x/core/libs/dtrash -I /home/gilles/devel/8.x/core/libs/facesengine/common -I /home/gilles/devel/8.x/core/libs/facesengine/detection -I /home/gilles/devel/8.x/core/libs/facesengine/detection/opencv-dnn -I /home/gilles/devel/8.x/core/libs/facesengine/facedb -I /home/gilles/devel/8.x/core/libs/facesengine/recognition -I /home/gilles/devel/8.x/core/libs/facesengine/recognition/opencv-dnn -I /home/gilles/devel/8.x/core/libs/fileactionmanager -I /home/gilles/devel/8.x/core/libs/filters -I /home/gilles/devel/8.x/core/libs/imgqsort/detectors -I /home/gilles/devel/8.x/core/libs/imgqsort -I /home/gilles/devel/8.x/core/libs/iojobs -I /home/gilles/devel/8.x/core/libs/jpegutils -I /home/gilles/devel/8.x/core/libs/metadataengine/containers -I /home/gilles/devel/8.x/core/libs/metadataengine/dmetadata -I /home/gilles/devel/8.x/core/libs/metadataengine/engine -I /home/gilles/devel/8.x/core/libs/metadataengine/exiftool -I /home/gilles/devel/8.x/core/libs/metadataengine/focuspoint -I /home/gilles/devel/8.x/core/libs/mlfoundation -I /home/gilles/devel/8.x/core/libs/models -I /home/gilles/devel/8.x/core/libs/networkmanager -I /home/gilles/devel/8.x/core/libs/notificationmanager -I /home/gilles/devel/8.x/core/libs/onlineversion -I /home/gilles/devel/8.x/core/libs/pgfutils -I /home/gilles/devel/8.x/core/libs/progressmanager -I /home/gilles/devel/8.x/core/libs/properties/captions -I /home/gilles/devel/8.x/core/libs/properties/geolocation -I /home/gilles/devel/8.x/core/libs/properties/history -I /home/gilles/devel/8.x/core/libs/properties/import -I /home/gilles/devel/8.x/core/libs/properties -I /home/gilles/devel/8.x/core/libs/qtopencvimg -I /home/gilles/devel/8.x/core/libs/rawengine -I /home/gilles/devel/8.x/core/libs/settings -I /home/gilles/devel/8.x/core/libs/tags/autoassignment -I /home/gilles/devel/8.x/core/libs/tags/autoassignment/classifiers -I /home/gilles/devel/8.x/core/libs/tags/autoassignment/classifiers/multiclassyolo -I /home/gilles/devel/8.x/core/libs/tags/autoassignment/classifiers/softmax -I /home/gilles/devel/8.x/core/libs/tags/autoassignment/model -I /home/gilles/devel/8.x/core/libs/tags/autoassignment/pipelines -I /home/gilles/devel/8.x/core/libs/tags/autoassignment/pipelines/object -I /home/gilles/devel/8.x/core/libs/tags/engine -I /home/gilles/devel/8.x/core/libs/tags/manager/models -I /home/gilles/devel/8.x/core/libs/tags/manager -I /home/gilles/devel/8.x/core/libs/tags/widgets -I /home/gilles/devel/8.x/core/libs/template -I /home/gilles/devel/8.x/core/libs/threadimageio/engine -I /home/gilles/devel/8.x/core/libs/threadimageio/fileio -I /home/gilles/devel/8.x/core/libs/threadimageio/preview -I /home/gilles/devel/8.x/core/libs/threadimageio/thumb -I /home/gilles/devel/8.x/core/libs/threadimageio/video -I /home/gilles/devel/8.x/core/libs/threads -I /home/gilles/devel/8.x/core/libs/timeadjust -I /home/gilles/devel/8.x/core/libs/transitionmngr -I /home/gilles/devel/8.x/core/libs/versionmanager -I /home/gilles/devel/8.x/core/libs/video -I /home/gilles/devel/8.x/core/libs/video/manager -I /home/gilles/devel/8.x/core/libs/video/osd -I /home/gilles/devel/8.x/core/libs/video/player -I /home/gilles/devel/8.x/core/libs/widgets/colors -I /home/gilles/devel/8.x/core/libs/widgets/combo -I /home/gilles/devel/8.x/core/libs/widgets/files -I /home/gilles/devel/8.x/core/libs/widgets/fonts -I /home/gilles/devel/8.x/core/libs/widgets/graphicsview -I /home/gilles/devel/8.x/core/libs/widgets/history -I /home/gilles/devel/8.x/core/libs/widgets/iccprofiles -I /home/gilles/devel/8.x/core/libs/widgets/itemview -I /home/gilles/devel/8.x/core/libs/widgets/layout -I /home/gilles/devel/8.x/core/libs/widgets/mainview -I /home/gilles/devel/8.x/core/libs/widgets/metadata/config -I /home/gilles/devel/8.x/core/libs/widgets/metadata/exiftool -I /home/gilles/devel/8.x/core/libs/widgets/metadata/exiv2 -I /home/gilles/devel/8.x/core/libs/widgets/metadata/labels -I /home/gilles/devel/8.x/core/libs/widgets/metadata/utils -I /home/gilles/devel/8.x/core/libs/widgets/range -I /home/gilles/devel/8.x/core/libs/widgets/text -I /home/gilles/devel/8.x/core/libs/jpegutils/libjpeg/84 -I /home/gilles/devel/8.x/core/app/utils -I /home/gilles/devel/8.x/build.scan/core/app/utils -I /home/gilles/devel/8.x/core/utilities/advancedrename -I /home/gilles/devel/8.x/core/utilities/advancedrename/common -I /home/gilles/devel/8.x/core/utilities/advancedrename/parser -I /home/gilles/devel/8.x/core/utilities/advancedrename/parser/modifiers -I /home/gilles/devel/8.x/core/utilities/advancedrename/parser/options -I /home/gilles/devel/8.x/core/utilities/advancedrename/parser/options/database -I /home/gilles/devel/8.x/core/utilities/advancedrename/parser/options/database/keys -I /home/gilles/devel/8.x/core/utilities/extrasupport/addressbook -I /home/gilles/devel/8.x/core/utilities/extrasupport/filesindexer -I /home/gilles/devel/8.x/core/utilities/facemanagement/bench -I /home/gilles/devel/8.x/core/utilities/facemanagement/database -I /home/gilles/devel/8.x/core/utilities/facemanagement/dialogs -I /home/gilles/devel/8.x/core/utilities/facemanagement/items -I /home/gilles/devel/8.x/core/utilities/facemanagement/pipelines/detectrecognize -I /home/gilles/devel/8.x/core/utilities/facemanagement/pipelines/edit -I /home/gilles/devel/8.x/core/utilities/facemanagement/pipelines -I /home/gilles/devel/8.x/core/utilities/facemanagement/pipelines/recognize -I /home/gilles/devel/8.x/core/utilities/facemanagement/pipelines/reset -I /home/gilles/devel/8.x/core/utilities/facemanagement/pipelines/retrain -I /home/gilles/devel/8.x/core/utilities/facemanagement/widgets -I /home/gilles/devel/8.x/core/utilities/firstrun -I /home/gilles/devel/8.x/core/utilities/focuspointmanagement -I /home/gilles/devel/8.x/core/utilities/fuzzysearch -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/astro -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/blendings -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/core -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/data -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/graphicsitem -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/handlers/dgml -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/handlers/kml -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/parser -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/scene -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/writer -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/writers/dgml -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/geodata/writers/kml -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/graphicsview -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/layers -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/models -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/osm -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/atmosphere -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/compass -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/crosshairs -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/graticule -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/mapscale -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/measure -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/navigation -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/overviewmap -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/render/progress -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/cache -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/gpsbabel -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/gpx -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/gpx/handlers -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/json -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/kml -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/nominatim-reversegeocoding -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm/o5mreader -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm/translators -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm/writers -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/pn2 -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/plugins/runner/pnt -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/projections -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/runners -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/settings -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/storage -I /home/gilles/devel/8.x/core/utilities/geolocation/engine/tile -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/backends -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/bookmark -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/core -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/correlator -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/dragdrop -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/items -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/lookup -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/reversegeocoding -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/tiles -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/tracks -I /home/gilles/devel/8.x/core/utilities/geolocation/geoiface/widgets -I /home/gilles/devel/8.x/core/utilities/geolocation/geomapwrapper -I /home/gilles/devel/8.x/core/utilities/geolocation/mapsearches -I /home/gilles/devel/8.x/core/utilities/imageeditor/core -I /home/gilles/devel/8.x/core/utilities/imageeditor/dialogs -I /home/gilles/devel/8.x/core/utilities/imageeditor/editor -I /home/gilles/devel/8.x/core/utilities/imageeditor/main -I /home/gilles/devel/8.x/core/utilities/imageeditor/widgets -I /home/gilles/devel/8.x/core/utilities/import/backend -I /home/gilles/devel/8.x/core/utilities/import/dialogs -I /home/gilles/devel/8.x/core/utilities/import/items -I /home/gilles/devel/8.x/core/utilities/import/main -I /home/gilles/devel/8.x/core/utilities/import/models -I /home/gilles/devel/8.x/core/utilities/import/views -I /home/gilles/devel/8.x/core/utilities/import/widgets -I /home/gilles/devel/8.x/core/utilities/lighttable -I /home/gilles/devel/8.x/core/utilities/maintenance/main -I /home/gilles/devel/8.x/core/utilities/maintenance/manager -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/dbcleaner -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/dbscan -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/duplicates -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/facesmanagement -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/fingerprints -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/imgqsort -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/metaremover -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/metasync -I /home/gilles/devel/8.x/core/utilities/maintenance/tools/thumbs -I /home/gilles/devel/8.x/core/utilities/maintenance/utils -I /home/gilles/devel/8.x/core/utilities/queuemanager/dplugins -I /home/gilles/devel/8.x/core/utilities/queuemanager/main -I /home/gilles/devel/8.x/core/utilities/queuemanager/manager -I /home/gilles/devel/8.x/core/utilities/queuemanager/views -I /home/gilles/devel/8.x/core/utilities/searchwindow -I /home/gilles/devel/8.x/core/utilities/setup/album -I /home/gilles/devel/8.x/core/utilities/setup/camera -I /home/gilles/devel/8.x/core/utilities/setup/collections -I /home/gilles/devel/8.x/core/utilities/setup/downloader -I /home/gilles/devel/8.x/core/utilities/setup/editor -I /home/gilles/devel/8.x/core/utilities/setup/metadata -I /home/gilles/devel/8.x/core/utilities/setup/misc -I /home/gilles/devel/8.x/core/utilities/setup -I /home/gilles/devel/8.x/core/app/main -I /home/gilles/devel/8.x/core/app/date -I /home/gilles/devel/8.x/core/app/dragdrop -I /home/gilles/devel/8.x/core/app/views/stack -I /home/gilles/devel/8.x/core/app/views/utils -I /home/gilles/devel/8.x/core/app/items/utils -I /home/gilles/devel/8.x/core/app/items/delegate -I /home/gilles/devel/8.x/core/app/views/sidebar -I /home/gilles/devel/8.x/core/libs/dimg/filters/transform/lqr -I /opt/qt6/include/opencv4 -I /usr/include/ImageMagick-6 -I /usr/include/x86_64-linux-gnu/ImageMagick-6 -I /opt/qt6/include/QtMultimedia -I /opt/qt6/include -I /opt/qt6/include/QtCore -I /opt/qt6/mkspecs/linux-g++ -I /opt/qt6/include/QtGui -I /opt/qt6/include/QtNetwork -I /opt/qt6/include/QtMultimediaWidgets -I /opt/qt6/include/QtWidgets -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/lensfun -I /usr/include/eigen3 -I /opt/qt6/include/QtConcurrent -I /opt/qt6/include/QtXml -I /opt/qt6/include/KF6/KCoreAddons -I /opt/qt6/include/KF6/KConfig -I /opt/qt6/include/KF6/KConfigCore -I /opt/qt6/include/KF6/KI18n -I /opt/qt6/include/KF6/KWidgetsAddons -I /opt/qt6/include/QtGui/6.8.1 -I /opt/qt6/include/QtGui/6.8.1/QtGui -I /opt/qt6/include/QtCore/6.8.1 -I /opt/qt6/include/QtCore/6.8.1/QtCore -I /opt/qt6/include/QtDBus/6.8.1 -I /opt/qt6/include/QtDBus/6.8.1/QtDBus -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/x86_64-linux-gnu/c++/14 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/backward -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-long-long -Wno-deprecated-copy -std=c++20 -fdeprecated-macro -ferror-limit 19 -fvisibility=hidden -fvisibility-inlines-hidden -fno-operator-names -fopenmp -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/gilles/devel/8.x/project/reports/report.scan/2025-01-21-132859-99447-1 -x c++ /home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2009-02-18
7 * Description : Channel mixer settings view.
8 *
9 * SPDX-FileCopyrightText: 2010-2025 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#include "mixersettings.h"
16
17// Qt includes
18
19#include <QGridLayout>
20#include <QLabel>
21#include <QString>
22#include <QFile>
23#include <QTextStream>
24#include <QCheckBox>
25#include <QPushButton>
26#include <QStandardPaths>
27#include <QApplication>
28#include <QStyle>
29#include <QComboBox>
30#include <QMessageBox>
31#include <QUrl>
32#include <QFontDatabase>
33
34// KDE includes
35
36#include <kconfiggroup.h>
37#include <klocalizedstring.h>
38
39// Local includes
40
41#include "dnuminput.h"
42#include "dfiledialog.h"
43#include "dexpanderbox.h"
44#include "digikam_debug.h"
45#include "digikam_config.h"
46
47namespace Digikam
48{
49
50class Q_DECL_HIDDEN__attribute__((visibility("hidden"))) MixerSettings::Private
51{
52public:
53
54 Private() = default;
55
56 const QString configMonochromeEntry = QLatin1String("Monochrome");
57 const QString configPreserveLuminosityEntry = QLatin1String("PreserveLuminosity");
58 const QString configRedRedGainEntry = QLatin1String("RedRedGain");
59 const QString configRedGreenGainEntry = QLatin1String("RedGreenGain");
60 const QString configRedBlueGainEntry = QLatin1String("RedBlueGain");
61 const QString configGreenRedGainEntry = QLatin1String("GreenRedGain");
62 const QString configGreenGreenGainEntry = QLatin1String("GreenGreenGain");
63 const QString configGreenBlueGainEntry = QLatin1String("GreenBlueGain");
64 const QString configBlueRedGainEntry = QLatin1String("BlueRedGain");
65 const QString configBlueGreenGainEntry = QLatin1String("BlueGreenGain");
66 const QString configBlueBlueGainEntry = QLatin1String("BlueBlueGain");
67 const QString configBlackRedGainEntry = QLatin1String("BlackRedGain");
68 const QString configBlackGreenGainEntry = QLatin1String("BlackGreenGain");
69 const QString configBlackBlueGainEntry = QLatin1String("BlackBlueGain");
70
71 int currentChannel = RedChannel;
72
73 QLabel* monochromeTips = nullptr;
74 QLabel* totalPercents = nullptr;
75 QLabel* outChannelLabel = nullptr;
76
77 QPushButton* resetButton = nullptr;
78
79 QCheckBox* preserveLuminosity = nullptr;
80 QCheckBox* monochrome = nullptr;
81
82 QComboBox* outChannelCB = nullptr;
83
84 MixerContainer mixerSettings;
85
86 DDoubleNumInput* redGain = nullptr;
87 DDoubleNumInput* greenGain = nullptr;
88 DDoubleNumInput* blueGain = nullptr;
89};
90
91// --------------------------------------------------------
92
93MixerSettings::MixerSettings(QWidget* const parent)
94 : QWidget(parent),
95 d (new Private)
96{
97 const int spacing = layoutSpacing();
98 QGridLayout* const grid = new QGridLayout(this);
99
100 d->outChannelLabel = new QLabel(i18nc("@label", "Output Channel:")i18ndc("digikam", "@label", "Output Channel:"));
101 d->outChannelCB = new QComboBox;
102 d->outChannelCB->addItem(i18nc("@item: color", "Red")i18ndc("digikam", "@item: color", "Red"), QVariant(RedChannel));
103 d->outChannelCB->addItem(i18nc("@item: color", "Green")i18ndc("digikam", "@item: color", "Green"), QVariant(GreenChannel));
104 d->outChannelCB->addItem(i18nc("@item: color", "Blue")i18ndc("digikam", "@item: color", "Blue"), QVariant(BlueChannel));
105
106 QLabel* const redLabel = new QLabel(i18nc("@label: color", "Red (%):")i18ndc("digikam", "@label: color", "Red (%):"));
107 d->redGain = new DDoubleNumInput;
108 d->redGain->setDecimals(1);
109 d->redGain->setRange(-200.0, 200.0, 1);
110 d->redGain->setDefaultValue(0);
111 d->redGain->setWhatsThis(i18nc("@info", "Select the red color gain, as a percentage, "i18ndc("digikam", "@info", "Select the red color gain, as a percentage, "
"for the current channel.")
112 "for the current channel.")i18ndc("digikam", "@info", "Select the red color gain, as a percentage, "
"for the current channel.")
);
113
114 QLabel* const greenLabel = new QLabel(i18nc("@label: color", "Green (%):")i18ndc("digikam", "@label: color", "Green (%):"));
115 d->greenGain = new DDoubleNumInput;
116 d->greenGain->setDecimals(1);
117 d->greenGain->setRange(-200.0, 200.0, 1);
118 d->greenGain->setDefaultValue(0);
119 d->greenGain->setWhatsThis(i18nc("@info", "Select the green color gain, as a percentage, "i18ndc("digikam", "@info", "Select the green color gain, as a percentage, "
"for the current channel.")
120 "for the current channel.")i18ndc("digikam", "@info", "Select the green color gain, as a percentage, "
"for the current channel.")
);
121
122 QLabel* const blueLabel = new QLabel(i18nc("@label: color", "Blue (%):")i18ndc("digikam", "@label: color", "Blue (%):"));
123 d->blueGain = new DDoubleNumInput;
124 d->blueGain->setDecimals(1);
125 d->blueGain->setRange(-200.0, 200.0, 1);
126 d->blueGain->setDefaultValue(0);
127 d->blueGain->setWhatsThis(i18nc("@info", "Select the blue color gain, as a percentage, "i18ndc("digikam", "@info", "Select the blue color gain, as a percentage, "
"for the current channel.")
128 "for the current channel.")i18ndc("digikam", "@info", "Select the blue color gain, as a percentage, "
"for the current channel.")
);
129
130 // -------------------------------------------------------------
131
132 d->resetButton = new QPushButton(i18nc("@option", "&Reset")i18ndc("digikam", "@option", "&Reset"));
133 d->resetButton->setIcon(QIcon::fromTheme(QLatin1String("document-revert")));
134 d->resetButton->setWhatsThis(i18nc("@info", "Reset color channels' gains settings from "i18ndc("digikam", "@info", "Reset color channels' gains settings from "
"the currently selected channel.")
135 "the currently selected channel.")i18ndc("digikam", "@info", "Reset color channels' gains settings from "
"the currently selected channel.")
);
136
137 d->totalPercents = new QLabel();
138 d->totalPercents->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
139
140 // -------------------------------------------------------------
141
142 d->preserveLuminosity = new QCheckBox(i18nc("@option", "Preserve luminosity")i18ndc("digikam", "@option", "Preserve luminosity"));
143 d->preserveLuminosity->setWhatsThis(i18nc("@info", "Enable this option is you want preserve "i18ndc("digikam", "@info", "Enable this option is you want preserve "
"the image luminosity.")
144 "the image luminosity.")i18ndc("digikam", "@info", "Enable this option is you want preserve "
"the image luminosity.")
);
145
146 // -------------------------------------------------------------
147
148 d->monochrome = new QCheckBox(i18nc("@option: color", "Monochrome")i18ndc("digikam", "@option: color", "Monochrome"));
149 d->monochromeTips = new QLabel(i18nc("@info: help",i18ndc("digikam", "@info: help", "Use \"Monochrome\" mode to convert color picture to Black and White:\n"
"The \"red channel\" modifies the contrast of photograph.\n"
"The \"green channel\" enhances or reduces the details level of photograph.\n"
"The \"blue channel\" affects the noise of photograph.\n" "Note: in this mode, the histogram will display only luminosity values."
)
150 "Use \"Monochrome\" mode to convert color picture to Black and White:\n"i18ndc("digikam", "@info: help", "Use \"Monochrome\" mode to convert color picture to Black and White:\n"
"The \"red channel\" modifies the contrast of photograph.\n"
"The \"green channel\" enhances or reduces the details level of photograph.\n"
"The \"blue channel\" affects the noise of photograph.\n" "Note: in this mode, the histogram will display only luminosity values."
)
151 "The \"red channel\" modifies the contrast of photograph.\n"i18ndc("digikam", "@info: help", "Use \"Monochrome\" mode to convert color picture to Black and White:\n"
"The \"red channel\" modifies the contrast of photograph.\n"
"The \"green channel\" enhances or reduces the details level of photograph.\n"
"The \"blue channel\" affects the noise of photograph.\n" "Note: in this mode, the histogram will display only luminosity values."
)
152 "The \"green channel\" enhances or reduces the details level of photograph.\n"i18ndc("digikam", "@info: help", "Use \"Monochrome\" mode to convert color picture to Black and White:\n"
"The \"red channel\" modifies the contrast of photograph.\n"
"The \"green channel\" enhances or reduces the details level of photograph.\n"
"The \"blue channel\" affects the noise of photograph.\n" "Note: in this mode, the histogram will display only luminosity values."
)
153 "The \"blue channel\" affects the noise of photograph.\n"i18ndc("digikam", "@info: help", "Use \"Monochrome\" mode to convert color picture to Black and White:\n"
"The \"red channel\" modifies the contrast of photograph.\n"
"The \"green channel\" enhances or reduces the details level of photograph.\n"
"The \"blue channel\" affects the noise of photograph.\n" "Note: in this mode, the histogram will display only luminosity values."
)
154 "Note: in this mode, the histogram will display only luminosity values.")i18ndc("digikam", "@info: help", "Use \"Monochrome\" mode to convert color picture to Black and White:\n"
"The \"red channel\" modifies the contrast of photograph.\n"
"The \"green channel\" enhances or reduces the details level of photograph.\n"
"The \"blue channel\" affects the noise of photograph.\n" "Note: in this mode, the histogram will display only luminosity values."
)
);
155
156 d->monochromeTips->setEnabled(false);
157 d->monochromeTips->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
158 d->monochromeTips->setWordWrap(true);
159 d->monochromeTips->setOpenExternalLinks(true);
160 d->monochromeTips->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
161 d->monochromeTips->setLineWidth(1);
162
163 // -------------------------------------------------------------
164
165 grid->addWidget(d->outChannelLabel, 0, 0, 1, 1);
166 grid->addWidget(d->outChannelCB, 0, 3, 1, 2);
167 grid->addWidget(redLabel, 1, 0, 1, 1);
168 grid->addWidget(d->redGain, 1, 1, 1, 4);
169 grid->addWidget(greenLabel, 2, 0, 1, 1);
170 grid->addWidget(d->greenGain, 2, 1, 1, 4);
171 grid->addWidget(blueLabel, 3, 0, 1, 1);
172 grid->addWidget(d->blueGain, 3, 1, 1, 4);
173 grid->addWidget(d->resetButton, 4, 0, 1, 2);
174 grid->addWidget(d->totalPercents, 4, 3, 1, 1);
175 grid->addWidget(d->preserveLuminosity, 5, 0, 1, 5);
176 grid->addWidget(d->monochrome, 6, 0, 1, 5);
177 grid->addWidget(d->monochromeTips, 7, 0, 1, 5);
178 grid->setRowStretch(8, 10);
179 grid->setColumnStretch(2, 10);
180 grid->setContentsMargins(spacing, spacing, spacing, spacing);
181 grid->setSpacing(spacing);
182
183 // -------------------------------------------------------------
184
185 connect(d->redGain, SIGNAL(valueChanged(double))qFlagLocation("2" "valueChanged(double)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "185")
,
186 this, SLOT(slotGainsChanged())qFlagLocation("1" "slotGainsChanged()" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "186")
);
187
188 connect(d->greenGain, SIGNAL(valueChanged(double))qFlagLocation("2" "valueChanged(double)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "188")
,
189 this, SLOT(slotGainsChanged())qFlagLocation("1" "slotGainsChanged()" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "189")
);
190
191 connect(d->blueGain, SIGNAL(valueChanged(double))qFlagLocation("2" "valueChanged(double)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "191")
,
192 this, SLOT(slotGainsChanged())qFlagLocation("1" "slotGainsChanged()" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "192")
);
193
194 connect(d->resetButton, SIGNAL(clicked())qFlagLocation("2" "clicked()" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "194")
,
195 this, SLOT(slotResetCurrentChannel())qFlagLocation("1" "slotResetCurrentChannel()" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "195")
);
196
197 connect(d->monochrome, SIGNAL(toggled(bool))qFlagLocation("2" "toggled(bool)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "197")
,
198 this, SLOT(slotMonochromeActived(bool))qFlagLocation("1" "slotMonochromeActived(bool)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "198")
);
199
200 connect(d->preserveLuminosity, SIGNAL(toggled(bool))qFlagLocation("2" "toggled(bool)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "200")
,
201 this, SLOT(slotLuminosityChanged(bool))qFlagLocation("1" "slotLuminosityChanged(bool)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "201")
);
202
203 connect(d->outChannelCB, SIGNAL(activated(int))qFlagLocation("2" "activated(int)" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "203")
,
204 this, SLOT(slotOutChannelChanged())qFlagLocation("1" "slotOutChannelChanged()" "\0" "/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
":" "204")
);
205}
206
207MixerSettings::~MixerSettings()
208{
209 delete d;
210}
211
212void MixerSettings::setMonochromeTipsVisible(bool b)
213{
214 b ? d->monochromeTips->show()
215 : d->monochromeTips->hide();
216}
217
218void MixerSettings::slotOutChannelChanged()
219{
220 int index = d->outChannelCB->currentIndex();
221 d->currentChannel = (ChannelType)(d->outChannelCB->itemData(index).toInt());
222 updateSettingsWidgets();
223 Q_EMIT signalOutChannelChanged();
224}
225
226int MixerSettings::currentChannel() const
227{
228 return d->currentChannel;
229}
230
231void MixerSettings::slotResetCurrentChannel()
232{
233 switch (d->currentChannel)
234 {
235 case GreenChannel:
236 {
237 d->mixerSettings.greenRedGain = 0.0;
238 d->mixerSettings.greenGreenGain = 1.0;
239 d->mixerSettings.greenBlueGain = 0.0;
240 break;
241 }
242
243 case BlueChannel:
244 {
245 d->mixerSettings.blueRedGain = 0.0;
246 d->mixerSettings.blueGreenGain = 0.0;
247 d->mixerSettings.blueBlueGain = 1.0;
248 break;
249 }
250
251 default: // Red or monochrome.
252 {
253 if (d->monochrome->isChecked())
254 {
255 d->mixerSettings.blackRedGain = 1.0;
256 d->mixerSettings.blackGreenGain = 0.0;
257 d->mixerSettings.blackBlueGain = 0.0;
258 }
259 else
260 {
261 d->mixerSettings.redRedGain = 1.0;
262 d->mixerSettings.redGreenGain = 0.0;
263 d->mixerSettings.redBlueGain = 0.0;
264 }
265
266 break;
267 }
268 }
269
270 updateSettingsWidgets();
271 Q_EMIT signalSettingsChanged();
272}
273
274void MixerSettings::slotGainsChanged()
275{
276 switch (d->currentChannel)
277 {
278 case GreenChannel:
279 {
280 d->mixerSettings.greenRedGain = d->redGain->value() / 100.0;
281 d->mixerSettings.greenGreenGain = d->greenGain->value() / 100.0;
282 d->mixerSettings.greenBlueGain = d->blueGain->value() / 100.0;
283 break;
284 }
285
286 case BlueChannel:
287 {
288 d->mixerSettings.blueRedGain = d->redGain->value() / 100.0;
289 d->mixerSettings.blueGreenGain = d->greenGain->value() / 100.0;
290 d->mixerSettings.blueBlueGain = d->blueGain->value() / 100.0;
291 break;
292 }
293
294 default: // Red or monochrome.
295 {
296 if (d->monochrome->isChecked())
297 {
298 d->mixerSettings.blackRedGain = d->redGain->value() / 100.0;
299 d->mixerSettings.blackGreenGain = d->greenGain->value() / 100.0;
300 d->mixerSettings.blackBlueGain = d->blueGain->value() / 100.0;
301 }
302 else
303 {
304 d->mixerSettings.redRedGain = d->redGain->value() / 100.0;
305 d->mixerSettings.redGreenGain = d->greenGain->value() / 100.0;
306 d->mixerSettings.redBlueGain = d->blueGain->value() / 100.0;
307 }
308
309 break;
310 }
311 }
312
313 updateTotalPercents();
314 Q_EMIT signalSettingsChanged();
315}
316
317void MixerSettings::updateTotalPercents()
318{
319 double total = d->redGain->value() + d->greenGain->value() + d->blueGain->value();
320 QString str;
321 d->totalPercents->setText(i18nc("@info: progress", "Total: %1 (%)", str.asprintf("%3.1f", total))i18ndc("digikam", "@info: progress", "Total: %1 (%)", str.asprintf
("%3.1f", total))
);
322}
323
324void MixerSettings::updateSettingsWidgets()
325{
326 d->monochrome->blockSignals(true);
327 d->preserveLuminosity->blockSignals(true);
328 d->redGain->blockSignals(true);
329 d->greenGain->blockSignals(true);
330 d->blueGain->blockSignals(true);
331
332 switch (d->currentChannel)
333 {
334 case GreenChannel:
335 {
336 d->redGain->setDefaultValue(0);
337 d->greenGain->setDefaultValue(100);
338 d->blueGain->setDefaultValue(0);
339 d->redGain->setValue(d->mixerSettings.greenRedGain * 100.0);
340 d->greenGain->setValue(d->mixerSettings.greenGreenGain * 100.0);
341 d->blueGain->setValue(d->mixerSettings.greenBlueGain * 100.0);
342 break;
343 }
344
345 case BlueChannel:
346 {
347 d->redGain->setDefaultValue(0);
348 d->greenGain->setDefaultValue(0);
349 d->blueGain->setDefaultValue(100);
350 d->redGain->setValue(d->mixerSettings.blueRedGain * 100.0);
351 d->greenGain->setValue(d->mixerSettings.blueGreenGain * 100.0);
352 d->blueGain->setValue(d->mixerSettings.blueBlueGain * 100.0);
353 break;
354 }
355
356 default: // Red or monochrome.
357 {
358 if (d->monochrome->isChecked())
359 {
360 d->redGain->setDefaultValue(100);
361 d->greenGain->setDefaultValue(0);
362 d->blueGain->setDefaultValue(0);
363 d->redGain->setValue(d->mixerSettings.blackRedGain * 100.0);
364 d->greenGain->setValue(d->mixerSettings.blackGreenGain * 100.0);
365 d->blueGain->setValue(d->mixerSettings.blackBlueGain * 100.0);
366 }
367 else
368 {
369 d->redGain->setDefaultValue(100);
370 d->greenGain->setDefaultValue(0);
371 d->blueGain->setDefaultValue(0);
372 d->redGain->setValue(d->mixerSettings.redRedGain * 100.0);
373 d->greenGain->setValue(d->mixerSettings.redGreenGain * 100.0);
374 d->blueGain->setValue(d->mixerSettings.redBlueGain * 100.0);
375 }
376
377 break;
378 }
379 }
380
381 d->monochrome->setChecked(d->mixerSettings.bMonochrome);
382 d->preserveLuminosity->setChecked(d->mixerSettings.bPreserveLum);
383 updateTotalPercents();
384
385 d->monochrome->blockSignals(false);
386 d->preserveLuminosity->blockSignals(false);
387 d->redGain->blockSignals(false);
388 d->greenGain->blockSignals(false);
389 d->blueGain->blockSignals(false);
390}
391
392void MixerSettings::slotMonochromeActived(bool mono)
393{
394 d->mixerSettings.bMonochrome = mono;
395 d->monochromeTips->setEnabled(mono);
396
397 d->outChannelLabel->setEnabled(!mono);
398 d->outChannelCB->setEnabled(!mono);
399 int id = d->outChannelCB->findData(QVariant(RedChannel));
400 d->outChannelCB->setCurrentIndex(id);
401 slotOutChannelChanged();
402
403 Q_EMIT signalMonochromeActived(mono);
404 Q_EMIT signalSettingsChanged();
405}
406
407void MixerSettings::slotLuminosityChanged(bool lum)
408{
409 d->mixerSettings.bPreserveLum = lum;
410
411 Q_EMIT signalSettingsChanged();
412}
413
414MixerContainer MixerSettings::settings() const
415{
416 return d->mixerSettings;
417}
418
419void MixerSettings::setSettings(const MixerContainer& settings)
420{
421 blockSignals(true);
422 d->mixerSettings = settings;
423 updateSettingsWidgets();
424 slotMonochromeActived(d->mixerSettings.bMonochrome);
425 blockSignals(false);
426}
427
428void MixerSettings::resetToDefault()
429{
430 setSettings(defaultSettings());
431}
432
433MixerContainer MixerSettings::defaultSettings() const
434{
435 MixerContainer prm;
436
437 prm.bMonochrome = false;
438 prm.bPreserveLum = true;
439
440 prm.redRedGain = 1.0;
441 prm.redGreenGain = 0.0;
442 prm.redBlueGain = 0.0;
443
444 prm.greenRedGain = 0.0;
445 prm.greenGreenGain = 1.0;
446 prm.greenBlueGain = 0.0;
447
448 prm.blueRedGain = 0.0;
449 prm.blueGreenGain = 0.0;
450 prm.blueBlueGain = 1.0;
451
452 prm.blackRedGain = 1.0;
453 prm.blackGreenGain = 0.0;
454 prm.blackBlueGain = 0.0;
455
456 return prm;
457}
458
459void MixerSettings::readSettings(const KConfigGroup& group)
460{
461 MixerContainer prm;
462 MixerContainer defaultPrm = defaultSettings();
463
464 prm.bMonochrome = group.readEntry(d->configMonochromeEntry, defaultPrm.bMonochrome);
465 prm.bPreserveLum = group.readEntry(d->configPreserveLuminosityEntry, defaultPrm.bPreserveLum);
466
467 prm.redRedGain = group.readEntry(d->configRedRedGainEntry, defaultPrm.redRedGain);
468 prm.redGreenGain = group.readEntry(d->configRedGreenGainEntry, defaultPrm.redGreenGain);
469 prm.redBlueGain = group.readEntry(d->configRedBlueGainEntry, defaultPrm.redBlueGain);
470
471 prm.greenRedGain = group.readEntry(d->configGreenRedGainEntry, defaultPrm.greenRedGain);
472 prm.greenGreenGain = group.readEntry(d->configGreenGreenGainEntry, defaultPrm.greenGreenGain);
473 prm.greenBlueGain = group.readEntry(d->configGreenBlueGainEntry, defaultPrm.greenBlueGain);
474
475 prm.blueRedGain = group.readEntry(d->configBlueRedGainEntry, defaultPrm.blueRedGain);
476 prm.blueGreenGain = group.readEntry(d->configBlueGreenGainEntry, defaultPrm.blueGreenGain);
477 prm.blueBlueGain = group.readEntry(d->configBlueBlueGainEntry, defaultPrm.blueBlueGain);
478
479 prm.blackRedGain = group.readEntry(d->configBlackRedGainEntry, defaultPrm.blackRedGain);
480 prm.blackGreenGain = group.readEntry(d->configBlackGreenGainEntry, defaultPrm.blackGreenGain);
481 prm.blackBlueGain = group.readEntry(d->configBlackBlueGainEntry, defaultPrm.blackBlueGain);
482
483 setSettings(prm);
484}
485
486void MixerSettings::writeSettings(KConfigGroup& group)
487{
488 MixerContainer prm = settings();
489
490 group.writeEntry(d->configMonochromeEntry, prm.bMonochrome);
491 group.writeEntry(d->configPreserveLuminosityEntry, prm.bPreserveLum);
492
493 group.writeEntry(d->configRedRedGainEntry, prm.redRedGain);
494 group.writeEntry(d->configRedGreenGainEntry, prm.redGreenGain);
495 group.writeEntry(d->configRedBlueGainEntry, prm.redBlueGain);
496
497 group.writeEntry(d->configGreenRedGainEntry, prm.greenRedGain);
498 group.writeEntry(d->configGreenGreenGainEntry, prm.greenGreenGain);
499 group.writeEntry(d->configGreenBlueGainEntry, prm.greenBlueGain);
500
501 group.writeEntry(d->configBlueRedGainEntry, prm.blueRedGain);
502 group.writeEntry(d->configBlueGreenGainEntry, prm.blueGreenGain);
503 group.writeEntry(d->configBlueBlueGainEntry, prm.blueBlueGain);
504
505 group.writeEntry(d->configBlackRedGainEntry, prm.blackRedGain);
506 group.writeEntry(d->configBlackGreenGainEntry, prm.blackGreenGain);
507 group.writeEntry(d->configBlackBlueGainEntry, prm.blackBlueGain);
508}
509
510void MixerSettings::loadSettings()
511{
512 QUrl loadGainsFileUrl;
513 FILE* fp = nullptr;
514 MixerContainer settings;
515
516 loadGainsFileUrl = DFileDialog::getOpenFileUrl(qApp(static_cast<QApplication *>(QCoreApplication::instance
()))
->activeWindow(), i18nc("@title:window", "Select Gimp Gains Mixer File to Load")i18ndc("digikam", "@title:window", "Select Gimp Gains Mixer File to Load"
)
,
517 QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)),
518 QLatin1String("*"));
519
520 if (loadGainsFileUrl.isEmpty())
1
Assuming the condition is false
2
Taking false branch
521 {
522 return;
523 }
524
525#ifdef Q_OS_WIN
526
527 fp = _wfopen((const wchar_t*)loadGainsFileUrl.toLocalFile().utf16(), L"r");
528
529#else
530
531 fp = fopen(loadGainsFileUrl.toLocalFile().toUtf8().constData(), "r");
532
533#endif
534
535 if (fp
2.1
'fp' is non-null
)
3
Taking true branch
536 {
537 char buf1[1024];
538 char buf2[1024];
539 char buf3[1024];
540
541 buf1[0] = '\0';
542
543 fgets(buf1, 1023, fp);
4
Assuming stream reaches end-of-file here
544
545 fscanf(fp, "%*s %256s", buf1);
5
Read function called when stream is in EOF state. Function has no effect
546 fscanf(fp, "%*s %256s", buf1); // preview flag, preserved for compatibility
547 fscanf(fp, "%*s %256s", buf1);
548
549 if (strcmp(buf1, "true") == 0)
550 {
551 settings.bMonochrome = true;
552 }
553 else
554 {
555 settings.bMonochrome = false;
556 }
557
558 fscanf(fp, "%*s %256s", buf1);
559
560 if (strcmp(buf1, "true") == 0)
561 {
562 settings.bPreserveLum = true;
563 }
564 else
565 {
566 settings.bPreserveLum = false;
567 }
568
569 fscanf(fp, "%*s %256s %256s %256s", buf1, buf2, buf3);
570 settings.redRedGain = atof(buf1);
571 settings.redGreenGain = atof(buf2);
572 settings.redBlueGain = atof(buf3);
573
574 fscanf(fp, "%*s %256s %256s %256s", buf1, buf2, buf3);
575 settings.greenRedGain = atof(buf1);
576 settings.greenGreenGain = atof(buf2);
577 settings.greenBlueGain = atof(buf3);
578
579 fscanf(fp, "%*s %256s %256s %256s", buf1, buf2, buf3);
580 settings.blueRedGain = atof(buf1);
581 settings.blueGreenGain = atof(buf2);
582 settings.blueBlueGain = atof(buf3);
583
584 fscanf(fp, "%*s %256s %256s %256s", buf1, buf2, buf3);
585 settings.blackRedGain = atof(buf1);
586 settings.blackGreenGain = atof(buf2);
587 settings.blackBlueGain = atof(buf3);
588
589 fclose(fp);
590
591 setSettings(settings);
592 }
593 else
594 {
595 QMessageBox::critical(qApp(static_cast<QApplication *>(QCoreApplication::instance
()))
->activeWindow(), qApp(static_cast<QApplication *>(QCoreApplication::instance
()))
->applicationName(),
596 i18nc("@info", "Cannot load settings from the Gains Mixer text file.")i18ndc("digikam", "@info", "Cannot load settings from the Gains Mixer text file."
)
);
597 return;
598 }
599}
600
601void MixerSettings::saveAsSettings()
602{
603 QUrl saveGainsFileUrl;
604 FILE* fp = nullptr;
605
606 saveGainsFileUrl = DFileDialog::getSaveFileUrl(qApp(static_cast<QApplication *>(QCoreApplication::instance
()))
->activeWindow(), i18nc("@title:window", "Gimp Gains Mixer File to Save")i18ndc("digikam", "@title:window", "Gimp Gains Mixer File to Save"
)
,
607 QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)),
608 QLatin1String("*"));
609
610 if (saveGainsFileUrl.isEmpty())
611 {
612 return;
613 }
614
615#ifdef Q_OS_WIN
616
617 fp = _wfopen((const wchar_t*)saveGainsFileUrl.toLocalFile().utf16(), L"w");
618
619#else
620
621 fp = fopen(saveGainsFileUrl.toLocalFile().toUtf8().constData(), "w");
622
623#endif
624
625 if (fp)
626 {
627 const char* str = nullptr;
628 char buf1[256];
629 char buf2[256];
630 char buf3[256];
631
632 switch (d->currentChannel)
633 {
634 case RedChannel:
635 str = "RED";
636 break;
637
638 case GreenChannel:
639 str = "GREEN";
640 break;
641
642 case BlueChannel:
643 str = "BLUE";
644 break;
645
646 default:
647 qCWarning(DIGIKAM_DIMG_LOG)for (QLoggingCategoryMacroHolder<QtWarningMsg> qt_category
((DIGIKAM_DIMG_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/devel/8.x/core/libs/dimg/filters/bw/mixersettings.cpp"
), 647, static_cast<const char *>(__PRETTY_FUNCTION__),
qt_category.name()).warning()
<< "Unknown Color channel gains";
648 break;
649 }
650
651 fprintf(fp, "# Channel Mixer Configuration File\n");
652
653 fprintf(fp, "CHANNEL: %s\n", str);
654 fprintf(fp, "PREVIEW: %s\n", "true"); // preserved for compatibility
655 fprintf(fp, "MONOCHROME: %s\n",
656 d->mixerSettings.bMonochrome ? "true" : "false");
657 fprintf(fp, "PRESERVE_LUMINOSITY: %s\n",
658 d->mixerSettings.bPreserveLum ? "true" : "false");
659
660 snprintf(buf1, sizeof(buf1), "%5.3f", d->mixerSettings.redRedGain);
661 snprintf(buf2, sizeof(buf2), "%5.3f", d->mixerSettings.redGreenGain);
662 snprintf(buf3, sizeof(buf3), "%5.3f", d->mixerSettings.redBlueGain);
663 fprintf(fp, "RED: %s %s %s\n", buf1, buf2, buf3);
664
665 snprintf(buf1, sizeof(buf1), "%5.3f", d->mixerSettings.greenRedGain);
666 snprintf(buf2, sizeof(buf2), "%5.3f", d->mixerSettings.greenGreenGain);
667 snprintf(buf3, sizeof(buf3), "%5.3f", d->mixerSettings.greenBlueGain);
668 fprintf(fp, "GREEN: %s %s %s\n", buf1, buf2, buf3);
669
670 snprintf(buf1, sizeof(buf1), "%5.3f", d->mixerSettings.blueRedGain);
671 snprintf(buf2, sizeof(buf2), "%5.3f", d->mixerSettings.blueGreenGain);
672 snprintf(buf3, sizeof(buf3), "%5.3f", d->mixerSettings.blueBlueGain);
673 fprintf(fp, "BLUE: %s %s %s\n", buf1, buf2, buf3);
674
675 snprintf(buf1, sizeof(buf1), "%5.3f", d->mixerSettings.blackRedGain);
676 snprintf(buf2, sizeof(buf2), "%5.3f", d->mixerSettings.blackGreenGain);
677 snprintf(buf3, sizeof(buf3), "%5.3f", d->mixerSettings.blackBlueGain);
678 fprintf(fp, "BLACK: %s %s %s\n", buf1, buf2, buf3);
679
680 fclose(fp);
681 }
682 else
683 {
684 QMessageBox::critical(qApp(static_cast<QApplication *>(QCoreApplication::instance
()))
->activeWindow(), qApp(static_cast<QApplication *>(QCoreApplication::instance
()))
->applicationName(),
685 i18nc("@info", "Cannot save settings to the Gains Mixer text file.")i18ndc("digikam", "@info", "Cannot save settings to the Gains Mixer text file."
)
);
686 return;
687 }
688}
689
690} // namespace Digikam
691
692#include "moc_mixersettings.cpp"