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
=== modified file 'po/ubuntu-printing-app.pot'
--- po/ubuntu-printing-app.pot 2017-03-21 18:00:45 +0000
+++ po/ubuntu-printing-app.pot 2017-03-21 18:00:45 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2017-03-20 16:57+0000\n"11"POT-Creation-Date: 2017-03-21 17:56+0000\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -84,17 +84,6 @@
84msgid "Settingsā€¦"84msgid "Settingsā€¦"
85msgstr ""85msgstr ""
8686
87#: ../build/po/ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
88#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
89#: ../ubuntu-printing-app/components/PrintRow.qml:74
90msgid "Print"
91msgstr ""
92
93#: ../build/po/ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
94#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
95msgid "Print;Printing;"
96msgstr ""
97
98#. notifier87#. notifier
99#. printing88#. printing
100#. ubuntu89#. ubuntu
@@ -106,30 +95,41 @@
106msgid "Queue;Paper;Print;Printing;"95msgid "Queue;Paper;Print;Printing;"
107msgstr ""96msgstr ""
10897
109#: ../queue-dialog/pages/QueuePage.qml:4198#. Only show the amount of sheets if they are above zero
99#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:1
100#: ../ubuntu-printing-app/components/PrintRow.qml:79
101#: ../ubuntu-printing-app/components/PrintRow.qml:82
102msgid "Print"
103msgstr ""
104
105#: ../ubuntu-printing-app/ubuntu-printing-app.desktop.in.in.h:2
106msgid "Print;Printing;"
107msgstr ""
108
109#: ../queue-dialog/pages/QueuePage.qml:30
110msgid "%1 job"110msgid "%1 job"
111msgid_plural "%1 jobs"111msgid_plural "%1 jobs"
112msgstr[0] ""112msgstr[0] ""
113msgstr[1] ""113msgstr[1] ""
114114
115#: ../queue-dialog/pages/QueuePage.qml:42115#: ../queue-dialog/pages/QueuePage.qml:31
116#: ../queue-dialog/components/QueueDelegate.qml:48116#: ../queue-dialog/components/QueueDelegate.qml:48
117msgid "Printing"117msgid "Printing"
118msgstr ""118msgstr ""
119119
120#: ../queue-dialog/pages/QueuePage.qml:79120#: ../queue-dialog/pages/QueuePage.qml:76
121msgid "No printer jobs"121msgid "No printer jobs"
122msgstr ""122msgstr ""
123123
124#: ../queue-dialog/pages/QueuePage.qml:87124#: ../queue-dialog/pages/QueuePage.qml:84
125msgid "Active"125msgid "Active"
126msgstr ""126msgstr ""
127127
128#: ../queue-dialog/pages/QueuePage.qml:95128#: ../queue-dialog/pages/QueuePage.qml:92
129msgid "Queued"129msgid "Queued"
130msgstr ""130msgstr ""
131131
132#: ../queue-dialog/pages/QueuePage.qml:103132#: ../queue-dialog/pages/QueuePage.qml:100
133msgid "Paused"133msgid "Paused"
134msgstr ""134msgstr ""
135135
@@ -249,10 +249,12 @@
249msgid "URL of PDF to print"249msgid "URL of PDF to print"
250msgstr ""250msgstr ""
251251
252#: ../ubuntu-printing-app/components/PrintRow.qml:74252#: ../ubuntu-printing-app/components/PrintRow.qml:76
253msgid "Create PDF"253msgid "Create PDF"
254msgstr ""254msgstr ""
255255
256#: ../ubuntu-printing-app/components/PrintRow.qml:74256#: ../ubuntu-printing-app/components/PrintRow.qml:80
257msgid "Sheets"257msgid "<u>%1</u> Sheet"
258msgstr ""258msgid_plural "<u>%1</u> Sheets"
259msgstr[0] ""
260msgstr[1] ""
259261
=== modified file 'ubuntu-printing-app/components/PrintRow.qml'
--- ubuntu-printing-app/components/PrintRow.qml 2017-03-07 13:46:02 +0000
+++ ubuntu-printing-app/components/PrintRow.qml 2017-03-21 18:00:45 +0000
@@ -71,7 +71,17 @@
71 color: pressed ? Qt.lighter("#111") : "#111"71 color: pressed ? Qt.lighter("#111") : "#111"
72 enabled: canPrint72 enabled: canPrint
73 Layout.fillWidth: true73 Layout.fillWidth: true
74 text: pdfMode ? i18n.tr("Create PDF") : i18n.tr("Print") + " <u>" + sheets + "</u> " + i18n.tr("Sheets")74 text: {
75 if (pdfMode) {
76 i18n.tr("Create PDF")
77 } else if (sheets > 0) {
78 // Only show the amount of sheets if they are above zero
79 i18n.tr("Print") + " "
80 + i18n.tr("<u>%1</u> Sheet", "<u>%1</u> Sheets", sheets).arg(sheets)
81 } else {
82 i18n.tr("Print")
83 }
84 }
7585
76 onClicked: confirm()86 onClicked: confirm()
77 }87 }
7888
=== modified file 'ubuntu-printing-app/pages/PrintPage.qml'
--- ubuntu-printing-app/pages/PrintPage.qml 2017-03-07 13:46:02 +0000
+++ ubuntu-printing-app/pages/PrintPage.qml 2017-03-21 18:00:45 +0000
@@ -302,7 +302,15 @@
302 pdfMode: printing.pdfMode302 pdfMode: printing.pdfMode
303 // TODO: This should count the range not all pages303 // TODO: This should count the range not all pages
304 // roundUp((pageCount * copies) / duplex)304 // roundUp((pageCount * copies) / duplex)
305 sheets: Math.ceil((document.count * printing.printerJob.copies) / (printing.printerJob.isTwoSided ? 2 : 1))305 sheets: {
306 // If range is selected and a value exists, then set the sheets to zero
307 // for now. Which results in not showing the number sheets
308 if (printing.printerJob.printRangeMode === PrinterEnum.PageRange && printing.printerJob.printRange.length > 0) {
309 0
310 } else {
311 Math.ceil((document.count * printing.printerJob.copies) / (printing.printerJob.isTwoSided ? 2 : 1))
312 }
313 }
306314
307 onCancel: page.cancel()315 onCancel: page.cancel()
308 onConfirm: page.confirm(document.url)316 onConfirm: page.confirm(document.url)
309317
=== modified file 'ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml'
--- ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml 2017-03-21 18:00:45 +0000
+++ ubuntu-printing-app/tests/qmltests/tst_PrintPage.qml 2017-03-21 18:00:45 +0000
@@ -503,6 +503,12 @@
503 mockPrinting.printerJob.isTwoSided = true;503 mockPrinting.printerJob.isTwoSided = true;
504504
505 compare(printRow.sheets, 2);505 compare(printRow.sheets, 2);
506
507 // Enable page ranges, this results in zero sheets
508 mockPrinting.printerJob.printRange = "-3,5-7,9-";
509 mockPrinting.printerJob.printRangeMode = PrinterEnum.PageRange;
510
511 compare(printRow.sheets, 0);
506 }512 }
507 }513 }
508}514}

Subscribers

People subscribed via source and target branches

to all changes: