mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
CrashReporter: Port CrashReporter to GML Compiler
This commit is contained in:
parent
4cb2ff1428
commit
44d623d588
4 changed files with 30 additions and 9 deletions
|
@ -4,16 +4,13 @@ serenity_component(
|
||||||
TARGETS CrashReporter
|
TARGETS CrashReporter
|
||||||
)
|
)
|
||||||
|
|
||||||
stringify_gml(CrashReporterWindow.gml CrashReporterWindowGML.h crash_reporter_window_gml)
|
compile_gml(CrashReporterWindow.gml CrashReporterWindowGML.cpp)
|
||||||
|
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
CrashReporterWindowGML.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(GENERATED_SOURCES
|
|
||||||
CrashReporterWindowGML.h
|
|
||||||
)
|
|
||||||
|
|
||||||
serenity_app(CrashReporter ICON app-crash-reporter)
|
serenity_app(CrashReporter ICON app-crash-reporter)
|
||||||
target_link_libraries(CrashReporter PRIVATE LibCore LibCoredump LibDebug LibDesktop LibFileSystem LibFileSystemAccessClient LibGfx LibGUI LibMain LibThreading)
|
target_link_libraries(CrashReporter PRIVATE LibCore LibCoredump LibDebug LibDesktop LibFileSystem LibFileSystemAccessClient LibGfx LibGUI LibMain LibThreading)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@GUI::Widget {
|
@CrashReporter::MainWidget {
|
||||||
fill_with_background_color: true
|
fill_with_background_color: true
|
||||||
layout: @GUI::VerticalBoxLayout {
|
layout: @GUI::VerticalBoxLayout {
|
||||||
margins: [4]
|
margins: [4]
|
||||||
|
|
24
Userland/Applications/CrashReporter/MainWidget.h
Normal file
24
Userland/Applications/CrashReporter/MainWidget.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023, the SerenityOS developers.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibGUI/Widget.h>
|
||||||
|
|
||||||
|
namespace CrashReporter {
|
||||||
|
|
||||||
|
class MainWidget final : public GUI::Widget {
|
||||||
|
C_OBJECT(MainWidget)
|
||||||
|
|
||||||
|
public:
|
||||||
|
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
|
||||||
|
virtual ~MainWidget() override = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWidget() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -6,11 +6,11 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "MainWidget.h"
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <Applications/CrashReporter/CrashReporterWindowGML.h>
|
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibCoredump/Backtrace.h>
|
#include <LibCoredump/Backtrace.h>
|
||||||
|
@ -208,8 +208,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
unlink_coredump(coredump_path);
|
unlink_coredump(coredump_path);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto widget = window->set_main_widget<GUI::Widget>();
|
auto widget = TRY(CrashReporter::MainWidget::try_create());
|
||||||
TRY(widget->load_from_gml(crash_reporter_window_gml));
|
window->set_main_widget(widget);
|
||||||
|
|
||||||
auto& icon_image_widget = *widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
|
auto& icon_image_widget = *widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
|
||||||
icon_image_widget.set_bitmap(GUI::FileIconProvider::icon_for_executable(executable_path).bitmap_for_size(32));
|
icon_image_widget.set_bitmap(GUI::FileIconProvider::icon_for_executable(executable_path).bitmap_for_size(32));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue