UnsavedChangesDialog.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 <AzCore/Memory/SystemAllocator.h>
  11. #include <QDialog>
  12. #endif
  13. namespace Ui
  14. {
  15. class UnsavedChangesDialog;
  16. }
  17. namespace ScriptCanvasEditor
  18. {
  19. enum class UnsavedChangesOptions
  20. {
  21. SAVE,
  22. CONTINUE_WITHOUT_SAVING,
  23. CANCEL_WITHOUT_SAVING,
  24. INVALID
  25. };
  26. class UnsavedChangesDialog
  27. : public QDialog
  28. {
  29. Q_OBJECT
  30. public:
  31. AZ_CLASS_ALLOCATOR(UnsavedChangesDialog, AZ::SystemAllocator);
  32. UnsavedChangesDialog(const QString& filename, QWidget* pParent = nullptr);
  33. UnsavedChangesOptions GetResult() const { return m_result; }
  34. protected:
  35. void OnSaveButton(bool clicked);
  36. void OnContinueWithoutSavingButton(bool clicked);
  37. void OnCancelWithoutSavingButton(bool clicked);
  38. Ui::UnsavedChangesDialog* ui;
  39. UnsavedChangesOptions m_result = UnsavedChangesOptions::INVALID;
  40. };
  41. }