Warning, /graphics/krita/plugins/dockers/touchdocker/qml/touchstrip.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-License-Identifier: GPL-3.0-or-later
0003  */
0004 
0005 import QtQuick 2.3
0006 import org.krita.sketch 1.0
0007 import org.krita.sketch.components 1.0
0008 
0009 Rectangle {
0010     id: root
0011 
0012     SystemPalette {
0013         id: palette;
0014         colorGroup: SystemPalette.Active
0015     }
0016 
0017     property int rowHeight: height/9;
0018     // same rule as defined in kis_icon_utils to determine useDarkIcons, but in the 0-1 range
0019     property bool useDarkIcons: palette.button.hsvValue > 0.39 ? true : false;
0020     color: palette.base;
0021 
0022     Column {
0023         width: root.width
0024         Row {
0025             height: root.rowHeight;
0026             Repeater {
0027                 model: ["fileOpen", "fileSave", "fileSaveAs"]
0028                 Button {
0029                     color: palette.button
0030                     highlightColor: palette.highlight
0031                     textColor: palette.buttonText
0032                     radius: 8;
0033                     width: root.width / 3
0034                     height: parent.height;
0035                     onClicked: {
0036                         mainWindow.slotButtonPressed(modelData+"Button")
0037                     }
0038                     image: root.useDarkIcons ? Settings.theme.icon(modelData.toLowerCase() + "-black") :
0039                                Settings.theme.icon(modelData.toLowerCase());
0040                 }
0041             }
0042         }
0043 
0044         Row {
0045             width: parent.width;
0046             height: root.rowHeight;
0047             ButtonSquared {
0048                 color: palette.button
0049                 highlightColor: palette.highlight
0050                 textColor: palette.buttonText
0051                 radius: 8;
0052                 id: undoButton
0053                 width: root.width / 2
0054                 height: parent.height;
0055                 image: root.useDarkIcons ? mainWindow.iconForButton("edit-undo", true) : mainWindow.iconForButton("edit-undo", false);
0056 
0057                 onClicked: {
0058                     mainWindow.slotButtonPressed("edit_undo")
0059                 }
0060             }
0061 
0062             ButtonSquared {
0063                 color: palette.button
0064                 highlightColor: palette.highlight
0065                 textColor: palette.buttonText
0066                 radius: 8;
0067                 width: root.width / 2
0068                 height: parent.height;
0069                 image: root.useDarkIcons ? mainWindow.iconForButton("edit-redo", true) : mainWindow.iconForButton("edit-redo", false);
0070 
0071                 onClicked: {
0072                     mainWindow.slotButtonPressed("edit_redo")
0073                 }
0074             }
0075         }
0076 
0077         Row{
0078             width: parent.width;
0079             height: childrenRect.height;
0080             Repeater {
0081                 model: [2, 3]
0082                 ButtonSquared {
0083                     color: palette.button
0084                     highlightColor: palette.highlight
0085                     textColor: palette.buttonText
0086                     radius: 8;
0087                     width: parent.width/2;
0088                     height: root.rowHeight
0089                     checkable: text === "shift" || text == "ctrl" || text == "alt" ? true : false;
0090                     onClicked: {
0091                         mainWindow.slotButtonPressed(modelData)
0092                     }
0093                     image: root.useDarkIcons ? mainWindow.iconForButton(modelData, true) : mainWindow.iconForButton(modelData, false);
0094                 }
0095             }
0096         }
0097 
0098         Row{
0099             width: parent.width;
0100             height: childrenRect.height;
0101             Repeater {
0102                 model: [1, 4]
0103                 ButtonSquared {
0104                     color: palette.button
0105                     highlightColor: palette.highlight
0106                     textColor: palette.buttonText
0107                     radius: 8;
0108                     width: parent.width/2;
0109                     height: root.rowHeight
0110                     checkable: text === "shift" || text == "ctrl" || text == "alt" ? true : false;
0111                     onClicked: {
0112                         mainWindow.slotButtonPressed(modelData)
0113                     }
0114                     image: root.useDarkIcons ? mainWindow.iconForButton(modelData, true) : mainWindow.iconForButton(modelData, false);
0115                 }
0116             }
0117         }
0118 
0119         Row {
0120             width: parent.width;
0121             height: childrenRect.height;
0122             Repeater {
0123                 model: ["rotate_canvas_left", "reset_canvas_rotation", "rotate_canvas_right"]
0124                 Item {
0125                     height: root.rowHeight
0126                     width: root.width/3
0127                     ButtonSquared {
0128                         id: rockerSwitch
0129                         color: palette.button
0130                         highlightColor: palette.highlight
0131                         textColor: palette.buttonText
0132                         radius: 8;
0133                         anchors.fill: parent;
0134                         visible: modelData !== "";
0135                         image: root.useDarkIcons ? mainWindow.iconForButton(modelData, true) : mainWindow.iconForButton(modelData, false);
0136                         onClicked: {
0137                             mainWindow.slotButtonPressed(modelData)
0138                             if (modelData === "reset_canvas_rotation") {
0139                                 mainWindow.slotButtonPressed("zoom_to_100pct")
0140                             }
0141                         }
0142                     }
0143                 }
0144             }
0145         }
0146 
0147         Row{
0148             width: parent.width;
0149             height: childrenRect.height;
0150             Repeater {
0151                 model: [6, "view_zoom_in"]
0152                 ButtonSquared {
0153                     color: palette.button
0154                     highlightColor: palette.highlight
0155                     textColor: palette.buttonText
0156                     radius: 8;
0157                     width: parent.width/2;
0158                     height: root.rowHeight
0159                     checkable: text === "shift" || text == "ctrl" || text == "alt" ? true : false;
0160                     onClicked: {
0161                         if (modelData === "view_zoom_in")
0162                         {
0163                             mainWindow.slotButtonPressed(modelData)
0164                         }
0165                         else
0166                         {
0167                             mainWindow.slotButtonPressed(modelData)
0168                         }
0169                     }
0170                     image: root.useDarkIcons ? mainWindow.iconForButton(modelData, true) : mainWindow.iconForButton(modelData, false);
0171                 }
0172             }
0173         }
0174 
0175         Row{
0176             width: parent.width;
0177             height: childrenRect.height;
0178             Repeater {
0179                 model: [5, "view_zoom_out"]
0180                 ButtonSquared {
0181                     color: palette.button
0182                     highlightColor: palette.highlight
0183                     textColor: palette.buttonText
0184                     radius: 8;
0185                     width: parent.width/2;
0186                     height: root.rowHeight
0187                     checkable: text === "shift" || text == "ctrl" || text == "alt" ? true : false;
0188                     onClicked: {
0189                         if(modelData === "view_zoom_out")
0190                         {
0191                             mainWindow.slotButtonPressed(modelData)
0192                         }
0193                         else
0194                         {
0195                             mainWindow.slotButtonPressed(modelData)
0196                         }
0197                     }
0198                     image: root.useDarkIcons ? mainWindow.iconForButton(modelData, true) : mainWindow.iconForButton(modelData, false);
0199                 }
0200             }
0201         }
0202 
0203         Repeater {
0204             width: parent.width;
0205             height: childrenRect.height;
0206             model: [7, 8]
0207             ButtonSquared {
0208                 color: palette.button
0209                 highlightColor: palette.highlight
0210                 textColor: palette.buttonText
0211                 radius: 8;
0212                 width: parent.width;
0213                 height: root.rowHeight
0214                 checkable: text === "shift" || text == "ctrl" || text == "alt" ? true : false;
0215                 onClicked: {
0216                     mainWindow.slotButtonPressed(modelData)
0217                 }
0218                 image: root.useDarkIcons ? mainWindow.iconForButton(modelData, true) : mainWindow.iconForButton(modelData, false);
0219             }
0220         }
0221     }
0222 }