1/* PoorManAdvancedView.cpp 2 * 3 * Philip Harrison 4 * Started: 5/12/2004 5 * Version: 0.1 6 */ 7 8#include <Box.h> 9#include <Catalog.h> 10#include <LayoutBuilder.h> 11#include <Locale.h> 12 13#include "constants.h" 14#include "PoorManAdvancedView.h" 15#include "PoorManWindow.h" 16#include "PoorManApplication.h" 17 18 19#undef B_TRANSLATION_CONTEXT 20#define B_TRANSLATION_CONTEXT "PoorMan" 21 22 23PoorManAdvancedView::PoorManAdvancedView(const char* name) 24 : 25 BView(name, B_WILL_DRAW, NULL) 26{ 27 PoorManWindow* win; 28 win = ((PoorManApplication*)be_app)->GetPoorManWindow(); 29 30 BBox* connectionOptions = new BBox(B_TRANSLATE("Connections")); 31 connectionOptions->SetLabel(STR_BBX_CONNECTION); 32 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); 36 37 // labels below the slider 1 and 200 38 fMaxConnections->SetLimitLabels("1", "200"); 39 SetMaxSimutaneousConnections(win->MaxConnections()); 40 41 42 BGroupLayout* connectionOptionsLayout = new BGroupLayout(B_VERTICAL, 0); 43 connectionOptions->SetLayout(connectionOptionsLayout); 44 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); 54} 55 56void 57PoorManAdvancedView::SetMaxSimutaneousConnections(int32 num) 58{ 59 if (num <= 0 || num > 200) 60 fMaxConnections->SetValue(32); 61 else 62 fMaxConnections->SetValue(num); 63} 64