Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/Tools.qml
- This file was copied to cuttlefish/package/contents/ui/ToolsResponsive.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 | property alias currentIndex: colorcombo.currentIndex | ||
| 38 | } | 35 | | ||
| 39 | } | 36 | Kirigami.Theme.textColor: cuttlefish.textcolor | ||
| 40 | tools: RowLayout { | 37 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | ||
| 41 | 38 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | |||
| 42 | spacing: units.gridUnit / 2 | 39 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | ||
| 43 | 40 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | |||
| 44 | PlasmaComponents.TextField { | 41 | Kirigami.Theme.neutralTextColor: cuttlefish.neutraltextcolor | ||
| 42 | Kirigami.Theme.negativeTextColor: cuttlefish.negativetextcolor | ||||
| 43 | | ||||
| 44 | RowLayout { | ||||
| 45 | anchors.fill: parent | ||||
| 46 | anchors.leftMargin: Kirigami.Units.smallSpacing | ||||
| 47 | anchors.rightMargin: Kirigami.Units.smallSpacing | ||||
| 48 | anchors.verticalCenter: parent.verticalCenter | ||||
| 49 | spacing: Kirigami.Units.largeSpacing | ||||
| 50 | Kirigami.SearchField { | ||||
ngraham: There's a bunch of unnecessary extra space to the left:
{F7318225, size=full} | |||||
| 45 | id: filterInput | 51 | id: filterInput | ||
| 46 | Layout.fillWidth: true | 52 | Layout.fillWidth: true | ||
| 47 | onTextChanged: typingtimer.restart() | 53 | onTextChanged: typingtimer.restart() | ||
| 48 | focus: true | 54 | focus: true | ||
| 49 | 55 | | |||
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 { | 56 | Timer { | ||
| 51 | id: typingtimer | 57 | id: typingtimer | ||
| 52 | running: false | 58 | running: false | ||
| 53 | repeat: false | 59 | repeat: false | ||
| 54 | interval: 100 | 60 | interval: 100 | ||
| 55 | onTriggered: { | 61 | onTriggered: { | ||
| 56 | iconModel.filter = filterInput.text | 62 | iconModel.filter = filterInput.text | ||
| 57 | } | 63 | } | ||
| 58 | } | 64 | } | ||
| 65 | Component.onCompleted: { | ||||
| 66 | filterInput.forceActiveFocus() | ||||
| 67 | } | ||||
| 59 | } | 68 | } | ||
| 60 | 69 | | |||
| 61 | ComboBox { | 70 | QQC2.ComboBox { | ||
| 71 | id: catsCombo | ||||
| 62 | Layout.preferredWidth: units.gridUnit * 6 | 72 | Layout.preferredWidth: units.gridUnit * 6 | ||
| 63 | model: iconModel.categories | 73 | model: iconModel.categories | ||
| 64 | onActivated: { | 74 | onActivated: { | ||
| 65 | if (currentText == "all") { | 75 | if (currentText == "all") { | ||
| 66 | iconModel.category = ""; | 76 | iconModel.category = ""; | ||
| 67 | } else if (currentText != "") { | 77 | } else if (currentText != "") { | ||
| 68 | iconModel.category = currentText | 78 | iconModel.category = currentText | ||
| 69 | } | 79 | } | ||
| 70 | } | 80 | } | ||
| 81 | popup.modal: false | ||||
| 71 | } | 82 | } | ||
| 72 | 83 | | |||
| 73 | Slider { | 84 | QQC2.Slider { | ||
| 85 | visible: cuttlefish.widescreen | ||||
| 74 | id: sizeslider | 86 | id: sizeslider | ||
| 75 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | 87 | Layout.preferredWidth: preview.width - units.gridUnit * 2 | ||
| 76 | 88 | | |||
| 77 | to: 6.0 | 89 | to: 5.0 | ||
| 78 | stepSize: 1.0 | 90 | stepSize: 1.0 | ||
| 79 | snapMode: Slider.AlwaysSnap | 91 | snapMode: QQC2.Slider.SnapAlways | ||
| 80 | value: 4.0 | 92 | value: 4.0 | ||
| 81 | 93 | | |||
| 82 | onValueChanged: { | 94 | onValueChanged: { | ||
| 83 | sizetimer.restart() | 95 | sizetimer.restart() | ||
| 84 | pixelSizeInput.text = indexToSize(sizeslider.value) | 96 | pixelSizeInput.text = indexToSize(sizeslider.value) | ||
| 85 | } | 97 | } | ||
| 86 | 98 | | |||
| 87 | Timer { | 99 | Timer { | ||
| 88 | id: sizetimer | 100 | id: sizetimer | ||
| 89 | running: false | 101 | running: false | ||
| 90 | repeat: false | 102 | repeat: false | ||
| 91 | interval: 200 | 103 | interval: 200 | ||
| 92 | onTriggered: iconSize = indexToSize(sizeslider.value) | 104 | onTriggered: iconSize = indexToSize(sizeslider.value) | ||
| 93 | } | 105 | } | ||
| 94 | 106 | | |||
| 95 | Component.onCompleted: { | 107 | Component.onCompleted: { | ||
| 96 | pixelSizeInput.text = indexToSize(sizeslider.value); | 108 | pixelSizeInput.text = indexToSize(sizeslider.value); | ||
| 97 | } | 109 | } | ||
| 98 | } | 110 | } | ||
| 99 | 111 | | |||
| 100 | PlasmaComponents.TextField { | 112 | QQC2.Label { | ||
| 113 | visible: cuttlefish.widescreen | ||||
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 | 114 | id: pixelSizeInput | ||
| 102 | 115 | | |||
| 103 | Layout.preferredWidth: units.gridUnit * 3 | 116 | Layout.preferredWidth: units.gridUnit * 3 | ||
| 104 | | ||||
| 105 | onTextChanged: { | | |||
| 106 | if (pixelSizeInput.activeFocus) { | | |||
| 107 | pxSizetimer.restart() | | |||
| 108 | } | 117 | } | ||
| 118 | QQC2.Label { | ||||
| 119 | visible: cuttlefish.widescreen | ||||
GB_2: "Color scheme" | |||||
| 120 | text: i18n("Color scheme:") | ||||
| 121 | } | ||||
| 122 | QQC2.ComboBox { | ||||
| 123 | id: colorcombo | ||||
ngraham: System Colorscheme -> System Color Scheme | |||||
| 124 | visible: cuttlefish.widescreen | ||||
| 125 | model: ["System Color Scheme", "Breeze (Normal)", "Breeze Dark"] | ||||
| 126 | delegate: QQC2.ItemDelegate { | ||||
| 127 | text: i18n(modelData) | ||||
| 128 | width: parent.width | ||||
| 109 | } | 129 | } | ||
| 110 | 130 | onActivated: (index) => { | |||
| 111 | Timer { | 131 | root.colorschemeChanged(index) | ||
| 112 | id: pxSizetimer | | |||
| 113 | running: false | | |||
| 114 | repeat: false | | |||
| 115 | interval: 100 | | |||
| 116 | onTriggered: iconSize = pixelSizeInput.text | | |||
| 117 | } | | |||
| 118 | } | 132 | } | ||
| 119 | 133 | popup.modal: false | |||
| 120 | PlasmaComponents.CheckBox { | | |||
| 121 | id: colorContextCheckbox | | |||
| 122 | text: i18n("Inverted") | | |||
| 123 | onCheckedChanged: darkScheme = checked | | |||
| 124 | } | 134 | } | ||
| 125 | | ||||
| 126 | PlasmaComponents.CheckBox { | | |||
| 127 | id: plasmaThemeCheckbox | | |||
| 128 | text: i18n("Monochrome") | | |||
| 129 | checked: true | | |||
| 130 | onCheckedChanged: cuttlefish.usesPlasmaTheme = checked | | |||
| 131 | } | 135 | } | ||
| 132 | 136 | Kirigami.Separator { | |||
ngraham: You could potentially use a Kirigami.Separator for this | |||||
| 133 | Item { | 137 | height: 1 | ||
| 134 | Layout.preferredWidth: preview.width | 138 | anchors { | ||
| 139 | 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… | |||||
| 140 | right: parent.right | ||||
| 141 | bottom: parent.bottom | ||||
| 135 | } | 142 | } | ||
| 136 | } | 143 | } | ||
| 137 | } | 144 | } | ||
| 138 | 145 | | |||


import QtQuick.Controls 2.5 as QQC2 (See T10862)