Localized Bluetooth preference panel. I hope I did not break anything. I don't have bluetooth devices to test. Feedback welcome, and suggestions on my fuzzy french translation too.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33232 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2009-09-21 21:30:08 +00:00
parent 9e3d9284f8
commit bef020d3b7
9 changed files with 147 additions and 63 deletions
@@ -10,12 +10,16 @@
#include <Bitmap.h>
#include <Catalog.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <SpaceLayoutItem.h>
#include <StringView.h>
#include <TextView.h>
#define TR_CONTEXT "Device View"
BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice, uint32 resizingMode, uint32 flags)
: BView(frame,"BluetoothDeviceView", resizingMode, flags | B_WILL_DRAW),
fDevice(bDevice)
@@ -30,7 +34,7 @@ BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
fBdaddr = new BStringView("bdaddr", bdaddrUtils::ToString(bdaddrUtils::NullAddress()));
fClassService = new BStringView("ServiceClass", "Service Classes: ");
fClassService = new BStringView("ServiceClass", TR("Service Classes: "));
fClass = new BStringView("class", "- / -");
@@ -89,7 +93,7 @@ BluetoothDeviceView::SetBluetoothDevice(BluetoothDevice* bDevice)
fName->SetText(bDevice->GetFriendlyName().String());
fBdaddr->SetText(bdaddrUtils::ToString(bDevice->GetBluetoothAddress()));
BString str("Service Classes: ");
BString str(TR("Service Classes: "));
bDevice->GetDeviceClass().GetServiceClass(str);
fClassService->SetText(str.String());
+7 -2
View File
@@ -5,6 +5,8 @@
#include <stdio.h>
#include <Alert.h>
#include <Catalog.h>
#include <Locale.h>
#include "BluetoothMain.h"
#include "BluetoothWindow.h"
@@ -15,6 +17,9 @@
BluetoothApplication::BluetoothApplication(void)
: BApplication(BLUETOOTH_APP_SIGNATURE)
{
BCatalog cat;
be_locale->GetAppCatalog(&cat);
fWindow = new BluetoothWindow(BRect(100, 100, 550, 420));
fWindow->Show();
}
@@ -24,7 +29,7 @@ void
BluetoothApplication::AboutRequested()
{
(new BAlert("about", "Haiku Bluetooth System, (ARCE)\n\n"
(new BAlert("about", TR("Haiku Bluetooth System, (ARCE)\n\n"
"Created by Oliver Ruiz Dorantes\n\n"
"With support of:\n"
" - Mika Lindqvist\n"
@@ -53,7 +58,7 @@ BluetoothApplication::AboutRequested()
" - Petter H. Juliussen\n"
" - Adrien Destugues\n\n"
"Who gave me all the knowledge:\n"
" - the yellowTAB team", "OK"))->Go();
" - the yellowTAB team", "OK")))->Go();
}
@@ -34,15 +34,15 @@ static const int32 kMsgSetDeviceClassSmartPhone = 'sDCp';
static const int32 kMsgSetAverageWeight = 'afEa';
static const int32 kMsgLocalSwitched = 'lDsW';
static const char* kAllLabel = "From all devices";
static const char* kTrustedLabel = "Only from Trusted devices";
static const char* kAlwaysLabel = "Always ask";
static const char* kAllLabel = TR_MARK("From all devices");
static const char* kTrustedLabel = TR_MARK("Only from Trusted devices");
static const char* kAlwaysLabel = TR_MARK("Always ask");
static const char* kDesktopLabel = "Desktop";
static const char* kServerLabel = "Server";
static const char* kLaptopLabel = "Laptop";
static const char* kHandheldLabel = "Handheld";
static const char* kPhoneLabel = "Smart Phone";
static const char* kDesktopLabel = TR_MARK("Desktop");
static const char* kServerLabel = TR_MARK("Server");
static const char* kLaptopLabel = TR_MARK("Laptop");
static const char* kHandheldLabel = TR_MARK("Handheld");
static const char* kPhoneLabel = TR_MARK("Smart Phone");
// #pragma mark -
@@ -53,24 +53,25 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
// antialiasing menu
_BuildConnectionPolicy();
fAntialiasingMenuField = new BMenuField("antialiasing",
"Incoming connections policy:", fAntialiasingMenu, NULL);
TR("Incoming connections policy:"), fAntialiasingMenu, NULL);
fAverageWeightControl = new BSlider("averageWeightControl",
"Default Inquiry time:", new BMessage(kMsgSetAverageWeight), 0, 255, B_HORIZONTAL);
fAverageWeightControl->SetLimitLabels("15 secs", "61 secs");
TR("Default Inquiry time:"), new BMessage(kMsgSetAverageWeight), 0, 255,
B_HORIZONTAL);
fAverageWeightControl->SetLimitLabels(TR("15 secs"), TR("61 secs"));
fAverageWeightControl->SetHashMarks(B_HASH_MARKS_BOTTOM);
fAverageWeightControl->SetHashMarkCount(255 / 15);
fAverageWeightControl->SetEnabled(true);
// hinting menu
_BuildHintingMenu();
fHintingMenuField = new BMenuField("hinting", "Identify host as:",
fHintingMenuField = new BMenuField("hinting", TR("Identify host as:"),
fHintingMenu, NULL);
// localdevices menu
_BuildLocalDevicesMenu();
fLocalDevicesMenuField = new BMenuField("devices", "Local Devices found on system:",
fLocalDevicesMenu, NULL);
fLocalDevicesMenuField = new BMenuField("devices",
TR("Local Devices found on system:"), fLocalDevicesMenu, NULL);
fExtDeviceView = new ExtendedLocalDeviceView(BRect(0,0,5,5), NULL);
@@ -190,23 +191,23 @@ BluetoothSettingsView::MessageReceived(BMessage *msg)
void
BluetoothSettingsView::_BuildConnectionPolicy()
{
fAntialiasingMenu = new BPopUpMenu("Policy...");
fAntialiasingMenu = new BPopUpMenu(TR("Policy..."));
BMessage* message = new BMessage(kMsgSetAntialiasing);
message->AddBool("antialiasing", false);
BMenuItem* item = new BMenuItem(kAllLabel, message);
BMenuItem* item = new BMenuItem(TR(kAllLabel), message);
fAntialiasingMenu->AddItem(item);
message = new BMessage(kMsgSetAntialiasing);
message->AddBool("antialiasing", true);
item = new BMenuItem(kTrustedLabel, message);
item = new BMenuItem(TR(kTrustedLabel), message);
fAntialiasingMenu->AddItem(item);
BMenuItem* item2 = new BMenuItem(kAlwaysLabel, NULL);
BMenuItem* item2 = new BMenuItem(TR(kAlwaysLabel), NULL);
fAntialiasingMenu->AddItem(item2);
@@ -217,27 +218,27 @@ void
BluetoothSettingsView::_BuildHintingMenu()
{
fHintingMenu = new BPopUpMenu("Identify us as...");
fHintingMenu = new BPopUpMenu(TR("Identify us as..."));
BMessage* message;
message = new BMessage(kMsgSetDeviceClassDesktop);
BMenuItem* item = new BMenuItem(kDesktopLabel, message);
BMenuItem* item = new BMenuItem(TR(kDesktopLabel), message);
fHintingMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassServer);
item = new BMenuItem(kServerLabel, message);
item = new BMenuItem(TR(kServerLabel), message);
fHintingMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassLaptop);
item = new BMenuItem(kLaptopLabel, message);
item = new BMenuItem(TR(kLaptopLabel), message);
fHintingMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassHandheld);
item = new BMenuItem(kHandheldLabel, message);
item = new BMenuItem(TR(kHandheldLabel), message);
fHintingMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassSmartPhone);
item = new BMenuItem(kPhoneLabel, message);
item = new BMenuItem(TR(kPhoneLabel), message);
fHintingMenu->AddItem(item);
@@ -250,7 +251,7 @@ BluetoothSettingsView::_BuildLocalDevicesMenu()
LocalDevice* lDevice;
if (!fLocalDevicesMenu)
fLocalDevicesMenu = new BPopUpMenu("Pick LocalDevice...");
fLocalDevicesMenu = new BPopUpMenu(TR("Pick LocalDevice..."));
for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) {
+16 -14
View File
@@ -6,7 +6,9 @@
#include <Button.h>
#include <Catalog.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <Messenger.h>
#include <SpaceLayoutItem.h>
#include <TabView.h>
@@ -35,38 +37,38 @@ BluetoothWindow::BluetoothWindow(BRect frame)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
fDefaultsButton = new BButton("defaults", "Defaults",
fDefaultsButton = new BButton("defaults", TR("Defaults"),
new BMessage(kMsgSetDefaults), B_WILL_DRAW);
fRevertButton = new BButton("revert", "Revert",
fRevertButton = new BButton("revert", TR("Revert"),
new BMessage(kMsgRevert), B_WILL_DRAW);
// Add the menu bar
fMenubar = new BMenuBar(Bounds(), "menu_bar");
// Add File menu to menu bar
BMenu *menu = new BMenu("Server");
menu->AddItem(new BMenuItem("Start Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0));
menu->AddItem(new BMenuItem("Stop Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStopServices), 0));
BMenu *menu = new BMenu(TR("Server"));
menu->AddItem(new BMenuItem(TR("Start Bluetooth Services" B_UTF8_ELLIPSIS), new BMessage(kMsgStartServices), 0));
menu->AddItem(new BMenuItem(TR("Stop Bluetooth Services" B_UTF8_ELLIPSIS), new BMessage(kMsgStopServices), 0));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Show Bluetooth console" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0));
menu->AddItem(new BMenuItem("Refresh LocalDevices" B_UTF8_ELLIPSIS, new BMessage(kMsgRefresh), 0));
menu->AddItem(new BMenuItem(TR("Show Bluetooth console" B_UTF8_ELLIPSIS), new BMessage(kMsgStartServices), 0));
menu->AddItem(new BMenuItem(TR("Refresh LocalDevices" B_UTF8_ELLIPSIS), new BMessage(kMsgRefresh), 0));
fMenubar->AddItem(menu);
menu = new BMenu("View");
menu->AddItem(new BMenuItem("Connections & Channels list" B_UTF8_ELLIPSIS, NULL, 0));
menu->AddItem(new BMenuItem("Remote Devices List" B_UTF8_ELLIPSIS, NULL, 0));
menu = new BMenu(TR("View"));
menu->AddItem(new BMenuItem(TR("Connections & Channels list" B_UTF8_ELLIPSIS), NULL, 0));
menu->AddItem(new BMenuItem(TR("Remote Devices List" B_UTF8_ELLIPSIS), NULL, 0));
fMenubar->AddItem(menu);
menu = new BMenu("Help");
menu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED), 0));
menu = new BMenu(TR("Help"));
menu->AddItem(new BMenuItem(TR("About" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED), 0));
fMenubar->AddItem(menu);
BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL);
fSettingsView = new BluetoothSettingsView("Settings");
fSettingsView = new BluetoothSettingsView(TR("Settings"));
// fConnChan = new ConnChanView("Connections & Channels", B_WILL_DRAW);
fRemoteDevices = new RemoteDevicesView("Remote Devices", B_WILL_DRAW);
fRemoteDevices = new RemoteDevicesView(TR("Remote Devices"), B_WILL_DRAW);
tabView->AddTab(fRemoteDevices);
// tabView->AddTab(fConnChan);
@@ -9,8 +9,10 @@
#include "defs.h"
#include <Bitmap.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <SpaceLayoutItem.h>
#include <StringView.h>
@@ -28,8 +30,9 @@ ExtendedLocalDeviceView::ExtendedLocalDeviceView(BRect frame, LocalDevice* bDevi
fDeviceView = new BluetoothDeviceView(BRect(0,0,5,5), bDevice);
fDiscoverable = new BCheckBox(iDontCare, "Discoverable","Discoverable", new BMessage(SET_DISCOVERABLE));
fVisible = new BCheckBox(iDontCare, "Visible", "Show Name", new BMessage(SET_VISIBLE));
fDiscoverable = new BCheckBox(iDontCare, "Discoverable", TR("Discoverable"),
new BMessage(SET_DISCOVERABLE));
fVisible = new BCheckBox(iDontCare, "Visible", TR("Show Name"), new BMessage(SET_VISIBLE));
fDiscoverable->SetEnabled(false);
fVisible->SetEnabled(false);
+16 -13
View File
@@ -5,7 +5,9 @@
#include <Alert.h>
#include <Button.h>
#include <Catalog.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <ListView.h>
#include <ListItem.h>
#include <MessageRunner.h>
@@ -94,7 +96,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
fScanProgress = new BStatusBar("status", "Scanning progress", "");
fScanProgress = new BStatusBar("status", TR("Scanning progress"), "");
activeColor = fScanProgress->BarColor();
if (fLocalDevice == NULL)
@@ -106,10 +108,10 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fMessage->MakeEditable(false);
fMessage->MakeSelectable(false);
fInquiryButton = new BButton("Inquiry", "Inquiry",
fInquiryButton = new BButton("Inquiry", TR("Inquiry"),
new BMessage(kMsgInquiry), B_WILL_DRAW);
fAddButton = new BButton("add", "Add device to list",
fAddButton = new BButton("add", TR("Add device to list"),
new BMessage(kMsgAddToRemoteList), B_WILL_DRAW);
fAddButton->SetEnabled(false);
@@ -120,11 +122,11 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
if (fLocalDevice != NULL) {
fMessage->SetText("Check that the bluetooth capabilities of your remote device"
fMessage->SetText(TR("Check that the bluetooth capabilities of your remote device"
" are activated. Press Inquiry to start scanning. The needed time"
" for the retrieval of the names is unknown, although should not"
" take more than 3 seconds per device. Afterwards you will be able"
" to add them to your main list, where you will be able to pair with them");
" to add them to your main list, where you will be able to pair with them"));
fInquiryButton->SetEnabled(true);
fDiscoveryAgent = fLocalDevice->GetDiscoveryAgent();
fDiscoveryListener = new PanelDiscoveryListener(this);
@@ -134,8 +136,8 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
} else {
fMessage->SetText("There has not been found any bluetooth LocalDevice device registered"
" on the system");
fMessage->SetText(TR("There has not been found any bluetooth LocalDevice device registered"
" on the system"));
fInquiryButton->SetEnabled(false);
}
@@ -210,7 +212,7 @@ InquiryPanel::MessageReceived(BMessage *message)
fRemoteList->MakeEmpty();
fScanProgress->Reset();
fScanProgress->SetTo(1);
fScanProgress->SetTrailingText("Starting scan...");
fScanProgress->SetTrailingText(TR("Starting scan..."));
fScanProgress->SetBarColor(activeColor);
fAddButton->SetEnabled(false);
@@ -230,18 +232,19 @@ InquiryPanel::MessageReceived(BMessage *message)
fRetrieving = true;
labelPlaced = false;
fScanProgress->SetTo(100);
fScanProgress->SetTrailingText("Retrieving names...");
fScanProgress->SetTrailingText(TR("Retrieving names..."));
BMessageRunner::StartSending(fMessenger, fRetrieveMessage, 1000000, 1);
break;
case kMsgSecond:
if (fScanning && scanningTime < timer) {
BString elapsedTime = "Remaining ";
// TODO time formatting could use Locale Kit
BString elapsedTime = TR("Remaining ");
fScanProgress->SetTo(scanningTime*100/timer); // TODO should not be needed if SetMaxValue works...
elapsedTime << (int)(timer - scanningTime) << " seconds";
elapsedTime << (int)(timer - scanningTime) << TR(" seconds");
fScanProgress->SetTrailingText(elapsedTime.String());
scanningTime = scanningTime + 1;
@@ -257,7 +260,7 @@ InquiryPanel::MessageReceived(BMessage *message)
if (!labelPlaced) {
labelPlaced = true;
BString progressText = "Retrieving name of ";
BString progressText = TR("Retrieving name of ");
progressText << bdaddrUtils::ToString(fDiscoveryAgent->RetrieveDevices(0).ItemAt(
retrievalIndex)->GetBluetoothAddress());
fScanProgress->SetTrailingText(progressText.String());
@@ -281,7 +284,7 @@ InquiryPanel::MessageReceived(BMessage *message)
retrievalIndex = 0;
fScanProgress->SetBarColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fScanProgress->SetTrailingText("Scanning completed.");
fScanProgress->SetTrailingText(TR("Scanning completed."));
fInquiryButton->SetEnabled(true);
UpdateListStatus();
}
+14
View File
@@ -17,3 +17,17 @@ Preference Bluetooth :
: be libbluetooth.so $(TARGET_LIBSUPC++)
;
DoCatalogs Bluetooth :
x-vnd.Haiku-BluetoothPrefs
:
BluetoothDeviceView.cpp
BluetoothMain.cpp
BluetoothSettingsView.cpp
BluetoothWindow.cpp
ExtendedLocalDeviceView.cpp
InquiryPanel.cpp
RemoteDevicesView.cpp
: en.catalog
: fr.catkeys
;
@@ -5,10 +5,12 @@
#include <stdio.h>
#include <Alert.h>
#include <Catalog.h>
#include <Directory.h>
#include <Entry.h>
#include <File.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <Messenger.h>
#include <Path.h>
#include <SpaceLayoutItem.h>
@@ -31,21 +33,21 @@ RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
addButton = new BButton("add", "Add" B_UTF8_ELLIPSIS,
addButton = new BButton("add", TR("Add" B_UTF8_ELLIPSIS),
new BMessage(kMsgAddDevices));
removeButton = new BButton("remove", "Remove",
removeButton = new BButton("remove", TR("Remove"),
new BMessage(kMsgRemoveDevice));
trustButton = new BButton("trust", "As Trusted",
trustButton = new BButton("trust", TR("As Trusted"),
new BMessage(kMsgTrustDevice));
blockButton = new BButton("trust", "As Blocked",
blockButton = new BButton("trust", TR("As Blocked"),
new BMessage(kMsgBlockDevice));
availButton = new BButton("check", "Refresh" B_UTF8_ELLIPSIS,
availButton = new BButton("check", TR("Refresh" B_UTF8_ELLIPSIS),
new BMessage(kMsgRefreshDevices));
+50
View File
@@ -0,0 +1,50 @@
1 french x-vnd.Haiku-BluetoothPrefs 698965680
Defaults Device View Défaut
Refresh LocalDevicesxE2x80xA6 Device View Rafraîchir LocalDevicesxE2x80xA6
Scanning progress Device View Avancée du balayage
Discoverable Device View Découvrable
Stop Bluetooth ServicesxE2x80xA6 Device View Arrêter les services bluetoothxE2x80xA6
Remove Device View Enlever
As Blocked Device View Bloqué
Always ask Device View Toujours demander
Settings Device View Réglages
As Trusted Device View De confiance
Server Device View Serveur
Check that the bluetooth capabilities of your remote device are activated. Press Inquiry to start scanning. The needed time for the retrieval of the names is unknown, although should not take more than 3 seconds per device. Afterwards you will be able to add them to your main list, where you will be able to pair with them Device View Vérifiez que les fonctionalités bluetooth de votre appareil distant sont activées. Appuyez sur Recherche pour lancer un balayage. Le temps nécessaire pour récupérer les noms est inconnu, mais ne devrait pas dépasser 3 secondes par appareil. Ensuite vous pourrez les ajouter à la liste principale, puis vous associer avec eux.
Identify host as: Device View Identifier l'hôte comme :
Incoming connections policy: Device View Attitude pour les connexiosn entrantes :
There has not been found any bluetooth LocalDevice device registered on the system Device View Aucun LocalDevice bluetooth n'est enregistré sur ce système
Local Devices found on system: Device View Appareils locaux trouvés sur le système :
Only from Trusted devices Device View Seulement les appareils de confiance
Add device to list Device View Ajouter l'appareil à la liste
Inquiry Device View Recherche
Remote Devices Device View Appareils distants
Retrieving name of Device View Récupère le nom de
Smart Phone Device View Smart Phone
Identify us as... Device View S'identifier comme...
Scanning completed. Device View Balayage complet.
Show Bluetooth consolexE2x80xA6 Device View Afficher la console bluetoothxE2x80xA6
Handheld Device View PDA
15 secs Device View 15 secs
Help Device View Aide
Revert Device View Défaire
Start Bluetooth ServicesxE2x80xA6 Device View Démarrer les serrvices bluetoothxE2x80xA6
61 secs Device View 61 secs
Default Inquiry time: Device View Temps de recherche par défaut :
Connections & Channels listxE2x80xA6 Device View Liste des canaux et connexionsxE2x80xA6
seconds Device View secondes
Policy... Device View Attitude...
Show Name Device View Montrer le nom
Laptop Device View Portable
AboutxE2x80xA6 Device View À proposxE2x80xA6
Service Classes: Device View Classes de services:
Remaining Device View Restant
Pick LocalDevice... Device View Sélectionner LocalDevice...
Remote Devices ListxE2x80xA6 Device View Liste des appareils distantsxE2x80xA6
RefreshxE2x80xA6 Device View RafraîchirxE2x80xA6
AddxE2x80xA6 Device View AjouterxE2x80xA6
View Device View Vue
Desktop Device View Bureau
Retrieving names... Device View Récupération des noms...
Starting scan... Device View Début du balayage...
From all devices Device View Depuis tous les appareils