Patch by Jorma Karvonen: Localization of CodyCam with some modifications by
myself. Closes ticket #5908, thanks a bunch! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36850 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+138
-85
@@ -25,6 +25,9 @@
|
|||||||
#include <TranslationKit.h>
|
#include <TranslationKit.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "CodyCam"
|
||||||
|
|
||||||
#define VIDEO_SIZE_X 320
|
#define VIDEO_SIZE_X 320
|
||||||
#define VIDEO_SIZE_Y 240
|
#define VIDEO_SIZE_Y 240
|
||||||
|
|
||||||
@@ -57,7 +60,7 @@ static status_t AddTranslationItems(BMenu* intoMenu, uint32 fromType);
|
|||||||
static void
|
static void
|
||||||
ErrorAlert(const char* message, status_t err, BWindow *window = NULL)
|
ErrorAlert(const char* message, status_t err, BWindow *window = NULL)
|
||||||
{
|
{
|
||||||
BAlert *alert = new BAlert("", message, "OK");
|
BAlert *alert = new BAlert("", message, B_TRANSLATE("OK"));
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
alert->CenterIn(window->Frame());
|
alert->CenterIn(window->Frame());
|
||||||
alert->Go();
|
alert->Go();
|
||||||
@@ -127,8 +130,31 @@ CodyCam::CodyCam()
|
|||||||
fVideoConsumer(NULL),
|
fVideoConsumer(NULL),
|
||||||
fWindow(NULL),
|
fWindow(NULL),
|
||||||
fPort(0),
|
fPort(0),
|
||||||
fVideoControlWindow(NULL)
|
fVideoControlWindow(NULL),
|
||||||
|
fAppCatalog(NULL)
|
||||||
{
|
{
|
||||||
|
be_locale->GetAppCatalog(&fAppCatalog);
|
||||||
|
|
||||||
|
int32 index = 0;
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 15 seconds");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 30 seconds");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every minute");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 5 minutes");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 10 minutes");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 15 minutes");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 30 minutes");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every hour");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 2 hours");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 4 hours");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 8 hours");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Every 24 hours");
|
||||||
|
kCaptureRate[index++] = B_TRANSLATE("Never");
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
kUploadClient[index++] = B_TRANSLATE("FTP");
|
||||||
|
kUploadClient[index++] = B_TRANSLATE("SFTP");
|
||||||
|
kUploadClient[index++] = B_TRANSLATE("Local");
|
||||||
|
|
||||||
chdir("/boot/home");
|
chdir("/boot/home");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +178,7 @@ void
|
|||||||
CodyCam::ReadyToRun()
|
CodyCam::ReadyToRun()
|
||||||
{
|
{
|
||||||
fWindow = new VideoWindow(BRect(28, 28, 28, 28),
|
fWindow = new VideoWindow(BRect(28, 28, 28, 28),
|
||||||
(const char*) "CodyCam", B_TITLED_WINDOW,
|
(const char*) B_TRANSLATE("CodyCam"), B_TITLED_WINDOW,
|
||||||
B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, &fPort);
|
B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, &fPort);
|
||||||
|
|
||||||
_SetUpNodes();
|
_SetUpNodes();
|
||||||
@@ -178,7 +204,8 @@ CodyCam::MessageReceived(BMessage *message)
|
|||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case msg_start:
|
case msg_start:
|
||||||
{
|
{
|
||||||
BTimeSource* timeSource = fMediaRoster->MakeTimeSourceFor(fTimeSourceNode);
|
BTimeSource* timeSource = fMediaRoster->MakeTimeSourceFor(
|
||||||
|
fTimeSourceNode);
|
||||||
bigtime_t real = BTimeSource::RealTime();
|
bigtime_t real = BTimeSource::RealTime();
|
||||||
bigtime_t perf = timeSource->PerformanceTimeFor(real) + 10000;
|
bigtime_t perf = timeSource->PerformanceTimeFor(real) + 10000;
|
||||||
status_t status = fMediaRoster->StartNode(fProducerNode, perf);
|
status_t status = fMediaRoster->StartNode(fProducerNode, perf);
|
||||||
@@ -208,16 +235,16 @@ CodyCam::MessageReceived(BMessage *message)
|
|||||||
BRect(2 * WINDOW_OFFSET_X + WINDOW_SIZE_X, WINDOW_OFFSET_Y,
|
BRect(2 * WINDOW_OFFSET_X + WINDOW_SIZE_X, WINDOW_OFFSET_Y,
|
||||||
2 * WINDOW_OFFSET_X + WINDOW_SIZE_X + view->Bounds().right,
|
2 * WINDOW_OFFSET_X + WINDOW_SIZE_X + view->Bounds().right,
|
||||||
WINDOW_OFFSET_Y + view->Bounds().bottom), view, node);
|
WINDOW_OFFSET_Y + view->Bounds().bottom), view, node);
|
||||||
fMediaRoster->StartWatching(BMessenger(NULL, fVideoControlWindow), node,
|
fMediaRoster->StartWatching(BMessenger(NULL,
|
||||||
B_MEDIA_WEB_CHANGED);
|
fVideoControlWindow), node, B_MEDIA_WEB_CHANGED);
|
||||||
fVideoControlWindow->Show();
|
fVideoControlWindow->Show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case msg_about:
|
case msg_about:
|
||||||
(new BAlert("About CodyCam", "CodyCam\n\nThe Original BeOS webcam",
|
(new BAlert(B_TRANSLATE("About CodyCam"), B_TRANSLATE("CodyCam\n\n"
|
||||||
"Close"))->Go();
|
"The Original BeOS webcam"), B_TRANSLATE("Close")))->Go();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case msg_control_win:
|
case msg_control_win:
|
||||||
@@ -241,14 +268,15 @@ CodyCam::_SetUpNodes()
|
|||||||
/* find the media roster */
|
/* find the media roster */
|
||||||
fMediaRoster = BMediaRoster::Roster(&status);
|
fMediaRoster = BMediaRoster::Roster(&status);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot find the media roster", status, fWindow);
|
ErrorAlert(B_TRANSLATE("Cannot find the media roster"), status,
|
||||||
|
fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find the time source */
|
/* find the time source */
|
||||||
status = fMediaRoster->GetTimeSource(&fTimeSourceNode);
|
status = fMediaRoster->GetTimeSource(&fTimeSourceNode);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot get a time source", status, fWindow);
|
ErrorAlert(B_TRANSLATE("Cannot get a time source"), status, fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,43 +284,49 @@ CodyCam::_SetUpNodes()
|
|||||||
INFO("CodyCam acquiring VideoInput node\n");
|
INFO("CodyCam acquiring VideoInput node\n");
|
||||||
status = fMediaRoster->GetVideoInput(&fProducerNode);
|
status = fMediaRoster->GetVideoInput(&fProducerNode);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot find a video source. You need a webcam to use CodyCam.", status, fWindow);
|
ErrorAlert(B_TRANSLATE("Cannot find a video source. You need a webcam "
|
||||||
|
"to use CodyCam."), status, fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the video consumer node */
|
/* create the video consumer node */
|
||||||
fVideoConsumer = new VideoConsumer("CodyCam", ((VideoWindow*)fWindow)->VideoView(),
|
fVideoConsumer = new VideoConsumer("CodyCam",
|
||||||
|
((VideoWindow*)fWindow)->VideoView(),
|
||||||
((VideoWindow*)fWindow)->StatusLine(), NULL, 0);
|
((VideoWindow*)fWindow)->StatusLine(), NULL, 0);
|
||||||
if (!fVideoConsumer) {
|
if (!fVideoConsumer) {
|
||||||
ErrorAlert("Cannot create a video window", B_ERROR, fWindow);
|
ErrorAlert(B_TRANSLATE("Cannot create a video window"), B_ERROR,
|
||||||
|
fWindow);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register the node */
|
/* register the node */
|
||||||
status = fMediaRoster->RegisterNode(fVideoConsumer);
|
status = fMediaRoster->RegisterNode(fVideoConsumer);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot register the video window", status, fWindow);
|
ErrorAlert(B_TRANSLATE("Cannot register the video window"), status,
|
||||||
|
fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
fPort = fVideoConsumer->ControlPort();
|
fPort = fVideoConsumer->ControlPort();
|
||||||
|
|
||||||
/* find free producer output */
|
/* find free producer output */
|
||||||
int32 cnt = 0;
|
int32 cnt = 0;
|
||||||
status = fMediaRoster->GetFreeOutputsFor(fProducerNode, &fProducerOut, 1, &cnt,
|
status = fMediaRoster->GetFreeOutputsFor(fProducerNode, &fProducerOut, 1,
|
||||||
B_MEDIA_RAW_VIDEO);
|
&cnt, B_MEDIA_RAW_VIDEO);
|
||||||
if (status != B_OK || cnt < 1) {
|
if (status != B_OK || cnt < 1) {
|
||||||
status = B_RESOURCE_UNAVAILABLE;
|
status = B_RESOURCE_UNAVAILABLE;
|
||||||
ErrorAlert("Cannot find an available video stream", status, fWindow);
|
ErrorAlert(B_TRANSLATE("Cannot find an available video stream"),
|
||||||
|
status, fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find free consumer input */
|
/* find free consumer input */
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
status = fMediaRoster->GetFreeInputsFor(fVideoConsumer->Node(), &fConsumerIn, 1,
|
status = fMediaRoster->GetFreeInputsFor(fVideoConsumer->Node(),
|
||||||
&cnt, B_MEDIA_RAW_VIDEO);
|
&fConsumerIn, 1, &cnt, B_MEDIA_RAW_VIDEO);
|
||||||
if (status != B_OK || cnt < 1) {
|
if (status != B_OK || cnt < 1) {
|
||||||
status = B_RESOURCE_UNAVAILABLE;
|
status = B_RESOURCE_UNAVAILABLE;
|
||||||
ErrorAlert("Can't find an available connection to the video window", status, fWindow);
|
ErrorAlert(B_TRANSLATE("Can't find an available connection to the "
|
||||||
|
"video window"), status, fWindow);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,24 +338,29 @@ CodyCam::_SetUpNodes()
|
|||||||
format.u.raw_video = vid_format;
|
format.u.raw_video = vid_format;
|
||||||
|
|
||||||
/* connect producer to consumer */
|
/* connect producer to consumer */
|
||||||
status = fMediaRoster->Connect(fProducerOut.source, fConsumerIn.destination,
|
status = fMediaRoster->Connect(fProducerOut.source,
|
||||||
&format, &fProducerOut, &fConsumerIn);
|
fConsumerIn.destination, &format, &fProducerOut, &fConsumerIn);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot connect the video source to the video window", status);
|
ErrorAlert(B_TRANSLATE("Cannot connect the video source to the video "
|
||||||
|
"window"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* set time sources */
|
/* set time sources */
|
||||||
status = fMediaRoster->SetTimeSourceFor(fProducerNode.node, fTimeSourceNode.node);
|
status = fMediaRoster->SetTimeSourceFor(fProducerNode.node,
|
||||||
|
fTimeSourceNode.node);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot set the time source for the video source", status);
|
ErrorAlert(B_TRANSLATE("Cannot set the time source for the video "
|
||||||
|
"source"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(), fTimeSourceNode.node);
|
status = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(),
|
||||||
|
fTimeSourceNode.node);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot set the time source for the video window", status);
|
ErrorAlert(B_TRANSLATE("Cannot set the time source for the video "
|
||||||
|
"window"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +373,8 @@ CodyCam::_SetUpNodes()
|
|||||||
bigtime_t initLatency = 0;
|
bigtime_t initLatency = 0;
|
||||||
status = fMediaRoster->GetInitialLatencyFor(fProducerNode, &initLatency);
|
status = fMediaRoster->GetInitialLatencyFor(fProducerNode, &initLatency);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
ErrorAlert("Error getting initial latency for the capture node", status);
|
ErrorAlert(B_TRANSLATE("Error getting initial latency for the capture "
|
||||||
|
"node"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,29 +390,30 @@ CodyCam::_SetUpNodes()
|
|||||||
status = fMediaRoster->StartTimeSource(fTimeSourceNode, real);
|
status = fMediaRoster->StartTimeSource(fTimeSourceNode, real);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
timeSource->Release();
|
timeSource->Release();
|
||||||
ErrorAlert("Cannot start time source!", status);
|
ErrorAlert(B_TRANSLATE("Cannot start time source!"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
status = fMediaRoster->SeekTimeSource(fTimeSourceNode, 0, real);
|
status = fMediaRoster->SeekTimeSource(fTimeSourceNode, 0, real);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
timeSource->Release();
|
timeSource->Release();
|
||||||
ErrorAlert("Cannot seek time source!", status);
|
ErrorAlert(B_TRANSLATE("Cannot seek time source!"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bigtime_t perf = timeSource->PerformanceTimeFor(real + latency + initLatency);
|
bigtime_t perf = timeSource->PerformanceTimeFor(real + latency
|
||||||
|
+ initLatency);
|
||||||
timeSource->Release();
|
timeSource->Release();
|
||||||
|
|
||||||
/* start the nodes */
|
/* start the nodes */
|
||||||
status = fMediaRoster->StartNode(fProducerNode, perf);
|
status = fMediaRoster->StartNode(fProducerNode, perf);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot start the video source", status);
|
ErrorAlert(B_TRANSLATE("Cannot start the video source"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
status = fMediaRoster->StartNode(fVideoConsumer->Node(), perf);
|
status = fMediaRoster->StartNode(fVideoConsumer->Node(), perf);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ErrorAlert("Cannot start the video window", status);
|
ErrorAlert(B_TRANSLATE("Cannot start the video window"), status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,39 +477,43 @@ VideoWindow::VideoWindow(BRect frame, const char* title, window_type type,
|
|||||||
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "menu bar");
|
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "menu bar");
|
||||||
|
|
||||||
BMenuItem* menuItem;
|
BMenuItem* menuItem;
|
||||||
BMenu* menu = new BMenu("File");
|
BMenu* menu = new BMenu(B_TRANSLATE("File"));
|
||||||
|
|
||||||
menuItem = new BMenuItem("Video settings", new BMessage(msg_video), 'P');
|
menuItem = new BMenuItem(B_TRANSLATE("Video settings"),
|
||||||
|
new BMessage(msg_video), 'P');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menuItem = new BMenuItem("Start video", new BMessage(msg_start), 'A');
|
menuItem = new BMenuItem(B_TRANSLATE("Start video"),
|
||||||
|
new BMessage(msg_start), 'A');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menuItem = new BMenuItem("Stop video", new BMessage(msg_stop), 'O');
|
menuItem = new BMenuItem(B_TRANSLATE("Stop video"),
|
||||||
|
new BMessage(msg_stop), 'O');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menuItem = new BMenuItem("About Codycam" B_UTF8_ELLIPSIS,
|
menuItem = new BMenuItem(B_TRANSLATE("About Codycam" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(msg_about), 'B');
|
new BMessage(msg_about), 'B');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menuItem = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q');
|
menuItem = new BMenuItem(B_TRANSLATE("Quit"),
|
||||||
|
new BMessage(B_QUIT_REQUESTED), 'Q');
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddItem(menuItem);
|
menu->AddItem(menuItem);
|
||||||
|
|
||||||
menuBar->AddItem(menu);
|
menuBar->AddItem(menu);
|
||||||
|
|
||||||
/* give it a gray background view */
|
/* give it a gray background view */
|
||||||
fView = new BView("Background View", B_WILL_DRAW);
|
fView = new BView(B_TRANSLATE("Background View"), B_WILL_DRAW);
|
||||||
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
/* add some controls */
|
/* add some controls */
|
||||||
@@ -659,17 +704,17 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
|
|
||||||
// Capture controls
|
// Capture controls
|
||||||
fCaptureSetupBox = new BBox("Capture Controls", B_WILL_DRAW);
|
fCaptureSetupBox = new BBox("Capture Controls", B_WILL_DRAW);
|
||||||
fCaptureSetupBox->SetLabel("Capture controls");
|
fCaptureSetupBox->SetLabel(B_TRANSLATE("Capture controls"));
|
||||||
|
|
||||||
BGridLayout *controlsLayout = new BGridLayout(kXBuffer, 0);
|
BGridLayout *controlsLayout = new BGridLayout(kXBuffer, 0);
|
||||||
controlsLayout->SetInsets(10, 15, 5, 5);
|
controlsLayout->SetInsets(10, 15, 5, 5);
|
||||||
fCaptureSetupBox->SetLayout(controlsLayout);
|
fCaptureSetupBox->SetLayout(controlsLayout);
|
||||||
|
|
||||||
fFileName = new BTextControl("File Name", "File name:",
|
fFileName = new BTextControl("File Name", B_TRANSLATE("File name:"),
|
||||||
fFilenameSetting->Value(), new BMessage(msg_filename));
|
fFilenameSetting->Value(), new BMessage(msg_filename));
|
||||||
fFileName->SetTarget(BMessenger(NULL, this));
|
fFileName->SetTarget(BMessenger(NULL, this));
|
||||||
|
|
||||||
fImageFormatMenu = new BPopUpMenu("Image Format Menu");
|
fImageFormatMenu = new BPopUpMenu(B_TRANSLATE("Image Format Menu"));
|
||||||
AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP);
|
AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP);
|
||||||
fImageFormatMenu->SetTargetForItems(this);
|
fImageFormatMenu->SetTargetForItems(this);
|
||||||
|
|
||||||
@@ -682,53 +727,57 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
else
|
else
|
||||||
fImageFormatMenu->ItemAt(0)->SetMarked(true);
|
fImageFormatMenu->ItemAt(0)->SetMarked(true);
|
||||||
|
|
||||||
fImageFormatSelector = new BMenuField("Format", "Format:",
|
fImageFormatSelector = new BMenuField("Format", B_TRANSLATE("Format:"),
|
||||||
fImageFormatMenu, NULL);
|
fImageFormatMenu, NULL);
|
||||||
|
|
||||||
fCaptureRateMenu = new BPopUpMenu("Capture Rate Menu");
|
fCaptureRateMenu = new BPopUpMenu(B_TRANSLATE("Capture Rate Menu"));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 15 seconds",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[0],
|
||||||
new BMessage(msg_rate_15s)));
|
new BMessage(msg_rate_15s)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 30 seconds",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[1],
|
||||||
new BMessage(msg_rate_30s)));
|
new BMessage(msg_rate_30s)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every minute",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[2],
|
||||||
new BMessage(msg_rate_1m)));
|
new BMessage(msg_rate_1m)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 5 minutes",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[3],
|
||||||
new BMessage(msg_rate_5m)));
|
new BMessage(msg_rate_5m)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 10 minutes",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[4],
|
||||||
new BMessage(msg_rate_10m)));
|
new BMessage(msg_rate_10m)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 15 minutes",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[5],
|
||||||
new BMessage(msg_rate_15m)));
|
new BMessage(msg_rate_15m)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 30 minutes",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[6],
|
||||||
new BMessage(msg_rate_30m)));
|
new BMessage(msg_rate_30m)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every hour",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[7],
|
||||||
new BMessage(msg_rate_1h)));
|
new BMessage(msg_rate_1h)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 2 hours",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[8],
|
||||||
new BMessage(msg_rate_2h)));
|
new BMessage(msg_rate_2h)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 4 hours",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[9],
|
||||||
new BMessage(msg_rate_4h)));
|
new BMessage(msg_rate_4h)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 8 hours",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[10],
|
||||||
new BMessage(msg_rate_8h)));
|
new BMessage(msg_rate_8h)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Every 24 hours",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[11],
|
||||||
new BMessage(msg_rate_24h)));
|
new BMessage(msg_rate_24h)));
|
||||||
fCaptureRateMenu->AddItem(new BMenuItem("Never",
|
fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[12],
|
||||||
new BMessage(msg_rate_never)));
|
new BMessage(msg_rate_never)));
|
||||||
fCaptureRateMenu->SetTargetForItems(this);
|
fCaptureRateMenu->SetTargetForItems(this);
|
||||||
fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true);
|
fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true);
|
||||||
fCaptureRateSelector = new BMenuField("Rate", "Rate:",
|
fCaptureRateSelector = new BMenuField("Rate", B_TRANSLATE("Rate:"),
|
||||||
fCaptureRateMenu, NULL);
|
fCaptureRateMenu, NULL);
|
||||||
|
|
||||||
controlsLayout->AddItem(fFileName->CreateLabelLayoutItem(), 0, 0);
|
controlsLayout->AddItem(fFileName->CreateLabelLayoutItem(), 0, 0);
|
||||||
controlsLayout->AddItem(fFileName->CreateTextViewLayoutItem(), 1, 0);
|
controlsLayout->AddItem(fFileName->CreateTextViewLayoutItem(), 1, 0);
|
||||||
controlsLayout->AddItem(fImageFormatSelector->CreateLabelLayoutItem(), 0, 1);
|
controlsLayout->AddItem(fImageFormatSelector->CreateLabelLayoutItem(), 0,
|
||||||
controlsLayout->AddItem(fImageFormatSelector->CreateMenuBarLayoutItem(), 1, 1);
|
1);
|
||||||
controlsLayout->AddItem(fCaptureRateSelector->CreateLabelLayoutItem(), 0, 2);
|
controlsLayout->AddItem(fImageFormatSelector->CreateMenuBarLayoutItem(), 1,
|
||||||
controlsLayout->AddItem(fCaptureRateSelector->CreateMenuBarLayoutItem(), 1, 2);
|
1);
|
||||||
|
controlsLayout->AddItem(fCaptureRateSelector->CreateLabelLayoutItem(), 0,
|
||||||
|
2);
|
||||||
|
controlsLayout->AddItem(fCaptureRateSelector->CreateMenuBarLayoutItem(), 1,
|
||||||
|
2);
|
||||||
controlsLayout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, 3, 2);
|
controlsLayout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, 3, 2);
|
||||||
|
|
||||||
// FTP setup box
|
// FTP setup box
|
||||||
fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW);
|
fFtpSetupBox = new BBox(B_TRANSLATE("FTP Setup"), B_WILL_DRAW);
|
||||||
|
|
||||||
fUploadClientMenu = new BPopUpMenu("Send to" B_UTF8_ELLIPSIS);
|
fUploadClientMenu = new BPopUpMenu(B_TRANSLATE("Send to" B_UTF8_ELLIPSIS));
|
||||||
for (int i = 0; kUploadClient[i]; i++) {
|
for (int i = 0; kUploadClient[i]; i++) {
|
||||||
BMessage *m = new BMessage(msg_upl_client);
|
BMessage *m = new BMessage(msg_upl_client);
|
||||||
m->AddInt32("client", i);
|
m->AddInt32("client", i);
|
||||||
@@ -739,35 +788,35 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
fUploadClientSelector = new BMenuField("UploadClient", NULL,
|
fUploadClientSelector = new BMenuField("UploadClient", NULL,
|
||||||
fUploadClientMenu, NULL);
|
fUploadClientMenu, NULL);
|
||||||
|
|
||||||
fFtpSetupBox->SetLabel("Output");
|
fFtpSetupBox->SetLabel(B_TRANSLATE("Output"));
|
||||||
// this doesn't work with the layout manager
|
// this doesn't work with the layout manager
|
||||||
// fFtpSetupBox->SetLabel(fUploadClientSelector);
|
// fFtpSetupBox->SetLabel(fUploadClientSelector);
|
||||||
fUploadClientSelector->SetLabel("Type:");
|
fUploadClientSelector->SetLabel(B_TRANSLATE("Type:"));
|
||||||
|
|
||||||
BGridLayout *ftpLayout = new BGridLayout(kXBuffer, 0);
|
BGridLayout *ftpLayout = new BGridLayout(kXBuffer, 0);
|
||||||
ftpLayout->SetInsets(10, 15, 5, 5);
|
ftpLayout->SetInsets(10, 15, 5, 5);
|
||||||
fFtpSetupBox->SetLayout(ftpLayout);
|
fFtpSetupBox->SetLayout(ftpLayout);
|
||||||
|
|
||||||
fServerName = new BTextControl("Server", "Server:",
|
fServerName = new BTextControl("Server", B_TRANSLATE("Server:"),
|
||||||
fServerSetting->Value(), new BMessage(msg_server));
|
fServerSetting->Value(), new BMessage(msg_server));
|
||||||
fServerName->SetTarget(this);
|
fServerName->SetTarget(this);
|
||||||
|
|
||||||
fLoginId = new BTextControl("Login", "Login:",
|
fLoginId = new BTextControl("Login", B_TRANSLATE("Login:"),
|
||||||
fLoginSetting->Value(), new BMessage(msg_login));
|
fLoginSetting->Value(), new BMessage(msg_login));
|
||||||
fLoginId->SetTarget(this);
|
fLoginId->SetTarget(this);
|
||||||
|
|
||||||
fPassword = new BTextControl("Password", "Password:",
|
fPassword = new BTextControl("Password", B_TRANSLATE("Password:"),
|
||||||
fPasswordSetting->Value(), new BMessage(msg_password));
|
fPasswordSetting->Value(), new BMessage(msg_password));
|
||||||
fPassword->SetTarget(this);
|
fPassword->SetTarget(this);
|
||||||
fPassword->TextView()->HideTyping(true);
|
fPassword->TextView()->HideTyping(true);
|
||||||
// BeOS HideTyping() seems broken, it empties the text
|
// BeOS HideTyping() seems broken, it empties the text
|
||||||
fPassword->SetText(fPasswordSetting->Value());
|
fPassword->SetText(fPasswordSetting->Value());
|
||||||
|
|
||||||
fDirectory = new BTextControl("Directory", "Directory:",
|
fDirectory = new BTextControl("Directory", B_TRANSLATE("Directory:"),
|
||||||
fDirectorySetting->Value(), new BMessage(msg_directory));
|
fDirectorySetting->Value(), new BMessage(msg_directory));
|
||||||
fDirectory->SetTarget(this);
|
fDirectory->SetTarget(this);
|
||||||
|
|
||||||
fPassiveFtp = new BCheckBox("Passive FTP", "Passive FTP",
|
fPassiveFtp = new BCheckBox("Passive FTP", B_TRANSLATE("Passive FTP"),
|
||||||
new BMessage(msg_passiveftp));
|
new BMessage(msg_passiveftp));
|
||||||
fPassiveFtp->SetTarget(this);
|
fPassiveFtp->SetTarget(this);
|
||||||
fPassiveFtp->SetValue(fPassiveFtpSetting->Value());
|
fPassiveFtp->SetValue(fPassiveFtpSetting->Value());
|
||||||
@@ -784,7 +833,7 @@ VideoWindow::_BuildCaptureControls(BView* theView)
|
|||||||
ftpLayout->AddItem(fDirectory->CreateTextViewLayoutItem(), 1, 4);
|
ftpLayout->AddItem(fDirectory->CreateTextViewLayoutItem(), 1, 4);
|
||||||
ftpLayout->AddView(fPassiveFtp, 0, 5, 2);
|
ftpLayout->AddView(fPassiveFtp, 0, 5, 2);
|
||||||
|
|
||||||
fStatusLine = new BStringView("Status Line", "Waiting" B_UTF8_ELLIPSIS);
|
fStatusLine = new BStringView("Status Line", B_TRANSLATE("Waiting" B_UTF8_ELLIPSIS));
|
||||||
|
|
||||||
BGroupLayout *groupLayout = new BGroupLayout(B_VERTICAL);
|
BGroupLayout *groupLayout = new BGroupLayout(B_VERTICAL);
|
||||||
groupLayout->SetInsets(kXBuffer, kYBuffer, kXBuffer, kYBuffer);
|
groupLayout->SetInsets(kXBuffer, kYBuffer, kXBuffer, kYBuffer);
|
||||||
@@ -834,24 +883,26 @@ VideoWindow::_SetUpSettings(const char* filename, const char* dirname)
|
|||||||
fSettings = new Settings(filename, dirname);
|
fSettings = new Settings(filename, dirname);
|
||||||
|
|
||||||
fServerSetting = new StringValueSetting("Server", "ftp.my.server",
|
fServerSetting = new StringValueSetting("Server", "ftp.my.server",
|
||||||
"server address expected", "");
|
B_TRANSLATE("server address expected"), "");
|
||||||
fLoginSetting = new StringValueSetting("Login", "loginID",
|
fLoginSetting = new StringValueSetting("Login", "loginID",
|
||||||
"login ID expected", "");
|
B_TRANSLATE("login ID expected"), "");
|
||||||
fPasswordSetting = new StringValueSetting("Password", "password",
|
fPasswordSetting = new StringValueSetting("Password",
|
||||||
"password expected", "");
|
B_TRANSLATE("password"), B_TRANSLATE("password expected"), "");
|
||||||
fDirectorySetting = new StringValueSetting("Directory", "web/images",
|
fDirectorySetting = new StringValueSetting("Directory", "web/images",
|
||||||
"destination directory expected", "");
|
B_TRANSLATE("destination directory expected"), "");
|
||||||
fPassiveFtpSetting = new BooleanValueSetting("PassiveFtp", 1);
|
fPassiveFtpSetting = new BooleanValueSetting("PassiveFtp", 1);
|
||||||
fFilenameSetting = new StringValueSetting("StillImageFilename",
|
fFilenameSetting = new StringValueSetting("StillImageFilename",
|
||||||
"codycam.jpg", "still image filename expected", "");
|
"codycam.jpg", B_TRANSLATE("still image filename expected"), "");
|
||||||
fImageFormatSettings = new StringValueSetting("ImageFileFormat",
|
fImageFormatSettings = new StringValueSetting("ImageFileFormat",
|
||||||
"JPEG image", "image file format expected", "");
|
B_TRANSLATE("JPEG image"), B_TRANSLATE("image file format expected"),
|
||||||
|
"");
|
||||||
fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate",
|
fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate",
|
||||||
"Every 5 minutes", kCaptureRate, "capture rate expected",
|
kCaptureRate[3], kCaptureRate, B_TRANSLATE("capture rate expected"),
|
||||||
"unrecognized capture rate specified");
|
"unrecognized capture rate specified");
|
||||||
fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
|
fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
|
||||||
"FTP", kUploadClient, "upload client name expected",
|
B_TRANSLATE("FTP"), kUploadClient,
|
||||||
"unrecognized upload client specified");
|
B_TRANSLATE("upload client name expected"),
|
||||||
|
B_TRANSLATE("unrecognized upload client specified"));
|
||||||
|
|
||||||
fSettings->Add(fServerSetting);
|
fSettings->Add(fServerSetting);
|
||||||
fSettings->Add(fLoginSetting);
|
fSettings->Add(fLoginSetting);
|
||||||
@@ -900,8 +951,10 @@ VideoWindow::_QuitSettings()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
ControlWindow::ControlWindow(const BRect& frame, BView* controls, media_node node)
|
ControlWindow::ControlWindow(const BRect& frame, BView* controls,
|
||||||
: BWindow(frame, "Video settings", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
media_node node)
|
||||||
|
: BWindow(frame, B_TRANSLATE("Video settings"), B_TITLED_WINDOW,
|
||||||
|
B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
fView = controls;
|
fView = controls;
|
||||||
fNode = node;
|
fNode = node;
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
@@ -59,6 +61,7 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
const char* kCaptureRate[] = {
|
const char* kCaptureRate[] = {
|
||||||
|
// NOTE: These are translated once the app catalog is loaded.
|
||||||
"Every 15 seconds",
|
"Every 15 seconds",
|
||||||
"Every 30 seconds",
|
"Every 30 seconds",
|
||||||
"Every minute",
|
"Every minute",
|
||||||
@@ -77,6 +80,7 @@ const char* kCaptureRate[] = {
|
|||||||
|
|
||||||
|
|
||||||
const char* kUploadClient[] = {
|
const char* kUploadClient[] = {
|
||||||
|
// NOTE: These are translated once the app catalog is loaded.
|
||||||
"FTP",
|
"FTP",
|
||||||
"SFTP",
|
"SFTP",
|
||||||
"Local",
|
"Local",
|
||||||
@@ -106,6 +110,7 @@ private:
|
|||||||
BWindow* fWindow;
|
BWindow* fWindow;
|
||||||
port_id fPort;
|
port_id fPort;
|
||||||
BWindow* fVideoControlWindow;
|
BWindow* fVideoControlWindow;
|
||||||
|
BCatalog fAppCatalog;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "FtpClient"
|
||||||
|
|
||||||
|
|
||||||
FtpClient::FtpClient()
|
FtpClient::FtpClient()
|
||||||
: FileUploadClient(),
|
: FileUploadClient(),
|
||||||
fState(0),
|
fState(0),
|
||||||
@@ -373,10 +381,10 @@ FtpClient::Chmod(const string& path, const string& mod)
|
|||||||
|
|
||||||
if (path.length() == 0)
|
if (path.length() == 0)
|
||||||
cmd += '/';
|
cmd += '/';
|
||||||
printf("cmd: '%s'\n", cmd.c_str());
|
printf(B_TRANSLATE("cmd: '%s'\n"), cmd.c_str());
|
||||||
if (_SendRequest(cmd) == true) {
|
if (_SendRequest(cmd) == true) {
|
||||||
if (_GetReply(replyString, code, codeType) == true) {
|
if (_GetReply(replyString, code, codeType) == true) {
|
||||||
printf("reply: %d, %d\n", code, codeType);
|
printf(B_TRANSLATE("reply: %d, %d\n"), code, codeType);
|
||||||
if (codeType == 2)
|
if (codeType == 2)
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
@@ -424,7 +432,7 @@ FtpClient::_SendRequest(const string& cmd)
|
|||||||
|
|
||||||
if (fControl != 0) {
|
if (fControl != 0) {
|
||||||
if (cmd.find("PASS") != string::npos)
|
if (cmd.find("PASS") != string::npos)
|
||||||
printf("PASS <suppressed> (real password sent)\n");
|
printf(B_TRANSLATE("PASS <suppressed> (real password sent)\n"));
|
||||||
else
|
else
|
||||||
printf("%s\n", ccmd.c_str());
|
printf("%s\n", ccmd.c_str());
|
||||||
|
|
||||||
@@ -540,7 +548,7 @@ FtpClient::_GetReply(string& outString, int& outCode, int& codeType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!rc && outCode != 421) {
|
if (!rc && outCode != 421) {
|
||||||
outString += "Remote host has closed the connection.\n";
|
outString += B_TRANSLATE("Remote host has closed the connection.\n");
|
||||||
outCode = 421;
|
outCode = 421;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,17 @@ Application CodyCam :
|
|||||||
Settings.cpp
|
Settings.cpp
|
||||||
SettingsHandler.cpp
|
SettingsHandler.cpp
|
||||||
VideoConsumer.cpp
|
VideoConsumer.cpp
|
||||||
: be media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++)
|
: be locale media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++)
|
||||||
: CodyCam.rdef
|
: CodyCam.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs CodyCam :
|
||||||
|
x-vnd.Haiku.CodyCam
|
||||||
|
:
|
||||||
|
CodyCam.cpp
|
||||||
|
FtpClient.cpp
|
||||||
|
Settings.cpp
|
||||||
|
SettingsHandler.cpp
|
||||||
|
SftpClient.cpp
|
||||||
|
VideoConsumer.cpp
|
||||||
|
;
|
||||||
|
|||||||
@@ -4,7 +4,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "Settings"
|
||||||
|
|
||||||
|
|
||||||
Settings* settings = NULL;
|
Settings* settings = NULL;
|
||||||
@@ -229,15 +235,19 @@ BooleanValueSetting::Value() const
|
|||||||
const char*
|
const char*
|
||||||
BooleanValueSetting::Handle(const char *const *argv)
|
BooleanValueSetting::Handle(const char *const *argv)
|
||||||
{
|
{
|
||||||
if (!*++argv)
|
if (!*++argv) {
|
||||||
return "on or off expected";
|
return B_TRANSLATE_COMMENT("on or off expected","Do not translate "
|
||||||
|
"'on' and 'off'");
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(*argv, "on") == 0)
|
if (strcmp(*argv, "on") == 0)
|
||||||
fValue = true;
|
fValue = true;
|
||||||
else if (strcmp(*argv, "off") == 0)
|
else if (strcmp(*argv, "off") == 0)
|
||||||
fValue = false;
|
fValue = false;
|
||||||
else
|
else {
|
||||||
return "on or off expected";
|
return B_TRANSLATE_COMMENT("on or off expected", "Do not translate "
|
||||||
|
"'on' and 'off'");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,21 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <StopWatch.h>
|
#include <StopWatch.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "SettingsHandler"
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static int
|
static int
|
||||||
Compare(const SettingsArgvDispatcher* p1, const SettingsArgvDispatcher* p2)
|
Compare(const SettingsArgvDispatcher* p1, const SettingsArgvDispatcher* p2)
|
||||||
@@ -56,7 +62,7 @@ ArgvParser::ArgvParser(const char* name)
|
|||||||
{
|
{
|
||||||
fFile = fopen(fFileName, "r");
|
fFile = fopen(fFileName, "r");
|
||||||
if (!fFile) {
|
if (!fFile) {
|
||||||
PRINT(("Error opening %s\n", fFileName));
|
PRINT((B_TRANSLATE("Error opening %s\n"), fFileName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fBuffer = new char [kBufferSize];
|
fBuffer = new char [kBufferSize];
|
||||||
@@ -95,7 +101,7 @@ ArgvParser::SendArgv(ArgvHandler argvHandlerFunc, void* passThru)
|
|||||||
fCurrentArgv[fArgc] = 0;
|
fCurrentArgv[fArgc] = 0;
|
||||||
const char *result = (argvHandlerFunc)(fArgc, fCurrentArgv, passThru);
|
const char *result = (argvHandlerFunc)(fArgc, fCurrentArgv, passThru);
|
||||||
if (result)
|
if (result)
|
||||||
printf("File %s; Line %ld # %s", fFileName, fLineNo, result);
|
printf(B_TRANSLATE("File %s; Line %ld # %s"), fFileName, fLineNo, result);
|
||||||
MakeArgvEmpty();
|
MakeArgvEmpty();
|
||||||
if (result)
|
if (result)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -148,7 +154,8 @@ ArgvParser::GetCh()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc, void* passThru)
|
ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc,
|
||||||
|
void* passThru)
|
||||||
{
|
{
|
||||||
ArgvParser parser(name);
|
ArgvParser parser(name);
|
||||||
return parser.EachArgvPrivate(name, argvHandlerFunc, passThru);
|
return parser.EachArgvPrivate(name, argvHandlerFunc, passThru);
|
||||||
@@ -166,7 +173,8 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
|
|||||||
if (ch == EOF) {
|
if (ch == EOF) {
|
||||||
// done with file
|
// done with file
|
||||||
if (fInDoubleQuote || fInSingleQuote) {
|
if (fInDoubleQuote || fInSingleQuote) {
|
||||||
printf("File %s # unterminated quote at end of file\n", name);
|
printf(B_TRANSLATE("File %s # unterminated quote at end of "
|
||||||
|
"file\n"), name);
|
||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -178,7 +186,8 @@ ArgvParser::EachArgvPrivate(const char* name, ArgvHandler argvHandlerFunc,
|
|||||||
// handle new line
|
// handle new line
|
||||||
fEatComment = false;
|
fEatComment = false;
|
||||||
if (!fSawBackslash && (fInDoubleQuote || fInSingleQuote)) {
|
if (!fSawBackslash && (fInDoubleQuote || fInSingleQuote)) {
|
||||||
printf("File %s ; Line %ld # unterminated quote\n", name, fLineNo);
|
printf(B_TRANSLATE("File %s ; Line %ld # unterminated "
|
||||||
|
"quote\n"), name, fLineNo);
|
||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -350,7 +359,7 @@ Settings::_ParseUserSettings(int, const char* const *argv, void* castToThis)
|
|||||||
|
|
||||||
SettingsArgvDispatcher* handler = settings->_Find(*argv);
|
SettingsArgvDispatcher* handler = settings->_Find(*argv);
|
||||||
if (!handler)
|
if (!handler)
|
||||||
return "unknown command";
|
return B_TRANSLATE("unknown command");
|
||||||
return handler->Handle(argv);
|
return handler->Handle(argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ SftpClient::ChangeDir(const string& dir)
|
|||||||
cmd << " " << dir.c_str() << "\n";
|
cmd << " " << dir.c_str() << "\n";
|
||||||
SendCommand(cmd.String());
|
SendCommand(cmd.String());
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("sftp>") < 0)
|
if (reply.FindFirst("sftp>") < 0)
|
||||||
return false;
|
return false;
|
||||||
rc = true;
|
rc = true;
|
||||||
@@ -46,10 +46,10 @@ SftpClient::ListDirContents(string& listing)
|
|||||||
BString reply;
|
BString reply;
|
||||||
do {
|
do {
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
printf("%s", reply.String());
|
printf("%s", reply.String());
|
||||||
if (reply.FindFirst("sftp>") == 0)
|
if (reply.FindFirst("sftp>") == 0)
|
||||||
return true;
|
return true;
|
||||||
@@ -69,7 +69,8 @@ SftpClient::PrintWorkingDir(string& dir)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SftpClient::Connect(const string& server, const string& login, const string& passwd)
|
SftpClient::Connect(const string& server, const string& login,
|
||||||
|
const string& passwd)
|
||||||
{
|
{
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
BString cmd("sftp ");
|
BString cmd("sftp ");
|
||||||
@@ -89,18 +90,18 @@ SftpClient::Connect(const string& server, const string& login, const string& pas
|
|||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %ld\n", len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("Connecting to ") != 0)
|
if (reply.FindFirst("Connecting to ") != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %ld\n", len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst(/*[pP]*/"assword:") < 0)
|
if (reply.FindFirst(/*[pP]*/"assword:") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -108,18 +109,18 @@ SftpClient::Connect(const string& server, const string& login, const string& pas
|
|||||||
write(OutputPipe(), "\n", 1);
|
write(OutputPipe(), "\n", 1);
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %ld\n", len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply != "\n")
|
if (reply != "\n")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %ld\n", len);
|
fprintf(stderr, _GetLongReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("sftp>") < 0)
|
if (reply.FindFirst("sftp>") < 0)
|
||||||
return false;
|
return false;
|
||||||
return rc;
|
return rc;
|
||||||
@@ -138,18 +139,18 @@ SftpClient::PutFile(const string& local, const string& remote, ftp_mode mode)
|
|||||||
BString reply;
|
BString reply;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("Uploading") < 0)
|
if (reply.FindFirst("Uploading") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("sftp>") < 0)
|
if (reply.FindFirst("sftp>") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -183,19 +184,19 @@ SftpClient::MoveFile(const string& oldPath, const string& newPath)
|
|||||||
BString reply;
|
BString reply;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
// we don't care if it worked or not.
|
// we don't care if it worked or not.
|
||||||
//if (reply.FindFirst("Removing") != 0 && reply.FindFirst("Couldn't") )
|
//if (reply.FindFirst("Removing") != 0 && reply.FindFirst("Couldn't") )
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("sftp>") < 0)
|
if (reply.FindFirst("sftp>") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -203,10 +204,10 @@ SftpClient::MoveFile(const string& oldPath, const string& newPath)
|
|||||||
cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n";
|
cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n";
|
||||||
SendCommand(cmd.String());
|
SendCommand(cmd.String());
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("sftp>") < 0)
|
if (reply.FindFirst("sftp>") < 0)
|
||||||
return false;
|
return false;
|
||||||
rc = true;
|
rc = true;
|
||||||
@@ -226,18 +227,18 @@ SftpClient::Chmod(const string& path, const string& mod)
|
|||||||
BString reply;
|
BString reply;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("Changing") < 0)
|
if (reply.FindFirst("Changing") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((len = ReadReply(&reply)) < 0) {
|
if ((len = ReadReply(&reply)) < 0) {
|
||||||
fprintf(stderr, "read: %d\n", len);
|
fprintf(stderr, _GetReadText(), len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "reply: '%s'\n", reply.String());
|
fprintf(stderr, _GetReplyText(), reply.String());
|
||||||
if (reply.FindFirst("sftp>") < 0)
|
if (reply.FindFirst("sftp>") < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -252,3 +253,24 @@ SftpClient::SetPassive(bool on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
SftpClient::_GetLongReadText() const
|
||||||
|
{
|
||||||
|
return B_TRANSLATE("read: %ld\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
SftpClient::_GetReadText() const
|
||||||
|
{
|
||||||
|
return B_TRANSLATE("read: %d\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
SftpClient::_GetReplyText() const
|
||||||
|
{
|
||||||
|
return B_TRANSLATE("reply: '%s'\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,36 +5,50 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
#include "SpawningUploadClient.h"
|
#include "SpawningUploadClient.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "SftpClient"
|
||||||
|
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
class SftpClient : public SpawningUploadClient {
|
class SftpClient : public SpawningUploadClient {
|
||||||
public:
|
public:
|
||||||
SftpClient();
|
SftpClient();
|
||||||
~SftpClient();
|
virtual ~SftpClient();
|
||||||
|
|
||||||
virtual bool Connect(const string& server, const string& login,
|
virtual bool Connect(const string& server,
|
||||||
const string& passwd);
|
const string& login,
|
||||||
|
const string& passwd);
|
||||||
|
|
||||||
bool PutFile(const string& local, const string& remote,
|
bool PutFile(const string& local,
|
||||||
ftp_mode mode = binary_mode);
|
const string& remote,
|
||||||
|
ftp_mode mode = binary_mode);
|
||||||
|
|
||||||
bool GetFile(const string& remote, const string& local,
|
bool GetFile(const string& remote,
|
||||||
ftp_mode mode = binary_mode);
|
const string& local,
|
||||||
|
ftp_mode mode = binary_mode);
|
||||||
|
|
||||||
bool MoveFile(const string& oldPath, const string& newPath);
|
bool MoveFile(const string& oldPath,
|
||||||
bool ChangeDir(const string& dir);
|
const string& newPath);
|
||||||
bool PrintWorkingDir(string& dir);
|
bool ChangeDir(const string& dir);
|
||||||
bool ListDirContents(string& listing);
|
bool PrintWorkingDir(string& dir);
|
||||||
bool Chmod(const string& path, const string& mod);
|
bool ListDirContents(string& listing);
|
||||||
|
bool Chmod(const string& path, const string& mod);
|
||||||
|
|
||||||
void SetPassive(bool on);
|
void SetPassive(bool on);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
const char* _GetLongReadText() const;
|
||||||
|
const char* _GetReadText() const;
|
||||||
|
const char* _GetReplyText() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SFTP_CLIENT_H
|
#endif // SFTP_CLIENT_H
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Buffer.h>
|
#include <Buffer.h>
|
||||||
#include <BufferGroup.h>
|
#include <BufferGroup.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MediaRoster.h>
|
#include <MediaRoster.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
@@ -24,6 +26,9 @@
|
|||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "VideoConsumer.cpp"
|
||||||
|
|
||||||
#define M1 ((double)1000000.0)
|
#define M1 ((double)1000000.0)
|
||||||
#define JITTER 20000
|
#define JITTER 20000
|
||||||
|
|
||||||
@@ -32,15 +37,19 @@
|
|||||||
#define PROGRESS printf
|
#define PROGRESS printf
|
||||||
#define LOOP printf
|
#define LOOP printf
|
||||||
|
|
||||||
|
|
||||||
static status_t SetFileType(BFile* file, int32 translator, uint32 type);
|
static status_t SetFileType(BFile* file, int32 translator, uint32 type);
|
||||||
|
|
||||||
const media_raw_video_format vid_format = {29.97, 1, 0, 239, B_VIDEO_TOP_LEFT_RIGHT,
|
const media_raw_video_format vid_format = {29.97, 1, 0, 239,
|
||||||
1, 1, {B_RGB16, 320, 240, 320 * 4, 0, 0}};
|
B_VIDEO_TOP_LEFT_RIGHT, 1, 1, {B_RGB16, 320, 240, 320 * 4, 0, 0}};
|
||||||
|
|
||||||
|
|
||||||
VideoConsumer::VideoConsumer(const char* name, BView* view, BStringView* statusLine,
|
VideoConsumer::VideoConsumer(const char* name, BView* view,
|
||||||
|
BStringView* statusLine,
|
||||||
BMediaAddOn* addon, const uint32 internalId)
|
BMediaAddOn* addon, const uint32 internalId)
|
||||||
: BMediaNode(name), BMediaEventLooper(), BBufferConsumer(B_MEDIA_RAW_VIDEO),
|
: BMediaNode(name),
|
||||||
|
BMediaEventLooper(),
|
||||||
|
BBufferConsumer(B_MEDIA_RAW_VIDEO),
|
||||||
fStatusLine(statusLine),
|
fStatusLine(statusLine),
|
||||||
fInternalID(internalId),
|
fInternalID(internalId),
|
||||||
fAddOn(addon),
|
fAddOn(addon),
|
||||||
@@ -86,9 +95,9 @@ VideoConsumer::~VideoConsumer()
|
|||||||
Quit();
|
Quit();
|
||||||
|
|
||||||
if (fWindow) {
|
if (fWindow) {
|
||||||
printf("Locking the window\n");
|
printf(B_TRANSLATE("Locking the window\n"));
|
||||||
if (fWindow->Lock()) {
|
if (fWindow->Lock()) {
|
||||||
printf("Closing the window\n");
|
printf(B_TRANSLATE("Closing the window\n"));
|
||||||
fWindow->Close();
|
fWindow->Close();
|
||||||
fWindow = 0;
|
fWindow = 0;
|
||||||
}
|
}
|
||||||
@@ -652,7 +661,7 @@ VideoConsumer::LocalSave(char* filename, BBitmap* bitmap)
|
|||||||
{
|
{
|
||||||
BFile* output;
|
BFile* output;
|
||||||
|
|
||||||
UpdateFtpStatus("Capturing Image" B_UTF8_ELLIPSIS);
|
UpdateFtpStatus(B_TRANSLATE("Capturing Image" B_UTF8_ELLIPSIS));
|
||||||
|
|
||||||
/* save a local copy of the image in the requested format */
|
/* save a local copy of the image in the requested format */
|
||||||
output = new BFile();
|
output = new BFile();
|
||||||
@@ -663,17 +672,17 @@ VideoConsumer::LocalSave(char* filename, BBitmap* bitmap)
|
|||||||
if (err == B_OK) {
|
if (err == B_OK) {
|
||||||
err = SetFileType(output, fTranslator, fImageFormat);
|
err = SetFileType(output, fTranslator, fImageFormat);
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
UpdateFtpStatus("Error setting type of output file");
|
UpdateFtpStatus(B_TRANSLATE("Error setting type of output file"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UpdateFtpStatus("Error writing output file");
|
UpdateFtpStatus(B_TRANSLATE("Error writing output file"));
|
||||||
|
|
||||||
input.DetachBitmap(&bitmap);
|
input.DetachBitmap(&bitmap);
|
||||||
output->Unset();
|
output->Unset();
|
||||||
delete output;
|
delete output;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
} else {
|
} else {
|
||||||
UpdateFtpStatus("Error creating output file");
|
UpdateFtpStatus(B_TRANSLATE("Error creating output file"));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,21 +704,23 @@ VideoConsumer::FtpSave(char* filename)
|
|||||||
case 2:
|
case 2:
|
||||||
return B_OK;
|
return B_OK;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "invalid upload client %ld\n", fUploadClient);
|
fprintf(stderr, B_TRANSLATE("invalid upload client %ld\n"),
|
||||||
|
fUploadClient);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftp->SetPassive(fPassiveFtp);
|
ftp->SetPassive(fPassiveFtp);
|
||||||
// ftp the local file to our web site
|
// ftp the local file to our web site
|
||||||
|
|
||||||
UpdateFtpStatus("Logging in" B_UTF8_ELLIPSIS);
|
UpdateFtpStatus(B_TRANSLATE("Logging in" B_UTF8_ELLIPSIS));
|
||||||
if (ftp->Connect((string)fServerText, (string)fLoginText, (string)fPasswordText)) {
|
if (ftp->Connect((string)fServerText, (string)fLoginText,
|
||||||
|
(string)fPasswordText)) {
|
||||||
// connect to server
|
// connect to server
|
||||||
UpdateFtpStatus("Connected" B_UTF8_ELLIPSIS);
|
UpdateFtpStatus(B_TRANSLATE("Connected" B_UTF8_ELLIPSIS));
|
||||||
|
|
||||||
if (ftp->ChangeDir((string)fDirectoryText)) {
|
if (ftp->ChangeDir((string)fDirectoryText)) {
|
||||||
// cd to the desired directory
|
// cd to the desired directory
|
||||||
UpdateFtpStatus("Transmitting" B_UTF8_ELLIPSIS);
|
UpdateFtpStatus(B_TRANSLATE("Transmitting" B_UTF8_ELLIPSIS));
|
||||||
|
|
||||||
if (ftp->PutFile((string)filename, (string)"temp")) {
|
if (ftp->PutFile((string)filename, (string)"temp")) {
|
||||||
// send the file to the server
|
// send the file to the server
|
||||||
@@ -717,13 +728,13 @@ VideoConsumer::FtpSave(char* filename)
|
|||||||
ftp->Chmod((string)"temp", (string)"644");
|
ftp->Chmod((string)"temp", (string)"644");
|
||||||
// make it world readable
|
// make it world readable
|
||||||
|
|
||||||
UpdateFtpStatus("Renaming" B_UTF8_ELLIPSIS);
|
UpdateFtpStatus(B_TRANSLATE("Renaming" B_UTF8_ELLIPSIS));
|
||||||
|
|
||||||
if (ftp->MoveFile((string)"temp", (string)filename)) {
|
if (ftp->MoveFile((string)"temp", (string)filename)) {
|
||||||
// change to the desired name
|
// change to the desired name
|
||||||
uint32 time = real_time_clock();
|
uint32 time = real_time_clock();
|
||||||
char s[80];
|
char s[80];
|
||||||
strcpy(s, "Last Capture: ");
|
strcpy(s, B_TRANSLATE("Last Capture: "));
|
||||||
strcat(s, ctime((const long*)&time));
|
strcat(s, ctime((const long*)&time));
|
||||||
s[strlen(s) - 1] = 0;
|
s[strlen(s) - 1] = 0;
|
||||||
UpdateFtpStatus(s);
|
UpdateFtpStatus(s);
|
||||||
@@ -731,16 +742,17 @@ VideoConsumer::FtpSave(char* filename)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UpdateFtpStatus("Rename failed");
|
UpdateFtpStatus(B_TRANSLATE("Rename failed"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UpdateFtpStatus("File transmission failed");
|
UpdateFtpStatus(B_TRANSLATE("File transmission failed"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UpdateFtpStatus("Couldn't find requested directory on server");
|
UpdateFtpStatus(B_TRANSLATE("Couldn't find requested directory on "
|
||||||
|
"server"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
UpdateFtpStatus("Server login failed");
|
UpdateFtpStatus(B_TRANSLATE("Server login failed"));
|
||||||
|
|
||||||
delete ftp;
|
delete ftp;
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user