1 /* PoorManLoggingView.cpp
10 #include <LayoutBuilder.h>
13 #include "constants.h"
14 #include "PoorManWindow.h"
15 #include "PoorManApplication.h"
16 #include "PoorManLoggingView.h"
19 #undef B_TRANSLATION_CONTEXT
20 #define B_TRANSLATION_CONTEXT "PoorMan"
23 PoorManLoggingView::PoorManLoggingView(const char* name
)
25 BView(name
, B_WILL_DRAW
, NULL
)
28 win
= ((PoorManApplication
*)be_app
)->GetPoorManWindow();
30 BBox
* consoleLogging
= new BBox(B_TRANSLATE("Console Logging"));
31 consoleLogging
->SetLabel(STR_BBX_CONSOLE_LOGGING
);
34 BBox
* fileLogging
= new BBox(B_TRANSLATE("File Logging"));
35 fileLogging
->SetLabel(STR_BBX_FILE_LOGGING
);
38 fLogConsole
= new BCheckBox(B_TRANSLATE("Log To Console"),
39 STR_CBX_LOG_CONSOLE
, new BMessage(MSG_PREF_LOG_CBX_CONSOLE
));
40 // set the checkbox to the value the program has
41 SetLogConsoleValue(win
->LogConsoleFlag());
44 fLogFile
= new BCheckBox(B_TRANSLATE("Log To File"), STR_CBX_LOG_FILE
,
45 new BMessage(MSG_PREF_LOG_CBX_FILE
));
46 // set the checkbox to the value the program has
47 SetLogFileValue(win
->LogFileFlag());
50 fLogFileName
= new BTextControl(B_TRANSLATE("File Name"),
51 STR_TXT_LOG_FILE_NAME
, NULL
, NULL
);
52 SetLogFileName(win
->LogPath());
55 fCreateLogFile
= new BButton(B_TRANSLATE("Create Log File"),
56 STR_BTN_CREATE_LOG_FILE
, new BMessage(MSG_PREF_LOG_BTN_CREATE_FILE
));
58 BGroupLayout
* consoleLoggingLayout
= new BGroupLayout(B_VERTICAL
, 0);
59 consoleLogging
->SetLayout(consoleLoggingLayout
);
61 BGroupLayout
* fileLoggingLayout
= new BGroupLayout(B_VERTICAL
,
63 fileLogging
->SetLayout(fileLoggingLayout
);
65 BLayoutBuilder::Group
<>(this, B_VERTICAL
)
66 .SetInsets(B_USE_WINDOW_SPACING
, B_USE_WINDOW_SPACING
,
67 B_USE_WINDOW_SPACING
, B_USE_DEFAULT_SPACING
)
68 .AddGroup(consoleLoggingLayout
)
69 .SetInsets(B_USE_ITEM_INSETS
)
70 .AddGroup(B_HORIZONTAL
)
71 .SetInsets(0, B_USE_ITEM_INSETS
, 0, 0)
76 .AddGroup(fileLoggingLayout
)
77 .SetInsets(B_USE_ITEM_INSETS
)
78 .AddGrid(B_USE_SMALL_SPACING
, B_USE_SMALL_SPACING
)
79 .SetInsets(0, B_USE_ITEM_INSETS
, 0, 0)
81 .AddTextControl(fLogFileName
, 0, 1, B_ALIGN_LEFT
, 1, 2)
82 .Add(fCreateLogFile
, 2, 2);