Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kquickimageeditor for openSUSE:Factory checked in at 2024-03-11 15:31:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kquickimageeditor (Old) and /work/SRC/openSUSE:Factory/.kquickimageeditor.new.1770 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kquickimageeditor" Mon Mar 11 15:31:56 2024 rev:4 rq:1153262 version:0.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kquickimageeditor/kquickimageeditor.changes 2021-10-08 00:06:51.405835329 +0200 +++ /work/SRC/openSUSE:Factory/.kquickimageeditor.new.1770/kquickimageeditor.changes 2024-03-11 15:38:08.371712060 +0100 @@ -1,0 +2,17 @@ +Thu Feb 29 14:07:34 UTC 2024 - Christophe Marin <christo...@krop.fr> + +- Update to 0.3.0 + * Don't preprocess QML files + * Show header in qtc6 + * We need to use Qt5Compat.GraphicalEffects in qt6 + * Add CMakePresets.json + * Ignore build dir + * Remove smooth property + * Don't include GNUInstallDirs + * Fix Qt version in CMake Config + * Enable building against Qt6 + * Port to ecm_add_qml_module + * Update example +- Add kquickimageeditor6, required by neochat + +------------------------------------------------------------------- Old: ---- kquickimageeditor-0.2.0.tar.xz kquickimageeditor-0.2.0.tar.xz.sig New: ---- _multibuild kquickimageeditor-0.3.0.tar.xz kquickimageeditor-0.3.0.tar.xz.sig kquickimageeditor6.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kquickimageeditor.spec ++++++ --- /var/tmp/diff_new_pack.ZGK5va/_old 2024-03-11 15:38:08.891731211 +0100 +++ /var/tmp/diff_new_pack.ZGK5va/_new 2024-03-11 15:38:08.891731211 +0100 @@ -1,7 +1,7 @@ # # spec file for package kquickimageeditor # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,25 +16,24 @@ # -%define _kf5_version 5.79.0 +%define kf5_version 5.91.0 +%define qt5_version 5.15.0 + %bcond_without lang Name: kquickimageeditor -Version: 0.2.0 +Version: 0.3.0 Release: 0 Summary: A set of QtQuick components for image editing License: LGPL-2.1-or-later -Group: System/GUI/KDE URL: https://www.kde.org Source0: https://download.kde.org/stable/kquickimageeditor/%{name}-%{version}.tar.xz %if %{with lang} Source1: https://download.kde.org/stable/kquickimageeditor/%{name}-%{version}.tar.xz.sig Source2: %{name}.keyring %endif -BuildRequires: cmake >= 3.5 -BuildRequires: extra-cmake-modules >= %{_kf5_version} -BuildRequires: kf5-filesystem -BuildRequires: cmake(Qt5Core) >= 5.15.0 -BuildRequires: cmake(Qt5Quick) >= 5.15.0 +BuildRequires: extra-cmake-modules >= %{kf5_version} +BuildRequires: cmake(Qt5Core) >= %{qt5_version} +BuildRequires: cmake(Qt5Quick) >= %{qt5_version} %description KQuickImageEditor is a set of QtQuick components providing basic image editing @@ -42,7 +41,6 @@ %package imports Summary: A set of QtQuick components for image editing -Group: System/GUI/KDE %description imports KQuickImageEditor is a set of QtQuick components providing basic image editing @@ -50,10 +48,8 @@ %package devel Summary: Development files for KQuickImageEditor -Group: Development/Libraries/KDE -Requires: %{name}-imports = %{version} +Requires: kquickimageeditor-imports = %{version} Requires: cmake(Qt5Core) -Requires: cmake(Qt5Quick) %description devel Development files for KQuickImageEditor, a set of QtQuick components providing @@ -64,6 +60,7 @@ %build %cmake_kf5 -d build + %cmake_build %install @@ -77,7 +74,6 @@ %{_kf5_qmldir}/org/kde/kquickimageeditor/ %files devel -%license LICENSES/* %{_kf5_cmakedir}/KQuickImageEditor/ %{_kf5_mkspecsdir}/qt_KQuickImageEditor.pri ++++++ kquickimageeditor6.spec ++++++ # # spec file for package kquickimageeditor6 # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define kf6_version 6.0.0 %define qt6_version 6.6.0 %define rname kquickimageeditor %bcond_without released Name: kquickimageeditor6 Version: 0.3.0 Release: 0 Summary: A set of QtQuick components for image editing License: LGPL-2.1-or-later URL: https://www.kde.org Source0: https://download.kde.org/stable/kquickimageeditor/%{rname}-%{version}.tar.xz %if %{with released} Source1: https://download.kde.org/stable/kquickimageeditor/%{rname}-%{version}.tar.xz.sig Source2: kquickimageeditor.keyring %endif BuildRequires: kf6-extra-cmake-modules >= %{kf6_version} BuildRequires: cmake(Qt6Core) >= %{qt6_version} BuildRequires: cmake(Qt6Quick) >= %{qt6_version} %description KQuickImageEditor is a set of QtQuick components providing basic image editing capabilities. %package imports Summary: A set of QtQuick components for image editing Requires: qt6-qt5compat-imports >= %{qt6_version} %description imports KQuickImageEditor is a set of QtQuick components providing basic image editing capabilities. %package devel Summary: Development files for KQuickImageEditor Requires: kquickimageeditor6-imports = %{version} Requires: cmake(Qt6Core) >= %{qt6_version} Conflicts: kquickimageeditor-devel %description devel Development files for KQuickImageEditor, a set of QtQuick components providing basic image editing capabilities. %prep %autosetup -p1 -n %{rname}-%{version} %build %cmake_kf6 -DBUILD_WITH_QT6:BOOL=TRUE %kf6_build %install %kf6_install %files imports %license LICENSES/* %doc README.md %{_kf6_qmldir}/org/kde/kquickimageeditor/ %files devel %{_kf6_cmakedir}/KQuickImageEditor/ %{_kf6_mkspecsdir}/qt_KQuickImageEditor.pri %changelog ++++++ _multibuild ++++++ <multibuild> <package>kquickimageeditor6</package> </multibuild> ++++++ kquickimageeditor-0.2.0.tar.xz -> kquickimageeditor-0.3.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/.gitignore new/kquickimageeditor-0.3.0/.gitignore --- old/kquickimageeditor-0.2.0/.gitignore 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/.gitignore 2023-11-02 17:00:24.000000000 +0100 @@ -5,5 +5,10 @@ _build *.kate-swp *.swp -build -.clang-format +build*/ +/.clang-format +/compile_commands.json +.clangd +.cache +.idea +/cmake-build* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/.gitlab-ci.yml new/kquickimageeditor-0.3.0/.gitlab-ci.yml --- old/kquickimageeditor-0.2.0/.gitlab-ci.yml 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/.gitlab-ci.yml 2023-11-02 17:00:24.000000000 +0100 @@ -3,3 +3,10 @@ include: - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd-qt6.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml + - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows-qt6.yml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/.kde-ci.yml new/kquickimageeditor-0.3.0/.kde-ci.yml --- old/kquickimageeditor-0.2.0/.kde-ci.yml 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/.kde-ci.yml 2023-11-02 17:00:24.000000000 +0100 @@ -2,6 +2,10 @@ # SPDX-License-Identifier: CC0-1.0 Dependencies: -- 'on': ['@all'] +- 'on': ['Linux/Qt5', 'FreeBSD/Qt5', 'Windows/Qt5', 'Android/Qt5'] 'require': 'frameworks/extra-cmake-modules': '@stable' + +- 'on': ['Linux/Qt6', 'FreeBSD/Qt6', 'Windows/Qt6', 'Android/Qt6'] + 'require': + 'frameworks/extra-cmake-modules': '@latest-kf6' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/CMakeLists.txt new/kquickimageeditor-0.3.0/CMakeLists.txt --- old/kquickimageeditor-0.2.0/CMakeLists.txt 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/CMakeLists.txt 2023-11-02 17:00:24.000000000 +0100 @@ -4,15 +4,15 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.79.0") +set(KF5_VERSION "5.91.0") set(REQUIRED_QT_VERSION 5.15.0) +set(KDE_COMPILERSETTINGS_LEVEL 5.84.0) -project(KQuickImageEditor LANGUAGES CXX VERSION 0.2.0) +project(KQuickImageEditor LANGUAGES CXX VERSION 0.3.0) find_package(ECM ${KF5_VERSION} NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) -include(GNUInstallDirs) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) @@ -23,6 +23,7 @@ include(ECMGenerateQmlTypes) include(CMakePackageConfigHelpers) include(KDEPackageAppTemplates) +include(ECMQmlModule) set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KQuickImageEditor") @@ -30,7 +31,7 @@ "${CMAKE_CURRENT_SOURCE_DIR}/KQuickImageEditorConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KQuickImageEditorConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} - PATH_VARS KF5_INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX + PATH_VARS CMAKE_INSTALL_PREFIX ) install(FILES @@ -48,7 +49,7 @@ ) -find_package(Qt5 ${REQUIRED_QT_VERSION} COMPONENTS Core Quick REQUIRED) +find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} COMPONENTS Core Quick REQUIRED) add_subdirectory(src) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/CMakePresets.json new/kquickimageeditor-0.3.0/CMakePresets.json --- old/kquickimageeditor-0.2.0/CMakePresets.json 1970-01-01 01:00:00.000000000 +0100 +++ new/kquickimageeditor-0.3.0/CMakePresets.json 2023-11-02 17:00:24.000000000 +0100 @@ -0,0 +1,224 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "base", + "displayName": "base preset", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-${presetName}", + "installDir": "$env{KF5}", + "hidden": true + }, + { + "name": "base-qt6", + "displayName": "base preset", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-${presetName}", + "installDir": "$env{KF6}", + "hidden": true + }, + { + "name": "dev-mold", + "displayName": "Build as debug + using mold linker", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_SHARED_LINKER_FLAGS": "-fuse-ld=mold" + }, + "inherits": [ + "base" + ] + }, + { + "name": "dev", + "displayName": "Build as debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "inherits": [ + "base" + ] + }, + { + "name": "dev-qt6", + "displayName": "Build against qt6", + "binaryDir": "${sourceDir}/build-qt6", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "BUILD_WITH_QT6": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "inherits": [ + "base-qt6" + ] + }, + { + "name": "asan", + "displayName": "Build with Asan support.", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "ECM_ENABLE_SANITIZERS" : "'address;undefined'" + }, + "inherits": [ + "base" + ] + }, + { + "name": "dev-clang", + "displayName": "dev-clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + }, + "environment": { + "CXX": "clang++", + "CCACHE_DISABLE": "ON" + }, + "inherits": [ + "base" + ] + }, + { + "name": "unity", + "displayName": "Build with CMake unity support.", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_UNITY_CMAKE_SUPPORT": "ON" + }, + "inherits": [ + "base" + ] + }, + { + "name": "release", + "displayName": "Build as release mode.", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + }, + "inherits": [ + "base" + ] + }, + { + "name": "profile", + "displayName": "profile", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + }, + "inherits": [ + "base" + ] + }, + { + "name": "coverage", + "displayName": "coverage", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_UNITY_CMAKE_SUPPORT": "OFF", + "BUILD_COVERAGE": "ON" + }, + "inherits": [ + "base" + ] + }, + { + "name": "clazy", + "displayName": "clazy", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + }, + "environment": { + "CXX": "clazy", + "CCACHE_DISABLE": "ON" + }, + "inherits": [ + "base" + ] + }, + { + "name": "pch", + "displayName": "pch", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_PRECOMPILED_HEADERS": "ON", + "BUILD_COVERAGE": "ON" + }, + "inherits": [ + "base" + ] + } + ], + "buildPresets": [ + { + "name": "dev", + "configurePreset": "dev" + }, + { + "name": "dev-mold", + "configurePreset": "dev-mold" + }, + { + "name": "dev-qt6", + "configurePreset": "dev-qt6" + }, + { + "name": "dev-clang", + "configurePreset": "dev-clang" + }, + { + "name": "pch", + "configurePreset": "pch" + }, + { + "name": "release", + "configurePreset": "release" + }, + { + "name": "unity", + "configurePreset": "unity" + }, + { + "name": "coverage", + "configurePreset": "coverage" + }, + { + "name": "asan", + "configurePreset": "asan" + }, + { + "name": "clazy", + "configurePreset": "clazy", + "environment": { + "CLAZY_CHECKS" : "level0,level1,detaching-member,ifndef-define-typo,isempty-vs-count,qrequiredresult-candidates,reserve-candidates,signal-with-return-value,unneeded-cast,function-args-by-ref,function-args-by-value,returning-void-expression,no-ctor-missing-parent-argument,isempty-vs-count,qhash-with-char-pointer-key,raw-environment-function,qproperty-type-mismatch,old-style-connect,qstring-allocations,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,qstring-varargs,level2,detaching-member,heap-allocated-small-trivial-type,isempty-vs-count,qstring-varargs,qvariant-template-instantiation,raw-environment-function,reserve-candidates,signal-with-return-value,thread-with-slots,no-ctor-missing-parent-argument,no-missing-typeinfo", + "CCACHE_DISABLE" : "ON" + } + } + ], + "testPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": false} + }, + { + "name": "asan", + "configurePreset": "asan", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": true} + }, + { + "name": "unity", + "configurePreset": "unity", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": true} + }, + { + "name": "coverage", + "configurePreset": "coverage", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": true} + } + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/KQuickImageEditorConfig.cmake.in new/kquickimageeditor-0.3.0/KQuickImageEditorConfig.cmake.in --- old/kquickimageeditor-0.2.0/KQuickImageEditorConfig.cmake.in 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/KQuickImageEditorConfig.cmake.in 2023-11-02 17:00:24.000000000 +0100 @@ -4,7 +4,7 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) -find_dependency(Qt5Core @REQUIRED_QT_VERSION@) +find_dependency(Qt@QT_MAJOR_VERSION@Core @REQUIRED_QT_VERSION@) # Any changes in this ".cmake" file will be overwritten by CMake, the source is the ".cmake.in" file. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/examples/KirigamiExample.qml new/kquickimageeditor-0.3.0/examples/KirigamiExample.qml --- old/kquickimageeditor-0.2.0/examples/KirigamiExample.qml 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/examples/KirigamiExample.qml 2023-11-02 17:00:24.000000000 +0100 @@ -27,72 +27,200 @@ Component { id: editorComponent + Kirigami.Page { id: rootEditorView - title: i18n("Edit") - leftPadding: 0 - rightPadding: 0 - - Shortcut { - sequence: StandardKey.Undo - onActivated: undoAction.trigger(); - } - - Shortcut { - sequences: [StandardKey.Save, "Enter"] - onActivated: saveAction.trigger(); - } - - Shortcut { - sequence: StandardKey.SaveAs - onActivated: saveAsAction.trigger(); - } property bool resizing: false; - property string imagePath: "/usr/share/wallpapers/Next/contents/images/5120x2880.jpg"; + property string imagePath: '/usr/share/wallpapers/Next/contents/images/5120x2880.jpg' + + signal imageEdited(); + + title: "Edit" + leftPadding: 0 + rightPadding: 0 + topPadding: 0 + bottomPadding: 0 function crop() { - const ratioX = editImage.paintedWidth / editImage.nativeWidth; - const ratioY = editImage.paintedHeight / editImage.nativeHeight; rootEditorView.resizing = false - imageDoc.crop(resizeRectangle.insideX / ratioX, resizeRectangle.insideY / ratioY, resizeRectangle.insideWidth / ratioX, resizeRectangle.insideHeight / ratioY); + imageDoc.crop(selectionTool.selectionX / editImage.ratioX, + selectionTool.selectionY / editImage.ratioY, + selectionTool.selectionWidth / editImage.ratioX, + selectionTool.selectionHeight / editImage.ratioY); } actions { - right: Kirigami.Action { + main: Kirigami.Action { + id: saveAction + visible: imageDoc.edited + text: "Save" + iconName: "document-save" + onTriggered: { + if (!imageDoc.save()) { + msg.type = Kirigami.MessageType.Error + msg.text = "Unable to save file. Check if you have the correct permission to edit this file." + msg.visible = true; + } + rootEditorView.imageEdited(); + applicationWindow().pageStack.layers.pop(); + } + } + left: Kirigami.Action { id: undoAction - text: i18nc("@action:button Undo modification", "Undo") + text: "Undo" iconName: "edit-undo" - onTriggered: imageDoc.undo(); + onTriggered: { + if (imageDoc.edited) { + imageDoc.undo(); + } + } visible: imageDoc.edited } contextualActions: [ Kirigami.Action { - id: saveAction - text: i18nc("@action:button Save the image as a new image", "Save As") - iconName: "document-save-as" - onTriggered: fileDialog.visible = true; - }, - Kirigami.Action { - id: saveAsAction - text: i18nc("@action:button Save the image", "Save") - iconName: "document-save" - onTriggered: { - if (!imageDoc.save()) { - msg.type = Kirigami.MessageType.Error - msg.text = i18n("Unable to save file. Check if you have the correct permission to edit this file.") - msg.visible = true; - } + iconName: rootEditorView.resizing ? "dialog-ok" : "transform-crop" + text: rootEditorView.resizing ? "Accept" : "Crop" + onTriggered: rootEditorView.resizing = !rootEditorView.resizing; + }, + Kirigami.Action { + iconName: "dialog-cancel" + visible: rootEditorView.resizing + text: "Cancel" + onTriggered: rootEditorView.resizing = !rootEditorView.resizing + }, + Kirigami.Action { + iconName: "object-rotate-left" + text: "Rotate left"; + onTriggered: imageDoc.rotate(-90); + visible: !rootEditorView.resizing + }, + Kirigami.Action { + iconName: "object-rotate-right" + text: "@action:button Rotate an image to the right", "Rotate right"; + onTriggered: imageDoc.rotate(90); + visible: !rootEditorView.resizing + }, + Kirigami.Action { + iconName: "object-flip-vertical" + text: "Flip" + onTriggered: imageDoc.mirror(false, true); + visible: !rootEditorView.resizing + }, + Kirigami.Action { + iconName: "object-flip-horizontal" + text: "Mirror" + onTriggered: imageDoc.mirror(true, false); + visible: !rootEditorView.resizing + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: QQC2.ToolSeparator { + leftPadding: Kirigami.Units.largeSpacing + rightPadding: leftPadding + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: QQC2.Label { + text: "Size:" + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: EditorSpinBox { + minimumContentWidth: widthTextMetrics.width + from: 1 + to: editImage.nativeWidth + value: selectionTool.selectionWidth / editImage.ratioX + onValueModified: selectionTool.selectionWidth = value * editImage.ratioX + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: EditorSpinBox { + minimumContentWidth: heightTextMetrics.width + from: 1 + to: editImage.nativeHeight + value: selectionTool.selectionHeight / editImage.ratioY + onValueModified: selectionTool.selectionHeight = value * editImage.ratioY + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: Item { + implicitWidth: Kirigami.Units.largeSpacing + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: QQC2.Label { + text: "Position:" + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: EditorSpinBox { + minimumContentWidth: widthTextMetrics.width + from: 0 + to: editImage.nativeWidth - (selectionTool.selectionWidth / editImage.ratioX) + value: selectionTool.selectionX / editImage.ratioX + onValueModified: selectionTool.selectionX = value * editImage.ratioX + } + }, + Kirigami.Action { + visible: rootEditorView.resizing + displayComponent: EditorSpinBox { + minimumContentWidth: heightTextMetrics.width + from: 0 + to: editImage.nativeHeight - (selectionTool.selectionHeight / editImage.ratioY) + value: selectionTool.selectionY / editImage.ratioY + onValueModified: selectionTool.selectionY = value * editImage.ratioY } - visible: imageDoc.edited } ] } + TextMetrics { + id: widthTextMetrics + text: editImage.nativeWidth.toLocaleString(rootEditorView.locale, 'f', 0) + } + + TextMetrics { + id: heightTextMetrics + text: editImage.nativeHeight.toLocaleString(rootEditorView.locale, 'f', 0) + } + + component EditorSpinBox : QQC2.SpinBox { + id: control + property real minimumContentWidth: 0 + contentItem: QQC2.TextField { + id: textField + implicitWidth: control.minimumContentWidth + leftPadding + rightPadding + 2 + implicitHeight: Math.ceil(contentHeight) + topPadding + bottomPadding + palette: control.palette + leftPadding: control.spacing + rightPadding: control.spacing + topPadding: 0 + bottomPadding: 0 + text: control.displayText + font: control.font + color: Kirigami.Theme.textColor + selectionColor: Kirigami.Theme.highlightColor + selectedTextColor: Kirigami.Theme.highlightedTextColor + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + readOnly: !control.editable + validator: control.validator + inputMethodHints: control.inputMethodHints + selectByMouse: true + background: null + } + } FileDialog { id: fileDialog - title: i18n("Save As") + title: "Save As" folder: shortcuts.home selectMultiple: false selectExisting: false @@ -100,11 +228,11 @@ if (imageDoc.saveAs(fileDialog.fileUrl)) {; imagePath = fileDialog.fileUrl; msg.type = Kirigami.MessageType.Information - msg.text = i18n("You are now editing a new file.") + msg.text = "You are now editing a new file." msg.visible = true; } else { msg.type = Kirigami.MessageType.Error - msg.text = i18n("Unable to save file. Check if you have the correct permission to edit this file.") + msg.text = "Unable to save file. Check if you have the correct permission to edit this file." msg.visible = true; } fileDialog.close() @@ -114,117 +242,75 @@ } Component.onCompleted: visible = false } - - KQuickImageEditor.ImageDocument { - id: imageDoc - path: rootEditorView.imagePath - } KQuickImageEditor.ImageItem { id: editImage + readonly property real ratioX: editImage.paintedWidth / editImage.nativeWidth; + readonly property real ratioY: editImage.paintedHeight / editImage.nativeHeight; + + // Assigning this to the contentItem and setting the padding causes weird positioning issues + anchors.fill: parent + anchors.margins: Kirigami.Units.gridUnit fillMode: KQuickImageEditor.ImageItem.PreserveAspectFit image: imageDoc.image - anchors.fill: parent - } - header: QQC2.ToolBar { - contentItem: Kirigami.ActionToolBar { - id: actionToolBar - display: QQC2.Button.TextBesideIcon - actions: [ - Kirigami.Action { - iconName: rootEditorView.resizing ? "dialog-cancel" : "transform-crop" - text: rootEditorView.resizing ? i18n("Cancel") : i18nc("@action:button Crop an image", "Crop"); - onTriggered: { - console.log(editImage.verticalPadding); - console.log(editImage.horizontalPadding); - resizeRectangle.width = editImage.paintedWidth - resizeRectangle.height = editImage.paintedHeight - resizeRectangle.x = 0 - resizeRectangle.y = editImage.verticalPadding - resizeRectangle.insideX = 100 - resizeRectangle.insideY = 100 - resizeRectangle.insideWidth = 100 - resizeRectangle.insideHeight = 100 - rootEditorView.resizing = !rootEditorView.resizing; - } - }, - Kirigami.Action { - iconName: "dialog-ok" - visible: rootEditorView.resizing - text: i18nc("@action:button Rotate an image to the right", "Crop"); - onTriggered: rootEditorView.crop(); - }, - Kirigami.Action { - iconName: "object-rotate-left" - text: i18nc("@action:button Rotate an image to the left", "Rotate left"); - onTriggered: imageDoc.rotate(-90); - visible: !rootEditorView.resizing - }, - Kirigami.Action { - iconName: "object-rotate-right" - text: i18nc("@action:button Rotate an image to the right", "Rotate right"); - onTriggered: imageDoc.rotate(90); - visible: !rootEditorView.resizing - }, - Kirigami.Action { - iconName: "object-flip-vertical" - text: i18nc("@action:button Mirror an image vertically", "Flip"); - onTriggered: imageDoc.mirror(false, true); - visible: !rootEditorView.resizing - }, - Kirigami.Action { - iconName: "object-flip-horizontal" - text: i18nc("@action:button Mirror an image horizontally", "Mirror"); - onTriggered: imageDoc.mirror(true, false); - visible: !rootEditorView.resizing + Shortcut { + sequence: StandardKey.Undo + onActivated: undoAction.trigger(); + } + + Shortcut { + sequences: [StandardKey.Save, "Enter"] + onActivated: saveAction.trigger(); + } + + Shortcut { + sequence: StandardKey.SaveAs + onActivated: saveAsAction.trigger(); + } + + KQuickImageEditor.ImageDocument { + id: imageDoc + path: rootEditorView.imagePath + } + + KQuickImageEditor.SelectionTool { + id: selectionTool + visible: rootEditorView.resizing + width: editImage.paintedWidth + height: editImage.paintedHeight + x: editImage.horizontalPadding + y: editImage.verticalPadding + KQuickImageEditor.CropBackground { + anchors.fill: parent + z: -1 + insideX: selectionTool.selectionX + insideY: selectionTool.selectionY + insideWidth: selectionTool.selectionWidth + insideHeight: selectionTool.selectionHeight + } + Connections { + target: selectionTool.selectionArea + function onDoubleClicked() { + rootEditorView.crop() } - ] + } + } + onImageChanged: { + selectionTool.selectionX = 0 + selectionTool.selectionY = 0 + selectionTool.selectionWidth = Qt.binding(() => selectionTool.width) + selectionTool.selectionHeight = Qt.binding(() => selectionTool.height) } } - + + footer: Kirigami.InlineMessage { id: msg type: Kirigami.MessageType.Error showCloseButton: true visible: false } - - KQuickImageEditor.ResizeRectangle { - id: resizeRectangle - - visible: rootEditorView.resizing - - width: editImage.paintedWidth - height: editImage.paintedHeight - x: 0 - y: editImage.verticalPadding - - insideX: 100 - insideY: 100 - insideWidth: 100 - insideHeight: 100 - - onAcceptSize: rootEditorView.crop(); - - //resizeHandle: KQuickImageEditor.BasicResizeHandle { } - - /*Rectangle { - radius: 2 - width: Kirigami.Units.gridUnit * 8 - height: Kirigami.Units.gridUnit * 3 - anchors.centerIn: parent - Kirigami.Theme.colorSet: Kirigami.Theme.View - color: Kirigami.Theme.backgroundColor - QQC2.Label { - anchors.centerIn: parent - text: "x: " + (resizeRectangle.x - rootEditorView.contentItem.width + editImage.paintedWidth) - + " y: " + (resizeRectangle.y - rootEditorView.contentItem.height + editImage.paintedHeight) - + "\nwidth: " + resizeRectangle.width - + " height: " + resizeRectangle.height - } - }*/ - } } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/CMakeLists.txt new/kquickimageeditor-0.3.0/src/CMakeLists.txt --- old/kquickimageeditor-0.2.0/src/CMakeLists.txt 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/CMakeLists.txt 2023-11-02 17:00:24.000000000 +0100 @@ -2,57 +2,50 @@ # # SPDX-License-Identifier: BSD-2-Clause -set( - sources +ecm_add_qml_module(kquickimageeditorplugin URI "org.kde.kquickimageeditor" VERSION 1.0) + +target_sources(kquickimageeditorplugin PRIVATE code/commands/undocommand.cpp + code/commands/undocommand.h code/commands/cropcommand.cpp + code/commands/cropcommand.h code/commands/resizecommand.cpp + code/commands/resizecommand.h code/commands/mirrorcommand.cpp + code/commands/mirrorcommand.h code/commands/rotatecommand.cpp + code/commands/rotatecommand.h code/kquickimageeditor_plugin.cpp + code/kquickimageeditor_plugin.h code/resizehandle.cpp + code/resizehandle.h code/resizerectangle.cpp + code/resizerectangle.h code/imageitem.cpp + code/imageitem.h code/imagedocument.cpp - resources.qrc - controls/qmldir + code/imagedocument.h ${kquickimageeditor_QM_LOADER} ) -ecm_generate_qmltypes(org.kde.kquickimageeditor 1.0 - DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kquickimageeditor) - -add_library( - kquickimageeditorplugin - SHARED - ${sources} +ecm_target_qml_sources(kquickimageeditorplugin SOURCES + controls/BasicResizeHandle.qml + controls/SelectionTool.qml + controls/qt${QT_MAJOR_VERSION}/SelectionHandle.qml + controls/SelectionBackground.qml + controls/CropBackground.qml + controls/RectangleCutout.qml ) -target_link_libraries( - kquickimageeditorplugin +target_link_libraries(kquickimageeditorplugin PRIVATE - Qt5::Core - Qt5::Quick - Qt5::Qml + Qt${QT_MAJOR_VERSION}::Core + Qt${QT_MAJOR_VERSION}::Quick + Qt${QT_MAJOR_VERSION}::Qml ) -if (BUILD_SHARED_LIBS) - add_custom_target(copy_to_bin ALL - COMMAND ${CMAKE_COMMAND} -E - make_directory ${CMAKE_BINARY_DIR}/bin/org/kde/kquickimageeditor/ - COMMAND ${CMAKE_COMMAND} -E - copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/controls ${CMAKE_BINARY_DIR}/bin/org/kde/kquickimageeditor/ - COMMAND ${CMAKE_COMMAND} -E - copy $<TARGET_FILE:kquickimageeditorplugin> ${CMAKE_BINARY_DIR}/bin/org/kde/kquickimageeditor/ - ) - - install(DIRECTORY controls/ DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kquickimageeditor) - - include(ECMGeneratePriFile) - ecm_generate_pri_file(BASE_NAME KQuickImageEditor LIB_NAME KQuickImageEditor DEPS "core qml quick svg" FILENAME_VAR PRI_FILENAME ) - install(FILES ${PRI_FILENAME} - DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) - -endif() +ecm_finalize_qml_module(kquickimageeditorplugin DESTINATION ${KDE_INSTALL_QMLDIR}) -install(TARGETS kquickimageeditorplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kquickimageeditor ) +include(ECMGeneratePriFile) +ecm_generate_pri_file(BASE_NAME KQuickImageEditor LIB_NAME KQuickImageEditor DEPS "core qml quick svg" FILENAME_VAR PRI_FILENAME ) +install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/code/imageitem.cpp new/kquickimageeditor-0.3.0/src/code/imageitem.cpp --- old/kquickimageeditor-0.2.0/src/code/imageitem.cpp 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/code/imageitem.cpp 2023-11-02 17:00:24.000000000 +0100 @@ -43,20 +43,6 @@ setImage(QImage()); } -void ImageItem::setSmooth(const bool smooth) -{ - if (smooth == m_smooth) { - return; - } - m_smooth = smooth; - update(); -} - -bool ImageItem::smooth() const -{ - return m_smooth; -} - int ImageItem::nativeWidth() const { return m_image.size().width() / m_image.devicePixelRatio(); @@ -90,8 +76,8 @@ return; } painter->save(); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); + painter->setRenderHint(QPainter::Antialiasing, smooth()); + painter->setRenderHint(QPainter::SmoothPixmapTransform, smooth()); if (m_fillMode == TileVertically) { painter->scale(width() / (qreal)m_image.width(), 1); @@ -203,8 +189,14 @@ } } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void ImageItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry); +#else +void ImageItem::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + QQuickPaintedItem::geometryChange(newGeometry, oldGeometry); +#endif updatePaintedRect(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/code/imageitem.h new/kquickimageeditor-0.3.0/src/code/imageitem.h --- old/kquickimageeditor-0.2.0/src/code/imageitem.h 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/code/imageitem.h 2023-11-02 17:00:24.000000000 +0100 @@ -15,7 +15,6 @@ Q_OBJECT Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged RESET resetImage) - Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) Q_PROPERTY(int paintedWidth READ paintedWidth NOTIFY paintedWidthChanged) @@ -43,9 +42,6 @@ QImage image() const; void resetImage(); - void setSmooth(const bool smooth); - bool smooth() const; - int nativeWidth() const; int nativeHeight() const; @@ -73,7 +69,11 @@ void horizontalPaddingChanged(); protected: +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; +#else + void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; +#endif private: QImage m_image; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/code/resizerectangle.cpp new/kquickimageeditor-0.3.0/src/code/resizerectangle.cpp --- old/kquickimageeditor-0.2.0/src/code/resizerectangle.cpp 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/code/resizerectangle.cpp 2023-11-02 17:00:24.000000000 +0100 @@ -155,7 +155,7 @@ node = new QSGGeometryNode; geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), vertexCount, indexCount); geometry->setIndexDataPattern(QSGGeometry::StaticPattern); - geometry->setDrawingMode(GL_TRIANGLES); + geometry->setDrawingMode(QSGGeometry::DrawTriangles); node->setGeometry(geometry); node->setFlag(QSGNode::OwnsGeometry); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/controls/SelectionHandle.qml new/kquickimageeditor-0.3.0/src/controls/SelectionHandle.qml --- old/kquickimageeditor-0.2.0/src/controls/SelectionHandle.qml 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/controls/SelectionHandle.qml 1970-01-01 01:00:00.000000000 +0100 @@ -1,120 +0,0 @@ -/* SPDX-FileCopyrightText: 2021 Noah Davis <noaha...@gmail.com> - * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL - */ - -import QtQuick 2.15 -import QtGraphicalEffects 1.15 -import org.kde.kirigami 2.15 as Kirigami - -MouseArea { - id: root - enum Position { - TopLeft, Top, TopRight, - Left, Right, - BottomLeft, Bottom, BottomRight, - NPositions - } - required property Item target - property int position: SelectionHandle.TopLeft - - readonly property bool leftSide: position === SelectionHandle.TopLeft - || position === SelectionHandle.Left - || position === SelectionHandle.BottomLeft - readonly property bool rightSide: position === SelectionHandle.TopRight - || position === SelectionHandle.Right - || position === SelectionHandle.BottomRight - readonly property bool topSide: position === SelectionHandle.TopLeft - || position === SelectionHandle.Top - || position === SelectionHandle.TopRight - readonly property bool bottomSide: position === SelectionHandle.BottomLeft - || position === SelectionHandle.Bottom - || position === SelectionHandle.BottomRight - readonly property bool horizontalOnly: position === SelectionHandle.Left || position === SelectionHandle.Right - readonly property bool verticalOnly: position === SelectionHandle.Top || position === SelectionHandle.Bottom - // Like forward slash - readonly property bool forwardDiagonal: position === SelectionHandle.TopRight || position === SelectionHandle.BottomLeft - // Like backward slash - readonly property bool backwardDiagonal: position === SelectionHandle.TopLeft || position === SelectionHandle.BottomRight - - property bool lockX: false - property bool lockY: false - - LayoutMirroring.enabled: false - LayoutMirroring.childrenInherit: true - anchors.horizontalCenter: if (!pressed && !lockX) { - if (leftSide) { - target.left - } else if (verticalOnly) { - target.horizontalCenter - } else { - target.right - } - } - anchors.verticalCenter: if (!pressed && !lockY) { - if (topSide) { - target.top - } else if (horizontalOnly) { - target.verticalCenter - } else { - target.bottom - } - } - implicitWidth: graphics.implicitWidth + Kirigami.Units.largeSpacing * 2 - implicitHeight: graphics.implicitHeight + Kirigami.Units.largeSpacing * 2 - width: verticalOnly ? target.width - implicitWidth : implicitWidth - height: horizontalOnly ? target.height - implicitHeight : implicitHeight - cursorShape: if (horizontalOnly) { - Qt.SizeHorCursor - } else if (verticalOnly) { - Qt.SizeVerCursor - } else if (forwardDiagonal) { - // actually oriented like forward slash - Qt.SizeBDiagCursor - } else { - // actually oriented like backward slash - Qt.SizeFDiagCursor - } - drag { - axis: if (horizontalOnly) { - Drag.XAxis - } else if (verticalOnly) { - Drag.YAxis - } else { - Drag.XAndYAxis - } - target: pressed ? root : null - minimumX: -width / 2 - maximumX: parent.width - width / 2 - minimumY: -height / 2 - maximumY: parent.height - height / 2 - threshold: 0 - } - Rectangle { - id: graphics - visible: false - implicitWidth: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2 - implicitHeight: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2 - anchors.centerIn: parent - color: Kirigami.Theme.highlightColor - radius: height / 2 - } - // Has to be the same size as source - Item { - id: maskSource - visible: false - anchors.fill: graphics - Rectangle { - x: root.leftSide ? parent.width - width : 0 - y: root.topSide ? parent.height - height : 0 - width: root.forwardDiagonal || root.backwardDiagonal || root.horizontalOnly ? parent.width / 2 : parent.width - height: root.forwardDiagonal || root.backwardDiagonal || root.verticalOnly ? parent.height / 2 : parent.height - } - } - OpacityMask { - anchors.fill: graphics - cached: true - invert: true - source: graphics - maskSource: maskSource - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/controls/qmldir new/kquickimageeditor-0.3.0/src/controls/qmldir --- old/kquickimageeditor-0.2.0/src/controls/qmldir 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/controls/qmldir 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -module org.kde.kquickimageeditor -plugin kquickimageeditorplugin -classname KQuickImageEditorPlugin -typeinfo plugins.qmltypes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/controls/qmldir.license new/kquickimageeditor-0.3.0/src/controls/qmldir.license --- old/kquickimageeditor-0.2.0/src/controls/qmldir.license 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/controls/qmldir.license 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -SPDX-FileCopyrightText: 2020 Carl Schwan <c...@carlschwan.eu> - -SPDX-License-Identifier: CC0-1.0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/controls/qt5/SelectionHandle.qml new/kquickimageeditor-0.3.0/src/controls/qt5/SelectionHandle.qml --- old/kquickimageeditor-0.2.0/src/controls/qt5/SelectionHandle.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kquickimageeditor-0.3.0/src/controls/qt5/SelectionHandle.qml 2023-11-02 17:00:24.000000000 +0100 @@ -0,0 +1,120 @@ +/* SPDX-FileCopyrightText: 2021 Noah Davis <noaha...@gmail.com> + * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + */ + +import QtQuick 2.15 +import QtGraphicalEffects 1.15 +import org.kde.kirigami 2.15 as Kirigami + +MouseArea { + id: root + enum Position { + TopLeft, Top, TopRight, + Left, Right, + BottomLeft, Bottom, BottomRight, + NPositions + } + required property Item target + property int position: SelectionHandle.TopLeft + + readonly property bool leftSide: position === SelectionHandle.TopLeft + || position === SelectionHandle.Left + || position === SelectionHandle.BottomLeft + readonly property bool rightSide: position === SelectionHandle.TopRight + || position === SelectionHandle.Right + || position === SelectionHandle.BottomRight + readonly property bool topSide: position === SelectionHandle.TopLeft + || position === SelectionHandle.Top + || position === SelectionHandle.TopRight + readonly property bool bottomSide: position === SelectionHandle.BottomLeft + || position === SelectionHandle.Bottom + || position === SelectionHandle.BottomRight + readonly property bool horizontalOnly: position === SelectionHandle.Left || position === SelectionHandle.Right + readonly property bool verticalOnly: position === SelectionHandle.Top || position === SelectionHandle.Bottom + // Like forward slash + readonly property bool forwardDiagonal: position === SelectionHandle.TopRight || position === SelectionHandle.BottomLeft + // Like backward slash + readonly property bool backwardDiagonal: position === SelectionHandle.TopLeft || position === SelectionHandle.BottomRight + + property bool lockX: false + property bool lockY: false + + LayoutMirroring.enabled: false + LayoutMirroring.childrenInherit: true + anchors.horizontalCenter: if (!pressed && !lockX) { + if (leftSide) { + target.left + } else if (verticalOnly) { + target.horizontalCenter + } else { + target.right + } + } + anchors.verticalCenter: if (!pressed && !lockY) { + if (topSide) { + target.top + } else if (horizontalOnly) { + target.verticalCenter + } else { + target.bottom + } + } + implicitWidth: graphics.implicitWidth + Kirigami.Units.largeSpacing * 2 + implicitHeight: graphics.implicitHeight + Kirigami.Units.largeSpacing * 2 + width: verticalOnly ? target.width - implicitWidth : implicitWidth + height: horizontalOnly ? target.height - implicitHeight : implicitHeight + cursorShape: if (horizontalOnly) { + Qt.SizeHorCursor + } else if (verticalOnly) { + Qt.SizeVerCursor + } else if (forwardDiagonal) { + // actually oriented like forward slash + Qt.SizeBDiagCursor + } else { + // actually oriented like backward slash + Qt.SizeFDiagCursor + } + drag { + axis: if (horizontalOnly) { + Drag.XAxis + } else if (verticalOnly) { + Drag.YAxis + } else { + Drag.XAndYAxis + } + target: pressed ? root : null + minimumX: -width / 2 + maximumX: parent.width - width / 2 + minimumY: -height / 2 + maximumY: parent.height - height / 2 + threshold: 0 + } + Rectangle { + id: graphics + visible: false + implicitWidth: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2 + implicitHeight: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2 + anchors.centerIn: parent + color: Kirigami.Theme.highlightColor + radius: height / 2 + } + // Has to be the same size as source + Item { + id: maskSource + visible: false + anchors.fill: graphics + Rectangle { + x: root.leftSide ? parent.width - width : 0 + y: root.topSide ? parent.height - height : 0 + width: root.forwardDiagonal || root.backwardDiagonal || root.horizontalOnly ? parent.width / 2 : parent.width + height: root.forwardDiagonal || root.backwardDiagonal || root.verticalOnly ? parent.height / 2 : parent.height + } + } + OpacityMask { + anchors.fill: graphics + cached: true + invert: true + source: graphics + maskSource: maskSource + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/controls/qt6/SelectionHandle.qml new/kquickimageeditor-0.3.0/src/controls/qt6/SelectionHandle.qml --- old/kquickimageeditor-0.2.0/src/controls/qt6/SelectionHandle.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kquickimageeditor-0.3.0/src/controls/qt6/SelectionHandle.qml 2023-11-02 17:00:24.000000000 +0100 @@ -0,0 +1,120 @@ +/* SPDX-FileCopyrightText: 2021 Noah Davis <noaha...@gmail.com> + * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + */ + +import QtQuick 2.15 +import Qt5Compat.GraphicalEffects +import org.kde.kirigami 2.15 as Kirigami + +MouseArea { + id: root + enum Position { + TopLeft, Top, TopRight, + Left, Right, + BottomLeft, Bottom, BottomRight, + NPositions + } + required property Item target + property int position: SelectionHandle.TopLeft + + readonly property bool leftSide: position === SelectionHandle.TopLeft + || position === SelectionHandle.Left + || position === SelectionHandle.BottomLeft + readonly property bool rightSide: position === SelectionHandle.TopRight + || position === SelectionHandle.Right + || position === SelectionHandle.BottomRight + readonly property bool topSide: position === SelectionHandle.TopLeft + || position === SelectionHandle.Top + || position === SelectionHandle.TopRight + readonly property bool bottomSide: position === SelectionHandle.BottomLeft + || position === SelectionHandle.Bottom + || position === SelectionHandle.BottomRight + readonly property bool horizontalOnly: position === SelectionHandle.Left || position === SelectionHandle.Right + readonly property bool verticalOnly: position === SelectionHandle.Top || position === SelectionHandle.Bottom + // Like forward slash + readonly property bool forwardDiagonal: position === SelectionHandle.TopRight || position === SelectionHandle.BottomLeft + // Like backward slash + readonly property bool backwardDiagonal: position === SelectionHandle.TopLeft || position === SelectionHandle.BottomRight + + property bool lockX: false + property bool lockY: false + + LayoutMirroring.enabled: false + LayoutMirroring.childrenInherit: true + anchors.horizontalCenter: if (!pressed && !lockX) { + if (leftSide) { + target.left + } else if (verticalOnly) { + target.horizontalCenter + } else { + target.right + } + } + anchors.verticalCenter: if (!pressed && !lockY) { + if (topSide) { + target.top + } else if (horizontalOnly) { + target.verticalCenter + } else { + target.bottom + } + } + implicitWidth: graphics.implicitWidth + Kirigami.Units.largeSpacing * 2 + implicitHeight: graphics.implicitHeight + Kirigami.Units.largeSpacing * 2 + width: verticalOnly ? target.width - implicitWidth : implicitWidth + height: horizontalOnly ? target.height - implicitHeight : implicitHeight + cursorShape: if (horizontalOnly) { + Qt.SizeHorCursor + } else if (verticalOnly) { + Qt.SizeVerCursor + } else if (forwardDiagonal) { + // actually oriented like forward slash + Qt.SizeBDiagCursor + } else { + // actually oriented like backward slash + Qt.SizeFDiagCursor + } + drag { + axis: if (horizontalOnly) { + Drag.XAxis + } else if (verticalOnly) { + Drag.YAxis + } else { + Drag.XAndYAxis + } + target: pressed ? root : null + minimumX: -width / 2 + maximumX: parent.width - width / 2 + minimumY: -height / 2 + maximumY: parent.height - height / 2 + threshold: 0 + } + Rectangle { + id: graphics + visible: false + implicitWidth: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2 + implicitHeight: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2 + anchors.centerIn: parent + color: Kirigami.Theme.highlightColor + radius: height / 2 + } + // Has to be the same size as source + Item { + id: maskSource + visible: false + anchors.fill: graphics + Rectangle { + x: root.leftSide ? parent.width - width : 0 + y: root.topSide ? parent.height - height : 0 + width: root.forwardDiagonal || root.backwardDiagonal || root.horizontalOnly ? parent.width / 2 : parent.width + height: root.forwardDiagonal || root.backwardDiagonal || root.verticalOnly ? parent.height / 2 : parent.height + } + } + OpacityMask { + anchors.fill: graphics + cached: true + invert: true + source: graphics + maskSource: maskSource + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kquickimageeditor-0.2.0/src/resources.qrc new/kquickimageeditor-0.3.0/src/resources.qrc --- old/kquickimageeditor-0.2.0/src/resources.qrc 2021-10-01 18:15:16.000000000 +0200 +++ new/kquickimageeditor-0.3.0/src/resources.qrc 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -<!-- -SPDX-FileCopyrightText: (C) 2020 Carl Schwan <c...@carlschwan.eu> - -SPDX-License-Identifier: LGPL-2.1-or-later ---> -<RCC> - <qresource prefix="/"> - <file alias="BasicResizeHandle.qml">controls/BasicResizeHandle.qml</file> - <file alias="SelectionTool.qml">controls/SelectionTool.qml</file> - <file alias="SelectionHandle.qml">controls/SelectionHandle.qml</file> - <file alias="SelectionBackground.qml">controls/SelectionBackground.qml</file> - <file alias="CropBackground.qml">controls/CropBackground.qml</file> - <file alias="RectangleCutout.qml">controls/RectangleCutout.qml</file> - </qresource> -</RCC> ++++++ kquickimageeditor.keyring ++++++ Binary files /var/tmp/diff_new_pack.ZGK5va/_old and /var/tmp/diff_new_pack.ZGK5va/_new differ