Warning, /plasma/kdeplasma-addons/applets/fifteenPuzzle/package/contents/ui/configAppearance.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2013 Bhushan Shah <bhush94@gmail.com>
0003 * SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
0004 * SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de>
0005 * SPDX-FileCopyrightText: 2014 Jeremy Whiting <jpwhiting@kde.org>
0006 *
0007 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0008 */
0009
0010 import QtQuick 2.15
0011 import QtCore
0012 import QtQuick.Controls 2.15 as QtControls
0013 import QtQuick.Layouts 1.15
0014 import QtQuick.Dialogs as QtDialogs
0015
0016 import org.kde.kquickcontrols 2.0 as KQC
0017 import org.kde.kirigami 2.20 as Kirigami
0018 import org.kde.kcmutils as KCM
0019
0020 KCM.SimpleKCM {
0021 property alias cfg_boardSize: sizeSpinBox.value
0022 property alias cfg_boardColor: pieceColorPicker.color
0023 property alias cfg_numberColor: numberColorPicker.color
0024 property alias cfg_showNumerals: showNumeralsCheckBox.checked
0025
0026 property alias cfg_useImage: imageBackgroundRadioButton.checked
0027 property alias cfg_imagePath: imagePathTextField.text
0028
0029 Kirigami.FormLayout {
0030
0031 QtControls.ButtonGroup {
0032 id: radioGroup
0033 }
0034
0035 // Need to manually set checked state for the color button based on the
0036 // other onebecause it's not aliased to a saved property
0037 Component.onCompleted: {
0038 colorBackgroundRadioButton.checked = !imageBackgroundRadioButton.checked;
0039 }
0040
0041 QtControls.SpinBox {
0042 id: sizeSpinBox
0043 Kirigami.FormData.label: i18nc("@label:spinbox", "Grid size:")
0044 }
0045
0046 Item {
0047 Kirigami.FormData.isSection: true
0048 }
0049
0050 // Color background
0051 RowLayout {
0052 Kirigami.FormData.label: i18n("Background:")
0053
0054 QtControls.RadioButton {
0055 id: colorBackgroundRadioButton
0056 QtControls.ButtonGroup.group: radioGroup
0057
0058 text: i18n("Color:")
0059 }
0060
0061 KQC.ColorButton {
0062 id: pieceColorPicker
0063 enabled: colorBackgroundRadioButton.checked
0064 }
0065 }
0066
0067 // Image background
0068 RowLayout {
0069 QtControls.RadioButton {
0070 id: imageBackgroundRadioButton
0071 QtControls.ButtonGroup.group: radioGroup
0072
0073 text: i18n("Image:")
0074 }
0075
0076 Kirigami.ActionTextField {
0077 id: imagePathTextField
0078 enabled: imageBackgroundRadioButton.checked
0079
0080 Layout.fillWidth: true
0081 placeholderText: i18nc("@info:placeholder", "Path to custom image…")
0082
0083 rightActions: [
0084 Kirigami.Action {
0085 icon.name: "edit-clear"
0086 visible: imagePathTextField.text.length !== 0
0087 onTriggered: imagePathTextField.text = "";
0088 }
0089 ]
0090 }
0091
0092 QtControls.Button {
0093 id: imageButton
0094 enabled: imageBackgroundRadioButton.checked
0095
0096 icon.name: "document-open"
0097
0098 QtControls.ToolTip {
0099 visible: imageButton.hovered
0100 text: i18nc("@info:tooltip", "Choose image…")
0101 }
0102
0103 onClicked: imagePicker.open()
0104
0105 QtDialogs.FileDialog {
0106 id: imagePicker
0107
0108 title: i18nc("@title:window", "Choose an Image")
0109
0110 currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
0111
0112 // TODO ask QImageReader for supported formats
0113 nameFilters: [ i18n("Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)") ]
0114
0115 onAccepted: {
0116 imagePathTextField.text = selectedFile.toString().replace("file://", "")
0117 }
0118 }
0119 }
0120 }
0121
0122 Item {
0123 Kirigami.FormData.isSection: true
0124 }
0125
0126 RowLayout {
0127 Kirigami.FormData.label: i18n("Tiles:")
0128
0129 QtControls.CheckBox {
0130 id: showNumeralsCheckBox
0131 text: i18n("Colored numbers:")
0132 }
0133
0134 KQC.ColorButton {
0135 id: numberColorPicker
0136 enabled: showNumeralsCheckBox.checked
0137 }
0138 }
0139 }
0140 }