139 lines
3.3 KiB
C++
139 lines
3.3 KiB
C++
#include "ClaudeCodeResultDialog.h"
|
|
#include "Framework/Application/SlateApplication.h"
|
|
#include "Widgets/SBoxPanel.h"
|
|
#include "Widgets/SWindow.h"
|
|
#include "Widgets/Input/SButton.h"
|
|
#include "Widgets/Layout/SBorder.h"
|
|
#include "Widgets/Layout/SScrollBox.h"
|
|
#include "Widgets/Layout/SSeparator.h"
|
|
#include "Widgets/Text/STextBlock.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "FClaudeCodeResultDialog"
|
|
|
|
void FClaudeCodeResultDialog::Show(const FInitResult& Result)
|
|
{
|
|
TSharedRef<SWindow> Window = SNew(SWindow)
|
|
.Title(LOCTEXT("DialogTitle", "Claude Code — Résultat de l'initialisation"))
|
|
.ClientSize(FVector2D(540, 340))
|
|
.SupportsMaximize(false)
|
|
.SupportsMinimize(false)
|
|
.IsTopmostWindow(true);
|
|
|
|
Window->SetContent(
|
|
SNew(SClaudeCodeResultDialog)
|
|
.InitResult(Result)
|
|
.ParentWindow(Window)
|
|
);
|
|
|
|
FSlateApplication::Get().AddModalWindow(Window, FSlateApplication::Get().GetActiveTopLevelWindow());
|
|
}
|
|
|
|
void SClaudeCodeResultDialog::Construct(const FArguments& InArgs)
|
|
{
|
|
ParentWindow = InArgs._ParentWindow;
|
|
const FInitResult& Result = InArgs._InitResult;
|
|
|
|
TSharedRef<SVerticalBox> StepsList = SNew(SVerticalBox);
|
|
|
|
for (const FInitStep& Step : Result.Steps)
|
|
{
|
|
const FString Icon = Step.bSuccess ? TEXT("✓") : TEXT("✗");
|
|
const FSlateColor IconColor = Step.bSuccess
|
|
? FSlateColor(FLinearColor(0.2f, 0.85f, 0.2f))
|
|
: FSlateColor(FLinearColor(0.9f, 0.2f, 0.2f));
|
|
|
|
StepsList->AddSlot()
|
|
.AutoHeight()
|
|
.Padding(4.f, 4.f)
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+ SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
.VAlign(VAlign_Top)
|
|
.Padding(0.f, 1.f, 10.f, 0.f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(FText::FromString(Icon))
|
|
.ColorAndOpacity(IconColor)
|
|
]
|
|
+ SHorizontalBox::Slot()
|
|
.FillWidth(1.f)
|
|
[
|
|
SNew(SVerticalBox)
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(Step.Name)
|
|
]
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.Padding(0.f, 2.f, 0.f, 0.f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(FText::FromString(Step.Details))
|
|
.ColorAndOpacity(FSlateColor(FLinearColor(0.55f, 0.55f, 0.55f)))
|
|
.AutoWrapText(true)
|
|
]
|
|
]
|
|
];
|
|
}
|
|
|
|
const FText StatusText = Result.bOverallSuccess
|
|
? LOCTEXT("StatusOk", "Initialisation réussie. Redémarrez Claude Code pour activer le serveur MCP.")
|
|
: LOCTEXT("StatusFail", "L'initialisation a rencontré des erreurs. Consultez les détails ci-dessus.");
|
|
|
|
const FSlateColor StatusColor = Result.bOverallSuccess
|
|
? FSlateColor(FLinearColor(0.2f, 0.85f, 0.2f))
|
|
: FSlateColor(FLinearColor(0.9f, 0.2f, 0.2f));
|
|
|
|
ChildSlot
|
|
[
|
|
SNew(SVerticalBox)
|
|
+ SVerticalBox::Slot()
|
|
.FillHeight(1.f)
|
|
.Padding(14.f, 12.f)
|
|
[
|
|
SNew(SScrollBox)
|
|
+ SScrollBox::Slot()
|
|
[
|
|
StepsList
|
|
]
|
|
]
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
SNew(SSeparator)
|
|
]
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.Padding(14.f, 8.f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(StatusText)
|
|
.ColorAndOpacity(StatusColor)
|
|
.AutoWrapText(true)
|
|
]
|
|
+ SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.HAlign(HAlign_Right)
|
|
.Padding(14.f, 4.f, 14.f, 14.f)
|
|
[
|
|
SNew(SButton)
|
|
.Text(LOCTEXT("CloseBtn", "Fermer"))
|
|
.OnClicked(this, &SClaudeCodeResultDialog::OnCloseClicked)
|
|
]
|
|
];
|
|
}
|
|
|
|
FReply SClaudeCodeResultDialog::OnCloseClicked()
|
|
{
|
|
if (ParentWindow.IsValid())
|
|
{
|
|
ParentWindow->RequestDestroyWindow();
|
|
}
|
|
return FReply::Handled();
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE
|