Remodeled the settings window after MediaPlayer.

This commit is contained in:
Humdinger
2012-02-29 19:17:46 +01:00
parent 4c9dc4c642
commit a866fc60f9
+42 -32
View File
@@ -7,8 +7,7 @@
#include <Box.h> #include <Box.h>
#include <Catalog.h> #include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <GroupLayout.h> #include <LayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h> #include <Locale.h>
#include <Path.h> #include <Path.h>
#include <Screen.h> #include <Screen.h>
@@ -26,13 +25,31 @@ const uint32 MSG_DESTSELECT = 'mDes';
#define B_TRANSLATE_CONTEXT "ExpanderPreferences" #define B_TRANSLATE_CONTEXT "ExpanderPreferences"
ExpanderPreferences::ExpanderPreferences(BMessage *settings) ExpanderPreferences::ExpanderPreferences(BMessage *settings)
: BWindow(BRect(0, 0, 325, 305), "Expander", B_MODAL_WINDOW, : BWindow(BRect(0, 0, 325, 305), B_TRANSLATE("Expander settings"),
B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS), B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL, B_NOT_CLOSABLE
| B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fSettings(settings), fSettings(settings),
fUsePanel(NULL) fUsePanel(NULL)
{ {
BBox* box = new BBox("background"); const float kSpacing = be_control_look->DefaultItemSpacing();
box->SetLabel(B_TRANSLATE("Expander settings"));
BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, kSpacing / 2);
settingsBox->SetLayout(settingsLayout);
BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2);
buttonBox->SetLayout(buttonLayout);
BStringView *expansionLabel = new BStringView("stringViewExpansion",
B_TRANSLATE("Expansion"));
expansionLabel->SetFont(be_bold_font);
BStringView *destinationLabel = new BStringView("stringViewDestination",
B_TRANSLATE("Destination folder"));
destinationLabel->SetFont(be_bold_font);
BStringView *otherLabel = new BStringView("stringViewOther",
B_TRANSLATE("Other"));
otherLabel->SetFont(be_bold_font);
fAutoExpand = new BCheckBox("autoExpand", fAutoExpand = new BCheckBox("autoExpand",
B_TRANSLATE("Automatically expand files"), NULL); B_TRANSLATE("Automatically expand files"), NULL);
@@ -61,23 +78,26 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings)
fAutoShow = new BCheckBox("autoShow", fAutoShow = new BCheckBox("autoShow",
B_TRANSLATE("Automatically show contents listing"), NULL); B_TRANSLATE("Automatically show contents listing"), NULL);
const float kSpacing = be_control_look->DefaultItemSpacing(); BButton* okbutton = new BButton("OKButton", B_TRANSLATE("OK"),
new BMessage(MSG_OK));
okbutton->MakeDefault(true);
BButton* cancel = new BButton("CancelButton", B_TRANSLATE("Cancel"),
new BMessage(MSG_CANCEL));
BView* view = new BGroupView(); // Build the layout
view->SetLayout(new BGroupLayout(B_HORIZONTAL)); BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
view->AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) .AddGroup(settingsLayout)
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(new BStringView("expansion", B_TRANSLATE("Expansion:"))) .Add(expansionLabel)
.AddGlue() .AddGlue()
.End() .End()
.AddGroup(B_VERTICAL, 0) .AddGroup(B_VERTICAL, 0)
.Add(fAutoExpand) .Add(fAutoExpand)
.Add(fCloseWindow) .Add(fCloseWindow)
.SetInsets(kSpacing, kSpacing / 2, 0, 0) .SetInsets(kSpacing, 0, 0, 0)
.End() .End()
.AddGroup(B_HORIZONTAL, 0) .AddGroup(B_HORIZONTAL, 0)
.Add(new BStringView("destinationFolder", .Add(destinationLabel)
B_TRANSLATE("Destination folder:")))
.AddGlue() .AddGlue()
.SetInsets(0, kSpacing, 0, 0) .SetInsets(0, kSpacing, 0, 0)
.End() .End()
@@ -89,40 +109,30 @@ ExpanderPreferences::ExpanderPreferences(BMessage *settings)
.Add(fDestText, 0.8) .Add(fDestText, 0.8)
.AddStrut(be_control_look->DefaultLabelSpacing()) .AddStrut(be_control_look->DefaultLabelSpacing())
.Add(fSelect, 0.2) .Add(fSelect, 0.2)
.SetInsets(kSpacing * 2, 0, 0, 0) .SetInsets(kSpacing * 2, 0, kSpacing / 2, 0)
.End() .End()
.SetInsets(kSpacing, kSpacing / 2, 0, 0) .SetInsets(kSpacing, 0, 0, 0)
.End() .End()
.AddGroup(B_HORIZONTAL, 0) .AddGroup(B_HORIZONTAL, 0)
.Add(new BStringView("other", B_TRANSLATE("Other:"))) .Add(otherLabel)
.AddGlue() .AddGlue()
.SetInsets(0, kSpacing / 2, 0, 0) .SetInsets(0, kSpacing / 2, 0, 0)
.End() .End()
.AddGroup(B_VERTICAL, 0) .AddGroup(B_VERTICAL, 0)
.Add(fOpenDest) .Add(fOpenDest)
.Add(fAutoShow) .Add(fAutoShow)
.SetInsets(kSpacing, kSpacing / 2, 0, 0) .SetInsets(kSpacing, 0, 0, 0)
.End() .End()
.SetInsets(kSpacing, kSpacing, kSpacing, kSpacing) .SetInsets(kSpacing, kSpacing, kSpacing, kSpacing)
); .End()
box->AddChild(view); .AddGroup(buttonLayout)
BButton* button = new BButton("OKButton", B_TRANSLATE("OK"),
new BMessage(MSG_OK));
button->MakeDefault(true);
BButton* cancel = new BButton("CancelButton", B_TRANSLATE("Cancel"),
new BMessage(MSG_CANCEL));
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 11)
.Add(box)
.AddGroup(B_HORIZONTAL, kSpacing) .AddGroup(B_HORIZONTAL, kSpacing)
.AddGlue() .AddGlue()
.Add(cancel) .Add(cancel)
.Add(button) .Add(okbutton)
.End() .End()
.SetInsets(kSpacing, kSpacing, kSpacing, kSpacing) .SetInsets(kSpacing, kSpacing, kSpacing, kSpacing)
); .End();
CenterOnScreen(); CenterOnScreen();