Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/ToolsResponsive.qml
- This file was copied from cuttlefish/package/contents/ui/Tools.qml.
| 1 | /*************************************************************************** | 1 | /*************************************************************************** | ||
|---|---|---|---|---|---|
| 2 | * * | 2 | * * | ||
| 3 | * Copyright 2014-2017 Sebastian Kügler <sebas@kde.org> * | 3 | * Copyright 2019 Carson Black <uhhadd@gmail.com> * | ||
| 4 | * * | 4 | * * | ||
| 5 | * This program is free software; you can redistribute it and/or modify * | 5 | * This program is free software; you can redistribute it and/or modify * | ||
| 6 | * it under the terms of the GNU General Public License as published by * | 6 | * it under the terms of the GNU General Public License as published by * | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or * | 7 | * the Free Software Foundation; either version 2 of the License, or * | ||
| 8 | * (at your option) any later version. * | 8 | * (at your option) any later version. * | ||
| 9 | * * | 9 | * * | ||
| 10 | * This program is distributed in the hope that it will be useful, * | 10 | * This program is distributed in the hope that it will be useful, * | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 13 | * GNU General Public License for more details. * | 13 | * GNU General Public License for more details. * | ||
| 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 | ||
| 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 | ||
| 34 | width: preview.width | 31 | color: Kirigami.Theme.backgroundColor | ||
| 32 | | ||||
| 33 | Kirigami.Theme.textColor: cuttlefish.textcolor | ||||
| 34 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | ||||
| 35 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | ||||
| 36 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | ||||
| 37 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | ||||
| 38 | Kirigami.Theme.neutralTextColor: cuttlefish.neutraltextcolor | ||||
| 39 | Kirigami.Theme.negativeTextColor: cuttlefish.negativetextcolor | ||||
| 40 | | ||||
| 41 | property alias currentIndex: colorcombo.currentIndex | ||||
| 42 | signal colorschemeChanged(int index) | ||||
| 43 | Kirigami.Separator { | ||||
| 44 | height: 1 | ||||
| 35 | anchors { | 45 | anchors { | ||
| 46 | left: parent.left | ||||
| 36 | right: parent.right | 47 | right: parent.right | ||
| 37 | top: parent.bottom | 48 | top: parent.top | ||
| 38 | } | | |||
| 39 | } | | |||
| 40 | tools: RowLayout { | | |||
| 41 | | ||||
| 42 | spacing: units.gridUnit / 2 | | |||
| 43 | | ||||
| 44 | PlasmaComponents.TextField { | | |||
| 45 | id: filterInput | | |||
| 46 | Layout.fillWidth: true | | |||
| 47 | onTextChanged: typingtimer.restart() | | |||
| 48 | focus: true | | |||
| 49 | | ||||
| 50 | Timer { | | |||
| 51 | id: typingtimer | | |||
| 52 | running: false | | |||
| 53 | repeat: false | | |||
| 54 | interval: 100 | | |||
| 55 | onTriggered: { | | |||
| 56 | iconModel.filter = filterInput.text | | |||
| 57 | } | | |||
| 58 | } | | |||
| 59 | } | | |||
| 60 | | ||||
| 61 | ComboBox { | | |||
| 62 | Layout.preferredWidth: units.gridUnit * 6 | | |||
| 63 | model: iconModel.categories | | |||
| 64 | onActivated: { | | |||
| 65 | if (currentText == "all") { | | |||
| 66 | iconModel.category = ""; | | |||
| 67 | } else if (currentText != "") { | | |||
| 68 | iconModel.category = currentText | | |||
| 69 | } | 49 | } | ||
| 70 | } | 50 | } | ||
| 71 | } | 51 | RowLayout { | ||
| 72 | 52 | anchors.fill: parent | |||
| 73 | Slider { | 53 | anchors.leftMargin: Kirigami.Units.smallSpacing | ||
| 54 | anchors.rightMargin: Kirigami.Units.smallSpacing | ||||
| 55 | anchors.verticalCenter: parent.verticalCenter | ||||
| 56 | spacing: Kirigami.Units.largeSpacing | ||||
| 57 | QQC2.Slider { | ||||
| 58 | visible: !cuttlefish.widescreen | ||||
| 74 | id: sizeslider | 59 | id: sizeslider | ||
| 75 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | 60 | Layout.fillWidth: true | ||
| 76 | 61 | | |||
| 77 | to: 6.0 | 62 | to: 5.0 | ||
| 78 | stepSize: 1.0 | 63 | stepSize: 1.0 | ||
| 79 | snapMode: Slider.AlwaysSnap | 64 | snapMode: QQC2.Slider.SnapAlways | ||
| 80 | value: 4.0 | 65 | value: 4.0 | ||
| 81 | 66 | | |||
| 82 | onValueChanged: { | 67 | onValueChanged: { | ||
| 83 | sizetimer.restart() | 68 | sizetimer.restart() | ||
| 84 | pixelSizeInput.text = indexToSize(sizeslider.value) | 69 | pixelSizeInput.text = indexToSize(sizeslider.value) | ||
| 85 | } | 70 | } | ||
| 86 | 71 | | |||
| 87 | Timer { | 72 | Timer { | ||
| 88 | id: sizetimer | 73 | id: sizetimer | ||
| 89 | running: false | 74 | running: false | ||
| 90 | repeat: false | 75 | repeat: false | ||
| 91 | interval: 200 | 76 | interval: 200 | ||
| 92 | onTriggered: iconSize = indexToSize(sizeslider.value) | 77 | onTriggered: iconSize = indexToSize(sizeslider.value) | ||
| 93 | } | 78 | } | ||
| 94 | 79 | | |||
| 95 | Component.onCompleted: { | 80 | Component.onCompleted: { | ||
| 96 | pixelSizeInput.text = indexToSize(sizeslider.value); | 81 | pixelSizeInput.text = indexToSize(sizeslider.value); | ||
| 97 | } | 82 | } | ||
| 98 | } | 83 | } | ||
| 99 | 84 | | |||
| 100 | PlasmaComponents.TextField { | 85 | QQC2.Label { | ||
| 86 | visible: !cuttlefish.widescreen | ||||
| 101 | id: pixelSizeInput | 87 | id: pixelSizeInput | ||
| 102 | 88 | | |||
| 103 | Layout.preferredWidth: units.gridUnit * 3 | 89 | Layout.preferredWidth: units.gridUnit * 1 | ||
| 104 | | ||||
| 105 | onTextChanged: { | | |||
| 106 | if (pixelSizeInput.activeFocus) { | | |||
| 107 | pxSizetimer.restart() | | |||
| 108 | } | | |||
| 109 | } | | |||
| 110 | | ||||
| 111 | Timer { | | |||
| 112 | id: pxSizetimer | | |||
| 113 | running: false | | |||
| 114 | repeat: false | | |||
| 115 | interval: 100 | | |||
| 116 | onTriggered: iconSize = pixelSizeInput.text | | |||
| 117 | } | 90 | } | ||
| 91 | QQC2.ComboBox { | ||||
| 92 | id: colorcombo | ||||
| 93 | visible: !cuttlefish.widescreen | ||||
| 94 | model: ["System Color Scheme", "Breeze (Normal)", "Breeze Dark"] | ||||
| 95 | delegate: QQC2.ItemDelegate { | ||||
| 96 | text: i18n(modelData) | ||||
| 97 | width: parent.width | ||||
| 118 | } | 98 | } | ||
| 119 | 99 | onActivated: (index) => { | |||
| 120 | PlasmaComponents.CheckBox { | 100 | root.colorschemeChanged(index) | ||
| 121 | id: colorContextCheckbox | | |||
| 122 | text: i18n("Inverted") | | |||
| 123 | onCheckedChanged: darkScheme = checked | | |||
| 124 | } | 101 | } | ||
| 125 | 102 | popup.modal: false | |||
| 126 | PlasmaComponents.CheckBox { | | |||
| 127 | id: plasmaThemeCheckbox | | |||
| 128 | text: i18n("Monochrome") | | |||
| 129 | checked: true | | |||
| 130 | onCheckedChanged: cuttlefish.usesPlasmaTheme = checked | | |||
| 131 | } | 103 | } | ||
| 132 | | ||||
| 133 | Item { | 104 | Item { | ||
| 134 | Layout.preferredWidth: preview.width | 105 | width: Kirigami.Units.largeSpacing * 3 | ||
| 135 | } | 106 | } | ||
| 136 | } | 107 | } | ||
| 137 | } | 108 | } | ||
| 138 | | ||||
| 109 | No newline at end of file | ||||