SpaceAnalyzer: Port to GML compiler
This commit is contained in:
parent
986130d9ea
commit
18124a5611
Notes:
sideshowbarker
2024-07-17 05:09:48 +09:00
Author: https://github.com/kemzeb Commit: https://github.com/SerenityOS/serenity/commit/18124a5611 Pull-request: https://github.com/SerenityOS/serenity/pull/21238 Reviewed-by: https://github.com/gmta ✅
5 changed files with 30 additions and 11 deletions
Userland/Applications/SpaceAnalyzer
|
@ -3,18 +3,15 @@ serenity_component(
|
|||
TARGETS SpaceAnalyzer
|
||||
)
|
||||
|
||||
stringify_gml(SpaceAnalyzer.gml SpaceAnalyzerGML.h space_analyzer_gml)
|
||||
compile_gml(SpaceAnalyzer.gml SpaceAnalyzerGML.cpp)
|
||||
|
||||
set(SOURCES
|
||||
ProgressWindow.cpp
|
||||
SpaceAnalyzerGML.cpp
|
||||
Tree.cpp
|
||||
TreeMapWidget.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(GENERATED_SOURCES
|
||||
SpaceAnalyzerGML.h
|
||||
)
|
||||
|
||||
serenity_app(SpaceAnalyzer ICON app-space-analyzer)
|
||||
target_link_libraries(SpaceAnalyzer PRIVATE LibCore LibDesktop LibFileSystem LibGfx LibGUI LibIPC LibMain)
|
||||
|
|
23
Userland/Applications/SpaceAnalyzer/MainWidget.h
Normal file
23
Userland/Applications/SpaceAnalyzer/MainWidget.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2023, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
namespace SpaceAnalyzer {
|
||||
|
||||
class MainWidget final : public GUI::Widget {
|
||||
C_OBJECT(MainWidget)
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
|
||||
virtual ~MainWidget() override = default;
|
||||
|
||||
private:
|
||||
MainWidget() = default;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@GUI::Widget {
|
||||
@SpaceAnalyzer::MainWidget {
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
spacing: 0
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include <LibGfx/Font/Font.h>
|
||||
#include <WindowServer/WindowManager.h>
|
||||
|
||||
REGISTER_WIDGET(SpaceAnalyzer, TreeMapWidget)
|
||||
|
||||
namespace SpaceAnalyzer {
|
||||
|
||||
static constexpr Array colors = {
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "MainWidget.h"
|
||||
#include "Tree.h"
|
||||
#include "TreeMapWidget.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <Applications/SpaceAnalyzer/SpaceAnalyzerGML.h>
|
||||
#include <LibDesktop/Launcher.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
#include <LibGUI/Application.h>
|
||||
|
@ -53,8 +53,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
// Load widgets.
|
||||
auto main_widget = window->set_main_widget<GUI::Widget>();
|
||||
TRY(main_widget->load_from_gml(space_analyzer_gml));
|
||||
auto main_widget = TRY(SpaceAnalyzer::MainWidget::try_create());
|
||||
window->set_main_widget(main_widget);
|
||||
|
||||
auto& breadcrumbbar = *main_widget->find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
|
||||
auto& tree_map_widget = *main_widget->find_descendant_of_type_named<SpaceAnalyzer::TreeMapWidget>("tree_map");
|
||||
auto& statusbar = *main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||
|
|
Loading…
Add table
Reference in a new issue