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