Merge lp:~ahayzen/ubuntu-ui-extras/examples-merge-printers-printerqueue into lp:~phablet-team/ubuntu-ui-extras/printer-staging

Proposed by Andrew Hayzen
Status: Merged
Approved by: Jonas G. Drange
Approved revision: 151
Merged at revision: 151
Proposed branch: lp:~ahayzen/ubuntu-ui-extras/examples-merge-printers-printerqueue
Merge into: lp:~phablet-team/ubuntu-ui-extras/printer-staging
Prerequisite: lp:~ahayzen/ubuntu-ui-extras/job-impressions-update
Diff against target: 237 lines (+40/-164)
2 files modified
modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml (+0/-133)
modules/Ubuntu/Components/Extras/Example/Printers.qml (+40/-31)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-ui-extras/examples-merge-printers-printerqueue
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve
Review via email: mp+319484@code.launchpad.net

Commit message

* Remove PrinterQueue.qml example and add missing job methods to Printers.qml example, so we have only one example

Description of the change

* Remove PrinterQueue.qml example and add missing job methods to Printers.qml example, so we have only one example

To post a comment you must log in.
150. By Andrew Hayzen

* Merge of upstream

151. By Andrew Hayzen

* Pull of upstream

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

LGTM! If you're seeing freezes due to QML changes, then we have a bug somewhere (not in the QML) :)

