Add a Quit button to the Team Monitor.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41215 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <NodeInfo.h>
|
#include <NodeInfo.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
#include <Roster.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -34,6 +35,10 @@ TeamListItem::TeamListItem(team_info &tinfo)
|
|||||||
nodeInfo.GetTrackerIcon(&fIcon, B_MINI_ICON);
|
nodeInfo.GetTrackerIcon(&fIcon, B_MINI_ICON);
|
||||||
nodeInfo.GetTrackerIcon(&fLargeIcon, B_LARGE_ICON);
|
nodeInfo.GetTrackerIcon(&fLargeIcon, B_LARGE_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app_info appInfo;
|
||||||
|
if (be_roster->GetRunningAppInfo(fInfo.team, &appInfo) == B_OK)
|
||||||
|
fAppSignature = appInfo.signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -145,3 +150,13 @@ TeamListItem::IsSystemServer()
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
TeamListItem::IsApplication()
|
||||||
|
{
|
||||||
|
if (fAppSignature.Length() > 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <ListItem.h>
|
#include <ListItem.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
class TeamListItem : public BListItem {
|
class TeamListItem : public BListItem {
|
||||||
@@ -26,7 +27,9 @@ public:
|
|||||||
const team_info* GetInfo();
|
const team_info* GetInfo();
|
||||||
const BBitmap* LargeIcon() { return &fLargeIcon; };
|
const BBitmap* LargeIcon() { return &fLargeIcon; };
|
||||||
const BPath* Path() { return &fPath; };
|
const BPath* Path() { return &fPath; };
|
||||||
|
const BString* AppSignature() { return &fAppSignature; };
|
||||||
bool IsSystemServer();
|
bool IsSystemServer();
|
||||||
|
bool IsApplication();
|
||||||
|
|
||||||
bool Found() const { return fFound; }
|
bool Found() const { return fFound; }
|
||||||
void SetFound(bool found) { fFound = found; }
|
void SetFound(bool found) { fFound = found; }
|
||||||
@@ -37,6 +40,7 @@ private:
|
|||||||
team_info fInfo;
|
team_info fInfo;
|
||||||
BBitmap fIcon, fLargeIcon;
|
BBitmap fIcon, fLargeIcon;
|
||||||
BPath fPath;
|
BPath fPath;
|
||||||
|
BString fAppSignature;
|
||||||
bool fFound;
|
bool fFound;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ static const uint32 kMsgLaunchTerminal = 'TMlt';
|
|||||||
const uint32 TM_CANCEL = 'TMca';
|
const uint32 TM_CANCEL = 'TMca';
|
||||||
const uint32 TM_FORCE_REBOOT = 'TMfr';
|
const uint32 TM_FORCE_REBOOT = 'TMfr';
|
||||||
const uint32 TM_KILL_APPLICATION = 'TMka';
|
const uint32 TM_KILL_APPLICATION = 'TMka';
|
||||||
|
const uint32 TM_QUIT_APPLICATION = 'TMqa';
|
||||||
const uint32 TM_RESTART_DESKTOP = 'TMrd';
|
const uint32 TM_RESTART_DESKTOP = 'TMrd';
|
||||||
const uint32 TM_SELECTED_TEAM = 'TMst';
|
const uint32 TM_SELECTED_TEAM = 'TMst';
|
||||||
|
|
||||||
@@ -97,6 +98,11 @@ TeamMonitorWindow::TeamMonitorWindow()
|
|||||||
groupView->AddChild(fKillButton);
|
groupView->AddChild(fKillButton);
|
||||||
fKillButton->SetEnabled(false);
|
fKillButton->SetEnabled(false);
|
||||||
|
|
||||||
|
fQuitButton = new BButton("quit", "Quit Application",
|
||||||
|
new BMessage(TM_QUIT_APPLICATION));
|
||||||
|
groupView->AddChild(fQuitButton);
|
||||||
|
fQuitButton->SetEnabled(false);
|
||||||
|
|
||||||
groupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
groupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
||||||
|
|
||||||
fDescriptionView = new TeamDescriptionView;
|
fDescriptionView = new TeamDescriptionView;
|
||||||
@@ -195,6 +201,18 @@ TeamMonitorWindow::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TM_QUIT_APPLICATION:
|
||||||
|
{
|
||||||
|
TeamListItem* item = dynamic_cast<TeamListItem*>(fListView->ItemAt(
|
||||||
|
fListView->CurrentSelection()));
|
||||||
|
if (item != NULL) {
|
||||||
|
BMessenger messenger(item->AppSignature()->String(),
|
||||||
|
item->GetInfo()->team);
|
||||||
|
messenger.SendMessage(B_QUIT_REQUESTED);
|
||||||
|
UpdateList();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TM_RESTART_DESKTOP:
|
case TM_RESTART_DESKTOP:
|
||||||
{
|
{
|
||||||
if (!be_roster->IsRunning(kTrackerSignature))
|
if (!be_roster->IsRunning(kTrackerSignature))
|
||||||
@@ -211,6 +229,7 @@ TeamMonitorWindow::MessageReceived(BMessage *msg)
|
|||||||
TeamListItem* item = (TeamListItem*)fListView->ItemAt(
|
TeamListItem* item = (TeamListItem*)fListView->ItemAt(
|
||||||
fListView->CurrentSelection());
|
fListView->CurrentSelection());
|
||||||
fDescriptionView->SetItem(item);
|
fDescriptionView->SetItem(item);
|
||||||
|
fQuitButton->SetEnabled(item && item->IsApplication());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TM_CANCEL:
|
case TM_CANCEL:
|
||||||
@@ -273,6 +292,7 @@ TeamMonitorWindow::UpdateList()
|
|||||||
if (item == fDescriptionView->Item()) {
|
if (item == fDescriptionView->Item()) {
|
||||||
fDescriptionView->SetItem(NULL);
|
fDescriptionView->SetItem(NULL);
|
||||||
fKillButton->SetEnabled(false);
|
fKillButton->SetEnabled(false);
|
||||||
|
fQuitButton->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete fListView->RemoveItem(i);
|
delete fListView->RemoveItem(i);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ private:
|
|||||||
BListView* fListView;
|
BListView* fListView;
|
||||||
BButton* fCancelButton;
|
BButton* fCancelButton;
|
||||||
BButton* fKillButton;
|
BButton* fKillButton;
|
||||||
|
BButton* fQuitButton;
|
||||||
BButton* fRestartButton;
|
BButton* fRestartButton;
|
||||||
TeamDescriptionView* fDescriptionView;
|
TeamDescriptionView* fDescriptionView;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user