Merge lp:~srazi/qpdfview/page-labels-fixes into lp:qpdfview

Proposed by Razi Alavizadeh
Status: Merged
Merged at revision: 1710
Proposed branch: lp:~srazi/qpdfview/page-labels-fixes
Merge into: lp:qpdfview
Diff against target: 47 lines (+17/-5)
1 file modified
sources/mainwindow.cpp (+17/-5)
To merge this branch: bzr merge lp:~srazi/qpdfview/page-labels-fixes
Reviewer Review Type Date Requested Status
Adam Reichold Approve
Review via email: mp+236940@code.launchpad.net

Description of the change

A small fix and an improvement related to page labels.

To post a comment you must log in.
Revision history for this message
Adam Reichold (adamreichold) wrote :

Hello Razi,

thanks for the merge request. However, I am not sure I understand it correctly. Does it address the problem that the backend could always return English-locale page labels and we would prefer our default page label in this case? If so, wouldn't it be better to fix this once in line 395 of documentview.cpp? (I.e. check if "m_pages.at(number - 1)->label().toInt() != number" before setting "label"?)

Best regards, Adam.

review: Needs Information
Revision history for this message
Razi Alavizadeh (srazi) wrote :

Hello Adam,

Oh... yes, indeed the correct solution instead of first commit (and a part of second commit) is what you said.

Best Regards,
Razi.

Revision history for this message
Adam Reichold (adamreichold) wrote :

Ok, so I'll merge this and make the necessary adjustments...

review: Approve
Revision history for this message
Razi Alavizadeh (srazi) wrote :

OK, thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sources/mainwindow.cpp'
--- sources/mainwindow.cpp 2014-09-21 20:29:25 +0000
+++ sources/mainwindow.cpp 2014-10-02 17:16:12 +0000
@@ -1596,7 +1596,18 @@
1596 }1596 }
15971597
1598 *ok = true;1598 *ok = true;
1599 return currentTab()->pageLabelFromNumber(val);1599
1600 const QString& defaultPageLabel = currentTab()->defaultPageLabelFromNumber(val);
1601 const QString& pageLabel = currentTab()->pageLabelFromNumber(val);
1602
1603 if(defaultPageLabel != pageLabel && pageLabel.toInt() != val)
1604 {
1605 return pageLabel;
1606 }
1607 else
1608 {
1609 return defaultPageLabel;
1610 }
1600}1611}
16011612
1602int MainWindow::currentPage_valueFromText(QString text, bool* ok) const1613int MainWindow::currentPage_valueFromText(QString text, bool* ok) const
@@ -2204,18 +2215,19 @@
2204 if(m_tabWidget->currentIndex() != -1)2215 if(m_tabWidget->currentIndex() != -1)
2205 {2216 {
2206 const int currentPage = currentTab()->currentPage();2217 const int currentPage = currentTab()->currentPage();
2207 const int numberOfPages = currentTab()->numberOfPages();2218 const QString& numberOfPagesAsString = currentTab()->defaultPageLabelFromNumber(currentTab()->numberOfPages());
22082219
2209 const QString& defaultPageLabel = currentTab()->defaultPageLabelFromNumber(currentPage);2220 const QString& defaultPageLabel = currentTab()->defaultPageLabelFromNumber(currentPage);
2210 const QString& pageLabel = currentTab()->pageLabelFromNumber(currentPage);2221 const QString& pageLabel = currentTab()->pageLabelFromNumber(currentPage);
22112222
2212 if((s_settings->mainWindow().usePageLabel() || currentTab()->hasFrontMatter()) && defaultPageLabel != pageLabel)2223 if((s_settings->mainWindow().usePageLabel() || currentTab()->hasFrontMatter()) &&
2224 (defaultPageLabel != pageLabel && pageLabel.toInt() != currentPage))
2213 {2225 {
2214 suffix = QString(" (%1 / %2)").arg(currentPage).arg(numberOfPages);2226 suffix = QString(" (%1 / %2)").arg(defaultPageLabel).arg(numberOfPagesAsString);
2215 }2227 }
2216 else2228 else
2217 {2229 {
2218 suffix = QString(" / %1").arg(numberOfPages);2230 suffix = QString(" / %1").arg(numberOfPagesAsString);
2219 }2231 }
2220 }2232 }
2221 else2233 else

Subscribers

People subscribed via source and target branches