From dd4b6c23f62e6a83480d11da50c25a74897d0660 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Fri, 7 May 2010 00:25:49 +0000 Subject: [PATCH] Updated to use B_TRANSLATE* macros. relates to #5408. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36695 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/sounds/HApp.cpp | 8 ++--- src/preferences/sounds/HEventList.cpp | 20 ++++++------ src/preferences/sounds/HWindow.cpp | 44 +++++++++++++++------------ 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/preferences/sounds/HApp.cpp b/src/preferences/sounds/HApp.cpp index 005cb6acdc..7185bf15ad 100644 --- a/src/preferences/sounds/HApp.cpp +++ b/src/preferences/sounds/HApp.cpp @@ -30,7 +30,7 @@ HApp::HApp() BRect rect; rect.Set(200, 150, 590, 570); - HWindow* window = new HWindow(rect, TR("Sounds")); + HWindow* window = new HWindow(rect, B_TRANSLATE("Sounds")); window->Show(); } @@ -43,14 +43,14 @@ HApp::~HApp() void HApp::AboutRequested() { - BAlert* alert = new BAlert(TR("About Sounds"), - TR("Sounds\n" + BAlert* alert = new BAlert(B_TRANSLATE("About Sounds"), + B_TRANSLATE("Sounds\n" " Brought to you by :\n" "\tOliver Ruiz Dorantes\n" "\tJérôme DUVAL.\n" " Original work from Atsushi Takamatsu.\n" "Copyright ©2003-2006 Haiku"), - TR("OK")); + B_TRANSLATE("OK")); alert->Go(); } diff --git a/src/preferences/sounds/HEventList.cpp b/src/preferences/sounds/HEventList.cpp index 03e566010a..4d353dd75e 100644 --- a/src/preferences/sounds/HEventList.cpp +++ b/src/preferences/sounds/HEventList.cpp @@ -43,7 +43,7 @@ HEventRow::SetPath(const char* _path) { fPath = _path; BPath path(_path); - SetField(new BStringField(_path ? path.Leaf() : TR("")), + SetField(new BStringField(_path ? path.Leaf() : B_TRANSLATE("")), kSoundColumn); } @@ -60,10 +60,10 @@ HEventList::HEventList(const char* name) BColumnListView(name, 0, B_PLAIN_BORDER, true), fType(NULL) { - AddColumn(new BStringColumn(TR("Event"), 150, 50, 500, B_TRUNCATE_MIDDLE), - kEventColumn); - AddColumn(new BStringColumn(TR("Sound"), 150, 50, 500, B_TRUNCATE_END), - kSoundColumn); + AddColumn(new BStringColumn(B_TRANSLATE("Event"), 150, 50, 500, + B_TRUNCATE_MIDDLE), kEventColumn); + AddColumn(new BStringColumn(B_TRANSLATE("Sound"), 150, 50, 500, + B_TRUNCATE_END), kSoundColumn); } @@ -82,7 +82,7 @@ HEventList::SetType(const char* type) mfiles.RewindRefs(type); delete fType; fType = strdup(type); - + BString name; entry_ref ref; while (mfiles.GetNextRef(&name,&ref) == B_OK) { @@ -111,12 +111,12 @@ void HEventList::SelectionChanged() { BColumnListView::SelectionChanged(); - + HEventRow* row = (HEventRow*)CurrentSelection(); if (row != NULL) { entry_ref ref; BMediaFiles().GetRefFor(fType, row->Name(), &ref); - + BPath path(&ref); if (path.InitCheck() == B_OK || ref.name == NULL || strcmp(ref.name, "") == 0) { @@ -126,7 +126,7 @@ HEventList::SelectionChanged() printf("name %s\n", ref.name); BMediaFiles().RemoveRefFor(fType, row->Name(), ref); BAlert* alert = new BAlert("alert", - TR("No such file or directory"), TR("OK")); + B_TRANSLATE("No such file or directory"), B_TRANSLATE("OK")); alert->Go(); return; } @@ -147,7 +147,7 @@ HEventList::SetPath(const char* path) BEntry entry(path); entry.GetRef(&ref); BMediaFiles().SetRefFor(fType, row->Name(), ref); - + row->SetPath(path); UpdateRow(row); } diff --git a/src/preferences/sounds/HWindow.cpp b/src/preferences/sounds/HWindow.cpp index bb960cfc2b..bfce5a99bd 100644 --- a/src/preferences/sounds/HWindow.cpp +++ b/src/preferences/sounds/HWindow.cpp @@ -53,10 +53,10 @@ HWindow::HWindow(BRect rect, const char* name) fFilePanel = new BFilePanel(); fFilePanel->SetTarget(this); - + BPath path; BMessage msg; - + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { path.Append(kSettingsFile); BFile file(path.Path(), B_READ_ONLY); @@ -74,7 +74,7 @@ HWindow::~HWindow() { delete fFilePanel; delete fPlayer; - + BPath path; BMessage msg; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { @@ -104,20 +104,23 @@ HWindow::InitGUI() menu->SetRadioMode(true); menu->SetLabelFromMarked(true); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem(TR(""), new BMessage(M_NONE_MESSAGE))); - menu->AddItem(new BMenuItem(TR("Other" B_UTF8_ELLIPSIS), + menu->AddItem(new BMenuItem(B_TRANSLATE(""), + new BMessage(M_NONE_MESSAGE))); + menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS), new BMessage(M_OTHER_MESSAGE))); - BMenuField* menuField = new BMenuField("filemenu", TR("Sound File:"), menu); - menuField->SetDivider(menuField->StringWidth(TR("Sound File:")) + 10); + BMenuField* menuField = new BMenuField("filemenu", + B_TRANSLATE("Sound File:"), menu); + menuField->SetDivider(menuField->StringWidth(B_TRANSLATE("Sound File:")) + + 10); - BButton* stopbutton = new BButton("stop", TR("Stop"), + BButton* stopbutton = new BButton("stop", B_TRANSLATE("Stop"), new BMessage(M_STOP_MESSAGE)); stopbutton->SetEnabled(false); - BButton* playbutton = new BButton("play", TR("Play"), + BButton* playbutton = new BButton("play", B_TRANSLATE("Play"), new BMessage(M_PLAY_MESSAGE)); playbutton->SetEnabled(false); - + view->SetLayout(new BGroupLayout(B_HORIZONTAL)); view->AddChild(BGroupLayoutBuilder(B_VERTICAL, 15) .AddGroup(B_HORIZONTAL) @@ -145,7 +148,7 @@ HWindow::InitGUI() // setup file menu SetupMenuField(); - menu->FindItem(TR(""))->SetMarked(true); + menu->FindItem(B_TRANSLATE(""))->SetMarked(true); } @@ -165,7 +168,7 @@ HWindow::MessageReceived(BMessage* message) if (row != NULL) { BPath path(row->Path()); if (path.InitCheck() != B_OK) { - BMenuItem* item = menu->FindItem(TR("")); + BMenuItem* item = menu->FindItem(B_TRANSLATE("")); if (item != NULL) item->SetMarked(true); } else { @@ -187,7 +190,7 @@ HWindow::MessageReceived(BMessage* message) BMenuField* menufield = dynamic_cast(FindView("filemenu")); if (menufield == NULL) - return; + return; BMenu* menu = menufield->Menu(); // check audio file @@ -201,9 +204,10 @@ HWindow::MessageReceived(BMessage* message) if (superType.Type() == NULL || strcmp(superType.Type(), "audio") != 0) { beep(); - BAlert* alert = new BAlert("", TR("This is not an audio " - "file."), TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, - B_STOP_ALERT); + BAlert* alert = new BAlert("", + B_TRANSLATE("This is not an audio file."), + B_TRANSLATE("OK"), NULL, NULL, + B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->Go(); break; } @@ -264,7 +268,7 @@ HWindow::MessageReceived(BMessage* message) if (message->FindString("path", &path) == B_OK) { BPath path(path); if (path.InitCheck() != B_OK) { - BMenuItem* item = menu->FindItem(TR("")); + BMenuItem* item = menu->FindItem(B_TRANSLATE("")); if (item != NULL) item->SetMarked(true); } else { @@ -326,7 +330,7 @@ HWindow::SetupMenuField() BDirectory dir; BEntry entry; BPath item_path; - + status_t err = find_directory(B_BEOS_SOUNDS_DIRECTORY, &path); if (err == B_OK) err = dir.SetTo(path.Path()); @@ -370,7 +374,7 @@ HWindow::SetupMenuField() err = find_directory(B_COMMON_SOUNDS_DIRECTORY, &path); if (err == B_OK) - err = dir.SetTo(path.Path()); + err = dir.SetTo(path.Path()); while (err == B_OK) { err = dir.GetNextEntry(&entry, true); if (entry.InitCheck() != B_NO_ERROR) @@ -439,7 +443,7 @@ bool HWindow::QuitRequested() { fFrame = Frame(); - + fEventList->RemoveAll(); be_app->PostMessage(B_QUIT_REQUESTED); return true;