Ticket #5908: codycamLocalization.patch

File codycamLocalization.patch, 49.9 KB (added by Karvjorm, 12 years ago)

A localization patch for CodyCam application

  • src/apps/codycam/SettingsHandler.cpp

     
    55#include <stdlib.h>
    66#include <string.h>
    77
     8#include <Catalog.h>
    89#include <Debug.h>
    910#include <Directory.h>
    1011#include <Entry.h>
    1112#include <File.h>
    1213#include <FindDirectory.h>
     14#include <Locale.h>
    1315#include <Path.h>
    1416#include <StopWatch.h>
    1517
     18#undef TR_CONTEXT
     19#define TR_CONTEXT "SettingsHandler"
    1620
    1721#if 0
    1822static int
     
    5660{
    5761    fFile = fopen(fFileName, "r");
    5862    if (!fFile) {
    59         PRINT(("Error opening %s\n", fFileName));
     63        PRINT((TR("Error opening %s\n"), fFileName));
    6064        return;
    6165    }
    6266    fBuffer = new char [kBufferSize];
     
    9599        fCurrentArgv[fArgc] = 0;
    96100        const char *result = (argvHandlerFunc)(fArgc, fCurrentArgv, passThru);
    97101        if (result)
    98             printf("File %s; Line %ld # %s", fFileName, fLineNo, result);
     102            printf(TR("File %s; Line %ld # %s"), fFileName, fLineNo, result);
    99103        MakeArgvEmpty();
    100104        if (result)
    101105            return B_ERROR;
     
    148152
    149153
    150154status_t
    151 ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc, void* passThru)
     155ArgvParser::EachArgv(const char* name, ArgvHandler argvHandlerFunc,
     156    void* passThru)
    152157{
    153158    ArgvParser parser(name);
    154159    return parser.EachArgvPrivate(name, argvHandlerFunc, passThru);
     
    166171        if (ch == EOF) {
    167172            // done with file
    168173            if (fInDoubleQuote || fInSingleQuote) {
    169                 printf("File %s # unterminated quote at end of file\n", name);
     174                printf(TR("File %s # unterminated quote at end of file\n"),
     175                    name);
    170176                result = B_ERROR;
    171177                break;
    172178            }
     
    178184            // handle new line
    179185            fEatComment = false;
    180186            if (!fSawBackslash && (fInDoubleQuote || fInSingleQuote)) {
    181                 printf("File %s ; Line %ld # unterminated quote\n", name, fLineNo);
     187                printf(TR("File %s ; Line %ld # unterminated quote\n"), name,
     188                    fLineNo);
    182189                result = B_ERROR;
    183190                break;
    184191            }
     
    268275{
    269276    if (!*argv) {
    270277        if (printError)
    271             printf("rect left expected");
     278            printf(TR("rect left expected"));
    272279        return false;
    273280    }
    274281    result.left = atoi(*argv);
    275282    if (!*++argv) {
    276283        if (printError)
    277             printf("rect top expected");
     284            printf(TR("rect top expected"));
    278285        return false;
    279286    }
    280287    result.top = atoi(*argv);
    281288    if (!*++argv) {
    282289        if (printError)
    283             printf("rect right expected");
     290            printf(TR("rect right expected"));
    284291        return false;
    285292    }
    286293    result.right = atoi(*argv);
    287294    if (!*++argv) {
    288295        if (printError)
    289             printf("rect bottom expected");
     296            printf(TR("rect bottom expected"));
    290297        return false;
    291298    }
    292299    result.bottom = atoi(*argv);
     
    350357
    351358    SettingsArgvDispatcher* handler = settings->_Find(*argv);
    352359    if (!handler)
    353         return "unknown command";
     360        return TR("unknown command");
    354361    return handler->Handle(argv);
    355362}
    356363
  • src/apps/codycam/Settings.cpp

     
    11#include "Settings.h"
    22
     3#include <Catalog.h>
     4#include <Locale.h>
     5
    36#include <stdio.h>
    47#include <stdlib.h>
    58#include <string.h>
     
    710#include <Debug.h>
    811
    912
     13#undef TR_CONTEXT
     14#define TR_CONTEXT "Settings"
     15
    1016Settings* settings = NULL;
    1117
    1218
     
    4955void
    5056StringValueSetting::SaveSettingValue(Settings* settings)
    5157{
    52     printf("-------StringValueSetting::SaveSettingValue %s %s\n", Name(), fValue);
     58    printf("-------StringValueSetting::SaveSettingValue %s %s\n", Name(),
     59        fValue);
    5360    settings->Write("\"%s\"", fValue);
    5461}
    5562
     
    8087    const char* defaultValue, const char *const *values,
    8188    const char* valueExpectedErrorString,
    8289    const char* wrongValueErrorString)
    83     : StringValueSetting(name, defaultValue, valueExpectedErrorString, wrongValueErrorString),
     90    : StringValueSetting(name, defaultValue, valueExpectedErrorString,
     91        wrongValueErrorString),
    8492    fValues(values)
    8593{
    8694}
     
    230238BooleanValueSetting::Handle(const char *const *argv)
    231239{
    232240    if (!*++argv)
    233         return "on or off expected";
     241        return TR("on or off expected");
    234242
    235243    if (strcmp(*argv, "on") == 0)
    236244        fValue = true;
    237245    else if (strcmp(*argv, "off") == 0)
    238246        fValue = false;
    239247    else
    240         return "on or off expected";
     248        return TR("on or off expected");
    241249
    242250    return 0;
    243251}
  • src/apps/codycam/SftpClient.cpp

     
    33
    44#include "SftpClient.h"
    55
     6
    67SftpClient::SftpClient()
    78    : SpawningUploadClient()
    89{
     
    2627    cmd << " " << dir.c_str() << "\n";
    2728    SendCommand(cmd.String());
    2829    if ((len = ReadReply(&reply)) < 0) {
    29         fprintf(stderr, "read: %d\n", len);
     30        fprintf(stderr, GetReadText(), len);
    3031        return false;
    3132    }
    32     fprintf(stderr, "reply: '%s'\n", reply.String());
     33    fprintf(stderr, GetReplyText(), reply.String());
    3334    if (reply.FindFirst("sftp>") < 0)
    3435        return false;
    3536    rc = true;
     
    4647    BString reply;
    4748    do {
    4849        if ((len = ReadReply(&reply)) < 0) {
    49             fprintf(stderr, "read: %d\n", len);
     50            fprintf(stderr, GetReadText(), len);
    5051            return false;
    5152        }
    52         fprintf(stderr, "reply: '%s'\n", reply.String());
     53        fprintf(stderr, GetReplyText(), reply.String());
    5354        printf("%s", reply.String());
    5455        if (reply.FindFirst("sftp>") == 0)
    5556            return true;
     
    6970
    7071
    7172bool
    72 SftpClient::Connect(const string& server, const string& login, const string& passwd)
     73SftpClient::Connect(const string& server, const string& login,
     74    const string& passwd)
    7375{
    7476    bool rc = false;
    7577    BString cmd("sftp ");
     
    8284        cmd << "-oPort=" << port << " ";
    8385    cmd << login.c_str();
    8486    cmd << "@" << host.String();
    85     printf("COMMAND: '%s'\n", cmd.String());
     87    printf(TR("COMMAND: '%s'\n"), cmd.String());
    8688    SetCommandLine(cmd.String());
    8789    rc = SpawningUploadClient::Connect(server, login, passwd);
    8890    BString reply;
    8991    ssize_t len;
    9092   
    9193    if ((len = ReadReply(&reply)) < 0) {
    92         fprintf(stderr, "read: %ld\n", len);
     94        fprintf(stderr, GetLReadText(), len);
    9395        return false;
    9496    }
    95     fprintf(stderr, "reply: '%s'\n", reply.String());
     97    fprintf(stderr, GetReplyText(), reply.String());
    9698    if (reply.FindFirst("Connecting to ") != 0)
    9799        return false;
    98100   
    99101    if ((len = ReadReply(&reply)) < 0) {
    100         fprintf(stderr, "read: %ld\n", len);
     102        fprintf(stderr, GetLReadText(), len);
    101103        return false;
    102104    }
    103     fprintf(stderr, "reply: '%s'\n", reply.String());
     105    fprintf(stderr, GetReplyText(), reply.String());
    104106    if (reply.FindFirst(/*[pP]*/"assword:") < 0)
    105107        return false;
    106108   
     
    108110    write(OutputPipe(), "\n", 1);
    109111   
    110112    if ((len = ReadReply(&reply)) < 0) {
    111         fprintf(stderr, "read: %ld\n", len);
     113        fprintf(stderr, GetLReadText(), len);
    112114        return false;
    113115    }
    114     fprintf(stderr, "reply: '%s'\n", reply.String());
     116    fprintf(stderr, GetReplyText(), reply.String());
    115117    if (reply != "\n")
    116118        return false;
    117119   
    118120    if ((len = ReadReply(&reply)) < 0) {
    119         fprintf(stderr, "read: %ld\n", len);
     121        fprintf(stderr, GetLReadText(), len);
    120122        return false;
    121123    }
    122     fprintf(stderr, "reply: '%s'\n", reply.String());
     124    fprintf(stderr, GetReplyText(), reply.String());
    123125    if (reply.FindFirst("sftp>") < 0)
    124126        return false;
    125127    return rc;
     
    138140    BString reply;
    139141
    140142    if ((len = ReadReply(&reply)) < 0) {
    141         fprintf(stderr, "read: %d\n", len);
     143        fprintf(stderr, GetReadText(), len);
    142144        return false;
    143145    }
    144     fprintf(stderr, "reply: '%s'\n", reply.String());
     146    fprintf(stderr, GetReplyText(), reply.String());
    145147    if (reply.FindFirst("Uploading") < 0)
    146148        return false;
    147149
    148150    if ((len = ReadReply(&reply)) < 0) {
    149         fprintf(stderr, "read: %d\n", len);
     151        fprintf(stderr, GetReadText(), len);
    150152        return false;
    151153    }
    152     fprintf(stderr, "reply: '%s'\n", reply.String());
     154    fprintf(stderr, GetReplyText(), reply.String());
    153155    if (reply.FindFirst("sftp>") < 0)
    154156        return false;
    155157
     
    178180    // sftpd can't rename to an existing file...
    179181    BString cmd("rm");
    180182    cmd << " " << newPath.c_str() << "\n";
    181     fprintf(stderr, "CMD: '%s'\n", cmd.String());
     183    fprintf(stderr, TR("CMD: '%s'\n"), cmd.String());
    182184    SendCommand(cmd.String());
    183185    BString reply;
    184186
    185187    if ((len = ReadReply(&reply)) < 0) {
    186         fprintf(stderr, "read: %d\n", len);
     188        fprintf(stderr, GetReadText(), len);
    187189        return false;
    188190    }
    189     fprintf(stderr, "reply: '%s'\n", reply.String());
     191    fprintf(stderr, GetReplyText(), reply.String());
    190192    // we don't care if it worked or not.
    191193    //if (reply.FindFirst("Removing") != 0 && reply.FindFirst("Couldn't") )
    192194    //  return false;
    193195
    194196    if ((len = ReadReply(&reply)) < 0) {
    195         fprintf(stderr, "read: %d\n", len);
     197        fprintf(stderr, GetReadText(), len);
    196198        return false;
    197199    }
    198     fprintf(stderr, "reply: '%s'\n", reply.String());
     200    fprintf(stderr, GetReplyText(), reply.String());
    199201    if (reply.FindFirst("sftp>") < 0)
    200202        return false;
    201203
     
    203205    cmd << " " << oldPath.c_str() << " " << newPath.c_str() << "\n";
    204206    SendCommand(cmd.String());
    205207    if ((len = ReadReply(&reply)) < 0) {
    206         fprintf(stderr, "read: %d\n", len);
     208        fprintf(stderr, GetReadText(), len);
    207209        return false;
    208210    }
    209     fprintf(stderr, "reply: '%s'\n", reply.String());
     211    fprintf(stderr, GetReplyText(), reply.String());
    210212    if (reply.FindFirst("sftp>") < 0)
    211213        return false;
    212214    rc = true;
     
    226228    BString reply;
    227229
    228230    if ((len = ReadReply(&reply)) < 0) {
    229         fprintf(stderr, "read: %d\n", len);
     231        fprintf(stderr, GetReadText(), len);
    230232        return false;
    231233    }
    232     fprintf(stderr, "reply: '%s'\n", reply.String());
     234    fprintf(stderr, GetReplyText(), reply.String());
    233235    if (reply.FindFirst("Changing") < 0)
    234236        return false;
    235237
    236238    if ((len = ReadReply(&reply)) < 0) {
    237         fprintf(stderr, "read: %d\n", len);
     239        fprintf(stderr, GetReadText(), len);
    238240        return false;
    239241    }
    240     fprintf(stderr, "reply: '%s'\n", reply.String());
     242    fprintf(stderr, GetReplyText(), reply.String());
    241243    if (reply.FindFirst("sftp>") < 0)
    242244        return false;
    243245
  • src/apps/codycam/CodyCam.cpp

     
    5757static void
    5858ErrorAlert(const char* message, status_t err, BWindow *window = NULL)
    5959{
    60     BAlert *alert = new BAlert("", message, "OK");
     60    BAlert *alert = new BAlert("", message, TR("OK"));
    6161    if (window != NULL)
    6262        alert->CenterIn(window->Frame());
    6363    alert->Go();
     
    127127    fVideoConsumer(NULL),
    128128    fWindow(NULL),
    129129    fPort(0),
    130     fVideoControlWindow(NULL)
     130    fVideoControlWindow(NULL),
     131    fAppCatalog(NULL)
    131132{
    132133    chdir("/boot/home");
     134    be_locale->GetAppCatalog(&fAppCatalog);
    133135}
    134136
    135137
     
    152154CodyCam::ReadyToRun()
    153155{
    154156    fWindow = new VideoWindow(BRect(28, 28, 28, 28),
    155         (const char*) "CodyCam", B_TITLED_WINDOW,
     157        (const char*) TR("CodyCam"), B_TITLED_WINDOW,
    156158        B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, &fPort);
    157159
    158160    _SetUpNodes();
     
    178180    switch (message->what) {
    179181        case msg_start:
    180182        {
    181             BTimeSource* timeSource = fMediaRoster->MakeTimeSourceFor(fTimeSourceNode);
     183            BTimeSource* timeSource
     184                = fMediaRoster->MakeTimeSourceFor(fTimeSourceNode);
    182185            bigtime_t real = BTimeSource::RealTime();
    183186            bigtime_t perf = timeSource->PerformanceTimeFor(real) + 10000;
    184187            status_t status = fMediaRoster->StartNode(fProducerNode, perf);
    185188            if (status != B_OK)
    186                 ERROR("error starting producer!");
     189                ERROR(TR("error starting producer!"));
    187190            timeSource->Release();
    188191            break;
    189192        }
     
    208211                    BRect(2 * WINDOW_OFFSET_X + WINDOW_SIZE_X, WINDOW_OFFSET_Y,
    209212                    2 * WINDOW_OFFSET_X + WINDOW_SIZE_X + view->Bounds().right,
    210213                    WINDOW_OFFSET_Y + view->Bounds().bottom), view, node);
    211                 fMediaRoster->StartWatching(BMessenger(NULL, fVideoControlWindow), node,
    212                     B_MEDIA_WEB_CHANGED);
     214                fMediaRoster->StartWatching(BMessenger(NULL,
     215                    fVideoControlWindow), node, B_MEDIA_WEB_CHANGED);
    213216                fVideoControlWindow->Show();
    214217            }
    215218            break;
    216219        }
    217220
    218221        case msg_about:
    219             (new BAlert("About CodyCam", "CodyCam\n\nThe Original BeOS webcam",
    220                 "Close"))->Go();
     222            (new BAlert(TR("About CodyCam"), TR("CodyCam\n\nThe Original BeOS "
     223                "webcam"), TR("Close")))->Go();
    221224            break;
    222225
    223226        case msg_control_win:
     
    241244    /* find the media roster */
    242245    fMediaRoster = BMediaRoster::Roster(&status);
    243246    if (status != B_OK) {
    244         ErrorAlert("Cannot find the media roster", status, fWindow);
     247        ErrorAlert(TR("Cannot find the media roster"), status, fWindow);
    245248        return status;
    246249    }
    247250
    248251    /* find the time source */
    249252    status = fMediaRoster->GetTimeSource(&fTimeSourceNode);
    250253    if (status != B_OK) {
    251         ErrorAlert("Cannot get a time source", status, fWindow);
     254        ErrorAlert(TR("Cannot get a time source"), status, fWindow);
    252255        return status;
    253256    }
    254257
    255258    /* find a video producer node */
    256     INFO("CodyCam acquiring VideoInput node\n");
     259    INFO(TR("CodyCam acquiring VideoInput node\n"));
    257260    status = fMediaRoster->GetVideoInput(&fProducerNode);
    258261    if (status != B_OK) {
    259         ErrorAlert("Cannot find a video source. You need a webcam to use CodyCam.", status, fWindow);
     262        ErrorAlert(TR("Cannot find a video source. You need a webcam to use "
     263            "CodyCam."), status, fWindow);
    260264        return status;
    261265    }
    262266
    263267    /* create the video consumer node */
    264     fVideoConsumer = new VideoConsumer("CodyCam", ((VideoWindow*)fWindow)->VideoView(),
     268    fVideoConsumer = new VideoConsumer(TR("CodyCam"),
     269        ((VideoWindow*)fWindow)->VideoView(),
    265270        ((VideoWindow*)fWindow)->StatusLine(), NULL, 0);
    266271    if (!fVideoConsumer) {
    267         ErrorAlert("Cannot create a video window", B_ERROR, fWindow);
     272        ErrorAlert(TR("Cannot create a video window"), B_ERROR, fWindow);
    268273        return B_ERROR;
    269274    }
    270275
    271276    /* register the node */
    272277    status = fMediaRoster->RegisterNode(fVideoConsumer);
    273278    if (status != B_OK) {
    274         ErrorAlert("Cannot register the video window", status, fWindow);
     279        ErrorAlert(TR("Cannot register the video window"), status, fWindow);
    275280        return status;
    276281    }
    277282    fPort = fVideoConsumer->ControlPort();
    278283
    279284    /* find free producer output */
    280285    int32 cnt = 0;
    281     status = fMediaRoster->GetFreeOutputsFor(fProducerNode, &fProducerOut, 1,  &cnt,
    282         B_MEDIA_RAW_VIDEO);
     286    status = fMediaRoster->GetFreeOutputsFor(fProducerNode, &fProducerOut, 1,
     287        &cnt, B_MEDIA_RAW_VIDEO);
    283288    if (status != B_OK || cnt < 1) {
    284289        status = B_RESOURCE_UNAVAILABLE;
    285         ErrorAlert("Cannot find an available video stream", status, fWindow);
     290        ErrorAlert(TR("Cannot find an available video stream"), status,
     291            fWindow);
    286292        return status;
    287293    }
    288294
    289295    /* find free consumer input */
    290296    cnt = 0;
    291     status = fMediaRoster->GetFreeInputsFor(fVideoConsumer->Node(), &fConsumerIn, 1,
    292         &cnt, B_MEDIA_RAW_VIDEO);
     297    status = fMediaRoster->GetFreeInputsFor(fVideoConsumer->Node(),
     298        &fConsumerIn, 1, &cnt, B_MEDIA_RAW_VIDEO);
    293299    if (status != B_OK || cnt < 1) {
    294300        status = B_RESOURCE_UNAVAILABLE;
    295         ErrorAlert("Can't find an available connection to the video window", status, fWindow);
     301        ErrorAlert(TR("Can't find an available connection to the video window"),
     302            status, fWindow);
    296303        return status;
    297304    }
    298305
     
    307314    status = fMediaRoster->Connect(fProducerOut.source, fConsumerIn.destination,
    308315                &format, &fProducerOut, &fConsumerIn);
    309316    if (status != B_OK) {
    310         ErrorAlert("Cannot connect the video source to the video window", status);
     317        ErrorAlert(TR("Cannot connect the video source to the video window"),
     318            status);
    311319        return status;
    312320    }
    313321
     
    315323    /* set time sources */
    316324    status = fMediaRoster->SetTimeSourceFor(fProducerNode.node, fTimeSourceNode.node);
    317325    if (status != B_OK) {
    318         ErrorAlert("Cannot set the time source for the video source", status);
     326        ErrorAlert(TR("Cannot set the time source for the video source"),
     327            status);
    319328        return status;
    320329    }
    321330
    322331    status = fMediaRoster->SetTimeSourceFor(fVideoConsumer->ID(), fTimeSourceNode.node);
    323332    if (status != B_OK) {
    324         ErrorAlert("Cannot set the time source for the video window", status);
     333        ErrorAlert(TR("Cannot set the time source for the video window"),
     334            status);
    325335        return status;
    326336    }
    327337
     
    334344    bigtime_t initLatency = 0;
    335345    status = fMediaRoster->GetInitialLatencyFor(fProducerNode, &initLatency);
    336346    if (status < B_OK) {
    337         ErrorAlert("Error getting initial latency for the capture node", status);
     347        ErrorAlert(TR("Error getting initial latency for the capture node"),
     348            status);
    338349        return status;
    339350    }
    340351
     
    350361        status = fMediaRoster->StartTimeSource(fTimeSourceNode, real);
    351362        if (status != B_OK) {
    352363            timeSource->Release();
    353             ErrorAlert("Cannot start time source!", status);
     364            ErrorAlert(TR("Cannot start time source!"),
     365                status);
    354366            return status;
    355367        }
    356368        status = fMediaRoster->SeekTimeSource(fTimeSourceNode, 0, real);
    357369        if (status != B_OK) {
    358370            timeSource->Release();
    359             ErrorAlert("Cannot seek time source!", status);
     371            ErrorAlert(TR("Cannot seek time source!"), status);
    360372            return status;
    361373        }
    362374    }
     
    367379    /* start the nodes */
    368380    status = fMediaRoster->StartNode(fProducerNode, perf);
    369381    if (status != B_OK) {
    370         ErrorAlert("Cannot start the video source", status);
     382        ErrorAlert(TR("Cannot start the video source"), status);
    371383        return status;
    372384    }
    373385    status = fMediaRoster->StartNode(fVideoConsumer->Node(), perf);
    374386    if (status != B_OK) {
    375         ErrorAlert("Cannot start the video window", status);
     387        ErrorAlert(TR("Cannot start the video window"), status);
    376388        return status;
    377389    }
    378390
     
    389401
    390402    if (fVideoConsumer) {
    391403        /* stop */
    392         INFO("stopping nodes!\n");
     404        INFO(TR("stopping nodes!\n"));
    393405//      fMediaRoster->StopNode(fProducerNode, 0, true);
    394406        fMediaRoster->StopNode(fVideoConsumer->Node(), 0, true);
    395407
     
    398410            fConsumerIn.node.node, fConsumerIn.destination);
    399411
    400412        if (fProducerNode != media_node::null) {
    401             INFO("CodyCam releasing fProducerNode\n");
     413            INFO(TR("CodyCam releasing fProducerNode\n"));
    402414            fMediaRoster->ReleaseNode(fProducerNode);
    403415            fProducerNode = media_node::null;
    404416        }
     
    436448    BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "menu bar");
    437449
    438450    BMenuItem* menuItem;
    439     BMenu* menu = new BMenu("File");
     451    BMenu* menu = new BMenu(TR("File"));
    440452
    441     menuItem = new BMenuItem("Video settings", new BMessage(msg_video), 'P');
     453    menuItem = new BMenuItem(TR("Video settings"), new BMessage(msg_video),
     454        'P');
    442455    menuItem->SetTarget(be_app);
    443456    menu->AddItem(menuItem);
    444457
    445458    menu->AddSeparatorItem();
    446459
    447     menuItem = new BMenuItem("Start video", new BMessage(msg_start), 'A');
     460    menuItem = new BMenuItem(TR("Start video"), new BMessage(msg_start), 'A');
    448461    menuItem->SetTarget(be_app);
    449462    menu->AddItem(menuItem);
    450463
    451     menuItem = new BMenuItem("Stop video", new BMessage(msg_stop), 'O');
     464    menuItem = new BMenuItem(TR("Stop video"), new BMessage(msg_stop), 'O');
    452465    menuItem->SetTarget(be_app);
    453466    menu->AddItem(menuItem);
    454467
    455468    menu->AddSeparatorItem();
    456469
    457     menuItem = new BMenuItem("About Codycam" B_UTF8_ELLIPSIS,
     470    menuItem = new BMenuItem(TR("About Codycam" B_UTF8_ELLIPSIS),
    458471        new BMessage(msg_about), 'B');
    459472    menuItem->SetTarget(be_app);
    460473    menu->AddItem(menuItem);
    461474
    462475    menu->AddSeparatorItem();
    463476
    464     menuItem = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q');
     477    menuItem = new BMenuItem(TR("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q');
    465478    menuItem->SetTarget(be_app);
    466479    menu->AddItem(menuItem);
    467480
    468481    menuBar->AddItem(menu);
    469482
    470483    /* give it a gray background view */
    471     fView = new BView("Background View", B_WILL_DRAW);
     484    fView = new BView(TR("Background View"), B_WILL_DRAW);
    472485    fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    473486
    474487    /* add some controls */
     
    508521        case msg_filename:
    509522            if (control != NULL) {
    510523                strncpy(fFtpInfo.fileNameText, ((BTextControl*)control)->Text(), 63);
    511                 FTPINFO("file is '%s'\n", fFtpInfo.fileNameText);
     524                FTPINFO(TR("file is '%s'\n"), fFtpInfo.fileNameText);
    512525            }
    513526            break;
    514527
    515528        case msg_rate_15s:
    516             FTPINFO("fifteen seconds\n");
     529            FTPINFO(TR("fifteen seconds\n"));
    517530            fFtpInfo.rate = (bigtime_t)(15 * 1000000);
    518531            break;
    519532
    520533        case msg_rate_30s:
    521             FTPINFO("thirty seconds\n");
     534            FTPINFO(TR("thirty seconds\n"));
    522535            fFtpInfo.rate = (bigtime_t)(30 * 1000000);
    523536            break;
    524537
    525538        case msg_rate_1m:
    526             FTPINFO("one minute\n");
     539            FTPINFO(TR("one minute\n"));
    527540            fFtpInfo.rate = (bigtime_t)(1 * 60 * 1000000);
    528541            break;
    529542
    530543        case msg_rate_5m:
    531             FTPINFO("five minute\n");
     544            FTPINFO(TR("five minute\n"));
    532545            fFtpInfo.rate = (bigtime_t)(5 * 60 * 1000000);
    533546            break;
    534547
    535548        case msg_rate_10m:
    536             FTPINFO("ten minute\n");
     549            FTPINFO(TR("ten minute\n"));
    537550            fFtpInfo.rate = (bigtime_t)(10 * 60 * 1000000);
    538551            break;
    539552
    540553        case msg_rate_15m:
    541             FTPINFO("fifteen minute\n");
     554            FTPINFO(TR("fifteen minute\n"));
    542555            fFtpInfo.rate = (bigtime_t)(15 * 60 * 1000000);
    543556            break;
    544557
    545558        case msg_rate_30m:
    546             FTPINFO("thirty minute\n");
     559            FTPINFO(TR("thirty minute\n"));
    547560            fFtpInfo.rate = (bigtime_t)(30 * 60 * 1000000);
    548561            break;
    549562
    550563        case msg_rate_1h:
    551             FTPINFO("one hour\n");
     564            FTPINFO(TR("one hour\n"));
    552565            fFtpInfo.rate = (bigtime_t)(60LL * 60LL * 1000000LL);
    553566            break;
    554567
    555568        case msg_rate_2h:
    556             FTPINFO("two hour\n");
     569            FTPINFO(TR("two hour\n"));
    557570            fFtpInfo.rate = (bigtime_t)(2LL * 60LL * 60LL * 1000000LL);
    558571            break;
    559572
    560573        case msg_rate_4h:
    561             FTPINFO("four hour\n");
     574            FTPINFO(TR("four hour\n"));
    562575            fFtpInfo.rate = (bigtime_t)(4LL * 60LL * 60LL * 1000000LL);
    563576            break;
    564577
    565578        case msg_rate_8h:
    566             FTPINFO("eight hour\n");
     579            FTPINFO(TR("eight hour\n"));
    567580            fFtpInfo.rate = (bigtime_t)(8LL * 60LL * 60LL * 1000000LL);
    568581            break;
    569582
    570583        case msg_rate_24h:
    571             FTPINFO("24 hour\n");
     584            FTPINFO(TR("24 hour\n"));
    572585            fFtpInfo.rate = (bigtime_t)(24LL * 60LL * 60LL * 1000000LL);
    573586            break;
    574587
    575588        case msg_rate_never:
    576             FTPINFO("never\n");
     589            FTPINFO(TR("never\n"));
    577590            fFtpInfo.rate = (bigtime_t)(B_INFINITE_TIMEOUT);
    578591            break;
    579592
     
    584597
    585598        case msg_upl_client:
    586599            message->FindInt32("client", &(fFtpInfo.uploadClient));
    587             FTPINFO("upl client = %ld\n", fFtpInfo.uploadClient);
     600            FTPINFO(TR("upl client = %ld\n"), fFtpInfo.uploadClient);
    588601            _UploadClientChanged();
    589602            break;
    590603
    591604        case msg_server:
    592605            if (control != NULL) {
    593606                strncpy(fFtpInfo.serverText, ((BTextControl*)control)->Text(), 64);
    594                 FTPINFO("server = '%s'\n", fFtpInfo.serverText);
     607                FTPINFO(TR("server = '%s'\n"), fFtpInfo.serverText);
    595608            }
    596609            break;
    597610
    598611        case msg_login:
    599612            if (control != NULL) {
    600613                strncpy(fFtpInfo.loginText, ((BTextControl*)control)->Text(), 64);
    601                 FTPINFO("login = '%s'\n", fFtpInfo.loginText);
     614                FTPINFO(TR("login = '%s'\n"), fFtpInfo.loginText);
    602615            }
    603616            break;
    604617
    605618        case msg_password:
    606619            if (control != NULL) {
    607620                strncpy(fFtpInfo.passwordText, ((BTextControl*)control)->Text(), 64);
    608                 FTPINFO("password = '%s'\n", fFtpInfo.passwordText);
     621                FTPINFO(TR("password = '%s'\n"), fFtpInfo.passwordText);
    609622            }
    610623            break;
    611624
    612625        case msg_directory:
    613626            if (control != NULL) {
    614627                strncpy(fFtpInfo.directoryText, ((BTextControl*)control)->Text(), 64);
    615                 FTPINFO("directory = '%s'\n", fFtpInfo.directoryText);
     628                FTPINFO(TR("directory = '%s'\n"), fFtpInfo.directoryText);
    616629            }
    617630            break;
    618631
     
    620633            if (control != NULL) {
    621634                fFtpInfo.passiveFtp = ((BCheckBox*)control)->Value();
    622635                if (fFtpInfo.passiveFtp)
    623                     FTPINFO("using passive ftp\n");
     636                    FTPINFO(TR("using passive ftp\n"));
    624637            }
    625638            break;
    626639
     
    658671    fVideoView->SetExplicitMaxSize(BSize(VIDEO_SIZE_X, VIDEO_SIZE_Y));
    659672
    660673    // Capture controls
    661     fCaptureSetupBox = new BBox("Capture Controls", B_WILL_DRAW);
    662     fCaptureSetupBox->SetLabel("Capture controls");
     674    fCaptureSetupBox = new BBox(TR("Capture Controls"), B_WILL_DRAW);
     675    fCaptureSetupBox->SetLabel(TR("Capture controls"));
    663676
    664677    BGridLayout *controlsLayout = new BGridLayout(kXBuffer, 0);
    665678    controlsLayout->SetInsets(10, 15, 5, 5);
    666679    fCaptureSetupBox->SetLayout(controlsLayout);
    667680
    668     fFileName = new BTextControl("File Name", "File name:",
     681    fFileName = new BTextControl(TR("File Name"), TR("File name:"),
    669682        fFilenameSetting->Value(), new BMessage(msg_filename));
    670683    fFileName->SetTarget(BMessenger(NULL, this));
    671684
    672     fImageFormatMenu = new BPopUpMenu("Image Format Menu");
     685    fImageFormatMenu = new BPopUpMenu(TR("Image Format Menu"));
    673686    AddTranslationItems(fImageFormatMenu, B_TRANSLATOR_BITMAP);
    674687    fImageFormatMenu->SetTargetForItems(this);
    675688
     
    682695    else
    683696        fImageFormatMenu->ItemAt(0)->SetMarked(true);
    684697
    685     fImageFormatSelector = new BMenuField("Format", "Format:",
     698    fImageFormatSelector = new BMenuField("Format", TR("Format:"),
    686699        fImageFormatMenu, NULL);
    687700
    688     fCaptureRateMenu = new BPopUpMenu("Capture Rate Menu");
    689     fCaptureRateMenu->AddItem(new BMenuItem("Every 15 seconds",
     701    fCaptureRateMenu = new BPopUpMenu(TR("Capture Rate Menu"));
     702    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[0],
    690703        new BMessage(msg_rate_15s)));
    691     fCaptureRateMenu->AddItem(new BMenuItem("Every 30 seconds",
     704    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[1],
    692705        new BMessage(msg_rate_30s)));
    693     fCaptureRateMenu->AddItem(new BMenuItem("Every minute",
     706    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[2],
    694707        new BMessage(msg_rate_1m)));
    695     fCaptureRateMenu->AddItem(new BMenuItem("Every 5 minutes",
     708    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[3],
    696709        new BMessage(msg_rate_5m)));
    697     fCaptureRateMenu->AddItem(new BMenuItem("Every 10 minutes",
     710    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[4],
    698711        new BMessage(msg_rate_10m)));
    699     fCaptureRateMenu->AddItem(new BMenuItem("Every 15 minutes",
     712    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[5],
    700713        new BMessage(msg_rate_15m)));
    701     fCaptureRateMenu->AddItem(new BMenuItem("Every 30 minutes",
     714    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[6],
    702715        new BMessage(msg_rate_30m)));
    703     fCaptureRateMenu->AddItem(new BMenuItem("Every hour",
     716    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[7],
    704717        new BMessage(msg_rate_1h)));
    705     fCaptureRateMenu->AddItem(new BMenuItem("Every 2 hours",
     718    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[8],
    706719        new BMessage(msg_rate_2h)));
    707     fCaptureRateMenu->AddItem(new BMenuItem("Every 4 hours",
     720    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[9],
    708721        new BMessage(msg_rate_4h)));
    709     fCaptureRateMenu->AddItem(new BMenuItem("Every 8 hours",
     722    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[10],
    710723        new BMessage(msg_rate_8h)));
    711     fCaptureRateMenu->AddItem(new BMenuItem("Every 24 hours",
     724    fCaptureRateMenu->AddItem(new BMenuItem(kCaptureRate[11],
    712725        new BMessage(msg_rate_24h)));
    713     fCaptureRateMenu->AddItem(new BMenuItem("Never",
     726    fCaptureRateMenu->AddItem(new BMenuItem(KCaptureRate[12],
    714727        new BMessage(msg_rate_never)));
    715728    fCaptureRateMenu->SetTargetForItems(this);
    716729    fCaptureRateMenu->FindItem(fCaptureRateSetting->Value())->SetMarked(true);
    717     fCaptureRateSelector = new BMenuField("Rate", "Rate:",
     730    fCaptureRateSelector = new BMenuField(TR("Rate"), TR("Rate:"),
    718731        fCaptureRateMenu, NULL);
    719732
    720733    controlsLayout->AddItem(fFileName->CreateLabelLayoutItem(), 0, 0);
     
    726739    controlsLayout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, 3, 2);
    727740
    728741    // FTP setup box
    729     fFtpSetupBox = new BBox("FTP Setup", B_WILL_DRAW);
     742    fFtpSetupBox = new BBox(TR("FTP Setup"), B_WILL_DRAW);
    730743
    731     fUploadClientMenu = new BPopUpMenu("Send to" B_UTF8_ELLIPSIS);
     744    fUploadClientMenu = new BPopUpMenu(TR("Send to" B_UTF8_ELLIPSIS));
    732745    for (int i = 0; kUploadClient[i]; i++) {
    733746        BMessage *m = new BMessage(msg_upl_client);
    734747        m->AddInt32("client", i);
     
    739752    fUploadClientSelector = new BMenuField("UploadClient", NULL,
    740753        fUploadClientMenu, NULL);
    741754
    742     fFtpSetupBox->SetLabel("Output");
     755    fFtpSetupBox->SetLabel(TR("Output"));
    743756    // this doesn't work with the layout manager
    744757    // fFtpSetupBox->SetLabel(fUploadClientSelector);
    745     fUploadClientSelector->SetLabel("Type:");
     758    fUploadClientSelector->SetLabel(TR("Type:"));
    746759
    747760    BGridLayout *ftpLayout = new BGridLayout(kXBuffer, 0);
    748761    ftpLayout->SetInsets(10, 15, 5, 5);
    749762    fFtpSetupBox->SetLayout(ftpLayout);
    750763
    751     fServerName = new BTextControl("Server", "Server:",
     764    fServerName = new BTextControl(TR("Server"), TR("Server:"),
    752765        fServerSetting->Value(), new BMessage(msg_server));
    753766    fServerName->SetTarget(this);
    754767
    755     fLoginId = new BTextControl("Login", "Login:",
     768    fLoginId = new BTextControl(TR("Login"), TR("Login:"),
    756769        fLoginSetting->Value(), new BMessage(msg_login));
    757770    fLoginId->SetTarget(this);
    758771
    759     fPassword = new BTextControl("Password", "Password:",
     772    fPassword = new BTextControl(TR("Password"), TR("Password:"),
    760773        fPasswordSetting->Value(), new BMessage(msg_password));
    761774    fPassword->SetTarget(this);
    762775    fPassword->TextView()->HideTyping(true);
    763776    // BeOS HideTyping() seems broken, it empties the text
    764777    fPassword->SetText(fPasswordSetting->Value());
    765778
    766     fDirectory = new BTextControl("Directory", "Directory:",
     779    fDirectory = new BTextControl(TR("Directory"), TR("Directory:"),
    767780        fDirectorySetting->Value(), new BMessage(msg_directory));
    768781    fDirectory->SetTarget(this);
    769782
    770     fPassiveFtp = new BCheckBox("Passive FTP", "Passive FTP",
     783    fPassiveFtp = new BCheckBox(TR("Passive FTP"), TR("Passive FTP"),
    771784        new BMessage(msg_passiveftp));
    772785    fPassiveFtp->SetTarget(this);
    773786    fPassiveFtp->SetValue(fPassiveFtpSetting->Value());
     
    784797    ftpLayout->AddItem(fDirectory->CreateTextViewLayoutItem(), 1, 4);
    785798    ftpLayout->AddView(fPassiveFtp, 0, 5, 2);
    786799
    787     fStatusLine = new BStringView("Status Line", "Waiting" B_UTF8_ELLIPSIS);
     800    fStatusLine = new BStringView(TR("Status Line"), TR("Waiting" B_UTF8_ELLIPSIS));
    788801
    789802    BGroupLayout *groupLayout = new BGroupLayout(B_VERTICAL);
    790803    groupLayout->SetInsets(kXBuffer, kYBuffer, kXBuffer, kYBuffer);
     
    834847    fSettings = new Settings(filename, dirname);
    835848
    836849    fServerSetting = new StringValueSetting("Server", "ftp.my.server",
    837         "server address expected", "");
     850        TR("server address expected"), "");
    838851    fLoginSetting = new StringValueSetting("Login", "loginID",
    839         "login ID expected", "");
    840     fPasswordSetting = new StringValueSetting("Password", "password",
    841         "password expected", "");
     852        TR("login ID expected"), "");
     853    fPasswordSetting = new StringValueSetting("Password", TR("password"),
     854        TR("password expected"), "");
    842855    fDirectorySetting = new StringValueSetting("Directory", "web/images",
    843         "destination directory expected", "");
     856        TR("destination directory expected"), "");
    844857    fPassiveFtpSetting = new BooleanValueSetting("PassiveFtp", 1);
    845858    fFilenameSetting = new StringValueSetting("StillImageFilename",
    846         "codycam.jpg", "still image filename expected", "");
     859        "codycam.jpg", TR("still image filename expected"), "");
    847860    fImageFormatSettings = new StringValueSetting("ImageFileFormat",
    848         "JPEG image", "image file format expected", "");
     861        TR("JPEG image"), TR("image file format expected"), "");
    849862    fCaptureRateSetting = new EnumeratedStringValueSetting("CaptureRate",
    850         "Every 5 minutes", kCaptureRate, "capture rate expected",
    851         "unrecognized capture rate specified");
     863        TR("Every 5 minutes"), kCaptureRate, TR("capture rate expected"),
     864        TR("unrecognized capture rate specified"));
    852865    fUploadClientSetting = new EnumeratedStringValueSetting("UploadClient",
    853         "FTP", kUploadClient, "upload client name expected",
    854         "unrecognized upload client specified");
     866        TR("FTP"), kUploadClient, TR("upload client name expected"),
     867        TR("unrecognized upload client specified"));
    855868
    856869    fSettings->Add(fServerSetting);
    857870    fSettings->Add(fLoginSetting);
     
    900913//  #pragma mark -
    901914
    902915
    903 ControlWindow::ControlWindow(const BRect& frame, BView* controls, media_node node)
    904     : BWindow(frame, "Video settings", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
     916ControlWindow::ControlWindow(const BRect& frame, BView* controls,
     917    media_node node)
     918    : BWindow(frame, TR("Video settings"), B_TITLED_WINDOW,
     919        B_ASYNCHRONOUS_CONTROLS)
    905920{
    906921    fView = controls;
    907922    fNode = node;
  • src/apps/codycam/SftpClient.h

     
    55#include <stdio.h>
    66#include <string>
    77
     8#include <Catalog.h>
    89#include <File.h>
     10#include <Locale.h>
     11
    912#include "SpawningUploadClient.h"
    1013
     14#undef TR_CONTEXT
     15#define TR_CONTEXT "SftpClient"
     16
    1117using std::string;
    1218
    1319
     
    3440        void SetPassive(bool on);
    3541   
    3642    protected:
     43    private:
     44        const char *GetReplyText() {return TR("reply: '%s'\n");};
     45        const char *GetReadText() {return TR("read: %d\n");};
     46        const char *GetLReadText() {return TR("read: %ld\n");};
    3747
    3848};
    3949
  • src/apps/codycam/VideoConsumer.cpp

     
    1616#include <Application.h>
    1717#include <Buffer.h>
    1818#include <BufferGroup.h>
     19#include <Catalog.h>
     20#include <Locale.h>
    1921#include <MediaRoster.h>
    2022#include <NodeInfo.h>
    2123#include <scheduler.h>
     
    3234#define PROGRESS    printf
    3335#define LOOP        printf
    3436
     37#undef TR_CONTEXT
     38#define TR_CONTEXT "VideoConsumer"
     39
    3540static status_t SetFileType(BFile* file,  int32 translator, uint32 type);
    3641
    3742const media_raw_video_format vid_format = {29.97, 1, 0, 239, B_VIDEO_TOP_LEFT_RIGHT,
    3843    1, 1, {B_RGB16, 320, 240, 320 * 4, 0, 0}};
    3944
    4045
    41 VideoConsumer::VideoConsumer(const char* name, BView* view, BStringView* statusLine,
    42     BMediaAddOn* addon, const uint32 internalId)
    43     : BMediaNode(name), BMediaEventLooper(), BBufferConsumer(B_MEDIA_RAW_VIDEO),
     46VideoConsumer::VideoConsumer(const char* name,
     47    BView* view, BStringView* statusLine, BMediaAddOn* addon,
     48    const uint32 internalId)
     49    : BMediaNode(name), BMediaEventLooper(),
     50    BBufferConsumer(B_MEDIA_RAW_VIDEO),
    4451    fStatusLine(statusLine),
    4552    fInternalID(internalId),
    4653    fAddOn(addon),
     
    8693    Quit();
    8794
    8895    if (fWindow) {
    89         printf("Locking the window\n");
     96        printf(TR("Locking the window\n"));
    9097        if (fWindow->Lock()) {
    91             printf("Closing the window\n");
     98            printf(TR("Closing the window\n"));
    9299            fWindow->Close();
    93100            fWindow = 0;
    94101        }
     
    179186status_t
    180187VideoConsumer::RequestCompleted(const media_request_info& info)
    181188{
    182     FUNCTION("VideoConsumer::RequestCompleted\n");
     189    const char *classfunc = "VideoConsumer::RequestCompleted";
     190    FUNCTION("%s\n", classfunc);
    183191    switch (info.what) {
    184192        case media_request_info::B_SET_OUTPUT_BUFFERS_FOR:
    185193            if (info.status != B_OK)
    186                     ERROR("VideoConsumer::RequestCompleted: Not using our buffers!\n");
     194                    ERROR(TR("%s: Not using our buffers!\n"), classfunc);
    187195            break;
    188196
    189197        default:
    190             ERROR("VideoConsumer::RequestCompleted: Invalid argument\n");
     198            ERROR(TR("%s: Invalid argument\n"), classfunc);
    191199            break;
    192200    }
    193201    return B_OK;
     
    197205status_t
    198206VideoConsumer::HandleMessage(int32 message, const void* data, size_t size)
    199207{
    200     //FUNCTION("VideoConsumer::HandleMessage\n");
     208    const char *classfunc = "VideoConsumer::HandleMessage";
     209    //FUNCTION("%s\n", classfunc);
    201210    ftp_msg_info* info = (ftp_msg_info*)data;
    202211    status_t status = B_OK;
    203212
    204213    switch (message) {
    205214        case FTP_INFO:
    206             PROGRESS("VideoConsumer::HandleMessage - FTP_INFO message\n");
     215            PROGRESS(TR("%s - FTP_INFO message\n"), classfunc);
    207216            fRate = info->rate;
    208217            fImageFormat = info->imageFormat;
    209218            fTranslator = info->translator;
     
    234243void
    235244VideoConsumer::BufferReceived(BBuffer* buffer)
    236245{
    237     LOOP("VideoConsumer::Buffer #%ld received, start_time %Ld\n", buffer->ID(), buffer->Header()->start_time);
     246    const char *classfunc = "VideoConsumer::BufferReceived";
     247    LOOP((TR("%s #%ld received, start_time %Ld\n"), classfunc),
     248        buffer->ID(), buffer->Header()->start_time);
    238249
    239250    if (RunState() == B_STOPPED) {
    240251        buffer->Recycle();
    241252        return;
    242253    }
    243254
    244     media_timed_event event(buffer->Header()->start_time, BTimedEventQueue::B_HANDLE_BUFFER,
     255    media_timed_event event(buffer->Header()->start_time,
     256        BTimedEventQueue::B_HANDLE_BUFFER,
    245257        buffer, BTimedEventQueue::B_RECYCLE_BUFFER);
    246258    EventQueue()->AddEvent(event);
    247259}
    248260
    249261
    250262void
    251 VideoConsumer::ProducerDataStatus(const media_destination& forWhom, int32 status,
    252     bigtime_t atMediaTime)
     263VideoConsumer::ProducerDataStatus(const media_destination& forWhom,
     264    int32 status, bigtime_t atMediaTime)
    253265{
    254266    FUNCTION("VideoConsumer::ProducerDataStatus\n");
    255267
     
    261273status_t
    262274VideoConsumer::CreateBuffers(const media_format& withFormat)
    263275{
    264     FUNCTION("VideoConsumer::CreateBuffers\n");
     276    const char *classfunc = "VideoConsumer::CreateBuffers";
     277    FUNCTION("%s\n", classfunc);
    265278
    266279    DeleteBuffers();   
    267280        // delete any old buffers
     
    272285    uint32 xSize = withFormat.u.raw_video.display.line_width;
    273286    uint32 ySize = withFormat.u.raw_video.display.line_count;   
    274287    color_space colorspace = withFormat.u.raw_video.display.format;
    275     PROGRESS("VideoConsumer::CreateBuffers - Colorspace = %d\n", colorspace);
     288    PROGRESS((TR("%s - Colorspace = %d\n"), classfunc), colorspace);
    276289
    277290    fBuffers = new BBufferGroup();
    278291    status = fBuffers->InitCheck();
    279292    if (status != B_OK) {
    280         ERROR("VideoConsumer::CreateBuffers - ERROR CREATING BUFFER GROUP\n");
     293        ERROR(TR("%s - ERROR CREATING BUFFER GROUP\n"), classfunc);
    281294        return status;
    282295    }
    283296    // and attach the  bitmaps to the buffer group
     
    287300        if (fBitmap[j]->IsValid()) {                       
    288301            buffer_clone_info info;
    289302            if ((info.area = area_for(fBitmap[j]->Bits())) == B_ERROR)
    290                 ERROR("VideoConsumer::CreateBuffers - ERROR IN AREA_FOR\n");
     303                ERROR(TR("%s - ERROR IN AREA_FOR\n"), classfunc);
    291304            info.offset = 0;
    292305            info.size = (size_t)fBitmap[j]->BitsLength();
    293306            info.flags = j;
    294307            info.buffer = 0;
    295308
    296309            if ((status = fBuffers->AddBuffer(info)) != B_OK) {
    297                 ERROR("VideoConsumer::CreateBuffers - ERROR ADDING BUFFER TO GROUP\n");
     310                ERROR(TR("%s - ERROR ADDING BUFFER TO GROUP\n"), classfunc);
    298311                return status;
    299312            }
    300313            else
    301                 PROGRESS("VideoConsumer::CreateBuffers - SUCCESSFUL ADD BUFFER TO GROUP\n");
     314                PROGRESS(TR("%s - SUCCESSFUL ADD BUFFER TO GROUP\n"), classfunc);
    302315        } else {
    303             ERROR("VideoConsumer::CreateBuffers - ERROR CREATING VIDEO RING BUFFER: %08lx\n",
    304                 status);
     316            ERROR((TR("%s - ERROR CREATING VIDEO RING BUFFER: "
     317                "%08lx\n"), classfunc), status);
    305318            return B_ERROR;
    306319        }
    307320    }
     
    314327        for (int j = 0; j < 3; j++)
    315328            if (buffList[j] != NULL) {
    316329                fBufferMap[j] = (uint32)buffList[j];
    317                 PROGRESS(" j = %d buffer = %08lx\n", j, fBufferMap[j]);
     330                PROGRESS(TR(" j = %d buffer = %08lx\n"), j, fBufferMap[j]);
    318331            } else {
    319                 ERROR("VideoConsumer::CreateBuffers ERROR MAPPING RING BUFFER\n");
     332                ERROR(TR("%s ERROR MAPPING RING BUFFER\n"), classfunc);
    320333                return B_ERROR;
    321334            }
    322335    else
    323         ERROR("VideoConsumer::CreateBuffers ERROR IN GET BUFFER LIST\n");
     336        ERROR(TR("%s ERROR IN GET BUFFER LIST\n"), classfunc);
    324337
    325     fFtpBitmap = new BBitmap(BRect(0, 0, xSize - 1, ySize - 1), B_RGB32, false, false);
     338    fFtpBitmap = new BBitmap(BRect(0, 0, xSize - 1, ySize - 1), B_RGB32,
     339        false, false);
    326340
    327     FUNCTION("VideoConsumer::CreateBuffers - EXIT\n");
     341    FUNCTION(TR("%s - EXIT\n"), classfunc);
    328342    return status;
    329343}
    330344
     
    332346void
    333347VideoConsumer::DeleteBuffers()
    334348{
    335     FUNCTION("VideoConsumer::DeleteBuffers\n");
     349    const char *classfunc = "VideoConsumer::DeleteBuffers";
     350    FUNCTION("%s\n", classfunc);
    336351
    337352    if (fBuffers) {
    338353        delete fBuffers;
     
    344359                fBitmap[j] = NULL;
    345360            }
    346361    }
    347     FUNCTION("VideoConsumer::DeleteBuffers - EXIT\n");
     362    FUNCTION(TR("%s - EXIT\n"), classfunc);
    348363}
    349364
    350365
     
    352367VideoConsumer::Connected(const media_source& producer, const media_destination& where,
    353368    const media_format& withFormat, media_input* outInput)
    354369{
    355     FUNCTION("VideoConsumer::Connected\n");
     370    const char *classfunc = "VideoConsumer::Connected";
     371    FUNCTION("%s\n", classfunc);
    356372   
    357373    fIn.source = producer;
    358374    fIn.format = withFormat;
    359375    fIn.node = Node();
    360     sprintf(fIn.name, "Video Consumer");
     376    sprintf(fIn.name, TR("Video Consumer"));
    361377    *outInput = fIn;
    362378
    363379    uint32 userData = 0;
     
    366382        BBufferConsumer::SetOutputBuffersFor(producer, fDestination,
    367383            fBuffers, (void *)&userData, &changeTag, true);
    368384    else {
    369         ERROR("VideoConsumer::Connected - COULDN'T CREATE BUFFERS\n");
     385        ERROR(TR("%s - COULDN'T CREATE BUFFERS\n"), classfunc);
    370386        return B_ERROR;
    371387    }
    372388
    373389    fConnectionActive = true;
    374390
    375     FUNCTION("VideoConsumer::Connected - EXIT\n");
     391    FUNCTION(TR("%s - EXIT\n"), classfunc);
    376392    return B_OK;
    377393}
    378394
     
    395411status_t
    396412VideoConsumer::AcceptFormat(const media_destination& dest, media_format* format)
    397413{
    398     FUNCTION("VideoConsumer::AcceptFormat\n");
     414    const char *classfunc = "VideoConsumer::AcceptFormat";
     415    FUNCTION("%s\n", classfunc);
    399416   
    400417    if (dest != fIn.destination) {
    401         ERROR("VideoConsumer::AcceptFormat - BAD DESTINATION\n");
     418        ERROR(TR("%s - BAD DESTINATION\n"), classfunc);
    402419        return B_MEDIA_BAD_DESTINATION;
    403420    }
    404421
     
    406423        format->type = B_MEDIA_RAW_VIDEO;
    407424   
    408425    if (format->type != B_MEDIA_RAW_VIDEO) {
    409         ERROR("VideoConsumer::AcceptFormat - BAD FORMAT\n");
     426        ERROR(TR("%s - BAD FORMAT\n"), classfunc);
    410427        return B_MEDIA_BAD_FORMAT;
    411428    }
    412429
     
    416433        && format->u.raw_video.display.format != B_GRAY8
    417434        &&         
    418435        format->u.raw_video.display.format != media_raw_video_format::wildcard.display.format) {
    419         ERROR("AcceptFormat - not a format we know about!\n");
     436        ERROR(TR("AcceptFormat - not a format we know about!\n"));
    420437        return B_MEDIA_BAD_FORMAT;
    421438    }
    422439
     
    426443
    427444    char formatString[256];     
    428445    string_for_format(*format, formatString, 256);
    429     FUNCTION("VideoConsumer::AcceptFormat: %s\n", formatString);
     446    FUNCTION("%s: %s\n", classfunc, formatString);
    430447
    431448    return B_OK;
    432449}
     
    435452status_t
    436453VideoConsumer::GetNextInput(int32* cookie, media_input* outInput)
    437454{
    438     FUNCTION("VideoConsumer::GetNextInput\n");
     455    const char *classfunc = "VideoConsumer::GetNextInput";
     456    FUNCTION("%s\n", classfunc);
    439457
    440458    // custom build a destination for this connection
    441459    // put connection number in id
     
    443461    if (*cookie < 1) {
    444462        fIn.node = Node();
    445463        fIn.destination.id = *cookie;
    446         sprintf(fIn.name, "Video Consumer");
     464        sprintf(fIn.name, TR("Video Consumer"));
    447465        *outInput = fIn;
    448466        (*cookie)++;
    449467        return B_OK;
    450468    } else {
    451         ERROR("VideoConsumer::GetNextInput - - BAD INDEX\n");
     469        ERROR(TR("%s - - BAD INDEX\n"), classfunc);
    452470        return B_MEDIA_BAD_DESTINATION;
    453471    }
    454472}
     
    497515VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness,
    498516    bool realTimeEvent)
    499517{
    500     LOOP("VideoConsumer::HandleEvent\n");
     518    const char *classfunc = "VideoConsumer::HandleEvent";
     519    LOOP("%s\n", classfunc);
    501520   
    502521    BBuffer* buffer;
    503522
    504523    switch (event->type) {
    505524        case BTimedEventQueue::B_START:
    506             PROGRESS("VideoConsumer::HandleEvent - START\n");
     525            PROGRESS(TR("%s - START\n"), classfunc);
    507526            break;
    508527
    509528        case BTimedEventQueue::B_STOP:
    510             PROGRESS("VideoConsumer::HandleEvent - STOP\n");
     529            PROGRESS(TR("%s - STOP\n"), classfunc);
    511530            EventQueue()->FlushEvents(event->event_time, BTimedEventQueue::B_ALWAYS,
    512531                true, BTimedEventQueue::B_HANDLE_BUFFER);
    513532            break;
    514533
    515534        case BTimedEventQueue::B_USER_EVENT:
    516             PROGRESS("VideoConsumer::HandleEvent - USER EVENT\n");
     535            PROGRESS(TR("%s - USER EVENT\n"), classfunc);
    517536            if (RunState() == B_STARTED) {
    518537                fTimeToFtp = true;
    519                 PROGRESS("Pushing user event for %.4f, time now %.4f\n",
     538                PROGRESS(TR("Pushing user event for %.4f, time now %.4f\n"),
    520539                    (event->event_time + fRate) / M1, event->event_time/M1);
    521540                media_timed_event newEvent(event->event_time + fRate,
    522541                    BTimedEventQueue::B_USER_EVENT);
     
    526545
    527546        case BTimedEventQueue::B_HANDLE_BUFFER:
    528547        {
    529             LOOP("VideoConsumer::HandleEvent - HANDLE BUFFER\n");
     548            LOOP(TR("%s - HANDLE BUFFER\n"), classfunc);
    530549            buffer = (BBuffer *)event->pointer;
    531550            if (RunState() == B_STARTED && fConnectionActive) {
    532551                // see if this is one of our buffers
     
    545564                }
    546565                           
    547566                if (fFtpComplete && fTimeToFtp) {
    548                     PROGRESS("VidConsumer::HandleEvent - SPAWNING FTP THREAD\n");
     567                    PROGRESS(TR("%s - SPAWNING FTP THREAD\n"), classfunc);
    549568                    fTimeToFtp = false;
    550569                    fFtpComplete = false;
    551570                    memcpy(fFtpBitmap->Bits(), buffer->Data(), fFtpBitmap->BitsLength());
     
    577596                    }
    578597                }
    579598                else
    580                     PROGRESS("VidConsumer::HandleEvent - DROPPED FRAME\n");
     599                    PROGRESS(TR("%s - DROPPED FRAME\n"), classfunc);
    581600                buffer->Recycle();
    582601            }
    583602            else
     
    586605        }
    587606
    588607        default:
    589             ERROR("VideoConsumer::HandleEvent - BAD EVENT\n");
     608            ERROR(TR("%s - BAD EVENT\n"), classfunc);
    590609            break;
    591610    }           
    592611}
     
    618637#if 0
    619638    // save a small version, too
    620639    BBitmap* b = new BBitmap(BRect(0,0,159,119), B_RGB32, true, false);
    621     BView* v = new BView(BRect(0,0,159,119), "SmallView 1", 0, B_WILL_DRAW);
     640    BView* v = new BView(BRect(0,0,159,119), TR("SmallView 1"), 0, B_WILL_DRAW);
    622641    b->AddChild(v);
    623642
    624643    b->Lock();
     
    639658void
    640659VideoConsumer::UpdateFtpStatus(const char* status)
    641660{
    642     printf("FTP STATUS: %s\n",status);
     661    printf(TR("FTP STATUS: %s\n"),status);
    643662    if (fView->Window()->Lock()) {
    644663        fStatusLine->SetText(status);
    645664        fView->Window()->Unlock();
     
    652671{
    653672    BFile* output;
    654673
    655     UpdateFtpStatus("Capturing Image" B_UTF8_ELLIPSIS);
     674    UpdateFtpStatus(TR("Capturing Image" B_UTF8_ELLIPSIS));
    656675
    657676    /* save a local copy of the image in the requested format */
    658677    output = new BFile();
     
    663682        if (err == B_OK) {
    664683            err = SetFileType(output, fTranslator, fImageFormat);
    665684            if (err != B_OK)
    666                 UpdateFtpStatus("Error setting type of output file");                           
     685                UpdateFtpStatus(TR("Error setting type of output file"));                           
    667686        }
    668687        else
    669             UpdateFtpStatus("Error writing output file");                           
     688            UpdateFtpStatus(TR("Error writing output file"));                           
    670689
    671690        input.DetachBitmap(&bitmap);
    672691        output->Unset();
    673692        delete output;
    674693        return B_OK;
    675694    } else {
    676         UpdateFtpStatus("Error creating output file");
     695        UpdateFtpStatus(TR("Error creating output file"));
    677696        return B_ERROR;
    678697    }                           
    679698}
     
    695714        case 2:
    696715            return B_OK;
    697716        default:
    698             fprintf(stderr, "invalid upload client %ld\n", fUploadClient);
     717            fprintf(stderr, TR("invalid upload client %ld\n"), fUploadClient);
    699718            return EINVAL;
    700719    }
    701720
    702721    ftp->SetPassive(fPassiveFtp);
    703722        // ftp the local file to our web site
    704723
    705     UpdateFtpStatus("Logging in" B_UTF8_ELLIPSIS);
     724    UpdateFtpStatus(TR("Logging in" B_UTF8_ELLIPSIS));
    706725    if (ftp->Connect((string)fServerText, (string)fLoginText, (string)fPasswordText)) {
    707726        // connect to server
    708         UpdateFtpStatus("Connected" B_UTF8_ELLIPSIS);
     727        UpdateFtpStatus(TR("Connected" B_UTF8_ELLIPSIS));
    709728
    710729        if (ftp->ChangeDir((string)fDirectoryText)) {
    711730            // cd to the desired directory
    712             UpdateFtpStatus("Transmitting" B_UTF8_ELLIPSIS);
     731            UpdateFtpStatus(TR("Transmitting" B_UTF8_ELLIPSIS));
    713732
    714733            if (ftp->PutFile((string)filename, (string)"temp")) {
    715734                // send the file to the server
     
    717736                ftp->Chmod((string)"temp", (string)"644");
    718737                // make it world readable
    719738
    720                 UpdateFtpStatus("Renaming" B_UTF8_ELLIPSIS);
     739                UpdateFtpStatus(TR("Renaming" B_UTF8_ELLIPSIS));
    721740
    722741                if (ftp->MoveFile((string)"temp", (string)filename)) {
    723742                    // change to the desired name
    724743                    uint32 time = real_time_clock();
    725744                    char s[80];
    726                     strcpy(s, "Last Capture: ");
     745                    strcpy(s, TR("Last Capture: "));
    727746                    strcat(s, ctime((const long*)&time));
    728747                    s[strlen(s) - 1] = 0;
    729748                    UpdateFtpStatus(s);
     
    731750                    return B_OK;
    732751                }
    733752                else
    734                     UpdateFtpStatus("Rename failed");
     753                    UpdateFtpStatus(TR("Rename failed"));
    735754            }
    736755            else
    737                 UpdateFtpStatus("File transmission failed");
     756                UpdateFtpStatus(TR("File transmission failed"));
    738757        }
    739758        else
    740             UpdateFtpStatus("Couldn't find requested directory on server");
     759            UpdateFtpStatus(TR("Couldn't find requested directory on server"));
    741760    }
    742761    else
    743         UpdateFtpStatus("Server login failed");
     762        UpdateFtpStatus(TR("Server login failed"));
    744763
    745764    delete ftp;
    746765    return B_ERROR;
  • src/apps/codycam/CodyCam.h

     
    99
    1010#include <Application.h>
    1111#include <Box.h>
     12#include <Catalog.h>
    1213#include <CheckBox.h>
     14#include <Locale.h>
    1315#include <Menu.h>
    1416#include <MenuField.h>
    1517#include <StringView.h>
     
    1921
    2022class BMediaRoster;
    2123
     24#undef TR_CONTEXT
     25#define TR_CONTEXT "CodyCam"
    2226
    2327enum {
    2428    msg_filename    = 'file',
     
    5963
    6064
    6165const char* kCaptureRate[] = {
    62     "Every 15 seconds",
    63     "Every 30 seconds",
    64     "Every minute",
    65     "Every 5 minutes",
    66     "Every 10 minutes",
    67     "Every 15 minutes",
    68     "Every 30 minutes",
    69     "Every hour",
    70     "Every 2 hours",
    71     "Every 4 hours",
    72     "Every 8 hours",
    73     "Every 24 hours",
    74     "Never",   
     66    TR("Every 15 seconds"),
     67    TR("Every 30 seconds"),
     68    TR("Every minute"),
     69    TR("Every 5 minutes"),
     70    TR("Every 10 minutes"),
     71    TR("Every 15 minutes"),
     72    TR("Every 30 minutes"),
     73    TR("Every hour"),
     74    TR("Every 2 hours"),
     75    TR("Every 4 hours"),
     76    TR("Every 8 hours"),
     77    TR("Every 24 hours"),
     78    TR("Never"),   
    7579    0
    7680};
    7781
    7882
    7983const char* kUploadClient[] = {
    80     "FTP",
    81     "SFTP",
    82     "Local",
     84    TR("FTP"),
     85    TR("SFTP"),
     86    TR("Local"),
    8387    0
    8488};
    8589
     
    106110            BWindow*        fWindow;
    107111            port_id         fPort;
    108112            BWindow*        fVideoControlWindow;
     113            BCatalog        fAppCatalog;
    109114};
    110115
    111116
  • src/apps/codycam/FtpClient.cpp

     
    11#include "FtpClient.h"
    22
     3#include <Catalog.h>
     4#include <Locale.h>
     5
    36#include <stdlib.h>
    47#include <string.h>
    58
     9#undef TR_CONTEXT
     10#define TR_CONTEXT "FtpClient"
     11
    612FtpClient::FtpClient()
    713    : FileUploadClient(),
    814    fState(0),
     
    111117
    112118
    113119bool
    114 FtpClient::Connect(const string& server, const string& login, const string& passwd)
     120FtpClient::Connect(const string& server,
     121    const string& login,
     122    const string& passwd)
    115123{
    116124    bool rc = false;
    117125    int code, codeType;
     
    373381   
    374382    if (path.length() == 0)
    375383        cmd += '/';
    376 printf("cmd: '%s'\n", cmd.c_str());
     384printf(TR("cmd: '%s'\n"), cmd.c_str());
    377385    if (_SendRequest(cmd) == true) {
    378386        if (_GetReply(replyString, code, codeType) == true) {
    379 printf("reply: %d, %d\n", code, codeType);
     387printf(TR("reply: %d, %d\n"), code, codeType);
    380388            if (codeType == 2)
    381389                rc = true;
    382390        }
     
    424432   
    425433    if (fControl != 0) {
    426434        if (cmd.find("PASS") != string::npos)
    427             printf("PASS <suppressed>  (real password sent)\n");
     435            printf(TR("PASS <suppressed>  (real password sent)\n"));
    428436        else
    429437            printf("%s\n", ccmd.c_str());
    430438
     
    540548    }
    541549   
    542550    if (!rc && outCode != 421) {
    543         outString += "Remote host has closed the connection.\n";
     551        outString += TR("Remote host has closed the connection.\n");
    544552        outCode = 421;
    545553    }
    546554