1 /* PoorManAdvancedView.cpp
10 #include <LayoutBuilder.h>
13 #include "constants.h"
14 #include "PoorManAdvancedView.h"
15 #include "PoorManWindow.h"
16 #include "PoorManApplication.h"
19 #undef B_TRANSLATION_CONTEXT
20 #define B_TRANSLATION_CONTEXT "PoorMan"
23 PoorManAdvancedView::PoorManAdvancedView(const char* name
)
25 BView(name
, B_WILL_DRAW
, NULL
)
28 win
= ((PoorManApplication
*)be_app
)->GetPoorManWindow();
30 BBox
* connectionOptions
= new BBox(B_TRANSLATE("Connections"));
31 connectionOptions
->SetLabel(STR_BBX_CONNECTION
);
33 fMaxConnections
= new StatusSlider("Max Slider", STR_SLD_LABEL
,
35 new BMessage(MSG_PREF_ADV_SLD_MAX_CONNECTION
), 1, 200);
37 // labels below the slider 1 and 200
38 fMaxConnections
->SetLimitLabels("1", "200");
39 SetMaxSimutaneousConnections(win
->MaxConnections());
42 BGroupLayout
* connectionOptionsLayout
= new BGroupLayout(B_VERTICAL
, 0);
43 connectionOptions
->SetLayout(connectionOptionsLayout
);
45 BLayoutBuilder::Group
<>(this, B_VERTICAL
)
46 .AddGroup(connectionOptionsLayout
)
47 .SetInsets(B_USE_ITEM_INSETS
)
48 .AddStrut(B_USE_ITEM_SPACING
)
52 .SetInsets(B_USE_WINDOW_SPACING
, B_USE_WINDOW_SPACING
,
53 B_USE_WINDOW_SPACING
, B_USE_DEFAULT_SPACING
);
57 PoorManAdvancedView::SetMaxSimutaneousConnections(int32 num
)
59 if (num
<= 0 || num
> 200)
60 fMaxConnections
->SetValue(32);
62 fMaxConnections
->SetValue(num
);