Fix cpufrequency again : actually StatusView is used both in the add-on and standalone, so it must be able to work in both ways. The macro are then unuseable.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34765 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2009-12-24 12:19:18 +00:00
parent b1c3d835a4
commit ea054b6a1a
1 changed files with 13 additions and 13 deletions

View File

@ -14,7 +14,6 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Catalog.h> #include <Catalog.h>
#include <CatalogInAddOn.h>
#include <Deskbar.h> #include <Deskbar.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <Locale.h> #include <Locale.h>
@ -196,20 +195,21 @@ FrequencyMenu::FrequencyMenu(BMenu* menu, BHandler* target,
fStorage(storage), fStorage(storage),
fInterface(interface) fInterface(interface)
{ {
BCatalog catalog("x-vnd.Haiku-CPUFrequencyPref");
fDynamicPerformance = new BMenuItem( fDynamicPerformance = new BMenuItem(
TR("Dynamic performance"), catalog.GetString("Dynamic performance",TR_CONTEXT),
new BMessage(kMsgPolicyDynamic)); new BMessage(kMsgPolicyDynamic));
fHighPerformance = new BMenuItem( fHighPerformance = new BMenuItem(
TR("High performance"), catalog.GetString("High performance",TR_CONTEXT),
new BMessage(kMsgPolicyPerformance)); new BMessage(kMsgPolicyPerformance));
fLowEnergie = new BMenuItem(TR("Low energy"), fLowEnergie = new BMenuItem(catalog.GetString("Low energy",TR_CONTEXT),
new BMessage(kMsgPolicyLowEnergy)); new BMessage(kMsgPolicyLowEnergy));
menu->AddItem(fDynamicPerformance); menu->AddItem(fDynamicPerformance);
menu->AddItem(fHighPerformance); menu->AddItem(fHighPerformance);
menu->AddItem(fLowEnergie); menu->AddItem(fLowEnergie);
fCustomStateMenu = new BMenu(TR("Set state")); fCustomStateMenu = new BMenu(catalog.GetString("Set state",TR_CONTEXT));
StateList* stateList = fInterface->GetCpuFrequencyStates(); StateList* stateList = fInterface->GetCpuFrequencyStates();
for (int i = 0; i < stateList->CountItems(); i++) { for (int i = 0; i < stateList->CountItems(); i++) {
@ -353,9 +353,9 @@ StatusView::StatusView(BRect frame, bool inDeskbar,
B_WILL_DRAW | B_FRAME_EVENTS), B_WILL_DRAW | B_FRAME_EVENTS),
fInDeskbar(inDeskbar), fInDeskbar(inDeskbar),
fCurrentFrequency(NULL), fCurrentFrequency(NULL),
fDragger(NULL) fDragger(NULL),
fCatalog("x-vnd.Haiku-CPUFrequencyPref")
{ {
get_add_on_catalog(&fCatalog,"x-vnd.Haiku-CPUFrequencyPref");
if (!inDeskbar) { if (!inDeskbar) {
// we were obviously added to a standard window - let's add a dragger // we were obviously added to a standard window - let's add a dragger
BRect bounds = Bounds(); BRect bounds = Bounds();
@ -407,10 +407,10 @@ StatusView::~StatusView()
void void
StatusView::_AboutRequested() StatusView::_AboutRequested()
{ {
BAlert *alert = new BAlert("about", TR("CPU Frequency\n" BAlert *alert = new BAlert("about", fCatalog.GetString("CPU Frequency\n"
"\twritten by Clemens Zeidler\n" "\twritten by Clemens Zeidler\n"
"\tCopyright 2009, Haiku, Inc.\n"), "\tCopyright 2009, Haiku, Inc.\n", TR_CONTEXT),
TR("Ok")); fCatalog.GetString("Ok", TR_CONTEXT));
BTextView *view = alert->TextView(); BTextView *view = alert->TextView();
BFont font; BFont font;
@ -490,14 +490,14 @@ StatusView::AttachedToWindow()
fPreferencesMenu->SetFont(be_plain_font); fPreferencesMenu->SetFont(be_plain_font);
fPreferencesMenu->AddSeparatorItem(); fPreferencesMenu->AddSeparatorItem();
fOpenPrefItem = new BMenuItem(TR( fOpenPrefItem = new BMenuItem(fCatalog.GetString(
"Open Speedstep preferences" B_UTF8_ELLIPSIS), "Open Speedstep preferences" B_UTF8_ELLIPSIS, TR_CONTEXT),
new BMessage(kMsgOpenSSPreferences)); new BMessage(kMsgOpenSSPreferences));
fPreferencesMenu->AddItem(fOpenPrefItem); fPreferencesMenu->AddItem(fOpenPrefItem);
fOpenPrefItem->SetTarget(this); fOpenPrefItem->SetTarget(this);
if (fInDeskbar) { if (fInDeskbar) {
fQuitItem= new BMenuItem(TR("Quit"), fQuitItem= new BMenuItem(fCatalog.GetString("Quit", TR_CONTEXT),
new BMessage(B_QUIT_REQUESTED)); new BMessage(B_QUIT_REQUESTED));
fPreferencesMenu->AddItem(fQuitItem); fPreferencesMenu->AddItem(fQuitItem);
fQuitItem->SetTarget(this); fQuitItem->SetTarget(this);