Ticket #7656: desklink.patch
File desklink.patch, 7.7 KB (added by , 13 years ago) |
---|
-
src/bin/desklink/MediaReplicant.cpp
20 20 21 21 #include <Alert.h> 22 22 #include <Bitmap.h> 23 #include <Catalog.h> 23 24 #include <Entry.h> 24 25 #include <File.h> 25 26 #include <FindDirectory.h> … … 39 40 #include "VolumeWindow.h" 40 41 41 42 43 #undef B_TRANSLATE_CONTEXT 44 #define B_TRANSLATE_CONTEXT "MediaReplicant" 45 46 42 47 static const uint32 kMsgOpenMediaSettings = 'mese'; 43 48 static const uint32 kMsgOpenSoundSettings = 'sose'; 44 49 static const uint32 kMsgOpenMediaPlayer = 'omep'; … … 88 93 MixerControl control; 89 94 control.Connect(fWhich); 90 95 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()); 94 99 95 100 Unlock(); 96 101 } … … 218 223 BPopUpMenu* menu = new BPopUpMenu("", false, false); 219 224 menu->SetFont(be_plain_font); 220 225 221 menu->AddItem(new BMenuItem("Media preferences" B_UTF8_ELLIPSIS, 226 menu->AddItem(new BMenuItem( 227 B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS), 222 228 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), 224 231 new BMessage(kMsgOpenSoundSettings))); 225 232 226 233 menu->AddSeparatorItem(); 227 234 228 menu->AddItem(new BMenuItem( "Open MediaPlayer",235 menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"), 229 236 new BMessage(kMsgOpenMediaPlayer))); 230 237 231 238 menu->AddSeparatorItem(); 232 239 233 BMenu* subMenu = new BMenu( "Options");240 BMenu* subMenu = new BMenu(B_TRANSLATE("Options")); 234 241 menu->AddItem(subMenu); 235 242 236 BMenuItem* item = new BMenuItem( "Control physical output",243 BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"), 237 244 new BMessage(kMsgVolumeWhich)); 238 245 item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT); 239 246 subMenu->AddItem(item); 240 247 241 item = new BMenuItem("Beep", new BMessage(kMsgToggleBeep)); 248 item = new BMenuItem(B_TRANSLATE("Beep"), 249 new BMessage(kMsgToggleBeep)); 242 250 item->SetMarked(!fDontBeep); 243 251 subMenu->AddItem(item); 244 252 245 253 menu->AddSeparatorItem(); 246 254 247 menu->AddItem(new BMenuItem( "About" B_UTF8_ELLIPSIS,255 menu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS), 248 256 new BMessage(B_ABOUT_REQUESTED))); 249 257 250 258 menu->SetTargetForItems(this); … … 266 274 { 267 275 switch (message->what) { 268 276 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" 270 279 " 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); 273 282 break; 274 283 275 284 case kMsgOpenMediaPlayer: … … 391 400 // launch the application 392 401 if (_LaunchBySignature(signature) != B_OK 393 402 && _LaunchByPath(path.Path()) != B_OK) { 394 BString message = "Couldn't launch ";403 BString message = B_TRANSLATE("Couldn't launch "); 395 404 message << prettyName; 396 405 397 (new BAlert("desklink", message.String(), "OK"))->Go(); 406 (new BAlert(B_TRANSLATE("desklink"), message.String(), 407 B_TRANSLATE("OK")))->Go(); 398 408 } 399 409 } 400 410 -
src/bin/desklink/DeskButton.cpp
12 12 13 13 #include <Alert.h> 14 14 #include <Bitmap.h> 15 #include <Catalog.h> 15 16 #include <Dragger.h> 16 17 #include <MenuItem.h> 17 18 #include <Message.h> … … 25 26 #define OPEN_REF 'opre' 26 27 #define DO_ACTION 'doac' 27 28 29 30 #undef B_TRANSLATE_CONTEXT 31 #define B_TRANSLATE_CONTEXT "DeskButton" 32 33 28 34 extern const char *kAppSignature; 29 35 // from desklink.cpp 30 36 … … 108 114 { 109 115 switch (message->what) { 110 116 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(); 114 122 break; 115 123 case OPEN_REF: 116 124 be_roster->Launch(&fRef); -
src/bin/desklink/Jamfile
12 12 VolumeControl.cpp 13 13 VolumeWindow.cpp 14 14 15 : be libmedia.so $( TARGET_LIBSUPC++)15 : be libmedia.so $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++) 16 16 : desklink.rdef 17 17 ; 18 19 DoCatalogs Mail : 20 x-vnd.Haiku-desklink 21 : 22 DeskButton.cpp 23 MediaReplicant.cpp 24 VolumeControl.cpp 25 ; -
src/bin/desklink/VolumeControl.cpp
17 17 #include <Alert.h> 18 18 #include <Application.h> 19 19 #include <Beep.h> 20 #include <Catalog.h> 20 21 #include <ControlLook.h> 21 22 #include <Dragger.h> 22 23 #include <MessageRunner.h> … … 29 30 #include "VolumeWindow.h" 30 31 31 32 33 34 35 #undef B_TRANSLATE_CONTEXT 36 #define B_TRANSLATE_CONTEXT "VolumeControl" 37 38 32 39 static const char* kMediaServerSignature = "application/x-vnd.Be.media-server"; 33 40 static const char* kAddOnServerSignature = "application/x-vnd.Be.addon-host"; 34 41 … … 37 44 38 45 VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message) 39 46 : 40 BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL), 47 BSlider("VolumeControl", B_TRANSLATE("Volume"), 48 message, 0, 1, B_HORIZONTAL), 41 49 fMixerControl(new MixerControl(volumeWhich)), 42 50 fBeep(beep), 43 51 fSnapping(false), … … 285 293 break; 286 294 287 295 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" 289 298 " 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); 292 301 break; 293 302 294 303 case B_SOME_APP_LAUNCHED: … … 308 317 if (isMediaServer || isAddOnServer) { 309 318 if (!fMediaServerRunning && !fAddOnServerRunning) { 310 319 // No media server around 311 SetLabel( "No media server running");320 SetLabel(B_TRANSLATE("No media server running")); 312 321 SetEnabled(false); 313 322 } else if (fMediaServerRunning && fAddOnServerRunning) { 314 323 // HACK! … … 389 398 if (!IsEnabled()) 390 399 return NULL; 391 400 392 snprintf(fText, sizeof(fText), "%ld dB", Value());393 return fText ;401 fText.SetToFormat(B_TRANSLATE("%ld dB"), Value()); 402 return fText.String(); 394 403 } 395 404 396 405 … … 418 427 SetLabel(errorString); 419 428 SetLimits(-60, 18); 420 429 } else { 421 SetLabel( "Volume");430 SetLabel(B_TRANSLATE("Volume")); 422 431 SetLimits((int32)floorf(fMixerControl->Minimum()), 423 432 (int32)ceilf(fMixerControl->Maximum())); 424 433 -
src/bin/desklink/VolumeControl.h
11 11 #define VOLUME_SLIDER_H 12 12 13 13 14 #include <String.h> 14 15 #include <Slider.h> 15 16 16 17 class MixerControl; … … 47 48 bool _IsReplicant() const; 48 49 float _PointForValue(int32 value) const; 49 50 50 mutable char fText[64];51 mutable BString fText; 51 52 MixerControl* fMixerControl; 52 53 int32 fOriginalValue; 53 54 bool fBeep;