• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • workspace API Reference
  • KDE Home
  • Contact Us
 

kdeplasma-addons

  • kde-4.x
  • workspace
  • kdeplasma-addons
  • applets
  • fifteenPuzzle
  • package
  • contents
  • ui
fifteenPuzzle/package/contents/ui/configAppearance.qml
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Bhushan Shah <[email protected]>
3  * Copyright 2013 Sebastian Kügler <[email protected]>
4  * Copyright 2014 Kai Uwe Broulik <[email protected]>
5  * Copyright 2014 Jeremy Whiting <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License or (at your option) version 3 or any later version
11  * accepted by the membership of KDE e.V. (or its successor approved
12  * by the membership of KDE e.V.), which shall act as a proxy
13  * defined in Section 14 of version 3 of the license.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>
22  */
23 
24 import QtQuick 2.5
25 import QtQuick.Controls 2.5 as QtControls
26 import QtQuick.Layouts 1.1
27 import QtQuick.Dialogs 1.2 as QtDialogs
28 import org.kde.kquickcontrols 2.0 as KQC
29 import org.kde.kirigami 2.8 as Kirigami
30 
31 Kirigami.FormLayout {
32  id: appearancePage
33 
34  property alias cfg_boardSize: sizeSpinBox.value
35  property alias cfg_boardColor: pieceColorPicker.color
36  property alias cfg_numberColor: numberColorPicker.color
37  property alias cfg_showNumerals: showNumeralsCheckBox.checked
38 
39  property alias cfg_useImage: imageBackgroundRadioButton.checked
40  property alias cfg_imagePath: imagePathTextField.text
41 
42  QtControls.ButtonGroup {
43  id: radioGroup
44  }
45 
46  // Need to manually set checked state for the color button based on the
47  // other onebecause it's not aliased to a saved property
48  Component.onCompleted: {
49  colorBackgroundRadioButton.checked = !imageBackgroundRadioButton.checked;
50  }
51 
52  QtControls.SpinBox {
53  id: sizeSpinBox
54  Kirigami.FormData.label: i18nc("@label:spinbox", "Grid size:")
55  }
56 
57  Item {
58  Kirigami.FormData.isSection: true
59  }
60 
61  // Color background
62  RowLayout {
63  Kirigami.FormData.label: i18n("Background:")
64 
65  QtControls.RadioButton {
66  id: colorBackgroundRadioButton
67  QtControls.ButtonGroup.group: radioGroup
68 
69  text: i18n("Color:")
70  }
71 
72  KQC.ColorButton {
73  id: pieceColorPicker
74  enabled: colorBackgroundRadioButton.checked
75  }
76  }
77 
78  // Image background
79  RowLayout {
80  QtControls.RadioButton {
81  id: imageBackgroundRadioButton
82  QtControls.ButtonGroup.group: radioGroup
83 
84  text: i18n("Image:")
85  }
86 
87  Kirigami.ActionTextField {
88  id: imagePathTextField
89  enabled: imageBackgroundRadioButton.checked
90 
91  Layout.fillWidth: true
92  placeholderText: i18nc("@info:placeholder", "Path to custom image...")
93 
94  rightActions: [
95  Kirigami.Action {
96  iconName: "edit-clear"
97  visible: imagePathTextField.text.length !== 0
98  onTriggered: imagePathTextField.text = "";
99  }
100  ]
101  }
102 
103  QtControls.Button {
104  enabled: imageBackgroundRadioButton.checked
105 
106  icon.name: "document-open"
107 
108  QtControls.ToolTip.visible: hovered
109  QtControls.ToolTip.delay: 100
110  QtControls.ToolTip.text: i18nc("@info:tooltip", "Choose image...")
111 
112  onClicked: imagePicker.open()
113 
114  QtDialogs.FileDialog {
115  id: imagePicker
116 
117  title: i18nc("@title:window", "Choose an Image")
118 
119  folder: shortcuts.pictures
120 
121  // TODO ask QImageReader for supported formats
122  nameFilters: [ i18n("Image Files (*.png *.jpg *.jpeg *.bmp *.svg *.svgz)") ]
123 
124  onFileUrlChanged: {
125  imagePathTextField.text = fileUrl.toString().replace("file://", "")
126  }
127  }
128  }
129  }
130 
131  Item {
132  Kirigami.FormData.isSection: true
133  }
134 
135  RowLayout {
136  Kirigami.FormData.label: i18n("Tiles:")
137 
138  QtControls.CheckBox {
139  id: showNumeralsCheckBox
140  text: i18n("Colored numbers:")
141  }
142 
143  KQC.ColorButton {
144  id: numberColorPicker
145  enabled: showNumeralsCheckBox.checked
146  }
147  }
148 }
Item
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Dec 9 2019 01:49:29 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdeplasma-addons

Skip menu "kdeplasma-addons"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

workspace API Reference

Skip menu "workspace API Reference"
  •   KCMShell
  • kdeplasma-addons
  • KWin
  •   KWin Effects Library
  • Plasma
  • Plasma
  •   Applets
  •   Engines
  •   libkworkspace
  • System Settings
  •   SystemSettingsView

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal