Changeset View
Changeset View
Standalone View
Standalone View
applets/comic/package/contents/ui/configGeneral.qml
Show All 11 Lines | |||||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 | ||
20 | import QtQuick.Controls 1.1 as Controls | 20 | import QtQuick.Controls 2.5 as Controls | ||
21 | import QtQuick.Layouts 1.1 as Layouts | 21 | import QtQuick.Layouts 1.1 as Layouts | ||
22 | 22 | | |||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 23 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.kirigami 2.5 as Kirigami | ||||
24 | 25 | | |||
25 | 26 | Kirigami.FormLayout { | |||
26 | Layouts.ColumnLayout { | | |||
27 | id: root | 27 | id: root | ||
28 | anchors.left: parent.left | ||||
29 | anchors.right: parent.right | ||||
28 | 30 | | |||
29 | signal configurationChanged | 31 | signal configurationChanged | ||
30 | 32 | | |||
31 | function saveConfig() { | 33 | function saveConfig() { | ||
32 | var newTabs = []; | 34 | var newTabs = []; | ||
33 | for (var i in providerColumn.children) { | 35 | for (var i in providerColumn.children) { | ||
34 | if (providerColumn.children[i].checked) { | 36 | if (providerColumn.children[i].checked) { | ||
35 | newTabs.push(providerColumn.children[i].plugin) | 37 | newTabs.push(providerColumn.children[i].plugin) | ||
Show All 11 Lines | |||||
47 | } | 49 | } | ||
48 | 50 | | |||
49 | Component.onCompleted: { | 51 | Component.onCompleted: { | ||
50 | middleClickCheckBox.checked = plasmoid.nativeInterface.middleClick; | 52 | middleClickCheckBox.checked = plasmoid.nativeInterface.middleClick; | ||
51 | checkNewComicStripsInterval.value = plasmoid.nativeInterface.checkNewComicStripsInterval; | 53 | checkNewComicStripsInterval.value = plasmoid.nativeInterface.checkNewComicStripsInterval; | ||
52 | providerUpdateInterval.value = plasmoid.nativeInterface.providerUpdateInterval | 54 | providerUpdateInterval.value = plasmoid.nativeInterface.providerUpdateInterval | ||
53 | } | 55 | } | ||
54 | 56 | | |||
55 | Controls.GroupBox { | 57 | Item { | ||
56 | Layouts.Layout.fillWidth: true | 58 | Kirigami.FormData.isSection: true | ||
57 | flat: true | 59 | } | ||
ngraham: If you used a header rather than a left label to work around the fact that the repeater… | |||||
58 | | ||||
59 | title: i18nc("@title:group", "Comic") | | |||
60 | 60 | | |||
61 | Layouts.ColumnLayout { | 61 | Layouts.ColumnLayout { | ||
62 | Layouts.ColumnLayout { | | |||
63 | id: providerColumn | 62 | id: providerColumn | ||
63 | Kirigami.FormData.label: i18nc("@title:group", "Comics:") | ||||
64 | Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater | ||||
65 | | ||||
64 | Repeater { | 66 | Repeater { | ||
65 | model: plasmoid.nativeInterface.availableComicsModel | 67 | model: plasmoid.nativeInterface.availableComicsModel | ||
66 | delegate: Controls.CheckBox { | 68 | delegate: Controls.CheckBox { | ||
67 | id: checkbox | 69 | id: checkbox | ||
68 | text: model.display | 70 | text: model.display | ||
69 | checked: model.checked | 71 | checked: model.checked | ||
70 | property string plugin: model.plugin | 72 | property string plugin: model.plugin | ||
71 | Component.onCompleted: { | 73 | Component.onCompleted: { | ||
72 | checkbox.checked = plasmoid.nativeInterface.tabIdentifiers.indexOf(model.plugin) !== -1 | 74 | checkbox.checked = plasmoid.nativeInterface.tabIdentifiers.indexOf(model.plugin) !== -1 | ||
73 | } | 75 | } | ||
74 | onCheckedChanged: root.configurationChanged(); | 76 | onCheckedChanged: root.configurationChanged(); | ||
75 | } | 77 | } | ||
76 | } | 78 | } | ||
77 | } | 79 | } | ||
78 | Item { | 80 | | ||
79 | Layouts.Layout.fillWidth: true | | |||
80 | Layouts.Layout.fillHeight: true | | |||
81 | Layouts.Layout.minimumHeight: units.gridUnit * 2 | | |||
82 | } | | |||
83 | Controls.Button { | 81 | Controls.Button { | ||
84 | iconName: "get-hot-new-stuff" | 82 | icon.name: "get-hot-new-stuff" | ||
85 | text: i18nc("@action:button", "Get New Comics...") | 83 | text: i18nc("@action:button", "Get New Comics...") | ||
86 | onClicked: plasmoid.nativeInterface.getNewComics(); | 84 | onClicked: plasmoid.nativeInterface.getNewComics(); | ||
87 | } | 85 | } | ||
86 | | ||||
88 | Controls.CheckBox { | 87 | Controls.CheckBox { | ||
89 | id: middleClickCheckBox | 88 | id: middleClickCheckBox | ||
90 | text: i18nc("@option:check", "Middle-click on the comic to show it at its original size") | 89 | text: i18nc("@option:check", "Middle-click on comic to display at original size") | ||
ngraham: This could be shortened:
"Middle-click on comic to display at original size" | |||||
91 | onCheckedChanged: root.configurationChanged(); | 90 | onCheckedChanged: root.configurationChanged(); | ||
92 | } | 91 | } | ||
93 | } | | |||
94 | } | | |||
95 | Controls.GroupBox { | | |||
96 | Layouts.Layout.fillWidth: true | | |||
97 | flat: true | | |||
98 | 92 | | |||
99 | title: i18nc("@title:group", "Update") | 93 | Item { | ||
94 | Kirigami.FormData.isSection: true | ||||
95 | } | ||||
100 | 96 | | |||
101 | Layouts.ColumnLayout { | | |||
102 | Layouts.RowLayout { | 97 | Layouts.RowLayout { | ||
103 | Layouts.Layout.alignment: Qt.AlignRight | 98 | Kirigami.FormData.label: i18nc("@label:spinbox", "Check for new plugins every:") | ||
I'd recommend putting these in the FormLayout rather than using a RowLayout, since now the spinboxes aren't aligned anymore. ngraham: I'd recommend putting these in the FormLayout rather than using a RowLayout, since now the… | |||||
You could shorten this very long string by writing it as "Check for new plugins every:" ngraham: You could shorten this very long string by writing it as "Check for new plugins every:" | |||||
104 | Controls.Label { | 99 | | ||
105 | text: i18nc("@label:spinbox", "Automatically update comic plugins:") | | |||
106 | } | | |||
107 | Controls.SpinBox { | 100 | Controls.SpinBox { | ||
108 | id: providerUpdateInterval | 101 | id: providerUpdateInterval | ||
109 | Layouts.Layout.minimumWidth: units.gridUnit * 8 | | |||
110 | suffix: i18nc("@item:valuesuffix spacing to number + unit", " days") | | |||
111 | stepSize: 1 | 102 | stepSize: 1 | ||
112 | onValueChanged: root.configurationChanged(); | 103 | onValueChanged: root.configurationChanged(); | ||
113 | } | 104 | } | ||
114 | } | 105 | | ||
115 | Layouts.RowLayout { | | |||
116 | Layouts.Layout.alignment: Qt.AlignRight | | |||
117 | Controls.Label { | 106 | Controls.Label { | ||
118 | text: i18nc("@label:spinbox", "Check for new comic strips:") | 107 | text: i18ncp("@item:valuesuffix spacing to number + unit", "day", "days") | ||
119 | } | 108 | } | ||
109 | } | ||||
110 | | ||||
111 | Layouts.RowLayout { | ||||
Same; use i18ncp() rather than synthesizing different i18n() calls for the singular and plural versions (also I think you're missing the i18n() calls themselves) ngraham: Same; use `i18ncp()` rather than synthesizing different `i18n()` calls for the singular and… | |||||
112 | Kirigami.FormData.label: i18nc("@label:spinbox", "Check for new comics every:") | ||||
ngraham: "comic strips" -> "comics" | |||||
113 | | ||||
120 | Controls.SpinBox { | 114 | Controls.SpinBox { | ||
121 | id: checkNewComicStripsInterval | 115 | id: checkNewComicStripsInterval | ||
122 | Layouts.Layout.minimumWidth: units.gridUnit * 8 | | |||
123 | suffix: i18nc("@item:valuesuffix spacing to number + unit (minutes)", " min") | | |||
124 | stepSize: 1 | 116 | stepSize: 1 | ||
125 | onValueChanged: root.configurationChanged(); | 117 | onValueChanged: root.configurationChanged(); | ||
126 | } | 118 | } | ||
127 | } | | |||
128 | } | | |||
129 | } | | |||
130 | 119 | | |||
131 | Item { | 120 | Controls.Label { | ||
132 | Layouts.Layout.fillHeight: true | 121 | text: i18ncp("@item:valuesuffix spacing to number + unit (minutes)", "minute", "minutes") | ||
ngraham: "Mins" -> "Minutes" (etc) | |||||
122 | } | ||||
133 | } | 123 | } | ||
134 | } | 124 | } | ||
ngraham: Ditto |
If you used a header rather than a left label to work around the fact that the repeater underneath it makes this hard, you can check out how I made that work in the clock settings' plugins view: https://cgit.kde.org/plasma-workspace.git/tree/applets/digital-clock/package/contents/ui/configCalendar.qml#n59