NewProjectDialog.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2021, Nick Vella <nick@nxk.io>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include "ProjectTemplatesModel.h"
  9. #include <DevTools/HackStudio/ProjectTemplate.h>
  10. #include <AK/Result.h>
  11. #include <LibGUI/Button.h>
  12. #include <LibGUI/Dialog.h>
  13. #include <LibGUI/Label.h>
  14. #include <LibGUI/TextBox.h>
  15. namespace HackStudio {
  16. class NewProjectDialog : public GUI::Dialog {
  17. C_OBJECT(NewProjectDialog);
  18. public:
  19. static ExecResult show(GUI::Window* parent_window);
  20. Optional<String> created_project_path() const { return m_created_project_path; }
  21. private:
  22. NewProjectDialog(GUI::Window* parent);
  23. virtual ~NewProjectDialog() override = default;
  24. void update_dialog();
  25. Optional<String> get_available_project_name();
  26. Optional<String> get_project_full_path();
  27. void do_create_project();
  28. RefPtr<ProjectTemplate> selected_template();
  29. NonnullRefPtr<ProjectTemplatesModel> m_model;
  30. bool m_input_valid { false };
  31. RefPtr<GUI::Widget> m_icon_view_container;
  32. RefPtr<GUI::IconView> m_icon_view;
  33. RefPtr<GUI::Label> m_description_label;
  34. RefPtr<GUI::TextBox> m_name_input;
  35. RefPtr<GUI::TextBox> m_create_in_input;
  36. RefPtr<GUI::Label> m_full_path_label;
  37. RefPtr<GUI::Button> m_ok_button;
  38. RefPtr<GUI::Button> m_cancel_button;
  39. RefPtr<GUI::Button> m_browse_button;
  40. Optional<String> m_created_project_path;
  41. };
  42. }