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
This commit is contained in:
@@ -30,7 +30,7 @@ HApp::HApp()
|
|||||||
BRect rect;
|
BRect rect;
|
||||||
rect.Set(200, 150, 590, 570);
|
rect.Set(200, 150, 590, 570);
|
||||||
|
|
||||||
HWindow* window = new HWindow(rect, TR("Sounds"));
|
HWindow* window = new HWindow(rect, B_TRANSLATE("Sounds"));
|
||||||
window->Show();
|
window->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,14 +43,14 @@ HApp::~HApp()
|
|||||||
void
|
void
|
||||||
HApp::AboutRequested()
|
HApp::AboutRequested()
|
||||||
{
|
{
|
||||||
BAlert* alert = new BAlert(TR("About Sounds"),
|
BAlert* alert = new BAlert(B_TRANSLATE("About Sounds"),
|
||||||
TR("Sounds\n"
|
B_TRANSLATE("Sounds\n"
|
||||||
" Brought to you by :\n"
|
" Brought to you by :\n"
|
||||||
"\tOliver Ruiz Dorantes\n"
|
"\tOliver Ruiz Dorantes\n"
|
||||||
"\tJérôme DUVAL.\n"
|
"\tJérôme DUVAL.\n"
|
||||||
" Original work from Atsushi Takamatsu.\n"
|
" Original work from Atsushi Takamatsu.\n"
|
||||||
"Copyright ©2003-2006 Haiku"),
|
"Copyright ©2003-2006 Haiku"),
|
||||||
TR("OK"));
|
B_TRANSLATE("OK"));
|
||||||
alert->Go();
|
alert->Go();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ HEventRow::SetPath(const char* _path)
|
|||||||
{
|
{
|
||||||
fPath = _path;
|
fPath = _path;
|
||||||
BPath path(_path);
|
BPath path(_path);
|
||||||
SetField(new BStringField(_path ? path.Leaf() : TR("<none>")),
|
SetField(new BStringField(_path ? path.Leaf() : B_TRANSLATE("<none>")),
|
||||||
kSoundColumn);
|
kSoundColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,10 +60,10 @@ HEventList::HEventList(const char* name)
|
|||||||
BColumnListView(name, 0, B_PLAIN_BORDER, true),
|
BColumnListView(name, 0, B_PLAIN_BORDER, true),
|
||||||
fType(NULL)
|
fType(NULL)
|
||||||
{
|
{
|
||||||
AddColumn(new BStringColumn(TR("Event"), 150, 50, 500, B_TRUNCATE_MIDDLE),
|
AddColumn(new BStringColumn(B_TRANSLATE("Event"), 150, 50, 500,
|
||||||
kEventColumn);
|
B_TRUNCATE_MIDDLE), kEventColumn);
|
||||||
AddColumn(new BStringColumn(TR("Sound"), 150, 50, 500, B_TRUNCATE_END),
|
AddColumn(new BStringColumn(B_TRANSLATE("Sound"), 150, 50, 500,
|
||||||
kSoundColumn);
|
B_TRUNCATE_END), kSoundColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ HEventList::SetType(const char* type)
|
|||||||
mfiles.RewindRefs(type);
|
mfiles.RewindRefs(type);
|
||||||
delete fType;
|
delete fType;
|
||||||
fType = strdup(type);
|
fType = strdup(type);
|
||||||
|
|
||||||
BString name;
|
BString name;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
while (mfiles.GetNextRef(&name,&ref) == B_OK) {
|
while (mfiles.GetNextRef(&name,&ref) == B_OK) {
|
||||||
@@ -111,12 +111,12 @@ void
|
|||||||
HEventList::SelectionChanged()
|
HEventList::SelectionChanged()
|
||||||
{
|
{
|
||||||
BColumnListView::SelectionChanged();
|
BColumnListView::SelectionChanged();
|
||||||
|
|
||||||
HEventRow* row = (HEventRow*)CurrentSelection();
|
HEventRow* row = (HEventRow*)CurrentSelection();
|
||||||
if (row != NULL) {
|
if (row != NULL) {
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BMediaFiles().GetRefFor(fType, row->Name(), &ref);
|
BMediaFiles().GetRefFor(fType, row->Name(), &ref);
|
||||||
|
|
||||||
BPath path(&ref);
|
BPath path(&ref);
|
||||||
if (path.InitCheck() == B_OK || ref.name == NULL
|
if (path.InitCheck() == B_OK || ref.name == NULL
|
||||||
|| strcmp(ref.name, "") == 0) {
|
|| strcmp(ref.name, "") == 0) {
|
||||||
@@ -126,7 +126,7 @@ HEventList::SelectionChanged()
|
|||||||
printf("name %s\n", ref.name);
|
printf("name %s\n", ref.name);
|
||||||
BMediaFiles().RemoveRefFor(fType, row->Name(), ref);
|
BMediaFiles().RemoveRefFor(fType, row->Name(), ref);
|
||||||
BAlert* alert = new BAlert("alert",
|
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();
|
alert->Go();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ HEventList::SetPath(const char* path)
|
|||||||
BEntry entry(path);
|
BEntry entry(path);
|
||||||
entry.GetRef(&ref);
|
entry.GetRef(&ref);
|
||||||
BMediaFiles().SetRefFor(fType, row->Name(), ref);
|
BMediaFiles().SetRefFor(fType, row->Name(), ref);
|
||||||
|
|
||||||
row->SetPath(path);
|
row->SetPath(path);
|
||||||
UpdateRow(row);
|
UpdateRow(row);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ HWindow::HWindow(BRect rect, const char* name)
|
|||||||
|
|
||||||
fFilePanel = new BFilePanel();
|
fFilePanel = new BFilePanel();
|
||||||
fFilePanel->SetTarget(this);
|
fFilePanel->SetTarget(this);
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
|
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||||
path.Append(kSettingsFile);
|
path.Append(kSettingsFile);
|
||||||
BFile file(path.Path(), B_READ_ONLY);
|
BFile file(path.Path(), B_READ_ONLY);
|
||||||
@@ -74,7 +74,7 @@ HWindow::~HWindow()
|
|||||||
{
|
{
|
||||||
delete fFilePanel;
|
delete fFilePanel;
|
||||||
delete fPlayer;
|
delete fPlayer;
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||||
@@ -104,20 +104,23 @@ HWindow::InitGUI()
|
|||||||
menu->SetRadioMode(true);
|
menu->SetRadioMode(true);
|
||||||
menu->SetLabelFromMarked(true);
|
menu->SetLabelFromMarked(true);
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(TR("<none>"), new BMessage(M_NONE_MESSAGE)));
|
menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
|
||||||
menu->AddItem(new BMenuItem(TR("Other" B_UTF8_ELLIPSIS),
|
new BMessage(M_NONE_MESSAGE)));
|
||||||
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(M_OTHER_MESSAGE)));
|
new BMessage(M_OTHER_MESSAGE)));
|
||||||
BMenuField* menuField = new BMenuField("filemenu", TR("Sound File:"), menu);
|
BMenuField* menuField = new BMenuField("filemenu",
|
||||||
menuField->SetDivider(menuField->StringWidth(TR("Sound File:")) + 10);
|
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));
|
new BMessage(M_STOP_MESSAGE));
|
||||||
stopbutton->SetEnabled(false);
|
stopbutton->SetEnabled(false);
|
||||||
|
|
||||||
BButton* playbutton = new BButton("play", TR("Play"),
|
BButton* playbutton = new BButton("play", B_TRANSLATE("Play"),
|
||||||
new BMessage(M_PLAY_MESSAGE));
|
new BMessage(M_PLAY_MESSAGE));
|
||||||
playbutton->SetEnabled(false);
|
playbutton->SetEnabled(false);
|
||||||
|
|
||||||
view->SetLayout(new BGroupLayout(B_HORIZONTAL));
|
view->SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
view->AddChild(BGroupLayoutBuilder(B_VERTICAL, 15)
|
view->AddChild(BGroupLayoutBuilder(B_VERTICAL, 15)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.AddGroup(B_HORIZONTAL)
|
||||||
@@ -145,7 +148,7 @@ HWindow::InitGUI()
|
|||||||
|
|
||||||
// setup file menu
|
// setup file menu
|
||||||
SetupMenuField();
|
SetupMenuField();
|
||||||
menu->FindItem(TR("<none>"))->SetMarked(true);
|
menu->FindItem(B_TRANSLATE("<none>"))->SetMarked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -165,7 +168,7 @@ HWindow::MessageReceived(BMessage* message)
|
|||||||
if (row != NULL) {
|
if (row != NULL) {
|
||||||
BPath path(row->Path());
|
BPath path(row->Path());
|
||||||
if (path.InitCheck() != B_OK) {
|
if (path.InitCheck() != B_OK) {
|
||||||
BMenuItem* item = menu->FindItem(TR("<none>"));
|
BMenuItem* item = menu->FindItem(B_TRANSLATE("<none>"));
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
} else {
|
} else {
|
||||||
@@ -187,7 +190,7 @@ HWindow::MessageReceived(BMessage* message)
|
|||||||
BMenuField* menufield
|
BMenuField* menufield
|
||||||
= dynamic_cast<BMenuField*>(FindView("filemenu"));
|
= dynamic_cast<BMenuField*>(FindView("filemenu"));
|
||||||
if (menufield == NULL)
|
if (menufield == NULL)
|
||||||
return;
|
return;
|
||||||
BMenu* menu = menufield->Menu();
|
BMenu* menu = menufield->Menu();
|
||||||
|
|
||||||
// check audio file
|
// check audio file
|
||||||
@@ -201,9 +204,10 @@ HWindow::MessageReceived(BMessage* message)
|
|||||||
if (superType.Type() == NULL
|
if (superType.Type() == NULL
|
||||||
|| strcmp(superType.Type(), "audio") != 0) {
|
|| strcmp(superType.Type(), "audio") != 0) {
|
||||||
beep();
|
beep();
|
||||||
BAlert* alert = new BAlert("", TR("This is not an audio "
|
BAlert* alert = new BAlert("",
|
||||||
"file."), TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
|
B_TRANSLATE("This is not an audio file."),
|
||||||
B_STOP_ALERT);
|
B_TRANSLATE("OK"), NULL, NULL,
|
||||||
|
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||||
alert->Go();
|
alert->Go();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -264,7 +268,7 @@ HWindow::MessageReceived(BMessage* message)
|
|||||||
if (message->FindString("path", &path) == B_OK) {
|
if (message->FindString("path", &path) == B_OK) {
|
||||||
BPath path(path);
|
BPath path(path);
|
||||||
if (path.InitCheck() != B_OK) {
|
if (path.InitCheck() != B_OK) {
|
||||||
BMenuItem* item = menu->FindItem(TR("<none>"));
|
BMenuItem* item = menu->FindItem(B_TRANSLATE("<none>"));
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
} else {
|
} else {
|
||||||
@@ -326,7 +330,7 @@ HWindow::SetupMenuField()
|
|||||||
BDirectory dir;
|
BDirectory dir;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BPath item_path;
|
BPath item_path;
|
||||||
|
|
||||||
status_t err = find_directory(B_BEOS_SOUNDS_DIRECTORY, &path);
|
status_t err = find_directory(B_BEOS_SOUNDS_DIRECTORY, &path);
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
err = dir.SetTo(path.Path());
|
err = dir.SetTo(path.Path());
|
||||||
@@ -370,7 +374,7 @@ HWindow::SetupMenuField()
|
|||||||
|
|
||||||
err = find_directory(B_COMMON_SOUNDS_DIRECTORY, &path);
|
err = find_directory(B_COMMON_SOUNDS_DIRECTORY, &path);
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
err = dir.SetTo(path.Path());
|
err = dir.SetTo(path.Path());
|
||||||
while (err == B_OK) {
|
while (err == B_OK) {
|
||||||
err = dir.GetNextEntry(&entry, true);
|
err = dir.GetNextEntry(&entry, true);
|
||||||
if (entry.InitCheck() != B_NO_ERROR)
|
if (entry.InitCheck() != B_NO_ERROR)
|
||||||
@@ -439,7 +443,7 @@ bool
|
|||||||
HWindow::QuitRequested()
|
HWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
fFrame = Frame();
|
fFrame = Frame();
|
||||||
|
|
||||||
fEventList->RemoveAll();
|
fEventList->RemoveAll();
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user