I'm not seeing the freeze on printer/job deletion, and the code looks fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml'
2--- modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml 2017-03-09 15:44:19 +0000
3+++ modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml 1970-01-01 00:00:00 +0000
4@@ -1,133 +0,0 @@
5-/*
6- * Copyright 2017 Canonical Ltd.
7- *
8- * This program is free software; you can redistribute it and/or modify
9- * it under the terms of the GNU Lesser General Public License as published by
10- * the Free Software Foundation; version 3.
11- *
12- * This program is distributed in the hope that it will be useful,
13- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15- * GNU Lesser General Public License for more details.
16- *
17- * You should have received a copy of the GNU Lesser General Public License
18- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19- *
20- * Authored by Jonas G. Drange <jonas.drange@canonical.com>
21- * Andrew Hayzen <andrew.hayzen@canonical.com>
22- */
23-
24-import QtQuick 2.4
25-import QtQuick.Layouts 1.1
26-import Ubuntu.Components 1.3
27-import Ubuntu.Components.ListItems 1.3 as ListItems
28-import Ubuntu.Components.Extras.Printers 0.1
29-
30-MainView {
31- width: units.gu(50)
32- height: units.gu(90)
33-
34- Component {
35- id: queuePage
36-
37- Page {
38- header: PageHeader {
39- title: "Queue: " + printer.name
40- flickable: queueView
41- }
42- visible: false
43-
44- property var printer
45-
46- ListView {
47- id: queueView
48- anchors {
49- fill: parent
50- }
51- delegate: ListItem {
52- height: modelLayout.height + (divider.visible ? divider.height : 0)
53- trailingActions: ListItemActions {
54- actions: [
55- Action {
56- iconName: model.held ? "media-playback-start" : "media-playback-pause"
57- text: model.held ? "Release" : "Hold"
58-
59- onTriggered: {
60- if (model.held) {
61- Printers.releaseJob(printer.name, model.id);
62- } else {
63- Printers.holdJob(printer.name, model.id);
64- }
65- }
66- },
67- Action {
68- iconName: "cancel"
69- text: "Cancel"
70-
71- onTriggered: Printers.cancelJob(printer.name, model.id);
72- }
73- ]
74- }
75-
76- ListItemLayout {
77- id: modelLayout
78- title.text: displayName
79- subtitle.text: model.title + " (" + model.id + ")\nPrinting " + model.impressionsCompleted + " pages"
80- subtitle.wrapMode: Text.WrapAtWordBoundaryOrAnywhere
81- subtitle.maximumLineCount: 3
82- }
83- }
84- model: printer.jobs
85-
86- Label {
87- anchors {
88- centerIn: parent
89- }
90- text: "Empty queue"
91- visible: queueView.count === 0
92- }
93- }
94- }
95- }
96-
97- PageStack {
98- id: pageStack
99-
100- Page {
101- id: printersPage
102- header: PageHeader {
103- title: "Printers"
104- flickable: printerList
105- }
106- visible: false
107-
108- ListView {
109- id: printerList
110- anchors { fill: parent }
111- model: Printers.allPrintersWithPdf
112- delegate: ListItem {
113- height: modelLayout.height + (divider.visible ? divider.height : 0)
114- ListItemLayout {
115- id: modelLayout
116- title.text: displayName
117- title.font.bold: model.default
118- subtitle.text: description
119-
120- Icon {
121- id: icon
122- width: height
123- height: units.gu(2.5)
124- name: "printer-symbolic"
125- SlotsLayout.position: SlotsLayout.First
126- }
127-
128- ProgressionSlot {}
129- }
130- onClicked: pageStack.push(queuePage, { printer: model })
131- }
132- }
133- }
134-
135- Component.onCompleted: push(printersPage)
136- }
137-}
138
139=== modified file 'modules/Ubuntu/Components/Extras/Example/Printers.qml'
140--- modules/Ubuntu/Components/Extras/Example/Printers.qml 2017-03-10 13:15:27 +0000
141+++ modules/Ubuntu/Components/Extras/Example/Printers.qml 2017-03-16 15:49:26 +0000
142@@ -277,6 +277,44 @@
143 }
144
145 Component {
146+ id: jobDelegate
147+
148+ ListItem {
149+ height: modelLayout.height + (divider.visible ? divider.height : 0)
150+ trailingActions: ListItemActions {
151+ actions: [
152+ Action {
153+ iconName: model.held ? "media-playback-start" : "media-playback-pause"
154+ text: model.held ? "Release" : "Hold"
155+
156+ onTriggered: {
157+ if (model.held) {
158+ Printers.releaseJob(model.printerName, model.id);
159+ } else {
160+ Printers.holdJob(model.printerName, model.id);
161+ }
162+ }
163+ },
164+ Action {
165+ iconName: "cancel"
166+ text: "Cancel"
167+
168+ onTriggered: Printers.cancelJob(model.printerName, model.id);
169+ }
170+ ]
171+ }
172+
173+ ListItemLayout {
174+ id: modelLayout
175+ title.text: displayName
176+ subtitle.text: "Printing " + model.impressionsCompleted + " pages" + "\n" + model.printerName
177+ subtitle.wrapMode: Text.WrapAtWordBoundaryOrAnywhere
178+ subtitle.maximumLineCount: 3
179+ }
180+ }
181+ }
182+
183+ Component {
184 id: jobPage
185 Page {
186 property var printer
187@@ -290,26 +328,11 @@
188 id: jobList
189 anchors.fill: parent
190 model: printer.jobs
191- delegate: ListItem {
192- height: jobLayout.height + (divider.visible ? divider.height : 0)
193- ListItemLayout {
194- id: jobLayout
195- title.text: displayName
196-
197- Icon {
198- id: icon
199- width: height
200- height: units.gu(2.5)
201- name: "stock_document"
202- SlotsLayout.position: SlotsLayout.First
203- }
204- }
205- }
206+ delegate: jobDelegate
207 }
208 }
209 }
210
211-
212 Component {
213 id: allJobsPage
214 Page {
215@@ -323,21 +346,7 @@
216 id: jobsList
217 anchors.fill: parent
218 model: Printers.printJobs
219- delegate: ListItem {
220- height: jobsLayout.height + (divider.visible ? divider.height : 0)
221- ListItemLayout {
222- id: jobsLayout
223- title.text: displayName
224-
225- Icon {
226- id: icon
227- width: height
228- height: units.gu(2.5)
229- name: "stock_document"
230- SlotsLayout.position: SlotsLayout.First
231- }
232- }
233- }
234+ delegate: jobDelegate
235 }
236 }
237 }

Subscribers

People subscribed via source and target branches