FileSelectionPage.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <QCheckBox>
  11. #include <QFileDialog>
  12. #include <QLabel>
  13. #include <QLineEdit>
  14. #include <QPushButton>
  15. #include <QString>
  16. #include <QWizardPage>
  17. #endif
  18. #include <AzCore/std/smart_ptr/unique_ptr.h>
  19. namespace AzToolsFramework
  20. {
  21. class ReflectedPropertyEditor;
  22. }
  23. namespace ROS2RobotImporter
  24. {
  25. struct SdfAssetBuilderSettings;
  26. }
  27. namespace ROS2RobotImporter
  28. {
  29. class FileSelectionPage : public QWizardPage
  30. {
  31. Q_OBJECT
  32. public:
  33. explicit FileSelectionPage(QWizard* parent);
  34. // The destructor is defaulted in the cpp file to allow the unique_ptr<SdfAssetBuilderSettings>
  35. // to not need a complete type in the header
  36. ~FileSelectionPage();
  37. bool isComplete() const override;
  38. QString getFileName() const;
  39. const SdfAssetBuilderSettings& GetSdfAssetBuilderSettings() const;
  40. private:
  41. QFileDialog* m_fileDialog;
  42. QPushButton* m_button;
  43. QLineEdit* m_textEdit;
  44. AZStd::unique_ptr<SdfAssetBuilderSettings> m_sdfAssetBuilderSettings;
  45. AzToolsFramework::ReflectedPropertyEditor* m_sdfAssetBuilderSettingsEditor{};
  46. void onLoadButtonPressed();
  47. void onFileSelected(const QString& file);
  48. void onEditingFinished();
  49. //! Refresh the default path in the file dialog based either on what was previously selected
  50. //! or what was entered in on the text edit line.
  51. void RefreshDefaultPath();
  52. bool m_fileExists{ false };
  53. };
  54. } // namespace ROS2RobotImporter