Run: Use new GML compiler

This commit is contained in:
kleines Filmröllchen 2023-05-26 12:42:58 +02:00 committed by Sam Atkins
parent 05ea3d6be0
commit 6f554af9c5
4 changed files with 27 additions and 9 deletions

View file

@ -4,15 +4,12 @@ serenity_component(
TARGETS Run
)
stringify_gml(Run.gml RunGML.h run_gml)
compile_gml(Run.gml RunGML.cpp)
set(SOURCES
main.cpp
RunWindow.cpp
)
set(GENERATED_SOURCES
RunGML.h
RunGML.cpp
)
serenity_app(Run ICON app-run)

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2023, kleines Filmröllchen <filmroellchen@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Widget.h>
namespace Run {
class MainWidget : public GUI::Widget {
C_OBJECT(MainWidget)
public:
MainWidget() = default;
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
virtual ~MainWidget() override = default;
};
}

View file

@ -1,4 +1,4 @@
@GUI::Widget {
@Run::MainWidget {
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [4]

View file

@ -6,9 +6,9 @@
*/
#include "RunWindow.h"
#include "MainWidget.h"
#include <AK/LexicalPath.h>
#include <AK/URL.h>
#include <Applications/Run/RunGML.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
@ -41,8 +41,7 @@ RunWindow::RunWindow()
set_resizable(false);
set_minimizable(false);
auto main_widget = set_main_widget<GUI::Widget>();
main_widget->load_from_gml(run_gml).release_value_but_fixme_should_propagate_errors();
auto main_widget = set_main_widget<Run::MainWidget>();
m_icon_image_widget = *main_widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32));