summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-12-22 12:55:11 +0100
committerAndreas Kling <kling@serenityos.org>2022-12-23 23:27:45 +0100
commit98fa3736ed016288db60be93e4671167bb852f35 (patch)
treecabcaa60eea775c13ddcd5cba61c284dd2a8b929 /Userland/DevTools
parent661c02b91484fbdeba0efe32d2f03afa9c3cb954 (diff)
downloadserenity-98fa3736ed016288db60be93e4671167bb852f35.zip
HackStudio: Open projects after the action tab was created
This change also removes the path argument from the GitWidget constructor because otherwise, the app wouldn't work now, as it doesn't yet know the project path. But it'll be set right away in open_project(), so nothing's lost. :^)
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/HackStudio/Git/GitWidget.cpp3
-rw-r--r--Userland/DevTools/HackStudio/Git/GitWidget.h2
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp17
3 files changed, 10 insertions, 12 deletions
diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp
index dd47d4227e..81778cad46 100644
--- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp
+++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp
@@ -22,8 +22,7 @@
namespace HackStudio {
-GitWidget::GitWidget(DeprecatedString const& repo_root)
- : m_repo_root(repo_root)
+GitWidget::GitWidget()
{
set_layout<GUI::HorizontalBoxLayout>();
diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.h b/Userland/DevTools/HackStudio/Git/GitWidget.h
index 47c0f07609..7bc7180a37 100644
--- a/Userland/DevTools/HackStudio/Git/GitWidget.h
+++ b/Userland/DevTools/HackStudio/Git/GitWidget.h
@@ -27,7 +27,7 @@ public:
void change_repo(DeprecatedString const& repo_root);
private:
- explicit GitWidget(DeprecatedString const& repo_root);
+ explicit GitWidget();
bool initialize();
bool initialize_if_needed();
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 1d15bd3d4a..9177f3e4e3 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -88,8 +88,6 @@ ErrorOr<NonnullRefPtr<HackStudioWidget>> HackStudioWidget::create(DeprecatedStri
widget->set_layout<GUI::VerticalBoxLayout>();
widget->layout()->set_spacing(2);
- widget->open_project(path_to_project);
-
auto& toolbar_container = widget->add<GUI::ToolbarContainer>();
auto& outer_splitter = widget->add<GUI::HorizontalSplitter>();
@@ -98,14 +96,17 @@ ErrorOr<NonnullRefPtr<HackStudioWidget>> HackStudioWidget::create(DeprecatedStri
auto& left_hand_splitter = outer_splitter.add<GUI::VerticalSplitter>();
left_hand_splitter.layout()->set_spacing(6);
left_hand_splitter.set_preferred_width(150);
- widget->create_project_tab(left_hand_splitter);
widget->m_project_tree_view_context_menu = widget->create_project_tree_view_context_menu();
- widget->create_open_files_view(left_hand_splitter);
-
widget->m_right_hand_splitter = outer_splitter.add<GUI::VerticalSplitter>();
widget->m_right_hand_stack = widget->m_right_hand_splitter->add<GUI::StackWidget>();
+ TRY(widget->create_action_tab(*widget->m_right_hand_splitter));
+
+ widget->open_project(path_to_project);
+ widget->create_project_tab(left_hand_splitter);
+ widget->create_open_files_view(left_hand_splitter);
+
// Put a placeholder widget front & center since we don't have a file open yet.
widget->m_right_hand_stack->add<GUI::Widget>();
@@ -126,8 +127,6 @@ ErrorOr<NonnullRefPtr<HackStudioWidget>> HackStudioWidget::create(DeprecatedStri
widget->m_save_as_action = widget->create_save_as_action();
widget->m_new_project_action = widget->create_new_project_action();
- TRY(widget->create_action_tab(*widget->m_right_hand_splitter));
-
widget->m_add_editor_tab_widget_action = widget->create_add_editor_tab_widget_action();
widget->m_add_editor_action = widget->create_add_editor_action();
widget->m_add_terminal_action = widget->create_add_terminal_action();
@@ -257,7 +256,7 @@ void HackStudioWidget::open_project(DeprecatedString const& root_path)
m_project_tree_view->set_model(m_project->model());
m_project_tree_view->update();
}
- if (m_git_widget && m_git_widget->initialized()) {
+ if (m_git_widget->initialized()) {
m_git_widget->change_repo(root_path);
m_git_widget->refresh();
}
@@ -1327,7 +1326,7 @@ ErrorOr<void> HackStudioWidget::create_action_tab(GUI::Widget& parent)
};
m_disassembly_widget = m_action_tab_widget->add_tab<DisassemblyWidget>("Disassembly");
- m_git_widget = m_action_tab_widget->add_tab<GitWidget>("Git", m_project->root_path());
+ m_git_widget = m_action_tab_widget->add_tab<GitWidget>("Git");
m_git_widget->set_view_diff_callback([this](auto const& original_content, auto const& diff) {
m_diff_viewer->set_content(original_content, diff);
set_edit_mode(EditMode::Diff);