Warning, /maui/mauikit-imagetools/src/controls.6/private/TransformationBar.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick
0002 import QtQuick.Controls 
0003 import QtQuick.Layouts 
0004 
0005 import org.mauikit.controls as Maui
0006 
0007 import org.kde.kquickimageeditor as KQuickImageEditor
0008 import Qt5Compat.GraphicalEffects
0009 
0010 ColumnLayout
0011 {
0012     id: control
0013 
0014     spacing: 0
0015 
0016     property alias rotationSlider: _freeRotationSlider
0017     property alias rotationButton : _freeRotationButton
0018     property alias cropButton : _cropButton
0019 
0020     Maui.ToolBar
0021     {
0022         position: ToolBar.Footer
0023         Layout.fillWidth: true
0024         visible: _freeRotationButton.checked
0025         background: Rectangle
0026         {
0027             color: Maui.Theme.backgroundColor
0028         }
0029         leftContent: [
0030             ToolButton
0031             {
0032                 icon.name: "object-flip-vertical"
0033                 text: i18nc("@action:button Mirror an image vertically", "Flip");
0034                 autoExclusive: true
0035                 onClicked: imageDoc.mirror(false, true);
0036             },
0037 
0038             ToolButton
0039             {
0040                 icon.name: "object-flip-horizontal"
0041                 text: i18nc("@action:button Mirror an image horizontally", "Mirror");
0042                 checkable: true
0043                 autoExclusive: true
0044                 onClicked: imageDoc.mirror(true, false);
0045             }
0046 
0047         ]
0048 
0049         rightContent: ToolButton
0050         {
0051             icon.name: "object-rotate-left"
0052             //                    display: ToolButton.IconOnly
0053             text: i18nc("@action:button Rotate an image 90°", "Rotate 90°");
0054             onClicked:
0055             {
0056                 let value = _freeRotationSlider.value-90
0057                 _freeRotationSlider.value = value < -180 ? 90 : value
0058             }
0059         }
0060 
0061         //                middleContent: Label
0062         //                {
0063         //                    text: i18nd("mauikitimagetools","Rotate")
0064         //                }
0065     }
0066 
0067     Maui.ToolBar
0068     {
0069         id: _freeRotation
0070 
0071         visible: _freeRotationButton.checked
0072         position: ToolBar.Footer
0073         background: Rectangle
0074         {
0075             color: Maui.Theme.backgroundColor
0076         }
0077 
0078         Layout.fillWidth: true
0079 
0080 
0081         middleContent: Ruler
0082         {
0083             id: _freeRotationSlider
0084             Layout.fillWidth: true
0085             from : -180
0086             to: 180
0087             value: 0
0088             snapMode: Slider.SnapAlways
0089             stepSize: 1
0090         }
0091     }
0092 
0093     Maui.ToolBar
0094     {
0095         position: ToolBar.Footer
0096         Layout.fillWidth: true
0097         background: Rectangle
0098         {
0099             color: Maui.Theme.backgroundColor
0100         }
0101         middleContent: Maui.ToolActions
0102         {
0103             autoExclusive: true
0104             Layout.alignment: Qt.AlignHCenter
0105             Action
0106             {
0107                 id: _cropButton
0108                 checkable: true
0109                 icon.name:  "transform-crop"
0110                 text:  i18nc("@action:button Crop an image", "Crop");
0111             }
0112 
0113             Action
0114             {
0115                 id: _freeRotationButton
0116                 icon.name: "transform-rotate"
0117                 checkable: true
0118                 text: i18nc("@action:button Rotate an image", "Rotate");
0119             }
0120         }
0121 
0122         leftContent: ToolButton
0123         {
0124             //                    text: i18nd("mauikitimagetools","Accept")
0125             visible: _freeRotationButton.checked || _cropButton.checked
0126 
0127             icon.name: "checkmark"
0128             onClicked:
0129             {
0130                 if(_freeRotationButton.checked)
0131                 {
0132                     var value = _freeRotationSlider.value
0133                     _freeRotationSlider.value = 0
0134 
0135                     console.log("Rotate >> " , value)
0136                     imageDoc.rotate(value);
0137                 }
0138 
0139                 if(_cropButton.checked)
0140                 {
0141                     crop()
0142                 }
0143             }
0144         }
0145 
0146         rightContent:  ToolButton
0147         {
0148             //                    text: i18nd("mauikitimagetools","Cancel")
0149             visible: _freeRotationButton.checked || _cropButton.checked
0150             icon.name: "dialog-cancel"
0151             onClicked:
0152             {
0153                 if(_freeRotationButton.checked)
0154                 {
0155                     _freeRotationSlider.value = 0
0156                     _freeRotationButton.checked = false
0157 
0158                 }
0159 
0160                 if(_cropButton.checked)
0161                 {
0162                     _cropButton.checked = false
0163                 }
0164             }
0165         }
0166     }
0167 }
0168