Merge lp:~ahayzen/ubuntu-printing-app/page-range-ignore-sheets-count into lp:ubuntu-printing-app

Proposed by Andrew Hayzen
Status: Merged
Approved by: Michael Sheldon
Approved revision: 67
Merged at revision: 36
Proposed branch: lp:~ahayzen/ubuntu-printing-app/page-range-ignore-sheets-count
Merge into: lp:ubuntu-printing-app
Prerequisite: lp:~ahayzen/ubuntu-printing-app/queue-dialog
Diff against target: 156 lines (+50/-24)
4 files modified
po/ubuntu-printing-app.pot (+24/-22)
ubuntu-printing-app/components/PrintRow.qml (+11/-1)
ubuntu-printing-app/pages/PrintPage.qml (+9/-1)
ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml (+6/-0)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-printing-app/page-range-ignore-sheets-count
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
Review via email: mp+320530@code.launchpad.net

Commit message

* Only show sheets count in print button when we are not performing a print range for now.
* Fix sheets text so that it shows singular and plural

Description of the change

* Only show sheets count in print button when we are not performing a print range for now.
* Fix sheets text so that it shows singular and plural

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

* Be explicit in the comparision

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

For phase 1, if there is a page range we won't show the amount of sheets it will result in.

In phase 2 there will be full validation of the copies/printRange fields at this point we'll calculate the number of sheets.

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/ubuntu-printing-app.pot'
2--- po/ubuntu-printing-app.pot 2017-03-21 18:00:45 +0000
3+++ po/ubuntu-printing-app.pot 2017-03-21 18:00:45 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2017-03-20 16:57+0000\n"
9+"POT-Creation-Date: 2017-03-21 17:56+0000\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -84,17 +84,6 @@
14 msgid "Settingsā€¦"
15 msgstr ""
16
17-#: ../build/po/ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
18-#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
19-#: ../ubuntu-printing-app/components/PrintRow.qml:74
20-msgid "Print"
21-msgstr ""
22-
23-#: ../build/po/ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
24-#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
25-msgid "Print;Printing;"
26-msgstr ""
27-
28 #. notifier
29 #. printing
30 #. ubuntu
31@@ -106,30 +95,41 @@
32 msgid "Queue;Paper;Print;Printing;"
33 msgstr ""
34
35-#: ../queue-dialog/pages/QueuePage.qml:41
36+#. Only show the amount of sheets if they are above zero
37+#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
38+#: ../ubuntu-printing-app/components/PrintRow.qml:79
39+#: ../ubuntu-printing-app/components/PrintRow.qml:82
40+msgid "Print"
41+msgstr ""
42+
43+#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
44+msgid "Print;Printing;"
45+msgstr ""
46+
47+#: ../queue-dialog/pages/QueuePage.qml:30
48 msgid "%1 job"
49 msgid_plural "%1 jobs"
50 msgstr[0] ""
51 msgstr[1] ""
52
53-#: ../queue-dialog/pages/QueuePage.qml:42
54+#: ../queue-dialog/pages/QueuePage.qml:31
55 #: ../queue-dialog/components/QueueDelegate.qml:48
56 msgid "Printing"
57 msgstr ""
58
59-#: ../queue-dialog/pages/QueuePage.qml:79
60+#: ../queue-dialog/pages/QueuePage.qml:76
61 msgid "No printer jobs"
62 msgstr ""
63
64-#: ../queue-dialog/pages/QueuePage.qml:87
65+#: ../queue-dialog/pages/QueuePage.qml:84
66 msgid "Active"
67 msgstr ""
68
69-#: ../queue-dialog/pages/QueuePage.qml:95
70+#: ../queue-dialog/pages/QueuePage.qml:92
71 msgid "Queued"
72 msgstr ""
73
74-#: ../queue-dialog/pages/QueuePage.qml:103
75+#: ../queue-dialog/pages/QueuePage.qml:100
76 msgid "Paused"
77 msgstr ""
78
79@@ -249,10 +249,12 @@
80 msgid "URL of PDF to print"
81 msgstr ""
82
83-#: ../ubuntu-printing-app/components/PrintRow.qml:74
84+#: ../ubuntu-printing-app/components/PrintRow.qml:76
85 msgid "Create PDF"
86 msgstr ""
87
88-#: ../ubuntu-printing-app/components/PrintRow.qml:74
89-msgid "Sheets"
90-msgstr ""
91+#: ../ubuntu-printing-app/components/PrintRow.qml:80
92+msgid "<u>%1</u> Sheet"
93+msgid_plural "<u>%1</u> Sheets"
94+msgstr[0] ""
95+msgstr[1] ""
96
97=== modified file 'ubuntu-printing-app/components/PrintRow.qml'
98--- ubuntu-printing-app/components/PrintRow.qml 2017-03-07 13:46:02 +0000
99+++ ubuntu-printing-app/components/PrintRow.qml 2017-03-21 18:00:45 +0000
100@@ -71,7 +71,17 @@
101 color: pressed ? Qt.lighter("#111") : "#111"
102 enabled: canPrint
103 Layout.fillWidth: true
104- text: pdfMode ? i18n.tr("Create PDF") : i18n.tr("Print") + " <u>" + sheets + "</u> " + i18n.tr("Sheets")
105+ text: {
106+ if (pdfMode) {
107+ i18n.tr("Create PDF")
108+ } else if (sheets > 0) {
109+ // Only show the amount of sheets if they are above zero
110+ i18n.tr("Print") + " "
111+ + i18n.tr("<u>%1</u> Sheet", "<u>%1</u> Sheets", sheets).arg(sheets)
112+ } else {
113+ i18n.tr("Print")
114+ }
115+ }
116
117 onClicked: confirm()
118 }
119
120=== modified file 'ubuntu-printing-app/pages/PrintPage.qml'
121--- ubuntu-printing-app/pages/PrintPage.qml 2017-03-07 13:46:02 +0000
122+++ ubuntu-printing-app/pages/PrintPage.qml 2017-03-21 18:00:45 +0000
123@@ -302,7 +302,15 @@
124 pdfMode: printing.pdfMode
125 // TODO: This should count the range not all pages
126 // roundUp((pageCount * copies) / duplex)
127- sheets: Math.ceil((document.count * printing.printerJob.copies) / (printing.printerJob.isTwoSided ? 2 : 1))
128+ sheets: {
129+ // If range is selected and a value exists, then set the sheets to zero
130+ // for now. Which results in not showing the number sheets
131+ if (printing.printerJob.printRangeMode === PrinterEnum.PageRange && printing.printerJob.printRange.length > 0) {
132+ 0
133+ } else {
134+ Math.ceil((document.count * printing.printerJob.copies) / (printing.printerJob.isTwoSided ? 2 : 1))
135+ }
136+ }
137
138 onCancel: page.cancel()
139 onConfirm: page.confirm(document.url)
140
141=== modified file 'ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml'
142--- ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml 2017-03-21 18:00:45 +0000
143+++ ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml 2017-03-21 18:00:45 +0000
144@@ -503,6 +503,12 @@
145 mockPrinting.printerJob.isTwoSided = true;
146
147 compare(printRow.sheets, 2);
148+
149+ // Enable page ranges, this results in zero sheets
150+ mockPrinting.printerJob.printRange = "-3,5-7,9-";
151+ mockPrinting.printerJob.printRangeMode = PrinterEnum.PageRange;
152+
153+ compare(printRow.sheets, 0);
154 }
155 }
156 }

Subscribers

People subscribed via source and target branches

to all changes: