20
20
#include " EditorStyleSet.h"
21
21
#endif
22
22
23
+ const FString FSentrySettingsCustomization::DefaultCrcEndpoint = TEXT(" https://datarouter.ol.epicgames.com/datarouter/api/v1/public/data" );
24
+
25
+ void OnDocumentationLinkClicked (const FSlateHyperlinkRun::FMetadata& Metadata);
26
+
23
27
TSharedRef<IDetailCustomization> FSentrySettingsCustomization::MakeInstance ()
24
28
{
25
29
return MakeShareable (new FSentrySettingsCustomization);
@@ -35,6 +39,9 @@ void FSentrySettingsCustomization::CustomizeDetails(IDetailLayoutBuilder& Detail
35
39
void FSentrySettingsCustomization::DrawDebugSymbolsNotice (IDetailLayoutBuilder& DetailBuilder)
36
40
{
37
41
IDetailCategoryBuilder& DebugSymbolsCategory = DetailBuilder.EditCategory (TEXT (" Debug Symbols" ));
42
+ IDetailCategoryBuilder& CrashReporterCategory = DetailBuilder.EditCategory (TEXT (" Crash Reporter" ));
43
+
44
+ TSharedPtr<IPropertyHandle> CrashReporterUrlHandle = DetailBuilder.GetProperty (GET_MEMBER_NAME_CHECKED (USentrySettings, CrashReporterUrl));
38
45
39
46
#if ENGINE_MAJOR_VERSION >= 5
40
47
const ISlateStyle& Style = FAppStyle::Get ();
@@ -50,17 +57,97 @@ void FSentrySettingsCustomization::DrawDebugSymbolsNotice(IDetailLayoutBuilder&
50
57
[
51
58
SNew (SHorizontalBox)
52
59
+ SHorizontalBox::Slot ()
53
- .Padding (FMargin (10 , 10 , 10 , 10 ))
54
- .FillWidth (1 .0f )
60
+ .Padding (FMargin (10 , 10 , 10 , 10 ))
61
+ .FillWidth (1 .0f )
55
62
[
56
63
SNew (SRichTextBlock)
57
- .Text (FText::FromString (TEXT (" Note that the Sentry SDK creates a <RichTextBlock.TextHighlight>sentry.properties</> file at project root to store the configuration, that should <RichTextBlock.TextHighlight>NOT</> be made publicly available." )))
64
+ .Text (FText::FromString (TEXT (" Note that the Sentry SDK creates a <RichTextBlock.TextHighlight>sentry.properties</> file at project root to store the configuration, "
65
+ " that should <RichTextBlock.TextHighlight>NOT</> be made publicly available." )))
58
66
.TextStyle (Style , " MessageLog" )
59
67
.DecoratorStyleSet (&Style )
60
68
.AutoWrapText (true )
61
69
]
62
70
]
63
71
];
72
+
73
+ CrashReporterCategory.AddCustomRow (FText::FromString (TEXT (" CrashReporter" )), false )
74
+ .WholeRowWidget
75
+ [
76
+ SNew (SVerticalBox)
77
+ + SVerticalBox::Slot ()
78
+ .Padding (1 )
79
+ .AutoHeight ()
80
+ [
81
+ SNew (SBorder)
82
+ .Padding (1 )
83
+ [
84
+ SNew (SHorizontalBox)
85
+ + SHorizontalBox::Slot ()
86
+ .Padding (FMargin (10 , 10 , 10 , 10 ))
87
+ .FillWidth (1 .0f )
88
+ [
89
+ SNew (SRichTextBlock)
90
+ .Text (FText::FromString (TEXT (" In order to configure Crash Reporter use Sentry's Unreal Engine Endpoint from the Client Keys settings page. "
91
+ " This will include which project within Sentry you want to see the crashes arriving in real time. "
92
+ " Note that it's accomplished by modifying the `CrashReportClient` section in the global <RichTextBlock.TextHighlight>DefaultEngine.ini</> file. "
93
+ " Changing the engine is necessary for this to work!" )))
94
+ .TextStyle (Style , " MessageLog" )
95
+ .DecoratorStyleSet (&Style )
96
+ .AutoWrapText (true )
97
+ ]
98
+ ]
99
+ ]
100
+ + SVerticalBox::Slot ()
101
+ .Padding (FMargin (0 , 10 , 0 , 10 ))
102
+ .VAlign (VAlign_Top)
103
+ [
104
+ SNew (SRichTextBlock)
105
+ .Text (FText::FromString (TEXT (" <a id=\" browser\" href=\" https://docs.sentry.io/platforms/unreal/setup-crashreporter/\" >View the Crash Reporter setup documentation -></>" )))
106
+ .AutoWrapText (true )
107
+ .DecoratorStyleSet (&FCoreStyle::Get ())
108
+ + SRichTextBlock::HyperlinkDecorator (TEXT (" browser" ), FSlateHyperlinkRun::FOnClick::CreateStatic (&OnDocumentationLinkClicked))
109
+ ]
110
+ + SVerticalBox::Slot ()
111
+ .Padding (FMargin (0 , 10 , 0 , 10 ))
112
+ .AutoHeight ()
113
+ [
114
+ SNew (SHorizontalBox)
115
+ + SHorizontalBox::Slot ()
116
+ .AutoWidth ()
117
+ .Padding (FMargin (0 , 0 , 5 , 0 ))
118
+ [
119
+ SNew (SButton)
120
+ .HAlign (HAlign_Center)
121
+ .VAlign (VAlign_Center)
122
+ .ContentPadding (FMargin (8 , 2 ))
123
+ .OnClicked_Lambda ([=]() -> FReply
124
+ {
125
+ FString CrcEndpoint;
126
+ CrashReporterUrlHandle->GetValue (CrcEndpoint);
127
+ UpdateCrcConfig (CrcEndpoint);
128
+ return FReply::Handled ();
129
+ })
130
+ .Text (FText::FromString (TEXT (" Update global settings" )))
131
+ .ToolTipText (FText::FromString (TEXT (" Update global crash reporter settings in DefaultEngine.ini configuration file." )))
132
+ ]
133
+ + SHorizontalBox::Slot ()
134
+ .AutoWidth ()
135
+ .Padding (FMargin (5 , 0 , 5 , 0 ))
136
+ [
137
+ SNew (SButton)
138
+ .HAlign (HAlign_Center)
139
+ .VAlign (VAlign_Center)
140
+ .ContentPadding (FMargin (8 , 2 ))
141
+ .OnClicked_Lambda ([=]() -> FReply
142
+ {
143
+ UpdateCrcConfig (DefaultCrcEndpoint);
144
+ return FReply::Handled ();
145
+ })
146
+ .Text (FText::FromString (" Reset" ))
147
+ .ToolTipText (FText::FromString (TEXT (" Reset crash reporter settings to defaults." )))
148
+ ]
149
+ ]
150
+ ];
64
151
}
65
152
66
153
void FSentrySettingsCustomization::SetPropertiesUpdateHandler (IDetailLayoutBuilder& DetailBuilder)
@@ -116,3 +203,42 @@ void FSentrySettingsCustomization::UpdatePropertiesFile(const FString& PropertyN
116
203
PropertiesFile.SetString (TEXT (" Sentry" ), *PropertyName, *PropertyValue);
117
204
PropertiesFile.Write (PropertiesFilePath);
118
205
}
206
+
207
+ void FSentrySettingsCustomization::UpdateCrcConfig (const FString& Url)
208
+ {
209
+ if (Url.IsEmpty ())
210
+ {
211
+ return ;
212
+ }
213
+
214
+ const FString CrcConfigFilePath = GetCrcConfigPath ();
215
+
216
+ if (!FPaths::FileExists (CrcConfigFilePath))
217
+ {
218
+ return ;
219
+ }
220
+
221
+ FConfigCacheIni CrcConfigFile (EConfigCacheType::DiskBacked);
222
+ CrcConfigFile.LoadFile (CrcConfigFilePath);
223
+
224
+ const FString CrcSectionName = FString (TEXT (" CrashReportClient" ));
225
+
226
+ const FString DataRouterUrlKey = FString (TEXT (" DataRouterUrl" ));
227
+ const FString DataRouterUrlValue = Url;
228
+
229
+ CrcConfigFile.SetString (*CrcSectionName, *DataRouterUrlKey, *DataRouterUrlValue, CrcConfigFilePath);
230
+ }
231
+
232
+ FString FSentrySettingsCustomization::GetCrcConfigPath ()
233
+ {
234
+ return FPaths::Combine (FPaths::EngineDir (), TEXT (" Programs" ), TEXT (" CrashReportClient" ), TEXT (" Config" ), TEXT (" DefaultEngine.ini" ));
235
+ }
236
+
237
+ void OnDocumentationLinkClicked (const FSlateHyperlinkRun::FMetadata& Metadata)
238
+ {
239
+ const FString* UrlPtr = Metadata.Find (TEXT (" href" ));
240
+ if (UrlPtr)
241
+ {
242
+ FPlatformProcess::LaunchURL (**UrlPtr, nullptr , nullptr );
243
+ }
244
+ }
0 commit comments