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
+8 -5
View File
@@ -12,6 +12,7 @@
#include <Alert.h> #include <Alert.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <Dragger.h> #include <Dragger.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <Message.h> #include <Message.h>
@@ -25,6 +26,11 @@
#define OPEN_REF 'opre' #define OPEN_REF 'opre'
#define DO_ACTION 'doac' #define DO_ACTION 'doac'
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "DeskButton"
extern const char *kAppSignature; extern const char *kAppSignature;
// from desklink.cpp // from desklink.cpp
@@ -107,14 +113,10 @@ void
DeskButton::MessageReceived(BMessage *message) DeskButton::MessageReceived(BMessage *message)
{ {
switch (message->what) { 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: case OPEN_REF:
be_roster->Launch(&fRef); be_roster->Launch(&fRef);
break; break;
case DO_ACTION: case DO_ACTION:
{ {
BString action; BString action;
@@ -124,6 +126,7 @@ DeskButton::MessageReceived(BMessage *message)
} }
break; break;
} }
default: default:
BView::MessageReceived(message); BView::MessageReceived(message);
break; break;
+9 -1
View File
@@ -12,6 +12,14 @@ BinCommand desklink :
VolumeControl.cpp VolumeControl.cpp
VolumeWindow.cpp VolumeWindow.cpp
: be libmedia.so $(TARGET_LIBSUPC++) : be libmedia.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
: desklink.rdef : desklink.rdef
; ;
DoCatalogs Mail :
x-vnd.Haiku-desklink
:
DeskButton.cpp
MediaReplicant.cpp
VolumeControl.cpp
;
+20 -23
View File
@@ -20,6 +20,7 @@
#include <Alert.h> #include <Alert.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <Entry.h> #include <Entry.h>
#include <File.h> #include <File.h>
#include <FindDirectory.h> #include <FindDirectory.h>
@@ -39,6 +40,10 @@
#include "VolumeWindow.h" #include "VolumeWindow.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaReplicant"
static const uint32 kMsgOpenMediaSettings = 'mese'; static const uint32 kMsgOpenMediaSettings = 'mese';
static const uint32 kMsgOpenSoundSettings = 'sose'; static const uint32 kMsgOpenSoundSettings = 'sose';
static const uint32 kMsgOpenMediaPlayer = 'omep'; static const uint32 kMsgOpenMediaPlayer = 'omep';
@@ -88,9 +93,9 @@ public:
MixerControl control; MixerControl control;
control.Connect(fWhich); control.Connect(fWhich);
char text[256]; BString text;
snprintf(text, sizeof(text), "%g dB", control.Volume()); text.SetToFormat(B_TRANSLATE("%g dB"), control.Volume());
fView->SetText(text); fView->SetText(text.String());
Unlock(); Unlock();
} }
@@ -218,35 +223,33 @@ MediaReplicant::MouseDown(BPoint point)
BPopUpMenu* menu = new BPopUpMenu("", false, false); BPopUpMenu* menu = new BPopUpMenu("", false, false);
menu->SetFont(be_plain_font); 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))); 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))); new BMessage(kMsgOpenSoundSettings)));
menu->AddSeparatorItem(); menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Open MediaPlayer", menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"),
new BMessage(kMsgOpenMediaPlayer))); new BMessage(kMsgOpenMediaPlayer)));
menu->AddSeparatorItem(); menu->AddSeparatorItem();
BMenu* subMenu = new BMenu("Options"); BMenu* subMenu = new BMenu(B_TRANSLATE("Options"));
menu->AddItem(subMenu); menu->AddItem(subMenu);
BMenuItem* item = new BMenuItem("Control physical output", BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"),
new BMessage(kMsgVolumeWhich)); new BMessage(kMsgVolumeWhich));
item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT); item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT);
subMenu->AddItem(item); subMenu->AddItem(item);
item = new BMenuItem("Beep", new BMessage(kMsgToggleBeep)); item = new BMenuItem(B_TRANSLATE("Beep"),
new BMessage(kMsgToggleBeep));
item->SetMarked(!fDontBeep); item->SetMarked(!fDontBeep);
subMenu->AddItem(item); subMenu->AddItem(item);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
new BMessage(B_ABOUT_REQUESTED)));
menu->SetTargetForItems(this); menu->SetTargetForItems(this);
subMenu->SetTargetForItems(this); subMenu->SetTargetForItems(this);
@@ -265,13 +268,6 @@ void
MediaReplicant::MessageReceived(BMessage* message) MediaReplicant::MessageReceived(BMessage* message)
{ {
switch (message->what) { 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: case kMsgOpenMediaPlayer:
_Launch("MediaPlayer", "application/x-vnd.Haiku-MediaPlayer", _Launch("MediaPlayer", "application/x-vnd.Haiku-MediaPlayer",
B_SYSTEM_APPS_DIRECTORY, "MediaPlayer"); B_SYSTEM_APPS_DIRECTORY, "MediaPlayer");
@@ -391,10 +387,11 @@ MediaReplicant::_Launch(const char* prettyName, const char* signature,
// launch the application // launch the application
if (_LaunchBySignature(signature) != B_OK if (_LaunchBySignature(signature) != B_OK
&& _LaunchByPath(path.Path()) != B_OK) { && _LaunchByPath(path.Path()) != B_OK) {
BString message = "Couldn't launch "; BString message = B_TRANSLATE("Couldn't launch ");
message << prettyName; message << prettyName;
(new BAlert("desklink", message.String(), "OK"))->Go(); (new BAlert(B_TRANSLATE("desklink"), message.String(),
B_TRANSLATE("OK")))->Go();
} }
} }
+13 -13
View File
@@ -14,9 +14,9 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Beep.h> #include <Beep.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <Dragger.h> #include <Dragger.h>
#include <MessageRunner.h> #include <MessageRunner.h>
@@ -29,6 +29,12 @@
#include "VolumeWindow.h" #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* kMediaServerSignature = "application/x-vnd.Be.media-server";
static const char* kAddOnServerSignature = "application/x-vnd.Be.addon-host"; 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) 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)), fMixerControl(new MixerControl(volumeWhich)),
fBeep(beep), fBeep(beep),
fSnapping(false), fSnapping(false),
@@ -284,13 +291,6 @@ VolumeControl::MessageReceived(BMessage* msg)
SetValue((int32)fMixerControl->Volume()); SetValue((int32)fMixerControl->Volume());
break; 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_LAUNCHED:
case B_SOME_APP_QUIT: case B_SOME_APP_QUIT:
{ {
@@ -308,7 +308,7 @@ VolumeControl::MessageReceived(BMessage* msg)
if (isMediaServer || isAddOnServer) { if (isMediaServer || isAddOnServer) {
if (!fMediaServerRunning && !fAddOnServerRunning) { if (!fMediaServerRunning && !fAddOnServerRunning) {
// No media server around // No media server around
SetLabel("No media server running"); SetLabel(B_TRANSLATE("No media server running"));
SetEnabled(false); SetEnabled(false);
} else if (fMediaServerRunning && fAddOnServerRunning) { } else if (fMediaServerRunning && fAddOnServerRunning) {
// HACK! // HACK!
@@ -389,8 +389,8 @@ VolumeControl::UpdateText() const
if (!IsEnabled()) if (!IsEnabled())
return NULL; return NULL;
snprintf(fText, sizeof(fText), "%ld dB", Value()); fText.SetToFormat(B_TRANSLATE("%ld dB"), Value());
return fText; return fText.String();
} }
@@ -418,7 +418,7 @@ VolumeControl::_ConnectVolume()
SetLabel(errorString); SetLabel(errorString);
SetLimits(-60, 18); SetLimits(-60, 18);
} else { } else {
SetLabel("Volume"); SetLabel(B_TRANSLATE("Volume"));
SetLimits((int32)floorf(fMixerControl->Minimum()), SetLimits((int32)floorf(fMixerControl->Minimum()),
(int32)ceilf(fMixerControl->Maximum())); (int32)ceilf(fMixerControl->Maximum()));
+2 -1
View File
@@ -11,6 +11,7 @@
#define VOLUME_SLIDER_H #define VOLUME_SLIDER_H
#include <String.h>
#include <Slider.h> #include <Slider.h>
class MixerControl; class MixerControl;
@@ -47,7 +48,7 @@ private:
bool _IsReplicant() const; bool _IsReplicant() const;
float _PointForValue(int32 value) const; float _PointForValue(int32 value) const;
mutable char fText[64]; mutable BString fText;
MixerControl* fMixerControl; MixerControl* fMixerControl;
int32 fOriginalValue; int32 fOriginalValue;
bool fBeep; bool fBeep;