Ticket #7350: processcontroller-fix.patch

File processcontroller-fix.patch, 13.8 KB (added by Karvjorm, 13 years ago)

A clean up and fix for the ProcessController application

  • src/apps/processcontroller/Preferences.cpp

     
    3434#include <Mime.h>
    3535#include <Path.h>
    3636
     37
    3738#undef B_TRANSLATE_CONTEXT
    38 #define B_TRANSLATE_CONTEXT "ProcessController"
     39#define B_TRANSLATE_CONTEXT "Preferences"
    3940
     41
    4042Preferences::Preferences(const char* name, const char* signature, bool doSave)
    4143    : BMessage('Pref'), BLocker("Preferences", true),
    4244    fSavePreferences(doSave)
     
    116118            BAlert *alert = new BAlert(B_TRANSLATE("Error saving file"),
    117119                error.String(), B_TRANSLATE("Damned!"), NULL, NULL,
    118120                B_WIDTH_AS_USUAL, B_STOP_ALERT);
     121            alert->SetShortcut(0, B_ESCAPE);
     122           
    119123            alert->Go();
    120124        }
    121125    }
  • src/apps/processcontroller/MemoryBarMenuItem.cpp

     
    2525#include "ProcessController.h"
    2626
    2727#include <Bitmap.h>
    28 #include <Catalog.h>
    2928#include <StringForSize.h>
    3029
    3130#include <stdio.h>
    3231
    33 #undef B_TRANSLATE_CONTEXT
    34 #define B_TRANSLATE_CONTEXT "MemoryBarMenu"
    3532
    36 
    3733MemoryBarMenuItem::MemoryBarMenuItem(const char *label, team_id team,
    3834        BBitmap* icon, bool deleteIcon, BMessage* message)
    3935    : BMenuItem(label, message),
  • src/apps/processcontroller/KernelMemoryBarMenuItem.cpp

     
    2929#include <Catalog.h>
    3030#include <StringForSize.h>
    3131
     32
    3233#undef B_TRANSLATE_CONTEXT
    33 #define B_TRANSLATE_CONTEXT "ProcessController"
     34#define B_TRANSLATE_CONTEXT "Kernel Memory Bar Menu Item"
    3435
    3536
    3637KernelMemoryBarMenuItem::KernelMemoryBarMenuItem(system_info& systemInfo)
  • src/apps/processcontroller/QuitMenu.cpp

     
    2929
    3030class QuitMenuItem : public IconMenuItem {
    3131    public:
    32                 QuitMenuItem(team_id team, BBitmap* icon, const char* title, BMessage* m, bool purge = false);
     32                QuitMenuItem(team_id team, BBitmap* icon, const char* title,
     33                    BMessage* m, bool purge = false);
    3334        team_id Team() { return fTeam; }
    3435
    3536    private:
     
    3738};
    3839
    3940
    40 QuitMenuItem::QuitMenuItem(team_id team, BBitmap* icon, const char* title, BMessage* m, bool purge) :
     41QuitMenuItem::QuitMenuItem(team_id team, BBitmap* icon, const char* title,
     42    BMessage* m, bool purge)
     43    :
    4144    IconMenuItem(icon, title, m, true, purge), fTeam(team)
    4245{
    4346}
     
    112115    message->AddInt32 ("team", tmid);
    113116    item = NULL;
    114117    if (t < fInfosCount)
    115         item = new QuitMenuItem(tmid, fInfos[t].team_icon, fInfos[t].team_name, message);
     118        item = new QuitMenuItem(tmid, fInfos[t].team_icon, fInfos[t].team_name,
     119            message);
    116120    else {
    117121        info_pack infos;
    118122        if (get_team_info(tmid, &infos.team_info) == B_OK
    119123            && get_team_name_and_icon(infos, true))
    120             item = new QuitMenuItem(tmid, infos.team_icon, infos.team_name, message, true);
     124            item = new QuitMenuItem(tmid, infos.team_icon, infos.team_name,
     125                message, true);
    121126    }
    122127    if (item) {
    123128        item->SetTarget(gPCView);
  • src/apps/processcontroller/PCWorld.cpp

     
    3838
    3939
    4040#undef B_TRANSLATE_CONTEXT
    41 #define B_TRANSLATE_CONTEXT "ProcessController"
     41#define B_TRANSLATE_CONTEXT "PCWorld"
    4242
    4343
    4444class PCApplication : public BApplication {
     
    5555const char* kTrackerSig = "application/x-vnd.Be-TRAK";
    5656const char* kDeskbarSig = "application/x-vnd.Be-TSKB";
    5757const char* kTerminalSig = "application/x-vnd.Haiku-Terminal";
    58 const char* kPreferencesFileName = "ProcessController Prefs";
     58const char* kPreferencesFileName = B_TRANSLATE_MARK("ProcessController Prefs");
    5959
    60 const char* kPosPrefName = "Position";
    61 const char* kVersionName = "Version";
     60const char* kPosPrefName = B_TRANSLATE_MARK("Position");
     61const char* kVersionName = B_TRANSLATE_MARK("Version");
    6262const int kCurrentVersion = 311;
    6363
    6464thread_id id = 0;
     
    8686    BDeskbar deskbar;
    8787    if (!deskbar.HasItem(kDeskbarItemName)) {
    8888        // We're not yet installed in the Deskbar, ask if we should
    89         BAlert* alert = new BAlert("",
     89        BAlert* alert = new BAlert(B_TRANSLATE("Info"),
    9090            B_TRANSLATE("You can run ProcessController in a window"
    9191            " or install it in the Deskbar."), B_TRANSLATE("Run in window"),
    92             B_TRANSLATE("Install in Deskbar"),
    93             NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     92            B_TRANSLATE("Install in Deskbar"), NULL, B_WIDTH_AS_USUAL,
     93            B_WARNING_ALERT);
    9494        alert->SetShortcut(0, B_ESCAPE);
    9595
    9696        if (alert->Go() != 0) {
     
    101101            return;
    102102        }
    103103    } else {
    104         BAlert* alert = new BAlert("",
     104        BAlert* alert = new BAlert(B_TRANSLATE("Info"),
    105105            B_TRANSLATE("ProcessController is already installed in Deskbar."),
    106             B_TRANSLATE("OK"), NULL,
    107             NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     106            B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
    108107        alert->SetShortcut(0, B_ESCAPE);
     108       
    109109        alert->Go();
    110110    }
    111111
  • src/apps/processcontroller/PriorityMenu.h

     
    33    PriorityMenu.h
    44
    55    ProcessController
    6     © 2000, Georges-Edouard Berenger, All Rights Reserved.
     6    (c) 2000, Georges-Edouard Berenger, All Rights Reserved.
    77    Copyright (C) 2004 beunited.org
    88
    99    This library is free software; you can redistribute it and/or
  • src/apps/processcontroller/NoiseBarMenuItem.h

     
    33    NoiseBarMenuItem.h
    44
    55    ProcessController
    6     © 2000, Georges-Edouard Berenger, All Rights Reserved.
     6    (C) 2000, Georges-Edouard Berenger, All Rights Reserved.
    77    Copyright (C) 2004 beunited.org
    88
    99    This library is free software; you can redistribute it and/or
  • src/apps/processcontroller/Jamfile

     
    2929    x-vnd.Haiku-ProcessController
    3030    :
    3131    KernelMemoryBarMenuItem.cpp
    32     MemoryBarMenu.cpp
    33     MemoryBarMenuItem.cpp
    3432    NoiseBarMenuItem.cpp
    3533    PCWorld.cpp
    3634    Preferences.cpp
    3735    PriorityMenu.cpp
    3836    ProcessController.cpp
    3937;
     38
     39AddCatalogEntryAttribute ProcessController
     40    :
     41    x-vnd.Haiku-ProcessController:PCWindow:ProcessController
     42;
  • src/apps/processcontroller/PriorityMenu.cpp

     
    2727
    2828#include <stdio.h>
    2929
     30
    3031#undef B_TRANSLATE_CONTEXT
    31 #define B_TRANSLATE_CONTEXT "ProcessController"
     32#define B_TRANSLATE_CONTEXT "Priority Menu"
    3233
     34
    3335PriorityMenu::PriorityMenu(thread_id thread, int32 priority)
    3436    : BMenu(B_EMPTY_STRING),
    3537    fThreadID(thread),
     
    9395        BString name;
    9496        const size_t size = B_OS_NAME_LENGTH * 4;
    9597        snprintf(name.LockBuffer(size), size,
    96             B_TRANSLATE("%s [%d]"), priority->name, (int)priority->priority);
     98            "%s [%d]", priority->name,  (int)priority->priority);
    9799        name.UnlockBuffer();
    98100        item = new BMenuItem(name.String(), message);
    99101        item->SetTarget(gPCView);
  • src/apps/processcontroller/NoiseBarMenuItem.cpp

     
    2323#include "Colors.h"
    2424#include "ProcessController.h"
    2525
     26
    2627#undef B_TRANSLATE_CONTEXT
    27 #define B_TRANSLATE_CONTEXT "ProcessController"
     28#define B_TRANSLATE_CONTEXT "Noise Bar Menu Item"
    2829
     30
    2931NoiseBarMenuItem::NoiseBarMenuItem()
    3032    : BMenuItem(B_TRANSLATE("Gone teams"B_UTF8_ELLIPSIS), NULL)
    3133{
  • src/apps/processcontroller/ProcessController.cpp

     
    6161#define B_TRANSLATE_CONTEXT "ProcessController"
    6262
    6363
    64 const char* kDeskbarItemName = "ProcessController";
    65 const char* kClassName = "ProcessController";
     64const char* kDeskbarItemName = B_TRANSLATE_MARK("ProcessController");
     65const char* kClassName = B_TRANSLATE_MARK("ProcessController");
    6666
    6767const char* kFrameColorPref = "deskbar_frame_color";
    6868const char* kIdleColorPref = "deskbar_idle_color";
     
    268268                    snprintf(question, sizeof(question),
    269269                    B_TRANSLATE("Do you really want to kill the team \"%s\"?"),
    270270                    infos.team_name);
    271                     alert = new BAlert("", question,
    272                     B_TRANSLATE("Cancel"), B_TRANSLATE("Yes, kill this team!"),
    273                     NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
     271                    alert = new BAlert(B_TRANSLATE("Question"), question,
     272                        B_TRANSLATE("Cancel"),
     273                        B_TRANSLATE("Yes, kill this team!"), NULL,
     274                        B_WIDTH_AS_USUAL, B_STOP_ALERT);
    274275                    alert->SetShortcut(0, B_ESCAPE);
     276                   
    275277                    if (alert->Go())
    276278                        kill_team(team);
    277279                } else {
    278                     alert = new BAlert("", B_TRANSLATE("This team is already "
    279                     "gone"B_UTF8_ELLIPSIS),
    280                     B_TRANSLATE("Ok!"), NULL, NULL, B_WIDTH_AS_USUAL,
    281                         B_STOP_ALERT);
     280                    alert = new BAlert(B_TRANSLATE("Question"),
     281                        B_TRANSLATE("This team is already gone"
     282                        B_UTF8_ELLIPSIS), B_TRANSLATE("Ok!"), NULL, NULL,
     283                        B_WIDTH_AS_USUAL, B_STOP_ALERT);
     284                    alert->SetShortcut(0, B_ESCAPE);
     285                   
    282286                    alert->Go();
    283287                }
    284288            }
     
    292296                    snprintf(question, sizeof(question),
    293297                        B_TRANSLATE("What do you want to do "
    294298                        "with the thread \"%s\"?"), thinfo.name);
    295                     alert = new BAlert("", question, B_TRANSLATE("Cancel"),
    296                     B_TRANSLATE("Debug this thread!"),
    297                     B_TRANSLATE("Kill this thread!"), B_WIDTH_AS_USUAL,
    298                     B_STOP_ALERT);
     299                    alert = new BAlert(B_TRANSLATE("Question"), question,
     300                        B_TRANSLATE("Cancel"),
     301                        B_TRANSLATE("Debug this thread!"),
     302                        B_TRANSLATE("Kill this thread!"), B_WIDTH_AS_USUAL,
     303                        B_STOP_ALERT);
    299304                    #define KILL 2
    300305                    #else
    301306                    snprintf(question, sizeof(question),
    302307                        B_TRANSLATE("Are you sure you want "
    303308                        "to kill the thread \"%s\"?"), thinfo.name);
    304                     alert = new BAlert("", question, B_TRANSLATE("Cancel"),
    305                     B_TRANSLATE("Kill this thread!"), NULL, B_WIDTH_AS_USUAL,
    306                     B_STOP_ALERT);
     309                    alert = new BAlert(B_TRANSLATE("Question"), question,
     310                        B_TRANSLATE("Cancel"),
     311                        B_TRANSLATE("Kill this thread!"), NULL,
     312                        B_WIDTH_AS_USUAL, B_STOP_ALERT);
    307313                    #define KILL 1
    308314                    #endif
    309315                    alert->SetShortcut(0, B_ESCAPE);
     316                   
    310317                    int r = alert->Go();
    311318                    if (r == KILL)
    312319                        kill_thread(thread);
     
    324331                    }
    325332                    #endif
    326333                } else {
    327                     alert = new BAlert("", B_TRANSLATE("This thread is "
    328                     "already gone"B_UTF8_ELLIPSIS), B_TRANSLATE("Ok!"),
    329                     NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
     334                    alert = new BAlert(B_TRANSLATE("Thread is gone"),
     335                        B_TRANSLATE("This thread is already gone"
     336                        B_UTF8_ELLIPSIS), B_TRANSLATE("Ok!"), NULL, NULL,
     337                        B_WIDTH_AS_USUAL, B_STOP_ALERT);
     338                    alert->SetShortcut(0, B_ESCAPE);
     339                   
    330340                    alert->Go();
    331341                }
    332342            }
     
    376386                    }
    377387                }
    378388                if (last) {
    379                     alert = new BAlert("", B_TRANSLATE("This is the last "
    380                     "active processor...\nYou can't turn it off!"),
     389                    alert = new BAlert(B_TRANSLATE("CPU"),
     390                        B_TRANSLATE("This is the last active processor...\n"
     391                        "You can't turn it off!"),
    381392                        B_TRANSLATE("That's no Fun!"), NULL, NULL,
    382393                        B_WIDTH_AS_USUAL, B_WARNING_ALERT);
     394                    alert->SetShortcut(0, B_ESCAPE);
     395                   
    383396                    alert->Go();
    384397                } else
    385398                    _kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
     
    415428    font.SetSize(font.Size() * 1.5);
    416429    font.SetFace(B_BOLD_FACE);
    417430    view->SetFontAndColor(0, strlen(B_TRANSLATE("ProcessController")), &font);
     431    alert->SetShortcut(0, B_ESCAPE);
    418432
    419433    alert->Go();
    420434}
  • src/apps/processcontroller/MemoryBarMenu.cpp

     
    2424#include "ProcessController.h"
    2525
    2626#include <Bitmap.h>
    27 #include <Catalog.h>
    2827#include <Roster.h>
    2928#include <StringForSize.h>
    3029#include <Window.h>
     
    3635
    3736float gMemoryTextWidth;
    3837
    39 #undef B_TRANSLATE_CONTEXT
    40 #define B_TRANSLATE_CONTEXT "MemoryBarMenu"
    4138
    42 
    4339MemoryBarMenu::MemoryBarMenu(const char* name, info_pack* infos, system_info& systemInfo)
    4440    : BMenu(name),
    4541    fFirstShow(true)
  • src/apps/processcontroller/PCWindow.cpp

     
    3232#include <StringView.h>
    3333
    3434
     35extern const char* kClassName;
     36
     37
    3538PCWindow::PCWindow()
    36     : BWindow(BRect(100, 150, 131, 181), "ProcessController", B_TITLED_WINDOW,
    37         B_NOT_H_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
     39    : BWindow(BRect(100, 150, 131, 181), kClassName,
     40        B_TITLED_WINDOW, B_NOT_H_RESIZABLE | B_NOT_ZOOMABLE |
     41        B_ASYNCHRONOUS_CONTROLS)
    3842{
    3943    Preferences preferences(kPreferencesFileName);
    4044    preferences.SaveInt32(kCurrentVersion, kVersionName);