mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 10:36:24 +00:00
SQLStudio: Port to GML Compilation
This commit is contained in:
parent
3336d00241
commit
def486305a
|
@ -4,16 +4,13 @@ serenity_component(
|
||||||
TARGETS SQLStudio
|
TARGETS SQLStudio
|
||||||
)
|
)
|
||||||
|
|
||||||
stringify_gml(SQLStudio.gml SQLStudioGML.h sql_studio_gml)
|
compile_gml(SQLStudio.gml SQLStudioGML.cpp)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
MainWidget.cpp
|
MainWidget.cpp
|
||||||
ScriptEditor.cpp
|
ScriptEditor.cpp
|
||||||
)
|
SQLStudioGML.cpp
|
||||||
|
|
||||||
set(GENERATED_SOURCES
|
|
||||||
SQLStudioGML.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(SQLStudio ICON app-sql-studio)
|
serenity_app(SQLStudio ICON app-sql-studio)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <DevTools/SQLStudio/SQLStudioGML.h>
|
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
#include <LibCore/StandardPaths.h>
|
#include <LibCore/StandardPaths.h>
|
||||||
#include <LibDesktop/Launcher.h>
|
#include <LibDesktop/Launcher.h>
|
||||||
|
@ -60,17 +59,7 @@ static Vector<ByteString> lookup_database_names()
|
||||||
return database_names;
|
return database_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<NonnullRefPtr<MainWidget>> MainWidget::create()
|
ErrorOr<void> MainWidget::initialize()
|
||||||
{
|
|
||||||
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()
|
|
||||||
{
|
{
|
||||||
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&) {
|
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();
|
open_new_script();
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#include <LibGUI/ComboBox.h>
|
||||||
|
#include <LibGUI/TableView.h>
|
||||||
#include <LibGUI/Widget.h>
|
#include <LibGUI/Widget.h>
|
||||||
#include <LibSQL/SQLClient.h>
|
#include <LibSQL/SQLClient.h>
|
||||||
|
|
||||||
|
@ -21,7 +23,8 @@ class MainWidget : public GUI::Widget {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~MainWidget() = default;
|
virtual ~MainWidget() = default;
|
||||||
static ErrorOr<NonnullRefPtr<MainWidget>> create();
|
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
|
||||||
|
ErrorOr<void> initialize();
|
||||||
|
|
||||||
ErrorOr<void> initialize_menu(GUI::Window*);
|
ErrorOr<void> initialize_menu(GUI::Window*);
|
||||||
void open_new_script();
|
void open_new_script();
|
||||||
|
@ -30,8 +33,6 @@ public:
|
||||||
bool request_close();
|
bool request_close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ErrorOr<void> setup();
|
|
||||||
|
|
||||||
ScriptEditor* active_editor();
|
ScriptEditor* active_editor();
|
||||||
|
|
||||||
void update_title();
|
void update_title();
|
||||||
|
|
|
@ -12,12 +12,12 @@
|
||||||
@GUI::TabWidget {
|
@GUI::TabWidget {
|
||||||
name: "script_tab_widget"
|
name: "script_tab_widget"
|
||||||
reorder_allowed: true
|
reorder_allowed: true
|
||||||
show_close_buttons: true
|
close_button_enabled: true
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::TabWidget {
|
@GUI::TabWidget {
|
||||||
name: "action_tab_widget"
|
name: "action_tab_widget"
|
||||||
show_close_buttons: true
|
close_button_enabled: true
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
window->set_title("SQL Studio");
|
window->set_title("SQL Studio");
|
||||||
|
|
||||||
auto main_widget = TRY(MainWidget::create());
|
auto main_widget = TRY(MainWidget::try_create());
|
||||||
window->set_main_widget(main_widget);
|
window->set_main_widget(main_widget);
|
||||||
TRY(main_widget->initialize_menu(window));
|
TRY(main_widget->initialize_menu(window));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue