2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-12-06 19:14:20 -05:00
|
|
|
|
2014-11-19 07:43:07 -05:00
|
|
|
#include "LogVisualizer.h"
|
|
|
|
|
#include "SVisualLoggerView.h"
|
|
|
|
|
#include "TimeSliderController.h"
|
|
|
|
|
#include "ITimeSlider.h"
|
|
|
|
|
#include "STimeSlider.h"
|
|
|
|
|
#include "SSearchBox.h"
|
|
|
|
|
#include "SSequencerSectionOverlay.h"
|
|
|
|
|
#include "STimelinesContainer.h"
|
|
|
|
|
#include "SVisualLoggerStatusView.h"
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "SVisualLoggerStatusView"
|
|
|
|
|
|
|
|
|
|
struct FLogStatusItem
|
|
|
|
|
{
|
|
|
|
|
FString ItemText;
|
|
|
|
|
FString ValueText;
|
|
|
|
|
|
|
|
|
|
TArray< TSharedPtr< FLogStatusItem > > Children;
|
|
|
|
|
|
|
|
|
|
FLogStatusItem(const FString& InItemText) : ItemText(InItemText) {}
|
|
|
|
|
FLogStatusItem(const FString& InItemText, const FString& InValueText) : ItemText(InItemText), ValueText(InValueText) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SVisualLoggerStatusView::Construct(const FArguments& InArgs, const TSharedRef<FUICommandList>& InCommandList)
|
|
|
|
|
{
|
|
|
|
|
ChildSlot
|
|
|
|
|
[
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
.Padding(1)
|
|
|
|
|
.BorderImage(FLogVisualizerStyle::Get().GetBrush("ToolPanel.GroupBorder"))
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(StatusItemsView, STreeView<TSharedPtr<FLogStatusItem> >)
|
|
|
|
|
.ItemHeight(40.0f)
|
|
|
|
|
.TreeItemsSource(&StatusItems)
|
|
|
|
|
.OnGenerateRow(this, &SVisualLoggerStatusView::HandleGenerateLogStatus)
|
|
|
|
|
.OnGetChildren(this, &SVisualLoggerStatusView::OnLogStatusGetChildren)
|
|
|
|
|
.SelectionMode(ESelectionMode::None)
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-18 12:12:43 -05:00
|
|
|
void GenerateChildren(TSharedPtr<FLogStatusItem> StatusItem, const FVisualLogStatusCategory LogCategory)
|
|
|
|
|
{
|
|
|
|
|
for (int32 LineIndex = 0; LineIndex < LogCategory.Data.Num(); LineIndex++)
|
|
|
|
|
{
|
|
|
|
|
FString KeyDesc, ValueDesc;
|
|
|
|
|
const bool bHasValue = LogCategory.GetDesc(LineIndex, KeyDesc, ValueDesc);
|
|
|
|
|
if (bHasValue)
|
|
|
|
|
{
|
|
|
|
|
StatusItem->Children.Add(MakeShareable(new FLogStatusItem(KeyDesc, ValueDesc)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const FVisualLogStatusCategory& Child : LogCategory.Children)
|
|
|
|
|
{
|
|
|
|
|
TSharedPtr<FLogStatusItem> ChildCategory = MakeShareable(new FLogStatusItem(Child.Category));
|
|
|
|
|
StatusItem->Children.Add(ChildCategory);
|
|
|
|
|
GenerateChildren(ChildCategory, Child);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-19 07:43:07 -05:00
|
|
|
void SVisualLoggerStatusView::OnItemSelectionChanged(const FVisualLogDevice::FVisualLogEntryItem& LogEntry)
|
|
|
|
|
{
|
2015-01-16 06:32:03 -05:00
|
|
|
TArray<FString> ExpandedCategories;
|
|
|
|
|
for (int32 ItemIndex = 0; ItemIndex < StatusItems.Num(); ItemIndex++)
|
|
|
|
|
{
|
|
|
|
|
const bool bIsExpanded = StatusItemsView->IsItemExpanded(StatusItems[ItemIndex]);
|
|
|
|
|
if (bIsExpanded)
|
|
|
|
|
{
|
|
|
|
|
ExpandedCategories.Add(StatusItems[ItemIndex]->ItemText);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-19 07:43:07 -05:00
|
|
|
|
|
|
|
|
StatusItems.Empty();
|
|
|
|
|
|
|
|
|
|
FString TimestampDesc = FString::Printf(TEXT("%.2fs"), LogEntry.Entry.TimeStamp);
|
|
|
|
|
StatusItems.Add(MakeShareable(new FLogStatusItem(LOCTEXT("VisLogTimestamp", "Time").ToString(), TimestampDesc)));
|
|
|
|
|
|
|
|
|
|
for (int32 CategoryIndex = 0; CategoryIndex < LogEntry.Entry.Status.Num(); CategoryIndex++)
|
|
|
|
|
{
|
2014-12-18 12:12:43 -05:00
|
|
|
if (LogEntry.Entry.Status[CategoryIndex].Data.Num() <= 0 && LogEntry.Entry.Status[CategoryIndex].Children.Num() == 0)
|
2014-11-19 07:43:07 -05:00
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<FLogStatusItem> StatusItem = MakeShareable(new FLogStatusItem(LogEntry.Entry.Status[CategoryIndex].Category));
|
|
|
|
|
for (int32 LineIndex = 0; LineIndex < LogEntry.Entry.Status[CategoryIndex].Data.Num(); LineIndex++)
|
|
|
|
|
{
|
|
|
|
|
FString KeyDesc, ValueDesc;
|
|
|
|
|
const bool bHasValue = LogEntry.Entry.Status[CategoryIndex].GetDesc(LineIndex, KeyDesc, ValueDesc);
|
|
|
|
|
if (bHasValue)
|
|
|
|
|
{
|
|
|
|
|
StatusItem->Children.Add(MakeShareable(new FLogStatusItem(KeyDesc, ValueDesc)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-18 12:12:43 -05:00
|
|
|
for (const FVisualLogStatusCategory& Child : LogEntry.Entry.Status[CategoryIndex].Children)
|
|
|
|
|
{
|
|
|
|
|
TSharedPtr<FLogStatusItem> ChildCategory = MakeShareable(new FLogStatusItem(Child.Category));
|
|
|
|
|
StatusItem->Children.Add(ChildCategory);
|
|
|
|
|
GenerateChildren(ChildCategory, Child);
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-19 07:43:07 -05:00
|
|
|
StatusItems.Add(StatusItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusItemsView->RequestTreeRefresh();
|
|
|
|
|
|
2015-01-16 06:32:03 -05:00
|
|
|
for (int32 ItemIndex = 0; ItemIndex < StatusItems.Num(); ItemIndex++)
|
|
|
|
|
{
|
|
|
|
|
for (const FString& Category : ExpandedCategories)
|
|
|
|
|
{
|
|
|
|
|
if (StatusItems[ItemIndex]->ItemText == Category)
|
|
|
|
|
{
|
|
|
|
|
StatusItemsView->SetItemExpansion(StatusItems[ItemIndex], true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-19 07:43:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SVisualLoggerStatusView::OnLogStatusGetChildren(TSharedPtr<FLogStatusItem> InItem, TArray< TSharedPtr<FLogStatusItem> >& OutItems)
|
|
|
|
|
{
|
|
|
|
|
OutItems = InItem->Children;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef<ITableRow> SVisualLoggerStatusView::HandleGenerateLogStatus(TSharedPtr<FLogStatusItem> InItem, const TSharedRef<STableViewBase>& OwnerTable)
|
|
|
|
|
{
|
|
|
|
|
if (InItem->Children.Num() > 0)
|
|
|
|
|
{
|
|
|
|
|
return SNew(STableRow<TSharedPtr<FLogStatusItem> >, OwnerTable)
|
|
|
|
|
[
|
|
|
|
|
SNew(STextBlock)
|
2014-12-18 08:37:06 -05:00
|
|
|
.Text(FText::FromString(InItem->ItemText))
|
2014-11-19 07:43:07 -05:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString TooltipText = FString::Printf(TEXT("%s: %s"), *InItem->ItemText, *InItem->ValueText);
|
|
|
|
|
return SNew(STableRow<TSharedPtr<FLogStatusItem> >, OwnerTable)
|
|
|
|
|
[
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
.BorderImage(FLogVisualizerStyle::Get().GetBrush("NoBorder"))
|
2014-12-18 08:37:06 -05:00
|
|
|
.ToolTipText(FText::FromString(TooltipText))
|
2014-11-19 07:43:07 -05:00
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SNew(STextBlock)
|
2014-12-18 08:37:06 -05:00
|
|
|
.Text(FText::FromString(InItem->ItemText))
|
2014-11-19 07:43:07 -05:00
|
|
|
.ColorAndOpacity(FColorList::Aquamarine)
|
|
|
|
|
]
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.Padding(4.0f, 0, 0, 0)
|
|
|
|
|
[
|
|
|
|
|
SNew(STextBlock)
|
2014-12-18 08:37:06 -05:00
|
|
|
.Text(FText::FromString(InItem->ValueText))
|
2014-11-19 07:43:07 -05:00
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|