Style cleanup, no functional changes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38782 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -165,37 +165,39 @@ parse_arguments(int argc, const char* const* argv, bool noOutput,
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// #pragma mark - Debugger application class
|
||||
|
||||
|
||||
class Debugger : public BApplication, private TeamDebugger::Listener {
|
||||
public:
|
||||
Debugger();
|
||||
~Debugger();
|
||||
Debugger();
|
||||
~Debugger();
|
||||
|
||||
status_t Init();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void ReadyToRun();
|
||||
virtual void ArgvReceived(int32 argc, char** argv);
|
||||
status_t Init();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void ReadyToRun();
|
||||
virtual void ArgvReceived(int32 argc, char** argv);
|
||||
|
||||
private:
|
||||
typedef BObjectList<TeamDebugger> TeamDebuggerList;
|
||||
typedef BObjectList<TeamDebugger> TeamDebuggerList;
|
||||
|
||||
private:
|
||||
// TeamDebugger::Listener
|
||||
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
|
||||
|
||||
virtual bool QuitRequested();
|
||||
virtual void Quit();
|
||||
virtual bool QuitRequested();
|
||||
virtual void Quit();
|
||||
|
||||
TeamDebugger* _FindTeamDebugger(team_id teamID) const;
|
||||
TeamDebugger* _StartTeamDebugger(team_id teamID,
|
||||
thread_id threadID = -1, bool stopInMain = false);
|
||||
TeamDebugger* _FindTeamDebugger(team_id teamID) const;
|
||||
TeamDebugger* _StartTeamDebugger(team_id teamID,
|
||||
thread_id threadID = -1,
|
||||
bool stopInMain = false);
|
||||
private:
|
||||
SettingsManager fSettingsManager;
|
||||
TeamDebuggerList fTeamDebuggers;
|
||||
int32 fRunningTeamDebuggers;
|
||||
TeamsWindow* fTeamsWindow;
|
||||
SettingsManager fSettingsManager;
|
||||
TeamDebuggerList fTeamDebuggers;
|
||||
int32 fRunningTeamDebuggers;
|
||||
TeamsWindow* fTeamsWindow;
|
||||
};
|
||||
|
||||
|
||||
@@ -239,7 +241,7 @@ Debugger::MessageReceived(BMessage* message)
|
||||
if (fTeamsWindow)
|
||||
fTeamsWindow->Activate(true);
|
||||
else {
|
||||
fTeamsWindow = new TeamsWindow();
|
||||
fTeamsWindow = new(std::nothrow) TeamsWindow(&fSettingsManager);
|
||||
fTeamsWindow->Show();
|
||||
}
|
||||
break;
|
||||
@@ -399,9 +401,6 @@ Debugger::QuitRequested()
|
||||
void
|
||||
Debugger::Quit()
|
||||
{
|
||||
printf("Debugger::Quit(): fRunningTeamDebuggers = %ld, fTeamsWindow = %p\n",
|
||||
fRunningTeamDebuggers, fTeamsWindow);
|
||||
|
||||
// don't quit before all team debuggers have been quit
|
||||
if (fRunningTeamDebuggers <= 0 && fTeamsWindow == NULL)
|
||||
BApplication::Quit();
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
#include "TeamsListView.h"
|
||||
|
||||
|
||||
TeamListItem::TeamListItem(team_info & info)
|
||||
: BStringItem("", false),
|
||||
TeamListItem::TeamListItem(team_info& info)
|
||||
:
|
||||
BStringItem("", false),
|
||||
fIcon(NULL)
|
||||
{
|
||||
_SetTo(info);
|
||||
@@ -29,7 +30,8 @@ TeamListItem::TeamListItem(team_info & info)
|
||||
|
||||
|
||||
TeamListItem::TeamListItem(team_id team)
|
||||
: BStringItem("", false),
|
||||
:
|
||||
BStringItem("", false),
|
||||
fIcon(NULL)
|
||||
{
|
||||
team_info info;
|
||||
@@ -45,7 +47,7 @@ TeamListItem::~TeamListItem()
|
||||
|
||||
|
||||
void
|
||||
TeamListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
{
|
||||
BRect rect = frame;
|
||||
|
||||
@@ -87,7 +89,7 @@ TeamListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
|
||||
|
||||
void
|
||||
TeamListItem::Update(BView *owner, const BFont *font)
|
||||
TeamListItem::Update(BView* owner, const BFont* font)
|
||||
{
|
||||
BStringItem::Update(owner, font);
|
||||
|
||||
@@ -106,10 +108,10 @@ TeamListItem::Update(BView *owner, const BFont *font)
|
||||
int
|
||||
TeamListItem::Compare(const void* a, const void* b)
|
||||
{
|
||||
const BListItem *itemA = *static_cast<const BListItem * const *>(a);
|
||||
const BListItem *itemB = *static_cast<const BListItem * const *>(b);
|
||||
const TeamListItem *teamItemA = dynamic_cast<const TeamListItem *>(itemA);
|
||||
const TeamListItem *teamItemB = dynamic_cast<const TeamListItem *>(itemB);
|
||||
const BListItem*itemA = *static_cast<const BListItem* const *>(a);
|
||||
const BListItem*itemB = *static_cast<const BListItem* const *>(b);
|
||||
const TeamListItem*teamItemA = dynamic_cast<const TeamListItem*>(itemA);
|
||||
const TeamListItem*teamItemB = dynamic_cast<const TeamListItem*>(itemB);
|
||||
|
||||
if (teamItemA != NULL && teamItemB != NULL) {
|
||||
return teamItemA->fTeamInfo.team - teamItemB->fTeamInfo.team;
|
||||
@@ -120,7 +122,7 @@ TeamListItem::Compare(const void* a, const void* b)
|
||||
|
||||
|
||||
status_t
|
||||
TeamListItem::_SetTo(team_info & info)
|
||||
TeamListItem::_SetTo(team_info& info)
|
||||
{
|
||||
BPath systemPath;
|
||||
team_info teamInfo = fTeamInfo = info;
|
||||
@@ -174,7 +176,8 @@ TeamListItem::_SetTo(team_info & info)
|
||||
|
||||
|
||||
TeamsListView::TeamsListView(BRect frame, const char* name)
|
||||
: BListView(frame, name, B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL),
|
||||
:
|
||||
BListView(frame, name, B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL),
|
||||
fUpdateRunner(NULL)
|
||||
{
|
||||
team_info tmi;
|
||||
@@ -250,7 +253,7 @@ TeamsListView::MessageReceived(BMessage* message)
|
||||
if (message->FindInt32("be:team", &team) != B_OK)
|
||||
break;
|
||||
|
||||
TeamListItem *item = FindItem(team);
|
||||
TeamListItem* item = FindItem(team);
|
||||
if (item != NULL) {
|
||||
RemoveItem(item);
|
||||
delete item;
|
||||
@@ -264,7 +267,7 @@ TeamsListView::MessageReceived(BMessage* message)
|
||||
}
|
||||
|
||||
|
||||
TeamListItem *
|
||||
TeamListItem*
|
||||
TeamsListView::FindItem(team_id teamId)
|
||||
{
|
||||
for (int32 i = CountItems(); i-- > 0;) {
|
||||
@@ -287,7 +290,7 @@ TeamsListView::_InitList()
|
||||
team_info tmi;
|
||||
|
||||
while (get_next_team_info(&tmi_cookie, &tmi) == B_OK) {
|
||||
TeamListItem * item = new TeamListItem(tmi);
|
||||
TeamListItem* item = new TeamListItem(tmi);
|
||||
|
||||
if (tmi.team == B_SYSTEM_TEAM ||
|
||||
tmi.team == fThisTeam) {
|
||||
@@ -307,34 +310,34 @@ TeamsListView::_UpdateList()
|
||||
{
|
||||
int32 tmi_cookie = 0;
|
||||
team_info tmi;
|
||||
TeamListItem *item;
|
||||
TeamListItem* item;
|
||||
int32 index = 0;
|
||||
|
||||
// NOTA: assuming get_next_team_info() returns team ordered by team ID...
|
||||
// NOTA: assuming get_next_team_info() returns teams ordered by team ID...
|
||||
while (get_next_team_info(&tmi_cookie, &tmi) == B_OK) {
|
||||
|
||||
item = (TeamListItem *) ItemAt(index);
|
||||
item = (TeamListItem*) ItemAt(index);
|
||||
while (item && tmi.team > item->TeamID()) {
|
||||
RemoveItem(item);
|
||||
delete item;
|
||||
item = (TeamListItem *) ItemAt(index);
|
||||
item = (TeamListItem*) ItemAt(index);
|
||||
}
|
||||
|
||||
if (!item || tmi.team != item->TeamID()) {
|
||||
// Team not found in known teams list: insert an new item
|
||||
TeamListItem * item = new TeamListItem(tmi);
|
||||
TeamListItem* newItem = new TeamListItem(tmi);
|
||||
if (!item)
|
||||
index++; // No item with team id bigger found: insert at list end
|
||||
|
||||
AddItem(item, index);
|
||||
AddItem(newItem, index);
|
||||
}
|
||||
index++; // Move list sync head.
|
||||
}
|
||||
|
||||
// Remove tail list items, if we don't walk list thru the end
|
||||
while ((item = (TeamListItem *) ItemAt(index)) != NULL) {
|
||||
while ((item = (TeamListItem*) ItemAt(index)) != NULL) {
|
||||
RemoveItem(item);
|
||||
delete item;
|
||||
item = (TeamListItem *) ItemAt(++index);
|
||||
item = (TeamListItem*) ItemAt(++index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,50 +16,49 @@ class BMessageRunner;
|
||||
|
||||
class TeamListItem : public BStringItem {
|
||||
public:
|
||||
TeamListItem(team_info & teamInfo);
|
||||
TeamListItem(team_id teamId);
|
||||
|
||||
virtual ~TeamListItem();
|
||||
TeamListItem(team_info & teamInfo);
|
||||
TeamListItem(team_id teamId);
|
||||
virtual ~TeamListItem();
|
||||
|
||||
public:
|
||||
virtual void DrawItem(BView *owner, BRect itemRect,
|
||||
bool drawEverything = false);
|
||||
virtual void Update(BView *owner, const BFont *font);
|
||||
virtual void DrawItem(BView *owner, BRect itemRect,
|
||||
bool drawEverything = false);
|
||||
virtual void Update(BView *owner, const BFont *font);
|
||||
|
||||
team_id TeamID() { return fTeamInfo.team; };
|
||||
team_id TeamID() { return fTeamInfo.team; };
|
||||
|
||||
static int Compare(const void* a, const void* b);
|
||||
static int Compare(const void* a, const void* b);
|
||||
|
||||
private:
|
||||
status_t _SetTo(team_info & info);
|
||||
status_t _SetTo(team_info & info);
|
||||
|
||||
private:
|
||||
team_info fTeamInfo;
|
||||
BBitmap * fIcon;
|
||||
float fBaselineOffset;
|
||||
team_info fTeamInfo;
|
||||
BBitmap * fIcon;
|
||||
float fBaselineOffset;
|
||||
};
|
||||
|
||||
|
||||
class TeamsListView : public BListView {
|
||||
public:
|
||||
TeamsListView(BRect frame, const char* name);
|
||||
virtual ~TeamsListView();
|
||||
TeamsListView(BRect frame, const char* name);
|
||||
virtual ~TeamsListView();
|
||||
|
||||
TeamListItem* FindItem(team_id teamId);
|
||||
TeamListItem* FindItem(team_id teamId);
|
||||
|
||||
protected:
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
private:
|
||||
void _InitList();
|
||||
void _UpdateList();
|
||||
void _InitList();
|
||||
void _UpdateList();
|
||||
|
||||
private:
|
||||
BMessageRunner* fUpdateRunner;
|
||||
team_id fThisTeam;
|
||||
BMessageRunner* fUpdateRunner;
|
||||
team_id fThisTeam;
|
||||
};
|
||||
|
||||
static const uint32 kMsgUpdateTeamsList = 'uptl';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -16,13 +17,16 @@
|
||||
#include <Path.h>
|
||||
|
||||
#include "MessageCodes.h"
|
||||
#include "SettingsManager.h"
|
||||
#include "TeamsWindow.h"
|
||||
#include "TeamsListView.h"
|
||||
|
||||
|
||||
TeamsWindow::TeamsWindow()
|
||||
: BWindow(BRect(100, 100, 500, 250), "Teams", B_DOCUMENT_WINDOW,
|
||||
B_ASYNCHRONOUS_CONTROLS)
|
||||
TeamsWindow::TeamsWindow(SettingsManager* settingsManager)
|
||||
:
|
||||
BWindow(BRect(100, 100, 500, 250), "Teams", B_DOCUMENT_WINDOW,
|
||||
B_ASYNCHRONOUS_CONTROLS),
|
||||
fSettingsManager(settingsManager)
|
||||
{
|
||||
BMessage settings;
|
||||
_LoadSettings(settings);
|
||||
|
||||
@@ -11,24 +11,26 @@
|
||||
class BListView;
|
||||
class BFile;
|
||||
class BMessage;
|
||||
class SettingsManager;
|
||||
|
||||
|
||||
class TeamsWindow : public BWindow {
|
||||
public:
|
||||
TeamsWindow();
|
||||
virtual ~TeamsWindow();
|
||||
TeamsWindow(SettingsManager* settingsManager);
|
||||
virtual ~TeamsWindow();
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
private:
|
||||
|
||||
status_t _OpenSettings(BFile& file, uint32 mode);
|
||||
status_t _LoadSettings(BMessage& settings);
|
||||
status_t _SaveSettings();
|
||||
status_t _OpenSettings(BFile& file, uint32 mode);
|
||||
status_t _LoadSettings(BMessage& settings);
|
||||
status_t _SaveSettings();
|
||||
|
||||
private:
|
||||
BListView* fTeamsListView;
|
||||
BListView* fTeamsListView;
|
||||
SettingsManager* fSettingsManager;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user