<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/106058/">http://git.reviewboard.kde.org/r/106058/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 21st, 2012, 7:23 p.m., <b>Albert Astals Cid</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="http://git.reviewboard.kde.org/r/106058/diff/2/?file=79672#file79672line2814" style="color: black; font-weight: bold; text-decoration: underline;">core/document.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void Document::setViewport( const DocumentViewport & viewport, int excludeId, bool smoothMove )</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2814</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">const</span> <span class="kt">bool</span> <span class="n">currentPageChanged</span> <span class="o">=</span> <span class="p">(</span><span class="n">d</span><span class="o">-></span><span class="n">m_currentPage</span> <span class="o">!=</span> <span class="n">currentViewportPage</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm wondering if we could save the m_currentPage variable and just use the oldViewport variable as used in the if just above this function.
It's not that i care about the size of an int, but if we have less "duplicate" information the better, otherwise it's easy for things to get out of sync.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">We can't use oldViewport, because of the following code some lines above:
if ( oldViewport.pageNumber == viewport.pageNumber || !oldViewport.isValid() )
{
// if page is unchanged save the viewport at current position in queue
oldViewport = viewport;
}
So if the old viewport is not valid (on initial startup), the oldViewport it set to the current viewport -> we won't be able to determine a page change in that case, because oldViewport.pageNumber and d->m_viewportIterator.pageNumber will be the same.
Is the patch ok to commit otherwise?</pre>
<br />
<p>- Tobias</p>
<br />
<p>On August 21st, 2012, 7:06 a.m., Tobias Koenig wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Okular.</div>
<div>By Tobias Koenig.</div>
<p style="color: grey;"><i>Updated Aug. 21, 2012, 7:06 a.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The DocumentObserver API currently does not provide a way to notify about page changes, only about viewport changes. That means each implementation of DocumentObserver (e.g. TOC, MiniBar, SideReview etc.) kept a private variable to keep track of the current page to detect page changes.
This patch moves the page change detection into the Okular::Document class and extends the Okular::DocumentObserver API with the two callbacks notifyCurrentPageAboutToBeChanged(int page) and notifyCurrentPageChanged(int page).
That allows the implementations of Okular::DocumentObserver to just reimplement the notifyCurrentPageChanged() callback instead of reimplementing the page-changed-detection logic.
Since the two callbacks are always invoked on _all_ listeners, the PageView has now a chance to get informed about page changes even though it's notifyViewport() method is not invoked if it changes the viewport itself.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>core/document.cpp <span style="color: grey">(f6bf699)</span></li>
<li>core/document_p.h <span style="color: grey">(54e922d)</span></li>
<li>core/observer.h <span style="color: grey">(76c096c)</span></li>
<li>core/observer.cpp <span style="color: grey">(0201a1d)</span></li>
<li>ui/minibar.h <span style="color: grey">(acb1163)</span></li>
<li>ui/minibar.cpp <span style="color: grey">(051df72)</span></li>
<li>ui/pagesizelabel.h <span style="color: grey">(ea508b8)</span></li>
<li>ui/pagesizelabel.cpp <span style="color: grey">(4a80779)</span></li>
<li>ui/pageview.h <span style="color: grey">(43ca2ab)</span></li>
<li>ui/pageview.cpp <span style="color: grey">(5e04412)</span></li>
<li>ui/presentationwidget.h <span style="color: grey">(20dbcbb)</span></li>
<li>ui/presentationwidget.cpp <span style="color: grey">(f4da539)</span></li>
<li>ui/side_reviews.h <span style="color: grey">(d063b7b)</span></li>
<li>ui/side_reviews.cpp <span style="color: grey">(a036c48)</span></li>
<li>ui/thumbnaillist.h <span style="color: grey">(0d7136b)</span></li>
<li>ui/thumbnaillist.cpp <span style="color: grey">(8b23025)</span></li>
<li>ui/toc.h <span style="color: grey">(4e63ef6)</span></li>
<li>ui/toc.cpp <span style="color: grey">(3203c79)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/106058/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>