<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="https://git.reviewboard.kde.org/r/116560/">https://git.reviewboard.kde.org/r/116560/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On March 3rd, 2014, 11:51 a.m. UTC, <b>Alexandr Akulich</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="https://git.reviewboard.kde.org/r/116560/diff/5/?file=251681#file251681line49" style="color: black; font-weight: bold; text-decoration: underline;">tools/debugger/main-window.cpp</a>
<span style="font-weight: normal;">
(Diff revision 5)
</span>
</th>
</tr>
</thead>
<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">49</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">switch</span> <span class="p">(</span><span class="n">m_ui</span><span class="p">.</span><span class="n">tabWidget</span><span class="o">-></span><span class="n">currentIndex</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 propose to rewrite it as:
switch (m_ui.tabWidget->currentWidget()) {
case m_ui.mcTab:
m_ui.mcLogsView->saveLogFile();
break;
case m_ui.gabbleTab:
m_ui.gabbleLogsView->saveLogFile();
break;
…
}
Such change will make method independent on tabs order.
At very least, you should add space before open brace.
I'm not sure that placing couple of instructions on same line is acceptable.</pre>
</blockquote>
<p>On March 3rd, 2014, 12:11 p.m. UTC, <b>Martin Klapetek</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Note that c++ switch operates only on int values, so the code above wouldn't work as is.
More simpler solution would be to simply get the current tab, cast it to the debug-message-view and call the method on it, no switch needed at all.</pre>
</blockquote>
<p>On March 3rd, 2014, 12:47 p.m. UTC, <b>David Edmundson</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">pointers are an int.
Your suggestion is better though :)</pre>
</blockquote>
<p>On March 3rd, 2014, 12:54 p.m. UTC, <b>Martin Klapetek</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">> pointers are an int.
It won't work without explicitly casting to (int) first, betting two beers on it.</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;">Bother:
new.cpp:4:14: error: switch quantity not an integer
I owe you two beers.</pre>
<br />
<p>- David</p>
<br />
<p>On March 3rd, 2014, 11:16 a.m. UTC, mayank jha wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Telepathy.</div>
<div>By mayank jha.</div>
<p style="color: grey;"><i>Updated March 3, 2014, 11:16 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=303564">303564</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
ktp-common-internals
</div>
<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;">Adds a button Save Log file to save the log in the currentTab of the TabWidget.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </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;">Runs fine!</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>tools/debugger/debug-message-view.h <span style="color: grey">(49a4b2f)</span></li>
<li>tools/debugger/debug-message-view.cpp <span style="color: grey">(c2ead13)</span></li>
<li>tools/debugger/main-window.h <span style="color: grey">(3876767)</span></li>
<li>tools/debugger/main-window.cpp <span style="color: grey">(faf7c22)</span></li>
<li>tools/debugger/main-window.ui <span style="color: grey">(0813149)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/116560/diff/" style="margin-left: 3em;">View Diff</a></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>
<ul>
<li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2014/03/03/e4d604cc-f67a-482a-9c81-0de3cbf3f2ea__savebutton.png">The Button added</a></li>
<li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2014/03/03/b6bb5033-dae3-4edc-bd60-f6428d9cfeda__savedialog.png">The File Dialog Box</a></li>
</ul>
</td>
</tr>
</table>
</div>
</body>
</html>