Changeset View
Changeset View
Standalone View
Standalone View
lookandfeelexplorer/package/contents/ui/main.qml
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls 1.3 | 21 | import QtQuick.Controls 1.3 | ||
22 | import QtQuick.Controls 2.0 as QQC2 | ||||
22 | import QtQuick.Layouts 1.1 | 23 | import QtQuick.Layouts 1.1 | ||
23 | 24 | | |||
24 | import org.kde.draganddrop 2.0 as DragAndDrop | 25 | import org.kde.draganddrop 2.0 as DragAndDrop | ||
25 | import org.kde.plasma.core 2.0 as PlasmaCore | 26 | import org.kde.kirigami 2.3 as Kirigami | ||
26 | import org.kde.kirigami 2.0 as Kirigami | | |||
27 | 27 | | |||
28 | Kirigami.AbstractApplicationWindow { | 28 | Kirigami.AbstractApplicationWindow { | ||
29 | id: root | 29 | id: root | ||
30 | width: units.gridUnit * 65 | 30 | width: Kirigami.Units.gridUnit * 50 | ||
31 | height: units.gridUnit * 26 | 31 | height: Kirigami.Units.gridUnit * 26 | ||
32 | visible: true | 32 | visible: true | ||
33 | 33 | | |||
34 | Component.onCompleted: { | 34 | Component.onCompleted: { | ||
35 | for (var i = 0; i < lnfLogic.lnfList.count; ++i) { | 35 | for (var i = 0; i < lnfLogic.lnfList.count; ++i) { | ||
36 | if (commandlineTheme == lnfLogic.lnfList.get(i).packageNameRole) { | 36 | if (commandlineTheme == lnfLogic.lnfList.get(i).packageNameRole) { | ||
37 | themeSelector.currentIndex = i; | 37 | themeSelector.currentIndex = i; | ||
38 | break; | 38 | break; | ||
39 | } | 39 | } | ||
40 | } | 40 | } | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | globalDrawer: Kirigami.GlobalDrawer { | 43 | globalDrawer: Kirigami.GlobalDrawer { | ||
44 | title: i18n("Look And Feel") | 44 | title: i18n("Look And Feel") | ||
45 | titleIcon: "preferences-desktop-theme" | 45 | titleIcon: "preferences-desktop-theme" | ||
46 | modal: true; | ||||
ognarb: This sadly didn't work :( | |||||
47 | collapsible: false; | ||||
48 | collapsed: false; | ||||
46 | topContent: ComboBox { | 49 | topContent: ComboBox { | ||
guoyunhe: This need to be changed to `QQC2.ComboBox` | |||||
47 | id: themeSelector | 50 | id: themeSelector | ||
48 | anchors { | 51 | Layout.fillWidth: true | ||
49 | left: parent.left | | |||
50 | right: parent.right | | |||
51 | } | | |||
52 | model: lnfLogic.lnfList | 52 | model: lnfLogic.lnfList | ||
53 | textRole: "displayRole" | 53 | textRole: "displayRole" | ||
54 | onCurrentIndexChanged: { | 54 | onCurrentIndexChanged: { | ||
55 | lnfLogic.theme = lnfLogic.lnfList.get(currentIndex).packageNameRole; | 55 | lnfLogic.theme = lnfLogic.lnfList.get(currentIndex).packageNameRole; | ||
56 | } | 56 | } | ||
57 | } | 57 | } | ||
58 | actions: [ | 58 | actions: [ | ||
59 | Kirigami.Action { | 59 | Kirigami.Action { | ||
Show All 27 Lines | 85 | Component { | |||
87 | MetadataEditor {} | 87 | MetadataEditor {} | ||
88 | } | 88 | } | ||
89 | 89 | | |||
90 | SystemPalette { | 90 | SystemPalette { | ||
91 | id: palette | 91 | id: palette | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | RowLayout { | 94 | RowLayout { | ||
95 | enabled: lnfLogic.isWritable | | |||
96 | anchors { | 95 | anchors { | ||
97 | fill: parent | 96 | fill: parent | ||
98 | margins: 10 | 97 | margins: Kirigami.Units.largeSpacing | ||
filipf: I would do something standardized like largeSpacing. | |||||
99 | } | 98 | } | ||
100 | GridLayout { | 99 | Layout.alignment: Qt.AlignHCenter | ||
No need to have this IMO. Just put the buttons in the Form Layout and then have them match the fields' width. Normally you would just have them fill the width but because the label above can be long you'd need to assign an id to one of the field and have the buttons's implicitWidth match the width of the field. filipf: No need to have this IMO.
Just put the buttons in the Form Layout and then have them match the… | |||||
101 | columns: 2 | 100 | ColumnLayout { | ||
102 | Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter | 101 | Layout.alignment: Qt.AlignHCenter | ||
103 | FormLabel { | 102 | Layout.fillWidth: true | ||
104 | text: i18n("Plugin Name:") | 103 | Kirigami.FormLayout { | ||
105 | } | 104 | enabled: lnfLogic.isWritable | ||
106 | Kirigami.Label { | 105 | QQC2.Label { | ||
filipf: ("Plugin name: ") | |||||
107 | text: lnfLogic.theme | 106 | text: i18n("Plugin name:") + lnfLogic.theme | ||
108 | } | | |||
109 | FormLabel { | | |||
110 | text: i18n("Name:") | | |||
111 | buddy: nameField | | |||
112 | } | 107 | } | ||
113 | FormField { | 108 | FormField { | ||
109 | id: formField | ||||
110 | label: i18n("Name:") | ||||
114 | key: "name" | 111 | key: "name" | ||
115 | } | 112 | } | ||
116 | FormLabel { | | |||
117 | text: i18n("Comment:") | | |||
118 | buddy: nameField | | |||
119 | } | | |||
120 | FormField { | 113 | FormField { | ||
114 | label: i18n("Comment:") | ||||
121 | key: "comment" | 115 | key: "comment" | ||
122 | } | 116 | } | ||
123 | FormLabel { | | |||
124 | text: i18n("Author:") | | |||
125 | buddy: nameField | | |||
126 | } | | |||
127 | FormField { | 117 | FormField { | ||
118 | label: i18n("Author:") | ||||
128 | key: "author" | 119 | key: "author" | ||
129 | } | 120 | } | ||
130 | FormLabel { | | |||
131 | text: i18n("Email:") | | |||
132 | buddy: nameField | | |||
133 | } | | |||
134 | FormField { | 121 | FormField { | ||
122 | label: i18n("Email:") | ||||
135 | key: "email" | 123 | key: "email" | ||
136 | } | 124 | } | ||
137 | FormLabel { | | |||
138 | text: i18n("Version:") | | |||
139 | buddy: nameField | | |||
140 | } | | |||
141 | FormField { | 125 | FormField { | ||
126 | label: i18n("Version:") | ||||
142 | key: "version" | 127 | key: "version" | ||
143 | } | 128 | } | ||
144 | FormLabel { | | |||
145 | text: i18n("Website:") | | |||
146 | buddy: nameField | | |||
147 | } | | |||
148 | FormField { | 129 | FormField { | ||
130 | label: i18n("Website:") | ||||
149 | key: "website" | 131 | key: "website" | ||
150 | } | 132 | } | ||
151 | FormLabel { | | |||
152 | text: i18n("License:") | | |||
153 | buddy: nameField | | |||
154 | } | | |||
155 | FormField { | 133 | FormField { | ||
134 | label: i18n("License:") | ||||
156 | key: "license" | 135 | key: "license" | ||
157 | } | 136 | } | ||
158 | Button { | 137 | QQC2.Button { | ||
159 | text: i18n("Layout from current Plasma setup") | 138 | text: i18n("Layout from current Plasma setup") | ||
160 | onClicked: lnfLogic.performLayoutDump = true | 139 | onClicked: lnfLogic.performLayoutDump = true | ||
161 | Layout.columnSpan: 2 | 140 | Layout.columnSpan: 2 | ||
162 | Layout.alignment: Qt.AlignRight | 141 | implicitWidth: formField.width | ||
163 | } | 142 | } | ||
164 | Button { | 143 | QQC2.Button { | ||
165 | text: i18n("Defaults from current setup") | 144 | text: i18n("Defaults from current setup") | ||
166 | onClicked: lnfLogic.performDefaultsDump = true | 145 | onClicked: lnfLogic.performDefaultsDump = true | ||
167 | Layout.columnSpan: 2 | 146 | Layout.columnSpan: 2 | ||
168 | Layout.alignment: Qt.AlignRight | 147 | implicitWidth: formField.width | ||
148 | } | ||||
169 | } | 149 | } | ||
170 | } | 150 | } | ||
171 | Connections { | 151 | Connections { | ||
172 | target: lnfLogic | 152 | target: lnfLogic | ||
173 | onThumbnailPathChanged: { | 153 | onThumbnailPathChanged: { | ||
174 | thumbnail.source = "" | 154 | thumbnail.source = "" | ||
175 | thumbnail.source = lnfLogic.thumbnailPath | 155 | thumbnail.source = lnfLogic.thumbnailPath | ||
176 | } | 156 | } | ||
177 | onMessageRequested: { | 157 | onMessageRequested: { | ||
178 | root.showPassiveNotification(message); | 158 | root.showPassiveNotification(message); | ||
179 | } | 159 | } | ||
180 | } | 160 | } | ||
181 | Rectangle { | 161 | Rectangle { | ||
182 | width: 250 | 162 | width: 250 | ||
183 | height: 250 | 163 | height: 250 | ||
184 | Kirigami.Label { | 164 | QQC2.Label { | ||
185 | anchors.centerIn: parent | 165 | anchors.centerIn: parent | ||
186 | text: i18n("click to open an image") | 166 | text: i18n("Click to open an image") | ||
"Click to set preview image..." I think it has to be that way because further action is required when clicking. filipf: "Click to set preview image..."
I think it has to be that way because further action is… | |||||
187 | visible: thumbnail.source == "" | 167 | visible: thumbnail.source == "" | ||
188 | } | 168 | } | ||
189 | Image { | 169 | Image { | ||
190 | id: thumbnail | 170 | id: thumbnail | ||
191 | anchors.fill: parent | 171 | anchors.fill: parent | ||
192 | fillMode: Image.PreserveAspectFit | 172 | fillMode: Image.PreserveAspectFit | ||
193 | 173 | | |||
194 | cache: false | 174 | cache: false | ||
Show All 13 Lines | 186 | MouseArea { | |||
208 | onClicked: { | 188 | onClicked: { | ||
209 | lnfLogic.processThumbnail(lnfLogic.openFile()); | 189 | lnfLogic.processThumbnail(lnfLogic.openFile()); | ||
210 | thumbnail.sourceChanged(thumbnail.source); | 190 | thumbnail.sourceChanged(thumbnail.source); | ||
211 | } | 191 | } | ||
212 | } | 192 | } | ||
213 | } | 193 | } | ||
214 | } | 194 | } | ||
215 | } | 195 | } | ||
216 | Button { | 196 | QQC2.Button { | ||
filipf: This button need more margins. | |||||
217 | anchors { | 197 | anchors { | ||
218 | right: parent.right | 198 | right: parent.right | ||
219 | bottom: parent.bottom | 199 | bottom: parent.bottom | ||
200 | margins: Kirigami.Units.largeSpacing | ||||
220 | } | 201 | } | ||
221 | text: i18n("Save") | 202 | text: i18n("Save") | ||
222 | enabled: lnfLogic.needsSave | 203 | enabled: lnfLogic.needsSave | ||
223 | onClicked: lnfLogic.save() | 204 | onClicked: lnfLogic.save() | ||
224 | } | 205 | } | ||
225 | } | 206 | } |
This sadly didn't work :(