[opensource-dev] Review Request: STORM-737 Add "+" menu to Inventory/Recent

Vadim ProductEngine vsavchuk at productengine.com
Mon Dec 27 04:31:08 PST 2010



> On 2010-12-24 13:25:16, Aleric Inglewood wrote:
> > indra/newview/llpanelmaininventory.cpp, line 948
> > <http://codereview.secondlife.com/r/65/diff/1/?file=274#file274line948>
> >
> >     While you're removing that empty line anyway, I thought I'd help you to not learn the bad coding habbits of whoever wrote the original code ;).
> >     
> >     operator== returns a bool, might as well do the conversions one step later (if at all) and use a bool here.
> >     
> >     Using 'bool' always has the preference (BOOL is ugly window-ism).
> >     
> >     Certainly in this case since !recent_active converts it to a bool again! (bool --> BOOL -> bool -> BOOL now).
> >     
> >     Secondly, when testing if a variable is equal to a literal/constant, I think that's better readable to put the variable up front, thus: mActivePanel()->getName() == "Recent Items".
> >     
> >     Finally, although you may choose to leave it like it is, be aware that the extra 'variable' recent_active here was only added as pseudo 'comment' and to because the monitor of the original coder wasn't wide enough. If you have a normal 22" inch like all devs, you might also consider the more professional looking:
> >     
> >     // "New Folder" is broken for the Recent Items tab. Do not enable it for that case.
> >     mMenuAdd->getChild<LLMenuItemGL>("New Folder")->setEnabled(mActivePanel->getName() != "Recent Items");
> >

I tend to agree regarding the BOOL, but the other two issues are rather a matter of taste, which, IMHO, is not a subject of code review.

Besides:
* Putting a constant on the left of a comparison operator makes sure you won't get a hard-to-find bug if you accidentally write "=" instead of "==" (I don't like this habit either, but at least it makes sense).
* Using reasonably named variables to make logic clearer is not a "bad coding habit" and doesn't look any less professional to me.


- Vadim


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://codereview.secondlife.com/r/65/#review88
-----------------------------------------------------------


On 2010-12-23 13:25:31, Jonathan Yap wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://codereview.secondlife.com/r/65/
> -----------------------------------------------------------
> 
> (Updated 2010-12-23 13:25:31)
> 
> 
> Review request for Viewer.
> 
> 
> Summary
> -------
> 
> This change enables the "+" menu in Inventory/Recent
> It grays out "New Folder" in this menu
> It enables identical menu entries when you right click on an inventory item.
> 
> Question:
>  Is graying out "New Folder" best done where I am doing it now -- in 
> llpanelmaininventory.cpp / LLPanelMainInventory::onAddButtonClick()
> 
> 
> This addresses bug storm-737.
>     http://jira.secondlife.com/browse/storm-737
> 
> 
> Diffs
> -----
> 
>   doc/contributions.txt e843e274fa58 
>   indra/newview/llinventorybridge.cpp e843e274fa58 
>   indra/newview/llpanelmaininventory.cpp e843e274fa58 
> 
> Diff: http://codereview.secondlife.com/r/65/diff
> 
> 
> Testing
> -------
> 
> I opened up Inventory/My Inventory and used all the "New xxx" options for both right clicking on an inventory item and also from the "+" menu.
> 
> I then changed to the Recent tab and performed the same steps.
> 
> New items were created as expected, except "New Folder" was not an option via either method when the Recent tab was active.
> 
> 
> Thanks,
> 
> Jonathan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/opensource-dev/attachments/20101227/c643e9a4/attachment-0001.htm 


More information about the opensource-dev mailing list