Factor out report name generation as a utility function.
This commit is contained in:
@@ -10,7 +10,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <DateTime.h>
|
|
||||||
#include <FilePanel.h>
|
#include <FilePanel.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
#include "StackTraceView.h"
|
#include "StackTraceView.h"
|
||||||
#include "Tracing.h"
|
#include "Tracing.h"
|
||||||
#include "TypeComponentPath.h"
|
#include "TypeComponentPath.h"
|
||||||
|
#include "UiUtils.h"
|
||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
#include "WatchPromptWindow.h"
|
#include "WatchPromptWindow.h"
|
||||||
@@ -221,21 +221,12 @@ TeamWindow::MessageReceived(BMessage* message)
|
|||||||
case MSG_CHOOSE_DEBUG_REPORT_LOCATION:
|
case MSG_CHOOSE_DEBUG_REPORT_LOCATION:
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
BPath teamPath(fTeam->Name());
|
char filename[B_FILE_NAME_LENGTH];
|
||||||
BDateTime currentTime;
|
UiUtils::ReportNameForTeam(fTeam, filename, sizeof(filename));
|
||||||
currentTime.SetTime_t(time(NULL));
|
|
||||||
BString filename;
|
|
||||||
filename.SetToFormat("%s-%" B_PRId32 "-debug-%02"
|
|
||||||
B_PRId32 "-%02" B_PRId32 "-%02" B_PRId32 "-%02"
|
|
||||||
B_PRId32 "-%02" B_PRId32 "-%02" B_PRId32 ".report",
|
|
||||||
teamPath.Leaf(), fTeam->ID(), currentTime.Date().Day(),
|
|
||||||
currentTime.Date().Month(), currentTime.Date().Year(),
|
|
||||||
currentTime.Time().Hour(), currentTime.Time().Minute(),
|
|
||||||
currentTime.Time().Second());
|
|
||||||
BMessenger msgr(this);
|
BMessenger msgr(this);
|
||||||
fFilePanel = new BFilePanel(B_SAVE_PANEL, &msgr,
|
fFilePanel = new BFilePanel(B_SAVE_PANEL, &msgr,
|
||||||
NULL, 0, false, new BMessage(MSG_GENERATE_DEBUG_REPORT));
|
NULL, 0, false, new BMessage(MSG_GENERATE_DEBUG_REPORT));
|
||||||
fFilePanel->SetSaveText(filename.String());
|
fFilePanel->SetSaveText(filename);
|
||||||
fFilePanel->Show();
|
fFilePanel->Show();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
delete fFilePanel;
|
delete fFilePanel;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
|
* Copyright 2012, Rene Gollent, rene@gollent.com.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -8,11 +9,14 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <DateTime.h>
|
||||||
|
#include <Path.h>
|
||||||
#include <Variant.h>
|
#include <Variant.h>
|
||||||
|
|
||||||
#include "FunctionInstance.h"
|
#include "FunctionInstance.h"
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
#include "StackFrame.h"
|
#include "StackFrame.h"
|
||||||
|
#include "Team.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -134,3 +138,21 @@ UiUtils::ImageTypeToString(image_type type, char* buffer, size_t bufferSize)
|
|||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ const char*
|
||||||
|
UiUtils::ReportNameForTeam(::Team* team, char* buffer, size_t bufferSize)
|
||||||
|
{
|
||||||
|
BPath teamPath(team->Name());
|
||||||
|
BDateTime currentTime;
|
||||||
|
currentTime.SetTime_t(time(NULL));
|
||||||
|
snprintf(buffer, bufferSize, "%s-%" B_PRId32 "-debug-%02" B_PRId32 "-%02"
|
||||||
|
B_PRId32 "-%02" B_PRId32 "-%02" B_PRId32 "-%02" B_PRId32 "-%02"
|
||||||
|
B_PRId32 ".report", teamPath.Leaf(), team->ID(),
|
||||||
|
currentTime.Date().Day(), currentTime.Date().Month(),
|
||||||
|
currentTime.Date().Year(), currentTime.Time().Hour(),
|
||||||
|
currentTime.Time().Minute(), currentTime.Time().Second());
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
class BVariant;
|
class BVariant;
|
||||||
class StackFrame;
|
class StackFrame;
|
||||||
|
class Team;
|
||||||
|
|
||||||
|
|
||||||
class UiUtils {
|
class UiUtils {
|
||||||
@@ -25,6 +26,9 @@ public:
|
|||||||
char* buffer, size_t bufferSize);
|
char* buffer, size_t bufferSize);
|
||||||
static const char* ImageTypeToString(image_type type,
|
static const char* ImageTypeToString(image_type type,
|
||||||
char* buffer, size_t bufferSize);
|
char* buffer, size_t bufferSize);
|
||||||
|
|
||||||
|
static const char* ReportNameForTeam(::Team* team,
|
||||||
|
char* buffer, size_t bufferSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user