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
=== removed file 'modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml'
--- modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml 2017-03-09 15:44:19 +0000
+++ modules/Ubuntu/Components/Extras/Example/PrinterQueue.qml 1970-01-01 00:00:00 +0000
@@ -1,133 +0,0 @@
1/*
2 * Copyright 2017 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by Jonas G. Drange <jonas.drange@canonical.com>
17 * Andrew Hayzen <andrew.hayzen@canonical.com>
18 */
19
20import QtQuick 2.4
21import QtQuick.Layouts 1.1
22import Ubuntu.Components 1.3
23import Ubuntu.Components.ListItems 1.3 as ListItems
24import Ubuntu.Components.Extras.Printers 0.1
25
26MainView {
27 width: units.gu(50)
28 height: units.gu(90)
29
30 Component {
31 id: queuePage
32
33 Page {
34 header: PageHeader {
35 title: "Queue: " + printer.name
36 flickable: queueView
37 }
38 visible: false
39
40 property var printer
41
42 ListView {
43 id: queueView
44 anchors {
45 fill: parent
46 }
47 delegate: ListItem {
48 height: modelLayout.height + (divider.visible ? divider.height : 0)
49 trailingActions: ListItemActions {
50 actions: [
51 Action {
52 iconName: model.held ? "media-playback-start" : "media-playback-pause"
53 text: model.held ? "Release" : "Hold"
54
55 onTriggered: {
56 if (model.held) {
57 Printers.releaseJob(printer.name, model.id);
58 } else {
59 Printers.holdJob(printer.name, model.id);
60 }
61 }
62 },
63 Action {
64 iconName: "cancel"
65 text: "Cancel"
66
67 onTriggered: Printers.cancelJob(printer.name, model.id);
68 }
69 ]
70 }
71
72 ListItemLayout {
73 id: modelLayout
74 title.text: displayName
75 subtitle.text: model.title + " (" + model.id + ")\nPrinting " + model.impressionsCompleted + " pages"
76 subtitle.wrapMode: Text.WrapAtWordBoundaryOrAnywhere
77 subtitle.maximumLineCount: 3
78 }
79 }
80 model: printer.jobs
81
82 Label {
83 anchors {
84 centerIn: parent
85 }
86 text: "Empty queue"
87 visible: queueView.count === 0
88 }
89 }
90 }
91 }
92
93 PageStack {
94 id: pageStack
95
96 Page {
97 id: printersPage
98 header: PageHeader {
99 title: "Printers"
100 flickable: printerList
101 }
102 visible: false
103
104 ListView {
105 id: printerList
106 anchors { fill: parent }
107 model: Printers.allPrintersWithPdf
108 delegate: ListItem {
109 height: modelLayout.height + (divider.visible ? divider.height : 0)
110 ListItemLayout {
111 id: modelLayout
112 title.text: displayName
113 title.font.bold: model.default
114 subtitle.text: description
115
116 Icon {
117 id: icon
118 width: height
119 height: units.gu(2.5)
120 name: "printer-symbolic"
121 SlotsLayout.position: SlotsLayout.First
122 }
123
124 ProgressionSlot {}
125 }
126 onClicked: pageStack.push(queuePage, { printer: model })
127 }
128 }
129 }
130
131 Component.onCompleted: push(printersPage)
132 }
133}
1340
=== modified file 'modules/Ubuntu/Components/Extras/Example/Printers.qml'
--- modules/Ubuntu/Components/Extras/Example/Printers.qml 2017-03-10 13:15:27 +0000
+++ modules/Ubuntu/Components/Extras/Example/Printers.qml 2017-03-16 15:49:26 +0000
@@ -277,6 +277,44 @@
277 }277 }
278278
279 Component {279 Component {
280 id: jobDelegate
281
282 ListItem {
283 height: modelLayout.height + (divider.visible ? divider.height : 0)
284 trailingActions: ListItemActions {
285 actions: [
286 Action {
287 iconName: model.held ? "media-playback-start" : "media-playback-pause"
288 text: model.held ? "Release" : "Hold"
289
290 onTriggered: {
291 if (model.held) {
292 Printers.releaseJob(model.printerName, model.id);
293 } else {
294 Printers.holdJob(model.printerName, model.id);
295 }
296 }
297 },
298 Action {
299 iconName: "cancel"
300 text: "Cancel"
301
302 onTriggered: Printers.cancelJob(model.printerName, model.id);
303 }
304 ]
305 }
306
307 ListItemLayout {
308 id: modelLayout
309 title.text: displayName
310 subtitle.text: "Printing " + model.impressionsCompleted + " pages" + "\n" + model.printerName
311 subtitle.wrapMode: Text.WrapAtWordBoundaryOrAnywhere
312 subtitle.maximumLineCount: 3
313 }
314 }
315 }
316
317 Component {
280 id: jobPage318 id: jobPage
281 Page {319 Page {
282 property var printer320 property var printer
@@ -290,26 +328,11 @@
290 id: jobList328 id: jobList
291 anchors.fill: parent329 anchors.fill: parent
292 model: printer.jobs330 model: printer.jobs
293 delegate: ListItem {331 delegate: jobDelegate
294 height: jobLayout.height + (divider.visible ? divider.height : 0)
295 ListItemLayout {
296 id: jobLayout
297 title.text: displayName
298
299 Icon {
300 id: icon
301 width: height
302 height: units.gu(2.5)
303 name: "stock_document"
304 SlotsLayout.position: SlotsLayout.First
305 }
306 }
307 }
308 }332 }
309 }333 }
310 }334 }
311335
312
313 Component {336 Component {
314 id: allJobsPage337 id: allJobsPage
315 Page {338 Page {
@@ -323,21 +346,7 @@
323 id: jobsList346 id: jobsList
324 anchors.fill: parent347 anchors.fill: parent
325 model: Printers.printJobs348 model: Printers.printJobs
326 delegate: ListItem {349 delegate: jobDelegate
327 height: jobsLayout.height + (divider.visible ? divider.height : 0)
328 ListItemLayout {
329 id: jobsLayout
330 title.text: displayName
331
332 Icon {
333 id: icon
334 width: height
335 height: units.gu(2.5)
336 name: "stock_document"
337 SlotsLayout.position: SlotsLayout.First
338 }
339 }
340 }
341 }350 }
342 }351 }
343 }352 }

Subscribers

People subscribed via source and target branches