Prompt user for location to save report to.
This commit is contained in:
@@ -56,6 +56,7 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
MSG_CHOOSE_DEBUG_REPORT_LOCATION = 'ccrl',
|
||||||
MSG_LOCATE_SOURCE_IF_NEEDED = 'lsin'
|
MSG_LOCATE_SOURCE_IF_NEEDED = 'lsin'
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ TeamWindow::TeamWindow(::Team* team, UserInterfaceListener* listener)
|
|||||||
fStepIntoButton(NULL),
|
fStepIntoButton(NULL),
|
||||||
fStepOutButton(NULL),
|
fStepOutButton(NULL),
|
||||||
fInspectorWindow(NULL),
|
fInspectorWindow(NULL),
|
||||||
fSourceLocatePanel(NULL)
|
fFilePanel(NULL)
|
||||||
{
|
{
|
||||||
fTeam->Lock();
|
fTeam->Lock();
|
||||||
BString name = fTeam->Name();
|
BString name = fTeam->Name();
|
||||||
@@ -145,7 +146,7 @@ TeamWindow::~TeamWindow()
|
|||||||
_SetActiveImage(NULL);
|
_SetActiveImage(NULL);
|
||||||
_SetActiveThread(NULL);
|
_SetActiveThread(NULL);
|
||||||
|
|
||||||
delete fSourceLocatePanel;
|
delete fFilePanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -217,12 +218,10 @@ void
|
|||||||
TeamWindow::MessageReceived(BMessage* message)
|
TeamWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case MSG_GENERATE_DEBUG_REPORT:
|
case MSG_CHOOSE_DEBUG_REPORT_LOCATION:
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
BPath path;
|
|
||||||
BPath teamPath(fTeam->Name());
|
BPath teamPath(fTeam->Name());
|
||||||
find_directory(B_DESKTOP_DIRECTORY, &path);
|
|
||||||
BDateTime currentTime;
|
BDateTime currentTime;
|
||||||
currentTime.SetTime_t(time(NULL));
|
currentTime.SetTime_t(time(NULL));
|
||||||
BString filename;
|
BString filename;
|
||||||
@@ -233,13 +232,30 @@ TeamWindow::MessageReceived(BMessage* message)
|
|||||||
currentTime.Date().Month(), currentTime.Date().Year(),
|
currentTime.Date().Month(), currentTime.Date().Year(),
|
||||||
currentTime.Time().Hour(), currentTime.Time().Minute(),
|
currentTime.Time().Hour(), currentTime.Time().Minute(),
|
||||||
currentTime.Time().Second());
|
currentTime.Time().Second());
|
||||||
path.Append(filename);
|
BMessenger msgr(this);
|
||||||
entry_ref ref;
|
fFilePanel = new BFilePanel(B_SAVE_PANEL, &msgr,
|
||||||
status_t result = get_ref_for_path(path.Path(), &ref);
|
NULL, 0, false, new BMessage(MSG_GENERATE_DEBUG_REPORT));
|
||||||
if (result == B_OK)
|
fFilePanel->SetSaveText(filename.String());
|
||||||
fListener->DebugReportRequested(&ref);
|
fFilePanel->Show();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// TODO: notify user
|
delete fFilePanel;
|
||||||
|
fFilePanel = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MSG_GENERATE_DEBUG_REPORT:
|
||||||
|
{
|
||||||
|
delete fFilePanel;
|
||||||
|
fFilePanel = NULL;
|
||||||
|
|
||||||
|
BPath path;
|
||||||
|
entry_ref ref;
|
||||||
|
if (message->FindRef("directory", &ref) == B_OK
|
||||||
|
&& message->HasString("name")) {
|
||||||
|
path.SetTo(&ref);
|
||||||
|
path.Append(message->FindString("name"));
|
||||||
|
if (get_ref_for_path(path.Path(), &ref) == B_OK)
|
||||||
|
fListener->DebugReportRequested(&ref);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -312,14 +328,14 @@ TeamWindow::MessageReceived(BMessage* message)
|
|||||||
->SourceFile() != NULL && fActiveSourceCode != NULL
|
->SourceFile() != NULL && fActiveSourceCode != NULL
|
||||||
&& fActiveSourceCode->GetSourceFile() == NULL) {
|
&& fActiveSourceCode->GetSourceFile() == NULL) {
|
||||||
try {
|
try {
|
||||||
if (fSourceLocatePanel == NULL) {
|
if (fFilePanel == NULL) {
|
||||||
fSourceLocatePanel = new BFilePanel(B_OPEN_PANEL,
|
fFilePanel = new BFilePanel(B_OPEN_PANEL,
|
||||||
new BMessenger(this));
|
new BMessenger(this));
|
||||||
}
|
}
|
||||||
fSourceLocatePanel->Show();
|
fFilePanel->Show();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
delete fSourceLocatePanel;
|
delete fFilePanel;
|
||||||
fSourceLocatePanel = NULL;
|
fFilePanel = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -828,7 +844,7 @@ TeamWindow::_Init()
|
|||||||
menu = new BMenu("Tools");
|
menu = new BMenu("Tools");
|
||||||
fMenuBar->AddItem(menu);
|
fMenuBar->AddItem(menu);
|
||||||
item = new BMenuItem("Save Debug Report",
|
item = new BMenuItem("Save Debug Report",
|
||||||
new BMessage(MSG_GENERATE_DEBUG_REPORT));
|
new BMessage(MSG_CHOOSE_DEBUG_REPORT_LOCATION));
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
item = new BMenuItem("Inspect Memory",
|
item = new BMenuItem("Inspect Memory",
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ private:
|
|||||||
BSplitView* fThreadSplitView;
|
BSplitView* fThreadSplitView;
|
||||||
InspectorWindow* fInspectorWindow;
|
InspectorWindow* fInspectorWindow;
|
||||||
GuiTeamUiSettings fUiSettings;
|
GuiTeamUiSettings fUiSettings;
|
||||||
BFilePanel* fSourceLocatePanel;
|
BFilePanel* fFilePanel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user