btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / poorman / PoorManAdvancedView.cpp
blob3b8e4e47de541a28c7400f5bc580a27dd7a7b1a7
1 /* PoorManAdvancedView.cpp
3 * Philip Harrison
4 * Started: 5/12/2004
5 * Version: 0.1
6 */
8 #include <Box.h>
9 #include <Catalog.h>
10 #include <LayoutBuilder.h>
11 #include <Locale.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)
27 PoorManWindow* win;
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,
34 STR_SLD_STATUS_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)
49 .Add(fMaxConnections)
50 .End()
51 .AddGlue()
52 .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
53 B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING);
56 void
57 PoorManAdvancedView::SetMaxSimutaneousConnections(int32 num)
59 if (num <= 0 || num > 200)
60 fMaxConnections->SetValue(32);
61 else
62 fMaxConnections->SetValue(num);