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