Author: humdinger Date: 2011-06-10 15:43:06 +0200 (Fri, 10 Jun 2011) New Revision: 42085 Changeset: https://dev.haiku-os.org/changeset/42085 Ticket: https://dev.haiku-os.org/ticket/7656 Modified: haiku/trunk/src/bin/desklink/DeskButton.cpp haiku/trunk/src/bin/desklink/Jamfile haiku/trunk/src/bin/desklink/MediaReplicant.cpp haiku/trunk/src/bin/desklink/VolumeControl.cpp haiku/trunk/src/bin/desklink/VolumeControl.h Log: Applied localization patch by mt, removed About menu/window as we decided those are not needed with system software. Fixes #7656. Compiling, working cosmetics, I'd say +alpha. Modified: haiku/trunk/src/bin/desklink/DeskButton.cpp =================================================================== --- haiku/trunk/src/bin/desklink/DeskButton.cpp 2011-06-10 12:59:14 UTC (rev 42084) +++ haiku/trunk/src/bin/desklink/DeskButton.cpp 2011-06-10 13:43:06 UTC (rev 42085) @@ -12,6 +12,7 @@ #include <Alert.h> #include <Bitmap.h> +#include <Catalog.h> #include <Dragger.h> #include <MenuItem.h> #include <Message.h> @@ -25,6 +26,11 @@ #define OPEN_REF 'opre' #define DO_ACTION 'doac' + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "DeskButton" + + extern const char *kAppSignature; // from desklink.cpp @@ -107,14 +113,10 @@ DeskButton::MessageReceived(BMessage *message) { switch (message->what) { - case B_ABOUT_REQUESTED: - (new BAlert("About Desklink", "Desklink (Replicant)\n" - " Brought to you by Jérôme DUVAL.\n\n" - "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku","OK"))->Go(); - break; case OPEN_REF: be_roster->Launch(&fRef); break; + case DO_ACTION: { BString action; @@ -124,6 +126,7 @@ } break; } + default: BView::MessageReceived(message); break; Modified: haiku/trunk/src/bin/desklink/Jamfile =================================================================== --- haiku/trunk/src/bin/desklink/Jamfile 2011-06-10 12:59:14 UTC (rev 42084) +++ haiku/trunk/src/bin/desklink/Jamfile 2011-06-10 13:43:06 UTC (rev 42085) @@ -12,6 +12,14 @@ VolumeControl.cpp VolumeWindow.cpp - : be libmedia.so $(TARGET_LIBSUPC++) + : be libmedia.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) : desklink.rdef ; + +DoCatalogs Mail : + x-vnd.Haiku-desklink + : + DeskButton.cpp + MediaReplicant.cpp + VolumeControl.cpp +; Modified: haiku/trunk/src/bin/desklink/MediaReplicant.cpp =================================================================== --- haiku/trunk/src/bin/desklink/MediaReplicant.cpp 2011-06-10 12:59:14 UTC (rev 42084) +++ haiku/trunk/src/bin/desklink/MediaReplicant.cpp 2011-06-10 13:43:06 UTC (rev 42085) @@ -20,6 +20,7 @@ #include <Alert.h> #include <Bitmap.h> +#include <Catalog.h> #include <Entry.h> #include <File.h> #include <FindDirectory.h> @@ -39,6 +40,10 @@ #include "VolumeWindow.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "MediaReplicant" + + static const uint32 kMsgOpenMediaSettings = 'mese'; static const uint32 kMsgOpenSoundSettings = 'sose'; static const uint32 kMsgOpenMediaPlayer = 'omep'; @@ -88,9 +93,9 @@ MixerControl control; control.Connect(fWhich); - char text[256]; - snprintf(text, sizeof(text), "%g dB", control.Volume()); - fView->SetText(text); + BString text; + text.SetToFormat(B_TRANSLATE("%g dB"), control.Volume()); + fView->SetText(text.String()); Unlock(); } @@ -218,35 +223,33 @@ BPopUpMenu* menu = new BPopUpMenu("", false, false); menu->SetFont(be_plain_font); - menu->AddItem(new BMenuItem("Media preferences" B_UTF8_ELLIPSIS, + menu->AddItem(new BMenuItem( + B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenMediaSettings))); - menu->AddItem(new BMenuItem("Sound preferences" B_UTF8_ELLIPSIS, + menu->AddItem(new BMenuItem( + B_TRANSLATE("Sound preferences" B_UTF8_ELLIPSIS), new BMessage(kMsgOpenSoundSettings))); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Open MediaPlayer", + menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"), new BMessage(kMsgOpenMediaPlayer))); menu->AddSeparatorItem(); - BMenu* subMenu = new BMenu("Options"); + BMenu* subMenu = new BMenu(B_TRANSLATE("Options")); menu->AddItem(subMenu); - BMenuItem* item = new BMenuItem("Control physical output", + BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"), new BMessage(kMsgVolumeWhich)); item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT); subMenu->AddItem(item); - item = new BMenuItem("Beep", new BMessage(kMsgToggleBeep)); + item = new BMenuItem(B_TRANSLATE("Beep"), + new BMessage(kMsgToggleBeep)); item->SetMarked(!fDontBeep); subMenu->AddItem(item); - menu->AddSeparatorItem(); - - menu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, - new BMessage(B_ABOUT_REQUESTED))); - menu->SetTargetForItems(this); subMenu->SetTargetForItems(this); @@ -265,13 +268,6 @@ MediaReplicant::MessageReceived(BMessage* message) { switch (message->what) { - case B_ABOUT_REQUESTED: - (new BAlert("About Volume Control", "Volume Control\n" - " Brought to you by Jérôme DUVAL.\n\n" - "Copyright " B_UTF8_COPYRIGHT "2003-2010, Haiku", - "OK"))->Go(NULL); - break; - case kMsgOpenMediaPlayer: _Launch("MediaPlayer", "application/x-vnd.Haiku-MediaPlayer", B_SYSTEM_APPS_DIRECTORY, "MediaPlayer"); @@ -391,10 +387,11 @@ // launch the application if (_LaunchBySignature(signature) != B_OK && _LaunchByPath(path.Path()) != B_OK) { - BString message = "Couldn't launch "; + BString message = B_TRANSLATE("Couldn't launch "); message << prettyName; - (new BAlert("desklink", message.String(), "OK"))->Go(); + (new BAlert(B_TRANSLATE("desklink"), message.String(), + B_TRANSLATE("OK")))->Go(); } } Modified: haiku/trunk/src/bin/desklink/VolumeControl.cpp =================================================================== --- haiku/trunk/src/bin/desklink/VolumeControl.cpp 2011-06-10 12:59:14 UTC (rev 42084) +++ haiku/trunk/src/bin/desklink/VolumeControl.cpp 2011-06-10 13:43:06 UTC (rev 42085) @@ -14,9 +14,9 @@ #include <string.h> #include <stdio.h> -#include <Alert.h> #include <Application.h> #include <Beep.h> +#include <Catalog.h> #include <ControlLook.h> #include <Dragger.h> #include <MessageRunner.h> @@ -29,6 +29,12 @@ #include "VolumeWindow.h" + + +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "VolumeControl" + + static const char* kMediaServerSignature = "application/x-vnd.Be.media-server"; static const char* kAddOnServerSignature = "application/x-vnd.Be.addon-host"; @@ -37,7 +43,8 @@ VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message) : - BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL), + BSlider("VolumeControl", B_TRANSLATE("Volume"), + message, 0, 1, B_HORIZONTAL), fMixerControl(new MixerControl(volumeWhich)), fBeep(beep), fSnapping(false), @@ -284,13 +291,6 @@ SetValue((int32)fMixerControl->Volume()); break; - case B_ABOUT_REQUESTED: - (new BAlert("About Volume Control", "Volume Control\n" - " Written by Jérôme DUVAL, and Axel Dörfler.\n\n" - "Copyright " B_UTF8_COPYRIGHT "2003-2009, Haiku", - "OK"))->Go(NULL); - break; - case B_SOME_APP_LAUNCHED: case B_SOME_APP_QUIT: { @@ -308,7 +308,7 @@ if (isMediaServer || isAddOnServer) { if (!fMediaServerRunning && !fAddOnServerRunning) { // No media server around - SetLabel("No media server running"); + SetLabel(B_TRANSLATE("No media server running")); SetEnabled(false); } else if (fMediaServerRunning && fAddOnServerRunning) { // HACK! @@ -389,8 +389,8 @@ if (!IsEnabled()) return NULL; - snprintf(fText, sizeof(fText), "%ld dB", Value()); - return fText; + fText.SetToFormat(B_TRANSLATE("%ld dB"), Value()); + return fText.String(); } @@ -418,7 +418,7 @@ SetLabel(errorString); SetLimits(-60, 18); } else { - SetLabel("Volume"); + SetLabel(B_TRANSLATE("Volume")); SetLimits((int32)floorf(fMixerControl->Minimum()), (int32)ceilf(fMixerControl->Maximum())); Modified: haiku/trunk/src/bin/desklink/VolumeControl.h =================================================================== --- haiku/trunk/src/bin/desklink/VolumeControl.h 2011-06-10 12:59:14 UTC (rev 42084) +++ haiku/trunk/src/bin/desklink/VolumeControl.h 2011-06-10 13:43:06 UTC (rev 42085) @@ -11,6 +11,7 @@ #define VOLUME_SLIDER_H +#include <String.h> #include <Slider.h> class MixerControl; @@ -47,7 +48,7 @@ bool _IsReplicant() const; float _PointForValue(int32 value) const; - mutable char fText[64]; + mutable BString fText; MixerControl* fMixerControl; int32 fOriginalValue; bool fBeep;