Pathc by Dziadek: localize Poorman. thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40026 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -49,5 +49,16 @@ Application PoorMan : PoorMan.cpp
|
|||||||
match.c
|
match.c
|
||||||
tdate_parse.c
|
tdate_parse.c
|
||||||
|
|
||||||
: be network tracker $(TARGET_LIBSTDC++)
|
: be network tracker $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
DoCatalogs PoorMan :
|
||||||
|
x-vnd.Haiku.PoorMan
|
||||||
|
:
|
||||||
|
constants.cpp
|
||||||
|
PoorManAdvancedView.cpp
|
||||||
|
PoorManLoggingView.cpp
|
||||||
|
PoorManPreferencesWindow.cpp
|
||||||
|
PoorManWindow.cpp
|
||||||
|
;
|
||||||
|
|||||||
@@ -6,12 +6,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "PoorManAdvancedView.h"
|
#include "PoorManAdvancedView.h"
|
||||||
#include "PoorManWindow.h"
|
#include "PoorManWindow.h"
|
||||||
#include "PoorManApplication.h"
|
#include "PoorManApplication.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PoorMan"
|
||||||
|
|
||||||
|
|
||||||
PoorManAdvancedView::PoorManAdvancedView(BRect rect, const char *name)
|
PoorManAdvancedView::PoorManAdvancedView(BRect rect, const char *name)
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
@@ -28,7 +35,7 @@ PoorManAdvancedView::PoorManAdvancedView(BRect rect, const char *name)
|
|||||||
maxRect.right -= 7.0;
|
maxRect.right -= 7.0;
|
||||||
maxRect.bottom -= 118.0;
|
maxRect.bottom -= 118.0;
|
||||||
|
|
||||||
BBox * connectionOptions = new BBox(maxRect, "Connections");
|
BBox * connectionOptions = new BBox(maxRect, B_TRANSLATE("Connections"));
|
||||||
connectionOptions->SetLabel(STR_BBX_CONNECTION);
|
connectionOptions->SetLabel(STR_BBX_CONNECTION);
|
||||||
AddChild(connectionOptions);
|
AddChild(connectionOptions);
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "PoorManWindow.h"
|
#include "PoorManWindow.h"
|
||||||
#include "PoorManApplication.h"
|
#include "PoorManApplication.h"
|
||||||
#include "PoorManLoggingView.h"
|
#include "PoorManLoggingView.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PoorMan"
|
||||||
|
|
||||||
|
|
||||||
PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
||||||
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
|
||||||
{
|
{
|
||||||
@@ -28,7 +35,8 @@ PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
|||||||
consoleLoggingRect.right -= 7.0;
|
consoleLoggingRect.right -= 7.0;
|
||||||
consoleLoggingRect.bottom -= 118.0;
|
consoleLoggingRect.bottom -= 118.0;
|
||||||
|
|
||||||
BBox * consoleLogging = new BBox(consoleLoggingRect, "Console Logging");
|
BBox * consoleLogging = new BBox(consoleLoggingRect,
|
||||||
|
B_TRANSLATE("Console Logging"));
|
||||||
consoleLogging->SetLabel(STR_BBX_CONSOLE_LOGGING);
|
consoleLogging->SetLabel(STR_BBX_CONSOLE_LOGGING);
|
||||||
AddChild(consoleLogging);
|
AddChild(consoleLogging);
|
||||||
|
|
||||||
@@ -39,7 +47,8 @@ PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
|||||||
fileLoggingRect.top = consoleLoggingRect.bottom + 10.0;
|
fileLoggingRect.top = consoleLoggingRect.bottom + 10.0;
|
||||||
fileLoggingRect.bottom = fileLoggingRect.top + 100.0;
|
fileLoggingRect.bottom = fileLoggingRect.top + 100.0;
|
||||||
|
|
||||||
BBox * fileLogging = new BBox(fileLoggingRect, "File Logging");
|
BBox * fileLogging = new BBox(fileLoggingRect,
|
||||||
|
B_TRANSLATE("File Logging"));
|
||||||
fileLogging->SetLabel(STR_BBX_FILE_LOGGING);
|
fileLogging->SetLabel(STR_BBX_FILE_LOGGING);
|
||||||
AddChild(fileLogging);
|
AddChild(fileLogging);
|
||||||
|
|
||||||
@@ -49,13 +58,15 @@ PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
|||||||
BRect tempRect(left, top, consoleLoggingRect.Width() - 5.0, top + box_size);
|
BRect tempRect(left, top, consoleLoggingRect.Width() - 5.0, top + box_size);
|
||||||
|
|
||||||
// Console Logging
|
// Console Logging
|
||||||
logConsole = new BCheckBox(tempRect, "Log To Console", STR_CBX_LOG_CONSOLE, new BMessage(MSG_PREF_LOG_CBX_CONSOLE));
|
logConsole = new BCheckBox(tempRect, B_TRANSLATE("Log To Console"),
|
||||||
|
STR_CBX_LOG_CONSOLE, new BMessage(MSG_PREF_LOG_CBX_CONSOLE));
|
||||||
// set the checkbox to the value the program has
|
// set the checkbox to the value the program has
|
||||||
SetLogConsoleValue(win->LogConsoleFlag());
|
SetLogConsoleValue(win->LogConsoleFlag());
|
||||||
consoleLogging->AddChild(logConsole);
|
consoleLogging->AddChild(logConsole);
|
||||||
|
|
||||||
// File Logging
|
// File Logging
|
||||||
logFile = new BCheckBox(tempRect, "Log To File", STR_CBX_LOG_FILE, new BMessage(MSG_PREF_LOG_CBX_FILE));
|
logFile = new BCheckBox(tempRect, B_TRANSLATE("Log To File"),
|
||||||
|
STR_CBX_LOG_FILE, new BMessage(MSG_PREF_LOG_CBX_FILE));
|
||||||
// set the checkbox to the value the program has
|
// set the checkbox to the value the program has
|
||||||
SetLogFileValue(win->LogFileFlag());
|
SetLogFileValue(win->LogFileFlag());
|
||||||
fileLogging->AddChild(logFile);
|
fileLogging->AddChild(logFile);
|
||||||
@@ -65,7 +76,8 @@ PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
|||||||
tempRect.bottom = tempRect.top + box_size;
|
tempRect.bottom = tempRect.top + box_size;
|
||||||
tempRect.right -= 5.0;
|
tempRect.right -= 5.0;
|
||||||
|
|
||||||
logFileName = new BTextControl(tempRect, "File Name", STR_TXT_LOG_FILE_NAME, NULL, NULL);
|
logFileName = new BTextControl(tempRect, B_TRANSLATE("File Name"),
|
||||||
|
STR_TXT_LOG_FILE_NAME, NULL, NULL);
|
||||||
logFileName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
logFileName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||||
logFileName->SetDivider(fileLogging->StringWidth(STR_TXT_LOG_FILE_NAME) + 8.0f);
|
logFileName->SetDivider(fileLogging->StringWidth(STR_TXT_LOG_FILE_NAME) + 8.0f);
|
||||||
SetLogFileName(win->LogPath());
|
SetLogFileName(win->LogPath());
|
||||||
@@ -76,10 +88,11 @@ PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name)
|
|||||||
createLogFileRect.top = tempRect.bottom + 13.0;
|
createLogFileRect.top = tempRect.bottom + 13.0;
|
||||||
createLogFileRect.right = tempRect.right + 2.0;
|
createLogFileRect.right = tempRect.right + 2.0;
|
||||||
createLogFileRect.left = createLogFileRect.right
|
createLogFileRect.left = createLogFileRect.right
|
||||||
- fileLogging->StringWidth("Create Log File") - 24.0;
|
- fileLogging->StringWidth(B_TRANSLATE("Create Log File")) - 24.0;
|
||||||
createLogFileRect.bottom = createLogFileRect.top + 19.0;
|
createLogFileRect.bottom = createLogFileRect.top + 19.0;
|
||||||
|
|
||||||
createLogFile = new BButton(createLogFileRect, "Create Log File", STR_BTN_CREATE_LOG_FILE, new BMessage(MSG_PREF_LOG_BTN_CREATE_FILE));
|
createLogFile = new BButton(createLogFileRect, B_TRANSLATE("Create Log File"),
|
||||||
|
STR_BTN_CREATE_LOG_FILE, new BMessage(MSG_PREF_LOG_BTN_CREATE_FILE));
|
||||||
fileLogging->AddChild(createLogFile);
|
fileLogging->AddChild(createLogFile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
* Version: 0.1
|
* Version: 0.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Window.h>
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Directory.h>
|
#include <Catalog.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
#include <Window.h>
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "PoorManWindow.h"
|
#include "PoorManWindow.h"
|
||||||
@@ -16,6 +18,11 @@
|
|||||||
#include "PoorManPreferencesWindow.h"
|
#include "PoorManPreferencesWindow.h"
|
||||||
#include "PoorManServer.h"
|
#include "PoorManServer.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PoorMan"
|
||||||
|
|
||||||
|
|
||||||
PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
||||||
: BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE
|
: BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE
|
||||||
| B_CLOSE_ON_ESCAPE),
|
| B_CLOSE_ON_ESCAPE),
|
||||||
@@ -43,20 +50,20 @@ PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
|||||||
float buttonTop = 0.0f;
|
float buttonTop = 0.0f;
|
||||||
float buttonHeight = 26.0f;
|
float buttonHeight = 26.0f;
|
||||||
|
|
||||||
float widthCancel = prefView->StringWidth("Cancel") + 24.0f;
|
float widthCancel = prefView->StringWidth(B_TRANSLATE("Cancel")) + 24.0f;
|
||||||
float widthDone = prefView->StringWidth("Done") + 24.0f;
|
float widthDone = prefView->StringWidth(B_TRANSLATE("Done")) + 24.0f;
|
||||||
|
|
||||||
float gap = 5.0f;
|
float gap = 5.0f;
|
||||||
|
|
||||||
BRect button1(prefView->Bounds().Width() - 2 * gap - widthCancel
|
BRect button1(prefView->Bounds().Width() - 2 * gap - widthCancel
|
||||||
- widthDone, buttonTop, prefView->Bounds().Width() - 2 * gap - widthDone,
|
- widthDone, buttonTop, prefView->Bounds().Width() - 2 * gap - widthDone,
|
||||||
buttonTop + buttonHeight);
|
buttonTop + buttonHeight);
|
||||||
cancelButton = new BButton(button1, "Cancel Button", "Cancel",
|
cancelButton = new BButton(button1, "Cancel Button", B_TRANSLATE("Cancel"),
|
||||||
new BMessage(MSG_PREF_BTN_CANCEL));
|
new BMessage(MSG_PREF_BTN_CANCEL));
|
||||||
|
|
||||||
BRect button2(prefView->Bounds().Width() - gap - widthDone, buttonTop,
|
BRect button2(prefView->Bounds().Width() - gap - widthDone, buttonTop,
|
||||||
prefView->Bounds().Width() - gap, buttonTop + buttonHeight);
|
prefView->Bounds().Width() - gap, buttonTop + buttonHeight);
|
||||||
doneButton = new BButton(button2, "Done Button", "Done",
|
doneButton = new BButton(button2, "Done Button", B_TRANSLATE("Done"),
|
||||||
new BMessage(MSG_PREF_BTN_DONE));
|
new BMessage(MSG_PREF_BTN_DONE));
|
||||||
|
|
||||||
buttonView->AddChild(cancelButton);
|
buttonView->AddChild(cancelButton);
|
||||||
@@ -105,14 +112,14 @@ PoorManPreferencesWindow::PoorManPreferencesWindow(BRect frame, char * name)
|
|||||||
B_DIRECTORY_NODE, false, &message, NULL, true);
|
B_DIRECTORY_NODE, false, &message, NULL, true);
|
||||||
|
|
||||||
webDirFilePanel->SetPanelDirectory(new BDirectory("/boot/home/public_html"));
|
webDirFilePanel->SetPanelDirectory(new BDirectory("/boot/home/public_html"));
|
||||||
webDirFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
webDirFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Select"));
|
||||||
change_title = webDirFilePanel->Window();
|
change_title = webDirFilePanel->Window();
|
||||||
change_title->SetTitle(STR_FILEPANEL_SELECT_WEB_DIR);
|
change_title->SetTitle(STR_FILEPANEL_SELECT_WEB_DIR);
|
||||||
|
|
||||||
message.what = MSG_FILE_PANEL_CREATE_LOG_FILE;
|
message.what = MSG_FILE_PANEL_CREATE_LOG_FILE;
|
||||||
logFilePanel = new BFilePanel(B_SAVE_PANEL, &messenger, NULL,
|
logFilePanel = new BFilePanel(B_SAVE_PANEL, &messenger, NULL,
|
||||||
B_FILE_NODE, false, &message);
|
B_FILE_NODE, false, &message);
|
||||||
logFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Create");
|
logFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, B_TRANSLATE("Create"));
|
||||||
change_title = logFilePanel->Window();
|
change_title = logFilePanel->Window();
|
||||||
change_title->SetTitle(STR_FILEPANEL_CREATE_LOG_FILE);
|
change_title->SetTitle(STR_FILEPANEL_CREATE_LOG_FILE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,18 +13,20 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <OS.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <ScrollBar.h>
|
#include <ScrollBar.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <TypeConstants.h>
|
#include <TypeConstants.h>
|
||||||
#include <OS.h>
|
|
||||||
|
|
||||||
#include "PoorManApplication.h"
|
#include "PoorManApplication.h"
|
||||||
#include "PoorManPreferencesWindow.h"
|
#include "PoorManPreferencesWindow.h"
|
||||||
@@ -34,6 +36,12 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PoorMan"
|
||||||
|
#define DATE_FORMAT B_SHORT_DATE_FORMAT
|
||||||
|
#define TIME_FORMAT B_MEDIUM_TIME_FORMAT
|
||||||
|
|
||||||
|
|
||||||
PoorManWindow::PoorManWindow(BRect frame)
|
PoorManWindow::PoorManWindow(BRect frame)
|
||||||
: BWindow(frame, STR_APP_NAME, B_TITLED_WINDOW, 0),
|
: BWindow(frame, STR_APP_NAME, B_TITLED_WINDOW, 0),
|
||||||
status(false), hits(0), prefWindow(NULL), fLogFile(NULL), fServer(NULL)
|
status(false), hits(0), prefWindow(NULL), fLogFile(NULL), fServer(NULL)
|
||||||
@@ -96,7 +104,8 @@ PoorManWindow::PoorManWindow(BRect frame)
|
|||||||
statusRect.bottom = statusRect.top + 15;
|
statusRect.bottom = statusRect.top + 15;
|
||||||
statusRect.right = statusRect.left + 100; // make the width wide enough for the string to display
|
statusRect.right = statusRect.left + 100; // make the width wide enough for the string to display
|
||||||
|
|
||||||
statusView = new BStringView(statusRect, "Status View", "Status: Stopped");
|
statusView = new BStringView(statusRect, "Status View",
|
||||||
|
B_TRANSLATE("Status: Stopped"));
|
||||||
bb->AddChild(statusView);
|
bb->AddChild(statusView);
|
||||||
|
|
||||||
// Directory String
|
// Directory String
|
||||||
@@ -107,7 +116,8 @@ PoorManWindow::PoorManWindow(BRect frame)
|
|||||||
dirRect.left = statusRect.left;
|
dirRect.left = statusRect.left;
|
||||||
dirRect.right -= 5;
|
dirRect.right -= 5;
|
||||||
|
|
||||||
dirView = new BStringView(dirRect, "Dir View", "Directory: (none)", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
dirView = new BStringView(dirRect, "Dir View",
|
||||||
|
B_TRANSLATE("Directory: (none)"), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||||
bb->AddChild(dirView);
|
bb->AddChild(dirView);
|
||||||
|
|
||||||
// Hits String
|
// Hits String
|
||||||
@@ -118,7 +128,8 @@ PoorManWindow::PoorManWindow(BRect frame)
|
|||||||
hitsRect.bottom = statusRect.bottom;
|
hitsRect.bottom = statusRect.bottom;
|
||||||
hitsRect.left = statusRect.right + 20;
|
hitsRect.left = statusRect.right + 20;
|
||||||
|
|
||||||
hitsView = new BStringView(hitsRect, "Hit View", "Hits: 0", B_FOLLOW_RIGHT | B_FOLLOW_TOP);
|
hitsView = new BStringView(hitsRect, "Hit View", B_TRANSLATE("Hits: 0"),
|
||||||
|
B_FOLLOW_RIGHT | B_FOLLOW_TOP);
|
||||||
hitsView->SetAlignment(B_ALIGN_RIGHT);
|
hitsView->SetAlignment(B_ALIGN_RIGHT);
|
||||||
bb->AddChild(hitsView);
|
bb->AddChild(hitsView);
|
||||||
|
|
||||||
@@ -298,9 +309,9 @@ PoorManWindow::MessageReceived(BMessage* message)
|
|||||||
color = *static_cast<const rgb_color*>(pointer);
|
color = *static_cast<const rgb_color*>(pointer);
|
||||||
|
|
||||||
if (time != -1) {
|
if (time != -1) {
|
||||||
char timeString[26];
|
BString timeString;
|
||||||
if (ctime_r(&time, timeString) != NULL) {
|
if (BLocale::Default()->FormatDateTime(&timeString, time,
|
||||||
timeString[24] = '\0';
|
DATE_FORMAT, TIME_FORMAT) == B_OK) {
|
||||||
line << '[' << timeString << "]: ";
|
line << '[' << timeString << "]: ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,21 +387,23 @@ PoorManWindow::QuitRequested()
|
|||||||
{
|
{
|
||||||
if (status) {
|
if (status) {
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
char line[] = "[Thu Jan 1 00:00:00 1970]: Shutting down.\n";
|
BString timeString;
|
||||||
|
BLocale::Default()->FormatDateTime(&timeString, now,
|
||||||
|
DATE_FORMAT, TIME_FORMAT);
|
||||||
|
|
||||||
ctime_r(&now, line + 1);
|
BString line;
|
||||||
line[25] = ']';
|
line << "[" << timeString << "]: " << B_TRANSLATE("Shutting down.")
|
||||||
line[26] = ' ';
|
<< "\n";
|
||||||
|
|
||||||
if (log_console_flag) {
|
if (log_console_flag) {
|
||||||
loggingView->Insert(loggingView->TextLength(),
|
loggingView->Insert(loggingView->TextLength(),
|
||||||
line, strlen(line));
|
line, line.Length());
|
||||||
loggingView->ScrollToOffset(loggingView->TextLength());
|
loggingView->ScrollToOffset(loggingView->TextLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_file_flag) {
|
if (log_file_flag) {
|
||||||
if (pthread_rwlock_rdlock(&fLogFileLock) == 0) {
|
if (pthread_rwlock_rdlock(&fLogFileLock) == 0) {
|
||||||
fLogFile->Write(line, strlen(line));
|
fLogFile->Write(line, line.Length());
|
||||||
pthread_rwlock_unlock(&fLogFileLock);
|
pthread_rwlock_unlock(&fLogFileLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,7 +534,7 @@ PoorManWindow::BuildControlsMenu() const
|
|||||||
void
|
void
|
||||||
PoorManWindow::SetDirLabel(const char * name)
|
PoorManWindow::SetDirLabel(const char * name)
|
||||||
{
|
{
|
||||||
BString dirPath("Directory: ");
|
BString dirPath(B_TRANSLATE("Directory: "));
|
||||||
dirPath.Append(name);
|
dirPath.Append(name);
|
||||||
|
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
@@ -536,9 +549,9 @@ PoorManWindow::UpdateStatusLabelAndMenuItem()
|
|||||||
{
|
{
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
if (status)
|
if (status)
|
||||||
statusView->SetText("Status: Running");
|
statusView->SetText(B_TRANSLATE("Status: Running"));
|
||||||
else
|
else
|
||||||
statusView->SetText("Status: Stopped");
|
statusView->SetText(B_TRANSLATE("Status: Stopped"));
|
||||||
ControlsMenu->FindItem(STR_MNU_CTRL_RUN_SERVER)->SetMarked(status);
|
ControlsMenu->FindItem(STR_MNU_CTRL_RUN_SERVER)->SetMarked(status);
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@@ -549,7 +562,7 @@ void
|
|||||||
PoorManWindow::UpdateHitsLabel()
|
PoorManWindow::UpdateHitsLabel()
|
||||||
{
|
{
|
||||||
if (Lock()) {
|
if (Lock()) {
|
||||||
sprintf(hitsLabel, "Hits: %lu", GetHits());
|
sprintf(hitsLabel, B_TRANSLATE("Hits: %lu"), GetHits());
|
||||||
hitsView->SetText(hitsLabel);
|
hitsView->SetText(hitsLabel);
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
@@ -607,9 +620,11 @@ PoorManWindow::SaveConsole(BMessage * message, bool selection)
|
|||||||
void
|
void
|
||||||
PoorManWindow::DefaultSettings()
|
PoorManWindow::DefaultSettings()
|
||||||
{
|
{
|
||||||
BAlert* serverAlert = new BAlert("Error Server", STR_ERR_CANT_START, "OK");
|
BAlert* serverAlert = new BAlert(B_TRANSLATE("Error Server"),
|
||||||
BAlert* dirAlert = new BAlert("Error Dir", STR_ERR_WEB_DIR,
|
STR_ERR_CANT_START, B_TRANSLATE("OK"));
|
||||||
"Cancel", "Select", "Default", B_WIDTH_AS_USUAL, B_OFFSET_SPACING);
|
BAlert* dirAlert = new BAlert(B_TRANSLATE("Error Dir"),
|
||||||
|
STR_ERR_WEB_DIR, B_TRANSLATE("Cancel"), B_TRANSLATE("Select"),
|
||||||
|
B_TRANSLATE("Default"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING);
|
||||||
dirAlert->SetShortcut(0, B_ESCAPE);
|
dirAlert->SetShortcut(0, B_ESCAPE);
|
||||||
int32 buttonIndex = dirAlert->Go();
|
int32 buttonIndex = dirAlert->Go();
|
||||||
|
|
||||||
@@ -636,7 +651,8 @@ PoorManWindow::DefaultSettings()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
BAlert* dirCreatedAlert =
|
BAlert* dirCreatedAlert =
|
||||||
new BAlert("Dir Created", STR_DIR_CREATED, "OK");
|
new BAlert(B_TRANSLATE("Dir Created"), STR_DIR_CREATED,
|
||||||
|
B_TRANSLATE("OK"));
|
||||||
dirCreatedAlert->Go();
|
dirCreatedAlert->Go();
|
||||||
SetWebDir(STR_DEFAULT_WEB_DIRECTORY);
|
SetWebDir(STR_DEFAULT_WEB_DIRECTORY);
|
||||||
be_app->PostMessage(kStartServer);
|
be_app->PostMessage(kStartServer);
|
||||||
@@ -767,14 +783,14 @@ PoorManWindow::StartServer()
|
|||||||
dir_list_flag,
|
dir_list_flag,
|
||||||
index_file_name.String());
|
index_file_name.String());
|
||||||
|
|
||||||
poorman_log("Starting up... ");
|
poorman_log(B_TRANSLATE("Starting up... "));
|
||||||
if (fServer->Run() != B_OK) {
|
if (fServer->Run() != B_OK) {
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = true;
|
status = true;
|
||||||
UpdateStatusLabelAndMenuItem();
|
UpdateStatusLabelAndMenuItem();
|
||||||
poorman_log("done.\n", false, INADDR_NONE, GREEN);
|
poorman_log(B_TRANSLATE("done.\n"), false, INADDR_NONE, GREEN);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -786,7 +802,7 @@ PoorManWindow::StopServer()
|
|||||||
if (fServer == NULL)
|
if (fServer == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
poorman_log("Shutting down.\n");
|
poorman_log(B_TRANSLATE("Shutting down.\n"));
|
||||||
fServer->Stop();
|
fServer->Stop();
|
||||||
status = false;
|
status = false;
|
||||||
UpdateStatusLabelAndMenuItem();
|
UpdateStatusLabelAndMenuItem();
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "PoorMan"
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// PoorMan Window
|
// PoorMan Window
|
||||||
@@ -9,108 +16,111 @@ const char* STR_APP_SIG
|
|||||||
char* STR_APP_NAME
|
char* STR_APP_NAME
|
||||||
= (char*)"PoorMan";
|
= (char*)"PoorMan";
|
||||||
const char* STR_ERR_WEB_DIR
|
const char* STR_ERR_WEB_DIR
|
||||||
= "Please choose the folder to publish on the web.\n\n"
|
= B_TRANSLATE(
|
||||||
|
"Please choose the folder to publish on the web.\n\n"
|
||||||
"You can have PoorMan create a default \"public_html\" "
|
"You can have PoorMan create a default \"public_html\" "
|
||||||
"in your home folder.\n"
|
"in your home folder.\n"
|
||||||
"Or you select one of your own folders instead.";
|
"Or you select one of your own folders instead.");
|
||||||
const char* STR_ERR_CANT_START
|
const char* STR_ERR_CANT_START
|
||||||
= "Cannot start the server";
|
= B_TRANSLATE(
|
||||||
|
"Cannot start the server");
|
||||||
const char* STR_DIR_CREATED
|
const char* STR_DIR_CREATED
|
||||||
= "A default web folder has been created "
|
= B_TRANSLATE(
|
||||||
|
"A default web folder has been created "
|
||||||
"at \"/boot/home/public_html.\"\nMake sure there is a HTML "
|
"at \"/boot/home/public_html.\"\nMake sure there is a HTML "
|
||||||
"file named \"index.html\" in that folder.";
|
"file named \"index.html\" in that folder.");
|
||||||
|
|
||||||
const char* STR_MNU_FILE
|
const char* STR_MNU_FILE
|
||||||
= "File";
|
= B_TRANSLATE("File");
|
||||||
const char* STR_MNU_FILE_SAVE_AS
|
const char* STR_MNU_FILE_SAVE_AS
|
||||||
= "Save console as" B_UTF8_ELLIPSIS;
|
= B_TRANSLATE("Save console as" B_UTF8_ELLIPSIS);
|
||||||
const char* STR_MNU_FILE_SAVE_SELECTION
|
const char* STR_MNU_FILE_SAVE_SELECTION
|
||||||
= "Save console selections as" B_UTF8_ELLIPSIS;
|
= B_TRANSLATE("Save console selections as" B_UTF8_ELLIPSIS);
|
||||||
const char* STR_MNU_FILE_ABOUT
|
const char* STR_MNU_FILE_ABOUT
|
||||||
= "About PoorMan" B_UTF8_ELLIPSIS;
|
= B_TRANSLATE("About PoorMan" B_UTF8_ELLIPSIS);
|
||||||
const char* STR_MNU_FILE_QUIT
|
const char* STR_MNU_FILE_QUIT
|
||||||
= "Quit";
|
= B_TRANSLATE("Quit");
|
||||||
const char* STR_MNU_EDIT
|
const char* STR_MNU_EDIT
|
||||||
= "Edit";
|
= B_TRANSLATE("Edit");
|
||||||
const char* STR_MNU_EDIT_COPY
|
const char* STR_MNU_EDIT_COPY
|
||||||
= "Copy";
|
= B_TRANSLATE("Copy");
|
||||||
const char* STR_MNU_EDIT_SELECT_ALL
|
const char* STR_MNU_EDIT_SELECT_ALL
|
||||||
= "Select all";
|
= B_TRANSLATE("Select all");
|
||||||
const char* STR_MNU_EDIT_PREF
|
const char* STR_MNU_EDIT_PREF
|
||||||
= "Settings" B_UTF8_ELLIPSIS;
|
= B_TRANSLATE("Settings" B_UTF8_ELLIPSIS);
|
||||||
const char* STR_MNU_CTRL
|
const char* STR_MNU_CTRL
|
||||||
= "Controls";
|
= B_TRANSLATE("Controls");
|
||||||
const char* STR_MNU_CTRL_RUN_SERVER
|
const char* STR_MNU_CTRL_RUN_SERVER
|
||||||
= "Run server";
|
= B_TRANSLATE("Run server");
|
||||||
const char* STR_MNU_CTRL_CLEAR_HIT_COUNTER
|
const char* STR_MNU_CTRL_CLEAR_HIT_COUNTER
|
||||||
= "Clear hit counter";
|
= B_TRANSLATE("Clear hit counter");
|
||||||
const char* STR_MNU_CTRL_CLEAR_CONSOLE
|
const char* STR_MNU_CTRL_CLEAR_CONSOLE
|
||||||
= "Clear console log";
|
= B_TRANSLATE("Clear console log");
|
||||||
const char* STR_MNU_CTRL_CLEAR_LOG_FILE
|
const char* STR_MNU_CTRL_CLEAR_LOG_FILE
|
||||||
= "Clear log file";
|
= B_TRANSLATE("Clear log file");
|
||||||
|
|
||||||
const char* STR_FILEPANEL_SAVE_CONSOLE
|
const char* STR_FILEPANEL_SAVE_CONSOLE
|
||||||
= "Save log console";
|
= B_TRANSLATE("Save log console");
|
||||||
const char* STR_FILEPANEL_SAVE_CONSOLE_SELECTION
|
const char* STR_FILEPANEL_SAVE_CONSOLE_SELECTION
|
||||||
= "Save log console selection";
|
= B_TRANSLATE("Save log console selection");
|
||||||
const char* STR_TXT_VIEW
|
const char* STR_TXT_VIEW
|
||||||
= "Logging view";
|
= B_TRANSLATE("Logging view");
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// Preferences Window
|
// Preferences Window
|
||||||
char* STR_WIN_NAME_PREF
|
char* STR_WIN_NAME_PREF
|
||||||
= (char*)"PoorMan settings";
|
= (char*)B_TRANSLATE("PoorMan settings");
|
||||||
|
|
||||||
const char* STR_SETTINGS_FILE_NAME
|
const char* STR_SETTINGS_FILE_NAME
|
||||||
= "PoorMan settings";
|
= B_TRANSLATE("PoorMan settings");
|
||||||
const char* STR_SETTINGS_NEW_FILE_NAME
|
const char* STR_SETTINGS_NEW_FILE_NAME
|
||||||
= "OBOS PoorMan settings";
|
= B_TRANSLATE("OBOS PoorMan settings");
|
||||||
const char* STR_DEFAULT_WEB_DIRECTORY
|
const char* STR_DEFAULT_WEB_DIRECTORY
|
||||||
= "/boot/home/public_html";
|
= "/boot/home/public_html";
|
||||||
const char* STR_TAB_SITE
|
const char* STR_TAB_SITE
|
||||||
= "Site";
|
= B_TRANSLATE("Site");
|
||||||
const char* STR_BBX_LOCATION
|
const char* STR_BBX_LOCATION
|
||||||
= "Website location";
|
= B_TRANSLATE("Website location");
|
||||||
const char* STR_TXT_DIRECTORY
|
const char* STR_TXT_DIRECTORY
|
||||||
= "Web folder:";
|
= B_TRANSLATE("Web folder:");
|
||||||
const char* STR_BTN_DIRECTORY
|
const char* STR_BTN_DIRECTORY
|
||||||
= "Select web folder";
|
= B_TRANSLATE("Select web folder");
|
||||||
const char* STR_TXT_INDEX
|
const char* STR_TXT_INDEX
|
||||||
= "Start page:";
|
= B_TRANSLATE("Start page:");
|
||||||
const char* STR_BBX_OPTIONS
|
const char* STR_BBX_OPTIONS
|
||||||
= "Website options";
|
= B_TRANSLATE("Website options");
|
||||||
const char* STR_CBX_DIR_LIST
|
const char* STR_CBX_DIR_LIST
|
||||||
= "Send file listing if there's no start page";
|
= B_TRANSLATE("Send file listing if there's no start page");
|
||||||
const char* STR_CBX_DIR_LIST_LABEL
|
const char* STR_CBX_DIR_LIST_LABEL
|
||||||
= "Send file listing if there's no start page";
|
= B_TRANSLATE("Send file listing if there's no start page");
|
||||||
const char* STR_FILEPANEL_SELECT_WEB_DIR
|
const char* STR_FILEPANEL_SELECT_WEB_DIR
|
||||||
= "Select web folder";
|
= B_TRANSLATE("Select web folder");
|
||||||
|
|
||||||
const char* STR_TAB_LOGGING
|
const char* STR_TAB_LOGGING
|
||||||
= "Logging";
|
= B_TRANSLATE("Logging");
|
||||||
const char* STR_BBX_CONSOLE_LOGGING
|
const char* STR_BBX_CONSOLE_LOGGING
|
||||||
= "Console logging";
|
= B_TRANSLATE("Console logging");
|
||||||
const char* STR_CBX_LOG_CONSOLE
|
const char* STR_CBX_LOG_CONSOLE
|
||||||
= "Log to console";
|
= B_TRANSLATE("Log to console");
|
||||||
const char* STR_BBX_FILE_LOGGING
|
const char* STR_BBX_FILE_LOGGING
|
||||||
= "File logging";
|
= B_TRANSLATE("File logging");
|
||||||
const char* STR_CBX_LOG_FILE
|
const char* STR_CBX_LOG_FILE
|
||||||
= "Log to file";
|
= B_TRANSLATE("Log to file");
|
||||||
const char* STR_TXT_LOG_FILE_NAME
|
const char* STR_TXT_LOG_FILE_NAME
|
||||||
= "Log file name:";
|
= B_TRANSLATE("Log file name:");
|
||||||
const char* STR_BTN_CREATE_LOG_FILE
|
const char* STR_BTN_CREATE_LOG_FILE
|
||||||
= "Create log file";
|
= B_TRANSLATE("Create log file");
|
||||||
const char* STR_FILEPANEL_CREATE_LOG_FILE
|
const char* STR_FILEPANEL_CREATE_LOG_FILE
|
||||||
= "Create PoorMan log";
|
= B_TRANSLATE("Create PoorMan log");
|
||||||
|
|
||||||
const char* STR_TAB_ADVANCED
|
const char* STR_TAB_ADVANCED
|
||||||
= "Advanced";
|
= B_TRANSLATE("Advanced");
|
||||||
const char* STR_BBX_CONNECTION
|
const char* STR_BBX_CONNECTION
|
||||||
= "Connections";
|
= B_TRANSLATE("Connections");
|
||||||
const char* STR_SLD_LABEL
|
const char* STR_SLD_LABEL
|
||||||
= "Max. simultaneous connections:";
|
= B_TRANSLATE("Max. simultaneous connections:");
|
||||||
char* STR_SLD_STATUS_LABEL
|
char* STR_SLD_STATUS_LABEL
|
||||||
= (char*)"connections";
|
= (char*)B_TRANSLATE("connections");
|
||||||
|
|
||||||
const char CMD_FILE_SAVE_AS
|
const char CMD_FILE_SAVE_AS
|
||||||
= 'S';
|
= 'S';
|
||||||
@@ -122,14 +132,15 @@ const char CMD_EDIT_SELECT_ALL
|
|||||||
= 'A';
|
= 'A';
|
||||||
|
|
||||||
const char* STR_ABOUT_TITLE
|
const char* STR_ABOUT_TITLE
|
||||||
= "About PoorMan";
|
= B_TRANSLATE("About PoorMan");
|
||||||
const char* STR_ABOUT_BUTTON
|
const char* STR_ABOUT_BUTTON
|
||||||
= "OK";
|
= B_TRANSLATE("OK");
|
||||||
const char* STR_ABOUT_DESC
|
const char* STR_ABOUT_DESC
|
||||||
= "Poor Man's web server\n"
|
= B_TRANSLATE(
|
||||||
|
"Poor Man's web server\n"
|
||||||
"Copyright " B_UTF8_COPYRIGHT " 2004-2009 Haiku\n"
|
"Copyright " B_UTF8_COPYRIGHT " 2004-2009 Haiku\n"
|
||||||
"All rights reserved.\n\n"
|
"All rights reserved.\n\n"
|
||||||
"Written by: Philip Harrison, Ma Jie";
|
"Written by: Philip Harrison, Ma Jie");
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
const rgb_color WHITE = { 255, 255, 255, 255 };
|
const rgb_color WHITE = { 255, 255, 255, 255 };
|
||||||
|
|||||||
Reference in New Issue
Block a user