Patch by Mike Roll: i18n ProcessController

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39938 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-12-24 09:59:07 +00:00
parent 0e07d4c078
commit 95fcf73946
6 changed files with 165 additions and 73 deletions

View File

@ -20,6 +20,16 @@ Application ProcessController :
ThreadBarMenu.cpp
ThreadBarMenuItem.cpp
Utilities.cpp
: be $(TARGET_LIBSUPC++)
: be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
: ProcessController.rdef
;
;
DoCatalogs ProcessController :
x-vnd.Haiku-ProcessController
:
ProcessController.cpp
NoiseBarMenuItem.cpp
PCWorld.cpp
Preferences.cpp
PriorityMenu.cpp
;

View File

@ -19,13 +19,15 @@
#include "NoiseBarMenuItem.h"
#include "Catalog.h"
#include "Colors.h"
#include "ProcessController.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProcessController"
NoiseBarMenuItem::NoiseBarMenuItem()
: BMenuItem("Gone teams" B_UTF8_ELLIPSIS, NULL)
: BMenuItem(B_TRANSLATE("Gone teams"B_UTF8_ELLIPSIS), NULL)
{
fBusyWaiting = -1;
fLost = -1;

View File

@ -28,6 +28,7 @@
#include <Alert.h>
#include <Application.h>
#include <Catalog.h>
#include <Deskbar.h>
#include <Roster.h>
@ -36,6 +37,10 @@
#include <string.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProcessController"
class PCApplication : public BApplication {
public:
PCApplication();
@ -50,10 +55,10 @@ const char* kSignature = "application/x-vnd.Haiku-ProcessController";
const char* kTrackerSig = "application/x-vnd.Be-TRAK";
const char* kDeskbarSig = "application/x-vnd.Be-TSKB";
const char* kTerminalSig = "application/x-vnd.Haiku-Terminal";
const char* kPreferencesFileName = "ProcessController Prefs";
const char* kPreferencesFileName = B_TRANSLATE("ProcessController Prefs");
const char* kPosPrefName = "Position";
const char* kVersionName = "Version";
const char* kPosPrefName = B_TRANSLATE("Position");
const char* kVersionName = B_TRANSLATE("Version");
const int kCurrentVersion = 311;
thread_id id = 0;
@ -81,9 +86,11 @@ PCApplication::ReadyToRun()
BDeskbar deskbar;
if (!deskbar.HasItem(kDeskbarItemName)) {
// We're not yet installed in the Deskbar, ask if we should
BAlert* alert = new BAlert("", "You can run PowerStatus in a window "
"or install it in the Deskbar.", "Run in window",
"Install in Deskbar", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
BAlert* alert = new BAlert("",
B_TRANSLATE("You can run PowerStatus in a window"
" or install it in the Deskbar."), B_TRANSLATE("Run in window"),
B_TRANSLATE("Install in Deskbar"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() != 0) {
@ -95,7 +102,8 @@ PCApplication::ReadyToRun()
}
} else {
BAlert* alert = new BAlert("",
"ProcessController is already installed in Deskbar.", "OK", NULL,
B_TRANSLATE("ProcessController is already installed in Deskbar."),
B_TRANSLATE("OK"), NULL,
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
@ -139,8 +147,9 @@ PCApplication::ArgvReceived(int32 argc, char **argv)
move_to_deskbar(deskbar);
} else if (argc > 1) {
// print a simple usage string
printf("Usage: %s [-deskbar]\n", argv[0]);
printf("(c) 1996-2001 Georges-Edouard Berenger, berenger@francenet.fr\n");
printf(B_TRANSLATE("Usage: %s [-deskbar]\n"), argv[0]);
printf(B_TRANSLATE("(c) 1996-2001 Georges-Edouard Berenger, "
"berenger@francenet.fr\n"));
}
Quit();

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <Alert.h>
#include <Catalog.h>
#include <Directory.h>
#include <File.h>
#include <FindDirectory.h>
@ -33,9 +34,11 @@
#include <Mime.h>
#include <Path.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProcessController"
Preferences::Preferences(const char* name, const char* signature, bool doSave)
: BMessage('Pref'), BLocker("Preferences", true),
: BMessage('Pref'), BLocker(B_TRANSLATE("Preferences"), true),
fSavePreferences(doSave)
{
fNewPreferences = false;
@ -62,7 +65,7 @@ Preferences::Preferences(const char* name, const char* signature, bool doSave)
Preferences::Preferences(const entry_ref &ref, const char* signature, bool doSave)
: BMessage('Pref'), BLocker("Preferences", true),
: BMessage('Pref'), BLocker(B_TRANSLATE("Preferences"), true),
fSavePreferences(doSave)
{
fSettingsFile = new entry_ref(ref);
@ -106,10 +109,12 @@ Preferences::~Preferences()
} else {
// implement saving somewhere else!
char error[1024];
sprintf(error, "Your setting file could not be saved!\n(%s)",
sprintf(error, B_TRANSLATE("Your setting file"
"could not be saved!\n(%s)"),
strerror(file.InitCheck()));
BAlert *alert = new BAlert("Error saving file", error,
"Damned!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert *alert = new BAlert(B_TRANSLATE("Error saving file"), error,
B_TRANSLATE("Damned!"), NULL, NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);
alert->Go();
}
}

View File

@ -21,11 +21,14 @@
#include "PriorityMenu.h"
#include "ProcessController.h"
#include <Catalog.h>
#include <MenuItem.h>
#include <Window.h>
#include <stdio.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProcessController"
PriorityMenu::PriorityMenu(thread_id thread, int32 priority)
: BMenu(B_EMPTY_STRING),
@ -65,7 +68,7 @@ static PriorityRec priorities[] = {
{"", -1}
};
PriorityRec customPriority = { "Custom", 0 };
PriorityRec customPriority = {"Custom", 0 };
void
@ -86,9 +89,9 @@ PriorityMenu::BuildMenu()
index--;
}
message = new BMessage('PrTh');
message->AddInt32("thread", fThreadID);
message->AddInt32("priority", priority->priority);
sprintf(name, "%s priority [%d]", priority->name, (int)priority->priority);
message->AddInt32(B_TRANSLATE("thread"), fThreadID);
message->AddInt32(B_TRANSLATE("priority"), priority->priority);
sprintf(name, B_TRANSLATE("%s priority [%d]"), priority->name, (int)priority->priority);
item = new BMenuItem(name, message);
item->SetTarget(gPCView);
if (fPriority == priority->priority)

View File

@ -27,6 +27,7 @@
#include <Alert.h>
#include <Bitmap.h>
#include <Catalog.h>
#include <debugger.h>
#include <Deskbar.h>
#include <Directory.h>
@ -56,6 +57,10 @@
#include "Utilities.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "ProcessController"
const char* kDeskbarItemName = "ProcessController";
const char* kClassName = "ProcessController";
@ -248,8 +253,11 @@ ProcessController::MessageReceived(BMessage *message)
break;
case 'QtTm':
if (message->FindInt32("team", &team) == B_OK)
resume_thread(spawn_thread(thread_quit_application, "Quit application", B_NORMAL_PRIORITY, (void*) team));
if (message->FindInt32("team", &team) == B_OK) {
resume_thread(spawn_thread(thread_quit_application,
B_TRANSLATE("Quit application"), B_NORMAL_PRIORITY,
(void*) team));
}
break;
case 'KlTm':
@ -257,13 +265,20 @@ ProcessController::MessageReceived(BMessage *message)
info_pack infos;
if (get_team_info(team, &infos.team_info) == B_OK) {
get_team_name_and_icon(infos);
sprintf(question, "Do you really want to kill the team \"%s\"?", infos.team_name);
alert = new BAlert("", question, "Cancel", "Yes, kill this team!", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
sprintf(question,
B_TRANSLATE("Do you really want to kill the team \"%s\"?"),
infos.team_name);
alert = new BAlert("", question,
B_TRANSLATE("Cancel"), B_TRANSLATE("Yes, kill this team!"),
NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go())
kill_team(team);
} else {
alert = new BAlert("", "This team is already gone" B_UTF8_ELLIPSIS, "Ok!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert = new BAlert("", B_TRANSLATE("This team is already "
"gone"B_UTF8_ELLIPSIS),
B_TRANSLATE("Ok!"), NULL, NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);
alert->Go();
}
}
@ -274,12 +289,19 @@ ProcessController::MessageReceived(BMessage *message)
thread_info thinfo;
if (get_thread_info(thread, &thinfo) == B_OK) {
#if DEBUG_THREADS
sprintf(question, "What do you want to do with the thread \"%s\"?", thinfo.name);
alert = new BAlert("", question, "Cancel", "Debug this thread!", "Kill this thread!", B_WIDTH_AS_USUAL, B_STOP_ALERT);
sprintf(question, B_TRANSLATE("What do you want to do "
"with the thread \"%s\"?"), thinfo.name);
alert = new BAlert("", question, B_TRANSLATE("Cancel"),
B_TRANSLATE("Debug this thread!"),
B_TRANSLATE("Kill this thread!"), B_WIDTH_AS_USUAL,
B_STOP_ALERT);
#define KILL 2
#else
sprintf(question, "Are you sure you want to kill the thread \"%s\"?", thinfo.name);
alert = new BAlert("", question, "Cancel", "Kill this thread!", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
sprintf(question, B_TRANSLATE("Are you sure you want "
"to kill the thread \"%s\"?"), thinfo.name);
alert = new BAlert("", question, B_TRANSLATE("Cancel"),
B_TRANSLATE("Kill this thread!"), NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);
#define KILL 1
#endif
alert->SetShortcut(0, B_ESCAPE);
@ -295,11 +317,14 @@ ProcessController::MessageReceived(BMessage *message)
else
param->sem = -1;
param->totalTime = thinfo.user_time+thinfo.kernel_time;
resume_thread(spawn_thread(thread_debug_thread, "Debug thread", B_NORMAL_PRIORITY, param));
resume_thread(spawn_thread(thread_debug_thread,
B_TRANSLATE("Debug thread"), B_NORMAL_PRIORITY, param));
}
#endif
} else {
alert = new BAlert("", "This thread is already gone" B_UTF8_ELLIPSIS, "Ok!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert = new BAlert("", B_TRANSLATE("This thread is "
"already gone"B_UTF8_ELLIPSIS), B_TRANSLATE("Ok!"),
NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go();
}
}
@ -349,8 +374,10 @@ ProcessController::MessageReceived(BMessage *message)
}
}
if (last) {
alert = new BAlert("", "This is the last active processor...\nYou can't turn it off!",
"That's no Fun!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert = new BAlert("", B_TRANSLATE("This is the last "
"active processor...\nYou can't turn it off!"),
B_TRANSLATE("That's no Fun!"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go();
} else
_kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
@ -371,10 +398,12 @@ ProcessController::MessageReceived(BMessage *message)
void
ProcessController::AboutRequested()
{
BAlert *alert = new BAlert("about", "ProcessController\n\n"
"Copyright 1997-2001,\n"
"Georges-Edouard Berenger.\n\n"
"Copyright " B_UTF8_COPYRIGHT " 2007 Haiku, Inc.\n", "OK");
BAlert *alert = new BAlert(B_TRANSLATE("about"),
B_TRANSLATE("ProcessController\n\n"
"Copyright 1997-2001,\n"
"Georges-Edouard Berenger.\n\n"
"Copyright "B_UTF8_COPYRIGHT" 2007 Haiku, Inc.\n"),
B_TRANSLATE("OK"));
BTextView *view = alert->TextView();
BFont font;
@ -434,7 +463,8 @@ ProcessController::AttachedToWindow()
gKernelColorSelected = tint_color(gKernelColor, B_HIGHLIGHT_BACKGROUND_TINT);
gUserColor = tint_color(gKernelColor, B_LIGHTEN_2_TINT);
gUserColorSelected = tint_color(gUserColor, B_HIGHLIGHT_BACKGROUND_TINT);
gFrameColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_HIGHLIGHT_BACKGROUND_TINT);
gFrameColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_HIGHLIGHT_BACKGROUND_TINT);
gFrameColorSelected = tint_color(gFrameColor, B_HIGHLIGHT_BACKGROUND_TINT);
gMenuBackColor = ui_color(B_MENU_BACKGROUND_COLOR);
gMenuBackColorSelected = ui_color(B_MENU_SELECTION_BACKGROUND_COLOR);
@ -462,7 +492,8 @@ ProcessController::MouseDown(BPoint where)
ConvertToScreen (&param->clickToOpenRect);
param->top = where.y < BScreen(this->Window()).Frame().bottom-50;
gPopupThreadID = spawn_thread(thread_popup, "Popup holder thread",
gPopupThreadID = spawn_thread(thread_popup,
B_TRANSLATE("Popup holder thread"),
B_URGENT_DISPLAY_PRIORITY, param);
resume_thread(gPopupThreadID);
}
@ -496,12 +527,15 @@ ProcessController::DoDraw(bool force)
if (force) {
SetHighColor(frame_color);
StrokeRect(BRect(left - 1, top - 1, right, bottom + 1));
if (gCPUcount == 2)
StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth, bottom));
if (gCPUcount == 2) {
StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth,
bottom));
}
}
float leftMem = bounds.Width() - layout[gCPUcount].mem_width;
if (force)
StrokeRect(BRect(leftMem - 1, top - 1, leftMem + layout[gCPUcount].mem_width, bottom + 1));
StrokeRect(BRect(leftMem - 1, top - 1,
leftMem + layout[gCPUcount].mem_width, bottom + 1));
for (int x = 0; x < gCPUcount; x++) {
right = left + barWidth - 1;
@ -522,7 +556,8 @@ ProcessController::DoDraw(bool force)
rgb_color fraction_color;
mix_colors(fraction_color, idle_color, active_color, rem);
SetHighColor(fraction_color);
StrokeLine(BPoint(left, bottom - barHeight), BPoint(right, bottom - barHeight));
StrokeLine(BPoint(left, bottom - barHeight), BPoint(right,
bottom - barHeight));
}
float active_bottom = bottom;
if (!force && previousLimit < bottom)
@ -559,7 +594,8 @@ ProcessController::DoDraw(bool force)
rgb_color fraction_color;
mix_colors(fraction_color, idle_color, used_memory_color, rem);
SetHighColor(fraction_color);
StrokeLine(BPoint(leftMem, bottom - barHeight), BPoint(rightMem, bottom - barHeight));
StrokeLine(BPoint(leftMem, bottom - barHeight), BPoint(rightMem,
bottom - barHeight));
}
float usedBottom = bottom;
// if (!force && previousLimit < bottom)
@ -622,7 +658,8 @@ thread_popup(void *arg)
if (get_next_team_info(&mcookie, &infos[m].team_info) == B_OK) {
infos[m].thread_info = new thread_info[infos[m].team_info.thread_count];
for (h = 0, hcookie = 0; h < infos[m].team_info.thread_count; h++) {
if (get_next_thread_info(infos[m].team_info.team, &hcookie, &infos[m].thread_info[h]) != B_OK)
if (get_next_thread_info(infos[m].team_info.team, &hcookie,
&infos[m].thread_info[h]) != B_OK)
infos[m].thread_info[h].thread = -1;
}
get_team_name_and_icon(infos[m], true);
@ -632,20 +669,24 @@ thread_popup(void *arg)
}
}
BPopUpMenu* popup = new BPopUpMenu("Global Popup", false, false);
BPopUpMenu* popup = new BPopUpMenu(B_TRANSLATE("Global Popup"), false, false);
popup->SetFont(be_plain_font);
// Quit section
BMenu* QuitPopup = new QuitMenu("Quit an application", infos, systemInfo.used_teams);
BMenu* QuitPopup = new QuitMenu(B_TRANSLATE("Quit an application"),
infos, systemInfo.used_teams);
QuitPopup->SetFont(be_plain_font);
popup->AddItem(QuitPopup);
// Memory Usage section
MemoryBarMenu* MemoryPopup = new MemoryBarMenu("Memory usage", infos, systemInfo);
MemoryBarMenu* MemoryPopup = new MemoryBarMenu(B_TRANSLATE("Memory usage"),
infos, systemInfo);
int commitedMemory = int(systemInfo.used_pages * B_PAGE_SIZE / 1024);
for (m = 0; m < systemInfo.used_teams; m++) {
if (infos[m].team_info.team >= 0) {
MemoryBarMenuItem* memoryItem = new MemoryBarMenuItem(infos[m].team_name, infos[m].team_info.team, infos[m].team_icon, false, NULL);
MemoryBarMenuItem* memoryItem =
new MemoryBarMenuItem(infos[m].team_name,
infos[m].team_info.team, infos[m].team_icon, false, NULL);
MemoryPopup->AddItem(memoryItem);
memoryItem->UpdateSituation(commitedMemory);
}
@ -654,13 +695,16 @@ thread_popup(void *arg)
addtopbottom(MemoryPopup);
// CPU Load section
TeamBarMenu* CPUPopup = new TeamBarMenu("Threads and CPU usage", infos, systemInfo.used_teams);
TeamBarMenu* CPUPopup = new TeamBarMenu(B_TRANSLATE("Threads and CPU "
"usage"), infos, systemInfo.used_teams);
for (m = 0; m < systemInfo.used_teams; m++) {
if (infos[m].team_info.team >= 0) {
ThreadBarMenu* TeamPopup = new ThreadBarMenu(infos[m].team_name, infos[m].team_info.team, infos[m].team_info.thread_count);
ThreadBarMenu* TeamPopup = new ThreadBarMenu(infos[m].team_name,
infos[m].team_info.team, infos[m].team_info.thread_count);
BMessage* kill_team = new BMessage('KlTm');
kill_team->AddInt32("team", infos[m].team_info.team);
TeamBarMenuItem* item = new TeamBarMenuItem(TeamPopup, kill_team, infos[m].team_info.team, infos[m].team_icon, false);
TeamBarMenuItem* item = new TeamBarMenuItem(TeamPopup, kill_team,
infos[m].team_info.team, infos[m].team_icon, false);
item->SetTarget(gPCView);
CPUPopup->AddItem(item);
}
@ -673,9 +717,9 @@ thread_popup(void *arg)
if (gCPUcount > 1) {
for (int i = 0; i < gCPUcount; i++) {
char item_name[32];
sprintf (item_name, "Processor %d", i + 1);
sprintf (item_name, B_TRANSLATE("Processor %d"), i + 1);
BMessage* m = new BMessage ('CPU ');
m->AddInt32 ("cpu", i);
m->AddInt32 (B_TRANSLATE("cpu"), i);
item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m);
if (_kern_cpu_enabled(i))
item->SetMarked (true);
@ -686,24 +730,28 @@ thread_popup(void *arg)
}
if (!be_roster->IsRunning(kTrackerSig)) {
item = new IconMenuItem(gPCView->fTrackerIcon, "Restart Tracker", new BMessage('Trac'));
item = new IconMenuItem(gPCView->fTrackerIcon,
B_TRANSLATE("Restart Tracker"), new BMessage('Trac'));
item->SetTarget(gPCView);
addtopbottom(item);
}
if (!be_roster->IsRunning(kDeskbarSig)) {
item = new IconMenuItem(gPCView->fDeskbarIcon, "Restart Deskbar", new BMessage('Dbar'));
item = new IconMenuItem(gPCView->fDeskbarIcon,
B_TRANSLATE("Restart Deskbar"), new BMessage('Dbar'));
item->SetTarget(gPCView);
addtopbottom(item);
}
item = new IconMenuItem(gPCView->fTerminalIcon, "New Terminal", new BMessage('Term'));
item = new IconMenuItem(gPCView->fTerminalIcon,
B_TRANSLATE("New Terminal"), new BMessage('Term'));
item->SetTarget(gPCView);
addtopbottom(item);
addtopbottom(new BSeparatorItem());
if (be_roster->IsRunning(kDeskbarSig)) {
item = new BMenuItem("Live in the Deskbar", new BMessage('AlDb'));
item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"),
new BMessage('AlDb'));
BDeskbar deskbar;
item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName));
item->SetTarget(gPCView);
@ -711,7 +759,8 @@ thread_popup(void *arg)
addtopbottom(new BSeparatorItem ());
}
item = new IconMenuItem(gPCView->fProcessControllerIcon, "About ProcessController" B_UTF8_ELLIPSIS,
item = new IconMenuItem(gPCView->fProcessControllerIcon,
B_TRANSLATE("About ProcessController"B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED));
item->SetTarget(gPCView);
addtopbottom(item);
@ -755,15 +804,17 @@ thread_debug_thread(void *arg)
thread_info thinfo;
get_thread_info(param->thread, &thinfo);
char text[4096];
sprintf(text, "db %d", int(param->thread));
sprintf(text, B_TRANSLATE("db %d"), int(param->thread));
system(text);
if (param->sem >= 0 && thinfo.state == B_THREAD_WAITING && param->sem == thinfo.sem) {
if (param->sem >= 0 && thinfo.state == B_THREAD_WAITING && param->sem
== thinfo.sem) {
snooze(1000000);
get_thread_info(param->thread, &thinfo);
if (thinfo.state == B_THREAD_WAITING
&& param->sem == thinfo.sem
&& param->totalTime == thinfo.user_time + thinfo.kernel_time) {
// the thread has been waiting for this semaphore since the before the alert, not doing anything... Let's push it out of there!
// the thread has been waiting for this semaphore since the before
// the alert, not doing anything... Let's push it out of there!
sem_info sinfo;
thread_info thinfo;
info_pack infos;
@ -771,28 +822,40 @@ thread_debug_thread(void *arg)
if (get_sem_info(param->sem, &sinfo) == B_OK
&& get_thread_info(param->thread, &thinfo) == B_OK
&& get_team_info(thinfo.team, &infos.team_info) == B_OK) {
sprintf (text, "This thread is waiting for the semaphore called \"%s\". As long as it waits for this semaphore, "
"you won't be able to debug that thread.\n", sinfo.name);
sprintf (text, B_TRANSLATE("This thread is waiting for the "
"semaphore called \"%s\". As long as it waits for this "
"semaphore, ")
B_TRANSLATE("you won't be able to debug that thread.\n"),
sinfo.name);
if (sinfo.team == thinfo.team)
strcat(text, "This semaphore belongs to the thread's team.\n\nShould I release this semaphore?\n");
strcat(text, B_TRANSLATE("This semaphore belongs to the "
"thread's team.\n\nShould I release this semaphore?\n"));
else {
get_team_name_and_icon(infos);
char moreText[1024];
sprintf(moreText, "\nWARNING! This semaphore belongs to the team \"%s\"!\n\nShould I release this semaphore anyway?\n",
sprintf(moreText, B_TRANSLATE("\nWARNING! This semaphore "
"belongs to the team \"%s\"!\n\nShould I release this "
"semaphore anyway?\n"),
infos.team_name);
strcat(text, moreText);
}
BAlert* alert = new BAlert("", text, "Cancel", "Release", NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert* alert = new BAlert("", text, B_TRANSLATE("Cancel"),
B_TRANSLATE("Release"), NULL, B_WIDTH_AS_USUAL,
B_STOP_ALERT);
alert->SetShortcut(0, B_ESCAPE);
if (alert->Go()) {
get_thread_info (param->thread, &thinfo);
if (thinfo.state == B_THREAD_WAITING && param->sem == thinfo.sem
&& param->totalTime == thinfo.user_time + thinfo.kernel_time)
if (thinfo.state == B_THREAD_WAITING && param->sem
== thinfo.sem
&& param->totalTime == thinfo.user_time
+ thinfo.kernel_time)
release_sem(param->sem);
else {
alert = new BAlert("", "The semaphore wasn't released, because it wasn't necessary anymore!", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert = new BAlert("", B_TRANSLATE("The semaphore "
"wasn't released, because it wasn't necessary "
"anymore!"), B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go();
}
}