Ticket #7656: desklink.patch

File desklink.patch, 7.7 KB (added by mt, 13 years ago)
  • src/bin/desklink/MediaReplicant.cpp

     
    2020
    2121#include <Alert.h>
    2222#include <Bitmap.h>
     23#include <Catalog.h>
    2324#include <Entry.h>
    2425#include <File.h>
    2526#include <FindDirectory.h>
     
    3940#include "VolumeWindow.h"
    4041
    4142
     43#undef B_TRANSLATE_CONTEXT
     44#define B_TRANSLATE_CONTEXT "MediaReplicant"
     45
     46
    4247static const uint32 kMsgOpenMediaSettings = 'mese';
    4348static const uint32 kMsgOpenSoundSettings = 'sose';
    4449static const uint32 kMsgOpenMediaPlayer = 'omep';
     
    8893        MixerControl control;
    8994        control.Connect(fWhich);
    9095
    91         char text[256];
    92         snprintf(text, sizeof(text), "%g dB", control.Volume());
    93         fView->SetText(text);
     96        BString text;
     97        text.SetToFormat(B_TRANSLATE("%g dB"), control.Volume());
     98        fView->SetText(text.String());
    9499
    95100        Unlock();
    96101    }
     
    218223        BPopUpMenu* menu = new BPopUpMenu("", false, false);
    219224        menu->SetFont(be_plain_font);
    220225
    221         menu->AddItem(new BMenuItem("Media preferences" B_UTF8_ELLIPSIS,
     226        menu->AddItem(new BMenuItem(
     227            B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS),
    222228            new BMessage(kMsgOpenMediaSettings)));
    223         menu->AddItem(new BMenuItem("Sound preferences" B_UTF8_ELLIPSIS,
     229        menu->AddItem(new BMenuItem(
     230            B_TRANSLATE("Sound preferences" B_UTF8_ELLIPSIS),
    224231            new BMessage(kMsgOpenSoundSettings)));
    225232
    226233        menu->AddSeparatorItem();
    227234
    228         menu->AddItem(new BMenuItem("Open MediaPlayer",
     235        menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"),
    229236            new BMessage(kMsgOpenMediaPlayer)));
    230237
    231238        menu->AddSeparatorItem();
    232239
    233         BMenu* subMenu = new BMenu("Options");
     240        BMenu* subMenu = new BMenu(B_TRANSLATE("Options"));
    234241        menu->AddItem(subMenu);
    235242
    236         BMenuItem* item = new BMenuItem("Control physical output",
     243        BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"),
    237244            new BMessage(kMsgVolumeWhich));
    238245        item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT);
    239246        subMenu->AddItem(item);
    240247
    241         item = new BMenuItem("Beep", new BMessage(kMsgToggleBeep));
     248        item = new BMenuItem(B_TRANSLATE("Beep"),
     249            new BMessage(kMsgToggleBeep));
    242250        item->SetMarked(!fDontBeep);
    243251        subMenu->AddItem(item);
    244252
    245253        menu->AddSeparatorItem();
    246254
    247         menu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
     255        menu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS),
    248256            new BMessage(B_ABOUT_REQUESTED)));
    249257
    250258        menu->SetTargetForItems(this);
     
    266274{
    267275    switch (message->what) {
    268276        case B_ABOUT_REQUESTED:
    269             (new BAlert("About Volume Control", "Volume Control\n"
     277            (new BAlert(B_TRANSLATE("About Volume Control"),
     278                B_TRANSLATE("Volume Control\n"
    270279                    "  Brought to you by Jérôme DUVAL.\n\n"
    271                     "Copyright " B_UTF8_COPYRIGHT "2003-2010, Haiku",
    272                 "OK"))->Go(NULL);
     280                    "Copyright " B_UTF8_COPYRIGHT "2003-2010, Haiku"),
     281                B_TRANSLATE("OK")))->Go(NULL);
    273282            break;
    274283
    275284        case kMsgOpenMediaPlayer:
     
    391400    // launch the application
    392401    if (_LaunchBySignature(signature) != B_OK
    393402        && _LaunchByPath(path.Path()) != B_OK) {
    394         BString message = "Couldn't launch ";
     403        BString message = B_TRANSLATE("Couldn't launch ");
    395404        message << prettyName;
    396405
    397         (new BAlert("desklink", message.String(), "OK"))->Go();
     406        (new BAlert(B_TRANSLATE("desklink"), message.String(),
     407            B_TRANSLATE("OK")))->Go();
    398408    }
    399409}
    400410
  • src/bin/desklink/DeskButton.cpp

     
    1212
    1313#include <Alert.h>
    1414#include <Bitmap.h>
     15#include <Catalog.h>
    1516#include <Dragger.h>
    1617#include <MenuItem.h>
    1718#include <Message.h>
     
    2526#define OPEN_REF    'opre'
    2627#define DO_ACTION   'doac'
    2728
     29
     30#undef B_TRANSLATE_CONTEXT
     31#define B_TRANSLATE_CONTEXT "DeskButton"
     32
     33
    2834extern const char *kAppSignature;
    2935    // from desklink.cpp
    3036
     
    108114{
    109115    switch (message->what) {
    110116        case B_ABOUT_REQUESTED:
    111             (new BAlert("About Desklink", "Desklink (Replicant)\n"
    112                 "  Brought to you by Jérôme DUVAL.\n\n"
    113                 "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku","OK"))->Go();
     117            (new BAlert(B_TRANSLATE("About Desklink"),
     118                B_TRANSLATE("Desklink (Replicant)\n"
     119                    "Brought to you by Jérôme DUVAL.\n\n"
     120                    "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku"),
     121                B_TRANSLATE("OK")))->Go();
    114122            break;
    115123        case OPEN_REF:
    116124            be_roster->Launch(&fRef);
  • src/bin/desklink/Jamfile

     
    1212    VolumeControl.cpp
    1313    VolumeWindow.cpp
    1414
    15     : be libmedia.so $(TARGET_LIBSUPC++)
     15    : be libmedia.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
    1616    : desklink.rdef
    1717;
     18
     19DoCatalogs Mail :
     20    x-vnd.Haiku-desklink
     21    :
     22    DeskButton.cpp
     23    MediaReplicant.cpp
     24    VolumeControl.cpp
     25;
  • src/bin/desklink/VolumeControl.cpp

     
    1717#include <Alert.h>
    1818#include <Application.h>
    1919#include <Beep.h>
     20#include <Catalog.h>
    2021#include <ControlLook.h>
    2122#include <Dragger.h>
    2223#include <MessageRunner.h>
     
    2930#include "VolumeWindow.h"
    3031
    3132
     33
     34
     35#undef B_TRANSLATE_CONTEXT
     36#define B_TRANSLATE_CONTEXT "VolumeControl"
     37
     38
    3239static const char* kMediaServerSignature = "application/x-vnd.Be.media-server";
    3340static const char* kAddOnServerSignature = "application/x-vnd.Be.addon-host";
    3441
     
    3744
    3845VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message)
    3946    :
    40     BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL),
     47    BSlider("VolumeControl", B_TRANSLATE("Volume"),
     48        message, 0, 1, B_HORIZONTAL),
    4149    fMixerControl(new MixerControl(volumeWhich)),
    4250    fBeep(beep),
    4351    fSnapping(false),
     
    285293            break;
    286294
    287295        case B_ABOUT_REQUESTED:
    288             (new BAlert("About Volume Control", "Volume Control\n"
     296            (new BAlert(B_TRANSLATE("About Volume Control"),
     297                B_TRANSLATE( "Volume Control\n"
    289298                    "  Written by Jérôme DUVAL, and Axel Dörfler.\n\n"
    290                     "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku",
    291                 "OK"))->Go(NULL);
     299                    "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku"),
     300                B_TRANSLATE("OK")))->Go(NULL);
    292301            break;
    293302
    294303        case B_SOME_APP_LAUNCHED:
     
    308317           if (isMediaServer || isAddOnServer) {
    309318                if (!fMediaServerRunning && !fAddOnServerRunning) {
    310319                    // No media server around
    311                     SetLabel("No media server running");
     320                    SetLabel(B_TRANSLATE("No media server running"));
    312321                    SetEnabled(false);
    313322                } else if (fMediaServerRunning && fAddOnServerRunning) {
    314323                    // HACK!
     
    389398    if (!IsEnabled())
    390399        return NULL;
    391400
    392     snprintf(fText, sizeof(fText), "%ld dB", Value());
    393     return fText;
     401    fText.SetToFormat(B_TRANSLATE("%ld dB"), Value());
     402    return fText.String();
    394403}
    395404
    396405
     
    418427        SetLabel(errorString);
    419428        SetLimits(-60, 18);
    420429    } else {
    421         SetLabel("Volume");
     430        SetLabel(B_TRANSLATE("Volume"));
    422431        SetLimits((int32)floorf(fMixerControl->Minimum()),
    423432            (int32)ceilf(fMixerControl->Maximum()));
    424433
  • src/bin/desklink/VolumeControl.h

     
    1111#define VOLUME_SLIDER_H
    1212
    1313
     14#include <String.h>
    1415#include <Slider.h>
    1516
    1617class MixerControl;
     
    4748            bool            _IsReplicant() const;
    4849            float           _PointForValue(int32 value) const;
    4950
    50             mutable char    fText[64];
     51            mutable BString fText;
    5152            MixerControl*   fMixerControl;
    5253            int32           fOriginalValue;
    5354            bool            fBeep;