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:
@@ -20,6 +20,16 @@ Application ProcessController :
|
|||||||
ThreadBarMenu.cpp
|
ThreadBarMenu.cpp
|
||||||
ThreadBarMenuItem.cpp
|
ThreadBarMenuItem.cpp
|
||||||
Utilities.cpp
|
Utilities.cpp
|
||||||
: be $(TARGET_LIBSUPC++)
|
: be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||||
: ProcessController.rdef
|
: ProcessController.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs ProcessController :
|
||||||
|
x-vnd.Haiku-ProcessController
|
||||||
|
:
|
||||||
|
ProcessController.cpp
|
||||||
|
NoiseBarMenuItem.cpp
|
||||||
|
PCWorld.cpp
|
||||||
|
Preferences.cpp
|
||||||
|
PriorityMenu.cpp
|
||||||
|
;
|
||||||
|
|||||||
@@ -19,13 +19,15 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "NoiseBarMenuItem.h"
|
#include "NoiseBarMenuItem.h"
|
||||||
|
#include "Catalog.h"
|
||||||
#include "Colors.h"
|
#include "Colors.h"
|
||||||
#include "ProcessController.h"
|
#include "ProcessController.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ProcessController"
|
||||||
|
|
||||||
NoiseBarMenuItem::NoiseBarMenuItem()
|
NoiseBarMenuItem::NoiseBarMenuItem()
|
||||||
: BMenuItem("Gone teams" B_UTF8_ELLIPSIS, NULL)
|
: BMenuItem(B_TRANSLATE("Gone teams"B_UTF8_ELLIPSIS), NULL)
|
||||||
{
|
{
|
||||||
fBusyWaiting = -1;
|
fBusyWaiting = -1;
|
||||||
fLost = -1;
|
fLost = -1;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Deskbar.h>
|
#include <Deskbar.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
@@ -36,6 +37,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ProcessController"
|
||||||
|
|
||||||
|
|
||||||
class PCApplication : public BApplication {
|
class PCApplication : public BApplication {
|
||||||
public:
|
public:
|
||||||
PCApplication();
|
PCApplication();
|
||||||
@@ -50,10 +55,10 @@ const char* kSignature = "application/x-vnd.Haiku-ProcessController";
|
|||||||
const char* kTrackerSig = "application/x-vnd.Be-TRAK";
|
const char* kTrackerSig = "application/x-vnd.Be-TRAK";
|
||||||
const char* kDeskbarSig = "application/x-vnd.Be-TSKB";
|
const char* kDeskbarSig = "application/x-vnd.Be-TSKB";
|
||||||
const char* kTerminalSig = "application/x-vnd.Haiku-Terminal";
|
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* kPosPrefName = B_TRANSLATE("Position");
|
||||||
const char* kVersionName = "Version";
|
const char* kVersionName = B_TRANSLATE("Version");
|
||||||
const int kCurrentVersion = 311;
|
const int kCurrentVersion = 311;
|
||||||
|
|
||||||
thread_id id = 0;
|
thread_id id = 0;
|
||||||
@@ -81,9 +86,11 @@ PCApplication::ReadyToRun()
|
|||||||
BDeskbar deskbar;
|
BDeskbar deskbar;
|
||||||
if (!deskbar.HasItem(kDeskbarItemName)) {
|
if (!deskbar.HasItem(kDeskbarItemName)) {
|
||||||
// We're not yet installed in the Deskbar, ask if we should
|
// We're not yet installed in the Deskbar, ask if we should
|
||||||
BAlert* alert = new BAlert("", "You can run PowerStatus in a window "
|
BAlert* alert = new BAlert("",
|
||||||
"or install it in the Deskbar.", "Run in window",
|
B_TRANSLATE("You can run PowerStatus in a window"
|
||||||
"Install in Deskbar", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
" 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);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
|
|
||||||
if (alert->Go() != 0) {
|
if (alert->Go() != 0) {
|
||||||
@@ -95,7 +102,8 @@ PCApplication::ReadyToRun()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BAlert* alert = new BAlert("",
|
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);
|
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
alert->SetShortcut(0, B_ESCAPE);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
alert->Go();
|
alert->Go();
|
||||||
@@ -139,8 +147,9 @@ PCApplication::ArgvReceived(int32 argc, char **argv)
|
|||||||
move_to_deskbar(deskbar);
|
move_to_deskbar(deskbar);
|
||||||
} else if (argc > 1) {
|
} else if (argc > 1) {
|
||||||
// print a simple usage string
|
// print a simple usage string
|
||||||
printf("Usage: %s [-deskbar]\n", argv[0]);
|
printf(B_TRANSLATE("Usage: %s [-deskbar]\n"), argv[0]);
|
||||||
printf("(c) 1996-2001 Georges-Edouard Berenger, [email protected]\n");
|
printf(B_TRANSLATE("(c) 1996-2001 Georges-Edouard Berenger, "
|
||||||
|
"[email protected]\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Quit();
|
Quit();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -33,9 +34,11 @@
|
|||||||
#include <Mime.h>
|
#include <Mime.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ProcessController"
|
||||||
|
|
||||||
Preferences::Preferences(const char* name, const char* signature, bool doSave)
|
Preferences::Preferences(const char* name, const char* signature, bool doSave)
|
||||||
: BMessage('Pref'), BLocker("Preferences", true),
|
: BMessage('Pref'), BLocker(B_TRANSLATE("Preferences"), true),
|
||||||
fSavePreferences(doSave)
|
fSavePreferences(doSave)
|
||||||
{
|
{
|
||||||
fNewPreferences = false;
|
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)
|
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)
|
fSavePreferences(doSave)
|
||||||
{
|
{
|
||||||
fSettingsFile = new entry_ref(ref);
|
fSettingsFile = new entry_ref(ref);
|
||||||
@@ -106,10 +109,12 @@ Preferences::~Preferences()
|
|||||||
} else {
|
} else {
|
||||||
// implement saving somewhere else!
|
// implement saving somewhere else!
|
||||||
char error[1024];
|
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()));
|
strerror(file.InitCheck()));
|
||||||
BAlert *alert = new BAlert("Error saving file", error,
|
BAlert *alert = new BAlert(B_TRANSLATE("Error saving file"), error,
|
||||||
"Damned!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
B_TRANSLATE("Damned!"), NULL, NULL, B_WIDTH_AS_USUAL,
|
||||||
|
B_STOP_ALERT);
|
||||||
alert->Go();
|
alert->Go();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,14 @@
|
|||||||
#include "PriorityMenu.h"
|
#include "PriorityMenu.h"
|
||||||
#include "ProcessController.h"
|
#include "ProcessController.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ProcessController"
|
||||||
|
|
||||||
PriorityMenu::PriorityMenu(thread_id thread, int32 priority)
|
PriorityMenu::PriorityMenu(thread_id thread, int32 priority)
|
||||||
: BMenu(B_EMPTY_STRING),
|
: BMenu(B_EMPTY_STRING),
|
||||||
@@ -65,7 +68,7 @@ static PriorityRec priorities[] = {
|
|||||||
{"", -1}
|
{"", -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
PriorityRec customPriority = { "Custom", 0 };
|
PriorityRec customPriority = {"Custom", 0 };
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -86,9 +89,9 @@ PriorityMenu::BuildMenu()
|
|||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
message = new BMessage('PrTh');
|
message = new BMessage('PrTh');
|
||||||
message->AddInt32("thread", fThreadID);
|
message->AddInt32(B_TRANSLATE("thread"), fThreadID);
|
||||||
message->AddInt32("priority", priority->priority);
|
message->AddInt32(B_TRANSLATE("priority"), priority->priority);
|
||||||
sprintf(name, "%s priority [%d]", priority->name, (int)priority->priority);
|
sprintf(name, B_TRANSLATE("%s priority [%d]"), priority->name, (int)priority->priority);
|
||||||
item = new BMenuItem(name, message);
|
item = new BMenuItem(name, message);
|
||||||
item->SetTarget(gPCView);
|
item->SetTarget(gPCView);
|
||||||
if (fPriority == priority->priority)
|
if (fPriority == priority->priority)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <debugger.h>
|
#include <debugger.h>
|
||||||
#include <Deskbar.h>
|
#include <Deskbar.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
@@ -56,6 +57,10 @@
|
|||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ProcessController"
|
||||||
|
|
||||||
|
|
||||||
const char* kDeskbarItemName = "ProcessController";
|
const char* kDeskbarItemName = "ProcessController";
|
||||||
const char* kClassName = "ProcessController";
|
const char* kClassName = "ProcessController";
|
||||||
|
|
||||||
@@ -248,8 +253,11 @@ ProcessController::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'QtTm':
|
case 'QtTm':
|
||||||
if (message->FindInt32("team", &team) == B_OK)
|
if (message->FindInt32("team", &team) == B_OK) {
|
||||||
resume_thread(spawn_thread(thread_quit_application, "Quit application", B_NORMAL_PRIORITY, (void*) team));
|
resume_thread(spawn_thread(thread_quit_application,
|
||||||
|
B_TRANSLATE("Quit application"), B_NORMAL_PRIORITY,
|
||||||
|
(void*) team));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'KlTm':
|
case 'KlTm':
|
||||||
@@ -257,13 +265,20 @@ ProcessController::MessageReceived(BMessage *message)
|
|||||||
info_pack infos;
|
info_pack infos;
|
||||||
if (get_team_info(team, &infos.team_info) == B_OK) {
|
if (get_team_info(team, &infos.team_info) == B_OK) {
|
||||||
get_team_name_and_icon(infos);
|
get_team_name_and_icon(infos);
|
||||||
sprintf(question, "Do you really want to kill the team \"%s\"?", infos.team_name);
|
sprintf(question,
|
||||||
alert = new BAlert("", question, "Cancel", "Yes, kill this team!", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
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);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
if (alert->Go())
|
if (alert->Go())
|
||||||
kill_team(team);
|
kill_team(team);
|
||||||
} else {
|
} 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();
|
alert->Go();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,12 +289,19 @@ ProcessController::MessageReceived(BMessage *message)
|
|||||||
thread_info thinfo;
|
thread_info thinfo;
|
||||||
if (get_thread_info(thread, &thinfo) == B_OK) {
|
if (get_thread_info(thread, &thinfo) == B_OK) {
|
||||||
#if DEBUG_THREADS
|
#if DEBUG_THREADS
|
||||||
sprintf(question, "What do you want to do with the thread \"%s\"?", thinfo.name);
|
sprintf(question, B_TRANSLATE("What do you want to do "
|
||||||
alert = new BAlert("", question, "Cancel", "Debug this thread!", "Kill this thread!", B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
"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
|
#define KILL 2
|
||||||
#else
|
#else
|
||||||
sprintf(question, "Are you sure you want to kill the thread \"%s\"?", thinfo.name);
|
sprintf(question, B_TRANSLATE("Are you sure you want "
|
||||||
alert = new BAlert("", question, "Cancel", "Kill this thread!", NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
"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
|
#define KILL 1
|
||||||
#endif
|
#endif
|
||||||
alert->SetShortcut(0, B_ESCAPE);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
@@ -295,11 +317,14 @@ ProcessController::MessageReceived(BMessage *message)
|
|||||||
else
|
else
|
||||||
param->sem = -1;
|
param->sem = -1;
|
||||||
param->totalTime = thinfo.user_time+thinfo.kernel_time;
|
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
|
#endif
|
||||||
} else {
|
} 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();
|
alert->Go();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,8 +374,10 @@ ProcessController::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (last) {
|
if (last) {
|
||||||
alert = new BAlert("", "This is the last active processor...\nYou can't turn it off!",
|
alert = new BAlert("", B_TRANSLATE("This is the last "
|
||||||
"That's no Fun!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
"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();
|
alert->Go();
|
||||||
} else
|
} else
|
||||||
_kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
|
_kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
|
||||||
@@ -371,10 +398,12 @@ ProcessController::MessageReceived(BMessage *message)
|
|||||||
void
|
void
|
||||||
ProcessController::AboutRequested()
|
ProcessController::AboutRequested()
|
||||||
{
|
{
|
||||||
BAlert *alert = new BAlert("about", "ProcessController\n\n"
|
BAlert *alert = new BAlert(B_TRANSLATE("about"),
|
||||||
"Copyright 1997-2001,\n"
|
B_TRANSLATE("ProcessController\n\n"
|
||||||
"Georges-Edouard Berenger.\n\n"
|
"Copyright 1997-2001,\n"
|
||||||
"Copyright " B_UTF8_COPYRIGHT " 2007 Haiku, Inc.\n", "OK");
|
"Georges-Edouard Berenger.\n\n"
|
||||||
|
"Copyright "B_UTF8_COPYRIGHT" 2007 Haiku, Inc.\n"),
|
||||||
|
B_TRANSLATE("OK"));
|
||||||
BTextView *view = alert->TextView();
|
BTextView *view = alert->TextView();
|
||||||
BFont font;
|
BFont font;
|
||||||
|
|
||||||
@@ -434,7 +463,8 @@ ProcessController::AttachedToWindow()
|
|||||||
gKernelColorSelected = tint_color(gKernelColor, B_HIGHLIGHT_BACKGROUND_TINT);
|
gKernelColorSelected = tint_color(gKernelColor, B_HIGHLIGHT_BACKGROUND_TINT);
|
||||||
gUserColor = tint_color(gKernelColor, B_LIGHTEN_2_TINT);
|
gUserColor = tint_color(gKernelColor, B_LIGHTEN_2_TINT);
|
||||||
gUserColorSelected = tint_color(gUserColor, B_HIGHLIGHT_BACKGROUND_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);
|
gFrameColorSelected = tint_color(gFrameColor, B_HIGHLIGHT_BACKGROUND_TINT);
|
||||||
gMenuBackColor = ui_color(B_MENU_BACKGROUND_COLOR);
|
gMenuBackColor = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||||
gMenuBackColorSelected = ui_color(B_MENU_SELECTION_BACKGROUND_COLOR);
|
gMenuBackColorSelected = ui_color(B_MENU_SELECTION_BACKGROUND_COLOR);
|
||||||
@@ -462,7 +492,8 @@ ProcessController::MouseDown(BPoint where)
|
|||||||
ConvertToScreen (¶m->clickToOpenRect);
|
ConvertToScreen (¶m->clickToOpenRect);
|
||||||
param->top = where.y < BScreen(this->Window()).Frame().bottom-50;
|
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);
|
B_URGENT_DISPLAY_PRIORITY, param);
|
||||||
resume_thread(gPopupThreadID);
|
resume_thread(gPopupThreadID);
|
||||||
}
|
}
|
||||||
@@ -496,12 +527,15 @@ ProcessController::DoDraw(bool force)
|
|||||||
if (force) {
|
if (force) {
|
||||||
SetHighColor(frame_color);
|
SetHighColor(frame_color);
|
||||||
StrokeRect(BRect(left - 1, top - 1, right, bottom + 1));
|
StrokeRect(BRect(left - 1, top - 1, right, bottom + 1));
|
||||||
if (gCPUcount == 2)
|
if (gCPUcount == 2) {
|
||||||
StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth, bottom));
|
StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth,
|
||||||
|
bottom));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
float leftMem = bounds.Width() - layout[gCPUcount].mem_width;
|
float leftMem = bounds.Width() - layout[gCPUcount].mem_width;
|
||||||
if (force)
|
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++) {
|
for (int x = 0; x < gCPUcount; x++) {
|
||||||
right = left + barWidth - 1;
|
right = left + barWidth - 1;
|
||||||
@@ -522,7 +556,8 @@ ProcessController::DoDraw(bool force)
|
|||||||
rgb_color fraction_color;
|
rgb_color fraction_color;
|
||||||
mix_colors(fraction_color, idle_color, active_color, rem);
|
mix_colors(fraction_color, idle_color, active_color, rem);
|
||||||
SetHighColor(fraction_color);
|
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;
|
float active_bottom = bottom;
|
||||||
if (!force && previousLimit < bottom)
|
if (!force && previousLimit < bottom)
|
||||||
@@ -559,7 +594,8 @@ ProcessController::DoDraw(bool force)
|
|||||||
rgb_color fraction_color;
|
rgb_color fraction_color;
|
||||||
mix_colors(fraction_color, idle_color, used_memory_color, rem);
|
mix_colors(fraction_color, idle_color, used_memory_color, rem);
|
||||||
SetHighColor(fraction_color);
|
SetHighColor(fraction_color);
|
||||||
StrokeLine(BPoint(leftMem, bottom - barHeight), BPoint(rightMem, bottom - barHeight));
|
StrokeLine(BPoint(leftMem, bottom - barHeight), BPoint(rightMem,
|
||||||
|
bottom - barHeight));
|
||||||
}
|
}
|
||||||
float usedBottom = bottom;
|
float usedBottom = bottom;
|
||||||
// if (!force && previousLimit < 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) {
|
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];
|
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++) {
|
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;
|
infos[m].thread_info[h].thread = -1;
|
||||||
}
|
}
|
||||||
get_team_name_and_icon(infos[m], true);
|
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);
|
popup->SetFont(be_plain_font);
|
||||||
|
|
||||||
// Quit section
|
// 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);
|
QuitPopup->SetFont(be_plain_font);
|
||||||
popup->AddItem(QuitPopup);
|
popup->AddItem(QuitPopup);
|
||||||
|
|
||||||
// Memory Usage section
|
// 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);
|
int commitedMemory = int(systemInfo.used_pages * B_PAGE_SIZE / 1024);
|
||||||
for (m = 0; m < systemInfo.used_teams; m++) {
|
for (m = 0; m < systemInfo.used_teams; m++) {
|
||||||
if (infos[m].team_info.team >= 0) {
|
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);
|
MemoryPopup->AddItem(memoryItem);
|
||||||
memoryItem->UpdateSituation(commitedMemory);
|
memoryItem->UpdateSituation(commitedMemory);
|
||||||
}
|
}
|
||||||
@@ -654,13 +695,16 @@ thread_popup(void *arg)
|
|||||||
addtopbottom(MemoryPopup);
|
addtopbottom(MemoryPopup);
|
||||||
|
|
||||||
// CPU Load section
|
// 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++) {
|
for (m = 0; m < systemInfo.used_teams; m++) {
|
||||||
if (infos[m].team_info.team >= 0) {
|
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');
|
BMessage* kill_team = new BMessage('KlTm');
|
||||||
kill_team->AddInt32("team", infos[m].team_info.team);
|
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);
|
item->SetTarget(gPCView);
|
||||||
CPUPopup->AddItem(item);
|
CPUPopup->AddItem(item);
|
||||||
}
|
}
|
||||||
@@ -673,9 +717,9 @@ thread_popup(void *arg)
|
|||||||
if (gCPUcount > 1) {
|
if (gCPUcount > 1) {
|
||||||
for (int i = 0; i < gCPUcount; i++) {
|
for (int i = 0; i < gCPUcount; i++) {
|
||||||
char item_name[32];
|
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 ');
|
BMessage* m = new BMessage ('CPU ');
|
||||||
m->AddInt32 ("cpu", i);
|
m->AddInt32 (B_TRANSLATE("cpu"), i);
|
||||||
item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m);
|
item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m);
|
||||||
if (_kern_cpu_enabled(i))
|
if (_kern_cpu_enabled(i))
|
||||||
item->SetMarked (true);
|
item->SetMarked (true);
|
||||||
@@ -686,24 +730,28 @@ thread_popup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!be_roster->IsRunning(kTrackerSig)) {
|
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);
|
item->SetTarget(gPCView);
|
||||||
addtopbottom(item);
|
addtopbottom(item);
|
||||||
}
|
}
|
||||||
if (!be_roster->IsRunning(kDeskbarSig)) {
|
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);
|
item->SetTarget(gPCView);
|
||||||
addtopbottom(item);
|
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);
|
item->SetTarget(gPCView);
|
||||||
addtopbottom(item);
|
addtopbottom(item);
|
||||||
|
|
||||||
addtopbottom(new BSeparatorItem());
|
addtopbottom(new BSeparatorItem());
|
||||||
|
|
||||||
if (be_roster->IsRunning(kDeskbarSig)) {
|
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;
|
BDeskbar deskbar;
|
||||||
item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName));
|
item->SetMarked(gInDeskbar || deskbar.HasItem(kDeskbarItemName));
|
||||||
item->SetTarget(gPCView);
|
item->SetTarget(gPCView);
|
||||||
@@ -711,7 +759,8 @@ thread_popup(void *arg)
|
|||||||
addtopbottom(new BSeparatorItem ());
|
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));
|
new BMessage(B_ABOUT_REQUESTED));
|
||||||
item->SetTarget(gPCView);
|
item->SetTarget(gPCView);
|
||||||
addtopbottom(item);
|
addtopbottom(item);
|
||||||
@@ -755,15 +804,17 @@ thread_debug_thread(void *arg)
|
|||||||
thread_info thinfo;
|
thread_info thinfo;
|
||||||
get_thread_info(param->thread, &thinfo);
|
get_thread_info(param->thread, &thinfo);
|
||||||
char text[4096];
|
char text[4096];
|
||||||
sprintf(text, "db %d", int(param->thread));
|
sprintf(text, B_TRANSLATE("db %d"), int(param->thread));
|
||||||
system(text);
|
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);
|
snooze(1000000);
|
||||||
get_thread_info(param->thread, &thinfo);
|
get_thread_info(param->thread, &thinfo);
|
||||||
if (thinfo.state == B_THREAD_WAITING
|
if (thinfo.state == B_THREAD_WAITING
|
||||||
&& param->sem == thinfo.sem
|
&& param->sem == thinfo.sem
|
||||||
&& param->totalTime == thinfo.user_time + thinfo.kernel_time) {
|
&& 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;
|
sem_info sinfo;
|
||||||
thread_info thinfo;
|
thread_info thinfo;
|
||||||
info_pack infos;
|
info_pack infos;
|
||||||
@@ -771,28 +822,40 @@ thread_debug_thread(void *arg)
|
|||||||
if (get_sem_info(param->sem, &sinfo) == B_OK
|
if (get_sem_info(param->sem, &sinfo) == B_OK
|
||||||
&& get_thread_info(param->thread, &thinfo) == B_OK
|
&& get_thread_info(param->thread, &thinfo) == B_OK
|
||||||
&& get_team_info(thinfo.team, &infos.team_info) == 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, "
|
sprintf (text, B_TRANSLATE("This thread is waiting for the "
|
||||||
"you won't be able to debug that thread.\n", sinfo.name);
|
"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)
|
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 {
|
else {
|
||||||
get_team_name_and_icon(infos);
|
get_team_name_and_icon(infos);
|
||||||
char moreText[1024];
|
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);
|
infos.team_name);
|
||||||
strcat(text, moreText);
|
strcat(text, moreText);
|
||||||
}
|
}
|
||||||
|
|
||||||
BAlert* alert = new BAlert("", text, "Cancel", "Release", NULL,
|
BAlert* alert = new BAlert("", text, B_TRANSLATE("Cancel"),
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
B_TRANSLATE("Release"), NULL, B_WIDTH_AS_USUAL,
|
||||||
|
B_STOP_ALERT);
|
||||||
alert->SetShortcut(0, B_ESCAPE);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
if (alert->Go()) {
|
if (alert->Go()) {
|
||||||
get_thread_info (param->thread, &thinfo);
|
get_thread_info (param->thread, &thinfo);
|
||||||
if (thinfo.state == B_THREAD_WAITING && param->sem == thinfo.sem
|
if (thinfo.state == B_THREAD_WAITING && param->sem
|
||||||
&& param->totalTime == thinfo.user_time + thinfo.kernel_time)
|
== thinfo.sem
|
||||||
|
&& param->totalTime == thinfo.user_time
|
||||||
|
+ thinfo.kernel_time)
|
||||||
release_sem(param->sem);
|
release_sem(param->sem);
|
||||||
else {
|
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();
|
alert->Go();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user