[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Review Request: New action class proposal: KDualAction
From: "David Jarvie" <djarvie () kde ! org>
Date: 2010-09-23 16:11:34
Message-ID: 20100923161134.12510.77110 () vidsolbach ! de
[Download RAW message or body]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/5396/#review7733
-----------------------------------------------------------
Labelling the states "active" and "inactive" seems misleading, and not necessarily \
intuitive to use. The summary of the purpose of the class says it's "an action which \
represents two actions, switching from one to the other whenever it is triggered". In \
other words, both actions/states have an equal status, so neither is necessarily \
"active" as compared to the other one? I suggest renaming the states (in the apidox \
and code) - perhaps simply use 'state1' and 'state2' instead.
trunk/KDE/kdelibs/kdeui/actions/kdualaction.h
<http://svn.reviewboard.kde.org/r/5396/#comment7852>
Say which state is initially set by the constructor
trunk/KDE/kdelibs/kdeui/actions/kdualaction.h
<http://svn.reviewboard.kde.org/r/5396/#comment7853>
Say which state is initially set by the constructor
trunk/KDE/kdelibs/kdeui/actions/kdualaction.h
<http://svn.reviewboard.kde.org/r/5396/#comment7854>
Say which state the two values of 'bool state' represent - presumably true = \
active, false = inactive:
@param state true for the active state, false for the inactive state
This comment applies to all methods taking a 'bool state' parameter.
- David
On 2010-09-23 14:29:29, Aurélien Gâteau wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/5396/
> -----------------------------------------------------------
>
> (Updated 2010-09-23 14:29:29)
>
>
> Review request for kdelibs.
>
>
> Summary
> -------
>
> This review-request introduces a new class named KDualAction. The goal of this \
> class is to make it easy to create a dual-state action: an action which represents \
> two actions, switching from one to the other whenever it is triggered. KDualAction \
> can be used to implement actions such as the Play/Pause action of a media player or \
> the Reload/Stop action of a web browser.
> Right now some applications mis-use KToggleAction to implement such dual-state \
> actions: They set the first action as the unchecked state and provide an \
> alternative KGuiItem for the checked state with KToggleAction::setCheckedState(). \
> This is wrong because when the user clicks a button representing the action in a \
> toolbar, the button stays down. The appropriate use cases for toggle buttons (and \
> thus KToggleAction) are documented in a recent addition to the HIG: \
> http://techbase.kde.org/Projects/Usability/HIG/Toggle_Buttons
> Potential users for this class:
>
> - Dragon, Juk, Amarok to implement their Play/Pause action.
>
> - Rekonq to implement its Reload/Stop action. Konqueror could also use this but it \
> does not feature a dual reload/stop action as far as I know.
> - Dolphin could maybe use it to implement its Split/Close action (although it's a \
> bit more involved in this case because the close action changes depending on which \
> panel it is going to close)
> - Any application which incorrectly uses KToggleAction + setCheckedState() to \
> show/hide a UI element (a search on lxr.kde.org shows quite a lot of misuse: \
> http://lxr.kde.org/ident?i=setCheckedState )
>
> Diffs
> -----
>
> trunk/KDE/kdelibs/kdeui/CMakeLists.txt 1171068
> trunk/KDE/kdelibs/kdeui/actions/kdualaction.h PRE-CREATION
> trunk/KDE/kdelibs/kdeui/actions/kdualaction.cpp PRE-CREATION
> trunk/KDE/kdelibs/kdeui/actions/kdualaction_p.h PRE-CREATION
> trunk/KDE/kdelibs/kdeui/tests/CMakeLists.txt 1171068
> trunk/KDE/kdelibs/kdeui/tests/kdualactiontest.cpp PRE-CREATION
>
> Diff: http://svn.reviewboard.kde.org/r/5396/diff
>
>
> Testing
> -------
>
> The class comes with unit-tests. I tested the API made sense by porting Dragon, \
> Konqueror and creating a showHideMenubar action in KStandardAction (review requests \
> to come if the class is accepted).
>
> Thanks,
>
> Aurélien
>
>
[Attachment #3 (text/html)]
<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://svn.reviewboard.kde.org/r/5396/">http://svn.reviewboard.kde.org/r/5396/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Labelling the states \
"active" and "inactive" seems misleading, and not necessarily \
intuitive to use. The summary of the purpose of the class says it's "an \
action which represents two actions, switching from one to the other whenever it is \
triggered". In other words, both actions/states have an equal status, so neither \
is necessarily "active" as compared to the other one? I suggest renaming \
the states (in the apidox and code) - perhaps simply use 'state1' and \
'state2' instead.</pre> <br />
<div>
<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="/r/5396/diff/2/?file=36938#file36938line65" style="color: black; font-weight: \
bold; text-decoration: underline;">trunk/KDE/kdelibs/kdeui/actions/kdualaction.h</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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">public:</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">65</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="cm"> * with setTextForState() or setGuiItemForState().</span></pre></td> \
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Say which \
state is initially set by the constructor</pre> </div>
<br />
<div>
<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="/r/5396/diff/2/?file=36938#file36938line70" style="color: black; font-weight: \
bold; text-decoration: underline;">trunk/KDE/kdelibs/kdeui/actions/kdualaction.h</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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">public:</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">70</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="cm"> * Constructs a KDualAction with the specified parent and \
texts.</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Say which \
state is initially set by the constructor</pre> </div>
<br />
<div>
<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="/r/5396/diff/2/?file=36938#file36938line75" style="color: black; font-weight: \
bold; text-decoration: underline;">trunk/KDE/kdelibs/kdeui/actions/kdualaction.h</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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
"></pre></td> <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: \
0; ">public:</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">75</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="cm"> * Sets the icon, text and tooltip for the state with a \
KGuiItem.</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Say which \
state the two values of 'bool state' represent - presumably true = active, \
false = inactive:
@param state true for the active state, false for the inactive state
This comment applies to all methods taking a 'bool state' parameter.</pre>
</div>
<br />
<p>- David</p>
<br />
<p>On September 23rd, 2010, 2:29 p.m., Aurélien Gâteau wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://svn.reviewboard.kde.orgrb/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 kdelibs.</div>
<div>By Aurélien Gâteau.</div>
<p style="color: grey;"><i>Updated 2010-09-23 14:29:29</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;">This review-request introduces a new class named KDualAction. The goal \
of this class is to make it easy to create a dual-state action: an action which \
represents two actions, switching from one to the other whenever it is triggered. \
KDualAction can be used to implement actions such as the Play/Pause action of a media \
player or the Reload/Stop action of a web browser.
Right now some applications mis-use KToggleAction to implement such dual-state \
actions: They set the first action as the unchecked state and provide an alternative \
KGuiItem for the checked state with KToggleAction::setCheckedState(). This is wrong \
because when the user clicks a button representing the action in a toolbar, the \
button stays down. The appropriate use cases for toggle buttons (and thus \
KToggleAction) are documented in a recent addition to the HIG: \
http://techbase.kde.org/Projects/Usability/HIG/Toggle_Buttons
Potential users for this class:
- Dragon, Juk, Amarok to implement their Play/Pause action.
- Rekonq to implement its Reload/Stop action. Konqueror could also use this but it \
does not feature a dual reload/stop action as far as I know.
- Dolphin could maybe use it to implement its Split/Close action (although it's a \
bit more involved in this case because the close action changes depending on which \
panel it is going to close)
- Any application which incorrectly uses KToggleAction + setCheckedState() to \
show/hide a UI element (a search on lxr.kde.org shows quite a lot of misuse: \
http://lxr.kde.org/ident?i=setCheckedState )</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;">The class comes with unit-tests. I tested the API made sense by porting \
Dragon, Konqueror and creating a showHideMenubar action in KStandardAction (review \
requests to come if the class is accepted).</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>trunk/KDE/kdelibs/kdeui/CMakeLists.txt <span style="color: \
grey">(1171068)</span></li>
<li>trunk/KDE/kdelibs/kdeui/actions/kdualaction.h <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdelibs/kdeui/actions/kdualaction.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdelibs/kdeui/actions/kdualaction_p.h <span style="color: \
grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdelibs/kdeui/tests/CMakeLists.txt <span style="color: \
grey">(1171068)</span></li>
<li>trunk/KDE/kdelibs/kdeui/tests/kdualactiontest.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="http://svn.reviewboard.kde.org/r/5396/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic