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.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42085 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Joachim Seemer 2011-06-10 13:43:06 +00:00
parent b047e41327
commit 9254b0c4df
5 changed files with 52 additions and 43 deletions

View File

@ -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 @@ void
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 @@ DeskButton::MessageReceived(BMessage *message)
}
break;
}
default:
BView::MessageReceived(message);
break;

View File

@ -12,6 +12,14 @@ BinCommand desklink :
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
;

View File

@ -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 @@ public:
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 @@ MediaReplicant::MouseDown(BPoint point)
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 @@ void
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 @@ MediaReplicant::_Launch(const char* prettyName, const char* signature,
// 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();
}
}

View File

@ -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 @@ static const uint32 kMsgReconnectVolume = 'rcms';
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 @@ VolumeControl::MessageReceived(BMessage* msg)
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 @@ VolumeControl::MessageReceived(BMessage* msg)
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 @@ VolumeControl::UpdateText() const
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 @@ VolumeControl::_ConnectVolume()
SetLabel(errorString);
SetLimits(-60, 18);
} else {
SetLabel("Volume");
SetLabel(B_TRANSLATE("Volume"));
SetLimits((int32)floorf(fMixerControl->Minimum()),
(int32)ceilf(fMixerControl->Maximum()));

View File

@ -11,6 +11,7 @@
#define VOLUME_SLIDER_H
#include <String.h>
#include <Slider.h>
class MixerControl;
@ -47,7 +48,7 @@ private:
bool _IsReplicant() const;
float _PointForValue(int32 value) const;
mutable char fText[64];
mutable BString fText;
MixerControl* fMixerControl;
int32 fOriginalValue;
bool fBeep;