SQLStudio: Port to GML Compilation

This commit is contained in:
Aryan Baburajan 2024-04-02 14:41:26 +05:30 committed by Tim Schumacher
parent 3336d00241
commit def486305a
Notes: sideshowbarker 2024-07-16 23:34:44 +09:00
5 changed files with 10 additions and 23 deletions

View file

@ -4,16 +4,13 @@ serenity_component(
TARGETS SQLStudio
)
stringify_gml(SQLStudio.gml SQLStudioGML.h sql_studio_gml)
compile_gml(SQLStudio.gml SQLStudioGML.cpp)
set(SOURCES
main.cpp
MainWidget.cpp
ScriptEditor.cpp
)
set(GENERATED_SOURCES
SQLStudioGML.h
SQLStudioGML.cpp
)
serenity_app(SQLStudio ICON app-sql-studio)

View file

@ -6,7 +6,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <DevTools/SQLStudio/SQLStudioGML.h>
#include <LibCore/DirIterator.h>
#include <LibCore/StandardPaths.h>
#include <LibDesktop/Launcher.h>
@ -60,17 +59,7 @@ static Vector<ByteString> lookup_database_names()
return database_names;
}
ErrorOr<NonnullRefPtr<MainWidget>> MainWidget::create()
{
auto widget = TRY(try_make_ref_counted<MainWidget>());
TRY(widget->load_from_gml(sql_studio_gml));
TRY(widget->setup());
return widget;
}
ErrorOr<void> MainWidget::setup()
ErrorOr<void> MainWidget::initialize()
{
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv)), [this](auto&) {
open_new_script();

View file

@ -9,6 +9,8 @@
#include <AK/LexicalPath.h>
#include <AK/Vector.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/TableView.h>
#include <LibGUI/Widget.h>
#include <LibSQL/SQLClient.h>
@ -21,7 +23,8 @@ class MainWidget : public GUI::Widget {
public:
virtual ~MainWidget() = default;
static ErrorOr<NonnullRefPtr<MainWidget>> create();
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
ErrorOr<void> initialize();
ErrorOr<void> initialize_menu(GUI::Window*);
void open_new_script();
@ -30,8 +33,6 @@ public:
bool request_close();
private:
ErrorOr<void> setup();
ScriptEditor* active_editor();
void update_title();

View file

@ -12,12 +12,12 @@
@GUI::TabWidget {
name: "script_tab_widget"
reorder_allowed: true
show_close_buttons: true
close_button_enabled: true
}
@GUI::TabWidget {
name: "action_tab_widget"
show_close_buttons: true
close_button_enabled: true
visible: false
}
}

View file

@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_icon(app_icon.bitmap_for_size(16));
window->set_title("SQL Studio");
auto main_widget = TRY(MainWidget::create());
auto main_widget = TRY(MainWidget::try_create());
window->set_main_widget(main_widget);
TRY(main_widget->initialize_menu(window));