Tracker Settings: Use BLayoutBuilder template and refactor

... instead of using the less flexable BGroupLayoutBuilder.

* Reduce Group levels used by eliminating the uneeded top
  level group.
* Use font relative spacing units in a few places instead of
  hard coding 20 pixels.
* By using the layout builder template I can use the single
  parameter version of SetInsets().
This commit is contained in:
John Scipione 2013-06-02 21:23:09 -04:00
parent 38a0042248
commit 64c6122863

View File

@ -45,7 +45,7 @@ All rights reserved.
#include <Button.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <GroupLayoutBuilder.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MenuField.h>
#include <ColorControl.h>
@ -193,21 +193,19 @@ DesktopSettingsView::DesktopSettingsView()
const float spacing = be_control_look->DefaultItemSpacing();
BGroupLayoutBuilder(this)
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(fShowDisksIconRadioButton)
.Add(fMountVolumesOntoDesktopRadioButton)
.AddGroup(B_VERTICAL, 0)
.Add(fShowDisksIconRadioButton)
.Add(fMountVolumesOntoDesktopRadioButton)
.AddGroup(B_VERTICAL, 0)
.Add(fMountSharedVolumesOntoDesktopCheckBox)
.SetInsets(20, 0, 0, 0)
.Add(fMountSharedVolumesOntoDesktopCheckBox)
.SetInsets(spacing * 2, 0, 0, 0)
.End()
.AddGlue()
.AddGroup(B_HORIZONTAL)
.Add(fMountButton)
.AddGlue()
.AddGroup(B_HORIZONTAL)
.Add(fMountButton)
.AddGlue()
.End()
.End()
.SetInsets(spacing, spacing, spacing, spacing);
.SetInsets(spacing);
fMountButton->SetTarget(be_app);
}
@ -439,24 +437,22 @@ WindowsSettingsView::WindowsSettingsView()
const float spacing = be_control_look->DefaultItemSpacing();
BGroupLayoutBuilder(this)
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.AddGroup(B_VERTICAL, 0)
.AddGroup(B_VERTICAL, 0)
.Add(fShowFullPathInTitleBarCheckBox)
.Add(fSingleWindowBrowseCheckBox)
.Add(fShowFullPathInTitleBarCheckBox)
.Add(fSingleWindowBrowseCheckBox)
.End()
.AddGroup(B_VERTICAL)
.Add(fShowNavigatorCheckBox)
.SetInsets(20, 0, 0, 0)
.AddGroup(B_VERTICAL)
.Add(fShowNavigatorCheckBox)
.SetInsets(spacing * 2, 0, 0, 0)
.End()
.AddGroup(B_VERTICAL, 0)
.Add(fOutlineSelectionCheckBox)
.Add(fSortFolderNamesFirstCheckBox)
.Add(fTypeAheadFilteringCheckBox)
.AddGroup(B_VERTICAL, 0)
.Add(fOutlineSelectionCheckBox)
.Add(fSortFolderNamesFirstCheckBox)
.Add(fTypeAheadFilteringCheckBox)
.End()
.AddGlue()
.End()
.SetInsets(spacing, spacing, spacing, spacing);
.SetInsets(spacing);
}
@ -733,27 +729,23 @@ SpaceBarSettingsView::SpaceBarSettingsView()
B_TRANSLATE("Warning space color"),
new BMessage(kSpaceBarSwitchColor)));
BBox* box = new BBox("box");
box->SetLabel(fColorPicker = new BMenuField("menu", NULL, menu));
fColorPicker = new BMenuField("menu", NULL, menu);
fColorControl = new BColorControl(BPoint(8,
fColorPicker->Bounds().Height() + 8 + kItemExtraSpacing),
B_CELLS_16x16, 1, "SpaceColorControl",
new BMessage(kSpaceBarColorChanged));
fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
BBox* box = new BBox("box");
box->SetLabel(fColorPicker);
box->AddChild(fColorControl);
const float spacing = be_control_look->DefaultItemSpacing();
BGroupLayout* layout = GroupLayout();
layout->SetOrientation(B_VERTICAL);
layout->SetSpacing(0);
BGroupLayoutBuilder(layout)
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fSpaceBarShowCheckBox)
.Add(box)
.AddGlue()
.SetInsets(spacing, spacing, spacing, spacing);
.SetInsets(B_USE_DEFAULT_SPACING);
}