mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-08 04:50:08 +03:00
5e1499d104
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
80 lines
2.2 KiB
C++
80 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) 2022, Dylan Katz <dykatz@uw.edu>
|
|
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/LexicalPath.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibGUI/Widget.h>
|
|
#include <LibSQL/SQLClient.h>
|
|
|
|
namespace SQLStudio {
|
|
|
|
class ScriptEditor;
|
|
|
|
class MainWidget : public GUI::Widget {
|
|
C_OBJECT_ABSTRACT(MainWidget)
|
|
|
|
public:
|
|
virtual ~MainWidget() = default;
|
|
static ErrorOr<NonnullRefPtr<MainWidget>> create();
|
|
|
|
ErrorOr<void> initialize_menu(GUI::Window*);
|
|
void open_new_script();
|
|
void open_script_from_file(LexicalPath const&);
|
|
|
|
bool request_close();
|
|
|
|
private:
|
|
ErrorOr<void> setup();
|
|
|
|
ScriptEditor* active_editor();
|
|
|
|
void update_title();
|
|
void on_editor_change();
|
|
void update_statusbar(ScriptEditor*);
|
|
void update_editor_actions(ScriptEditor*);
|
|
|
|
virtual void drag_enter_event(GUI::DragEvent&) override;
|
|
virtual void drop_event(GUI::DropEvent&) override;
|
|
|
|
RefPtr<GUI::Action> m_new_action;
|
|
RefPtr<GUI::Action> m_open_action;
|
|
RefPtr<GUI::Action> m_save_action;
|
|
RefPtr<GUI::Action> m_save_as_action;
|
|
RefPtr<GUI::Action> m_save_all_action;
|
|
RefPtr<GUI::Action> m_copy_action;
|
|
RefPtr<GUI::Action> m_cut_action;
|
|
RefPtr<GUI::Action> m_paste_action;
|
|
RefPtr<GUI::Action> m_undo_action;
|
|
RefPtr<GUI::Action> m_redo_action;
|
|
RefPtr<GUI::Action> m_connect_to_database_action;
|
|
RefPtr<GUI::Action> m_run_script_action;
|
|
|
|
int m_new_script_counter { 1 };
|
|
RefPtr<GUI::ComboBox> m_databases_combo_box;
|
|
RefPtr<GUI::TabWidget> m_tab_widget;
|
|
RefPtr<GUI::Statusbar> m_statusbar;
|
|
RefPtr<GUI::TabWidget> m_action_tab_widget;
|
|
RefPtr<GUI::Widget> m_query_results_widget;
|
|
RefPtr<GUI::TableView> m_query_results_table_view;
|
|
|
|
RefPtr<SQL::SQLClient> m_sql_client;
|
|
Optional<SQL::ConnectionID> m_connection_id;
|
|
Vector<ByteString> m_result_column_names;
|
|
Vector<Vector<ByteString>> m_results;
|
|
|
|
void read_next_sql_statement_of_editor();
|
|
Optional<ByteString> read_next_line_of_editor();
|
|
size_t m_current_line_for_parsing { 0 };
|
|
int m_editor_line_level { 0 };
|
|
};
|
|
|
|
}
|
|
|
|
using SQLStudio::MainWidget;
|