Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/Tools.qml
Show All 13 Lines | |||||
14 | * * | 14 | * * | ||
15 | * You should have received a copy of the GNU General Public License * | 15 | * You should have received a copy of the GNU General Public License * | ||
16 | * along with this program; if not, write to the * | 16 | * along with this program; if not, write to the * | ||
17 | * Free Software Foundation, Inc., * | 17 | * Free Software Foundation, Inc., * | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
19 | * * | 19 | * * | ||
20 | ***************************************************************************/ | 20 | ***************************************************************************/ | ||
21 | 21 | | |||
22 | import QtQuick 2.2 | 22 | import QtQuick 2.5 | ||
23 | import QtQuick.Controls 2.0 | 23 | import QtQuick.Controls 2.5 as QQC2 | ||
ngraham: `import QtQuick.Controls 2.5 as QQC2` (See T10862) | |||||
24 | import QtQuick.Layouts 1.0 | 24 | import QtQuick.Layouts 1.0 | ||
25 | 25 | | |||
26 | import org.kde.plasma.core 2.0 as PlasmaCore | 26 | import org.kde.kirigami 2.8 as Kirigami | ||
27 | import org.kde.plasma.components 2.0 as PlasmaComponents | | |||
28 | 27 | | |||
29 | PlasmaComponents.ToolBar { | 28 | Item { | ||
30 | 29 | width: parent.width | |||
31 | Rectangle { | 30 | RowLayout { | ||
The fake toolbar created here feels too short. I would make it taller by a few pixels so there's more room above and below the controls. ngraham: The fake toolbar created here feels too short. I would make it taller by a few pixels so… | |||||
ngraham: Now it's a bit too tall, and the margins above and below the search field still don't match the… | |||||
32 | color: theme.backgroundColor | 31 | anchors.fill: parent | ||
33 | height: units.gridUnit / 20 | 32 | anchors.leftMargin: Kirigami.Units.smallSpacing | ||
34 | width: preview.width | 33 | anchors.verticalCenter: parent.verticalCenter | ||
35 | anchors { | 34 | spacing: Kirigami.Units.largeSpacing | ||
36 | right: parent.right | | |||
37 | top: parent.bottom | | |||
38 | } | | |||
39 | } | | |||
40 | tools: RowLayout { | | |||
41 | | ||||
42 | spacing: units.gridUnit / 2 | | |||
43 | 35 | | |||
44 | PlasmaComponents.TextField { | 36 | Kirigami.SearchField { | ||
ngraham: There's a bunch of unnecessary extra space to the left:
{F7318225, size=full} | |||||
45 | id: filterInput | 37 | id: filterInput | ||
ngraham: Set the same thing for the right margin too | |||||
ngraham: Not done yet | |||||
46 | Layout.fillWidth: true | 38 | Layout.fillWidth: true | ||
47 | onTextChanged: typingtimer.restart() | 39 | onTextChanged: typingtimer.restart() | ||
48 | focus: true | 40 | focus: true | ||
41 | placeholderText: i18n("Search icons...") | ||||
Don't need to override the default placeholder text when using Kirigami.SearchField ngraham: Don't need to override the default placeholder text when using `Kirigami.SearchField` | |||||
ngraham: Not done yet. | |||||
49 | 42 | | |||
50 | Timer { | 43 | Timer { | ||
51 | id: typingtimer | 44 | id: typingtimer | ||
52 | running: false | 45 | running: false | ||
53 | repeat: false | 46 | repeat: false | ||
54 | interval: 100 | 47 | interval: 100 | ||
55 | onTriggered: { | 48 | onTriggered: { | ||
56 | iconModel.filter = filterInput.text | 49 | iconModel.filter = filterInput.text | ||
57 | } | 50 | } | ||
58 | } | 51 | } | ||
59 | } | 52 | } | ||
60 | 53 | | |||
61 | ComboBox { | 54 | QQC2.ComboBox { | ||
62 | Layout.preferredWidth: units.gridUnit * 6 | 55 | Layout.preferredWidth: units.gridUnit * 6 | ||
63 | model: iconModel.categories | 56 | model: iconModel.categories | ||
64 | onActivated: { | 57 | onActivated: { | ||
65 | if (currentText == "all") { | 58 | if (currentText == "all") { | ||
66 | iconModel.category = ""; | 59 | iconModel.category = ""; | ||
67 | } else if (currentText != "") { | 60 | } else if (currentText != "") { | ||
68 | iconModel.category = currentText | 61 | iconModel.category = currentText | ||
69 | } | 62 | } | ||
70 | } | 63 | } | ||
71 | } | 64 | } | ||
72 | 65 | | |||
73 | Slider { | 66 | QQC2.Slider { | ||
74 | id: sizeslider | 67 | id: sizeslider | ||
75 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | 68 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | ||
76 | 69 | | |||
77 | to: 6.0 | 70 | to: 6.0 | ||
78 | stepSize: 1.0 | 71 | stepSize: 1.0 | ||
79 | snapMode: Slider.AlwaysSnap | 72 | snapMode: QQC2.Slider.SnapAlways | ||
80 | value: 4.0 | 73 | value: 4.0 | ||
81 | 74 | | |||
82 | onValueChanged: { | 75 | onValueChanged: { | ||
83 | sizetimer.restart() | 76 | sizetimer.restart() | ||
84 | pixelSizeInput.text = indexToSize(sizeslider.value) | 77 | pixelSizeInput.text = indexToSize(sizeslider.value) | ||
85 | } | 78 | } | ||
86 | 79 | | |||
87 | Timer { | 80 | Timer { | ||
88 | id: sizetimer | 81 | id: sizetimer | ||
89 | running: false | 82 | running: false | ||
90 | repeat: false | 83 | repeat: false | ||
91 | interval: 200 | 84 | interval: 200 | ||
92 | onTriggered: iconSize = indexToSize(sizeslider.value) | 85 | onTriggered: iconSize = indexToSize(sizeslider.value) | ||
93 | } | 86 | } | ||
94 | 87 | | |||
95 | Component.onCompleted: { | 88 | Component.onCompleted: { | ||
96 | pixelSizeInput.text = indexToSize(sizeslider.value); | 89 | pixelSizeInput.text = indexToSize(sizeslider.value); | ||
97 | } | 90 | } | ||
98 | } | 91 | } | ||
99 | 92 | | |||
100 | PlasmaComponents.TextField { | 93 | QQC2.Label { | ||
Let's just use a label for this. There's no value to letting people enter arbitrary numbers here. ngraham: Let's just use a label for this. There's no value to letting people enter arbitrary numbers… | |||||
101 | id: pixelSizeInput | 94 | id: pixelSizeInput | ||
102 | 95 | | |||
103 | Layout.preferredWidth: units.gridUnit * 3 | 96 | Layout.preferredWidth: units.gridUnit * 3 | ||
104 | | ||||
105 | onTextChanged: { | | |||
106 | if (pixelSizeInput.activeFocus) { | | |||
107 | pxSizetimer.restart() | | |||
108 | } | 97 | } | ||
109 | } | 98 | } | ||
GB_2: "Color scheme" | |||||
ngraham: System Colorscheme -> System Color Scheme | |||||
110 | 99 | Kirigami.Separator { | |||
ngraham: You could potentially use a Kirigami.Separator for this | |||||
111 | Timer { | 100 | opacity: 0.2 | ||
112 | id: pxSizetimer | 101 | color: Kirigami.Theme.textColor | ||
113 | running: false | 102 | height: 1 | ||
Is any of this custom styling actually necessary given Kirigami.Separator's default appearance? ngraham: Is any of this custom styling actually necessary given `Kirigami.Separator`'s default… | |||||
114 | repeat: false | 103 | anchors { | ||
115 | interval: 100 | 104 | left: parent.left | ||
116 | onTriggered: iconSize = pixelSizeInput.text | 105 | right: parent.right | ||
117 | } | 106 | bottom: parent.bottom | ||
118 | } | | |||
119 | | ||||
120 | PlasmaComponents.CheckBox { | | |||
121 | id: colorContextCheckbox | | |||
122 | text: i18n("Inverted") | | |||
123 | onCheckedChanged: darkScheme = checked | | |||
124 | } | | |||
125 | | ||||
126 | PlasmaComponents.CheckBox { | | |||
127 | id: plasmaThemeCheckbox | | |||
128 | text: i18n("Monochrome") | | |||
129 | checked: true | | |||
130 | onCheckedChanged: cuttlefish.usesPlasmaTheme = checked | | |||
131 | } | | |||
132 | | ||||
133 | Item { | | |||
134 | Layout.preferredWidth: preview.width | | |||
135 | } | 107 | } | ||
136 | } | 108 | } | ||
137 | } | 109 | } | ||
138 | 110 | |
import QtQuick.Controls 2.5 as QQC2 (See T10862)