[haiku-commits] Re: r40500 - haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 Feb 2011 09:07:00 +0100 (MET)

kallisti5@xxxxxxxxxxx wrote:
>  {
> +     float textControlW;
> +     float textControlH;

"width", and "height" would be preferred over H/W. Besides that they aren't 
defined where they should be (ie. where they are used, not at the beginning of 
the function). I'm starting to feel like an old record.

> +     // Create our controls
> +     fAddressField = new BTextControl(frame, "address", "IP Address:",
> +             NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
> +     fNetmaskField = new BTextControl(frame, "netmask", "Netmask:",
> +             NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
>  
> +     fAddressField->GetPreferredSize(&textControlW, &textControlH);
> +     float labelSize = ( textControlW + 50 )
> +             - fAddressField->StringWidth("XXX.XXX.XXX.XXX");
[...]
>       AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
> -             .Add(address)
> +             .Add(fAddressField)
> +             .Add(fNetmaskField)

You mix layout and non-layout aware code here -- why? Please make actually use 
of the layout kit, which would also save setting the divider manually.
Please take more care about code quality!

>               .SetInsets(10, 10, 10, 10)

Those should be removed, too, or set to B_DEFAULT_SPACING (which should be the 
default, though).

Bye,
   Axel.


Other related posts: