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


import QtQuick.Controls 2.5 as QQC2 (See T10862)