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 | | ||||
29 | PlasmaComponents.ToolBar { | | |||
30 | 27 | | |||
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… | |||||
ngraham: Set the same thing for the right margin too | |||||
ngraham: Not done yet | |||||
31 | Rectangle { | 28 | Rectangle { | ||
32 | color: theme.backgroundColor | 29 | id: root | ||
33 | height: units.gridUnit / 20 | 30 | width: parent.width | ||
34 | width: preview.width | 31 | color: Kirigami.Theme.backgroundColor | ||
35 | anchors { | 32 | signal colorschemeChanged(int index) | ||
36 | right: parent.right | 33 | property alias slider: sizeslider | ||
37 | top: parent.bottom | 34 | | ||
38 | } | 35 | RowLayout { | ||
39 | } | 36 | anchors.fill: parent | ||
40 | tools: RowLayout { | 37 | anchors.leftMargin: Kirigami.Units.smallSpacing | ||
41 | 38 | anchors.rightMargin: Kirigami.Units.smallSpacing | |||
42 | spacing: units.gridUnit / 2 | 39 | anchors.verticalCenter: parent.verticalCenter | ||
43 | 40 | spacing: Kirigami.Units.largeSpacing | |||
44 | PlasmaComponents.TextField { | 41 | Kirigami.SearchField { | ||
ngraham: There's a bunch of unnecessary extra space to the left:
{F7318225, size=full} | |||||
45 | id: filterInput | 42 | id: filterInput | ||
46 | Layout.fillWidth: true | 43 | Layout.fillWidth: true | ||
47 | onTextChanged: typingtimer.restart() | 44 | onTextChanged: typingtimer.restart() | ||
48 | focus: true | 45 | focus: true | ||
49 | 46 | | |||
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. | |||||
50 | Timer { | 47 | Timer { | ||
51 | id: typingtimer | 48 | id: typingtimer | ||
52 | running: false | 49 | running: false | ||
53 | repeat: false | 50 | repeat: false | ||
54 | interval: 100 | 51 | interval: 100 | ||
55 | onTriggered: { | 52 | onTriggered: { | ||
56 | iconModel.filter = filterInput.text | 53 | iconModel.filter = filterInput.text | ||
57 | } | 54 | } | ||
58 | } | 55 | } | ||
56 | Component.onCompleted: { | ||||
57 | filterInput.forceActiveFocus() | ||||
58 | } | ||||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | ComboBox { | 61 | QQC2.ComboBox { | ||
62 | id: catsCombo | ||||
62 | Layout.preferredWidth: units.gridUnit * 6 | 63 | Layout.preferredWidth: units.gridUnit * 6 | ||
63 | model: iconModel.categories | 64 | model: iconModel.categories | ||
64 | onActivated: { | 65 | onActivated: { | ||
65 | if (currentText == "all") { | 66 | if (currentText == "all") { | ||
66 | iconModel.category = ""; | 67 | iconModel.category = ""; | ||
67 | } else if (currentText != "") { | 68 | } else if (currentText != "") { | ||
68 | iconModel.category = currentText | 69 | iconModel.category = currentText | ||
69 | } | 70 | } | ||
70 | } | 71 | } | ||
72 | popup.modal: false | ||||
71 | } | 73 | } | ||
72 | 74 | | |||
73 | Slider { | 75 | QQC2.Slider { | ||
74 | id: sizeslider | 76 | id: sizeslider | ||
75 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | 77 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | ||
76 | 78 | | |||
77 | to: 6.0 | 79 | to: 5.0 | ||
78 | stepSize: 1.0 | 80 | stepSize: 1.0 | ||
79 | snapMode: Slider.AlwaysSnap | 81 | snapMode: QQC2.Slider.SnapAlways | ||
80 | value: 4.0 | 82 | value: 4.0 | ||
81 | 83 | | |||
82 | onValueChanged: { | 84 | onValueChanged: { | ||
83 | sizetimer.restart() | 85 | sizetimer.restart() | ||
84 | pixelSizeInput.text = indexToSize(sizeslider.value) | 86 | pixelSizeInput.text = indexToSize(sizeslider.value) | ||
85 | } | 87 | } | ||
86 | 88 | | |||
87 | Timer { | 89 | Timer { | ||
88 | id: sizetimer | 90 | id: sizetimer | ||
89 | running: false | 91 | running: false | ||
90 | repeat: false | 92 | repeat: false | ||
91 | interval: 200 | 93 | interval: 200 | ||
92 | onTriggered: iconSize = indexToSize(sizeslider.value) | 94 | onTriggered: iconSize = indexToSize(sizeslider.value) | ||
93 | } | 95 | } | ||
94 | 96 | | |||
95 | Component.onCompleted: { | 97 | Component.onCompleted: { | ||
96 | pixelSizeInput.text = indexToSize(sizeslider.value); | 98 | pixelSizeInput.text = indexToSize(sizeslider.value); | ||
97 | } | 99 | } | ||
98 | } | 100 | } | ||
99 | 101 | | |||
100 | PlasmaComponents.TextField { | 102 | 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 | 103 | id: pixelSizeInput | ||
102 | 104 | | |||
103 | Layout.preferredWidth: units.gridUnit * 3 | 105 | Layout.preferredWidth: units.gridUnit * 3 | ||
104 | | ||||
105 | onTextChanged: { | | |||
106 | if (pixelSizeInput.activeFocus) { | | |||
107 | pxSizetimer.restart() | | |||
108 | } | 106 | } | ||
107 | QQC2.Label { | ||||
108 | text: i18n("Colorscheme:") | ||||
GB_2: "Color scheme" | |||||
109 | } | 109 | } | ||
110 | 110 | QQC2.ComboBox { | |||
111 | Timer { | 111 | model: ["System Colorscheme", "Breeze (Normal)", "Breeze Dark"] | ||
ngraham: System Colorscheme -> System Color Scheme | |||||
112 | id: pxSizetimer | 112 | delegate: QQC2.ItemDelegate { | ||
113 | running: false | 113 | text: i18n(modelData) | ||
114 | repeat: false | 114 | width: parent.width | ||
115 | interval: 100 | | |||
116 | onTriggered: iconSize = pixelSizeInput.text | | |||
117 | } | 115 | } | ||
116 | onActivated: (index) => { | ||||
117 | root.colorschemeChanged(index) | ||||
118 | } | 118 | } | ||
119 | 119 | popup.modal: false | |||
120 | PlasmaComponents.CheckBox { | | |||
121 | id: colorContextCheckbox | | |||
122 | text: i18n("Inverted") | | |||
123 | onCheckedChanged: darkScheme = checked | | |||
124 | } | 120 | } | ||
125 | | ||||
126 | PlasmaComponents.CheckBox { | | |||
127 | id: plasmaThemeCheckbox | | |||
128 | text: i18n("Monochrome") | | |||
129 | checked: true | | |||
130 | onCheckedChanged: cuttlefish.usesPlasmaTheme = checked | | |||
131 | } | 121 | } | ||
132 | 122 | Kirigami.Separator { | |||
ngraham: You could potentially use a Kirigami.Separator for this | |||||
133 | Item { | 123 | height: 1 | ||
134 | Layout.preferredWidth: preview.width | 124 | anchors { | ||
125 | left: parent.left | ||||
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… | |||||
126 | right: parent.right | ||||
127 | bottom: parent.bottom | ||||
135 | } | 128 | } | ||
136 | } | 129 | } | ||
137 | } | 130 | } | ||
138 | 131 | |
import QtQuick.Controls 2.5 as QQC2 (See T10862)